clavix 2.4.1 → 2.4.3

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/bin/clavix.js CHANGED
@@ -1,15 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // Disable debug mode (stack traces) unless explicitly requested via DEBUG env var
4
+ if (!process.env.DEBUG) {
5
+ require('@oclif/core').settings.debug = false;
6
+ }
7
+
8
+ // Custom error handler to suppress stack traces
9
+ async function handleError(error) {
10
+ // For CLIError, show only the formatted message
11
+ if (error.oclif && error.oclif.exit !== undefined) {
12
+ // Format error message (hints are now included in error.message)
13
+ console.error(' › Error: ' + error.message);
14
+ process.exit(error.oclif.exit);
15
+ }
16
+
17
+ // For other errors, use default handler
18
+ const { handle } = require('@oclif/core');
19
+ return handle(error);
20
+ }
21
+
3
22
  require('../dist/index.js')
4
23
  .run()
5
- .catch((error) => {
6
- // ExitError from OCLIF is thrown when this.error() is called
7
- // It already displays the error message, so we just exit with the code
8
- if (error.oclif && error.oclif.exit !== undefined) {
9
- process.exit(error.oclif.exit);
10
- }
11
-
12
- // For other errors, display them
13
- console.error(error);
14
- process.exit(1);
15
- });
24
+ .catch(handleError);
@@ -67,9 +67,7 @@ class Implement extends core_1.Command {
67
67
  const prdPath = await manager.findPrdDirectory(flags.project);
68
68
  tasksPath = path.join(prdPath, 'tasks.md');
69
69
  if (!(await fs.pathExists(tasksPath))) {
70
- this.error(chalk_1.default.red('Error: No tasks.md found!') +
71
- '\n\n' +
72
- chalk_1.default.yellow('Hint: Run ') + chalk_1.default.cyan('clavix plan') + chalk_1.default.yellow(' first to generate task breakdown'));
70
+ this.error('No tasks.md found\n\nHint: Run "clavix plan" first to generate task breakdown');
73
71
  }
74
72
  console.log(chalk_1.default.dim(`Found: ${tasksPath}\n`));
75
73
  }
@@ -187,13 +185,7 @@ class Implement extends core_1.Command {
187
185
  }
188
186
  catch (error) {
189
187
  const errorMessage = error instanceof Error ? error.message : 'An unexpected error occurred';
190
- let fullMessage = chalk_1.default.red(`Error: ${errorMessage}`);
191
- // Provide helpful hints
192
- if (error instanceof Error && error.message.includes('tasks.md')) {
193
- fullMessage += '\n\n' + chalk_1.default.yellow('Hint: Make sure you have generated a task plan first') +
194
- '\n' + chalk_1.default.gray('Run ') + chalk_1.default.cyan('clavix plan') + chalk_1.default.gray(' to create tasks.md');
195
- }
196
- this.error(fullMessage);
188
+ this.error(errorMessage);
197
189
  }
198
190
  }
199
191
  /**
@@ -240,9 +232,7 @@ class Implement extends core_1.Command {
240
232
  }
241
233
  // No PRD projects found
242
234
  if (prdProjects.length === 0) {
243
- this.error(chalk_1.default.yellow('Warning: No PRD projects found in .clavix/outputs/') +
244
- '\n\n' +
245
- chalk_1.default.gray('Hint: Create a PRD first using ') + chalk_1.default.cyan('clavix prd'));
235
+ this.error('No PRD projects found in .clavix/outputs/\n\nHint: Create a PRD first using: clavix prd');
246
236
  }
247
237
  // Only one PRD - auto-select
248
238
  if (prdProjects.length === 1) {
@@ -325,7 +315,7 @@ class Implement extends core_1.Command {
325
315
  }
326
316
  catch (error) {
327
317
  const errorMessage = error instanceof Error ? error.message : 'Unknown error';
328
- this.error(chalk_1.default.red(`Error running clavix plan: ${errorMessage}`));
318
+ this.error(`Running clavix plan failed: ${errorMessage}`);
329
319
  }
330
320
  }
331
321
  else {
@@ -69,9 +69,11 @@ class Plan extends core_1.Command {
69
69
  if (!prdPath) {
70
70
  selectedProject = await this.resolveProjectDirectory(manager, flags.project);
71
71
  if (!selectedProject) {
72
- this.error(chalk_1.default.red('Error: No PRD projects found in .clavix/outputs/') +
73
- '\n\n' +
74
- chalk_1.default.gray("Hint: Run 'clavix prd' to generate a PRD, 'clavix summarize' to create a mini-PRD, or use 'clavix plan --session <id>'"));
72
+ this.error('No PRD projects found in .clavix/outputs/\n\n' +
73
+ 'Hints:\n' +
74
+ ' • Run "clavix prd" to generate a PRD\n' +
75
+ ' • Run "clavix summarize" to create a mini-PRD\n' +
76
+ ' • Use "clavix plan --session <id>" to plan from a session');
75
77
  }
76
78
  prdPath = selectedProject.path;
77
79
  projectName = selectedProject.name;
@@ -91,14 +93,16 @@ class Plan extends core_1.Command {
91
93
  console.log(chalk_1.default.dim('Looking for PRD artifacts...'));
92
94
  const availableSources = await manager.detectAvailableSources(prdPath);
93
95
  if (availableSources.length === 0) {
94
- this.error(chalk_1.default.red('Error: No PRD artifacts found in this directory') +
95
- '\n\n' +
96
- chalk_1.default.gray('Hint: Generate a PRD with clavix prd, run clavix summarize, or supply a session via --session'));
96
+ this.error('No PRD artifacts found in this directory\n\n' +
97
+ 'Hints:\n' +
98
+ ' Generate a PRD with: clavix prd\n' +
99
+ ' • Create a mini-PRD with: clavix summarize\n' +
100
+ ' • Plan from a session with: clavix plan --session <id>');
97
101
  }
98
102
  if (sourcePreference !== 'auto' && !availableSources.includes(sourcePreference)) {
99
- this.error(chalk_1.default.red(`Error: Preferred source "${sourcePreference}" not found in ${prdPath}`) +
100
- '\n\n' +
101
- chalk_1.default.gray(`Hint: Available sources: ${availableSources.join(', ') || 'none'}. Override with --source`));
103
+ this.error(`Preferred source "${sourcePreference}" not found in ${prdPath}\n\n` +
104
+ `Available sources: ${availableSources.join(', ') || 'none'}\n` +
105
+ 'Hint: Override with --source flag');
102
106
  }
103
107
  if (availableSources.length > 1 && sourcePreference === 'auto') {
104
108
  console.log(chalk_1.default.dim(`Found multiple sources (${availableSources.join(', ')}). Selecting best match...`));
@@ -159,26 +163,7 @@ class Plan extends core_1.Command {
159
163
  }
160
164
  catch (error) {
161
165
  const errorMessage = error instanceof Error ? error.message : 'An unexpected error occurred';
162
- let fullMessage = chalk_1.default.red(`Error: ${errorMessage}`);
163
- if (error instanceof Error) {
164
- if (error.message.includes('Session has no messages')) {
165
- fullMessage += '\n\n' + chalk_1.default.gray('Hint: Add conversation messages with clavix start before running plan --session');
166
- }
167
- else if (error.message.includes('Session not found')) {
168
- fullMessage += '\n\n' + chalk_1.default.gray('Hint: Check the session ID with clavix list');
169
- }
170
- else if (error.message.includes('No active session')) {
171
- fullMessage += '\n\n' + chalk_1.default.gray('Hint: Start a session with clavix start before using --active-session');
172
- }
173
- else if (error.message.includes('PRD project not found')) {
174
- fullMessage += '\n\n' + chalk_1.default.gray("Hint: Run 'clavix list' to see available outputs or specify a valid project name");
175
- }
176
- else if (error.message.includes('No PRD')) {
177
- fullMessage += '\n\n' + chalk_1.default.yellow('Hint: Create a PRD first') +
178
- '\n' + chalk_1.default.gray('Run ') + chalk_1.default.cyan('clavix prd') + chalk_1.default.gray(' to generate a new PRD');
179
- }
180
- }
181
- this.error(fullMessage);
166
+ this.error(errorMessage);
182
167
  }
183
168
  }
184
169
  validateSessionFlags(session, activeSession) {
@@ -138,7 +138,7 @@ class Prd extends core_1.Command {
138
138
  if (answer && answer.toString().trim() && question) {
139
139
  const submitResult = engine.submitAnswer(question.id, answer);
140
140
  if (submitResult !== true) {
141
- console.log(chalk_1.default.red(`\nError: ${submitResult}\n`));
141
+ console.log(chalk_1.default.red(`\n${submitResult}\n`));
142
142
  continue; // Ask again
143
143
  }
144
144
  answers[question.id] = answer;
@@ -173,7 +173,7 @@ class Prd extends core_1.Command {
173
173
  }
174
174
  catch (error) {
175
175
  const errorMessage = error instanceof Error ? error.message : 'An unexpected error occurred';
176
- this.error(chalk_1.default.red(`Error: ${errorMessage}`));
176
+ this.error(errorMessage);
177
177
  }
178
178
  }
179
179
  /**
@@ -72,7 +72,7 @@ class Start extends core_1.Command {
72
72
  }
73
73
  catch (error) {
74
74
  const errorMessage = error instanceof Error ? error.message : 'An unexpected error occurred';
75
- this.error(chalk_1.default.red(`Error: ${errorMessage}`));
75
+ this.error(errorMessage);
76
76
  }
77
77
  }
78
78
  /**
@@ -56,28 +56,25 @@ class Summarize extends core_1.Command {
56
56
  console.log(chalk_1.default.dim(`Loading session ${args.sessionId}...\n`));
57
57
  session = await manager.getSession(args.sessionId);
58
58
  if (!session) {
59
- this.error(chalk_1.default.red(`Error: Session not found: ${args.sessionId}`));
59
+ this.error(`Session not found: ${args.sessionId}`);
60
60
  }
61
61
  }
62
62
  else if (flags.active) {
63
63
  console.log(chalk_1.default.dim('Loading most recent active session...\n'));
64
64
  session = await manager.getActiveSession();
65
65
  if (!session) {
66
- this.error(chalk_1.default.red('Error: No active session found') +
67
- '\n\n' +
68
- chalk_1.default.gray('Hint: Use ') + chalk_1.default.cyan('clavix list') + chalk_1.default.gray(' to see all sessions'));
66
+ this.error('No active session found\n\nHint: Use "clavix list" to see all sessions');
69
67
  }
70
68
  }
71
69
  else {
72
70
  // Try to get active session by default
73
71
  session = await manager.getActiveSession();
74
72
  if (!session) {
75
- this.error(chalk_1.default.yellow('Warning: No active session found') +
76
- '\n\n' +
77
- chalk_1.default.gray('Usage:') +
78
- '\n' + chalk_1.default.gray('') + chalk_1.default.cyan('clavix summarize <session-id>') + chalk_1.default.gray(' - Summarize specific session') +
79
- '\n' + chalk_1.default.gray('') + chalk_1.default.cyan('clavix summarize --active') + chalk_1.default.gray(' - Summarize most recent active session') +
80
- '\n' + chalk_1.default.gray(' • ') + chalk_1.default.cyan('clavix list') + chalk_1.default.gray(' - View all sessions'));
73
+ this.error('No active session found\n\n' +
74
+ 'Usage:\n' +
75
+ ' • clavix summarize <session-id> - Summarize specific session\n' +
76
+ ' • clavix summarize --active - Summarize most recent active session\n' +
77
+ ' • clavix list - View all sessions');
81
78
  }
82
79
  }
83
80
  // Display session info
@@ -89,7 +86,7 @@ class Summarize extends core_1.Command {
89
86
  console.log();
90
87
  // Check if session has messages
91
88
  if (session.messages.length === 0) {
92
- this.error(chalk_1.default.yellow('Warning: Session has no messages to analyze'));
89
+ this.error('Session has no messages to analyze');
93
90
  }
94
91
  // Analyze conversation
95
92
  console.log(chalk_1.default.dim('Analyzing conversation...\n'));
@@ -138,7 +135,7 @@ class Summarize extends core_1.Command {
138
135
  }
139
136
  catch (error) {
140
137
  const errorMessage = error instanceof Error ? error.message : 'An unexpected error occurred';
141
- this.error(chalk_1.default.red(`Error: ${errorMessage}`));
138
+ this.error(errorMessage);
142
139
  }
143
140
  }
144
141
  /**
package/dist/index.js CHANGED
@@ -4,19 +4,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.run = run;
5
5
  const core_1 = require("@oclif/core");
6
6
  async function run(argv) {
7
+ // Disable debug mode (stack traces) unless explicitly requested via DEBUG env var
8
+ if (!process.env.DEBUG) {
9
+ core_1.settings.debug = false;
10
+ }
7
11
  return (0, core_1.run)(argv);
8
12
  }
9
13
  // Run if called directly
10
14
  if (require.main === module) {
11
- run().catch((error) => {
12
- // ExitError from OCLIF is thrown when this.error() is called
13
- // It already displays the error message, so we just exit with the code
14
- if (error.oclif && error.oclif.exit !== undefined) {
15
- process.exit(error.oclif.exit);
16
- }
17
- // For other errors, display them
18
- console.error(error);
19
- process.exit(1);
20
- });
15
+ run().catch(core_1.handle);
21
16
  }
22
17
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
1
  import { AgentAdapter, CommandTemplate } from '../types/agent';
2
- export declare function loadCommandTemplates(adapter: AgentAdapter): Promise<CommandTemplate[]>;
2
+ export declare function loadCommandTemplates(_adapter: AgentAdapter): Promise<CommandTemplate[]>;
3
3
  //# sourceMappingURL=template-loader.d.ts.map
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.loadCommandTemplates = loadCommandTemplates;
37
37
  const path = __importStar(require("path"));
38
38
  const file_system_1 = require("./file-system");
39
- async function loadCommandTemplates(adapter) {
39
+ async function loadCommandTemplates(_adapter) {
40
40
  // Load from canonical template source (always .md files)
41
41
  const templatesDir = getCanonicalTemplatesDirectory();
42
42
  const files = await file_system_1.FileSystem.listFiles(templatesDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavix",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "Transform vague ideas into production-ready prompts. CLI tool using the CLEAR framework to analyze, improve, and generate PRDs for AI coding assistants (Claude Code, Cursor, Windsurf, and more)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",