@compilr-dev/cli 0.5.15 → 0.5.17

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,32 +1,9 @@
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
- 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
- }
7
+ import { type AskUserInput } from '@compilr-dev/sdk';
8
+ export type { AskUserQuestion } from '@compilr-dev/sdk';
31
9
  export declare const askUserTool: import("@compilr-dev/sdk").Tool<AskUserInput>;
32
- export {};
@@ -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>[];
@@ -11,6 +11,7 @@
11
11
  * Single point of terminal output. All rendering goes through this class.
12
12
  * Eliminates race conditions by ensuring only one writer.
13
13
  */
14
+ import { log } from '../foundation/logger.js';
14
15
  import { EventEmitter } from 'events';
15
16
  import { RenderMode, isValidTransition } from './render-modes.js';
16
17
  // Re-export RenderMode for convenience
@@ -721,8 +722,7 @@ export class TerminalRenderer extends EventEmitter {
721
722
  */
722
723
  log(message) {
723
724
  if (this.debug) {
724
- const timestamp = new Date().toISOString().slice(11, 23);
725
- console.error(`[TerminalRenderer ${timestamp}] ${message}`);
725
+ log.debug({ component: 'terminal-renderer' }, message);
726
726
  }
727
727
  }
728
728
  }
@@ -54,13 +54,16 @@ function getMasterKey() {
54
54
  }
55
55
  }
56
56
  /**
57
- * Derive encryption key from master key + machine identifiers
57
+ * Derive encryption key from master key + username.
58
+ * NOTE: hostname was removed from derivation because Docker/devcontainers
59
+ * generate random hostnames on each rebuild, breaking credential decryption.
60
+ * The mk is a 32-byte random value unique per installation — sufficient entropy.
58
61
  */
59
62
  function deriveKey() {
60
63
  const mk = getMasterKey();
61
- const machineId = `${os.hostname()}:${os.userInfo().username}`;
64
+ const userId = os.userInfo().username;
62
65
  // Use scrypt for key derivation (secure, slow by design)
63
- return crypto.scryptSync(`${mk}:${machineId}`, SALT, 32);
66
+ return crypto.scryptSync(`${mk}:${userId}`, SALT, 32);
64
67
  }
65
68
  // =============================================================================
66
69
  // Encryption/Decryption
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/cli",
3
- "version": "0.5.15",
3
+ "version": "0.5.17",
4
4
  "description": "AI-powered coding assistant CLI using @compilr-dev/agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -50,15 +50,16 @@
50
50
  "LICENSE"
51
51
  ],
52
52
  "engines": {
53
- "node": ">=20.0.0"
53
+ "node": ">=22.0.0"
54
54
  },
55
55
  "dependencies": {
56
56
  "@anthropic-ai/sdk": "^0.74.0",
57
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
- "@compilr-dev/factory": "^0.1.12",
61
- "@compilr-dev/sdk": "^0.2.11",
60
+ "@compilr-dev/factory": "^0.1.19",
61
+ "@compilr-dev/logger": "^0.1.0",
62
+ "@compilr-dev/sdk": "^0.7.1",
62
63
  "@compilr-dev/ui-core": "^0.0.1",
63
64
  "@modelcontextprotocol/sdk": "^1.23.0",
64
65
  "better-sqlite3": "^12.5.0",