@compilr-dev/cli 0.4.0 → 0.5.0
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 +30 -12
- package/dist/agent.d.ts +74 -1
- package/dist/agent.js +259 -76
- package/dist/anchors/index.d.ts +9 -0
- package/dist/anchors/index.js +9 -0
- package/dist/anchors/project-anchors.d.ts +79 -0
- package/dist/anchors/project-anchors.js +202 -0
- package/dist/commands/handler-types.d.ts +68 -0
- package/dist/commands/handler-types.js +8 -0
- package/dist/commands/handlers/agent-commands.d.ts +13 -0
- package/dist/commands/handlers/agent-commands.js +305 -0
- package/dist/commands/handlers/design-commands.d.ts +15 -0
- package/dist/commands/handlers/design-commands.js +334 -0
- package/dist/commands/handlers/index.d.ts +20 -0
- package/dist/commands/handlers/index.js +43 -0
- package/dist/commands/handlers/overlay-commands.d.ts +21 -0
- package/dist/commands/handlers/overlay-commands.js +287 -0
- package/dist/commands/handlers/project-commands.d.ts +11 -0
- package/dist/commands/handlers/project-commands.js +167 -0
- package/dist/commands/handlers/simple-commands.d.ts +19 -0
- package/dist/commands/handlers/simple-commands.js +144 -0
- package/dist/commands/index.d.ts +2 -1
- package/dist/commands/registry.d.ts +50 -0
- package/dist/commands/registry.js +75 -0
- package/dist/commands-v2/handlers/context.d.ts +13 -0
- package/dist/commands-v2/handlers/context.js +348 -0
- package/dist/commands-v2/handlers/core.d.ts +13 -0
- package/dist/commands-v2/handlers/core.js +165 -0
- package/dist/commands-v2/handlers/debug.d.ts +11 -0
- package/dist/commands-v2/handlers/debug.js +159 -0
- package/dist/commands-v2/handlers/index.d.ts +12 -0
- package/dist/commands-v2/handlers/index.js +24 -0
- package/dist/commands-v2/handlers/project.d.ts +22 -0
- package/dist/commands-v2/handlers/project.js +814 -0
- package/dist/commands-v2/handlers/settings.d.ts +15 -0
- package/dist/commands-v2/handlers/settings.js +235 -0
- package/dist/commands-v2/index.d.ts +13 -0
- package/dist/commands-v2/index.js +15 -0
- package/dist/commands-v2/registry.d.ts +37 -0
- package/dist/commands-v2/registry.js +80 -0
- package/dist/commands-v2/types.d.ts +75 -0
- package/dist/commands-v2/types.js +7 -0
- package/dist/commands.js +110 -7
- package/dist/index.js +288 -29
- package/dist/input-handlers/index.d.ts +7 -0
- package/dist/input-handlers/index.js +7 -0
- package/dist/input-handlers/memory-handler.d.ts +26 -0
- package/dist/input-handlers/memory-handler.js +68 -0
- package/dist/repl-helpers.d.ts +63 -0
- package/dist/repl-helpers.js +318 -0
- package/dist/repl-v2.d.ts +155 -0
- package/dist/repl-v2.js +774 -0
- package/dist/repl.d.ts +32 -4
- package/dist/repl.js +250 -977
- package/dist/settings/index.d.ts +23 -0
- package/dist/settings/index.js +48 -0
- package/dist/settings/paths.d.ts +110 -0
- package/dist/settings/paths.js +264 -0
- package/dist/templates/compilr-md.js +7 -4
- package/dist/templates/index.js +3 -4
- package/dist/themes/colors.js +3 -1
- package/dist/themes/registry.d.ts +5 -36
- package/dist/themes/registry.js +11 -95
- package/dist/themes/types.d.ts +3 -38
- package/dist/themes/types.js +2 -2
- package/dist/tools/anchor-tools.d.ts +31 -0
- package/dist/tools/anchor-tools.js +255 -0
- package/dist/tools/backlog-wrappers.d.ts +54 -0
- package/dist/tools/backlog-wrappers.js +338 -0
- package/dist/tools/backlog.js +1 -1
- package/dist/tools/db-tools.d.ts +65 -0
- package/dist/tools/db-tools.js +19 -0
- package/dist/tools/document-db.d.ts +43 -0
- package/dist/tools/document-db.js +220 -0
- package/dist/tools/project-db.d.ts +102 -0
- package/dist/tools/project-db.js +370 -0
- package/dist/tools/workitem-db.d.ts +103 -0
- package/dist/tools/workitem-db.js +549 -0
- package/dist/tools.js +13 -3
- package/dist/ui/agents-overlay-v2.d.ts +43 -0
- package/dist/ui/agents-overlay-v2.js +809 -0
- package/dist/ui/agents-overlay.d.ts +5 -5
- package/dist/ui/agents-overlay.js +782 -420
- package/dist/ui/anchors-overlay.d.ts +12 -0
- package/dist/ui/anchors-overlay.js +775 -0
- package/dist/ui/arch-type-overlay.d.ts +1 -6
- package/dist/ui/arch-type-overlay.js +175 -203
- package/dist/ui/ask-user-overlay-v2.d.ts +26 -0
- package/dist/ui/ask-user-overlay-v2.js +555 -0
- package/dist/ui/ask-user-overlay.d.ts +2 -2
- package/dist/ui/ask-user-overlay.js +443 -535
- package/dist/ui/ask-user-simple-overlay-v2.d.ts +25 -0
- package/dist/ui/ask-user-simple-overlay-v2.js +215 -0
- package/dist/ui/ask-user-simple-overlay.d.ts +2 -2
- package/dist/ui/ask-user-simple-overlay.js +182 -209
- package/dist/ui/backlog-overlay.d.ts +16 -1
- package/dist/ui/backlog-overlay.js +525 -659
- package/dist/ui/base/index.d.ts +26 -0
- package/dist/ui/base/index.js +33 -0
- package/dist/ui/base/inline-overlay-utils.d.ts +217 -0
- package/dist/ui/base/inline-overlay-utils.js +320 -0
- package/dist/ui/base/inline-overlay.d.ts +159 -0
- package/dist/ui/base/inline-overlay.js +257 -0
- package/dist/ui/base/key-utils.d.ts +15 -0
- package/dist/ui/base/key-utils.js +30 -0
- package/dist/ui/base/overlay-base-v2.d.ts +193 -0
- package/dist/ui/base/overlay-base-v2.js +246 -0
- package/dist/ui/base/overlay-base.d.ts +156 -0
- package/dist/ui/base/overlay-base.js +238 -0
- package/dist/ui/base/overlay-lifecycle.d.ts +65 -0
- package/dist/ui/base/overlay-lifecycle.js +159 -0
- package/dist/ui/base/overlay-types.d.ts +185 -0
- package/dist/ui/base/overlay-types.js +7 -0
- package/dist/ui/base/render-utils.d.ts +8 -0
- package/dist/ui/base/render-utils.js +11 -0
- package/dist/ui/base/screen-stack.d.ts +148 -0
- package/dist/ui/base/screen-stack.js +184 -0
- package/dist/ui/base/tabbed-list-overlay-v2.d.ts +103 -0
- package/dist/ui/base/tabbed-list-overlay-v2.js +317 -0
- package/dist/ui/base/tabbed-list-overlay.d.ts +153 -0
- package/dist/ui/base/tabbed-list-overlay.js +369 -0
- package/dist/ui/commands-overlay-v2.d.ts +33 -0
- package/dist/ui/commands-overlay-v2.js +441 -0
- package/dist/ui/commands-overlay.d.ts +7 -2
- package/dist/ui/commands-overlay.js +384 -355
- package/dist/ui/config-overlay.d.ts +5 -4
- package/dist/ui/config-overlay.js +243 -513
- package/dist/ui/conversation.d.ts +75 -4
- package/dist/ui/conversation.js +374 -161
- package/dist/ui/docs-overlay.d.ts +17 -0
- package/dist/ui/docs-overlay.js +303 -0
- package/dist/ui/ephemeral.d.ts +1 -1
- package/dist/ui/ephemeral.js +1 -1
- package/dist/ui/features/index.d.ts +34 -0
- package/dist/ui/features/index.js +34 -0
- package/dist/ui/features/input-feature.d.ts +85 -0
- package/dist/ui/features/input-feature.js +238 -0
- package/dist/ui/features/list-feature.d.ts +155 -0
- package/dist/ui/features/list-feature.js +244 -0
- package/dist/ui/features/pagination-feature.d.ts +154 -0
- package/dist/ui/features/pagination-feature.js +238 -0
- package/dist/ui/features/search-feature.d.ts +148 -0
- package/dist/ui/features/search-feature.js +185 -0
- package/dist/ui/features/tab-feature.d.ts +194 -0
- package/dist/ui/features/tab-feature.js +307 -0
- package/dist/ui/footer-v2.d.ts +222 -0
- package/dist/ui/footer-v2.js +1349 -0
- package/dist/ui/footer.d.ts +107 -0
- package/dist/ui/footer.js +359 -67
- package/dist/ui/guardrail-overlay.d.ts +29 -0
- package/dist/ui/guardrail-overlay.js +145 -0
- package/dist/ui/help-overlay-v2.d.ts +34 -0
- package/dist/ui/help-overlay-v2.js +309 -0
- package/dist/ui/help-overlay.d.ts +16 -0
- package/dist/ui/help-overlay.js +316 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -3
- package/dist/ui/init-overlay-v2.d.ts +34 -0
- package/dist/ui/init-overlay-v2.js +600 -0
- package/dist/ui/init-overlay.d.ts +12 -2
- package/dist/ui/init-overlay.js +349 -270
- package/dist/ui/input-prompt-v2.d.ts +1 -0
- package/dist/ui/input-prompt-v2.js +14 -6
- package/dist/ui/input-prompt.d.ts +116 -33
- package/dist/ui/input-prompt.js +536 -337
- package/dist/ui/iteration-limit-overlay-v2.d.ts +21 -0
- package/dist/ui/iteration-limit-overlay-v2.js +114 -0
- package/dist/ui/iteration-limit-overlay.d.ts +2 -2
- package/dist/ui/iteration-limit-overlay.js +92 -128
- package/dist/ui/keys-overlay-v2.d.ts +41 -0
- package/dist/ui/keys-overlay-v2.js +248 -0
- package/dist/ui/keys-overlay.d.ts +1 -0
- package/dist/ui/keys-overlay.js +203 -141
- package/dist/ui/line-utils.d.ts +88 -0
- package/dist/ui/line-utils.js +150 -0
- package/dist/ui/live-region.d.ts +161 -0
- package/dist/ui/live-region.js +387 -0
- package/dist/ui/mascot/expressions.d.ts +32 -0
- package/dist/ui/mascot/expressions.js +213 -0
- package/dist/ui/mascot/index.d.ts +8 -0
- package/dist/ui/mascot/index.js +8 -0
- package/dist/ui/mascot/renderer.d.ts +19 -0
- package/dist/ui/mascot/renderer.js +97 -0
- package/dist/ui/mascot-overlay-v2.d.ts +41 -0
- package/dist/ui/mascot-overlay-v2.js +138 -0
- package/dist/ui/mascot-overlay.d.ts +21 -0
- package/dist/ui/mascot-overlay.js +146 -0
- package/dist/ui/model-overlay-v2.d.ts +49 -0
- package/dist/ui/model-overlay-v2.js +118 -0
- package/dist/ui/model-overlay.d.ts +27 -0
- package/dist/ui/model-overlay.js +221 -0
- package/dist/ui/model-warning-overlay.js +3 -5
- package/dist/ui/new-overlay.d.ts +34 -0
- package/dist/ui/new-overlay.js +604 -0
- package/dist/ui/overlay/impl/agents-overlay-v2.d.ts +45 -0
- package/dist/ui/overlay/impl/agents-overlay-v2.js +825 -0
- package/dist/ui/overlay/impl/anchors-overlay-v2.d.ts +47 -0
- package/dist/ui/overlay/impl/anchors-overlay-v2.js +783 -0
- package/dist/ui/overlay/impl/arch-type-overlay-v2.d.ts +37 -0
- package/dist/ui/overlay/impl/arch-type-overlay-v2.js +240 -0
- package/dist/ui/overlay/impl/ask-user-overlay-v2.d.ts +72 -0
- package/dist/ui/overlay/impl/ask-user-overlay-v2.js +584 -0
- package/dist/ui/overlay/impl/ask-user-simple-overlay-v2.d.ts +46 -0
- package/dist/ui/overlay/impl/ask-user-simple-overlay-v2.js +204 -0
- package/dist/ui/overlay/impl/backlog-overlay-v2.d.ts +49 -0
- package/dist/ui/overlay/impl/backlog-overlay-v2.js +642 -0
- package/dist/ui/overlay/impl/commands-overlay-v2.d.ts +33 -0
- package/dist/ui/overlay/impl/commands-overlay-v2.js +441 -0
- package/dist/ui/overlay/impl/config-overlay-v2.d.ts +100 -0
- package/dist/ui/overlay/impl/config-overlay-v2.js +654 -0
- package/dist/ui/overlay/impl/dashboard-overlay-v2.d.ts +55 -0
- package/dist/ui/overlay/impl/dashboard-overlay-v2.js +359 -0
- package/dist/ui/overlay/impl/docs-overlay-v2.d.ts +45 -0
- package/dist/ui/overlay/impl/docs-overlay-v2.js +114 -0
- package/dist/ui/overlay/impl/document-detail-overlay-v2.d.ts +77 -0
- package/dist/ui/overlay/impl/document-detail-overlay-v2.js +1071 -0
- package/dist/ui/overlay/impl/guardrail-overlay-v2.d.ts +43 -0
- package/dist/ui/overlay/impl/guardrail-overlay-v2.js +114 -0
- package/dist/ui/overlay/impl/help-overlay-v2.d.ts +34 -0
- package/dist/ui/overlay/impl/help-overlay-v2.js +309 -0
- package/dist/ui/overlay/impl/init-overlay-v2.d.ts +77 -0
- package/dist/ui/overlay/impl/init-overlay-v2.js +593 -0
- package/dist/ui/overlay/impl/init-setup-overlay-v2.d.ts +25 -0
- package/dist/ui/overlay/impl/init-setup-overlay-v2.js +97 -0
- package/dist/ui/overlay/impl/iteration-limit-overlay-v2.d.ts +35 -0
- package/dist/ui/overlay/impl/iteration-limit-overlay-v2.js +105 -0
- package/dist/ui/overlay/impl/keys-overlay-v2.d.ts +41 -0
- package/dist/ui/overlay/impl/keys-overlay-v2.js +248 -0
- package/dist/ui/overlay/impl/mascot-overlay-v2.d.ts +41 -0
- package/dist/ui/overlay/impl/mascot-overlay-v2.js +138 -0
- package/dist/ui/overlay/impl/model-overlay-v2.d.ts +49 -0
- package/dist/ui/overlay/impl/model-overlay-v2.js +118 -0
- package/dist/ui/overlay/impl/model-warning-overlay-v2.d.ts +46 -0
- package/dist/ui/overlay/impl/model-warning-overlay-v2.js +132 -0
- package/dist/ui/overlay/impl/new-overlay-v2.d.ts +77 -0
- package/dist/ui/overlay/impl/new-overlay-v2.js +593 -0
- package/dist/ui/overlay/impl/permission-overlay-v2.d.ts +36 -0
- package/dist/ui/overlay/impl/permission-overlay-v2.js +380 -0
- package/dist/ui/overlay/impl/projects-overlay-v2.d.ts +36 -0
- package/dist/ui/overlay/impl/projects-overlay-v2.js +499 -0
- package/dist/ui/overlay/impl/theme-overlay-v2.d.ts +42 -0
- package/dist/ui/overlay/impl/theme-overlay-v2.js +135 -0
- package/dist/ui/overlay/impl/tools-overlay-v2.d.ts +47 -0
- package/dist/ui/overlay/impl/tools-overlay-v2.js +218 -0
- package/dist/ui/overlay/impl/tutorial-overlay-v2.d.ts +31 -0
- package/dist/ui/overlay/impl/tutorial-overlay-v2.js +1035 -0
- package/dist/ui/overlay/impl/workflow-overlay-v2.d.ts +80 -0
- package/dist/ui/overlay/impl/workflow-overlay-v2.js +637 -0
- package/dist/ui/overlay/index.d.ts +33 -0
- package/dist/ui/overlay/index.js +35 -0
- package/dist/ui/overlay/key-utils.d.ts +6 -0
- package/dist/ui/overlay/key-utils.js +6 -0
- package/dist/ui/overlay/overlay-types.d.ts +128 -0
- package/dist/ui/overlay/overlay-types.js +22 -0
- package/dist/ui/overlay/types.d.ts +135 -0
- package/dist/ui/overlay/types.js +22 -0
- package/dist/ui/overlays/help-overlay-v2.d.ts +28 -0
- package/dist/ui/overlays/help-overlay-v2.js +198 -0
- package/dist/ui/overlays/index.d.ts +11 -0
- package/dist/ui/overlays/index.js +11 -0
- package/dist/ui/overlays.d.ts +0 -4
- package/dist/ui/overlays.js +0 -444
- package/dist/ui/permission-overlay-v2.d.ts +36 -0
- package/dist/ui/permission-overlay-v2.js +380 -0
- package/dist/ui/permission-overlay.d.ts +1 -1
- package/dist/ui/permission-overlay.js +186 -298
- package/dist/ui/projects-overlay.d.ts +19 -0
- package/dist/ui/projects-overlay.js +484 -0
- package/dist/ui/providers/types.d.ts +178 -0
- package/dist/ui/providers/types.js +9 -0
- package/dist/ui/render-modes.d.ts +36 -0
- package/dist/ui/render-modes.js +44 -0
- package/dist/ui/startup-menu.d.ts +36 -0
- package/dist/ui/startup-menu.js +236 -0
- package/dist/ui/subagent-renderer.d.ts +117 -0
- package/dist/ui/subagent-renderer.js +334 -0
- package/dist/ui/terminal-codes.d.ts +94 -0
- package/dist/ui/terminal-codes.js +124 -0
- package/dist/ui/terminal-renderer.d.ts +221 -0
- package/dist/ui/terminal-renderer.js +751 -0
- package/dist/ui/terminal-ui.d.ts +463 -0
- package/dist/ui/terminal-ui.js +2296 -0
- package/dist/ui/terminal.d.ts +20 -0
- package/dist/ui/terminal.js +72 -0
- package/dist/ui/theme-overlay-v2.d.ts +42 -0
- package/dist/ui/theme-overlay-v2.js +135 -0
- package/dist/ui/theme-overlay.d.ts +24 -0
- package/dist/ui/theme-overlay.js +127 -0
- package/dist/ui/todo-zone.js +53 -25
- package/dist/ui/tool-formatters.d.ts +16 -0
- package/dist/ui/tool-formatters.js +516 -0
- package/dist/ui/tools-overlay-v2.d.ts +47 -0
- package/dist/ui/tools-overlay-v2.js +218 -0
- package/dist/ui/tools-overlay.d.ts +10 -2
- package/dist/ui/tools-overlay.js +172 -220
- package/dist/ui/tutorial-overlay-v2.d.ts +31 -0
- package/dist/ui/tutorial-overlay-v2.js +1035 -0
- package/dist/ui/tutorial-overlay.d.ts +1 -0
- package/dist/ui/tutorial-overlay.js +400 -302
- package/dist/ui/workflow-overlay.d.ts +22 -0
- package/dist/ui/workflow-overlay.js +636 -0
- package/dist/utils/debug-log.d.ts +28 -0
- package/dist/utils/debug-log.js +57 -0
- package/dist/utils/model-tiers.js +1 -1
- package/dist/utils/path-safety.d.ts +56 -0
- package/dist/utils/path-safety.js +239 -0
- package/dist/workflow/guided-mode-injector.d.ts +42 -0
- package/dist/workflow/guided-mode-injector.js +191 -0
- package/dist/workflow/index.d.ts +8 -0
- package/dist/workflow/index.js +8 -0
- package/dist/workflow/step-criteria.d.ts +62 -0
- package/dist/workflow/step-criteria.js +150 -0
- package/dist/workflow/step-tracker.d.ts +92 -0
- package/dist/workflow/step-tracker.js +141 -0
- package/package.json +12 -5
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design Commands
|
|
3
|
+
*
|
|
4
|
+
* Commands for project design and requirements:
|
|
5
|
+
* - design: Full project design workflow
|
|
6
|
+
* - sketch: Quick project outline
|
|
7
|
+
* - refine: Refine existing requirements
|
|
8
|
+
* - arch: Create architecture documentation
|
|
9
|
+
*/
|
|
10
|
+
import * as conversation from '../../ui/conversation.js';
|
|
11
|
+
import { showModelWarningOverlay } from '../../ui/model-warning-overlay.js';
|
|
12
|
+
import { showArchTypeOverlay } from '../../ui/arch-type-overlay.js';
|
|
13
|
+
import { getModelTier, modelMeetsTier } from '../../utils/model-tiers.js';
|
|
14
|
+
// Note: findBacklogPath removed - backlog now tracked in database via workitem_* tools
|
|
15
|
+
import { getActiveProject } from '../../tools/project-db.js';
|
|
16
|
+
import { workItemRepository } from '../../db/repositories/index.js';
|
|
17
|
+
import { detectCompilrProject, getSkillPrompt, } from '../../repl-helpers.js';
|
|
18
|
+
// =============================================================================
|
|
19
|
+
// Design Command
|
|
20
|
+
// =============================================================================
|
|
21
|
+
export const designCommand = {
|
|
22
|
+
name: 'design',
|
|
23
|
+
description: 'Design your project and populate the backlog',
|
|
24
|
+
async execute(_args, ctx) {
|
|
25
|
+
// Check if project is initialized
|
|
26
|
+
const designProject = detectCompilrProject();
|
|
27
|
+
if (!designProject.found) {
|
|
28
|
+
conversation.printError('No .compilr project found. Run /new first.');
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
// Check model tier - /design works best with large models
|
|
32
|
+
if (!modelMeetsTier(ctx.currentModel, '/design')) {
|
|
33
|
+
const modelTier = getModelTier(ctx.currentModel);
|
|
34
|
+
// Show warning overlay
|
|
35
|
+
const choice = await showModelWarningOverlay({
|
|
36
|
+
command: '/design',
|
|
37
|
+
currentModel: ctx.currentModel,
|
|
38
|
+
currentTier: modelTier.tier,
|
|
39
|
+
suggestedModel: modelTier.suggestedUpgrade,
|
|
40
|
+
alternativeCommand: '/sketch',
|
|
41
|
+
});
|
|
42
|
+
switch (choice) {
|
|
43
|
+
case 'cancel':
|
|
44
|
+
return true;
|
|
45
|
+
case 'alternative':
|
|
46
|
+
// Run /sketch instead
|
|
47
|
+
return ctx.handleCommand('sketch', '');
|
|
48
|
+
case 'switch':
|
|
49
|
+
// Hot-switch to the suggested model
|
|
50
|
+
if (modelTier.suggestedUpgrade) {
|
|
51
|
+
ctx.setModel(modelTier.suggestedUpgrade);
|
|
52
|
+
conversation.printSuccess(`Switched to ${modelTier.suggestedUpgrade}`);
|
|
53
|
+
conversation.printInfo('');
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
conversation.printWarning('No suggested upgrade available. Continuing with current model.');
|
|
57
|
+
conversation.printInfo('');
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
case 'continue':
|
|
61
|
+
// Proceed with current model
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Get design skill prompt
|
|
66
|
+
const designPrompt = getSkillPrompt('design');
|
|
67
|
+
if (!designPrompt) {
|
|
68
|
+
conversation.printError('Design skill not found.');
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
// Clear footer before printing, then re-render after
|
|
72
|
+
ctx.footer.clearForOutput();
|
|
73
|
+
conversation.printInfo('📋 Starting project design...');
|
|
74
|
+
conversation.printInfo('');
|
|
75
|
+
ctx.footer.forceRender();
|
|
76
|
+
// Resume footer animation before processing message
|
|
77
|
+
ctx.footer.resumeAnimation();
|
|
78
|
+
// Get active project for context
|
|
79
|
+
const activeProject = getActiveProject();
|
|
80
|
+
const projectContext = activeProject
|
|
81
|
+
? `
|
|
82
|
+
Project context:
|
|
83
|
+
- ID: ${String(activeProject.id)}
|
|
84
|
+
- Name: ${activeProject.name}
|
|
85
|
+
- Path: ${activeProject.path}`
|
|
86
|
+
: '';
|
|
87
|
+
// Inject design skill and send initial message
|
|
88
|
+
await ctx.processMessage(`I want to design my project and create the backlog.
|
|
89
|
+
|
|
90
|
+
${designPrompt}
|
|
91
|
+
|
|
92
|
+
## DATABASE INTEGRATION (IMPORTANT)
|
|
93
|
+
Use database tools for all backlog management:
|
|
94
|
+
|
|
95
|
+
1. **For backlog items**: Use \`workitem_add\` for EACH feature/requirement
|
|
96
|
+
- Example: workitem_add({ type: "feature", title: "User Authentication", description: "...", priority: "high" })
|
|
97
|
+
|
|
98
|
+
2. **For documents**: Use \`project_document_add\`
|
|
99
|
+
- Example: project_document_add({ doc_type: "prd", title: "Product Requirements", content: "..." })
|
|
100
|
+
${projectContext}
|
|
101
|
+
|
|
102
|
+
Please start by using todo_write to track the design phases, then begin with Phase 1: Vision. Use the ask_user tool to gather information efficiently.`, {
|
|
103
|
+
displayMessage: 'Start the design process for my project.',
|
|
104
|
+
});
|
|
105
|
+
return true;
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
// =============================================================================
|
|
109
|
+
// Sketch Command
|
|
110
|
+
// =============================================================================
|
|
111
|
+
export const sketchCommand = {
|
|
112
|
+
name: 'sketch',
|
|
113
|
+
description: 'Quick project outline (6 questions)',
|
|
114
|
+
async execute(_args, ctx) {
|
|
115
|
+
// Check if project is initialized
|
|
116
|
+
const sketchProject = detectCompilrProject();
|
|
117
|
+
if (!sketchProject.found) {
|
|
118
|
+
conversation.printError('No .compilr project found. Run /new first.');
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
// Get sketch skill prompt
|
|
122
|
+
const sketchPrompt = getSkillPrompt('sketch');
|
|
123
|
+
if (!sketchPrompt) {
|
|
124
|
+
conversation.printError('Sketch skill not found.');
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
// Clear footer before printing, then re-render after
|
|
128
|
+
ctx.footer.clearForOutput();
|
|
129
|
+
conversation.printInfo('✏️ Starting quick project sketch...');
|
|
130
|
+
conversation.printInfo('');
|
|
131
|
+
ctx.footer.forceRender();
|
|
132
|
+
// Resume footer animation before processing message
|
|
133
|
+
ctx.footer.resumeAnimation();
|
|
134
|
+
// Inject sketch skill and send initial message
|
|
135
|
+
await ctx.processMessage(`I want to quickly outline my project.
|
|
136
|
+
|
|
137
|
+
${sketchPrompt}
|
|
138
|
+
|
|
139
|
+
## DATABASE INTEGRATION
|
|
140
|
+
Use \`workitem_add\` for backlog items and \`project_document_add\` for documents.
|
|
141
|
+
|
|
142
|
+
Please start by asking me about the type of application I'm building using the ask_user_simple tool.`, {
|
|
143
|
+
displayMessage: 'Quick project outline.',
|
|
144
|
+
});
|
|
145
|
+
return true;
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
// =============================================================================
|
|
149
|
+
// Refine Command
|
|
150
|
+
// =============================================================================
|
|
151
|
+
export const refineCommand = {
|
|
152
|
+
name: 'refine',
|
|
153
|
+
description: 'Refine existing requirements',
|
|
154
|
+
async execute(args, ctx) {
|
|
155
|
+
// Check for active project in database
|
|
156
|
+
const activeProject = getActiveProject();
|
|
157
|
+
if (!activeProject) {
|
|
158
|
+
conversation.printError('No active project. Run /new first or use /projects to select one.');
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
// Check if project has work items in database
|
|
162
|
+
const counts = workItemRepository.getStatusCounts(activeProject.id);
|
|
163
|
+
const totalItems = counts.backlog + counts.in_progress + counts.completed + counts.skipped;
|
|
164
|
+
if (totalItems === 0) {
|
|
165
|
+
conversation.printError('No backlog items found. Run /design first to create initial requirements.');
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
// Check if a specific item ID was provided (e.g., /refine REQ-001)
|
|
169
|
+
const itemId = args.trim().toUpperCase();
|
|
170
|
+
const isFocusedRefine = itemId && /^[A-Z]+-\d{3}$/.test(itemId);
|
|
171
|
+
// For full refine mode (no item ID), check model tier and warn
|
|
172
|
+
if (!isFocusedRefine && !modelMeetsTier(ctx.currentModel, '/refine')) {
|
|
173
|
+
const modelTier = getModelTier(ctx.currentModel);
|
|
174
|
+
const choice = await showModelWarningOverlay({
|
|
175
|
+
command: '/refine',
|
|
176
|
+
currentModel: ctx.currentModel,
|
|
177
|
+
currentTier: modelTier.tier,
|
|
178
|
+
suggestedModel: modelTier.suggestedUpgrade,
|
|
179
|
+
alternativeCommand: '/refine <ITEM-ID>',
|
|
180
|
+
});
|
|
181
|
+
switch (choice) {
|
|
182
|
+
case 'cancel':
|
|
183
|
+
return true;
|
|
184
|
+
case 'alternative':
|
|
185
|
+
// Show hint about using specific item ID
|
|
186
|
+
conversation.printInfo('💡 Tip: Use /refine <ITEM-ID> for focused refinement with smaller models.');
|
|
187
|
+
conversation.printInfo(' Example: /refine REQ-001');
|
|
188
|
+
conversation.printInfo('');
|
|
189
|
+
return true;
|
|
190
|
+
case 'switch':
|
|
191
|
+
if (modelTier.suggestedUpgrade) {
|
|
192
|
+
ctx.setModel(modelTier.suggestedUpgrade);
|
|
193
|
+
conversation.printSuccess(`Switched to ${ctx.currentModel}`);
|
|
194
|
+
}
|
|
195
|
+
break;
|
|
196
|
+
case 'continue':
|
|
197
|
+
// Continue with current model
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Get appropriate skill prompt
|
|
202
|
+
const skillName = isFocusedRefine ? 'refine-item' : 'refine';
|
|
203
|
+
const refinePrompt = getSkillPrompt(skillName);
|
|
204
|
+
if (!refinePrompt) {
|
|
205
|
+
conversation.printError(`${skillName} skill not found.`);
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
// Clear footer before printing, then re-render after
|
|
209
|
+
ctx.footer.clearForOutput();
|
|
210
|
+
if (isFocusedRefine) {
|
|
211
|
+
conversation.printInfo(`🔄 Refining item ${itemId}...`);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
conversation.printInfo('🔄 Starting requirements refinement...');
|
|
215
|
+
}
|
|
216
|
+
conversation.printInfo('');
|
|
217
|
+
ctx.footer.forceRender();
|
|
218
|
+
// Resume footer animation before processing message
|
|
219
|
+
ctx.footer.resumeAnimation();
|
|
220
|
+
// Build message based on mode
|
|
221
|
+
const userIntent = isFocusedRefine
|
|
222
|
+
? `I want to refine backlog item ${itemId}.`
|
|
223
|
+
: 'I want to refine my project requirements.';
|
|
224
|
+
const agentInstructions = isFocusedRefine
|
|
225
|
+
? `Please use workitem_query to find item "${itemId}", then guide me through refining it using workitem_update.`
|
|
226
|
+
: 'Please start by using workitem_query with limit:10 to get an overview, then ask me what I\'d like to focus on using ask_user_simple.';
|
|
227
|
+
await ctx.processMessage(`${userIntent}
|
|
228
|
+
|
|
229
|
+
${refinePrompt}
|
|
230
|
+
|
|
231
|
+
## DATABASE INTEGRATION
|
|
232
|
+
Use \`workitem_query\` to read items and \`workitem_update\` to modify them.
|
|
233
|
+
|
|
234
|
+
${agentInstructions}`, {
|
|
235
|
+
displayMessage: userIntent,
|
|
236
|
+
});
|
|
237
|
+
return true;
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
// =============================================================================
|
|
241
|
+
// Arch Command
|
|
242
|
+
// =============================================================================
|
|
243
|
+
export const archCommand = {
|
|
244
|
+
name: 'arch',
|
|
245
|
+
description: 'Create architecture documentation',
|
|
246
|
+
async execute(_args, ctx) {
|
|
247
|
+
// Check if project is initialized
|
|
248
|
+
const archProject = detectCompilrProject();
|
|
249
|
+
if (!archProject.found) {
|
|
250
|
+
conversation.printError('No .compilr project found. Run /new first.');
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
// Check model tier - /arch requires large models
|
|
254
|
+
if (!modelMeetsTier(ctx.currentModel, '/arch')) {
|
|
255
|
+
const modelTier = getModelTier(ctx.currentModel);
|
|
256
|
+
const choice = await showModelWarningOverlay({
|
|
257
|
+
command: '/arch',
|
|
258
|
+
currentModel: ctx.currentModel,
|
|
259
|
+
currentTier: modelTier.tier,
|
|
260
|
+
suggestedModel: modelTier.suggestedUpgrade,
|
|
261
|
+
// No alternative command for /arch - it's inherently complex
|
|
262
|
+
});
|
|
263
|
+
switch (choice) {
|
|
264
|
+
case 'cancel':
|
|
265
|
+
return true;
|
|
266
|
+
case 'switch':
|
|
267
|
+
if (modelTier.suggestedUpgrade) {
|
|
268
|
+
ctx.setModel(modelTier.suggestedUpgrade);
|
|
269
|
+
conversation.printSuccess(`Switched to ${modelTier.suggestedUpgrade}`);
|
|
270
|
+
conversation.printInfo('');
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
conversation.printWarning('No suggested upgrade available. Continuing with current model.');
|
|
274
|
+
conversation.printInfo('');
|
|
275
|
+
}
|
|
276
|
+
break;
|
|
277
|
+
case 'continue':
|
|
278
|
+
// Proceed with current model
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// Show type selection overlay
|
|
283
|
+
const archChoice = await showArchTypeOverlay();
|
|
284
|
+
if (!archChoice) {
|
|
285
|
+
// User cancelled
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
// Get architecture skill prompt
|
|
289
|
+
const archPrompt = getSkillPrompt('architecture');
|
|
290
|
+
if (!archPrompt) {
|
|
291
|
+
conversation.printError('Architecture skill not found.');
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
// Build the document type description for display
|
|
295
|
+
const docTypeLabels = {
|
|
296
|
+
'adr': 'Architecture Decision Record',
|
|
297
|
+
'diagram': 'System Diagram',
|
|
298
|
+
'data-model': 'Data Model',
|
|
299
|
+
'api': 'API Design',
|
|
300
|
+
'custom': 'Custom Documentation',
|
|
301
|
+
};
|
|
302
|
+
const displayType = archChoice.customTopic
|
|
303
|
+
? `Custom: ${archChoice.customTopic}`
|
|
304
|
+
: docTypeLabels[archChoice.type];
|
|
305
|
+
// Clear footer before printing, then re-render after
|
|
306
|
+
ctx.footer.clearForOutput();
|
|
307
|
+
conversation.printInfo(`📐 Creating ${displayType}...`);
|
|
308
|
+
conversation.printInfo('');
|
|
309
|
+
ctx.footer.forceRender();
|
|
310
|
+
// Resume footer animation before processing message
|
|
311
|
+
ctx.footer.resumeAnimation();
|
|
312
|
+
// Replace placeholders in skill prompt
|
|
313
|
+
const finalPrompt = archPrompt
|
|
314
|
+
.replace('{{doc_type}}', archChoice.type)
|
|
315
|
+
.replace('{{#if custom_topic}}Custom Topic: {{custom_topic}}{{/if}}', archChoice.customTopic ? `Custom Topic: ${archChoice.customTopic}` : '');
|
|
316
|
+
await ctx.processMessage(`I want to create architecture documentation.
|
|
317
|
+
|
|
318
|
+
${finalPrompt}
|
|
319
|
+
|
|
320
|
+
Please start by using project_document_list to find any existing PRD, and workitem_query to understand the project backlog. Then use ask_user to gather the information needed for this ${archChoice.type} document.`, {
|
|
321
|
+
displayMessage: `Create ${displayType} documentation.`,
|
|
322
|
+
});
|
|
323
|
+
return true;
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
// =============================================================================
|
|
327
|
+
// Export All Design Commands
|
|
328
|
+
// =============================================================================
|
|
329
|
+
export const designCommands = [
|
|
330
|
+
archCommand,
|
|
331
|
+
designCommand,
|
|
332
|
+
refineCommand,
|
|
333
|
+
sketchCommand,
|
|
334
|
+
];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Handlers
|
|
3
|
+
*
|
|
4
|
+
* Central export for all command handlers.
|
|
5
|
+
* Import this to register all handlers with the command registry.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* All command handlers, organized by category.
|
|
9
|
+
*/
|
|
10
|
+
export declare const allHandlers: import("../handler-types.js").CommandHandler[];
|
|
11
|
+
/**
|
|
12
|
+
* Register all command handlers with the registry.
|
|
13
|
+
* Call this once at startup.
|
|
14
|
+
*/
|
|
15
|
+
export declare function registerAllHandlers(): void;
|
|
16
|
+
export * from './simple-commands.js';
|
|
17
|
+
export * from './overlay-commands.js';
|
|
18
|
+
export * from './agent-commands.js';
|
|
19
|
+
export * from './project-commands.js';
|
|
20
|
+
export * from './design-commands.js';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Handlers
|
|
3
|
+
*
|
|
4
|
+
* Central export for all command handlers.
|
|
5
|
+
* Import this to register all handlers with the command registry.
|
|
6
|
+
*/
|
|
7
|
+
import { commandRegistry } from '../registry.js';
|
|
8
|
+
import { simpleCommands } from './simple-commands.js';
|
|
9
|
+
import { overlayCommands } from './overlay-commands.js';
|
|
10
|
+
import { agentCommands } from './agent-commands.js';
|
|
11
|
+
import { projectCommands } from './project-commands.js';
|
|
12
|
+
import { designCommands } from './design-commands.js';
|
|
13
|
+
// =============================================================================
|
|
14
|
+
// All Handlers
|
|
15
|
+
// =============================================================================
|
|
16
|
+
/**
|
|
17
|
+
* All command handlers, organized by category.
|
|
18
|
+
*/
|
|
19
|
+
export const allHandlers = [
|
|
20
|
+
...simpleCommands,
|
|
21
|
+
...overlayCommands,
|
|
22
|
+
...agentCommands,
|
|
23
|
+
...projectCommands,
|
|
24
|
+
...designCommands,
|
|
25
|
+
];
|
|
26
|
+
// =============================================================================
|
|
27
|
+
// Registration
|
|
28
|
+
// =============================================================================
|
|
29
|
+
/**
|
|
30
|
+
* Register all command handlers with the registry.
|
|
31
|
+
* Call this once at startup.
|
|
32
|
+
*/
|
|
33
|
+
export function registerAllHandlers() {
|
|
34
|
+
commandRegistry.registerAll(allHandlers);
|
|
35
|
+
}
|
|
36
|
+
// =============================================================================
|
|
37
|
+
// Re-exports
|
|
38
|
+
// =============================================================================
|
|
39
|
+
export * from './simple-commands.js';
|
|
40
|
+
export * from './overlay-commands.js';
|
|
41
|
+
export * from './agent-commands.js';
|
|
42
|
+
export * from './project-commands.js';
|
|
43
|
+
export * from './design-commands.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlay Commands
|
|
3
|
+
*
|
|
4
|
+
* Commands that primarily show overlays without complex logic:
|
|
5
|
+
* - agents, anchors, backlog, commands, docs, help, keys, tutorial
|
|
6
|
+
*/
|
|
7
|
+
import type { CommandHandler } from '../handler-types.js';
|
|
8
|
+
export declare const agentsCommand: CommandHandler;
|
|
9
|
+
export declare const anchorsCommand: CommandHandler;
|
|
10
|
+
export declare const backlogCommand: CommandHandler;
|
|
11
|
+
export declare const commandsCommand: CommandHandler;
|
|
12
|
+
export declare const docsCommand: CommandHandler;
|
|
13
|
+
export declare const helpCommand: CommandHandler;
|
|
14
|
+
export declare const keysCommand: CommandHandler;
|
|
15
|
+
export declare const tutorialCommand: CommandHandler;
|
|
16
|
+
export declare const toolsCommand: CommandHandler;
|
|
17
|
+
export declare const themeCommand: CommandHandler;
|
|
18
|
+
export declare const modelCommand: CommandHandler;
|
|
19
|
+
export declare const mascotCommand: CommandHandler;
|
|
20
|
+
export declare const configCommand: CommandHandler;
|
|
21
|
+
export declare const overlayCommands: CommandHandler[];
|