clavix 5.5.0 → 5.5.2

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 CHANGED
@@ -1,64 +1,27 @@
1
1
  # Clavix
2
- > Agentic-first prompt workflows. Markdown templates that teach AI agents how to optimize prompts, create PRDs, and manage implementation. Works with Claude Code, Cursor, Windsurf, and 19+ other AI coding tools.
3
-
4
- ## Table of contents
5
- - [Why Clavix?](#why-clavix)
6
- - [How It Works](#how-it-works)
7
- - [Supported AI Tools](#supported-ai-tools)
8
- - [Quickstart](#quickstart)
9
- - [Full documentation](#full-documentation)
10
-
11
- ## Release Notes
12
-
13
- | Version | Highlights | Details |
14
- | --- | --- | --- |
15
- | **v5.5.0** (Latest) | Architecture cleanup, consolidated adapters, documentation overhaul | [Changelog](CHANGELOG.md) |
16
- | **v5.0.0** | Agentic-first architecture - lean template delivery | [Changelog](CHANGELOG.md#500---2025-01-27) |
17
-
18
- **Requirements:** Node.js >= 18.0.0
19
-
20
- ## Why Clavix?
21
-
22
- Better prompts lead to better code. Clavix provides **markdown templates** that teach AI agents how to:
23
- - **Optimize prompts** - Transform rough ideas into structured, AI-ready prompts
24
- - **Create PRDs** - Generate comprehensive requirements documents through guided questions
25
- - **Plan implementations** - Break down PRDs into phased task lists
26
- - **Track progress** - Manage task completion with optional git commits
27
-
28
- **No framework to learn.** Just describe what you want, and your AI agent follows the Clavix templates to structure it properly.
29
-
30
- Learn more in [docs/why-clavix.md](docs/why-clavix.md).
31
2
 
32
- ## How It Works
3
+ > Agentic-first prompt workflows. Markdown templates that teach AI agents how to optimize prompts, create PRDs, and manage implementation. Works with Claude Code, Cursor, Windsurf, and 19+ other AI coding tools.
33
4
 
34
- Clavix v5 follows an **agentic-first architecture**:
5
+ ## Quick Links
35
6
 
36
- 1. **You run `clavix init`** - Sets up `.clavix/` directory with slash command templates
37
- 2. **You invoke a slash command** - Like `/clavix:improve` in Claude Code or Cursor
38
- 3. **Your AI agent reads the template** - The markdown file contains all instructions
39
- 4. **The agent follows the instructions** - Using its native tools (Write, Read, Edit, etc.)
40
- 5. **Output is saved** - To `.clavix/outputs/` for future reference
7
+ | I want to... | Go to |
8
+ |--------------|-------|
9
+ | Get started | [Quickstart](#quickstart) |
10
+ | See all commands | [docs/commands.md](docs/commands.md) |
11
+ | Understand the architecture | [docs/architecture.md](docs/architecture.md) |
12
+ | Check integrations | [docs/integrations.md](docs/integrations.md) |
13
+ | Contribute | [CONTRIBUTING.md](CONTRIBUTING.md) |
41
14
 
42
- **No TypeScript code executes during slash command usage.** The templates are the product - they instruct AI agents on what to do.
15
+ ## Command Format
43
16
 
44
- ## Supported AI Tools
17
+ **Your command format depends on your AI tool:**
45
18
 
46
- | Category | Tools |
47
- | --- | --- |
48
- | IDE extensions | Cursor, Windsurf, Kilocode, Roocode, Cline |
49
- | CLI agents | Claude Code, Droid CLI, CodeBuddy CLI, OpenCode, Gemini CLI, Qwen Code, LLXPRT, Amp, Crush CLI, Codex CLI, Augment CLI |
50
- | Universal adapters | AGENTS.md, GitHub Copilot, OCTO.md, WARP.md |
19
+ | Tool Type | Format | Example |
20
+ |-----------|--------|---------|
21
+ | **CLI tools** (Claude Code, Gemini, Qwen) | Colon (`:`) | `/clavix:improve` |
22
+ | **IDE extensions** (Cursor, Windsurf, Cline) | Hyphen (`-`) | `/clavix-improve` |
51
23
 
52
- ### Feature Matrix
53
-
54
- | Feature | Claude Code | Cursor/Windsurf | Gemini/Qwen | Generic Agents |
55
- |---------|-------------|-----------------|-------------|----------------|
56
- | Slash commands | ✅ Native | ✅ Native | ✅ TOML | ❌ Read-only |
57
- | Doc injection | ✅ CLAUDE.md | ✅ .cursor/rules | ✅ N/A | ✅ AGENTS.md |
58
- | Namespace dirs | ✅ clavix/ | ✅ clavix/ | ✅ clavix/ | N/A |
59
- | Auto-detection | ✅ Yes | ✅ Yes | ✅ Yes | N/A |
60
-
61
- Full list and configuration: [docs/integrations.md](docs/integrations.md)
24
+ **Rule of thumb:** CLI tools use colon, IDE extensions use hyphen.
62
25
 
63
26
  ## Quickstart
64
27
 
@@ -69,80 +32,76 @@ npm install -g clavix
69
32
  clavix init
70
33
  ```
71
34
 
72
- This creates `.clavix/` with slash command templates and injects documentation into your CLAUDE.md (or equivalent).
73
-
74
35
  ### 2. Use Slash Commands
75
36
 
76
- In your AI coding assistant (Claude Code, Cursor, etc.):
77
-
78
37
  ```
79
38
  /clavix:improve "Create a secure login page with JWT"
80
39
  ```
81
40
 
82
- The AI agent reads the improve template and:
83
- - Analyzes your prompt for quality
84
- - Applies optimization patterns
85
- - Saves the improved version to `.clavix/outputs/prompts/`
41
+ The AI agent reads the template and optimizes your prompt.
86
42
 
87
43
  ### 3. Choose Your Workflow
88
44
 
89
- **Core Workflows:**
90
45
  | Command | When to Use |
91
46
  |---------|-------------|
92
- | `/clavix:improve` | Optimize a single prompt (auto-selects depth) |
47
+ | `/clavix:improve` | Optimize a single prompt |
93
48
  | `/clavix:prd` | Plan something new with guided questions |
94
- | `/clavix:start` | Explore ideas conversationally first |
95
49
  | `/clavix:plan` | Generate tasks from a PRD |
96
50
  | `/clavix:implement` | Execute tasks with progress tracking |
97
- | `/clavix:summarize` | Extract requirements from conversation |
98
51
 
99
- **Project Management:**
100
- | Utility | Purpose |
101
- |---------|---------|
102
- | `/clavix:verify` | Check implementation against PRD requirements |
103
- | `/clavix:archive` | Archive completed projects to `.clavix/archive/` |
52
+ See [Getting Started](docs/getting-started.md) for the full guide.
104
53
 
105
- See [Choosing the Right Workflow](docs/guides/choosing-workflow.md) for detailed guidance.
54
+ ## How It Works
106
55
 
107
- ### 4. Keep Templates Updated
56
+ Clavix is **agentic-first**:
108
57
 
109
- ```bash
110
- clavix update # After npm update clavix
111
- ```
58
+ 1. **You run `clavix init`** - Sets up slash command templates
59
+ 2. **You invoke a slash command** - Like `/clavix:improve`
60
+ 3. **AI agent reads the template** - Markdown instructions
61
+ 4. **Agent follows instructions** - Using its native tools
62
+ 5. **Output is saved** - To `.clavix/outputs/`
112
63
 
113
- ## CLI Commands
64
+ **No TypeScript executes during slash commands.** The markdown templates ARE the product.
114
65
 
115
- Clavix v5 has 4 CLI commands (for setup and diagnostics, not workflows):
66
+ See [Architecture](docs/architecture.md) for details.
67
+
68
+ ## Supported AI Tools
69
+
70
+ | Category | Tools |
71
+ |----------|-------|
72
+ | IDE extensions | Cursor, Windsurf, Kilocode, Roocode, Cline |
73
+ | CLI agents | Claude Code, Gemini CLI, Qwen Code, Droid CLI, CodeBuddy, OpenCode, LLXPRT, Amp, Crush CLI, Codex CLI, Augment CLI |
74
+ | Universal | AGENTS.md, GitHub Copilot, OCTO.md, WARP.md |
75
+
76
+ Full list: [docs/integrations.md](docs/integrations.md)
77
+
78
+ ## CLI Commands
116
79
 
117
80
  | Command | Purpose |
118
81
  |---------|---------|
119
- | `clavix init` | Initialize or reconfigure Clavix in a project |
120
- | `clavix update` | Update templates after package update |
121
- | `clavix diagnose` | Check installation and report issues |
82
+ | `clavix init` | Initialize Clavix in a project |
83
+ | `clavix update` | Regenerate templates |
84
+ | `clavix diagnose` | Check installation |
122
85
  | `clavix version` | Show version |
123
86
 
124
- **All workflows** (`/clavix:improve`, `/clavix:prd`, etc.) are **slash commands** that AI agents execute by reading markdown templates.
87
+ All workflows (`/clavix:improve`, etc.) are **slash commands** that AI agents execute.
125
88
 
126
- ## Full documentation
127
- - Overview & navigation: [docs/README.md](docs/README.md)
128
- - Integrations: [docs/integrations.md](docs/integrations.md)
129
- - How it works: [docs/how-it-works.md](docs/how-it-works.md)
130
- - Philosophy: [docs/philosophy.md](docs/philosophy.md)
89
+ ## Documentation
131
90
 
132
- ## Requirements
91
+ - [Getting Started](docs/getting-started.md) - Installation and first workflow
92
+ - [Commands Reference](docs/commands.md) - All commands in one place
93
+ - [Architecture](docs/architecture.md) - How Clavix works
94
+ - [Integrations](docs/integrations.md) - Full tool matrix
95
+ - [CONTRIBUTING.md](CONTRIBUTING.md) - Contribute to Clavix
133
96
 
134
- ### For End Users
135
- - **Node.js >= 18.0.0**
136
- - npm or yarn package manager
137
- - An AI coding assistant (Claude Code, Cursor, Windsurf, etc.)
97
+ ## Requirements
138
98
 
139
- ### For Contributors
140
99
  - **Node.js >= 18.0.0**
141
- - Run tests: `npm test`
142
- - Lint: `npm run lint`
143
- - Build: `npm run build`
100
+ - npm or yarn
101
+ - An AI coding tool (Claude Code, Cursor, etc.)
144
102
 
145
103
  ## License
104
+
146
105
  Apache-2.0
147
106
 
148
107
  ## Star History
@@ -15,6 +15,7 @@ import { GeminiAdapter } from '../../core/adapters/gemini-adapter.js';
15
15
  import { QwenAdapter } from '../../core/adapters/qwen-adapter.js';
16
16
  import { loadCommandTemplates } from '../../utils/template-loader.js';
17
17
  import { collectLegacyCommandFiles } from '../../utils/legacy-command-cleanup.js';
18
+ import { CLAVIX_BLOCK_START, CLAVIX_BLOCK_END } from '../../constants.js';
18
19
  export default class Init extends Command {
19
20
  static description = 'Initialize Clavix in the current project';
20
21
  static examples = ['<%= config.bin %> <%= command.id %>'];
@@ -76,8 +77,11 @@ export default class Init extends Command {
76
77
  // Select integrations using shared utility
77
78
  console.log(chalk.gray('Select AI development tools to support:\n'));
78
79
  console.log(chalk.gray('(Space to select, Enter to confirm)\n'));
79
- const { selectIntegrations } = await import('../../utils/integration-selector.js');
80
- const selectedIntegrations = await selectIntegrations(agentManager, existingIntegrations);
80
+ console.log(chalk.cyan('ℹ'), chalk.gray('AGENTS.md is always enabled to provide universal agent guidance.\n'));
81
+ const { selectIntegrations, ensureMandatoryIntegrations } = await import('../../utils/integration-selector.js');
82
+ const userSelectedIntegrations = await selectIntegrations(agentManager, existingIntegrations);
83
+ // Always include AGENTS.md
84
+ const selectedIntegrations = ensureMandatoryIntegrations(userSelectedIntegrations);
81
85
  if (!selectedIntegrations || selectedIntegrations.length === 0) {
82
86
  console.log(chalk.red('\n✗ No integrations selected\n'));
83
87
  return;
@@ -272,18 +276,30 @@ export default class Init extends Command {
272
276
  await InstructionsGenerator.generate();
273
277
  console.log(chalk.gray(' ✓ Created detailed workflow guides for generic integrations'));
274
278
  }
275
- // Success message
276
- // v4.11: Use generic command names - format varies by integration
277
- // (claude-code uses colon like /clavix:improve, droid uses hyphen like /clavix-improve)
279
+ // Success message with prominent command format display
278
280
  console.log(chalk.bold.green('\n✅ Clavix initialized successfully!\n'));
279
- console.log(chalk.gray('Next steps:'));
281
+ // Determine the primary command format based on selected integrations
282
+ const colonTools = ['claude-code', 'gemini', 'qwen', 'crush', 'llxprt', 'augment'];
283
+ const usesColon = selectedIntegrations.some((i) => colonTools.includes(i));
284
+ const usesHyphen = selectedIntegrations.some((i) => !colonTools.includes(i));
285
+ const separator = usesColon && !usesHyphen ? ':' : usesHyphen && !usesColon ? '-' : ':';
286
+ const altSeparator = separator === ':' ? '-' : ':';
287
+ // Show command format prominently at the TOP
288
+ console.log(chalk.bold('📋 Your command format:'), chalk.bold.cyan(`/clavix${separator}improve`));
289
+ if (usesColon && usesHyphen) {
290
+ console.log(chalk.gray(' (Some integrations use'), chalk.cyan(`/clavix${altSeparator}improve`), chalk.gray('instead)'));
291
+ }
292
+ console.log();
293
+ // Available commands
294
+ console.log(chalk.gray('Available slash commands:'));
295
+ console.log(chalk.gray(' •'), chalk.cyan(`/clavix${separator}improve`), chalk.gray('- Smart prompt optimization'));
296
+ console.log(chalk.gray(' •'), chalk.cyan(`/clavix${separator}prd`), chalk.gray('- Generate PRD through guided questions'));
297
+ console.log(chalk.gray(' •'), chalk.cyan(`/clavix${separator}plan`), chalk.gray('- Create task breakdown from PRD'));
298
+ console.log(chalk.gray(' •'), chalk.cyan(`/clavix${separator}implement`), chalk.gray('- Execute tasks or prompts'));
299
+ console.log(chalk.gray('\nNext steps:'));
280
300
  console.log(chalk.gray(' • Slash commands are now available in your AI agent'));
281
- console.log(chalk.gray(' • Run'), chalk.cyan('clavix --help'), chalk.gray('to see all CLI commands'));
282
- console.log(chalk.gray(' • Available slash commands:'));
283
- console.log(chalk.gray(' ◦'), chalk.cyan('improve'), chalk.gray('- Smart prompt optimization with auto depth selection'));
284
- console.log(chalk.gray(' ◦'), chalk.cyan('prd'), chalk.gray('- Generate PRD through guided questions'));
285
- console.log(chalk.gray(' ◦'), chalk.cyan('execute'), chalk.gray('- Run saved prompts'));
286
- console.log(chalk.gray('\n Command format varies by integration (colon vs hyphen)\n'));
301
+ console.log(chalk.gray(' • Run'), chalk.cyan('clavix diagnose'), chalk.gray('to verify installation'));
302
+ console.log();
287
303
  }
288
304
  catch (error) {
289
305
  const { getErrorMessage, toError } = await import('../../utils/error-utils.js');
@@ -378,6 +394,17 @@ export default class Init extends Command {
378
394
 
379
395
  Welcome to Clavix! This directory contains your local Clavix configuration and data.
380
396
 
397
+ ## Command Format
398
+
399
+ **Your command format depends on your AI tool:**
400
+
401
+ | Tool Type | Format | Example |
402
+ |-----------|--------|---------|
403
+ | **CLI tools** (Claude Code, Gemini, Qwen) | Colon (\`:\`) | \`/clavix:improve\` |
404
+ | **IDE extensions** (Cursor, Windsurf, Cline) | Hyphen (\`-\`) | \`/clavix-improve\` |
405
+
406
+ **Rule of thumb:** CLI tools use colon, IDE extensions use hyphen.
407
+
381
408
  ## Directory Structure
382
409
 
383
410
  \`\`\`
@@ -530,7 +557,8 @@ To reconfigure integrations, run \`clavix init\` again.
530
557
  }
531
558
  }
532
559
  extractClavixBlock(content) {
533
- const match = content.match(/<!-- CLAVIX:START -->([\s\S]*?)<!-- CLAVIX:END -->/);
560
+ const regex = new RegExp(`${CLAVIX_BLOCK_START}([\\s\\S]*?)${CLAVIX_BLOCK_END}`);
561
+ const match = content.match(regex);
534
562
  return match ? match[1].trim() : content;
535
563
  }
536
564
  }
@@ -3,8 +3,6 @@ import chalk from 'chalk';
3
3
  import inquirer from 'inquirer';
4
4
  import fs from 'fs-extra';
5
5
  import * as path from 'path';
6
- import { fileURLToPath } from 'url';
7
- import { dirname } from 'path';
8
6
  import { DocInjector } from '../../core/doc-injector.js';
9
7
  import { AgentManager } from '../../core/agent-manager.js';
10
8
  import { AgentsMdGenerator } from '../../core/adapters/agents-md-generator.js';
@@ -12,8 +10,7 @@ import { OctoMdGenerator } from '../../core/adapters/octo-md-generator.js';
12
10
  import { WarpMdGenerator } from '../../core/adapters/warp-md-generator.js';
13
11
  import { InstructionsGenerator } from '../../core/adapters/instructions-generator.js';
14
12
  import { collectLegacyCommandFiles } from '../../utils/legacy-command-cleanup.js';
15
- const __filename = fileURLToPath(import.meta.url);
16
- const _dirname = dirname(__filename); // eslint-disable-line @typescript-eslint/no-unused-vars
13
+ import { CLAVIX_BLOCK_START, CLAVIX_BLOCK_END } from '../../constants.js';
17
14
  export default class Update extends Command {
18
15
  static description = 'Update managed blocks and slash commands';
19
16
  static examples = [
@@ -135,8 +132,8 @@ export default class Update extends Command {
135
132
  const currentContent = fs.readFileSync(claudePath, 'utf-8');
136
133
  if (force || !this.hasUpToDateBlock(currentContent, claudeContent)) {
137
134
  await DocInjector.injectBlock(claudePath, claudeContent, {
138
- startMarker: '<!-- CLAVIX:START -->',
139
- endMarker: '<!-- CLAVIX:END -->',
135
+ startMarker: CLAVIX_BLOCK_START,
136
+ endMarker: CLAVIX_BLOCK_END,
140
137
  });
141
138
  this.log(chalk.gray(' ✓ Updated CLAUDE.md'));
142
139
  updated++;
@@ -2,17 +2,6 @@
2
2
  * Clavix constants and magic values
3
3
  * Centralizes hardcoded values for maintainability
4
4
  */
5
- export declare const BACKUP_EXTENSION = ".backup";
6
- export declare const SEPARATOR_WIDTH = 50;
7
- export declare const SEPARATOR_CHAR = "\u2500";
8
5
  export declare const CLAVIX_BLOCK_START = "<!-- CLAVIX:START -->";
9
6
  export declare const CLAVIX_BLOCK_END = "<!-- CLAVIX:END -->";
10
- export declare const WINDSURF_CHAR_LIMIT = 12000;
11
- export declare const DEPTH_STANDARD = "standard";
12
- export declare const DEPTH_COMPREHENSIVE = "comprehensive";
13
- export declare const CLAVIX_CONFIG_DIR = ".clavix";
14
- export declare const CLAVIX_CONFIG_FILE = "config.json";
15
- export declare const CLAVIX_OUTPUTS_DIR = "outputs";
16
- export declare const CLAVIX_PROMPTS_DIR = "prompts";
17
- export declare const CLAVIX_TEMPLATES_DIR = "templates";
18
7
  //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js CHANGED
@@ -2,23 +2,7 @@
2
2
  * Clavix constants and magic values
3
3
  * Centralizes hardcoded values for maintainability
4
4
  */
5
- // File system
6
- export const BACKUP_EXTENSION = '.backup';
7
- // CLI formatting
8
- export const SEPARATOR_WIDTH = 50;
9
- export const SEPARATOR_CHAR = '─';
10
5
  // Clavix managed block markers
11
6
  export const CLAVIX_BLOCK_START = '<!-- CLAVIX:START -->';
12
7
  export const CLAVIX_BLOCK_END = '<!-- CLAVIX:END -->';
13
- // Adapter-specific limits
14
- export const WINDSURF_CHAR_LIMIT = 12000;
15
- // Depth terminology (canonical)
16
- export const DEPTH_STANDARD = 'standard';
17
- export const DEPTH_COMPREHENSIVE = 'comprehensive';
18
- // File patterns
19
- export const CLAVIX_CONFIG_DIR = '.clavix';
20
- export const CLAVIX_CONFIG_FILE = 'config.json';
21
- export const CLAVIX_OUTPUTS_DIR = 'outputs';
22
- export const CLAVIX_PROMPTS_DIR = 'prompts';
23
- export const CLAVIX_TEMPLATES_DIR = 'templates';
24
8
  //# sourceMappingURL=constants.js.map
@@ -7,6 +7,11 @@
7
7
  * For adapters requiring custom behavior (TOML format, doc injection),
8
8
  * dedicated adapter classes still exist.
9
9
  *
10
+ * NOTE: AGENTS.md is a mandatory integration that is always enabled by default.
11
+ * It provides universal agent guidance that all AI tools can read. The AGENTS.md
12
+ * adapter is handled separately via AgentsMdGenerator and is automatically
13
+ * included by ensureMandatoryIntegrations() in integration-selector.ts.
14
+ *
10
15
  * @since v5.3.0
11
16
  */
12
17
  import { AdapterConfig } from '../types/adapter-config.js';
@@ -7,6 +7,11 @@
7
7
  * For adapters requiring custom behavior (TOML format, doc injection),
8
8
  * dedicated adapter classes still exist.
9
9
  *
10
+ * NOTE: AGENTS.md is a mandatory integration that is always enabled by default.
11
+ * It provides universal agent guidance that all AI tools can read. The AGENTS.md
12
+ * adapter is handled separately via AgentsMdGenerator and is automatically
13
+ * included by ensureMandatoryIntegrations() in integration-selector.ts.
14
+ *
10
15
  * @since v5.3.0
11
16
  */
12
17
  import { DEFAULT_MD_FEATURES, DEFAULT_TOML_FEATURES, } from '../types/adapter-config.js';
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'url';
3
3
  import { dirname } from 'path';
4
4
  import { FileSystem } from '../../utils/file-system.js';
5
5
  import { DocInjector } from '../doc-injector.js';
6
+ import { DataError } from '../../types/errors.js';
6
7
  const __filename = fileURLToPath(import.meta.url);
7
8
  const __dirname = dirname(__filename);
8
9
  /**
@@ -17,7 +18,7 @@ export class AgentsMdGenerator {
17
18
  static async generate() {
18
19
  const templatePath = path.join(__dirname, '../../templates/agents/agents.md');
19
20
  if (!(await FileSystem.exists(templatePath))) {
20
- throw new Error(`AGENTS.md template not found at ${templatePath}`);
21
+ throw new DataError(`AGENTS.md template not found at ${templatePath}`, "Check Clavix installation or run 'clavix update'");
21
22
  }
22
23
  const template = await FileSystem.readFile(templatePath);
23
24
  await DocInjector.injectBlock(this.TARGET_FILE, template, {
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'url';
3
3
  import { dirname } from 'path';
4
4
  import { FileSystem } from '../../utils/file-system.js';
5
5
  import { DocInjector } from '../doc-injector.js';
6
+ import { DataError } from '../../types/errors.js';
6
7
  const __filename = fileURLToPath(import.meta.url);
7
8
  const __dirname = dirname(__filename);
8
9
  /**
@@ -17,7 +18,7 @@ export class CopilotInstructionsGenerator {
17
18
  static async generate() {
18
19
  const templatePath = path.join(__dirname, '../../templates/agents/copilot-instructions.md');
19
20
  if (!(await FileSystem.exists(templatePath))) {
20
- throw new Error(`Copilot instructions template not found at ${templatePath}`);
21
+ throw new DataError(`Copilot instructions template not found at ${templatePath}`, "Check Clavix installation or run 'clavix update'");
21
22
  }
22
23
  const template = await FileSystem.readFile(templatePath);
23
24
  // Ensure .github directory exists
@@ -1,6 +1,7 @@
1
1
  import { FileSystem } from '../../utils/file-system.js';
2
2
  import { TemplateAssembler } from '../template-assembler.js';
3
3
  import { CommandTransformer } from '../command-transformer.js';
4
+ import { DataError } from '../../types/errors.js';
4
5
  import * as path from 'path';
5
6
  import { fileURLToPath } from 'url';
6
7
  import { dirname } from 'path';
@@ -28,7 +29,7 @@ export class InstructionsGenerator {
28
29
  const staticInstructionsPath = path.join(__dirname, '../../templates/instructions');
29
30
  // Check if static template exists
30
31
  if (!(await FileSystem.exists(staticInstructionsPath))) {
31
- throw new Error(`.clavix/instructions static files not found at ${staticInstructionsPath}`);
32
+ throw new DataError(`.clavix/instructions static files not found at ${staticInstructionsPath}`, "Check Clavix installation or run 'clavix update'");
32
33
  }
33
34
  // Create target directory
34
35
  await FileSystem.ensureDir(this.TARGET_DIR);
@@ -70,7 +71,7 @@ export class InstructionsGenerator {
70
71
  const canonicalPath = path.join(__dirname, '../../templates/slash-commands/_canonical');
71
72
  const workflowsTarget = path.join(this.TARGET_DIR, 'workflows');
72
73
  if (!(await FileSystem.exists(canonicalPath))) {
73
- throw new Error(`Canonical templates not found at ${canonicalPath}`);
74
+ throw new DataError(`Canonical templates not found at ${canonicalPath}`, "Check Clavix installation or run 'clavix update'");
74
75
  }
75
76
  // Create workflows directory
76
77
  await FileSystem.ensureDir(workflowsTarget);
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'url';
3
3
  import { dirname } from 'path';
4
4
  import { FileSystem } from '../../utils/file-system.js';
5
5
  import { DocInjector } from '../doc-injector.js';
6
+ import { DataError } from '../../types/errors.js';
6
7
  const __filename = fileURLToPath(import.meta.url);
7
8
  const __dirname = dirname(__filename);
8
9
  /**
@@ -17,7 +18,7 @@ export class OctoMdGenerator {
17
18
  static async generate() {
18
19
  const templatePath = path.join(__dirname, '../../templates/agents/octo.md');
19
20
  if (!(await FileSystem.exists(templatePath))) {
20
- throw new Error(`OCTO.md template not found at ${templatePath}`);
21
+ throw new DataError(`OCTO.md template not found at ${templatePath}`, "Check Clavix installation or run 'clavix update'");
21
22
  }
22
23
  const template = await FileSystem.readFile(templatePath);
23
24
  await DocInjector.injectBlock(this.TARGET_FILE, template, {
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'url';
3
3
  import { dirname } from 'path';
4
4
  import { FileSystem } from '../../utils/file-system.js';
5
5
  import { DocInjector } from '../doc-injector.js';
6
+ import { DataError } from '../../types/errors.js';
6
7
  const __filename = fileURLToPath(import.meta.url);
7
8
  const __dirname = dirname(__filename);
8
9
  /**
@@ -17,7 +18,7 @@ export class WarpMdGenerator {
17
18
  static async generate() {
18
19
  const templatePath = path.join(__dirname, '../../templates/agents/warp.md');
19
20
  if (!(await FileSystem.exists(templatePath))) {
20
- throw new Error(`WARP.md template not found at ${templatePath}`);
21
+ throw new DataError(`WARP.md template not found at ${templatePath}`, "Check Clavix installation or run 'clavix update'");
21
22
  }
22
23
  const template = await FileSystem.readFile(templatePath);
23
24
  await DocInjector.injectBlock(this.TARGET_FILE, template, {
@@ -3,12 +3,13 @@ import { FileSystem } from '../utils/file-system.js';
3
3
  import { DataError } from '../types/errors.js';
4
4
  import { escapeRegex } from '../utils/string-utils.js';
5
5
  import { logger } from '../utils/logger.js';
6
+ import { CLAVIX_BLOCK_START, CLAVIX_BLOCK_END } from '../constants.js';
6
7
  /**
7
8
  * DocInjector - manages injection and updating of managed blocks in documentation files
8
9
  */
9
10
  export class DocInjector {
10
- static DEFAULT_START_MARKER = '<!-- CLAVIX:START -->';
11
- static DEFAULT_END_MARKER = '<!-- CLAVIX:END -->';
11
+ static DEFAULT_START_MARKER = CLAVIX_BLOCK_START;
12
+ static DEFAULT_END_MARKER = CLAVIX_BLOCK_END;
12
13
  /**
13
14
  * Inject or update managed block in a file
14
15
  */
@@ -194,6 +195,11 @@ Enter conversational mode for iterative prompt development. Discuss your require
194
195
  #### /clavix:summarize
195
196
  Analyze the current conversation and extract key requirements into a structured prompt and mini-PRD.
196
197
 
198
+ ### Refinement
199
+
200
+ #### /clavix:refine
201
+ Refine existing PRD or prompt through continued discussion. Detects available PRDs and saved prompts, then guides you through updating them with tracked changes.
202
+
197
203
  ### Agentic Utilities
198
204
 
199
205
  These utilities provide structured workflows for common tasks. Invoke them using the slash commands below:
@@ -207,10 +213,11 @@ These utilities provide structured workflows for common tasks. Invoke them using
207
213
 
208
214
  **Recommended Workflow:**
209
215
  1. Start with \`/clavix:prd\` or \`/clavix:start\` for complex features
210
- 2. Generate tasks with \`/clavix:plan\`
211
- 3. Implement with \`/clavix:implement\`
212
- 4. Verify with \`/clavix:verify\`
213
- 5. Archive when complete with \`/clavix:archive\`
216
+ 2. Refine requirements with \`/clavix:refine\` as needed
217
+ 3. Generate tasks with \`/clavix:plan\`
218
+ 4. Implement with \`/clavix:implement\`
219
+ 5. Verify with \`/clavix:verify\`
220
+ 6. Archive when complete with \`/clavix:archive\`
214
221
 
215
222
  **Pro tip**: Start complex features with \`/clavix:prd\` or \`/clavix:start\` to ensure clear requirements before implementation.`;
216
223
  }
@@ -60,6 +60,7 @@ For complete step-by-step workflows, see `.clavix/instructions/`:
60
60
  | "create a PRD", "product requirements" | PRD mode → Socratic questioning | `workflows/prd.md` |
61
61
  | "let's discuss", "not sure what I want" | Conversational mode → Start gathering | `workflows/start.md` |
62
62
  | "summarize our conversation" | Extract mode → Analyze thread | `workflows/summarize.md` |
63
+ | "refine", "update PRD", "change requirements", "modify prompt" | Refine mode → Update existing content | `workflows/refine.md` |
63
64
  | "verify", "check my implementation" | Verify mode → Implementation verification | `core/verification.md` |
64
65
 
65
66
  **When detected:** Reference the corresponding `.clavix/instructions/workflows/{workflow}.md` file.
@@ -87,6 +88,7 @@ All workflows are executed via slash commands that AI agents read and follow:
87
88
  | `/clavix:implement` | Execute tasks or prompts (auto-detects source) |
88
89
  | `/clavix:start` | Begin conversational session |
89
90
  | `/clavix:summarize` | Extract requirements from conversation |
91
+ | `/clavix:refine` | Refine existing PRD or saved prompt |
90
92
 
91
93
  ### Agentic Utilities (Project Management)
92
94
  These utilities provide structured workflows for project completion: