@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,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ask User Simple Overlay
|
|
3
|
+
*
|
|
4
|
+
* Simplified modal overlay for single-question input.
|
|
5
|
+
* Used by the ask_user_simple tool during /sketch workflows.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Single question (no tabs, no navigation)
|
|
9
|
+
* - Options to select from with arrow keys
|
|
10
|
+
* - Custom text input option
|
|
11
|
+
* - Simple, clean UI
|
|
12
|
+
*/
|
|
13
|
+
import chalk from 'chalk';
|
|
14
|
+
import * as terminal from './terminal.js';
|
|
15
|
+
import { getStyles } from '../themes/index.js';
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// Rendering
|
|
18
|
+
// =============================================================================
|
|
19
|
+
function render(question, options, allowCustom, state, previousLineCount = 0, targetLineCount = 0) {
|
|
20
|
+
const s = getStyles();
|
|
21
|
+
const lines = [];
|
|
22
|
+
const cols = terminal.getTerminalWidth();
|
|
23
|
+
const border = s.muted('─'.repeat(Math.max(1, cols - 1)));
|
|
24
|
+
// Clear previous render
|
|
25
|
+
if (previousLineCount > 0) {
|
|
26
|
+
terminal.clearLinesAbove(previousLineCount);
|
|
27
|
+
}
|
|
28
|
+
// Header
|
|
29
|
+
lines.push(border);
|
|
30
|
+
lines.push(' ' + s.primaryBold('Sketch'));
|
|
31
|
+
lines.push('');
|
|
32
|
+
// Question
|
|
33
|
+
lines.push(chalk.bold(` ${question}`));
|
|
34
|
+
lines.push('');
|
|
35
|
+
// Options
|
|
36
|
+
const customIndex = options.length;
|
|
37
|
+
for (let i = 0; i < options.length; i++) {
|
|
38
|
+
const isCursor = state.selectedIndex === i && !state.isTypingCustom;
|
|
39
|
+
const prefix = isCursor ? ' ❯ ' : ' ';
|
|
40
|
+
const num = `${String(i + 1)}. `;
|
|
41
|
+
if (isCursor) {
|
|
42
|
+
lines.push(s.primary(prefix + num + options[i]));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
lines.push(s.muted(prefix + num + options[i]));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Custom input option (if allowed)
|
|
49
|
+
if (allowCustom) {
|
|
50
|
+
const isCursor = state.selectedIndex === customIndex && !state.isTypingCustom;
|
|
51
|
+
const prefix = isCursor ? ' ❯ ' : ' ';
|
|
52
|
+
const num = `${String(options.length + 1)}. `;
|
|
53
|
+
if (state.isTypingCustom) {
|
|
54
|
+
// Show input field
|
|
55
|
+
lines.push(s.primary(prefix + num + 'Custom: ') + s.primaryBold(state.inputBuffer + '▋'));
|
|
56
|
+
}
|
|
57
|
+
else if (isCursor) {
|
|
58
|
+
lines.push(s.primary(prefix + num + 'Type something else...'));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
lines.push(s.muted(prefix + num + 'Type something else...'));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Footer
|
|
65
|
+
lines.push('');
|
|
66
|
+
if (state.isTypingCustom) {
|
|
67
|
+
lines.push(s.muted(' Enter Submit · Esc Cancel'));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
lines.push(s.muted(' ↑↓ Navigate · Enter Select · s Skip · Esc Cancel'));
|
|
71
|
+
}
|
|
72
|
+
// Bottom border
|
|
73
|
+
lines.push(border);
|
|
74
|
+
// Pad with empty lines to maintain consistent height
|
|
75
|
+
while (lines.length < targetLineCount) {
|
|
76
|
+
lines.push('');
|
|
77
|
+
}
|
|
78
|
+
// Render all lines
|
|
79
|
+
terminal.write(lines.join('\n'));
|
|
80
|
+
return lines.length;
|
|
81
|
+
}
|
|
82
|
+
// =============================================================================
|
|
83
|
+
// Main Export
|
|
84
|
+
// =============================================================================
|
|
85
|
+
/**
|
|
86
|
+
* Show the simple ask user overlay
|
|
87
|
+
*/
|
|
88
|
+
export async function showAskUserSimpleOverlay(options) {
|
|
89
|
+
const { question, options: choices = [], allowCustom = true } = options;
|
|
90
|
+
// If no predefined choices and custom is allowed, auto-start in typing mode
|
|
91
|
+
const autoTyping = choices.length === 0 && allowCustom;
|
|
92
|
+
const state = {
|
|
93
|
+
selectedIndex: autoTyping ? 0 : 0,
|
|
94
|
+
inputBuffer: '',
|
|
95
|
+
isTypingCustom: autoTyping,
|
|
96
|
+
cancelled: false,
|
|
97
|
+
};
|
|
98
|
+
let lineCount = 0;
|
|
99
|
+
let maxLineCount = 0;
|
|
100
|
+
// NOTE: Footer is already paused by the caller (index.ts handler calls sharedState.pauseFooter)
|
|
101
|
+
// Do NOT call pauseForOverlay() here - it causes double-pause issues
|
|
102
|
+
// The caller's pause already clears the footer from screen
|
|
103
|
+
// Text output is also buffered by repl.ts (not flushed until overlay closes)
|
|
104
|
+
// Ensure we start from a fresh line (like config-overlay does)
|
|
105
|
+
terminal.writeLine('');
|
|
106
|
+
terminal.hideCursor();
|
|
107
|
+
const wasRawMode = process.stdin.isRaw;
|
|
108
|
+
terminal.enableRawMode();
|
|
109
|
+
// Initial render
|
|
110
|
+
lineCount = render(question, choices, allowCustom, state, 0);
|
|
111
|
+
maxLineCount = Math.max(maxLineCount, lineCount);
|
|
112
|
+
// Helper: Get total option count
|
|
113
|
+
const getOptionCount = () => {
|
|
114
|
+
return allowCustom ? choices.length + 1 : choices.length;
|
|
115
|
+
};
|
|
116
|
+
return new Promise((resolve) => {
|
|
117
|
+
const cleanup = () => {
|
|
118
|
+
terminal.clearLinesAbove(maxLineCount);
|
|
119
|
+
terminal.writeLine('');
|
|
120
|
+
terminal.showCursor();
|
|
121
|
+
if (!wasRawMode) {
|
|
122
|
+
terminal.disableRawMode();
|
|
123
|
+
}
|
|
124
|
+
process.stdin.removeListener('data', handleData);
|
|
125
|
+
// NOTE: Footer resume is handled by the caller (index.ts) in the finally block
|
|
126
|
+
};
|
|
127
|
+
const handleData = (data) => {
|
|
128
|
+
const isEscape = data.length === 1 && data[0] === 0x1b;
|
|
129
|
+
const isUpArrow = data.length === 3 && data[0] === 0x1b && data[1] === 0x5b && data[2] === 0x41;
|
|
130
|
+
const isDownArrow = data.length === 3 && data[0] === 0x1b && data[1] === 0x5b && data[2] === 0x42;
|
|
131
|
+
const isCtrlC = data.length === 1 && data[0] === 0x03;
|
|
132
|
+
const isEnter = data.length === 1 && (data[0] === 0x0d || data[0] === 0x0a);
|
|
133
|
+
const isBackspace = data.length === 1 && (data[0] === 0x7f || data[0] === 0x08);
|
|
134
|
+
const isS = data.length === 1 && (data[0] === 0x73 || data[0] === 0x53); // 's' or 'S'
|
|
135
|
+
// Ctrl+C always cancels
|
|
136
|
+
if (isCtrlC) {
|
|
137
|
+
cleanup();
|
|
138
|
+
resolve({ answer: '', skipped: true });
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
// If typing custom input
|
|
142
|
+
if (state.isTypingCustom) {
|
|
143
|
+
if (isEscape) {
|
|
144
|
+
// Cancel custom input
|
|
145
|
+
state.isTypingCustom = false;
|
|
146
|
+
state.inputBuffer = '';
|
|
147
|
+
}
|
|
148
|
+
else if (isUpArrow && choices.length > 0) {
|
|
149
|
+
// Exit typing mode and navigate up (only if there are other options)
|
|
150
|
+
state.isTypingCustom = false;
|
|
151
|
+
state.inputBuffer = '';
|
|
152
|
+
state.selectedIndex = Math.max(0, state.selectedIndex - 1);
|
|
153
|
+
}
|
|
154
|
+
else if (isDownArrow) {
|
|
155
|
+
// Exit typing mode (but stay on custom since it's last option)
|
|
156
|
+
// This effectively does nothing but we handle it to be consistent
|
|
157
|
+
}
|
|
158
|
+
else if (isEnter) {
|
|
159
|
+
// Submit custom input
|
|
160
|
+
const custom = state.inputBuffer.trim();
|
|
161
|
+
if (custom) {
|
|
162
|
+
cleanup();
|
|
163
|
+
resolve({ answer: custom, skipped: false });
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
// Empty - stay in custom mode
|
|
167
|
+
}
|
|
168
|
+
else if (isBackspace) {
|
|
169
|
+
state.inputBuffer = state.inputBuffer.slice(0, -1);
|
|
170
|
+
}
|
|
171
|
+
else if (data.length === 1 && data[0] >= 0x20 && data[0] < 0x7f) {
|
|
172
|
+
// Printable character
|
|
173
|
+
state.inputBuffer += String.fromCharCode(data[0]);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
// Navigation mode
|
|
178
|
+
const optionCount = getOptionCount();
|
|
179
|
+
const customIndex = choices.length;
|
|
180
|
+
if (isEscape) {
|
|
181
|
+
// Cancel overlay
|
|
182
|
+
cleanup();
|
|
183
|
+
resolve({ answer: '', skipped: true });
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
else if (isS) {
|
|
187
|
+
// Skip question (only in navigation mode, not when typing)
|
|
188
|
+
cleanup();
|
|
189
|
+
resolve({ answer: '', skipped: true });
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
else if (isUpArrow) {
|
|
193
|
+
state.selectedIndex = Math.max(0, state.selectedIndex - 1);
|
|
194
|
+
// Auto-enable typing when navigating to custom option
|
|
195
|
+
if (allowCustom && state.selectedIndex === customIndex) {
|
|
196
|
+
state.isTypingCustom = true;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
else if (isDownArrow) {
|
|
200
|
+
state.selectedIndex = Math.min(optionCount - 1, state.selectedIndex + 1);
|
|
201
|
+
// Auto-enable typing when navigating to custom option
|
|
202
|
+
if (allowCustom && state.selectedIndex === customIndex) {
|
|
203
|
+
state.isTypingCustom = true;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else if (isEnter) {
|
|
207
|
+
if (state.selectedIndex < choices.length) {
|
|
208
|
+
// Selected a predefined option
|
|
209
|
+
cleanup();
|
|
210
|
+
resolve({ answer: choices[state.selectedIndex], skipped: false });
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
else if (allowCustom && state.selectedIndex === customIndex) {
|
|
214
|
+
// Enter custom input mode
|
|
215
|
+
state.isTypingCustom = true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
else if (data.length === 1 && data[0] >= 0x31 && data[0] <= 0x39) {
|
|
219
|
+
// Number keys 1-9
|
|
220
|
+
const numIndex = data[0] - 0x31; // 0-indexed
|
|
221
|
+
if (numIndex < optionCount) {
|
|
222
|
+
if (numIndex < choices.length) {
|
|
223
|
+
// Select predefined option directly
|
|
224
|
+
cleanup();
|
|
225
|
+
resolve({ answer: choices[numIndex], skipped: false });
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
else if (allowCustom && numIndex === customIndex) {
|
|
229
|
+
// Enter custom mode
|
|
230
|
+
state.selectedIndex = customIndex;
|
|
231
|
+
state.isTypingCustom = true;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// Re-render
|
|
237
|
+
lineCount = render(question, choices, allowCustom, state, maxLineCount, maxLineCount);
|
|
238
|
+
maxLineCount = Math.max(maxLineCount, lineCount);
|
|
239
|
+
};
|
|
240
|
+
process.stdin.on('data', handleData);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backlog Overlay
|
|
3
|
+
*
|
|
4
|
+
* Modal overlay for viewing and managing the project backlog.
|
|
5
|
+
* Provides a UI for manually adding, editing, and filtering backlog items.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Search by title/description
|
|
9
|
+
* - Filter tabs by type (All/Feature/Bug/Tech-Debt/Chore)
|
|
10
|
+
* - Pagination for large backlogs
|
|
11
|
+
* - Quick status toggle with Space
|
|
12
|
+
* - Add new items with wizard
|
|
13
|
+
*/
|
|
14
|
+
export interface BacklogOverlayResult {
|
|
15
|
+
modified: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function showBacklogOverlay(): Promise<BacklogOverlayResult>;
|