@compilr-dev/cli 0.5.14 → 0.5.16

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.
@@ -1,114 +1,15 @@
1
1
  /**
2
- * Ask User Tool - Presents structured questions to the user
2
+ * Ask User Tool CLI wrapper around SDK factory
3
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.
4
+ * Uses getAskUserHandler() from shared-handlers.ts which coordinates
5
+ * with the terminal footer (pause/resume) and shows the overlay.
10
6
  */
11
- import { defineTool } from '@compilr-dev/sdk';
7
+ import { createAskUserTool } from '@compilr-dev/sdk';
12
8
  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
- silent: true,
9
+ export const askUserTool = createAskUserTool(async (input) => {
10
+ const handler = getAskUserHandler();
11
+ if (!handler) {
12
+ throw new Error('ask_user handler not initialized. This tool requires the CLI context.');
13
+ }
14
+ return handler(input);
114
15
  });
@@ -10,7 +10,7 @@ export { getActiveProject, setActiveProject } from './project-db.js';
10
10
  /**
11
11
  * All database tools combined (32 tools from SDK)
12
12
  */
13
- export declare const allDbTools: import("@compilr-dev/agents").Tool<never>[];
13
+ export declare const allDbTools: import("@compilr-dev/sdk").Tool<never>[];
14
14
  /**
15
15
  * All factory tools (5 tools from @compilr-dev/factory)
16
16
  */
@@ -22,4 +22,4 @@ export declare const allPlatformTools: import("@compilr-dev/sdk").Tool<never>[];
22
22
  * - 3 model tools (app_model_get, app_model_update, app_model_validate)
23
23
  * - 2 factory tools (factory_scaffold, factory_list_toolkits)
24
24
  */
25
- export declare const allFactoryTools: import("@compilr-dev/sdk").Tool<never>[];
25
+ export declare const allFactoryTools: import("@compilr-dev/agents").Tool<never>[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/cli",
3
- "version": "0.5.14",
3
+ "version": "0.5.16",
4
4
  "description": "AI-powered coding assistant CLI using @compilr-dev/agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -54,11 +54,11 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@anthropic-ai/sdk": "^0.74.0",
57
- "@compilr-dev/agents": "^0.3.25",
57
+ "@compilr-dev/agents": "^0.3.26",
58
58
  "@compilr-dev/agents-coding": "^1.0.4",
59
59
  "@compilr-dev/editor-core": "^0.0.2",
60
60
  "@compilr-dev/factory": "^0.1.12",
61
- "@compilr-dev/sdk": "^0.2.7",
61
+ "@compilr-dev/sdk": "^0.3.0",
62
62
  "@compilr-dev/ui-core": "^0.0.1",
63
63
  "@modelcontextprotocol/sdk": "^1.23.0",
64
64
  "better-sqlite3": "^12.5.0",