@compilr-dev/cli 0.4.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 +110 -0
- package/dist/agent.d.ts +62 -0
- package/dist/agent.js +317 -0
- package/dist/agents/registry.d.ts +66 -0
- package/dist/agents/registry.js +238 -0
- package/dist/agents/types.d.ts +40 -0
- package/dist/agents/types.js +94 -0
- package/dist/commands/custom-registry.d.ts +69 -0
- package/dist/commands/custom-registry.js +246 -0
- package/dist/commands/index.d.ts +7 -0
- package/dist/commands/index.js +7 -0
- package/dist/commands/types.d.ts +31 -0
- package/dist/commands/types.js +26 -0
- package/dist/commands.d.ts +63 -0
- package/dist/commands.js +324 -0
- package/dist/db/index.d.ts +42 -0
- package/dist/db/index.js +146 -0
- package/dist/db/repositories/document-repository.d.ts +63 -0
- package/dist/db/repositories/document-repository.js +184 -0
- package/dist/db/repositories/index.d.ts +9 -0
- package/dist/db/repositories/index.js +6 -0
- package/dist/db/repositories/project-repository.d.ts +132 -0
- package/dist/db/repositories/project-repository.js +337 -0
- package/dist/db/repositories/work-item-repository.d.ts +115 -0
- package/dist/db/repositories/work-item-repository.js +389 -0
- package/dist/db/schema.d.ts +83 -0
- package/dist/db/schema.js +143 -0
- package/dist/debug.d.ts +8 -0
- package/dist/debug.js +48 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +348 -0
- package/dist/index.old.d.ts +7 -0
- package/dist/index.old.js +1014 -0
- package/dist/repl.d.ts +121 -0
- package/dist/repl.js +1878 -0
- package/dist/settings/index.d.ts +80 -0
- package/dist/settings/index.js +195 -0
- package/dist/shared-handlers.d.ts +63 -0
- package/dist/shared-handlers.js +57 -0
- package/dist/slash-autocomplete.d.ts +41 -0
- package/dist/slash-autocomplete.js +638 -0
- package/dist/state.d.ts +75 -0
- package/dist/state.js +130 -0
- package/dist/tabbed-menu.d.ts +11 -0
- package/dist/tabbed-menu.js +328 -0
- package/dist/templates/backlog-md.d.ts +7 -0
- package/dist/templates/backlog-md.js +94 -0
- package/dist/templates/claude-md.d.ts +7 -0
- package/dist/templates/claude-md.js +189 -0
- package/dist/templates/coding-standards.d.ts +7 -0
- package/dist/templates/coding-standards.js +299 -0
- package/dist/templates/compilr-md.d.ts +7 -0
- package/dist/templates/compilr-md.js +189 -0
- package/dist/templates/config-json.d.ts +38 -0
- package/dist/templates/config-json.js +39 -0
- package/dist/templates/gitignore.d.ts +7 -0
- package/dist/templates/gitignore.js +85 -0
- package/dist/templates/index.d.ts +19 -0
- package/dist/templates/index.js +302 -0
- package/dist/templates/package-json.d.ts +7 -0
- package/dist/templates/package-json.js +111 -0
- package/dist/templates/readme-md.d.ts +7 -0
- package/dist/templates/readme-md.js +161 -0
- package/dist/templates/tsconfig.d.ts +7 -0
- package/dist/templates/tsconfig.js +61 -0
- package/dist/templates/types.d.ts +33 -0
- package/dist/templates/types.js +24 -0
- package/dist/test-autocomplete.d.ts +7 -0
- package/dist/test-autocomplete.js +85 -0
- package/dist/test-tabbed-menu.d.ts +7 -0
- package/dist/test-tabbed-menu.js +25 -0
- package/dist/themes/colors.d.ts +49 -0
- package/dist/themes/colors.js +135 -0
- package/dist/themes/index.d.ts +23 -0
- package/dist/themes/index.js +24 -0
- package/dist/themes/registry.d.ts +60 -0
- package/dist/themes/registry.js +195 -0
- package/dist/themes/types.d.ts +82 -0
- package/dist/themes/types.js +7 -0
- package/dist/tool-selector.d.ts +71 -0
- package/dist/tool-selector.js +184 -0
- package/dist/tools/ask-user-simple.d.ts +19 -0
- package/dist/tools/ask-user-simple.js +86 -0
- package/dist/tools/ask-user.d.ts +32 -0
- package/dist/tools/ask-user.js +113 -0
- package/dist/tools/backlog.d.ts +53 -0
- package/dist/tools/backlog.js +709 -0
- package/dist/tools.d.ts +15 -0
- package/dist/tools.js +121 -0
- package/dist/ui/agents-overlay.d.ts +12 -0
- package/dist/ui/agents-overlay.js +501 -0
- package/dist/ui/arch-type-overlay.d.ts +20 -0
- package/dist/ui/arch-type-overlay.js +229 -0
- package/dist/ui/ask-user-overlay.d.ts +26 -0
- package/dist/ui/ask-user-overlay.js +647 -0
- package/dist/ui/ask-user-simple-overlay.d.ts +25 -0
- package/dist/ui/ask-user-simple-overlay.js +242 -0
- package/dist/ui/backlog-overlay.d.ts +17 -0
- package/dist/ui/backlog-overlay.js +786 -0
- package/dist/ui/commands-overlay.d.ts +11 -0
- package/dist/ui/commands-overlay.js +410 -0
- package/dist/ui/config-overlay.d.ts +34 -0
- package/dist/ui/config-overlay.js +977 -0
- package/dist/ui/conversation.d.ts +82 -0
- package/dist/ui/conversation.js +508 -0
- package/dist/ui/diff.d.ts +38 -0
- package/dist/ui/diff.js +182 -0
- package/dist/ui/ephemeral.d.ts +111 -0
- package/dist/ui/ephemeral.js +413 -0
- package/dist/ui/file-autocomplete.d.ts +45 -0
- package/dist/ui/file-autocomplete.js +237 -0
- package/dist/ui/footer.d.ts +153 -0
- package/dist/ui/footer.js +422 -0
- package/dist/ui/index.d.ts +12 -0
- package/dist/ui/index.js +15 -0
- package/dist/ui/init-overlay.d.ts +24 -0
- package/dist/ui/init-overlay.js +525 -0
- package/dist/ui/input-prompt-v2.d.ts +179 -0
- package/dist/ui/input-prompt-v2.js +991 -0
- package/dist/ui/input-prompt.d.ts +97 -0
- package/dist/ui/input-prompt.js +800 -0
- package/dist/ui/iteration-limit-overlay.d.ts +21 -0
- package/dist/ui/iteration-limit-overlay.js +150 -0
- package/dist/ui/keys-overlay.d.ts +14 -0
- package/dist/ui/keys-overlay.js +181 -0
- package/dist/ui/model-warning-overlay.d.ts +30 -0
- package/dist/ui/model-warning-overlay.js +171 -0
- package/dist/ui/overlay-controller.d.ts +25 -0
- package/dist/ui/overlay-controller.js +35 -0
- package/dist/ui/overlays.d.ts +47 -0
- package/dist/ui/overlays.js +627 -0
- package/dist/ui/permission-overlay.d.ts +16 -0
- package/dist/ui/permission-overlay.js +494 -0
- package/dist/ui/terminal.d.ts +117 -0
- package/dist/ui/terminal.js +237 -0
- package/dist/ui/todo-zone.d.ts +112 -0
- package/dist/ui/todo-zone.js +353 -0
- package/dist/ui/tools-overlay.d.ts +26 -0
- package/dist/ui/tools-overlay.js +278 -0
- package/dist/ui/tutorial-overlay.d.ts +10 -0
- package/dist/ui/tutorial-overlay.js +936 -0
- package/dist/ui/types.d.ts +103 -0
- package/dist/ui/types.js +33 -0
- package/dist/utils/credentials.d.ts +55 -0
- package/dist/utils/credentials.js +268 -0
- package/dist/utils/model-tiers.d.ts +37 -0
- package/dist/utils/model-tiers.js +118 -0
- package/dist/utils/project-memory.d.ts +47 -0
- package/dist/utils/project-memory.js +117 -0
- package/dist/utils/project-status.d.ts +56 -0
- package/dist/utils/project-status.js +237 -0
- package/package.json +66 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Architecture Type Selection Overlay
|
|
3
|
+
*
|
|
4
|
+
* Shows options for what type of architecture documentation to create.
|
|
5
|
+
* User selects from:
|
|
6
|
+
* - ADR (Architecture Decision Record)
|
|
7
|
+
* - System Diagram
|
|
8
|
+
* - Data Model
|
|
9
|
+
* - API Design
|
|
10
|
+
* - Custom topic
|
|
11
|
+
*/
|
|
12
|
+
import * as terminal from './terminal.js';
|
|
13
|
+
import { getStyles } from '../themes/index.js';
|
|
14
|
+
import { pauseForOverlay, resumeAfterOverlay } from './overlay-controller.js';
|
|
15
|
+
const ARCH_OPTIONS = [
|
|
16
|
+
{ key: '1', type: 'adr', label: 'Decision Record (ADR)', description: '"Why we chose X over Y"' },
|
|
17
|
+
{ key: '2', type: 'diagram', label: 'System Diagram', description: 'Mermaid component diagram' },
|
|
18
|
+
{ key: '3', type: 'data-model', label: 'Data Model', description: 'Entities and relationships' },
|
|
19
|
+
{ key: '4', type: 'api', label: 'API Design', description: 'Endpoints and contracts' },
|
|
20
|
+
{ key: '5', type: 'custom', label: 'Custom topic...', description: 'Specify your own' },
|
|
21
|
+
];
|
|
22
|
+
// =============================================================================
|
|
23
|
+
// Rendering
|
|
24
|
+
// =============================================================================
|
|
25
|
+
function render(selectedIndex, previousLineCount = 0, targetLineCount = 0) {
|
|
26
|
+
const s = getStyles();
|
|
27
|
+
const lines = [];
|
|
28
|
+
const cols = terminal.getTerminalWidth();
|
|
29
|
+
const border = s.muted('─'.repeat(Math.max(1, cols - 1)));
|
|
30
|
+
// Clear previous render
|
|
31
|
+
if (previousLineCount > 0) {
|
|
32
|
+
terminal.clearLinesAbove(previousLineCount);
|
|
33
|
+
}
|
|
34
|
+
// Header
|
|
35
|
+
lines.push(border);
|
|
36
|
+
lines.push(' ' + s.primary('Architecture Documentation'));
|
|
37
|
+
lines.push('');
|
|
38
|
+
// Question
|
|
39
|
+
lines.push(' What would you like to document?');
|
|
40
|
+
lines.push('');
|
|
41
|
+
// Options
|
|
42
|
+
for (let i = 0; i < ARCH_OPTIONS.length; i++) {
|
|
43
|
+
const opt = ARCH_OPTIONS[i];
|
|
44
|
+
const isCursor = selectedIndex === i;
|
|
45
|
+
const prefix = isCursor ? ' ❯ ' : ' ';
|
|
46
|
+
// Calculate max label width for alignment
|
|
47
|
+
const maxLabelLen = Math.max(...ARCH_OPTIONS.map((o) => o.label.length));
|
|
48
|
+
const paddedLabel = opt.label.padEnd(maxLabelLen + 2);
|
|
49
|
+
if (isCursor) {
|
|
50
|
+
lines.push(s.primary(`${prefix}${opt.key}. ${paddedLabel}`) + s.muted(opt.description));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
lines.push(s.muted(`${prefix}${opt.key}. ${paddedLabel}${opt.description}`));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Footer
|
|
57
|
+
lines.push('');
|
|
58
|
+
lines.push(s.muted(' ↑↓ Navigate · Enter Select · Esc Cancel'));
|
|
59
|
+
lines.push(border);
|
|
60
|
+
// Pad with empty lines to maintain consistent height
|
|
61
|
+
while (lines.length < targetLineCount) {
|
|
62
|
+
lines.push('');
|
|
63
|
+
}
|
|
64
|
+
// Render all lines
|
|
65
|
+
terminal.write(lines.join('\n'));
|
|
66
|
+
return lines.length;
|
|
67
|
+
}
|
|
68
|
+
function renderCustomInput(inputValue, previousLineCount = 0, targetLineCount = 0) {
|
|
69
|
+
const s = getStyles();
|
|
70
|
+
const lines = [];
|
|
71
|
+
const cols = terminal.getTerminalWidth();
|
|
72
|
+
const border = s.muted('─'.repeat(Math.max(1, cols - 1)));
|
|
73
|
+
// Clear previous render
|
|
74
|
+
if (previousLineCount > 0) {
|
|
75
|
+
terminal.clearLinesAbove(previousLineCount);
|
|
76
|
+
}
|
|
77
|
+
// Header
|
|
78
|
+
lines.push(border);
|
|
79
|
+
lines.push(' ' + s.primary('Custom Architecture Topic'));
|
|
80
|
+
lines.push('');
|
|
81
|
+
// Input field
|
|
82
|
+
lines.push(' Enter the topic you want to document:');
|
|
83
|
+
lines.push('');
|
|
84
|
+
lines.push(' ' + s.primary('> ') + inputValue + s.primary('_'));
|
|
85
|
+
lines.push('');
|
|
86
|
+
// Footer
|
|
87
|
+
lines.push(s.muted(' Enter to confirm · Esc to go back'));
|
|
88
|
+
lines.push(border);
|
|
89
|
+
// Pad with empty lines to maintain consistent height
|
|
90
|
+
while (lines.length < targetLineCount) {
|
|
91
|
+
lines.push('');
|
|
92
|
+
}
|
|
93
|
+
// Render all lines
|
|
94
|
+
terminal.write(lines.join('\n'));
|
|
95
|
+
return lines.length;
|
|
96
|
+
}
|
|
97
|
+
// =============================================================================
|
|
98
|
+
// Main Export
|
|
99
|
+
// =============================================================================
|
|
100
|
+
/**
|
|
101
|
+
* Show the architecture type selection overlay and return the user's choice.
|
|
102
|
+
*/
|
|
103
|
+
export async function showArchTypeOverlay() {
|
|
104
|
+
let selectedIndex = 0;
|
|
105
|
+
let lineCount = 0;
|
|
106
|
+
let maxLineCount = 0;
|
|
107
|
+
let mode = 'select';
|
|
108
|
+
let customInput = '';
|
|
109
|
+
// Pause footer animation
|
|
110
|
+
pauseForOverlay();
|
|
111
|
+
// Clear and prepare
|
|
112
|
+
terminal.clearToEndOfScreen();
|
|
113
|
+
terminal.writeLine('');
|
|
114
|
+
terminal.hideCursor();
|
|
115
|
+
const wasRawMode = process.stdin.isRaw;
|
|
116
|
+
terminal.enableRawMode();
|
|
117
|
+
// Initial render
|
|
118
|
+
lineCount = render(selectedIndex, 0);
|
|
119
|
+
maxLineCount = Math.max(maxLineCount, lineCount);
|
|
120
|
+
// Re-render to stabilize
|
|
121
|
+
lineCount = render(selectedIndex, lineCount, lineCount);
|
|
122
|
+
return new Promise((resolve) => {
|
|
123
|
+
const cleanup = () => {
|
|
124
|
+
terminal.clearLinesAbove(maxLineCount);
|
|
125
|
+
terminal.writeLine('');
|
|
126
|
+
terminal.showCursor();
|
|
127
|
+
if (!wasRawMode) {
|
|
128
|
+
terminal.disableRawMode();
|
|
129
|
+
}
|
|
130
|
+
process.stdin.removeListener('data', handleData);
|
|
131
|
+
resumeAfterOverlay();
|
|
132
|
+
};
|
|
133
|
+
const handleData = (data) => {
|
|
134
|
+
const isEscape = data.length === 1 && data[0] === 0x1b;
|
|
135
|
+
const isUpArrow = data.length === 3 && data[0] === 0x1b && data[1] === 0x5b && data[2] === 0x41;
|
|
136
|
+
const isDownArrow = data.length === 3 && data[0] === 0x1b && data[1] === 0x5b && data[2] === 0x42;
|
|
137
|
+
const isCtrlC = data.length === 1 && data[0] === 0x03;
|
|
138
|
+
const isEnter = data.length === 1 && (data[0] === 0x0d || data[0] === 0x0a);
|
|
139
|
+
const isBackspace = data.length === 1 && (data[0] === 0x7f || data[0] === 0x08);
|
|
140
|
+
if (mode === 'select') {
|
|
141
|
+
// Ctrl+C or Escape cancels
|
|
142
|
+
if (isCtrlC || isEscape) {
|
|
143
|
+
cleanup();
|
|
144
|
+
resolve(null);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
// Navigation
|
|
148
|
+
if (isUpArrow) {
|
|
149
|
+
selectedIndex = Math.max(0, selectedIndex - 1);
|
|
150
|
+
}
|
|
151
|
+
else if (isDownArrow) {
|
|
152
|
+
selectedIndex = Math.min(ARCH_OPTIONS.length - 1, selectedIndex + 1);
|
|
153
|
+
}
|
|
154
|
+
else if (isEnter) {
|
|
155
|
+
const selected = ARCH_OPTIONS[selectedIndex];
|
|
156
|
+
if (selected.type === 'custom') {
|
|
157
|
+
// Switch to custom input mode
|
|
158
|
+
mode = 'custom-input';
|
|
159
|
+
customInput = '';
|
|
160
|
+
terminal.showCursor();
|
|
161
|
+
lineCount = renderCustomInput(customInput, maxLineCount, maxLineCount);
|
|
162
|
+
maxLineCount = Math.max(maxLineCount, lineCount);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
cleanup();
|
|
166
|
+
resolve({ type: selected.type });
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
else if (data.length === 1 && data[0] >= 0x31 && data[0] <= 0x35) {
|
|
170
|
+
// Number keys 1-5
|
|
171
|
+
const numIndex = data[0] - 0x31; // 0-indexed
|
|
172
|
+
if (numIndex < ARCH_OPTIONS.length) {
|
|
173
|
+
const selected = ARCH_OPTIONS[numIndex];
|
|
174
|
+
if (selected.type === 'custom') {
|
|
175
|
+
mode = 'custom-input';
|
|
176
|
+
customInput = '';
|
|
177
|
+
terminal.showCursor();
|
|
178
|
+
lineCount = renderCustomInput(customInput, maxLineCount, maxLineCount);
|
|
179
|
+
maxLineCount = Math.max(maxLineCount, lineCount);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
cleanup();
|
|
183
|
+
resolve({ type: selected.type });
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// Re-render
|
|
188
|
+
lineCount = render(selectedIndex, maxLineCount, maxLineCount);
|
|
189
|
+
maxLineCount = Math.max(maxLineCount, lineCount);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
// Custom input mode
|
|
193
|
+
if (isCtrlC) {
|
|
194
|
+
cleanup();
|
|
195
|
+
resolve(null);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (isEscape) {
|
|
199
|
+
// Go back to select mode
|
|
200
|
+
mode = 'select';
|
|
201
|
+
terminal.hideCursor();
|
|
202
|
+
lineCount = render(selectedIndex, maxLineCount, maxLineCount);
|
|
203
|
+
maxLineCount = Math.max(maxLineCount, lineCount);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (isEnter) {
|
|
207
|
+
if (customInput.trim()) {
|
|
208
|
+
cleanup();
|
|
209
|
+
resolve({ type: 'custom', customTopic: customInput.trim() });
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
// Don't allow empty custom topic
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (isBackspace) {
|
|
216
|
+
customInput = customInput.slice(0, -1);
|
|
217
|
+
}
|
|
218
|
+
else if (data.length === 1 && data[0] >= 0x20 && data[0] <= 0x7e) {
|
|
219
|
+
// Printable ASCII
|
|
220
|
+
customInput += String.fromCharCode(data[0]);
|
|
221
|
+
}
|
|
222
|
+
// Re-render
|
|
223
|
+
lineCount = renderCustomInput(customInput, maxLineCount, maxLineCount);
|
|
224
|
+
maxLineCount = Math.max(maxLineCount, lineCount);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
process.stdin.on('data', handleData);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ask User Overlay
|
|
3
|
+
*
|
|
4
|
+
* Modal overlay for presenting multi-question forms to the user.
|
|
5
|
+
* Used by the ask_user tool during /design and /refine workflows.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Multiple questions with navigation (←/→ or Tab)
|
|
9
|
+
* - Options to select from with arrow keys
|
|
10
|
+
* - Custom text input option
|
|
11
|
+
* - Multi-select support
|
|
12
|
+
* - Progress indicator showing answered questions
|
|
13
|
+
*/
|
|
14
|
+
import type { AskUserQuestion } from '../tools/ask-user.js';
|
|
15
|
+
export interface AskUserOptions {
|
|
16
|
+
questions: AskUserQuestion[];
|
|
17
|
+
context?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface AskUserResult {
|
|
20
|
+
answers: Record<string, string | string[]>;
|
|
21
|
+
skipped: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Show the ask user overlay
|
|
25
|
+
*/
|
|
26
|
+
export declare function showAskUserOverlay(options: AskUserOptions): Promise<AskUserResult>;
|