@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,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ask User Simple Tool - Single question with flat schema
|
|
3
|
+
*
|
|
4
|
+
* A simplified version of ask_user designed for smaller models.
|
|
5
|
+
* Uses a flat schema (no arrays of objects) that's easier for
|
|
6
|
+
* models like Haiku, Flash, and GPT-4o-mini to generate correctly.
|
|
7
|
+
*
|
|
8
|
+
* Used by /sketch command for quick project outlines.
|
|
9
|
+
*/
|
|
10
|
+
import { defineTool } from '@compilr-dev/agents';
|
|
11
|
+
import { getAskUserSimpleHandler } from '../shared-handlers.js';
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Tool Definition
|
|
14
|
+
// =============================================================================
|
|
15
|
+
export const askUserSimpleTool = defineTool({
|
|
16
|
+
name: 'ask_user_simple',
|
|
17
|
+
description: 'Ask the user a single question. ' +
|
|
18
|
+
'Provide optional predefined choices or allow free-text input. ' +
|
|
19
|
+
'Use this for simple question flows - one question at a time. ' +
|
|
20
|
+
'Best suited for /sketch command and smaller models.',
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
question: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'The question to ask the user',
|
|
27
|
+
},
|
|
28
|
+
options: {
|
|
29
|
+
type: 'array',
|
|
30
|
+
description: 'Predefined options for the user to choose from (max 5)',
|
|
31
|
+
items: { type: 'string' },
|
|
32
|
+
maxItems: 5,
|
|
33
|
+
},
|
|
34
|
+
allowCustom: {
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
description: 'Allow free-text input in addition to options (default: true)',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
required: ['question'],
|
|
40
|
+
},
|
|
41
|
+
execute: async (input) => {
|
|
42
|
+
try {
|
|
43
|
+
// Validate input
|
|
44
|
+
if (!input.question || input.question.trim().length === 0) {
|
|
45
|
+
return {
|
|
46
|
+
success: false,
|
|
47
|
+
error: 'Question text is required',
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (input.options && input.options.length > 5) {
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
error: 'Maximum 5 options allowed',
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// Get the handler from shared-handlers
|
|
57
|
+
const askUserSimpleHandler = getAskUserSimpleHandler();
|
|
58
|
+
if (!askUserSimpleHandler) {
|
|
59
|
+
return {
|
|
60
|
+
success: false,
|
|
61
|
+
error: 'ask_user_simple handler not initialized. This tool requires the CLI context.',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// Show the overlay via the handler (which pauses footer)
|
|
65
|
+
const result = await askUserSimpleHandler({
|
|
66
|
+
question: input.question,
|
|
67
|
+
options: input.options,
|
|
68
|
+
allowCustom: input.allowCustom,
|
|
69
|
+
});
|
|
70
|
+
const output = {
|
|
71
|
+
answer: result.answer,
|
|
72
|
+
skipped: result.skipped,
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
success: true,
|
|
76
|
+
result: output,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
return {
|
|
81
|
+
success: false,
|
|
82
|
+
error: `Failed to ask user: ${err instanceof Error ? err.message : String(err)}`,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ask User Tool - Presents structured questions to the user
|
|
3
|
+
*
|
|
4
|
+
* This tool allows the agent to ask questions with predefined options
|
|
5
|
+
* or free-text input. Used during /design and /refine workflows.
|
|
6
|
+
*
|
|
7
|
+
* Note: This tool uses a callback pattern to coordinate with the footer.
|
|
8
|
+
* The actual overlay is shown via getAskUserHandler() from shared-handlers.ts
|
|
9
|
+
* which is registered during app initialization and properly pauses the footer.
|
|
10
|
+
*/
|
|
11
|
+
export interface AskUserQuestion {
|
|
12
|
+
/** Unique identifier for the question (e.g., "app_type", "target_users") */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Short label for tab display (e.g., "App Type", "Users") - max 12 chars */
|
|
15
|
+
header: string;
|
|
16
|
+
/** The question text */
|
|
17
|
+
question: string;
|
|
18
|
+
/** Predefined options (optional) */
|
|
19
|
+
options?: string[];
|
|
20
|
+
/** Allow free-text input (default: true) */
|
|
21
|
+
allowCustom?: boolean;
|
|
22
|
+
/** Allow multiple selections (default: false) */
|
|
23
|
+
multiSelect?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface AskUserInput {
|
|
26
|
+
/** 1-5 questions to ask */
|
|
27
|
+
questions: AskUserQuestion[];
|
|
28
|
+
/** Optional context shown above questions */
|
|
29
|
+
context?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const askUserTool: import("@compilr-dev/agents").Tool<AskUserInput>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ask User Tool - Presents structured questions to the user
|
|
3
|
+
*
|
|
4
|
+
* This tool allows the agent to ask questions with predefined options
|
|
5
|
+
* or free-text input. Used during /design and /refine workflows.
|
|
6
|
+
*
|
|
7
|
+
* Note: This tool uses a callback pattern to coordinate with the footer.
|
|
8
|
+
* The actual overlay is shown via getAskUserHandler() from shared-handlers.ts
|
|
9
|
+
* which is registered during app initialization and properly pauses the footer.
|
|
10
|
+
*/
|
|
11
|
+
import { defineTool } from '@compilr-dev/agents';
|
|
12
|
+
import { getAskUserHandler } from '../shared-handlers.js';
|
|
13
|
+
// =============================================================================
|
|
14
|
+
// Tool Definition
|
|
15
|
+
// =============================================================================
|
|
16
|
+
export const askUserTool = defineTool({
|
|
17
|
+
name: 'ask_user',
|
|
18
|
+
description: 'Ask the user structured questions. ' +
|
|
19
|
+
'Present 1-5 questions with optional predefined answers. ' +
|
|
20
|
+
'Each question can have options to choose from or allow free-text input. ' +
|
|
21
|
+
'Use this during design/refine phases to gather requirements efficiently.',
|
|
22
|
+
inputSchema: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
questions: {
|
|
26
|
+
type: 'array',
|
|
27
|
+
description: 'Questions to ask the user (1-5 questions)',
|
|
28
|
+
minItems: 1,
|
|
29
|
+
maxItems: 5,
|
|
30
|
+
items: {
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: {
|
|
33
|
+
id: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'Unique identifier for the question',
|
|
36
|
+
},
|
|
37
|
+
header: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
description: 'Short label for tab display (max 12 chars)',
|
|
40
|
+
},
|
|
41
|
+
question: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
description: 'The question text',
|
|
44
|
+
},
|
|
45
|
+
options: {
|
|
46
|
+
type: 'array',
|
|
47
|
+
description: 'Predefined options (optional)',
|
|
48
|
+
items: { type: 'string' },
|
|
49
|
+
},
|
|
50
|
+
allowCustom: {
|
|
51
|
+
type: 'boolean',
|
|
52
|
+
description: 'Allow free-text input (default: true)',
|
|
53
|
+
},
|
|
54
|
+
multiSelect: {
|
|
55
|
+
type: 'boolean',
|
|
56
|
+
description: 'Allow multiple selections (default: false)',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
required: ['id', 'header', 'question'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
context: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
description: 'Optional context shown above questions',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
required: ['questions'],
|
|
68
|
+
},
|
|
69
|
+
execute: async (input) => {
|
|
70
|
+
try {
|
|
71
|
+
// Validate input
|
|
72
|
+
if (input.questions.length === 0) {
|
|
73
|
+
return {
|
|
74
|
+
success: false,
|
|
75
|
+
error: 'At least one question is required',
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (input.questions.length > 5) {
|
|
79
|
+
return {
|
|
80
|
+
success: false,
|
|
81
|
+
error: 'Maximum 5 questions allowed',
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// Get the handler from index.ts which coordinates with footer
|
|
85
|
+
const askUserHandler = getAskUserHandler();
|
|
86
|
+
if (!askUserHandler) {
|
|
87
|
+
return {
|
|
88
|
+
success: false,
|
|
89
|
+
error: 'ask_user handler not initialized. This tool requires the CLI context.',
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
// Show the overlay via the handler (which pauses footer)
|
|
93
|
+
const result = await askUserHandler({
|
|
94
|
+
questions: input.questions,
|
|
95
|
+
context: input.context,
|
|
96
|
+
});
|
|
97
|
+
const output = {
|
|
98
|
+
answers: result.answers,
|
|
99
|
+
skipped: result.skipped,
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
success: true,
|
|
103
|
+
result: output,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
return {
|
|
108
|
+
success: false,
|
|
109
|
+
error: `Failed to ask user: ${err instanceof Error ? err.message : String(err)}`,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backlog Tools - Read and write project backlog items
|
|
3
|
+
*
|
|
4
|
+
* These tools allow the agent to programmatically manage the project backlog,
|
|
5
|
+
* supporting the /design and /refine workflow.
|
|
6
|
+
*/
|
|
7
|
+
export type BacklogStatus = '📋' | '🚧' | '✅';
|
|
8
|
+
export type BacklogType = 'feature' | 'bug' | 'tech-debt' | 'chore';
|
|
9
|
+
export type BacklogPriority = 'critical' | 'high' | 'medium' | 'low';
|
|
10
|
+
export interface BacklogItem {
|
|
11
|
+
id: string;
|
|
12
|
+
type: BacklogType;
|
|
13
|
+
status: BacklogStatus;
|
|
14
|
+
priority: BacklogPriority;
|
|
15
|
+
title: string;
|
|
16
|
+
description: string;
|
|
17
|
+
commit?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Find the backlog file path for the current project.
|
|
21
|
+
* Checks both single-repo and two-repo patterns.
|
|
22
|
+
*/
|
|
23
|
+
export declare function findBacklogPath(basePath?: string): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Parse backlog items from markdown content.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseBacklogItems(content: string): BacklogItem[];
|
|
28
|
+
interface BacklogReadInput {
|
|
29
|
+
status?: BacklogStatus | 'all';
|
|
30
|
+
type?: BacklogType | 'all';
|
|
31
|
+
priority?: BacklogPriority | 'all';
|
|
32
|
+
limit?: number;
|
|
33
|
+
offset?: number;
|
|
34
|
+
search?: string;
|
|
35
|
+
id?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare const backlogReadTool: import("@compilr-dev/agents").Tool<BacklogReadInput>;
|
|
38
|
+
interface BacklogWriteInput {
|
|
39
|
+
action: 'add' | 'update' | 'remove' | 'reorder';
|
|
40
|
+
items?: Array<{
|
|
41
|
+
type: BacklogType;
|
|
42
|
+
status?: BacklogStatus;
|
|
43
|
+
priority: BacklogPriority;
|
|
44
|
+
title: string;
|
|
45
|
+
description: string;
|
|
46
|
+
}>;
|
|
47
|
+
id?: string;
|
|
48
|
+
updates?: Partial<Omit<BacklogItem, 'id'>>;
|
|
49
|
+
ids?: string[];
|
|
50
|
+
order?: string[];
|
|
51
|
+
}
|
|
52
|
+
export declare const backlogWriteTool: import("@compilr-dev/agents").Tool<BacklogWriteInput>;
|
|
53
|
+
export {};
|