@compilr-dev/cli 0.5.0 → 0.5.1
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/README.md +236 -68
- package/dist/.tsbuildinfo.app +1 -0
- package/dist/.tsbuildinfo.data +1 -0
- package/dist/.tsbuildinfo.domain +1 -0
- package/dist/.tsbuildinfo.foundation +1 -0
- package/dist/agent.d.ts +61 -4
- package/dist/agent.js +241 -245
- package/dist/anchors/index.d.ts +1 -1
- package/dist/anchors/index.js +1 -1
- package/dist/anchors/project-anchors.d.ts +2 -2
- package/dist/anchors/project-anchors.js +1 -1
- package/dist/auth/api-client.d.ts +124 -0
- package/dist/auth/api-client.js +261 -0
- package/dist/auth/index.d.ts +172 -0
- package/dist/auth/index.js +545 -0
- package/dist/auth/storage.d.ts +52 -0
- package/dist/auth/storage.js +118 -0
- package/dist/changelog/index.d.ts +16 -0
- package/dist/changelog/index.js +24 -0
- package/dist/changelog/releases.d.ts +17 -0
- package/dist/changelog/releases.js +63 -0
- package/dist/commands-v2/handlers/auth.d.ts +10 -0
- package/dist/commands-v2/handlers/auth.js +118 -0
- package/dist/commands-v2/handlers/background.d.ts +14 -0
- package/dist/commands-v2/handlers/background.js +276 -0
- package/dist/commands-v2/handlers/context.js +266 -81
- package/dist/commands-v2/handlers/core.d.ts +1 -0
- package/dist/commands-v2/handlers/core.js +133 -8
- package/dist/commands-v2/handlers/debug.js +18 -0
- package/dist/commands-v2/handlers/delegations.d.ts +8 -0
- package/dist/commands-v2/handlers/delegations.js +29 -0
- package/dist/commands-v2/handlers/files.d.ts +8 -0
- package/dist/commands-v2/handlers/files.js +162 -0
- package/dist/commands-v2/handlers/filter.d.ts +9 -0
- package/dist/commands-v2/handlers/filter.js +130 -0
- package/dist/commands-v2/handlers/games.d.ts +7 -0
- package/dist/commands-v2/handlers/games.js +57 -0
- package/dist/commands-v2/handlers/index.d.ts +13 -0
- package/dist/commands-v2/handlers/index.js +39 -0
- package/dist/commands-v2/handlers/mcp.d.ts +8 -0
- package/dist/commands-v2/handlers/mcp.js +39 -0
- package/dist/commands-v2/handlers/notifications.d.ts +9 -0
- package/dist/commands-v2/handlers/notifications.js +34 -0
- package/dist/commands-v2/handlers/project.js +244 -23
- package/dist/commands-v2/handlers/reset.d.ts +11 -0
- package/dist/commands-v2/handlers/reset.js +118 -0
- package/dist/commands-v2/handlers/session.d.ts +161 -0
- package/dist/commands-v2/handlers/session.js +805 -0
- package/dist/commands-v2/handlers/settings.d.ts +2 -0
- package/dist/commands-v2/handlers/settings.js +217 -35
- package/dist/commands-v2/handlers/tasks.d.ts +5 -0
- package/dist/commands-v2/handlers/tasks.js +36 -0
- package/dist/commands-v2/handlers/team.d.ts +9 -0
- package/dist/commands-v2/handlers/team.js +549 -0
- package/dist/commands-v2/handlers/terminals.d.ts +9 -0
- package/dist/commands-v2/handlers/terminals.js +34 -0
- package/dist/commands-v2/index.d.ts +3 -2
- package/dist/commands-v2/index.js +4 -1
- package/dist/commands-v2/registry.d.ts +15 -0
- package/dist/commands-v2/registry.js +34 -0
- package/dist/commands-v2/types.d.ts +81 -3
- package/dist/commands.js +13 -0
- package/dist/compilr-diff-companion.vsix +0 -0
- package/dist/db/index.js +98 -4
- package/dist/db/repositories/document-repository.d.ts +2 -0
- package/dist/db/repositories/document-repository.js +5 -1
- package/dist/db/repositories/index.d.ts +2 -0
- package/dist/db/repositories/index.js +1 -0
- package/dist/db/repositories/plan-repository.d.ts +101 -0
- package/dist/db/repositories/plan-repository.js +275 -0
- package/dist/db/repositories/project-repository.d.ts +6 -0
- package/dist/db/repositories/project-repository.js +41 -0
- package/dist/db/repositories/work-item-repository.d.ts +15 -0
- package/dist/db/repositories/work-item-repository.js +69 -4
- package/dist/db/schema.d.ts +40 -3
- package/dist/db/schema.js +66 -3
- package/dist/episodes/index.d.ts +20 -0
- package/dist/episodes/index.js +27 -0
- package/dist/episodes/recorder.d.ts +51 -0
- package/dist/episodes/recorder.js +195 -0
- package/dist/episodes/significant-work.d.ts +21 -0
- package/dist/episodes/significant-work.js +56 -0
- package/dist/episodes/store.d.ts +38 -0
- package/dist/episodes/store.js +199 -0
- package/dist/episodes/types.d.ts +35 -0
- package/dist/episodes/types.js +6 -0
- package/dist/episodes/work-at-risk.d.ts +12 -0
- package/dist/episodes/work-at-risk.js +38 -0
- package/dist/episodes/work-summary-anchor.d.ts +23 -0
- package/dist/episodes/work-summary-anchor.js +73 -0
- package/dist/games/coins.d.ts +66 -0
- package/dist/games/coins.js +165 -0
- package/dist/games/game-base.d.ts +84 -0
- package/dist/games/game-base.js +204 -0
- package/dist/games/index.d.ts +16 -0
- package/dist/games/index.js +49 -0
- package/dist/games/scores.d.ts +69 -0
- package/dist/games/scores.js +191 -0
- package/dist/games/tetris/board.d.ts +59 -0
- package/dist/games/tetris/board.js +170 -0
- package/dist/games/tetris/index.d.ts +109 -0
- package/dist/games/tetris/index.js +610 -0
- package/dist/games/tetris/pieces.d.ts +44 -0
- package/dist/games/tetris/pieces.js +271 -0
- package/dist/games/tetris/renderer.d.ts +26 -0
- package/dist/games/tetris/renderer.js +77 -0
- package/dist/guide/guide-content.d.ts +23 -0
- package/dist/guide/guide-content.js +196 -0
- package/dist/guide/index.d.ts +8 -0
- package/dist/guide/index.js +7 -0
- package/dist/guide/shared-content.d.ts +37 -0
- package/dist/guide/shared-content.js +1272 -0
- package/dist/guide/tutorial-helpers.d.ts +57 -0
- package/dist/guide/tutorial-helpers.js +147 -0
- package/dist/handlers/ask-user-handlers.d.ts +32 -0
- package/dist/handlers/ask-user-handlers.js +104 -0
- package/dist/handlers/delegation-handlers.d.ts +34 -0
- package/dist/handlers/delegation-handlers.js +291 -0
- package/dist/handlers/permission-handler.d.ts +30 -0
- package/dist/handlers/permission-handler.js +205 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +448 -271
- package/dist/input-handlers/memory-handler.d.ts +1 -1
- package/dist/input-handlers/memory-handler.js +2 -1
- package/dist/models/index.d.ts +10 -0
- package/dist/models/index.js +12 -0
- package/dist/models/model-registry.d.ts +38 -0
- package/dist/models/model-registry.js +69 -0
- package/dist/models/model-tiers.d.ts +28 -0
- package/dist/models/model-tiers.js +71 -0
- package/dist/models/model-validation.d.ts +25 -0
- package/dist/models/model-validation.js +291 -0
- package/dist/models/ollama-models.d.ts +73 -0
- package/dist/models/ollama-models.js +178 -0
- package/dist/models/provider-types.d.ts +6 -0
- package/dist/models/provider-types.js +1 -0
- package/dist/models/providers.d.ts +35 -0
- package/dist/models/providers.js +58 -0
- package/dist/models/types.d.ts +4 -0
- package/dist/models/types.js +4 -0
- package/dist/multi-agent/activity.d.ts +21 -0
- package/dist/multi-agent/activity.js +34 -0
- package/dist/multi-agent/agent-selection.d.ts +55 -0
- package/dist/multi-agent/agent-selection.js +90 -0
- package/dist/multi-agent/artifacts.d.ts +197 -0
- package/dist/multi-agent/artifacts.js +379 -0
- package/dist/multi-agent/checkpointer.d.ts +138 -0
- package/dist/multi-agent/checkpointer.js +471 -0
- package/dist/multi-agent/collision-utils.d.ts +16 -0
- package/dist/multi-agent/collision-utils.js +28 -0
- package/dist/multi-agent/context-resolver.d.ts +97 -0
- package/dist/multi-agent/context-resolver.js +316 -0
- package/dist/multi-agent/custom-agents.d.ts +83 -0
- package/dist/multi-agent/custom-agents.js +227 -0
- package/dist/multi-agent/delegation-tracker.d.ts +157 -0
- package/dist/multi-agent/delegation-tracker.js +243 -0
- package/dist/multi-agent/file-lock-hook.d.ts +29 -0
- package/dist/multi-agent/file-lock-hook.js +97 -0
- package/dist/multi-agent/file-locks.d.ts +58 -0
- package/dist/multi-agent/file-locks.js +194 -0
- package/dist/multi-agent/index.d.ts +24 -0
- package/dist/multi-agent/index.js +30 -0
- package/dist/multi-agent/mention-parser.d.ts +64 -0
- package/dist/multi-agent/mention-parser.js +146 -0
- package/dist/multi-agent/notification-manager.d.ts +84 -0
- package/dist/multi-agent/notification-manager.js +224 -0
- package/dist/multi-agent/pending-requests.d.ts +122 -0
- package/dist/multi-agent/pending-requests.js +155 -0
- package/dist/multi-agent/session-registry.d.ts +139 -0
- package/dist/multi-agent/session-registry.js +514 -0
- package/dist/multi-agent/shared-context.d.ts +293 -0
- package/dist/multi-agent/shared-context.js +671 -0
- package/dist/multi-agent/skill-requirements.d.ts +66 -0
- package/dist/multi-agent/skill-requirements.js +178 -0
- package/dist/multi-agent/task-assignment.d.ts +69 -0
- package/dist/multi-agent/task-assignment.js +123 -0
- package/dist/multi-agent/task-suggestion.d.ts +31 -0
- package/dist/multi-agent/task-suggestion.js +72 -0
- package/dist/multi-agent/team-agent.d.ts +201 -0
- package/dist/multi-agent/team-agent.js +488 -0
- package/dist/multi-agent/team.d.ts +286 -0
- package/dist/multi-agent/team.js +610 -0
- package/dist/multi-agent/tool-config.d.ts +110 -0
- package/dist/multi-agent/tool-config.js +661 -0
- package/dist/multi-agent/types.d.ts +211 -0
- package/dist/multi-agent/types.js +617 -0
- package/dist/prompts/plan-mode-prompt.d.ts +11 -0
- package/dist/prompts/plan-mode-prompt.js +95 -0
- package/dist/repl-helpers.js +3 -2
- package/dist/repl-v2.d.ts +401 -2
- package/dist/repl-v2.js +2577 -65
- package/dist/session/index.d.ts +6 -0
- package/dist/session/index.js +6 -0
- package/dist/session/project-session-manager.d.ts +158 -0
- package/dist/session/project-session-manager.js +650 -0
- package/dist/settings/index.d.ts +133 -13
- package/dist/settings/index.js +329 -24
- package/dist/settings/mcp-config.d.ts +76 -0
- package/dist/settings/mcp-config.js +143 -0
- package/dist/settings/paths.d.ts +4 -0
- package/dist/settings/paths.js +6 -0
- package/dist/shared-handlers.d.ts +62 -0
- package/dist/shared-handlers.js +48 -0
- package/dist/system-prompt/builder.d.ts +5 -0
- package/dist/system-prompt/builder.js +4 -0
- package/dist/system-prompt/index.d.ts +18 -0
- package/dist/system-prompt/index.js +18 -0
- package/dist/system-prompt/modules.d.ts +5 -0
- package/dist/system-prompt/modules.js +4 -0
- package/dist/tabbed-menu.js +2 -1
- package/dist/templates/compilr-md-import.d.ts +16 -0
- package/dist/templates/compilr-md-import.js +241 -0
- package/dist/templates/compilr-md.js +10 -61
- package/dist/templates/config-json.d.ts +1 -25
- package/dist/templates/index.d.ts +2 -0
- package/dist/templates/index.js +34 -73
- package/dist/tool-names.d.ts +108 -0
- package/dist/tool-names.js +227 -0
- package/dist/tools/anchor-tools.d.ts +4 -4
- package/dist/tools/anchor-tools.js +1 -1
- package/dist/tools/artifact-tools.d.ts +42 -0
- package/dist/tools/artifact-tools.js +328 -0
- package/dist/tools/ask-user-simple.d.ts +1 -1
- package/dist/tools/ask-user-simple.js +2 -1
- package/dist/tools/ask-user.d.ts +1 -1
- package/dist/tools/ask-user.js +2 -1
- package/dist/tools/backlog-wrappers.d.ts +5 -3
- package/dist/tools/backlog-wrappers.js +16 -1
- package/dist/tools/backlog.d.ts +2 -2
- package/dist/tools/backlog.js +1 -1
- package/dist/tools/db-tools.d.ts +8 -61
- package/dist/tools/db-tools.js +8 -13
- package/dist/tools/delegate-background.d.ts +27 -0
- package/dist/tools/delegate-background.js +115 -0
- package/dist/tools/delegate.d.ts +22 -0
- package/dist/tools/delegate.js +97 -0
- package/dist/tools/delegation-status.d.ts +16 -0
- package/dist/tools/delegation-status.js +128 -0
- package/dist/tools/document-db.d.ts +5 -5
- package/dist/tools/document-db.js +1 -1
- package/dist/tools/guide-tool.d.ts +12 -0
- package/dist/tools/guide-tool.js +59 -0
- package/dist/tools/handoff.d.ts +25 -0
- package/dist/tools/handoff.js +99 -0
- package/dist/tools/meta-tools.d.ts +26 -0
- package/dist/tools/meta-tools.js +47 -0
- package/dist/tools/plan-tools.d.ts +54 -0
- package/dist/tools/plan-tools.js +338 -0
- package/dist/tools/platform-adapter.d.ts +29 -0
- package/dist/tools/platform-adapter.js +394 -0
- package/dist/tools/project-db.d.ts +5 -73
- package/dist/tools/project-db.js +5 -336
- package/dist/tools/recall-work-tool.d.ts +18 -0
- package/dist/tools/recall-work-tool.js +82 -0
- package/dist/tools/workitem-db.d.ts +43 -11
- package/dist/tools/workitem-db.js +186 -5
- package/dist/tools.d.ts +67 -2
- package/dist/tools.js +237 -47
- package/dist/ui/autocomplete-controller.d.ts +42 -0
- package/dist/ui/autocomplete-controller.js +384 -0
- package/dist/ui/base/index.d.ts +1 -1
- package/dist/ui/base/index.js +1 -1
- package/dist/ui/base/overlay-base-v2.d.ts +10 -0
- package/dist/ui/base/overlay-base-v2.js +14 -0
- package/dist/ui/base/render-utils.d.ts +19 -0
- package/dist/ui/base/render-utils.js +25 -0
- package/dist/ui/base/tabbed-list-overlay-v2.d.ts +16 -1
- package/dist/ui/base/tabbed-list-overlay-v2.js +19 -1
- package/dist/ui/constants/labels.d.ts +14 -0
- package/dist/ui/constants/labels.js +51 -0
- package/dist/ui/conversation-store.d.ts +55 -0
- package/dist/ui/conversation-store.js +107 -0
- package/dist/ui/conversation.js +11 -13
- package/dist/ui/diff.d.ts +7 -1
- package/dist/ui/diff.js +85 -48
- package/dist/ui/ephemeral.js +3 -9
- package/dist/ui/file-autocomplete.d.ts +24 -0
- package/dist/ui/file-autocomplete.js +56 -0
- package/dist/ui/footer-renderer.d.ts +69 -0
- package/dist/ui/footer-renderer.js +431 -0
- package/dist/ui/footer.d.ts +74 -7
- package/dist/ui/footer.js +173 -16
- package/dist/ui/input-controller.d.ts +51 -0
- package/dist/ui/input-controller.js +176 -0
- package/dist/ui/input-prompt.d.ts +19 -0
- package/dist/ui/input-prompt.js +206 -14
- package/dist/ui/keyboard-handler.d.ts +57 -0
- package/dist/ui/keyboard-handler.js +557 -0
- package/dist/ui/live-region-facade.d.ts +42 -0
- package/dist/ui/live-region-facade.js +205 -0
- package/dist/ui/live-region.d.ts +0 -4
- package/dist/ui/live-region.js +6 -14
- package/dist/ui/mascot/renderer.d.ts +1 -1
- package/dist/ui/mascot/renderer.js +37 -2
- package/dist/ui/overlay/data/tutorial-content.d.ts +9 -0
- package/dist/ui/overlay/data/tutorial-content.js +9 -0
- package/dist/ui/overlay/data/tutorial-registry.d.ts +12 -0
- package/dist/ui/overlay/data/tutorial-registry.js +116 -0
- package/dist/ui/overlay/data/tutorial-types.d.ts +35 -0
- package/dist/ui/overlay/data/tutorial-types.js +6 -0
- package/dist/ui/overlay/data/tutorials/basics/first-conversation.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/basics/first-conversation.js +220 -0
- package/dist/ui/overlay/data/tutorials/basics/first-project.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/basics/first-project.js +284 -0
- package/dist/ui/overlay/data/tutorials/basics/navigation.d.ts +8 -0
- package/dist/ui/overlay/data/tutorials/basics/navigation.js +22 -0
- package/dist/ui/overlay/data/tutorials/basics/welcome.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/basics/welcome.js +174 -0
- package/dist/ui/overlay/data/tutorials/config/context-management.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/config/context-management.js +158 -0
- package/dist/ui/overlay/data/tutorials/config/mcp-servers.d.ts +8 -0
- package/dist/ui/overlay/data/tutorials/config/mcp-servers.js +155 -0
- package/dist/ui/overlay/data/tutorials/config/model-selection.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/config/model-selection.js +162 -0
- package/dist/ui/overlay/data/tutorials/config/permissions-safety.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/config/permissions-safety.js +163 -0
- package/dist/ui/overlay/data/tutorials/config/settings-config.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/config/settings-config.js +166 -0
- package/dist/ui/overlay/data/tutorials/planning/arch.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/arch.js +168 -0
- package/dist/ui/overlay/data/tutorials/planning/backlog.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/backlog.js +103 -0
- package/dist/ui/overlay/data/tutorials/planning/build.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/build.js +173 -0
- package/dist/ui/overlay/data/tutorials/planning/design.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/design.js +205 -0
- package/dist/ui/overlay/data/tutorials/planning/docs.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/docs.js +143 -0
- package/dist/ui/overlay/data/tutorials/planning/prd.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/prd.js +173 -0
- package/dist/ui/overlay/data/tutorials/planning/scaffold.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/scaffold.js +164 -0
- package/dist/ui/overlay/data/tutorials/planning/sketch.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/planning/sketch.js +58 -0
- package/dist/ui/overlay/data/tutorials/projects/anchors.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/projects/anchors.js +248 -0
- package/dist/ui/overlay/data/tutorials/projects/import-project.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/projects/import-project.js +172 -0
- package/dist/ui/overlay/data/tutorials/projects/managing-projects.d.ts +8 -0
- package/dist/ui/overlay/data/tutorials/projects/managing-projects.js +212 -0
- package/dist/ui/overlay/data/tutorials/projects/new-project.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/projects/new-project.js +251 -0
- package/dist/ui/overlay/data/tutorials/projects/session-management.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/projects/session-management.js +169 -0
- package/dist/ui/overlay/data/tutorials/teams/background-execution.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/teams/background-execution.js +171 -0
- package/dist/ui/overlay/data/tutorials/teams/multi-terminal.d.ts +8 -0
- package/dist/ui/overlay/data/tutorials/teams/multi-terminal.js +147 -0
- package/dist/ui/overlay/data/tutorials/teams/task-assignment.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/teams/task-assignment.js +204 -0
- package/dist/ui/overlay/data/tutorials/teams/team-overview.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/teams/team-overview.js +165 -0
- package/dist/ui/overlay/data/tutorials/teams/working-with-agents.d.ts +7 -0
- package/dist/ui/overlay/data/tutorials/teams/working-with-agents.js +172 -0
- package/dist/ui/overlay/impl/agents-overlay-v2.js +6 -17
- package/dist/ui/overlay/impl/anchors-overlay-v2.js +30 -64
- package/dist/ui/overlay/impl/artifact-detail-overlay-v2.d.ts +43 -0
- package/dist/ui/overlay/impl/artifact-detail-overlay-v2.js +232 -0
- package/dist/ui/overlay/impl/artifact-overlay-v2.d.ts +40 -0
- package/dist/ui/overlay/impl/artifact-overlay-v2.js +115 -0
- package/dist/ui/overlay/impl/ask-user-overlay-v2.js +2 -5
- package/dist/ui/overlay/impl/background-overlay-v2.d.ts +40 -0
- package/dist/ui/overlay/impl/background-overlay-v2.js +147 -0
- package/dist/ui/overlay/impl/backlog-overlay-v2.d.ts +4 -1
- package/dist/ui/overlay/impl/backlog-overlay-v2.js +55 -16
- package/dist/ui/overlay/impl/changelog-overlay-v2.d.ts +44 -0
- package/dist/ui/overlay/impl/changelog-overlay-v2.js +165 -0
- package/dist/ui/overlay/impl/commands-overlay-v2.js +4 -6
- package/dist/ui/overlay/impl/config-overlay-v2.d.ts +12 -1
- package/dist/ui/overlay/impl/config-overlay-v2.js +164 -100
- package/dist/ui/overlay/impl/custom-agent-form-overlay-v2.d.ts +83 -0
- package/dist/ui/overlay/impl/custom-agent-form-overlay-v2.js +711 -0
- package/dist/ui/overlay/impl/dashboard-overlay-v2.d.ts +2 -0
- package/dist/ui/overlay/impl/dashboard-overlay-v2.js +26 -3
- package/dist/ui/overlay/impl/delegations-overlay-v2.d.ts +28 -0
- package/dist/ui/overlay/impl/delegations-overlay-v2.js +279 -0
- package/dist/ui/overlay/impl/docs-overlay-v2.js +12 -9
- package/dist/ui/overlay/impl/document-detail-overlay-v2.d.ts +7 -0
- package/dist/ui/overlay/impl/document-detail-overlay-v2.js +119 -78
- package/dist/ui/overlay/impl/filter-overlay-v2.d.ts +41 -0
- package/dist/ui/overlay/impl/filter-overlay-v2.js +110 -0
- package/dist/ui/overlay/impl/games-overlay-v2.d.ts +31 -0
- package/dist/ui/overlay/impl/games-overlay-v2.js +135 -0
- package/dist/ui/overlay/impl/help-overlay-v2.d.ts +26 -3
- package/dist/ui/overlay/impl/help-overlay-v2.js +20 -42
- package/dist/ui/overlay/impl/login-overlay-v2.d.ts +49 -0
- package/dist/ui/overlay/impl/login-overlay-v2.js +277 -0
- package/dist/ui/overlay/impl/mcp-overlay-v2.d.ts +63 -0
- package/dist/ui/overlay/impl/mcp-overlay-v2.js +907 -0
- package/dist/ui/overlay/impl/model-overlay-v2.d.ts +57 -13
- package/dist/ui/overlay/impl/model-overlay-v2.js +1086 -61
- package/dist/ui/overlay/impl/new-overlay-v2.d.ts +37 -6
- package/dist/ui/overlay/impl/new-overlay-v2.js +715 -65
- package/dist/ui/overlay/impl/notifications-overlay-v2.d.ts +20 -0
- package/dist/ui/overlay/impl/notifications-overlay-v2.js +116 -0
- package/dist/ui/overlay/impl/onboarding-wizard-overlay-v2.d.ts +76 -0
- package/dist/ui/overlay/impl/onboarding-wizard-overlay-v2.js +728 -0
- package/dist/ui/overlay/impl/pending-overlay-v2.d.ts +51 -0
- package/dist/ui/overlay/impl/pending-overlay-v2.js +445 -0
- package/dist/ui/overlay/impl/permission-overlay-v2.js +5 -5
- package/dist/ui/overlay/impl/permissions-overlay-v2.d.ts +85 -0
- package/dist/ui/overlay/impl/permissions-overlay-v2.js +820 -0
- package/dist/ui/overlay/impl/plan-approval-overlay-v2.d.ts +35 -0
- package/dist/ui/overlay/impl/plan-approval-overlay-v2.js +181 -0
- package/dist/ui/overlay/impl/project-edit-overlay-v2.d.ts +36 -0
- package/dist/ui/overlay/impl/project-edit-overlay-v2.js +195 -0
- package/dist/ui/overlay/impl/projects-overlay-v2.d.ts +1 -0
- package/dist/ui/overlay/impl/projects-overlay-v2.js +278 -44
- package/dist/ui/overlay/impl/reset-overlay-v2.d.ts +39 -0
- package/dist/ui/overlay/impl/reset-overlay-v2.js +107 -0
- package/dist/ui/overlay/impl/resume-overlay-v2.d.ts +60 -0
- package/dist/ui/overlay/impl/resume-overlay-v2.js +414 -0
- package/dist/ui/overlay/impl/session-mode-overlay-v2.d.ts +43 -0
- package/dist/ui/overlay/impl/session-mode-overlay-v2.js +124 -0
- package/dist/ui/overlay/impl/tasks-overlay-v2.d.ts +28 -0
- package/dist/ui/overlay/impl/tasks-overlay-v2.js +283 -0
- package/dist/ui/overlay/impl/team-overlay-v2.d.ts +86 -0
- package/dist/ui/overlay/impl/team-overlay-v2.js +692 -0
- package/dist/ui/overlay/impl/terminals-overlay-v2.d.ts +26 -0
- package/dist/ui/overlay/impl/terminals-overlay-v2.js +217 -0
- package/dist/ui/overlay/impl/tools-overlay-v2.js +3 -7
- package/dist/ui/overlay/impl/tutorial-overlay-v2.d.ts +30 -16
- package/dist/ui/overlay/impl/tutorial-overlay-v2.js +133 -956
- package/dist/ui/overlay/impl/workflow-overlay-v2.js +5 -1
- package/dist/ui/overlay/index.d.ts +20 -1
- package/dist/ui/overlay/index.js +19 -0
- package/dist/ui/overlay/types.d.ts +5 -0
- package/dist/ui/overlay-manager.d.ts +43 -0
- package/dist/ui/overlay-manager.js +238 -0
- package/dist/ui/overlays.js +4 -16
- package/dist/ui/permission-overlay.js +6 -5
- package/dist/ui/status-bar-controller.d.ts +33 -0
- package/dist/ui/status-bar-controller.js +99 -0
- package/dist/ui/subagent-renderer.js +3 -19
- package/dist/ui/terminal-autocomplete-utils.d.ts +23 -0
- package/dist/ui/terminal-autocomplete-utils.js +83 -0
- package/dist/ui/terminal-line-builders.d.ts +17 -0
- package/dist/ui/terminal-line-builders.js +42 -0
- package/dist/ui/terminal-render-item.d.ts +16 -0
- package/dist/ui/terminal-render-item.js +267 -0
- package/dist/ui/terminal-renderer.d.ts +7 -8
- package/dist/ui/terminal-renderer.js +7 -8
- package/dist/ui/terminal-types.d.ts +179 -0
- package/dist/ui/terminal-types.js +34 -0
- package/dist/ui/terminal-ui.d.ts +144 -276
- package/dist/ui/terminal-ui.js +384 -1861
- package/dist/ui/todo-zone.d.ts +19 -1
- package/dist/ui/todo-zone.js +71 -13
- package/dist/ui/tool-formatters.js +512 -1
- package/dist/ui/turn-metrics.d.ts +56 -0
- package/dist/ui/turn-metrics.js +75 -0
- package/dist/ui/types.d.ts +28 -0
- package/dist/ui/types.js +1 -0
- package/dist/ui/vscode-diff-ipc.d.ts +102 -0
- package/dist/ui/vscode-diff-ipc.js +385 -0
- package/dist/utils/credentials.d.ts +24 -5
- package/dist/utils/credentials.js +123 -9
- package/dist/utils/format-tokens.d.ts +13 -0
- package/dist/utils/format-tokens.js +18 -0
- package/dist/utils/git-config.d.ts +26 -0
- package/dist/utils/git-config.js +54 -0
- package/dist/utils/message-utils.d.ts +61 -0
- package/dist/utils/message-utils.js +72 -0
- package/dist/utils/model-tiers.d.ts +8 -1
- package/dist/utils/model-tiers.js +38 -16
- package/dist/utils/open-browser.d.ts +5 -0
- package/dist/utils/open-browser.js +32 -0
- package/dist/utils/path-safety.js +3 -2
- package/dist/utils/project-detection.d.ts +58 -0
- package/dist/utils/project-detection.js +424 -0
- package/dist/utils/project-memory.js +2 -1
- package/dist/utils/project-status.d.ts +2 -2
- package/dist/utils/startup-perf.d.ts +18 -0
- package/dist/utils/startup-perf.js +60 -0
- package/dist/utils/token-tracker.d.ts +62 -0
- package/dist/utils/token-tracker.js +150 -0
- package/dist/utils/token-types.d.ts +23 -0
- package/dist/utils/token-types.js +18 -0
- package/dist/utils/types/config-types.d.ts +32 -0
- package/dist/utils/types/config-types.js +8 -0
- package/dist/utils/update-checker.d.ts +28 -0
- package/dist/utils/update-checker.js +106 -0
- package/dist/utils/version.d.ts +7 -0
- package/dist/utils/version.js +10 -0
- package/dist/utils/vscode-detect.d.ts +39 -0
- package/dist/utils/vscode-detect.js +137 -0
- package/package.json +25 -12
- package/dist/commands/handler-types.d.ts +0 -68
- package/dist/commands/handler-types.js +0 -8
- package/dist/commands/handlers/agent-commands.d.ts +0 -13
- package/dist/commands/handlers/agent-commands.js +0 -305
- package/dist/commands/handlers/design-commands.d.ts +0 -15
- package/dist/commands/handlers/design-commands.js +0 -334
- package/dist/commands/handlers/index.d.ts +0 -20
- package/dist/commands/handlers/index.js +0 -43
- package/dist/commands/handlers/overlay-commands.d.ts +0 -21
- package/dist/commands/handlers/overlay-commands.js +0 -287
- package/dist/commands/handlers/project-commands.d.ts +0 -11
- package/dist/commands/handlers/project-commands.js +0 -167
- package/dist/commands/handlers/simple-commands.d.ts +0 -19
- package/dist/commands/handlers/simple-commands.js +0 -144
- package/dist/commands/registry.d.ts +0 -50
- package/dist/commands/registry.js +0 -75
- package/dist/index.old.d.ts +0 -7
- package/dist/index.old.js +0 -1014
- package/dist/repl.d.ts +0 -149
- package/dist/repl.js +0 -1151
- package/dist/templates/claude-md.d.ts +0 -7
- package/dist/templates/claude-md.js +0 -189
- package/dist/test-autocomplete.d.ts +0 -7
- package/dist/test-autocomplete.js +0 -85
- package/dist/test-tabbed-menu.d.ts +0 -7
- package/dist/test-tabbed-menu.js +0 -25
- package/dist/tool-selector.d.ts +0 -71
- package/dist/tool-selector.js +0 -184
- package/dist/ui/agents-overlay-v2.d.ts +0 -43
- package/dist/ui/agents-overlay-v2.js +0 -809
- package/dist/ui/agents-overlay.d.ts +0 -12
- package/dist/ui/agents-overlay.js +0 -863
- package/dist/ui/anchors-overlay.d.ts +0 -12
- package/dist/ui/anchors-overlay.js +0 -775
- package/dist/ui/arch-type-overlay.d.ts +0 -15
- package/dist/ui/arch-type-overlay.js +0 -201
- package/dist/ui/ask-user-overlay-v2.d.ts +0 -26
- package/dist/ui/ask-user-overlay-v2.js +0 -555
- package/dist/ui/ask-user-simple-overlay-v2.d.ts +0 -25
- package/dist/ui/ask-user-simple-overlay-v2.js +0 -215
- package/dist/ui/backlog-overlay.d.ts +0 -32
- package/dist/ui/backlog-overlay.js +0 -652
- package/dist/ui/commands-overlay-v2.d.ts +0 -33
- package/dist/ui/commands-overlay-v2.js +0 -441
- package/dist/ui/commands-overlay.d.ts +0 -16
- package/dist/ui/commands-overlay.js +0 -439
- package/dist/ui/config-overlay.d.ts +0 -35
- package/dist/ui/config-overlay.js +0 -707
- package/dist/ui/docs-overlay.d.ts +0 -17
- package/dist/ui/docs-overlay.js +0 -303
- package/dist/ui/footer-v2.d.ts +0 -222
- package/dist/ui/footer-v2.js +0 -1349
- package/dist/ui/help-overlay-v2.d.ts +0 -34
- package/dist/ui/help-overlay-v2.js +0 -309
- package/dist/ui/help-overlay.d.ts +0 -16
- package/dist/ui/help-overlay.js +0 -316
- package/dist/ui/init-overlay-v2.d.ts +0 -34
- package/dist/ui/init-overlay-v2.js +0 -600
- package/dist/ui/init-overlay.d.ts +0 -34
- package/dist/ui/init-overlay.js +0 -604
- package/dist/ui/input-prompt-v2.d.ts +0 -180
- package/dist/ui/input-prompt-v2.js +0 -999
- package/dist/ui/iteration-limit-overlay-v2.d.ts +0 -21
- package/dist/ui/iteration-limit-overlay-v2.js +0 -114
- package/dist/ui/keys-overlay-v2.d.ts +0 -41
- package/dist/ui/keys-overlay-v2.js +0 -248
- package/dist/ui/mascot-overlay-v2.d.ts +0 -41
- package/dist/ui/mascot-overlay-v2.js +0 -138
- package/dist/ui/mascot-overlay.d.ts +0 -21
- package/dist/ui/mascot-overlay.js +0 -146
- package/dist/ui/model-overlay-v2.d.ts +0 -49
- package/dist/ui/model-overlay-v2.js +0 -118
- package/dist/ui/model-overlay.d.ts +0 -27
- package/dist/ui/model-overlay.js +0 -221
- package/dist/ui/model-warning-overlay.d.ts +0 -30
- package/dist/ui/model-warning-overlay.js +0 -169
- package/dist/ui/new-overlay.d.ts +0 -34
- package/dist/ui/new-overlay.js +0 -604
- package/dist/ui/overlay/impl/init-overlay-v2.d.ts +0 -77
- package/dist/ui/overlay/impl/init-overlay-v2.js +0 -593
- package/dist/ui/overlay/overlay-types.d.ts +0 -128
- package/dist/ui/overlay/overlay-types.js +0 -22
- package/dist/ui/overlays/help-overlay-v2.d.ts +0 -28
- package/dist/ui/overlays/help-overlay-v2.js +0 -198
- package/dist/ui/overlays/index.d.ts +0 -11
- package/dist/ui/overlays/index.js +0 -11
- package/dist/ui/permission-overlay-v2.d.ts +0 -36
- package/dist/ui/permission-overlay-v2.js +0 -380
- package/dist/ui/projects-overlay.d.ts +0 -19
- package/dist/ui/projects-overlay.js +0 -484
- package/dist/ui/theme-overlay-v2.d.ts +0 -42
- package/dist/ui/theme-overlay-v2.js +0 -135
- package/dist/ui/theme-overlay.d.ts +0 -24
- package/dist/ui/theme-overlay.js +0 -127
- package/dist/ui/tools-overlay-v2.d.ts +0 -47
- package/dist/ui/tools-overlay-v2.js +0 -218
- package/dist/ui/tools-overlay.d.ts +0 -34
- package/dist/ui/tools-overlay.js +0 -230
- package/dist/ui/tutorial-overlay-v2.d.ts +0 -31
- package/dist/ui/tutorial-overlay-v2.js +0 -1035
- package/dist/ui/tutorial-overlay.d.ts +0 -11
- package/dist/ui/tutorial-overlay.js +0 -1034
- package/dist/ui/workflow-overlay.d.ts +0 -22
- package/dist/ui/workflow-overlay.js +0 -636
|
@@ -12,14 +12,21 @@
|
|
|
12
12
|
* 4. Tech stack
|
|
13
13
|
* 5. Coding standards
|
|
14
14
|
* 6. Initialize git?
|
|
15
|
-
* 7.
|
|
16
|
-
* 8.
|
|
17
|
-
*
|
|
15
|
+
* 7. Workflow mode
|
|
16
|
+
* 8. Confirmation
|
|
17
|
+
*
|
|
18
|
+
* Note: All projects are tracked in the database. File-based backlog was deprecated.
|
|
18
19
|
*/
|
|
19
20
|
import chalk from 'chalk';
|
|
21
|
+
import * as fs from 'fs';
|
|
22
|
+
import * as path from 'path';
|
|
23
|
+
import { execSync } from 'child_process';
|
|
20
24
|
import { BaseOverlayV2, renderBorder } from '../../base/index.js';
|
|
21
|
-
import {
|
|
25
|
+
import { checkGitConfig } from '../../../utils/git-config.js';
|
|
26
|
+
import { TECH_STACK_LABELS, CODING_STANDARDS_LABELS, REPO_PATTERN_LABELS, generateProject, isValidProjectName, projectExists, generateCompilrMdForImport, } from '../../../templates/index.js';
|
|
22
27
|
import { getProjectsPath, ensureProjectsDirectory } from '../../../settings/paths.js';
|
|
28
|
+
import { detectProjectInfo, validateImportPath, getLanguageLabel, getFrameworkLabel, } from '../../../utils/project-detection.js';
|
|
29
|
+
import { projectRepository } from '../../../db/repositories/index.js';
|
|
23
30
|
// =============================================================================
|
|
24
31
|
// Constants
|
|
25
32
|
// =============================================================================
|
|
@@ -47,17 +54,15 @@ function getMaxOptionsForStep(step) {
|
|
|
47
54
|
case 6:
|
|
48
55
|
return 2;
|
|
49
56
|
case 7:
|
|
50
|
-
return 2;
|
|
51
|
-
case 8:
|
|
52
57
|
return WORKFLOW_MODE_OPTIONS.length;
|
|
53
|
-
case
|
|
58
|
+
case 8:
|
|
54
59
|
return 2;
|
|
55
60
|
default:
|
|
56
61
|
return 0;
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
function isSelectionStep(step) {
|
|
60
|
-
return [0, 3, 4, 5, 6, 7, 8
|
|
65
|
+
return [0, 3, 4, 5, 6, 7, 8].includes(step);
|
|
61
66
|
}
|
|
62
67
|
function isInputStep(step) {
|
|
63
68
|
return [1, 2].includes(step);
|
|
@@ -78,8 +83,19 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
78
83
|
techStack: null,
|
|
79
84
|
codingStandards: null,
|
|
80
85
|
initGit: true,
|
|
81
|
-
|
|
86
|
+
gitRemote: '',
|
|
82
87
|
workflowMode: 'flexible',
|
|
88
|
+
gitConfigChecked: false,
|
|
89
|
+
gitConfigValid: false,
|
|
90
|
+
gitUserName: null,
|
|
91
|
+
gitUserEmail: null,
|
|
92
|
+
gitRemoteInputMode: false,
|
|
93
|
+
// Import project state
|
|
94
|
+
importPath: '',
|
|
95
|
+
detectedProject: null,
|
|
96
|
+
importGitChoice: null,
|
|
97
|
+
importStep: 0,
|
|
98
|
+
// UI state
|
|
83
99
|
selectedIndex: 0,
|
|
84
100
|
inputBuffer: '',
|
|
85
101
|
error: null,
|
|
@@ -98,9 +114,37 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
98
114
|
}
|
|
99
115
|
const lines = [];
|
|
100
116
|
const border = renderBorder(context.width, s);
|
|
101
|
-
//
|
|
117
|
+
// Check if we're in import flow (projectType === 'existing')
|
|
118
|
+
if (this.state.projectType === 'existing') {
|
|
119
|
+
// Import flow header
|
|
120
|
+
lines.push(border);
|
|
121
|
+
lines.push(' ' + s.primaryBold('Import Existing Project') + s.muted(` [${String(this.state.importStep + 1)}/5]`));
|
|
122
|
+
lines.push('');
|
|
123
|
+
// Import step content
|
|
124
|
+
switch (this.state.importStep) {
|
|
125
|
+
case 0:
|
|
126
|
+
lines.push(...this.renderImportStep1(s));
|
|
127
|
+
break;
|
|
128
|
+
case 1:
|
|
129
|
+
lines.push(...this.renderImportStep2(s));
|
|
130
|
+
break;
|
|
131
|
+
case 2:
|
|
132
|
+
lines.push(...this.renderImportStep3(s));
|
|
133
|
+
break;
|
|
134
|
+
case 3:
|
|
135
|
+
lines.push(...this.renderImportStep4(s));
|
|
136
|
+
break;
|
|
137
|
+
case 4:
|
|
138
|
+
lines.push(...this.renderImportStep5(s));
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
// Footer for import flow
|
|
142
|
+
lines.push(...this.renderImportStepFooter(s));
|
|
143
|
+
return lines;
|
|
144
|
+
}
|
|
145
|
+
// Header for new project flow
|
|
102
146
|
lines.push(border);
|
|
103
|
-
lines.push(' ' + s.primaryBold('Initialize New Project') + s.muted(` [${String(this.state.step)}/
|
|
147
|
+
lines.push(' ' + s.primaryBold('Initialize New Project') + s.muted(` [${String(this.state.step)}/8]`));
|
|
104
148
|
lines.push('');
|
|
105
149
|
// Step content
|
|
106
150
|
switch (this.state.step) {
|
|
@@ -131,9 +175,6 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
131
175
|
case 8:
|
|
132
176
|
lines.push(...this.renderStep8(s));
|
|
133
177
|
break;
|
|
134
|
-
case 9:
|
|
135
|
-
lines.push(...this.renderStep9(s));
|
|
136
|
-
break;
|
|
137
178
|
}
|
|
138
179
|
// Footer
|
|
139
180
|
lines.push(...this.renderStepFooter(s));
|
|
@@ -152,7 +193,7 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
152
193
|
if (this.state.step === 0) {
|
|
153
194
|
lines.push(s.muted(' Up/Down Navigate | Enter Select | q/Esc Cancel'));
|
|
154
195
|
}
|
|
155
|
-
else if (this.state.step ===
|
|
196
|
+
else if (this.state.step === 8) {
|
|
156
197
|
lines.push(s.muted(' Up/Down Navigate | Enter Confirm | Esc Back'));
|
|
157
198
|
}
|
|
158
199
|
else if (isSelectionStep(this.state.step)) {
|
|
@@ -179,10 +220,16 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
179
220
|
lines.push(chalk.bold(' What would you like to do?'));
|
|
180
221
|
lines.push('');
|
|
181
222
|
lines.push(this.renderSelectionOption(s, 0, '1. Start a new project'));
|
|
182
|
-
lines.push(this.renderSelectionOption(s, 1, '2. Add workflow to existing project'
|
|
223
|
+
lines.push(this.renderSelectionOption(s, 1, '2. Add workflow to existing project'));
|
|
183
224
|
lines.push('');
|
|
184
|
-
|
|
185
|
-
|
|
225
|
+
if (this.state.selectedIndex === 0) {
|
|
226
|
+
lines.push(s.muted(' Start fresh with a structured project layout'));
|
|
227
|
+
lines.push(s.muted(' optimized for AI-assisted development.'));
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
lines.push(s.muted(' Import an existing codebase and add'));
|
|
231
|
+
lines.push(s.muted(' compilr workflow tracking.'));
|
|
232
|
+
}
|
|
186
233
|
return lines;
|
|
187
234
|
}
|
|
188
235
|
renderStep1(s) {
|
|
@@ -256,26 +303,50 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
256
303
|
}
|
|
257
304
|
renderStep6(s) {
|
|
258
305
|
const lines = [];
|
|
306
|
+
// Check git config on first render of this step
|
|
307
|
+
if (!this.state.gitConfigChecked) {
|
|
308
|
+
const config = checkGitConfig();
|
|
309
|
+
this.state.gitConfigChecked = true;
|
|
310
|
+
this.state.gitConfigValid = config.hasName && config.hasEmail;
|
|
311
|
+
this.state.gitUserName = config.userName;
|
|
312
|
+
this.state.gitUserEmail = config.userEmail;
|
|
313
|
+
}
|
|
314
|
+
// Git remote URL input mode
|
|
315
|
+
if (this.state.gitRemoteInputMode) {
|
|
316
|
+
lines.push(chalk.bold(' Git remote URL (optional)'));
|
|
317
|
+
lines.push('');
|
|
318
|
+
lines.push(' Enter the URL of your git remote repository.');
|
|
319
|
+
lines.push(' Useful for tracking even if the repo already exists.');
|
|
320
|
+
lines.push(' You can skip this and set it later via /projects (e key).');
|
|
321
|
+
lines.push('');
|
|
322
|
+
lines.push(` > ${this.state.inputBuffer}█`);
|
|
323
|
+
lines.push('');
|
|
324
|
+
lines.push(s.muted(' Enter Continue · Esc Skip'));
|
|
325
|
+
return lines;
|
|
326
|
+
}
|
|
327
|
+
// Main selection
|
|
259
328
|
lines.push(chalk.bold(' Initialize git repository?'));
|
|
260
329
|
lines.push('');
|
|
261
330
|
lines.push(this.renderSelectionOption(s, 0, 'Yes'));
|
|
262
331
|
lines.push(this.renderSelectionOption(s, 1, 'No'));
|
|
263
332
|
lines.push('');
|
|
264
|
-
|
|
333
|
+
if (this.state.gitConfigValid) {
|
|
334
|
+
lines.push(s.muted(' Creates git repo with initial commit'));
|
|
335
|
+
lines.push(s.muted(` Git user: ${this.state.gitUserName ?? ''} <${this.state.gitUserEmail ?? ''}>`));
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
lines.push(s.warning(' ⚠ Git config not set - initial commit will be skipped'));
|
|
339
|
+
if (!this.state.gitUserName) {
|
|
340
|
+
lines.push(s.muted(' Missing: git config --global user.name'));
|
|
341
|
+
}
|
|
342
|
+
if (!this.state.gitUserEmail) {
|
|
343
|
+
lines.push(s.muted(' Missing: git config --global user.email'));
|
|
344
|
+
}
|
|
345
|
+
lines.push(s.muted(' Configure via /config or run git config commands'));
|
|
346
|
+
}
|
|
265
347
|
return lines;
|
|
266
348
|
}
|
|
267
349
|
renderStep7(s) {
|
|
268
|
-
const lines = [];
|
|
269
|
-
lines.push(chalk.bold(' Track with project database?'));
|
|
270
|
-
lines.push('');
|
|
271
|
-
lines.push(this.renderSelectionOption(s, 0, 'Yes (recommended)'));
|
|
272
|
-
lines.push(this.renderSelectionOption(s, 1, 'No'));
|
|
273
|
-
lines.push('');
|
|
274
|
-
lines.push(s.muted(' Enables persistent project tracking, backlog management,'));
|
|
275
|
-
lines.push(s.muted(' and workflow features across sessions.'));
|
|
276
|
-
return lines;
|
|
277
|
-
}
|
|
278
|
-
renderStep8(s) {
|
|
279
350
|
const lines = [];
|
|
280
351
|
lines.push(chalk.bold(' Workflow mode'));
|
|
281
352
|
lines.push('');
|
|
@@ -289,7 +360,7 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
289
360
|
lines.push(s.muted(' Guided: Agent suggests next steps, tracks work item progress'));
|
|
290
361
|
return lines;
|
|
291
362
|
}
|
|
292
|
-
|
|
363
|
+
renderStep8(s) {
|
|
293
364
|
const lines = [];
|
|
294
365
|
lines.push(chalk.bold(' Ready to create project?'));
|
|
295
366
|
lines.push('');
|
|
@@ -299,10 +370,10 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
299
370
|
lines.push(` Tech: ${s.primary(this.state.techStack ? TECH_STACK_LABELS[this.state.techStack] : 'Not set')}`);
|
|
300
371
|
lines.push(` Standards: ${s.primary(this.state.codingStandards ? CODING_STANDARDS_LABELS[this.state.codingStandards] : 'Not set')}`);
|
|
301
372
|
lines.push(` Git: ${s.primary(this.state.initGit ? 'Yes' : 'No')}`);
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
lines.push(` Workflow: ${s.primary(WORKFLOW_MODE_LABELS[this.state.workflowMode])}`);
|
|
373
|
+
if (this.state.gitRemote) {
|
|
374
|
+
lines.push(` Remote: ${s.primary(this.state.gitRemote)}`);
|
|
305
375
|
}
|
|
376
|
+
lines.push(` Workflow: ${s.primary(WORKFLOW_MODE_LABELS[this.state.workflowMode])}`);
|
|
306
377
|
if (this.state.repoPattern === 'two-repo') {
|
|
307
378
|
lines.push('');
|
|
308
379
|
lines.push(s.muted(` Docs repo: ./${this.state.projectName}-docs/`));
|
|
@@ -317,6 +388,178 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
317
388
|
return lines;
|
|
318
389
|
}
|
|
319
390
|
// ===========================================================================
|
|
391
|
+
// Import Step Renderers
|
|
392
|
+
// ===========================================================================
|
|
393
|
+
renderImportStep1(s) {
|
|
394
|
+
const lines = [];
|
|
395
|
+
lines.push(chalk.bold(' Enter path to existing project'));
|
|
396
|
+
lines.push('');
|
|
397
|
+
lines.push(` > ${this.state.inputBuffer}|`);
|
|
398
|
+
lines.push('');
|
|
399
|
+
if (this.state.error) {
|
|
400
|
+
lines.push(s.error(` ${this.state.error}`));
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
lines.push(s.muted(' Enter absolute or relative path to project directory'));
|
|
404
|
+
lines.push(s.muted(' Tab for autocomplete'));
|
|
405
|
+
}
|
|
406
|
+
return lines;
|
|
407
|
+
}
|
|
408
|
+
renderImportStep2(s) {
|
|
409
|
+
const lines = [];
|
|
410
|
+
const detected = this.state.detectedProject;
|
|
411
|
+
if (!detected) {
|
|
412
|
+
lines.push(s.error(' No project detected'));
|
|
413
|
+
return lines;
|
|
414
|
+
}
|
|
415
|
+
lines.push(chalk.bold(' Project Detection Results'));
|
|
416
|
+
lines.push('');
|
|
417
|
+
// Name
|
|
418
|
+
const nameIcon = detected.nameSource !== 'folder' ? s.success('✓') : s.warning('⚠');
|
|
419
|
+
const nameNote = detected.nameSource !== 'folder' ? `(from ${detected.nameSource})` : '(from folder name)';
|
|
420
|
+
lines.push(` ${nameIcon} Name: ${s.primary(detected.displayName)} ${s.muted(nameNote)}`);
|
|
421
|
+
// Language
|
|
422
|
+
const langIcon = detected.language ? s.success('✓') : s.warning('⚠');
|
|
423
|
+
const langLabel = getLanguageLabel(detected.language);
|
|
424
|
+
lines.push(` ${langIcon} Language: ${s.primary(langLabel)}`);
|
|
425
|
+
// Framework
|
|
426
|
+
if (detected.framework) {
|
|
427
|
+
lines.push(` ${s.success('✓')} Framework: ${s.primary(getFrameworkLabel(detected.framework))}`);
|
|
428
|
+
}
|
|
429
|
+
else if (detected.language) {
|
|
430
|
+
lines.push(` ${s.muted('-')} Framework: ${s.muted('Not detected')}`);
|
|
431
|
+
}
|
|
432
|
+
// Git
|
|
433
|
+
if (detected.hasGit && detected.gitRemote) {
|
|
434
|
+
lines.push(` ${s.success('✓')} Git: ${s.primary(detected.gitRemote)}`);
|
|
435
|
+
}
|
|
436
|
+
else if (detected.hasGit) {
|
|
437
|
+
lines.push(` ${s.warning('⚠')} Git: ${s.muted('No remote configured')}`);
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
lines.push(` ${s.warning('⚠')} Git: ${s.muted('Not initialized')}`);
|
|
441
|
+
}
|
|
442
|
+
// COMPILR.md
|
|
443
|
+
if (detected.hasCompilrMd) {
|
|
444
|
+
lines.push(` ${s.success('✓')} COMPILR.md: ${s.primary('Found')}`);
|
|
445
|
+
}
|
|
446
|
+
else if (detected.hasClaudeMd) {
|
|
447
|
+
lines.push(` ${s.success('✓')} CLAUDE.md: ${s.primary('Found (will use as COMPILR.md)')}`);
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
lines.push(` ${s.muted('○')} COMPILR.md: ${s.muted('Will be created')}`);
|
|
451
|
+
}
|
|
452
|
+
lines.push('');
|
|
453
|
+
lines.push(s.muted(' Press Enter to continue, or Esc to go back'));
|
|
454
|
+
return lines;
|
|
455
|
+
}
|
|
456
|
+
renderImportStep3(s) {
|
|
457
|
+
const lines = [];
|
|
458
|
+
const detected = this.state.detectedProject;
|
|
459
|
+
lines.push(chalk.bold(' Git Repository Setup'));
|
|
460
|
+
lines.push('');
|
|
461
|
+
// Custom input mode for remote URL
|
|
462
|
+
if (this.state.importGitChoice === 'custom' || this.state.importGitChoice === 'init') {
|
|
463
|
+
lines.push(' Enter git remote URL:');
|
|
464
|
+
lines.push('');
|
|
465
|
+
lines.push(` > ${this.state.inputBuffer}|`);
|
|
466
|
+
lines.push('');
|
|
467
|
+
lines.push(s.muted(' Enter to confirm, Esc to cancel'));
|
|
468
|
+
return lines;
|
|
469
|
+
}
|
|
470
|
+
if (detected?.hasGit && detected.gitRemote) {
|
|
471
|
+
// Has git with remote
|
|
472
|
+
lines.push(` Detected remote: ${s.primary(detected.gitRemote)}`);
|
|
473
|
+
lines.push('');
|
|
474
|
+
lines.push(this.renderSelectionOption(s, 0, 'Use detected remote'));
|
|
475
|
+
lines.push(this.renderSelectionOption(s, 1, 'Enter different remote URL'));
|
|
476
|
+
lines.push(this.renderSelectionOption(s, 2, 'Skip git remote (local only)'));
|
|
477
|
+
}
|
|
478
|
+
else if (detected?.hasGit) {
|
|
479
|
+
// Has git but no remote
|
|
480
|
+
lines.push(' Git repository found but no remote configured.');
|
|
481
|
+
lines.push('');
|
|
482
|
+
lines.push(this.renderSelectionOption(s, 0, 'Enter remote URL'));
|
|
483
|
+
lines.push(this.renderSelectionOption(s, 1, 'Skip git remote (local only)'));
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
// No git
|
|
487
|
+
lines.push(' No git repository found.');
|
|
488
|
+
lines.push('');
|
|
489
|
+
lines.push(this.renderSelectionOption(s, 0, 'Initialize git and enter remote URL'));
|
|
490
|
+
lines.push(this.renderSelectionOption(s, 1, 'Initialize git (local only)'));
|
|
491
|
+
lines.push(this.renderSelectionOption(s, 2, 'Skip git initialization'));
|
|
492
|
+
}
|
|
493
|
+
return lines;
|
|
494
|
+
}
|
|
495
|
+
renderImportStep4(s) {
|
|
496
|
+
const lines = [];
|
|
497
|
+
lines.push(chalk.bold(' Workflow mode'));
|
|
498
|
+
lines.push('');
|
|
499
|
+
for (let i = 0; i < WORKFLOW_MODE_OPTIONS.length; i++) {
|
|
500
|
+
const mode = WORKFLOW_MODE_OPTIONS[i];
|
|
501
|
+
const suffix = i === 0 ? ' (recommended)' : '';
|
|
502
|
+
lines.push(this.renderSelectionOption(s, i, `${String(i + 1)}. ${WORKFLOW_MODE_LABELS[mode]}${suffix}`));
|
|
503
|
+
}
|
|
504
|
+
lines.push('');
|
|
505
|
+
lines.push(s.muted(' Flexible: Work at your own pace, agent responds to requests'));
|
|
506
|
+
lines.push(s.muted(' Guided: Agent suggests next steps, tracks work item progress'));
|
|
507
|
+
return lines;
|
|
508
|
+
}
|
|
509
|
+
renderImportStep5(s) {
|
|
510
|
+
const lines = [];
|
|
511
|
+
const detected = this.state.detectedProject;
|
|
512
|
+
lines.push(chalk.bold(' Ready to import project?'));
|
|
513
|
+
lines.push('');
|
|
514
|
+
lines.push(` Path: ${s.primary(this.state.importPath)}`);
|
|
515
|
+
lines.push(` Name: ${s.primary(detected?.displayName ?? 'Unknown')}`);
|
|
516
|
+
lines.push(` Language: ${s.primary(getLanguageLabel(detected?.language ?? null))}`);
|
|
517
|
+
if (detected?.framework) {
|
|
518
|
+
lines.push(` Framework: ${s.primary(getFrameworkLabel(detected.framework))}`);
|
|
519
|
+
}
|
|
520
|
+
lines.push(` Git Remote: ${s.primary(this.state.gitRemote || 'None')}`);
|
|
521
|
+
lines.push(` Workflow: ${s.primary(WORKFLOW_MODE_LABELS[this.state.workflowMode])}`);
|
|
522
|
+
lines.push('');
|
|
523
|
+
lines.push(chalk.bold(' Will create:'));
|
|
524
|
+
if (!detected?.hasCompilrMd && !detected?.hasClaudeMd) {
|
|
525
|
+
lines.push(` ${s.success('✓')} COMPILR.md (project context file)`);
|
|
526
|
+
}
|
|
527
|
+
lines.push(` ${s.success('✓')} .compilr/config.json (local config)`);
|
|
528
|
+
lines.push(` ${s.success('✓')} Database entry (project tracking)`);
|
|
529
|
+
// Note if project is outside the standard projects folder
|
|
530
|
+
const projectsFolder = getProjectsPath();
|
|
531
|
+
if (!this.state.importPath.startsWith(projectsFolder)) {
|
|
532
|
+
lines.push('');
|
|
533
|
+
lines.push(s.muted(' Note: This project is outside your projects folder.'));
|
|
534
|
+
lines.push(s.muted(` It will be tracked at its current location.`));
|
|
535
|
+
}
|
|
536
|
+
lines.push('');
|
|
537
|
+
if (this.state.error) {
|
|
538
|
+
lines.push(s.error(` ${this.state.error}`));
|
|
539
|
+
lines.push('');
|
|
540
|
+
}
|
|
541
|
+
lines.push(this.renderSelectionOption(s, 0, 'Import'));
|
|
542
|
+
lines.push(this.renderSelectionOption(s, 1, 'Cancel'));
|
|
543
|
+
return lines;
|
|
544
|
+
}
|
|
545
|
+
renderImportStepFooter(s) {
|
|
546
|
+
const lines = [];
|
|
547
|
+
lines.push('');
|
|
548
|
+
if (this.state.importStep === 0) {
|
|
549
|
+
lines.push(s.muted(' Enter Confirm | Tab Autocomplete | Esc Cancel'));
|
|
550
|
+
}
|
|
551
|
+
else if (this.state.importStep === 4) {
|
|
552
|
+
lines.push(s.muted(' Up/Down Navigate | Enter Confirm | Esc Back'));
|
|
553
|
+
}
|
|
554
|
+
else if (this.state.importStep === 1) {
|
|
555
|
+
lines.push(s.muted(' Enter Continue | Esc Back'));
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
lines.push(s.muted(' Up/Down Navigate | Enter Select | Esc Back'));
|
|
559
|
+
}
|
|
560
|
+
return lines;
|
|
561
|
+
}
|
|
562
|
+
// ===========================================================================
|
|
320
563
|
// Key Handling
|
|
321
564
|
// ===========================================================================
|
|
322
565
|
handleKey(key) {
|
|
@@ -324,18 +567,35 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
324
567
|
if (this.isInterruptKey(key)) {
|
|
325
568
|
return this.close({ created: false });
|
|
326
569
|
}
|
|
570
|
+
// Import flow handling
|
|
571
|
+
if (this.state.projectType === 'existing') {
|
|
572
|
+
return this.handleImportKey(key);
|
|
573
|
+
}
|
|
327
574
|
// 'q' key on step 0 cancels
|
|
328
575
|
if (this.state.step === 0 && key.name === 'q') {
|
|
329
576
|
return this.close({ created: false });
|
|
330
577
|
}
|
|
331
578
|
// Escape on step 0 cancels, otherwise goes back
|
|
332
579
|
if (key.name === 'escape') {
|
|
580
|
+
// In git remote input mode, Esc skips to next step
|
|
581
|
+
if (this.state.gitRemoteInputMode) {
|
|
582
|
+
this.state.gitRemoteInputMode = false;
|
|
583
|
+
this.state.gitRemote = '';
|
|
584
|
+
this.state.inputBuffer = '';
|
|
585
|
+
this.state.step = 7;
|
|
586
|
+
this.state.selectedIndex = 0;
|
|
587
|
+
return this.rerender();
|
|
588
|
+
}
|
|
333
589
|
if (this.state.step === 0) {
|
|
334
590
|
return this.close({ created: false });
|
|
335
591
|
}
|
|
336
592
|
this.prevStep();
|
|
337
593
|
return this.rerender();
|
|
338
594
|
}
|
|
595
|
+
// Handle git remote URL input mode (sub-step of step 6)
|
|
596
|
+
if (this.state.gitRemoteInputMode) {
|
|
597
|
+
return this.handleGitRemoteInput(key);
|
|
598
|
+
}
|
|
339
599
|
// Handle selection steps
|
|
340
600
|
if (isSelectionStep(this.state.step)) {
|
|
341
601
|
return this.handleSelectionKey(key);
|
|
@@ -371,13 +631,28 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
371
631
|
return this.noAction();
|
|
372
632
|
}
|
|
373
633
|
async handleSelectionEnter() {
|
|
374
|
-
// Step 0 -
|
|
375
|
-
if (this.state.step === 0
|
|
376
|
-
this.state.
|
|
634
|
+
// Step 0 - choose between new and existing project
|
|
635
|
+
if (this.state.step === 0) {
|
|
636
|
+
if (this.state.selectedIndex === 0) {
|
|
637
|
+
// New project
|
|
638
|
+
this.state.projectType = 'new';
|
|
639
|
+
this.state.step = 1;
|
|
640
|
+
this.state.inputBuffer = '';
|
|
641
|
+
this.state.selectedIndex = 0;
|
|
642
|
+
this.state.error = null;
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
// Import existing project
|
|
646
|
+
this.state.projectType = 'existing';
|
|
647
|
+
this.state.importStep = 0;
|
|
648
|
+
this.state.inputBuffer = '';
|
|
649
|
+
this.state.selectedIndex = 0;
|
|
650
|
+
this.state.error = null;
|
|
651
|
+
}
|
|
377
652
|
return this.rerender();
|
|
378
653
|
}
|
|
379
|
-
// Step
|
|
380
|
-
if (this.state.step ===
|
|
654
|
+
// Step 8 - confirmation
|
|
655
|
+
if (this.state.step === 8) {
|
|
381
656
|
if (this.state.selectedIndex === 1) {
|
|
382
657
|
// Cancel
|
|
383
658
|
return this.close({ created: false });
|
|
@@ -409,10 +684,11 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
409
684
|
projectPath: result.projectPath,
|
|
410
685
|
docsPath: result.docsPath,
|
|
411
686
|
filesCreated: result.filesCreated,
|
|
412
|
-
trackInDatabase:
|
|
687
|
+
trackInDatabase: true, // Always track in database
|
|
413
688
|
workflowMode: this.state.workflowMode,
|
|
414
689
|
projectName: this.state.projectName,
|
|
415
690
|
description: this.state.description,
|
|
691
|
+
gitRemote: this.state.gitRemote || undefined,
|
|
416
692
|
});
|
|
417
693
|
}
|
|
418
694
|
else {
|
|
@@ -450,19 +726,404 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
450
726
|
}
|
|
451
727
|
return this.noAction();
|
|
452
728
|
}
|
|
729
|
+
handleGitRemoteInput(key) {
|
|
730
|
+
// Enter - confirm and move to next step
|
|
731
|
+
if (this.isEnterKey(key)) {
|
|
732
|
+
this.state.gitRemote = this.state.inputBuffer.trim();
|
|
733
|
+
this.state.gitRemoteInputMode = false;
|
|
734
|
+
this.state.inputBuffer = '';
|
|
735
|
+
this.state.step = 7;
|
|
736
|
+
this.state.selectedIndex = 0;
|
|
737
|
+
return this.rerender();
|
|
738
|
+
}
|
|
739
|
+
// Backspace - delete last character
|
|
740
|
+
if (key.name === 'backspace') {
|
|
741
|
+
this.state.inputBuffer = this.state.inputBuffer.slice(0, -1);
|
|
742
|
+
return this.rerender();
|
|
743
|
+
}
|
|
744
|
+
// Regular character input
|
|
745
|
+
if (key.char && key.char.length === 1 && key.char >= ' ' && key.char <= '~') {
|
|
746
|
+
this.state.inputBuffer += key.char;
|
|
747
|
+
return this.rerender();
|
|
748
|
+
}
|
|
749
|
+
return this.noAction();
|
|
750
|
+
}
|
|
751
|
+
// ===========================================================================
|
|
752
|
+
// Import Flow Key Handling
|
|
753
|
+
// ===========================================================================
|
|
754
|
+
handleImportKey(key) {
|
|
755
|
+
// Escape handling for import flow
|
|
756
|
+
if (key.name === 'escape') {
|
|
757
|
+
// In git remote custom input mode, cancel and go back to selection
|
|
758
|
+
if (this.state.importGitChoice === 'custom' || this.state.importGitChoice === 'init') {
|
|
759
|
+
this.state.importGitChoice = null;
|
|
760
|
+
this.state.inputBuffer = '';
|
|
761
|
+
return this.rerender();
|
|
762
|
+
}
|
|
763
|
+
// Step 0: go back to project type selection
|
|
764
|
+
if (this.state.importStep === 0) {
|
|
765
|
+
this.state.projectType = null;
|
|
766
|
+
this.state.step = 0;
|
|
767
|
+
this.state.selectedIndex = 1; // Keep "existing" selected
|
|
768
|
+
this.state.error = null;
|
|
769
|
+
return this.rerender();
|
|
770
|
+
}
|
|
771
|
+
// Other steps: go back
|
|
772
|
+
this.prevImportStep();
|
|
773
|
+
return this.rerender();
|
|
774
|
+
}
|
|
775
|
+
// Handle based on current step
|
|
776
|
+
switch (this.state.importStep) {
|
|
777
|
+
case 0: // Path input
|
|
778
|
+
return this.handleImportPathInput(key);
|
|
779
|
+
case 1: // Detection results (just Enter to continue)
|
|
780
|
+
if (this.isEnterKey(key)) {
|
|
781
|
+
this.nextImportStep();
|
|
782
|
+
return this.rerender();
|
|
783
|
+
}
|
|
784
|
+
return this.noAction();
|
|
785
|
+
case 2: // Git configuration
|
|
786
|
+
return this.handleImportGitStep(key);
|
|
787
|
+
case 3: // Workflow mode
|
|
788
|
+
return this.handleImportWorkflowStep(key);
|
|
789
|
+
case 4: // Confirmation
|
|
790
|
+
return this.handleImportConfirmation(key);
|
|
791
|
+
default:
|
|
792
|
+
return this.noAction();
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
handleImportPathInput(key) {
|
|
796
|
+
// Enter - validate and continue
|
|
797
|
+
if (this.isEnterKey(key)) {
|
|
798
|
+
const inputPath = this.state.inputBuffer.trim();
|
|
799
|
+
if (!inputPath) {
|
|
800
|
+
this.state.error = 'Path is required';
|
|
801
|
+
return this.rerender();
|
|
802
|
+
}
|
|
803
|
+
// Resolve to absolute path
|
|
804
|
+
const absolutePath = path.isAbsolute(inputPath)
|
|
805
|
+
? inputPath
|
|
806
|
+
: path.resolve(process.cwd(), inputPath);
|
|
807
|
+
// Validate path
|
|
808
|
+
const validation = validateImportPath(absolutePath);
|
|
809
|
+
if (!validation.valid) {
|
|
810
|
+
this.state.error = validation.error ?? 'Invalid path';
|
|
811
|
+
return this.rerender();
|
|
812
|
+
}
|
|
813
|
+
// Check if already tracked in database
|
|
814
|
+
const existingProject = projectRepository.getByPath(absolutePath);
|
|
815
|
+
if (existingProject) {
|
|
816
|
+
this.state.error = `Already tracked as "${existingProject.displayName}"`;
|
|
817
|
+
return this.rerender();
|
|
818
|
+
}
|
|
819
|
+
// Detect project info
|
|
820
|
+
this.state.importPath = absolutePath;
|
|
821
|
+
this.state.detectedProject = detectProjectInfo(absolutePath);
|
|
822
|
+
this.state.error = null;
|
|
823
|
+
this.nextImportStep();
|
|
824
|
+
return this.rerender();
|
|
825
|
+
}
|
|
826
|
+
// Tab - autocomplete
|
|
827
|
+
if (key.name === 'tab') {
|
|
828
|
+
const completedPath = this.autocompleteImportPath(this.state.inputBuffer);
|
|
829
|
+
if (completedPath) {
|
|
830
|
+
this.state.inputBuffer = completedPath;
|
|
831
|
+
this.state.error = null;
|
|
832
|
+
}
|
|
833
|
+
return this.rerender();
|
|
834
|
+
}
|
|
835
|
+
// Backspace
|
|
836
|
+
if (key.name === 'backspace') {
|
|
837
|
+
this.state.inputBuffer = this.state.inputBuffer.slice(0, -1);
|
|
838
|
+
this.state.error = null;
|
|
839
|
+
return this.rerender();
|
|
840
|
+
}
|
|
841
|
+
// Regular character input
|
|
842
|
+
if (key.char && key.char.length === 1 && key.char >= ' ' && key.char <= '~') {
|
|
843
|
+
this.state.inputBuffer += key.char;
|
|
844
|
+
this.state.error = null;
|
|
845
|
+
return this.rerender();
|
|
846
|
+
}
|
|
847
|
+
return this.noAction();
|
|
848
|
+
}
|
|
849
|
+
handleImportGitStep(key) {
|
|
850
|
+
const detected = this.state.detectedProject;
|
|
851
|
+
// In custom URL input mode
|
|
852
|
+
if (this.state.importGitChoice === 'custom' || this.state.importGitChoice === 'init') {
|
|
853
|
+
if (this.isEnterKey(key)) {
|
|
854
|
+
this.state.gitRemote = this.state.inputBuffer.trim();
|
|
855
|
+
this.state.inputBuffer = '';
|
|
856
|
+
this.state.importGitChoice = null;
|
|
857
|
+
this.nextImportStep();
|
|
858
|
+
return this.rerender();
|
|
859
|
+
}
|
|
860
|
+
if (key.name === 'backspace') {
|
|
861
|
+
this.state.inputBuffer = this.state.inputBuffer.slice(0, -1);
|
|
862
|
+
return this.rerender();
|
|
863
|
+
}
|
|
864
|
+
if (key.char && key.char.length === 1 && key.char >= ' ' && key.char <= '~') {
|
|
865
|
+
this.state.inputBuffer += key.char;
|
|
866
|
+
return this.rerender();
|
|
867
|
+
}
|
|
868
|
+
return this.noAction();
|
|
869
|
+
}
|
|
870
|
+
// Navigation
|
|
871
|
+
const maxOptions = this.getImportGitMaxOptions();
|
|
872
|
+
if ((key.name === 'j' || this.isDownKey(key)) && this.state.selectedIndex < maxOptions - 1) {
|
|
873
|
+
this.state.selectedIndex++;
|
|
874
|
+
return this.rerender();
|
|
875
|
+
}
|
|
876
|
+
if ((key.name === 'k' || this.isUpKey(key)) && this.state.selectedIndex > 0) {
|
|
877
|
+
this.state.selectedIndex--;
|
|
878
|
+
return this.rerender();
|
|
879
|
+
}
|
|
880
|
+
// Enter to select
|
|
881
|
+
if (this.isEnterKey(key)) {
|
|
882
|
+
if (detected?.hasGit && detected.gitRemote) {
|
|
883
|
+
// Has git with remote
|
|
884
|
+
switch (this.state.selectedIndex) {
|
|
885
|
+
case 0: // Use detected
|
|
886
|
+
this.state.gitRemote = detected.gitRemote;
|
|
887
|
+
this.nextImportStep();
|
|
888
|
+
break;
|
|
889
|
+
case 1: // Custom
|
|
890
|
+
this.state.importGitChoice = 'custom';
|
|
891
|
+
this.state.inputBuffer = '';
|
|
892
|
+
break;
|
|
893
|
+
case 2: // Skip
|
|
894
|
+
this.state.gitRemote = '';
|
|
895
|
+
this.nextImportStep();
|
|
896
|
+
break;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
else if (detected?.hasGit) {
|
|
900
|
+
// Has git but no remote
|
|
901
|
+
switch (this.state.selectedIndex) {
|
|
902
|
+
case 0: // Enter URL
|
|
903
|
+
this.state.importGitChoice = 'custom';
|
|
904
|
+
this.state.inputBuffer = '';
|
|
905
|
+
break;
|
|
906
|
+
case 1: // Skip
|
|
907
|
+
this.state.gitRemote = '';
|
|
908
|
+
this.nextImportStep();
|
|
909
|
+
break;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
else {
|
|
913
|
+
// No git
|
|
914
|
+
switch (this.state.selectedIndex) {
|
|
915
|
+
case 0: // Init + URL
|
|
916
|
+
this.state.importGitChoice = 'init';
|
|
917
|
+
this.state.inputBuffer = '';
|
|
918
|
+
this.state.initGit = true;
|
|
919
|
+
break;
|
|
920
|
+
case 1: // Init only
|
|
921
|
+
this.state.initGit = true;
|
|
922
|
+
this.state.gitRemote = '';
|
|
923
|
+
this.nextImportStep();
|
|
924
|
+
break;
|
|
925
|
+
case 2: // Skip
|
|
926
|
+
this.state.initGit = false;
|
|
927
|
+
this.state.gitRemote = '';
|
|
928
|
+
this.nextImportStep();
|
|
929
|
+
break;
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
return this.rerender();
|
|
933
|
+
}
|
|
934
|
+
return this.noAction();
|
|
935
|
+
}
|
|
936
|
+
handleImportWorkflowStep(key) {
|
|
937
|
+
const maxOptions = WORKFLOW_MODE_OPTIONS.length;
|
|
938
|
+
// Navigation
|
|
939
|
+
if ((key.name === 'j' || this.isDownKey(key)) && this.state.selectedIndex < maxOptions - 1) {
|
|
940
|
+
this.state.selectedIndex++;
|
|
941
|
+
return this.rerender();
|
|
942
|
+
}
|
|
943
|
+
if ((key.name === 'k' || this.isUpKey(key)) && this.state.selectedIndex > 0) {
|
|
944
|
+
this.state.selectedIndex--;
|
|
945
|
+
return this.rerender();
|
|
946
|
+
}
|
|
947
|
+
// Enter to select
|
|
948
|
+
if (this.isEnterKey(key)) {
|
|
949
|
+
this.state.workflowMode = WORKFLOW_MODE_OPTIONS[this.state.selectedIndex];
|
|
950
|
+
this.nextImportStep();
|
|
951
|
+
return this.rerender();
|
|
952
|
+
}
|
|
953
|
+
return this.noAction();
|
|
954
|
+
}
|
|
955
|
+
handleImportConfirmation(key) {
|
|
956
|
+
// Navigation
|
|
957
|
+
if ((key.name === 'j' || this.isDownKey(key)) && this.state.selectedIndex < 1) {
|
|
958
|
+
this.state.selectedIndex++;
|
|
959
|
+
return this.rerender();
|
|
960
|
+
}
|
|
961
|
+
if ((key.name === 'k' || this.isUpKey(key)) && this.state.selectedIndex > 0) {
|
|
962
|
+
this.state.selectedIndex--;
|
|
963
|
+
return this.rerender();
|
|
964
|
+
}
|
|
965
|
+
// Enter to confirm
|
|
966
|
+
if (this.isEnterKey(key)) {
|
|
967
|
+
if (this.state.selectedIndex === 1) {
|
|
968
|
+
// Cancel
|
|
969
|
+
return this.close({ created: false });
|
|
970
|
+
}
|
|
971
|
+
// Import project
|
|
972
|
+
return this.executeImport();
|
|
973
|
+
}
|
|
974
|
+
return this.noAction();
|
|
975
|
+
}
|
|
976
|
+
executeImport() {
|
|
977
|
+
const detected = this.state.detectedProject;
|
|
978
|
+
if (!detected) {
|
|
979
|
+
this.state.error = 'No project detected';
|
|
980
|
+
return this.rerender();
|
|
981
|
+
}
|
|
982
|
+
this.state.isGenerating = true;
|
|
983
|
+
try {
|
|
984
|
+
// Create .compilr directory
|
|
985
|
+
const compilrDir = path.join(this.state.importPath, '.compilr');
|
|
986
|
+
if (!fs.existsSync(compilrDir)) {
|
|
987
|
+
fs.mkdirSync(compilrDir, { recursive: true });
|
|
988
|
+
}
|
|
989
|
+
// Create .compilr/config.json
|
|
990
|
+
const configContent = JSON.stringify({
|
|
991
|
+
version: 1,
|
|
992
|
+
projectPath: this.state.importPath,
|
|
993
|
+
workflow_mode: this.state.workflowMode,
|
|
994
|
+
created_at: new Date().toISOString(),
|
|
995
|
+
}, null, 2);
|
|
996
|
+
fs.writeFileSync(path.join(compilrDir, 'config.json'), configContent, 'utf-8');
|
|
997
|
+
// Create COMPILR.md if it doesn't exist
|
|
998
|
+
if (!detected.hasCompilrMd && !detected.hasClaudeMd) {
|
|
999
|
+
const compilrMdContent = generateCompilrMdForImport({
|
|
1000
|
+
name: detected.name,
|
|
1001
|
+
displayName: detected.displayName,
|
|
1002
|
+
path: this.state.importPath,
|
|
1003
|
+
detected,
|
|
1004
|
+
workflowMode: this.state.workflowMode,
|
|
1005
|
+
});
|
|
1006
|
+
fs.writeFileSync(path.join(this.state.importPath, 'COMPILR.md'), compilrMdContent, 'utf-8');
|
|
1007
|
+
}
|
|
1008
|
+
// Initialize git if requested and not already initialized
|
|
1009
|
+
if (this.state.initGit && !detected.hasGit) {
|
|
1010
|
+
try {
|
|
1011
|
+
execSync('git init', { cwd: this.state.importPath, stdio: 'ignore' });
|
|
1012
|
+
}
|
|
1013
|
+
catch {
|
|
1014
|
+
// Git init failed - not critical
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
// Return success - database registration is handled by the command handler
|
|
1018
|
+
return this.close({
|
|
1019
|
+
created: true,
|
|
1020
|
+
imported: true,
|
|
1021
|
+
projectPath: this.state.importPath,
|
|
1022
|
+
trackInDatabase: true,
|
|
1023
|
+
workflowMode: this.state.workflowMode,
|
|
1024
|
+
projectName: detected.name,
|
|
1025
|
+
description: undefined, // No description for imports
|
|
1026
|
+
gitRemote: this.state.gitRemote || undefined,
|
|
1027
|
+
detectedProject: detected,
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
catch (error) {
|
|
1031
|
+
this.state.isGenerating = false;
|
|
1032
|
+
this.state.error = error.message;
|
|
1033
|
+
return this.rerender();
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
getImportGitMaxOptions() {
|
|
1037
|
+
const detected = this.state.detectedProject;
|
|
1038
|
+
if (detected?.hasGit && detected.gitRemote)
|
|
1039
|
+
return 3;
|
|
1040
|
+
if (detected?.hasGit)
|
|
1041
|
+
return 2;
|
|
1042
|
+
return 3;
|
|
1043
|
+
}
|
|
1044
|
+
nextImportStep() {
|
|
1045
|
+
this.state.importStep = Math.min(4, this.state.importStep + 1);
|
|
1046
|
+
this.state.selectedIndex = 0;
|
|
1047
|
+
this.state.error = null;
|
|
1048
|
+
}
|
|
1049
|
+
prevImportStep() {
|
|
1050
|
+
this.state.importStep = Math.max(0, this.state.importStep - 1);
|
|
1051
|
+
this.state.selectedIndex = 0;
|
|
1052
|
+
this.state.error = null;
|
|
1053
|
+
}
|
|
1054
|
+
autocompleteImportPath(input) {
|
|
1055
|
+
if (!input)
|
|
1056
|
+
return null;
|
|
1057
|
+
try {
|
|
1058
|
+
// Resolve the input to determine directory and prefix
|
|
1059
|
+
const resolvedInput = input.startsWith('/')
|
|
1060
|
+
? input
|
|
1061
|
+
: path.resolve(process.cwd(), input);
|
|
1062
|
+
let dir;
|
|
1063
|
+
let prefix;
|
|
1064
|
+
if (fs.existsSync(resolvedInput) && fs.statSync(resolvedInput).isDirectory()) {
|
|
1065
|
+
// Input is a complete directory, list its contents
|
|
1066
|
+
dir = resolvedInput;
|
|
1067
|
+
prefix = '';
|
|
1068
|
+
}
|
|
1069
|
+
else {
|
|
1070
|
+
// Input is partial, get parent directory and prefix
|
|
1071
|
+
dir = path.dirname(resolvedInput);
|
|
1072
|
+
prefix = path.basename(resolvedInput).toLowerCase();
|
|
1073
|
+
}
|
|
1074
|
+
if (!fs.existsSync(dir))
|
|
1075
|
+
return null;
|
|
1076
|
+
// Get directory contents
|
|
1077
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true })
|
|
1078
|
+
.filter((e) => e.isDirectory())
|
|
1079
|
+
.filter((e) => !e.name.startsWith('.')) // Hide hidden directories
|
|
1080
|
+
.map((e) => e.name);
|
|
1081
|
+
// Find matches
|
|
1082
|
+
const matches = entries.filter((name) => name.toLowerCase().startsWith(prefix));
|
|
1083
|
+
if (matches.length === 0)
|
|
1084
|
+
return null;
|
|
1085
|
+
if (matches.length === 1) {
|
|
1086
|
+
// Single match - complete it with trailing slash
|
|
1087
|
+
const completed = path.join(dir, matches[0]);
|
|
1088
|
+
// Keep relative if input was relative
|
|
1089
|
+
if (!input.startsWith('/')) {
|
|
1090
|
+
const relative = path.relative(process.cwd(), completed);
|
|
1091
|
+
return relative + '/';
|
|
1092
|
+
}
|
|
1093
|
+
return completed + '/';
|
|
1094
|
+
}
|
|
1095
|
+
// Multiple matches - find common prefix
|
|
1096
|
+
const sortedMatches = matches.sort();
|
|
1097
|
+
const first = sortedMatches[0];
|
|
1098
|
+
const last = sortedMatches[sortedMatches.length - 1];
|
|
1099
|
+
let common = '';
|
|
1100
|
+
for (let i = 0; i < first.length; i++) {
|
|
1101
|
+
if (first[i] === last[i]) {
|
|
1102
|
+
common += first[i];
|
|
1103
|
+
}
|
|
1104
|
+
else {
|
|
1105
|
+
break;
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
if (common.length > prefix.length) {
|
|
1109
|
+
const completed = path.join(dir, common);
|
|
1110
|
+
if (!input.startsWith('/')) {
|
|
1111
|
+
return path.relative(process.cwd(), completed);
|
|
1112
|
+
}
|
|
1113
|
+
return completed;
|
|
1114
|
+
}
|
|
1115
|
+
return null;
|
|
1116
|
+
}
|
|
1117
|
+
catch {
|
|
1118
|
+
return null;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
453
1121
|
// ===========================================================================
|
|
454
1122
|
// Step Navigation
|
|
455
1123
|
// ===========================================================================
|
|
456
1124
|
nextStep() {
|
|
457
1125
|
switch (this.state.step) {
|
|
458
|
-
|
|
459
|
-
if (this.state.selectedIndex === 0) {
|
|
460
|
-
this.state.projectType = 'new';
|
|
461
|
-
this.state.step = 1;
|
|
462
|
-
this.state.inputBuffer = '';
|
|
463
|
-
this.state.selectedIndex = 0;
|
|
464
|
-
}
|
|
465
|
-
break;
|
|
1126
|
+
// Note: step 0 is handled in handleSelectionEnter() since it branches to import flow
|
|
466
1127
|
case 1:
|
|
467
1128
|
this.state.projectName = this.state.inputBuffer.trim();
|
|
468
1129
|
this.state.step = 2;
|
|
@@ -490,18 +1151,14 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
490
1151
|
break;
|
|
491
1152
|
case 6:
|
|
492
1153
|
this.state.initGit = this.state.selectedIndex === 0;
|
|
493
|
-
|
|
494
|
-
|
|
1154
|
+
// Always prompt for git remote URL (useful even if not initializing git)
|
|
1155
|
+
// User might have an existing repo on GitHub they want to associate
|
|
1156
|
+
this.state.gitRemoteInputMode = true;
|
|
1157
|
+
this.state.inputBuffer = '';
|
|
495
1158
|
break;
|
|
496
1159
|
case 7:
|
|
497
|
-
this.state.trackInDatabase = this.state.selectedIndex === 0;
|
|
498
|
-
// If tracking in DB, ask for workflow mode; otherwise skip to confirmation
|
|
499
|
-
this.state.step = this.state.trackInDatabase ? 8 : 9;
|
|
500
|
-
this.state.selectedIndex = 0;
|
|
501
|
-
break;
|
|
502
|
-
case 8:
|
|
503
1160
|
this.state.workflowMode = WORKFLOW_MODE_OPTIONS[this.state.selectedIndex];
|
|
504
|
-
this.state.step =
|
|
1161
|
+
this.state.step = 8;
|
|
505
1162
|
this.state.selectedIndex = 0;
|
|
506
1163
|
break;
|
|
507
1164
|
}
|
|
@@ -539,14 +1196,7 @@ export class NewProjectOverlayV2 extends BaseOverlayV2 {
|
|
|
539
1196
|
break;
|
|
540
1197
|
case 8:
|
|
541
1198
|
this.state.step = 7;
|
|
542
|
-
this.state.selectedIndex = this.state.
|
|
543
|
-
break;
|
|
544
|
-
case 9:
|
|
545
|
-
// Go back to workflow mode if DB tracking is on, otherwise go to DB tracking step
|
|
546
|
-
this.state.step = this.state.trackInDatabase ? 8 : 7;
|
|
547
|
-
this.state.selectedIndex = this.state.trackInDatabase
|
|
548
|
-
? WORKFLOW_MODE_OPTIONS.indexOf(this.state.workflowMode)
|
|
549
|
-
: 1;
|
|
1199
|
+
this.state.selectedIndex = WORKFLOW_MODE_OPTIONS.indexOf(this.state.workflowMode);
|
|
550
1200
|
break;
|
|
551
1201
|
}
|
|
552
1202
|
this.state.error = null;
|