@dyyz1993/create-agent 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -4
- package/src/__tests__/cli.test.ts +2 -0
- package/src/__tests__/copy.test.ts +110 -122
- package/src/__tests__/create-args.test.ts +113 -0
- package/src/__tests__/templates.test.ts +29 -3
- package/src/__tests__/update.test.ts +129 -0
- package/src/cli.ts +30 -32
- package/src/commands/create.ts +83 -24
- package/src/commands/update.ts +174 -0
- package/src/commands/workspace.ts +26 -6
- package/src/lib/copy.ts +233 -93
- package/src/lib/templates.ts +12 -0
- package/templates/agent/.husky/commit-msg +4 -0
- package/templates/agent/.husky/pre-commit +11 -0
- package/templates/agent/.husky/pre-push +6 -0
- package/templates/agent/.prettierignore +6 -0
- package/templates/agent/.prettierrc +9 -0
- package/templates/agent/CHANGELOG.md +15 -0
- package/templates/agent/commitlint.config.js +8 -0
- package/templates/agent/package.json +19 -4
- package/templates/agent/src/gateway/__tests__/ws-handler-token.test.ts +53 -39
- package/templates/agent/src/mainview/App.tsx +14 -12
- package/templates/agent/src/mainview/__tests__/hooks/use-rpc-init.test.ts +194 -190
- package/templates/agent/src/mainview/components/bash/BashPanel.tsx +210 -189
- package/templates/agent/src/mainview/components/chat/ChatPanel.tsx +45 -20
- package/templates/agent/src/mainview/components/common/ThemeToggle.tsx +41 -21
- package/templates/agent/src/mainview/components/debug/DebugPanel.tsx +181 -114
- package/templates/agent/src/mainview/components/debug/__tests__/DebugPanel.test.tsx +80 -80
- package/templates/agent/src/mainview/components/diff/__tests__/DiffViewerPanel.test.tsx +61 -58
- package/templates/agent/src/mainview/components/feed/FeedPanel.tsx +43 -41
- package/templates/agent/src/mainview/components/file-preview/FilePreviewOverlay.tsx +69 -50
- package/templates/agent/src/mainview/components/file-preview/VirtualizedCodeView.tsx +31 -18
- package/templates/agent/src/mainview/components/git/GitPanel.tsx +731 -490
- package/templates/agent/src/mainview/components/git/__tests__/GitPanel.test.tsx +157 -139
- package/templates/agent/src/mainview/components/layout/AppLayout.tsx +210 -161
- package/templates/agent/src/mainview/components/layout/__tests__/AppLayout.test.tsx +130 -122
- package/templates/agent/src/mainview/components/rules/RulesPanel.tsx +119 -109
- package/templates/agent/src/mainview/components/search/SearchPanel.tsx +123 -117
- package/templates/agent/src/mainview/components/search/__tests__/SearchPanel.test.tsx +64 -44
- package/templates/agent/src/mainview/components/sidebar/__tests__/PinButton.test.tsx +38 -38
- package/templates/agent/src/mainview/components/todo/TodoPanel.tsx +40 -38
- package/templates/agent/src/mainview/components/todo/__tests__/TodoPanel.test.tsx +72 -72
- package/templates/agent/src/mainview/lib/i18n/locales/en.json +175 -155
- package/templates/agent/src/mainview/lib/i18n/locales/zh.json +173 -155
- package/templates/agent/src/mainview/stores/use-app-store.ts +96 -86
- package/templates/agent/src/mainview/stores/use-explorer-store.ts +292 -275
- package/templates/agent/src/mainview/types/index.ts +23 -22
- package/templates/agent/src/mainview/utils/file-icon.tsx +17 -21
- package/templates/agent/src/shared/handlers/chat.ts +53 -53
- package/templates/agent/src/shared/handlers/debug.ts +13 -3
- package/templates/browser-agent/.env.example +19 -0
- package/templates/browser-agent/.husky/commit-msg +4 -0
- package/templates/browser-agent/.husky/pre-commit +11 -0
- package/templates/browser-agent/.husky/pre-push +6 -0
- package/templates/browser-agent/.prettierignore +6 -0
- package/templates/browser-agent/.prettierrc +9 -0
- package/templates/browser-agent/AGENTS.md +396 -0
- package/templates/browser-agent/CHANGELOG.md +15 -0
- package/templates/browser-agent/LICENSE +21 -0
- package/templates/browser-agent/README.md +103 -0
- package/templates/browser-agent/commitlint.config.js +8 -0
- package/templates/browser-agent/electrobun.config.ts +27 -0
- package/templates/browser-agent/electron/main.js +46 -0
- package/templates/browser-agent/electron/preload.js +5 -0
- package/templates/browser-agent/electron-builder.json +40 -0
- package/templates/browser-agent/eslint.config.mjs +79 -0
- package/templates/browser-agent/llms.txt +24 -0
- package/templates/browser-agent/package.json +140 -0
- package/templates/browser-agent/postcss.config.js +6 -0
- package/templates/browser-agent/scripts/dev.ts +138 -0
- package/templates/browser-agent/src/__tests__/hybrid-mode.test.ts +126 -0
- package/templates/browser-agent/src/__tests__/server-config-security.test.ts +55 -0
- package/templates/browser-agent/src/__tests__/server-config.test.ts +59 -0
- package/templates/browser-agent/src/bun/index.ts +130 -0
- package/templates/browser-agent/src/bun/three.d.ts +1 -0
- package/templates/browser-agent/src/gateway/http-routes.ts +1 -0
- package/templates/browser-agent/src/gateway/ipc-transport.ts +68 -0
- package/templates/browser-agent/src/gateway/sse-transport.ts +221 -0
- package/templates/browser-agent/src/mainview/App.tsx +45 -0
- package/templates/browser-agent/src/mainview/__tests__/hooks/use-rpc-init.test.ts +202 -0
- package/templates/browser-agent/src/mainview/__tests__/hooks/use-sidebar-resize.test.ts +127 -0
- package/templates/browser-agent/src/mainview/__tests__/i18n/i18n.test.ts +49 -0
- package/templates/browser-agent/src/mainview/__tests__/setup.ts +40 -0
- package/templates/browser-agent/src/mainview/__tests__/stores/use-chat-store.test.ts +73 -0
- package/templates/browser-agent/src/mainview/__tests__/stores/use-sidebar-store.test.ts +61 -0
- package/templates/browser-agent/src/mainview/__tests__/theme-variables.test.ts +36 -0
- package/templates/browser-agent/src/mainview/components/assets/AssetsPanel.tsx +139 -0
- package/templates/browser-agent/src/mainview/components/chat/ChatPanel.tsx +219 -0
- package/templates/browser-agent/src/mainview/components/chat/CommandBar.tsx +184 -0
- package/templates/browser-agent/src/mainview/components/chat/MessageBubble.tsx +249 -0
- package/templates/browser-agent/src/mainview/components/chat/ToolPicker.tsx +115 -0
- package/templates/browser-agent/src/mainview/components/common/ErrorBoundary.tsx +1 -0
- package/templates/browser-agent/src/mainview/components/common/LanguageSwitcher.tsx +15 -0
- package/templates/browser-agent/src/mainview/components/common/ThemeToggle.tsx +45 -0
- package/templates/browser-agent/src/mainview/components/common/__tests__/ErrorBoundary.test.tsx +74 -0
- package/templates/browser-agent/src/mainview/components/common/__tests__/LanguageSwitcher.test.tsx +44 -0
- package/templates/browser-agent/src/mainview/components/common/__tests__/ThemeToggle.test.tsx +41 -0
- package/templates/browser-agent/src/mainview/components/dev/NetworkPanel.tsx +155 -0
- package/templates/browser-agent/src/mainview/components/layout/AppLayout.tsx +311 -0
- package/templates/browser-agent/src/mainview/components/onboarding/SetupWizard.tsx +310 -0
- package/templates/browser-agent/src/mainview/components/process/ProcessPanel.tsx +329 -0
- package/templates/browser-agent/src/mainview/components/sidebar/SessionSidebar.tsx +122 -0
- package/templates/browser-agent/src/mainview/components/sidebar/SkillSidebar.tsx +115 -0
- package/templates/browser-agent/src/mainview/components/topbar/TopBar.tsx +350 -0
- package/templates/browser-agent/src/mainview/global.d.ts +13 -0
- package/templates/browser-agent/src/mainview/hooks/__tests__/use-breakpoint.test.ts +151 -0
- package/templates/browser-agent/src/mainview/hooks/use-agent-chat.ts +157 -0
- package/templates/browser-agent/src/mainview/hooks/use-breakpoint.ts +68 -0
- package/templates/browser-agent/src/mainview/hooks/use-rpc-init.ts +71 -0
- package/templates/browser-agent/src/mainview/hooks/use-sidebar-resize.ts +40 -0
- package/templates/browser-agent/src/mainview/index.css +71 -0
- package/templates/browser-agent/src/mainview/index.html +12 -0
- package/templates/browser-agent/src/mainview/lib/api-client.ts +397 -0
- package/templates/browser-agent/src/mainview/lib/i18n/index.ts +30 -0
- package/templates/browser-agent/src/mainview/lib/i18n/locales/en.json +130 -0
- package/templates/browser-agent/src/mainview/lib/i18n/locales/zh.json +128 -0
- package/templates/browser-agent/src/mainview/lib/network-bus.ts +92 -0
- package/templates/browser-agent/src/mainview/lib/rpc-cache.ts +94 -0
- package/templates/browser-agent/src/mainview/main.tsx +18 -0
- package/templates/browser-agent/src/mainview/stores/__tests__/use-connection-store.test.ts +26 -0
- package/templates/browser-agent/src/mainview/stores/__tests__/use-locale-store.test.ts +32 -0
- package/templates/browser-agent/src/mainview/stores/__tests__/use-log-store.test.ts +28 -0
- package/templates/browser-agent/src/mainview/stores/__tests__/use-theme-store.test.ts +59 -0
- package/templates/browser-agent/src/mainview/stores/message-batcher.ts +25 -0
- package/templates/browser-agent/src/mainview/stores/use-asset-store.ts +65 -0
- package/templates/browser-agent/src/mainview/stores/use-chat-store.ts +200 -0
- package/templates/browser-agent/src/mainview/stores/use-connection-store.ts +173 -0
- package/templates/browser-agent/src/mainview/stores/use-locale-store.ts +27 -0
- package/templates/browser-agent/src/mainview/stores/use-log-store.ts +16 -0
- package/templates/browser-agent/src/mainview/stores/use-network-panel-store.ts +18 -0
- package/templates/browser-agent/src/mainview/stores/use-record-store.ts +147 -0
- package/templates/browser-agent/src/mainview/stores/use-session-store.ts +151 -0
- package/templates/browser-agent/src/mainview/stores/use-sidebar-store.ts +161 -0
- package/templates/browser-agent/src/mainview/stores/use-theme-store.ts +46 -0
- package/templates/browser-agent/src/mainview/stores/use-view-store.ts +20 -0
- package/templates/browser-agent/src/mainview/types/index.ts +6 -0
- package/templates/browser-agent/src/server-config.ts +45 -0
- package/templates/browser-agent/src/server.ts +78 -0
- package/templates/browser-agent/src/shared/handlers/__tests__/chat-concurrency.test.ts +127 -0
- package/templates/browser-agent/src/shared/handlers/__tests__/chat-handler.test.ts +77 -0
- package/templates/browser-agent/src/shared/handlers/__tests__/file-handler.test.ts +100 -0
- package/templates/browser-agent/src/shared/handlers/__tests__/system-handler.test.ts +55 -0
- package/templates/browser-agent/src/shared/handlers/__tests__/timer-handler.test.ts +77 -0
- package/templates/browser-agent/src/shared/handlers/browser.ts +596 -0
- package/templates/browser-agent/src/shared/handlers/chat.ts +213 -0
- package/templates/browser-agent/src/shared/handlers/file.ts +99 -0
- package/templates/browser-agent/src/shared/handlers/index.ts +7 -0
- package/templates/browser-agent/src/shared/handlers/session.ts +167 -0
- package/templates/browser-agent/src/shared/handlers/system.ts +27 -0
- package/templates/browser-agent/src/shared/handlers/timer.ts +34 -0
- package/templates/browser-agent/src/shared/http-routes.ts +437 -0
- package/templates/browser-agent/src/shared/lib/__tests__/logger.test.ts +92 -0
- package/templates/browser-agent/src/shared/lib/__tests__/path-security.test.ts +77 -0
- package/templates/browser-agent/src/shared/lib/__tests__/web-server.test.ts +203 -0
- package/templates/browser-agent/src/shared/lib/agent.ts +384 -0
- package/templates/browser-agent/src/shared/lib/cdp.ts +448 -0
- package/templates/browser-agent/src/shared/lib/generate.ts +111 -0
- package/templates/browser-agent/src/shared/lib/logger.ts +152 -0
- package/templates/browser-agent/src/shared/lib/mock-stream.ts +147 -0
- package/templates/browser-agent/src/shared/lib/path-security.ts +38 -0
- package/templates/browser-agent/src/shared/lib/port-registry.ts +103 -0
- package/templates/browser-agent/src/shared/lib/web-server.ts +127 -0
- package/templates/browser-agent/src/shared/lib/xhs-extract.ts +71 -0
- package/templates/browser-agent/src/shared/modules/browser.ts +86 -0
- package/templates/browser-agent/src/shared/modules/chat.ts +20 -0
- package/templates/browser-agent/src/shared/modules/file.ts +40 -0
- package/templates/browser-agent/src/shared/modules/session.ts +55 -0
- package/templates/browser-agent/src/shared/modules/system.ts +8 -0
- package/templates/browser-agent/src/shared/modules/timer.ts +11 -0
- package/templates/browser-agent/src/shared/register-all-handlers.ts +36 -0
- package/templates/browser-agent/src/shared/rpc-schema.ts +34 -0
- package/templates/browser-agent/tailwind.config.js +15 -0
- package/templates/browser-agent/tsconfig.ipc.json +14 -0
- package/templates/browser-agent/tsconfig.json +36 -0
- package/templates/browser-agent/vite.config.ts +3 -0
- package/templates/browser-agent/vitest.config.ts +3 -0
- package/templates/chat/.husky/commit-msg +4 -0
- package/templates/chat/.husky/pre-commit +11 -0
- package/templates/chat/.husky/pre-push +6 -0
- package/templates/chat/CHANGELOG.md +15 -0
- package/templates/chat/commitlint.config.js +8 -0
- package/templates/chat/package.json +19 -4
- package/templates/chat/src/mainview/__tests__/hooks/use-input-history.test.ts +125 -0
- package/templates/chat/src/mainview/__tests__/setup.ts +32 -29
- package/templates/chat/src/mainview/components/chat/ChatPanel.tsx +80 -55
- package/templates/chat/src/mainview/components/common/ThemeToggle.tsx +40 -20
- package/templates/chat/src/mainview/lib/i18n/locales/en.json +175 -155
- package/templates/chat/src/mainview/lib/i18n/locales/zh.json +173 -155
- package/templates/chat/src/shared/handlers/chat.ts +17 -19
- package/templates/chat/src/shared/handlers/debug.ts +12 -2
- package/templates/cowork/.env.example +8 -0
- package/templates/cowork/.prettierignore +6 -0
- package/templates/cowork/.prettierrc +9 -0
- package/templates/cowork/AGENTS.md +236 -0
- package/templates/cowork/CHANGELOG.md +15 -0
- package/templates/cowork/LICENSE +21 -0
- package/templates/cowork/README.md +103 -0
- package/templates/cowork/commitlint.config.js +8 -0
- package/templates/cowork/docs/CODE-VIEW-PLAN.md +637 -0
- package/templates/cowork/docs/CODE-VIEW-V2.md +196 -0
- package/templates/cowork/docs/CODE-VIEW-V4.md +150 -0
- package/templates/cowork/electrobun.config.ts +27 -0
- package/templates/cowork/eslint.config.mjs +79 -0
- package/templates/cowork/llms.txt +24 -0
- package/templates/cowork/package.json +87 -0
- package/templates/cowork/postcss.config.js +6 -0
- package/templates/cowork/scripts/dev.ts +138 -0
- package/templates/cowork/src/__tests__/hybrid-mode.test.ts +126 -0
- package/templates/cowork/src/__tests__/server-config-security.test.ts +55 -0
- package/templates/cowork/src/__tests__/server-config.test.ts +59 -0
- package/templates/cowork/src/bun/index.ts +130 -0
- package/templates/cowork/src/bun/three.d.ts +1 -0
- package/templates/cowork/src/gateway/http-routes.ts +1 -0
- package/templates/cowork/src/gateway/ipc-transport.ts +68 -0
- package/templates/cowork/src/gateway/sse-transport.ts +231 -0
- package/templates/cowork/src/mainview/App.tsx +45 -0
- package/templates/cowork/src/mainview/__tests__/hooks/use-rpc-init.test.ts +202 -0
- package/templates/cowork/src/mainview/__tests__/hooks/use-sidebar-resize.test.ts +127 -0
- package/templates/cowork/src/mainview/__tests__/i18n/i18n.test.ts +49 -0
- package/templates/cowork/src/mainview/__tests__/setup.ts +40 -0
- package/templates/cowork/src/mainview/__tests__/stores/use-chat-store.test.ts +73 -0
- package/templates/cowork/src/mainview/__tests__/stores/use-sidebar-store.test.ts +61 -0
- package/templates/cowork/src/mainview/__tests__/theme-variables.test.ts +36 -0
- package/templates/cowork/src/mainview/components/chat/TaskChat.tsx +311 -0
- package/templates/cowork/src/mainview/components/chat/__tests__/localhost-links.test.ts +76 -0
- package/templates/cowork/src/mainview/components/common/ErrorBoundary.tsx +1 -0
- package/templates/cowork/src/mainview/components/common/LanguageSwitcher.tsx +15 -0
- package/templates/cowork/src/mainview/components/common/ThemeToggle.tsx +45 -0
- package/templates/cowork/src/mainview/components/common/__tests__/ErrorBoundary.test.tsx +74 -0
- package/templates/cowork/src/mainview/components/common/__tests__/LanguageSwitcher.test.tsx +44 -0
- package/templates/cowork/src/mainview/components/common/__tests__/ThemeToggle.test.tsx +41 -0
- package/templates/cowork/src/mainview/components/dev/NetworkPanel.tsx +155 -0
- package/templates/cowork/src/mainview/components/layout/AppLayout.tsx +216 -0
- package/templates/cowork/src/mainview/components/right/ArtifactsPanel.tsx +54 -0
- package/templates/cowork/src/mainview/components/right/ContextPanel.tsx +133 -0
- package/templates/cowork/src/mainview/components/right/ElementPicker.tsx +206 -0
- package/templates/cowork/src/mainview/components/right/PreviewBlock.tsx +155 -0
- package/templates/cowork/src/mainview/components/right/ProgressPanel.tsx +85 -0
- package/templates/cowork/src/mainview/components/sidebar/TaskSidebar.tsx +211 -0
- package/templates/cowork/src/mainview/components/topbar/TopBar.tsx +86 -0
- package/templates/cowork/src/mainview/global.d.ts +13 -0
- package/templates/cowork/src/mainview/hooks/__tests__/use-breakpoint.test.ts +123 -0
- package/templates/cowork/src/mainview/hooks/use-breakpoint.ts +53 -0
- package/templates/cowork/src/mainview/hooks/use-rpc-init.ts +26 -0
- package/templates/cowork/src/mainview/hooks/use-sidebar-resize.ts +40 -0
- package/templates/cowork/src/mainview/index.css +89 -0
- package/templates/cowork/src/mainview/index.html +12 -0
- package/templates/cowork/src/mainview/lib/api-client.ts +404 -0
- package/templates/cowork/src/mainview/lib/i18n/index.ts +30 -0
- package/templates/cowork/src/mainview/lib/i18n/locales/en.json +130 -0
- package/templates/cowork/src/mainview/lib/i18n/locales/zh.json +128 -0
- package/templates/cowork/src/mainview/lib/network-bus.ts +92 -0
- package/templates/cowork/src/mainview/lib/rpc-cache.ts +94 -0
- package/templates/cowork/src/mainview/main.tsx +18 -0
- package/templates/cowork/src/mainview/stores/__tests__/use-connection-store.test.ts +26 -0
- package/templates/cowork/src/mainview/stores/__tests__/use-locale-store.test.ts +32 -0
- package/templates/cowork/src/mainview/stores/__tests__/use-log-store.test.ts +28 -0
- package/templates/cowork/src/mainview/stores/__tests__/use-preview-store.test.ts +193 -0
- package/templates/cowork/src/mainview/stores/__tests__/use-sidebar-store.test.ts +81 -0
- package/templates/cowork/src/mainview/stores/__tests__/use-theme-store.test.ts +59 -0
- package/templates/cowork/src/mainview/stores/message-batcher.ts +25 -0
- package/templates/cowork/src/mainview/stores/use-chat-store.ts +198 -0
- package/templates/cowork/src/mainview/stores/use-connection-store.ts +168 -0
- package/templates/cowork/src/mainview/stores/use-context-store.ts +68 -0
- package/templates/cowork/src/mainview/stores/use-locale-store.ts +27 -0
- package/templates/cowork/src/mainview/stores/use-log-store.ts +16 -0
- package/templates/cowork/src/mainview/stores/use-network-panel-store.ts +18 -0
- package/templates/cowork/src/mainview/stores/use-output-store.ts +47 -0
- package/templates/cowork/src/mainview/stores/use-preview-store.ts +97 -0
- package/templates/cowork/src/mainview/stores/use-sidebar-store.ts +272 -0
- package/templates/cowork/src/mainview/stores/use-task-store.ts +86 -0
- package/templates/cowork/src/mainview/stores/use-theme-store.ts +46 -0
- package/templates/cowork/src/mainview/stores/use-view-store.ts +29 -0
- package/templates/cowork/src/mainview/types/index.ts +6 -0
- package/templates/cowork/src/server-config.ts +44 -0
- package/templates/cowork/src/server.ts +78 -0
- package/templates/cowork/src/shared/handlers/__tests__/chat-concurrency.test.ts +127 -0
- package/templates/cowork/src/shared/handlers/__tests__/chat-handler.test.ts +77 -0
- package/templates/cowork/src/shared/handlers/__tests__/file-handler.test.ts +100 -0
- package/templates/cowork/src/shared/handlers/__tests__/preview-handler.test.ts +172 -0
- package/templates/cowork/src/shared/handlers/__tests__/system-handler.test.ts +55 -0
- package/templates/cowork/src/shared/handlers/__tests__/timer-handler.test.ts +77 -0
- package/templates/cowork/src/shared/handlers/chat.ts +213 -0
- package/templates/cowork/src/shared/handlers/context.ts +72 -0
- package/templates/cowork/src/shared/handlers/file.ts +99 -0
- package/templates/cowork/src/shared/handlers/index.ts +9 -0
- package/templates/cowork/src/shared/handlers/output.ts +59 -0
- package/templates/cowork/src/shared/handlers/preview.ts +81 -0
- package/templates/cowork/src/shared/handlers/system.ts +27 -0
- package/templates/cowork/src/shared/handlers/task.ts +101 -0
- package/templates/cowork/src/shared/handlers/timer.ts +34 -0
- package/templates/cowork/src/shared/http-routes.ts +444 -0
- package/templates/cowork/src/shared/lib/__tests__/logger.test.ts +92 -0
- package/templates/cowork/src/shared/lib/__tests__/path-security.test.ts +77 -0
- package/templates/cowork/src/shared/lib/__tests__/web-server.test.ts +203 -0
- package/templates/cowork/src/shared/lib/logger.ts +152 -0
- package/templates/cowork/src/shared/lib/path-security.ts +38 -0
- package/templates/cowork/src/shared/lib/port-registry.ts +103 -0
- package/templates/cowork/src/shared/lib/web-server.ts +127 -0
- package/templates/cowork/src/shared/modules/chat.ts +20 -0
- package/templates/cowork/src/shared/modules/context.ts +32 -0
- package/templates/cowork/src/shared/modules/file.ts +40 -0
- package/templates/cowork/src/shared/modules/output.ts +20 -0
- package/templates/cowork/src/shared/modules/preview.ts +44 -0
- package/templates/cowork/src/shared/modules/system.ts +8 -0
- package/templates/cowork/src/shared/modules/task.ts +31 -0
- package/templates/cowork/src/shared/modules/timer.ts +11 -0
- package/templates/cowork/src/shared/register-all-handlers.ts +36 -0
- package/templates/cowork/src/shared/rpc-schema.ts +38 -0
- package/templates/cowork/tailwind.config.js +15 -0
- package/templates/cowork/test-upload.txt +0 -0
- package/templates/cowork/tsconfig.ipc.json +14 -0
- package/templates/cowork/tsconfig.json +36 -0
- package/templates/cowork/vite.config.ts +3 -0
- package/templates/cowork/vitest.config.ts +3 -0
- package/templates/general/.husky/commit-msg +4 -0
- package/templates/general/.husky/pre-commit +11 -0
- package/templates/general/.husky/pre-push +6 -0
- package/templates/general/CHANGELOG.md +15 -0
- package/templates/general/commitlint.config.js +8 -0
- package/templates/general/package.json +19 -4
- package/templates/general/src/mainview/__tests__/hooks/use-input-history.test.ts +125 -0
- package/templates/general/src/mainview/__tests__/setup.ts +32 -29
- package/templates/general/src/mainview/components/chat/ChatPanel.tsx +80 -55
- package/templates/general/src/mainview/components/common/ThemeToggle.tsx +40 -20
- package/templates/general/src/mainview/components/debug/DebugPanel.tsx +170 -156
- package/templates/general/src/mainview/components/debug/__tests__/DebugPanel.test.tsx +169 -0
- package/templates/general/src/mainview/components/explorer/ConfirmDialog.tsx +42 -42
- package/templates/general/src/mainview/components/explorer/ContextMenu.tsx +72 -67
- package/templates/general/src/mainview/components/feed/FeedPanel.tsx +7 -5
- package/templates/general/src/mainview/components/file-preview/FilePreviewOverlay.tsx +64 -45
- package/templates/general/src/mainview/components/file-preview/VirtualizedCodeView.tsx +24 -7
- package/templates/general/src/mainview/components/git/GitPanel.tsx +700 -473
- package/templates/general/src/mainview/components/layout/AppLayout.tsx +123 -114
- package/templates/general/src/mainview/components/search/SearchPanel.tsx +15 -19
- package/templates/general/src/mainview/lib/i18n/locales/en.json +175 -155
- package/templates/general/src/mainview/lib/i18n/locales/zh.json +173 -155
- package/templates/general/src/mainview/stores/__tests__/use-explorer-store.test.ts +259 -0
- package/templates/general/src/mainview/stores/__tests__/use-feed-store.test.ts +160 -0
- package/templates/general/src/mainview/stores/__tests__/use-git-store.test.ts +313 -0
- package/templates/general/src/mainview/stores/__tests__/use-notification-store.test.ts +115 -0
- package/templates/general/src/mainview/stores/__tests__/use-sidebar-store.test.ts +120 -0
- package/templates/general/src/mainview/stores/use-explorer-store.ts +277 -260
- package/templates/general/src/mainview/types/index.ts +21 -20
- package/templates/general/src/shared/handlers/chat.ts +1 -1
- package/templates/general/src/shared/handlers/debug.ts +12 -2
- package/templates/shared/components/ErrorBoundary.tsx +0 -1
- package/templates/shared/vite-base.config.ts +8 -7
- /package/templates/{shared → browser-agent}/test-upload.txt +0 -0
package/src/lib/copy.ts
CHANGED
|
@@ -1,9 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
readFileSync,
|
|
3
|
+
writeFileSync,
|
|
4
|
+
mkdirSync,
|
|
5
|
+
existsSync,
|
|
6
|
+
readdirSync,
|
|
7
|
+
unlinkSync,
|
|
8
|
+
chmodSync,
|
|
9
|
+
} from "fs";
|
|
10
|
+
import { join, resolve, extname } from "path";
|
|
11
|
+
import { homedir } from "os";
|
|
12
|
+
import { execFileSync } from "child_process";
|
|
13
|
+
import { getRootDir } from "./templates.js";
|
|
4
14
|
|
|
5
15
|
const SKIP_DIRS = new Set(["node_modules", "build", "dist", ".git", ".husky", ".trae"]);
|
|
6
|
-
const SKIP_FILES = new Set(["bun.lock"
|
|
16
|
+
const SKIP_FILES = new Set(["bun.lock"]);
|
|
17
|
+
|
|
18
|
+
const BINARY_EXTENSIONS = new Set([
|
|
19
|
+
".png",
|
|
20
|
+
".jpg",
|
|
21
|
+
".jpeg",
|
|
22
|
+
".gif",
|
|
23
|
+
".webp",
|
|
24
|
+
".ico",
|
|
25
|
+
".icns",
|
|
26
|
+
".ttf",
|
|
27
|
+
".otf",
|
|
28
|
+
".woff",
|
|
29
|
+
".woff2",
|
|
30
|
+
".mp3",
|
|
31
|
+
".mp4",
|
|
32
|
+
".wav",
|
|
33
|
+
".pdf",
|
|
34
|
+
".zip",
|
|
35
|
+
".gz",
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
export function expandTilde(targetPath: string): string {
|
|
39
|
+
if (targetPath === "~") return homedir();
|
|
40
|
+
if (targetPath.startsWith("~/")) return join(homedir(), targetPath.slice(2));
|
|
41
|
+
return targetPath;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isBinaryFile(filePath: string, buffer: Buffer): boolean {
|
|
45
|
+
if (BINARY_EXTENSIONS.has(extname(filePath).toLowerCase())) return true;
|
|
46
|
+
// A NUL byte in the first 8KB almost certainly means binary content;
|
|
47
|
+
// reading such a file as utf-8 would silently corrupt it.
|
|
48
|
+
return buffer.subarray(0, 8192).includes(0);
|
|
49
|
+
}
|
|
7
50
|
|
|
8
51
|
export interface CopyOptions {
|
|
9
52
|
projectName: string;
|
|
@@ -35,14 +78,20 @@ export function copyAndReplace(srcDir: string, destDir: string, projectName: str
|
|
|
35
78
|
} else {
|
|
36
79
|
if (SKIP_FILES.has(entry.name)) continue;
|
|
37
80
|
|
|
38
|
-
|
|
81
|
+
const raw = readFileSync(srcPath);
|
|
82
|
+
|
|
83
|
+
if (isBinaryFile(entry.name, raw)) {
|
|
84
|
+
writeFileSync(destPath, raw);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let content = raw.toString("utf-8");
|
|
39
89
|
|
|
40
90
|
content = content.replace(/pi-agent-template/g, projectName);
|
|
41
91
|
content = content.replace(/Pi Agent Template/g, pascalName);
|
|
42
92
|
content = content.replace(/Pi Agent/g, pascalName);
|
|
43
93
|
content = content.replace(/com\.piagent\.template/g, identifier);
|
|
44
94
|
content = content.replace(/com\.piagent/g, shortId);
|
|
45
|
-
content = content.replace(/@pi-agent\//g, `@${projectName}/`);
|
|
46
95
|
|
|
47
96
|
writeFileSync(destPath, content);
|
|
48
97
|
}
|
|
@@ -66,8 +115,8 @@ function copyTraeRules(monorepoRoot: string, targetDir: string, projectName: str
|
|
|
66
115
|
}
|
|
67
116
|
}
|
|
68
117
|
|
|
69
|
-
function copySharedModules(
|
|
70
|
-
const sharedDir = resolve(
|
|
118
|
+
function copySharedModules(sourceRoot: string, targetDir: string, projectName: string): void {
|
|
119
|
+
const sharedDir = resolve(sourceRoot, "templates", "shared");
|
|
71
120
|
if (!existsSync(sharedDir)) return;
|
|
72
121
|
|
|
73
122
|
const destSharedDir = join(targetDir, "shared");
|
|
@@ -137,76 +186,83 @@ function cleanSharedViteConfig(sharedDir: string): void {
|
|
|
137
186
|
}
|
|
138
187
|
}
|
|
139
188
|
|
|
140
|
-
function resolvePackageVersion(packageName: string): string {
|
|
189
|
+
function resolvePackageVersion(packageName: string, fallbackRange?: string): string {
|
|
141
190
|
try {
|
|
142
|
-
|
|
191
|
+
const version = execFileSync("npm", ["view", packageName, "version"], {
|
|
192
|
+
encoding: "utf-8",
|
|
193
|
+
}).trim();
|
|
194
|
+
return `^${version}`;
|
|
143
195
|
} catch {
|
|
144
|
-
|
|
196
|
+
// Offline / registry failure: keep a usable range instead of silently
|
|
197
|
+
// downgrading the project to an ancient version.
|
|
198
|
+
if (fallbackRange && fallbackRange !== "workspace:*") {
|
|
199
|
+
console.warn(`(Could not look up latest ${packageName}; keeping ${fallbackRange})`);
|
|
200
|
+
return fallbackRange;
|
|
201
|
+
}
|
|
202
|
+
const fallback = NPM_FALLBACK_VERSIONS[packageName];
|
|
203
|
+
if (fallback) {
|
|
204
|
+
console.warn(`(Could not look up latest ${packageName}; falling back to ${fallback})`);
|
|
205
|
+
return fallback;
|
|
206
|
+
}
|
|
207
|
+
console.warn(`(Could not look up latest ${packageName}; keeping ${String(fallbackRange)})`);
|
|
208
|
+
return fallbackRange ?? "*";
|
|
145
209
|
}
|
|
146
210
|
}
|
|
147
211
|
|
|
212
|
+
// Only used when the registry is unreachable AND no usable range is present;
|
|
213
|
+
// bundled templates carry pinned versions via post-sync-templates.mjs.
|
|
214
|
+
const NPM_FALLBACK_VERSIONS: Record<string, string> = {
|
|
215
|
+
"@dyyz1993/rpc-core": "^2.2.0",
|
|
216
|
+
"@dyyz1993/eslint-plugin-rpc": "^1.1.0",
|
|
217
|
+
};
|
|
218
|
+
|
|
148
219
|
const WORKSPACE_PACKAGES = ["@dyyz1993/rpc-core", "@dyyz1993/eslint-plugin-rpc"];
|
|
149
220
|
|
|
150
|
-
function updatePackageJson(targetDir: string,
|
|
221
|
+
function updatePackageJson(targetDir: string, projectName: string): void {
|
|
151
222
|
const rootPkgPath = join(targetDir, "package.json");
|
|
152
223
|
if (!existsSync(rootPkgPath)) return;
|
|
153
224
|
|
|
154
225
|
const rootPkg = JSON.parse(readFileSync(rootPkgPath, "utf-8"));
|
|
155
226
|
|
|
156
227
|
delete rootPkg.workspaces;
|
|
228
|
+
rootPkg.name = projectName;
|
|
157
229
|
|
|
158
230
|
for (const depKey of ["dependencies", "devDependencies"] as const) {
|
|
159
231
|
if (!rootPkg[depKey]) continue;
|
|
160
232
|
for (const pkgName of WORKSPACE_PACKAGES) {
|
|
161
233
|
if (!rootPkg[depKey][pkgName]) continue;
|
|
162
|
-
|
|
163
|
-
const version = resolvePackageVersion(pkgName);
|
|
164
|
-
rootPkg[depKey][pkgName] = `^${version}`;
|
|
165
|
-
} else {
|
|
166
|
-
delete rootPkg[depKey][pkgName];
|
|
167
|
-
}
|
|
234
|
+
rootPkg[depKey][pkgName] = resolvePackageVersion(pkgName, rootPkg[depKey][pkgName]);
|
|
168
235
|
}
|
|
169
236
|
}
|
|
170
237
|
|
|
171
238
|
writeFileSync(rootPkgPath, JSON.stringify(rootPkg, null, "\t") + "\n");
|
|
239
|
+
}
|
|
172
240
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (line.includes("import rpcPlugin") && line.includes("@dyyz1993/eslint-plugin-rpc")) {
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (line.includes("RPC") && line.includes("规范规则")) {
|
|
188
|
-
inRpcSection = true;
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (inRpcSection) {
|
|
193
|
-
if (line.trim().startsWith("'rpc/") || line.trim().startsWith('"rpc/')) {
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
inRpcSection = false;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (line.includes("rpc: rpcPlugin")) {
|
|
200
|
-
continue;
|
|
201
|
-
}
|
|
241
|
+
/**
|
|
242
|
+
* Shared post-processing after raw template files land in the target project.
|
|
243
|
+
* Used by both `create` and `update --force`; skipping it used to leave
|
|
244
|
+
* `workspace:*` deps and `../shared` imports in user projects.
|
|
245
|
+
*/
|
|
246
|
+
export function postProcessTemplate(targetDir: string, projectName: string): void {
|
|
247
|
+
copySharedModules(getRootDir(), targetDir, projectName);
|
|
248
|
+
cleanViteConfig(targetDir);
|
|
249
|
+
updatePackageJson(targetDir, projectName);
|
|
250
|
+
}
|
|
202
251
|
|
|
203
|
-
|
|
252
|
+
function precheckExternalTools(): void {
|
|
253
|
+
const missing: string[] = [];
|
|
254
|
+
for (const tool of ["git", "bun"]) {
|
|
255
|
+
try {
|
|
256
|
+
execFileSync(tool, ["--version"], { stdio: "pipe" });
|
|
257
|
+
} catch {
|
|
258
|
+
missing.push(tool);
|
|
204
259
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
260
|
+
}
|
|
261
|
+
if (missing.length > 0) {
|
|
262
|
+
throw new Error(
|
|
263
|
+
`Required tools not found: ${missing.join(", ")}. ` +
|
|
264
|
+
`Install them before creating a project (bun: https://bun.sh).`
|
|
265
|
+
);
|
|
210
266
|
}
|
|
211
267
|
}
|
|
212
268
|
|
|
@@ -219,6 +275,8 @@ export async function copyTemplate(options: CopyOptions): Promise<void> {
|
|
|
219
275
|
throw new Error(`Directory "${targetDir}" already exists.`);
|
|
220
276
|
}
|
|
221
277
|
|
|
278
|
+
precheckExternalTools();
|
|
279
|
+
|
|
222
280
|
const { identifier } = deriveNames(projectName);
|
|
223
281
|
|
|
224
282
|
console.log(`Creating project: ${projectName}`);
|
|
@@ -229,65 +287,147 @@ export async function copyTemplate(options: CopyOptions): Promise<void> {
|
|
|
229
287
|
copyAndReplace(templateDir, targetDir, projectName);
|
|
230
288
|
if (isMonorepo) {
|
|
231
289
|
copyTraeRules(localRoot, targetDir, projectName);
|
|
232
|
-
copySharedModules(localRoot, targetDir, projectName);
|
|
233
|
-
} else {
|
|
234
|
-
const publishedShared = resolve(import.meta.dir, "..", "..", "templates", "shared");
|
|
235
|
-
if (existsSync(publishedShared)) {
|
|
236
|
-
copyAndReplace(publishedShared, join(targetDir, "shared"), projectName);
|
|
237
|
-
for (const f of ["http-routes.ts", "logger.ts"]) {
|
|
238
|
-
const p = join(targetDir, "shared", f);
|
|
239
|
-
if (existsSync(p)) unlinkSync(p);
|
|
240
|
-
}
|
|
241
|
-
const tsconfigPath = join(targetDir, "tsconfig.json");
|
|
242
|
-
if (existsSync(tsconfigPath)) {
|
|
243
|
-
let tsconfig = readFileSync(tsconfigPath, "utf-8");
|
|
244
|
-
tsconfig = tsconfig.replace(/"\.\.\/shared\/\*"/g, '"./shared/*"');
|
|
245
|
-
tsconfig = tsconfig.replace(/"\.\.\/shared"/g, '"./shared"');
|
|
246
|
-
writeFileSync(tsconfigPath, tsconfig);
|
|
247
|
-
}
|
|
248
|
-
cleanSharedViteConfig(join(targetDir, "shared"));
|
|
249
|
-
}
|
|
250
290
|
}
|
|
251
|
-
|
|
252
|
-
updatePackageJson(targetDir, projectName);
|
|
291
|
+
postProcessTemplate(targetDir, projectName);
|
|
253
292
|
|
|
254
293
|
console.log("Initializing git...");
|
|
255
|
-
|
|
294
|
+
execFileSync("git", ["init"], { cwd: targetDir, stdio: "pipe" });
|
|
256
295
|
|
|
257
296
|
console.log("Installing dependencies...");
|
|
258
|
-
|
|
297
|
+
execFileSync("bun", ["install"], { cwd: targetDir, stdio: "inherit" });
|
|
259
298
|
|
|
260
299
|
console.log("Building browser bundle...");
|
|
261
300
|
try {
|
|
262
|
-
|
|
301
|
+
execFileSync("bun", ["run", "build:browser"], { cwd: targetDir, stdio: "pipe" });
|
|
263
302
|
} catch {
|
|
264
303
|
console.log("(build:browser skipped - script not found)");
|
|
265
304
|
}
|
|
266
305
|
|
|
267
306
|
const huskyDir = join(targetDir, ".husky");
|
|
268
307
|
mkdirSync(huskyDir, { recursive: true });
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
308
|
+
|
|
309
|
+
const hook = (name: string, content: string) => {
|
|
310
|
+
const p = join(huskyDir, name);
|
|
311
|
+
writeFileSync(p, content);
|
|
312
|
+
chmodSync(p, 0o755);
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
hook(
|
|
316
|
+
"pre-commit",
|
|
317
|
+
`#!/bin/sh
|
|
318
|
+
bunx lint-staged
|
|
319
|
+
|
|
320
|
+
STAGED_TS=$(git diff --cached --name-only --diff-filter=ACMR | grep -c '\\.tsx\\?$' || true)
|
|
321
|
+
|
|
322
|
+
if [ "$STAGED_TS" -gt 0 ]; then
|
|
323
|
+
echo "⏳ Type checking..."
|
|
324
|
+
bunx tsc --noEmit 2>&1 | grep "error TS" | grep -v "node_modules" && exit 1 || true
|
|
325
|
+
fi
|
|
326
|
+
|
|
327
|
+
echo "✅ Pre-commit checks passed"
|
|
328
|
+
`
|
|
280
329
|
);
|
|
281
330
|
|
|
282
|
-
|
|
331
|
+
hook(
|
|
332
|
+
"commit-msg",
|
|
333
|
+
`#!/bin/sh
|
|
334
|
+
bunx commitlint --edit "$1"
|
|
335
|
+
`
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
hook(
|
|
339
|
+
"pre-push",
|
|
340
|
+
`#!/bin/sh
|
|
341
|
+
echo "⏳ Linting..."
|
|
342
|
+
bun run lint || { echo "❌ Lint failed."; exit 1; }
|
|
343
|
+
|
|
344
|
+
echo "⏳ Checking lockfile sync..."
|
|
345
|
+
git diff --name-only HEAD -- bun.lock | grep -q . && { echo "⚠️ bun.lock has uncommitted changes."; exit 1; }
|
|
283
346
|
|
|
347
|
+
echo "✅ Pre-push checks passed (full tests run in CI). Pushing..."
|
|
348
|
+
`
|
|
349
|
+
);
|
|
350
|
+
|
|
351
|
+
hook(
|
|
352
|
+
"prepare-commit-msg",
|
|
353
|
+
`#!/bin/sh
|
|
354
|
+
COMMIT_MSG_FILE="$1"
|
|
355
|
+
COMMIT_SOURCE="$2"
|
|
356
|
+
|
|
357
|
+
if [ "$COMMIT_SOURCE" = "merge" ] || [ "$COMMIT_SOURCE" = "squash" ] || [ "$COMMIT_SOURCE" = "commit" ]; then
|
|
358
|
+
exit 0
|
|
359
|
+
fi
|
|
360
|
+
|
|
361
|
+
FIRST_LINE=$(head -n1 "$COMMIT_MSG_FILE")
|
|
362
|
+
|
|
363
|
+
if echo "$FIRST_LINE" | grep -qE '^[a-z]+(\\([^)]+\\))?:'; then
|
|
364
|
+
exit 0
|
|
365
|
+
fi
|
|
366
|
+
|
|
367
|
+
STAGED=$(git diff --cached --name-only)
|
|
368
|
+
|
|
369
|
+
if echo "$STAGED" | grep -q "^src/"; then
|
|
370
|
+
SCOPE="app"
|
|
371
|
+
elif echo "$STAGED" | grep -q "^components/"; then
|
|
372
|
+
SCOPE="ui"
|
|
373
|
+
elif echo "$STAGED" | grep -q "^server/"; then
|
|
374
|
+
SCOPE="server"
|
|
375
|
+
fi
|
|
376
|
+
|
|
377
|
+
if [ -n "$SCOPE" ]; then
|
|
378
|
+
sed -i.bak -E "s/^([a-z]+)(\\([^)]+\\))?:/\\1($SCOPE):/" "$COMMIT_MSG_FILE"
|
|
379
|
+
rm -f "\${COMMIT_MSG_FILE}.bak"
|
|
380
|
+
fi
|
|
381
|
+
`
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
hook(
|
|
385
|
+
"post-merge",
|
|
386
|
+
`#!/bin/sh
|
|
387
|
+
echo "⏳ Checking for dependency changes..."
|
|
388
|
+
CHANGED=$(git diff HEAD@{1} --name-only HEAD)
|
|
389
|
+
|
|
390
|
+
if echo "$CHANGED" | grep -q "bun.lock\\|package.json"; then
|
|
391
|
+
echo "📦 Dependencies changed, running bun install..."
|
|
392
|
+
bun install
|
|
393
|
+
fi
|
|
394
|
+
`
|
|
395
|
+
);
|
|
396
|
+
|
|
397
|
+
hook(
|
|
398
|
+
"post-checkout",
|
|
399
|
+
`#!/bin/sh
|
|
400
|
+
PREV_HEAD="$1"
|
|
401
|
+
NEW_HEAD="$2"
|
|
402
|
+
IS_BRANCH="$3"
|
|
403
|
+
|
|
404
|
+
if [ "$IS_BRANCH" = "1" ]; then
|
|
405
|
+
CHANGED=$(git diff --name-only "$PREV_HEAD" "$NEW_HEAD" 2>/dev/null)
|
|
406
|
+
if echo "$CHANGED" | grep -q "bun.lock\\|package.json"; then
|
|
407
|
+
echo "📦 Dependencies changed between branches, running bun install..."
|
|
408
|
+
bun install
|
|
409
|
+
fi
|
|
410
|
+
fi
|
|
411
|
+
`
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
console.log("Initializing husky...");
|
|
284
415
|
try {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
416
|
+
execFileSync("bun", ["run", "prepare"], { cwd: targetDir, stdio: "pipe" });
|
|
417
|
+
} catch {
|
|
418
|
+
console.warn("(husky init skipped - prepare script failed; git hooks not installed)");
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
execFileSync("git", ["add", "-A"], { cwd: targetDir, stdio: "pipe" });
|
|
422
|
+
|
|
423
|
+
try {
|
|
424
|
+
execFileSync(
|
|
425
|
+
"git",
|
|
426
|
+
["commit", "--no-verify", "-m", `feat: init ${projectName} from pi-agent-template`],
|
|
427
|
+
{ cwd: targetDir, stdio: "pipe" }
|
|
428
|
+
);
|
|
289
429
|
} catch {
|
|
290
|
-
console.log("(git commit skipped -
|
|
430
|
+
console.log("(git commit skipped - check git user.name / user.email config)");
|
|
291
431
|
}
|
|
292
432
|
|
|
293
433
|
console.log("");
|
package/src/lib/templates.ts
CHANGED
|
@@ -27,6 +27,18 @@ const TEMPLATES: TemplateInfo[] = [
|
|
|
27
27
|
available: true,
|
|
28
28
|
dir: 'templates/agent',
|
|
29
29
|
},
|
|
30
|
+
{
|
|
31
|
+
type: 'browser-agent',
|
|
32
|
+
description: 'Browser automation agent (AI-powered browser control + xbrowser + Desktop/Web)',
|
|
33
|
+
available: true,
|
|
34
|
+
dir: 'templates/browser-agent',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: 'cowork',
|
|
38
|
+
description: 'Cowork task collaboration agent (Task orchestration + Progress tracking + Artifacts + Context management)',
|
|
39
|
+
available: true,
|
|
40
|
+
dir: 'templates/cowork',
|
|
41
|
+
},
|
|
30
42
|
];
|
|
31
43
|
|
|
32
44
|
export function getTemplateInfo(type: string): TemplateInfo | undefined {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
+
|
|
4
|
+
# Secret detection
|
|
5
|
+
if git diff --cached --name-only --diff-filter=ACM -z | xargs -0 grep -ilE '(password|secret|api.key|private.key|token|credential).*=.*[A-Za-z0-9]{16,}' 2>/dev/null; then
|
|
6
|
+
echo "⚠️ Potential secrets detected in staged files!"
|
|
7
|
+
echo "Please review and remove any sensitive data before committing."
|
|
8
|
+
exit 1
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
npx lint-staged
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# pi-agent-app
|
|
2
|
+
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`29d2171`](https://github.com/dyyz1993/pi-agent-template/commit/29d217148f6e0b496cc06716e11847b3e522e266)]:
|
|
8
|
+
- @dyyz1993/rpc-core@2.2.1
|
|
9
|
+
|
|
10
|
+
## 1.0.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`29d2171`](https://github.com/dyyz1993/pi-agent-template/commit/29d217148f6e0b496cc06716e11847b3e522e266), [`724470a`](https://github.com/dyyz1993/pi-agent-template/commit/724470a784b48a66591e06299fab8ad72f023962)]:
|
|
15
|
+
- @dyyz1993/rpc-core@3.0.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Coding agent template with Bash, Rules, and Todo management",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "xuyingzhou",
|
|
@@ -67,13 +67,15 @@
|
|
|
67
67
|
"electron:build:linux": "vite build && electron-builder --linux",
|
|
68
68
|
"lint": "eslint .",
|
|
69
69
|
"lint:fix": "eslint . --fix",
|
|
70
|
+
"format": "prettier --write .",
|
|
71
|
+
"format:check": "prettier --check .",
|
|
70
72
|
"test": "vitest run",
|
|
71
73
|
"test:watch": "vitest",
|
|
72
74
|
"test:coverage": "vitest run --coverage",
|
|
73
75
|
"prepare": "husky"
|
|
74
76
|
},
|
|
75
77
|
"dependencies": {
|
|
76
|
-
"@dyyz1993/rpc-core": "^
|
|
78
|
+
"@dyyz1993/rpc-core": "^2.2.1",
|
|
77
79
|
"@tanstack/react-virtual": "^3.13.24",
|
|
78
80
|
"electrobun": "1.18.1",
|
|
79
81
|
"lucide-react": "^1.9.0",
|
|
@@ -89,7 +91,7 @@
|
|
|
89
91
|
"zustand": "^5.0.12"
|
|
90
92
|
},
|
|
91
93
|
"devDependencies": {
|
|
92
|
-
"@dyyz1993/eslint-plugin-rpc": "
|
|
94
|
+
"@dyyz1993/eslint-plugin-rpc": "^1.1.0",
|
|
93
95
|
"@eslint/js": "^9.0.0",
|
|
94
96
|
"@testing-library/jest-dom": "^6.9.1",
|
|
95
97
|
"@testing-library/react": "^16.3.2",
|
|
@@ -116,7 +118,20 @@
|
|
|
116
118
|
"typescript-eslint": "^8.0.0",
|
|
117
119
|
"vite": "^6.0.3",
|
|
118
120
|
"vitest": "^4.1.5",
|
|
119
|
-
"ws": "^8.18.0"
|
|
121
|
+
"ws": "^8.18.0",
|
|
122
|
+
"@commitlint/cli": "^19.8.1",
|
|
123
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
124
|
+
"prettier": "^3.5.3",
|
|
125
|
+
"lint-staged": "^15.5.2"
|
|
126
|
+
},
|
|
127
|
+
"lint-staged": {
|
|
128
|
+
"*.{ts,tsx}": [
|
|
129
|
+
"eslint --fix",
|
|
130
|
+
"prettier --write"
|
|
131
|
+
],
|
|
132
|
+
"*.{json,md,css,html}": [
|
|
133
|
+
"prettier --write"
|
|
134
|
+
]
|
|
120
135
|
},
|
|
121
136
|
"overrides": {
|
|
122
137
|
"minimatch": "^10.0.1"
|