### Install Project Dependencies Source: https://github.com/astrskai/astrsk/blob/develop/apps/electron/README.md Run this command to install all necessary project dependencies. ```bash $ npm install ``` -------------------------------- ### Start Development Server Source: https://github.com/astrskai/astrsk/blob/develop/apps/electron/README.md Use this command to start the development server and begin working on the application. ```bash $ npm run dev ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/CONTRIBUTING.md Install dependencies for the web application and optionally for the desktop application. ```bash # Web app dependencies cd apps/web npm install # Desktop app dependencies (optional) cd ../desktop npm install ``` -------------------------------- ### Start Development Servers Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/CONTRIBUTING.md Start the development server for the web application and the desktop application in separate terminals. ```bash # For web app cd apps/web npm run dev # For desktop app (in a separate terminal) cd apps/desktop npm run dev ``` -------------------------------- ### Install Web App Dependencies Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/README_temp.md Navigate to the web app directory and install its dependencies using npm. ```bash cd apps/web npm install ``` -------------------------------- ### Install Desktop App Dependencies Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/README_temp.md Navigate to the desktop app directory and install its dependencies using npm. ```bash cd apps/desktop npm install ``` -------------------------------- ### Set Up Local Environment Variables Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/CONTRIBUTING.md Copy the example environment file to create your local environment configuration. ```bash # Copy the example environment file cp .env.example .env.local ``` -------------------------------- ### Install Astrsk Design System Source: https://github.com/astrskai/astrsk/blob/develop/packages/design-system/src/Introduction.mdx Install the design system package using npm or pnpm. ```bash npm install @astrsk/design-system # or pnpm add @astrsk/design-system ``` -------------------------------- ### Start Desktop App Development Mode Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/README_temp.md Start the desktop application in development mode. It defaults to http://localhost:5173, but can be overridden using the MAIN_VITE_PWA_URL environment variable. ```bash # Default .env.development already points to http://localhost:5173 # To use a different URL, modify .env.development or set: export MAIN_VITE_PWA_URL=http://your-dev-url:port npm run dev ``` -------------------------------- ### Development Command: Start PWA Dev Server Source: https://github.com/astrskai/astrsk/blob/develop/CLAUDE.md Use this command to start the Progressive Web App development server. ```bash pnpm dev:pwa ``` -------------------------------- ### Clone astrsk.ai Repository Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/README_temp.md Clone the astrsk.ai repository to get started with the project locally. ```bash git clone https://github.com/harpychat/astrsk.ai.git cd astrsk.ai ``` -------------------------------- ### Run PWA Development Server Source: https://github.com/astrskai/astrsk/blob/develop/README.md Command to start the PWA development server. Displays local and network addresses upon successful startup. ```bash $ pnpm dev:pwa ... pwa:dev: VITE v6.3.5 ready in 500 ms pwa:dev: pwa:dev: ➜ Local: https://localhost:5173/ pwa:dev: ➜ Network: https://172.30.1.34:5173/ pwa:dev: ➜ Network: https://169.254.224.249:5173/ pwa:dev: ➜ press h + enter to show help ``` -------------------------------- ### Add Vite Basic SSL Plugin Source: https://github.com/astrskai/astrsk/blob/develop/README.md Installs the @vitejs/plugin-basic-ssl development dependency for PWA self-hosting. ```bash $ pnpm --filter pwa add -D @vitejs/plugin-basic-ssl ``` -------------------------------- ### Run Development Mode with Hot Reload Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/GEMINI.md Use this command to start the development server with hot reloading enabled for rapid iteration. ```bash npm run dev ``` -------------------------------- ### Complete Example: Update Node Position with Optimistic Updates Source: https://github.com/astrskai/astrsk/blob/develop/TANSTACK_QUERY.md A comprehensive example demonstrating optimistic updates for changing a node's position within a flow. It includes cancelling queries, snapshotting, optimistic cache updates, error rollback, and final server synchronization. ```typescript export const useUpdateNodePosition = (flowId: string) => { const queryClient = useQueryClient(); return useMutation({ mutationFn: async ({ nodeId, position }: { nodeId: string; position: { x: number; y: number } }) => { return FlowService.updateNodePosition(flowId, nodeId, position); }, onMutate: async ({ nodeId, position }) => { // Cancel ongoing queries await queryClient.cancelQueries({ queryKey: flowKeys.nodes(flowId) }); // Snapshot const previousNodes = queryClient.getQueryData(flowKeys.nodes(flowId)); // Optimistic update queryClient.setQueryData(flowKeys.nodes(flowId), (old: Node[]) => old.map(node => node.id === nodeId ? { ...node, position } : node ) ); return { previousNodes }; }, onError: (err, variables, context) => { // Rollback if (context?.previousNodes) { queryClient.setQueryData(flowKeys.nodes(flowId), context.previousNodes); } toast.error('Failed to update node position'); }, onSettled: () => { // Sync with server queryClient.invalidateQueries({ queryKey: flowKeys.nodes(flowId) }); } }); }; ``` -------------------------------- ### TopNavigation Transparency Example Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/docs/sort-dialog-usage.md Demonstrates how to enable transparency mode on the TopNavigation component using the `transparent` and `transparencyLevel` props. This is useful for overlay scenarios. ```typescript } rightAction={} /> ``` -------------------------------- ### Development Commands for Astrsk PWA Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/README.md Provides commands to start the development server for the Astrsk PWA. Use the monorepo root command or navigate to the PWA directory. ```bash # From monorepo root pnpm dev:pwa # Or from this directory pnpm dev ``` -------------------------------- ### Container/Presenter Pattern Example Source: https://github.com/astrskai/astrsk/blob/develop/CLAUDE.md Separate data fetching and business logic (Container) from UI rendering (Presenter) for cleaner, more maintainable components. ```typescript // Container (data logic) export const SessionPanelContainer = () => { const { data } = useSessionQuery(sessionId); return ; }; // Presenter (UI only) export const SessionPanel = ({ session }) => { return
{session.name}
; }; ``` -------------------------------- ### LabeledInput Component Examples Source: https://github.com/astrskai/astrsk/blob/develop/packages/design-system/README.md Demonstrates LabeledInput with various configurations, including different `labelPosition` values ('top', 'left', 'inner'), hints, and error messages. ```tsx ``` -------------------------------- ### Conventional Commits Examples Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/CONTRIBUTING.md Examples of commit messages following the Conventional Commits specification for features, bug fixes, documentation, and breaking changes. ```bash # Feature feat(flow-editor): add branching logic for narrative flows # Bug fix fix(session): resolve memory leak in session cleanup # Documentation docs: update API documentation for v2.0 # With breaking change feat(agent)!: redesign agent configuration schema BREAKING CHANGE: Agent config now requires explicit provider selection ``` -------------------------------- ### Adaptive Component Pattern Example Source: https://github.com/astrskai/astrsk/blob/develop/CLAUDE.md Implement responsive behavior within a single component using hooks like `useBreakpoint`. Avoid creating separate mobile-specific files (`-mobile.tsx`). ```typescript // GOOD: Single component with responsive behavior export const SessionPanel = () => { const { isMobile } = useBreakpoint(); return isMobile ? : ; }; // BAD: Separate mobile file (FORBIDDEN) // session-panel-mobile.tsx ``` -------------------------------- ### Feature Flag Usage Example Source: https://github.com/astrskai/astrsk/blob/develop/CLAUDE.md Demonstrates how to use the Feature Flag context to check if a feature is enabled. Requires the FeatureFlagContext to be set up. ```typescript const isEnabled = useFeatureFlag(FEATURE_FLAGS.EXPERIMENTAL_FEATURE_X); ``` -------------------------------- ### Write Unit Tests with Vitest Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/CONTRIBUTING.md Example of writing a unit test for the Agent class using Vitest, asserting the creation of an agent with valid properties. ```typescript import { describe, it, expect } from 'vitest'; import { Agent } from './agent'; describe('Agent', () => { it('should create agent with valid properties', () => { const agent = Agent.create({ name: 'Test Agent', prompt: 'You are a helpful assistant', providerId: 'openai' }); expect(agent.isOk()).toBe(true); expect(agent.value.name).toBe('Test Agent'); }); }); ``` -------------------------------- ### Measure Initialization Time Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/INITIALIZATION_SYSTEM.md Measure the total time taken for application initialization by recording the start time and calculating the difference after all initialization tasks are complete. ```typescript const startTime = performance.now(); // ... initialization ... const initTime = performance.now() - startTime; logger.debug(`✅ Initialization completed in ${Math.round(initTime)}ms`); ``` -------------------------------- ### Setup DesignSystemProvider with Next.js Image Optimization Source: https://github.com/astrskai/astrsk/blob/develop/packages/design-system/README.md Wrap your application with DesignSystemProvider to enable framework-specific image optimization. This is useful for components like CharacterCard and SessionCard. ```tsx // app/providers.tsx or _app.tsx import { DesignSystemProvider } from '@astrsk/design-system'; import Image from 'next/image'; export function Providers({ children }: { children: React.ReactNode }) { return ( ( {alt} )} > {children} ); } ``` -------------------------------- ### Override Theme Variables with CSS Source: https://github.com/astrskai/astrsk/blob/develop/packages/design-system/README.md Demonstrates how to customize the design system's appearance by redefining CSS variables in your global CSS file. Includes examples for backgrounds, foregrounds, borders, inputs, and buttons. ```css :root { /* Backgrounds */ --bg-canvas: #000000; --bg-surface: #0a0a0c; /* Foreground */ --fg-default: #ffffff; --fg-muted: #e2e2e8; --fg-subtle: #9898a4; /* Borders */ --border-default: #232328; --border-focus: #5b82ba; /* Input */ --input-bg: #232328; --input-border: #3a3a42; /* Button */ --btn-primary-bg: #4a6fa5; --btn-primary-fg: #ffffff; } ``` -------------------------------- ### Build for Production Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/GEMINI.md Execute this command to create an optimized production build of the application. ```bash npm run build ``` -------------------------------- ### Preview Production Build Source: https://github.com/astrskai/astrsk/blob/develop/apps/pwa/GEMINI.md Use this command to preview the production build locally before deployment. ```bash npm run preview ``` -------------------------------- ### Build Application for Windows Source: https://github.com/astrskai/astrsk/blob/develop/apps/electron/README.md Execute this command to build the application specifically for the Windows platform. ```bash # For windows $ npm run build:win ``` -------------------------------- ### Build Application for Linux Source: https://github.com/astrskai/astrsk/blob/develop/apps/electron/README.md Execute this command to build the application specifically for the Linux platform. ```bash # For Linux $ npm run build:linux ``` -------------------------------- ### LabeledTextarea Component Configurations Source: https://github.com/astrskai/astrsk/blob/develop/packages/design-system/README.md Examples of LabeledTextarea with different labels, hints, and error messages, similar to LabeledInput. ```tsx ``` -------------------------------- ### Textarea Component Usage Source: https://github.com/astrskai/astrsk/blob/develop/packages/design-system/README.md Basic examples of the Textarea component, showing a default placeholder and adjusting the number of rows. ```tsx