@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,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings Module
|
|
3
|
+
*
|
|
4
|
+
* Centralized settings management for the CLI.
|
|
5
|
+
* Persistence in ~/.compilr-dev/settings.json
|
|
6
|
+
*/
|
|
7
|
+
export type PermissionMode = 'default' | 'plan' | 'bypass';
|
|
8
|
+
export type NotificationMode = 'auto' | 'enabled' | 'disabled';
|
|
9
|
+
export type OutputStyle = 'default' | 'compact' | 'verbose';
|
|
10
|
+
export type EditorMode = 'normal' | 'vim' | 'emacs';
|
|
11
|
+
export type ProviderType = 'auto' | 'claude' | 'openai' | 'gemini' | 'ollama';
|
|
12
|
+
export interface Settings {
|
|
13
|
+
theme?: string;
|
|
14
|
+
defaultProvider: ProviderType;
|
|
15
|
+
defaultModel: string | null;
|
|
16
|
+
autoCompact: boolean;
|
|
17
|
+
showTips: boolean;
|
|
18
|
+
reviseCode: boolean;
|
|
19
|
+
verbose: boolean;
|
|
20
|
+
progressBar: boolean;
|
|
21
|
+
gitignore: boolean;
|
|
22
|
+
autoInstall: boolean;
|
|
23
|
+
permissionMode: PermissionMode;
|
|
24
|
+
notifications: NotificationMode;
|
|
25
|
+
outputStyle: OutputStyle;
|
|
26
|
+
editorMode: EditorMode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get all settings (cached)
|
|
30
|
+
*/
|
|
31
|
+
export declare function getSettings(): Settings;
|
|
32
|
+
/**
|
|
33
|
+
* Get a single setting
|
|
34
|
+
*/
|
|
35
|
+
export declare function getSetting<K extends keyof Settings>(key: K): Settings[K];
|
|
36
|
+
/**
|
|
37
|
+
* Set a single setting
|
|
38
|
+
*/
|
|
39
|
+
export declare function setSetting<K extends keyof Settings>(key: K, value: Settings[K]): void;
|
|
40
|
+
/**
|
|
41
|
+
* Update multiple settings at once
|
|
42
|
+
*/
|
|
43
|
+
export declare function updateSettings(updates: Partial<Settings>): void;
|
|
44
|
+
/**
|
|
45
|
+
* Reset all settings to defaults
|
|
46
|
+
*/
|
|
47
|
+
export declare function resetSettings(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Clear settings cache (for testing or forced reload)
|
|
50
|
+
*/
|
|
51
|
+
export declare function clearSettingsCache(): void;
|
|
52
|
+
export declare const getDefaultProvider: () => ProviderType;
|
|
53
|
+
export declare const getDefaultModel: () => string | null;
|
|
54
|
+
export declare const isAutoCompactEnabled: () => boolean;
|
|
55
|
+
export declare const isShowTipsEnabled: () => boolean;
|
|
56
|
+
export declare const isReviseCodeEnabled: () => boolean;
|
|
57
|
+
export declare const isVerboseEnabled: () => boolean;
|
|
58
|
+
export declare const isProgressBarEnabled: () => boolean;
|
|
59
|
+
export declare const isGitignoreEnabled: () => boolean;
|
|
60
|
+
export declare const isAutoInstallEnabled: () => boolean;
|
|
61
|
+
export declare const getPermissionMode: () => PermissionMode;
|
|
62
|
+
export declare const getNotificationMode: () => NotificationMode;
|
|
63
|
+
export declare const getOutputStyle: () => OutputStyle;
|
|
64
|
+
export declare const getEditorMode: () => EditorMode;
|
|
65
|
+
/**
|
|
66
|
+
* Map internal permission mode to display value
|
|
67
|
+
*/
|
|
68
|
+
export declare function permissionModeToDisplay(mode: PermissionMode): string;
|
|
69
|
+
/**
|
|
70
|
+
* Map display value to internal permission mode
|
|
71
|
+
*/
|
|
72
|
+
export declare function displayToPermissionMode(display: string): PermissionMode;
|
|
73
|
+
/**
|
|
74
|
+
* Map internal notification mode to display value
|
|
75
|
+
*/
|
|
76
|
+
export declare function notificationModeToDisplay(mode: NotificationMode): string;
|
|
77
|
+
/**
|
|
78
|
+
* Map display value to internal notification mode
|
|
79
|
+
*/
|
|
80
|
+
export declare function displayToNotificationMode(display: string): NotificationMode;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings Module
|
|
3
|
+
*
|
|
4
|
+
* Centralized settings management for the CLI.
|
|
5
|
+
* Persistence in ~/.compilr-dev/settings.json
|
|
6
|
+
*/
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
import * as path from 'path';
|
|
9
|
+
import * as os from 'os';
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Constants
|
|
12
|
+
// =============================================================================
|
|
13
|
+
const CONFIG_DIR = path.join(os.homedir(), '.compilr-dev');
|
|
14
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, 'settings.json');
|
|
15
|
+
// =============================================================================
|
|
16
|
+
// Defaults
|
|
17
|
+
// =============================================================================
|
|
18
|
+
const DEFAULT_SETTINGS = {
|
|
19
|
+
theme: 'compilr-dark',
|
|
20
|
+
// Provider/Model defaults
|
|
21
|
+
defaultProvider: 'auto',
|
|
22
|
+
defaultModel: null,
|
|
23
|
+
// Boolean defaults
|
|
24
|
+
autoCompact: true,
|
|
25
|
+
showTips: true,
|
|
26
|
+
reviseCode: true,
|
|
27
|
+
verbose: false,
|
|
28
|
+
progressBar: true,
|
|
29
|
+
gitignore: true,
|
|
30
|
+
autoInstall: true,
|
|
31
|
+
// Cycle defaults
|
|
32
|
+
permissionMode: 'default',
|
|
33
|
+
notifications: 'auto',
|
|
34
|
+
outputStyle: 'default',
|
|
35
|
+
editorMode: 'normal',
|
|
36
|
+
};
|
|
37
|
+
// =============================================================================
|
|
38
|
+
// In-memory cache
|
|
39
|
+
// =============================================================================
|
|
40
|
+
let settingsCache = null;
|
|
41
|
+
// =============================================================================
|
|
42
|
+
// Persistence
|
|
43
|
+
// =============================================================================
|
|
44
|
+
/**
|
|
45
|
+
* Load settings from disk
|
|
46
|
+
*/
|
|
47
|
+
function loadFromDisk() {
|
|
48
|
+
try {
|
|
49
|
+
if (fs.existsSync(CONFIG_FILE)) {
|
|
50
|
+
const data = fs.readFileSync(CONFIG_FILE, 'utf-8');
|
|
51
|
+
return JSON.parse(data);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// Ignore errors, return empty
|
|
56
|
+
}
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Save settings to disk
|
|
61
|
+
*/
|
|
62
|
+
function saveToDisk(settings) {
|
|
63
|
+
try {
|
|
64
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
65
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(settings, null, 2), 'utf-8');
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error('Failed to save settings:', error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// =============================================================================
|
|
72
|
+
// Public API
|
|
73
|
+
// =============================================================================
|
|
74
|
+
/**
|
|
75
|
+
* Get all settings (cached)
|
|
76
|
+
*/
|
|
77
|
+
export function getSettings() {
|
|
78
|
+
if (settingsCache) {
|
|
79
|
+
return settingsCache;
|
|
80
|
+
}
|
|
81
|
+
const stored = loadFromDisk();
|
|
82
|
+
settingsCache = { ...DEFAULT_SETTINGS, ...stored };
|
|
83
|
+
return settingsCache;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get a single setting
|
|
87
|
+
*/
|
|
88
|
+
export function getSetting(key) {
|
|
89
|
+
return getSettings()[key];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Set a single setting
|
|
93
|
+
*/
|
|
94
|
+
export function setSetting(key, value) {
|
|
95
|
+
const settings = getSettings();
|
|
96
|
+
settings[key] = value;
|
|
97
|
+
settingsCache = settings;
|
|
98
|
+
saveToDisk(settings);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Update multiple settings at once
|
|
102
|
+
*/
|
|
103
|
+
export function updateSettings(updates) {
|
|
104
|
+
const settings = getSettings();
|
|
105
|
+
Object.assign(settings, updates);
|
|
106
|
+
settingsCache = settings;
|
|
107
|
+
saveToDisk(settings);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Reset all settings to defaults
|
|
111
|
+
*/
|
|
112
|
+
export function resetSettings() {
|
|
113
|
+
settingsCache = { ...DEFAULT_SETTINGS };
|
|
114
|
+
saveToDisk(settingsCache);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Clear settings cache (for testing or forced reload)
|
|
118
|
+
*/
|
|
119
|
+
export function clearSettingsCache() {
|
|
120
|
+
settingsCache = null;
|
|
121
|
+
}
|
|
122
|
+
// =============================================================================
|
|
123
|
+
// Convenience Getters (for type-safe access)
|
|
124
|
+
// =============================================================================
|
|
125
|
+
// Provider/Model getters
|
|
126
|
+
export const getDefaultProvider = () => getSetting('defaultProvider');
|
|
127
|
+
export const getDefaultModel = () => getSetting('defaultModel');
|
|
128
|
+
// Boolean getters
|
|
129
|
+
export const isAutoCompactEnabled = () => getSetting('autoCompact');
|
|
130
|
+
export const isShowTipsEnabled = () => getSetting('showTips');
|
|
131
|
+
export const isReviseCodeEnabled = () => getSetting('reviseCode');
|
|
132
|
+
export const isVerboseEnabled = () => getSetting('verbose');
|
|
133
|
+
export const isProgressBarEnabled = () => getSetting('progressBar');
|
|
134
|
+
export const isGitignoreEnabled = () => getSetting('gitignore');
|
|
135
|
+
export const isAutoInstallEnabled = () => getSetting('autoInstall');
|
|
136
|
+
// Cycle getters
|
|
137
|
+
export const getPermissionMode = () => getSetting('permissionMode');
|
|
138
|
+
export const getNotificationMode = () => getSetting('notifications');
|
|
139
|
+
export const getOutputStyle = () => getSetting('outputStyle');
|
|
140
|
+
export const getEditorMode = () => getSetting('editorMode');
|
|
141
|
+
// =============================================================================
|
|
142
|
+
// Display Value Mappers (for config overlay)
|
|
143
|
+
// =============================================================================
|
|
144
|
+
/**
|
|
145
|
+
* Map internal permission mode to display value
|
|
146
|
+
*/
|
|
147
|
+
export function permissionModeToDisplay(mode) {
|
|
148
|
+
switch (mode) {
|
|
149
|
+
case 'default':
|
|
150
|
+
return 'Default';
|
|
151
|
+
case 'plan':
|
|
152
|
+
return 'Plan';
|
|
153
|
+
case 'bypass':
|
|
154
|
+
return 'Bypass prompts';
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Map display value to internal permission mode
|
|
159
|
+
*/
|
|
160
|
+
export function displayToPermissionMode(display) {
|
|
161
|
+
switch (display) {
|
|
162
|
+
case 'Plan':
|
|
163
|
+
return 'plan';
|
|
164
|
+
case 'Bypass prompts':
|
|
165
|
+
return 'bypass';
|
|
166
|
+
default:
|
|
167
|
+
return 'default';
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Map internal notification mode to display value
|
|
172
|
+
*/
|
|
173
|
+
export function notificationModeToDisplay(mode) {
|
|
174
|
+
switch (mode) {
|
|
175
|
+
case 'auto':
|
|
176
|
+
return 'Auto';
|
|
177
|
+
case 'enabled':
|
|
178
|
+
return 'Enabled';
|
|
179
|
+
case 'disabled':
|
|
180
|
+
return 'Disabled';
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Map display value to internal notification mode
|
|
185
|
+
*/
|
|
186
|
+
export function displayToNotificationMode(display) {
|
|
187
|
+
switch (display) {
|
|
188
|
+
case 'Enabled':
|
|
189
|
+
return 'enabled';
|
|
190
|
+
case 'Disabled':
|
|
191
|
+
return 'disabled';
|
|
192
|
+
default:
|
|
193
|
+
return 'auto';
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Handlers Module
|
|
3
|
+
*
|
|
4
|
+
* This module provides a shared registry for handlers that need to be
|
|
5
|
+
* accessible from tools but are set up at the application level.
|
|
6
|
+
* This avoids circular imports between index.ts and tool modules.
|
|
7
|
+
*/
|
|
8
|
+
export interface AskUserQuestion {
|
|
9
|
+
id: string;
|
|
10
|
+
header: string;
|
|
11
|
+
question: string;
|
|
12
|
+
options?: string[];
|
|
13
|
+
allowCustom?: boolean;
|
|
14
|
+
multiSelect?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface AskUserInput {
|
|
17
|
+
questions: AskUserQuestion[];
|
|
18
|
+
context?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface AskUserResult {
|
|
21
|
+
answers: Record<string, string | string[]>;
|
|
22
|
+
skipped: string[];
|
|
23
|
+
}
|
|
24
|
+
export type AskUserHandler = (input: AskUserInput) => Promise<AskUserResult>;
|
|
25
|
+
export interface AskUserSimpleInput {
|
|
26
|
+
/** The question text */
|
|
27
|
+
question: string;
|
|
28
|
+
/** Predefined options (optional, max 5) */
|
|
29
|
+
options?: string[];
|
|
30
|
+
/** Allow free-text input (default: true) */
|
|
31
|
+
allowCustom?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface AskUserSimpleResult {
|
|
34
|
+
/** User's answer */
|
|
35
|
+
answer: string;
|
|
36
|
+
/** True if user skipped the question */
|
|
37
|
+
skipped: boolean;
|
|
38
|
+
}
|
|
39
|
+
export type AskUserSimpleHandler = (input: AskUserSimpleInput) => Promise<AskUserSimpleResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Register the ask_user handler. Called during app initialization.
|
|
42
|
+
*/
|
|
43
|
+
export declare function registerAskUserHandler(handler: AskUserHandler): void;
|
|
44
|
+
/**
|
|
45
|
+
* Get the registered ask_user handler. Called by the ask_user tool.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getAskUserHandler(): AskUserHandler | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Register the ask_user_simple handler. Called during app initialization.
|
|
50
|
+
*/
|
|
51
|
+
export declare function registerAskUserSimpleHandler(handler: AskUserSimpleHandler): void;
|
|
52
|
+
/**
|
|
53
|
+
* Get the registered ask_user_simple handler. Called by the ask_user_simple tool.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getAskUserSimpleHandler(): AskUserSimpleHandler | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Set overlay active state. Called when showing/hiding overlays.
|
|
58
|
+
*/
|
|
59
|
+
export declare function setOverlayActive(active: boolean): void;
|
|
60
|
+
/**
|
|
61
|
+
* Check if an overlay is currently active.
|
|
62
|
+
*/
|
|
63
|
+
export declare function isOverlayActive(): boolean;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Handlers Module
|
|
3
|
+
*
|
|
4
|
+
* This module provides a shared registry for handlers that need to be
|
|
5
|
+
* accessible from tools but are set up at the application level.
|
|
6
|
+
* This avoids circular imports between index.ts and tool modules.
|
|
7
|
+
*/
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Handler Registry
|
|
10
|
+
// =============================================================================
|
|
11
|
+
let askUserHandler;
|
|
12
|
+
let askUserSimpleHandler;
|
|
13
|
+
/**
|
|
14
|
+
* Register the ask_user handler. Called during app initialization.
|
|
15
|
+
*/
|
|
16
|
+
export function registerAskUserHandler(handler) {
|
|
17
|
+
askUserHandler = handler;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the registered ask_user handler. Called by the ask_user tool.
|
|
21
|
+
*/
|
|
22
|
+
export function getAskUserHandler() {
|
|
23
|
+
return askUserHandler;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Register the ask_user_simple handler. Called during app initialization.
|
|
27
|
+
*/
|
|
28
|
+
export function registerAskUserSimpleHandler(handler) {
|
|
29
|
+
askUserSimpleHandler = handler;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the registered ask_user_simple handler. Called by the ask_user_simple tool.
|
|
33
|
+
*/
|
|
34
|
+
export function getAskUserSimpleHandler() {
|
|
35
|
+
return askUserSimpleHandler;
|
|
36
|
+
}
|
|
37
|
+
// =============================================================================
|
|
38
|
+
// Overlay State (for buffering output during overlays)
|
|
39
|
+
// =============================================================================
|
|
40
|
+
/**
|
|
41
|
+
* Flag indicating if an overlay is currently active.
|
|
42
|
+
* When true, the REPL should buffer text output instead of rendering.
|
|
43
|
+
* This prevents text from appearing in the middle of overlay UI.
|
|
44
|
+
*/
|
|
45
|
+
let overlayActive = false;
|
|
46
|
+
/**
|
|
47
|
+
* Set overlay active state. Called when showing/hiding overlays.
|
|
48
|
+
*/
|
|
49
|
+
export function setOverlayActive(active) {
|
|
50
|
+
overlayActive = active;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check if an overlay is currently active.
|
|
54
|
+
*/
|
|
55
|
+
export function isOverlayActive() {
|
|
56
|
+
return overlayActive;
|
|
57
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slash Command Autocomplete
|
|
3
|
+
*
|
|
4
|
+
* Claude Code-style autocomplete for slash commands.
|
|
5
|
+
* Features:
|
|
6
|
+
* - Horizontal separator line above input
|
|
7
|
+
* - Autocomplete dropdown for slash commands
|
|
8
|
+
* - Multiline input with \ continuation
|
|
9
|
+
* - Proper wrapping for long input
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Slash command definition
|
|
13
|
+
*/
|
|
14
|
+
export interface SlashCommand {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
aliases?: string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Available slash commands
|
|
21
|
+
*/
|
|
22
|
+
export declare const SLASH_COMMANDS: SlashCommand[];
|
|
23
|
+
/**
|
|
24
|
+
* Todo item for display
|
|
25
|
+
*/
|
|
26
|
+
export interface TodoDisplayItem {
|
|
27
|
+
content: string;
|
|
28
|
+
status: 'pending' | 'in_progress' | 'completed';
|
|
29
|
+
activeForm?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Strip ANSI codes from string
|
|
33
|
+
*/
|
|
34
|
+
export declare function stripAnsi(str: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Create interactive input with autocomplete
|
|
37
|
+
*/
|
|
38
|
+
export declare function createInteractiveInput(prompt: string, onSubmit: (input: string) => void, showSeparator?: boolean, getTodos?: () => TodoDisplayItem[]): {
|
|
39
|
+
start: () => void;
|
|
40
|
+
stop: () => void;
|
|
41
|
+
};
|