clavix 5.5.1 → 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/dist/cli/commands/init.js +8 -3
- package/dist/cli/commands/update.js +3 -6
- package/dist/constants.d.ts +0 -11
- package/dist/constants.js +0 -16
- package/dist/core/adapter-registry.d.ts +5 -0
- package/dist/core/adapter-registry.js +5 -0
- package/dist/core/adapters/agents-md-generator.js +2 -1
- package/dist/core/adapters/copilot-instructions-generator.js +2 -1
- package/dist/core/adapters/instructions-generator.js +3 -2
- package/dist/core/adapters/octo-md-generator.js +2 -1
- package/dist/core/adapters/warp-md-generator.js +2 -1
- package/dist/core/doc-injector.js +13 -6
- package/dist/templates/agents/agents.md +2 -0
- package/dist/templates/slash-commands/_canonical/refine.md +612 -0
- package/dist/utils/agent-error-messages.d.ts +25 -0
- package/dist/utils/agent-error-messages.js +68 -0
- package/dist/utils/integration-selector.d.ts +12 -0
- package/dist/utils/integration-selector.js +19 -2
- package/dist/utils/toml-templates.js +3 -2
- package/dist/utils/version.d.ts +0 -5
- package/dist/utils/version.js +0 -14
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
80
|
-
const
|
|
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;
|
|
@@ -553,7 +557,8 @@ To reconfigure integrations, run \`clavix init\` again.
|
|
|
553
557
|
}
|
|
554
558
|
}
|
|
555
559
|
extractClavixBlock(content) {
|
|
556
|
-
const
|
|
560
|
+
const regex = new RegExp(`${CLAVIX_BLOCK_START}([\\s\\S]*?)${CLAVIX_BLOCK_END}`);
|
|
561
|
+
const match = content.match(regex);
|
|
557
562
|
return match ? match[1].trim() : content;
|
|
558
563
|
}
|
|
559
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
|
-
|
|
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:
|
|
139
|
-
endMarker:
|
|
135
|
+
startMarker: CLAVIX_BLOCK_START,
|
|
136
|
+
endMarker: CLAVIX_BLOCK_END,
|
|
140
137
|
});
|
|
141
138
|
this.log(chalk.gray(' ✓ Updated CLAUDE.md'));
|
|
142
139
|
updated++;
|
package/dist/constants.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
11
|
-
static DEFAULT_END_MARKER =
|
|
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.
|
|
211
|
-
3.
|
|
212
|
-
4.
|
|
213
|
-
5.
|
|
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:
|
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Clavix: Refine"
|
|
3
|
+
description: Refine existing PRD or prompt through continued discussion
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Clavix: Refine Your Requirements
|
|
7
|
+
|
|
8
|
+
Need to update your PRD or improve a saved prompt? This command lets you refine existing work without starting over.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## What This Does
|
|
13
|
+
|
|
14
|
+
When you run `/clavix:refine`, I:
|
|
15
|
+
1. **Detect available targets** - Find PRDs and saved prompts in your project
|
|
16
|
+
2. **Ask what to refine** - PRD project or saved prompt?
|
|
17
|
+
3. **Load existing content** - Read and understand current state
|
|
18
|
+
4. **Enter refinement mode** - Discuss what you want to change
|
|
19
|
+
5. **Update the files** - Save refined version with change history
|
|
20
|
+
|
|
21
|
+
**I'm refining existing work, not creating new content from scratch.**
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## CLAVIX MODE: Refinement
|
|
26
|
+
|
|
27
|
+
**I'm in refinement mode. Updating existing requirements or prompts.**
|
|
28
|
+
|
|
29
|
+
**What I'll do:**
|
|
30
|
+
- Check for existing PRDs and prompts
|
|
31
|
+
- Ask you what you want to refine
|
|
32
|
+
- Load and display current content
|
|
33
|
+
- Discuss changes with you
|
|
34
|
+
- Update files with tracked changes
|
|
35
|
+
- Flag what changed vs. what stayed the same
|
|
36
|
+
|
|
37
|
+
**What I won't do:**
|
|
38
|
+
- Write implementation code
|
|
39
|
+
- Create new PRDs from scratch (use `/clavix:prd` for that)
|
|
40
|
+
- Create new prompts from scratch (use `/clavix:improve` for that)
|
|
41
|
+
- Make changes without user approval
|
|
42
|
+
|
|
43
|
+
**I'm improving what exists, not building from scratch.**
|
|
44
|
+
|
|
45
|
+
For complete mode documentation, see: `.clavix/instructions/core/clavix-mode.md`
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Self-Correction Protocol
|
|
50
|
+
|
|
51
|
+
**DETECT**: If you find yourself doing any of these 6 mistake types:
|
|
52
|
+
|
|
53
|
+
| Type | What It Looks Like |
|
|
54
|
+
|------|--------------------|
|
|
55
|
+
| 1. Implementation Code | Writing function/class definitions, creating components, generating API endpoints |
|
|
56
|
+
| 2. Skipping Mode Selection | Not asking user what to refine (PRD vs prompt) first |
|
|
57
|
+
| 3. Not Loading Existing Content | Making changes without reading current state first |
|
|
58
|
+
| 4. Losing Requirements | Removing existing requirements during refinement without user approval |
|
|
59
|
+
| 5. Not Tracking Changes | Failing to mark what was [ADDED], [MODIFIED], [REMOVED], [UNCHANGED] |
|
|
60
|
+
| 6. Capability Hallucination | Claiming features Clavix doesn't have, inventing workflows |
|
|
61
|
+
|
|
62
|
+
**STOP**: Immediately halt the incorrect action
|
|
63
|
+
|
|
64
|
+
**CORRECT**: Output:
|
|
65
|
+
"I apologize - I was [describe mistake]. Let me return to refinement mode."
|
|
66
|
+
|
|
67
|
+
**RESUME**: Return to the refinement workflow with proper mode selection and content loading.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## State Assertion (Required)
|
|
72
|
+
|
|
73
|
+
**Before starting refinement, output:**
|
|
74
|
+
```
|
|
75
|
+
**CLAVIX MODE: Refinement**
|
|
76
|
+
Mode: planning
|
|
77
|
+
Purpose: Refining existing PRD or prompt
|
|
78
|
+
Implementation: BLOCKED - I will refine requirements, not implement them
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Instructions
|
|
84
|
+
|
|
85
|
+
### Step 0: Detect Available Refinement Targets
|
|
86
|
+
|
|
87
|
+
**CHECKPOINT:** Starting detection of refinement targets
|
|
88
|
+
|
|
89
|
+
Use file system tools to check for:
|
|
90
|
+
|
|
91
|
+
**PRD Projects:**
|
|
92
|
+
```bash
|
|
93
|
+
# Look for PRD files
|
|
94
|
+
ls .clavix/outputs/*/mini-prd.md 2>/dev/null
|
|
95
|
+
ls .clavix/outputs/*/quick-prd.md 2>/dev/null
|
|
96
|
+
ls .clavix/outputs/*/full-prd.md 2>/dev/null
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Saved Prompts:**
|
|
100
|
+
```bash
|
|
101
|
+
# Look for saved prompts
|
|
102
|
+
ls .clavix/outputs/prompts/*.md 2>/dev/null
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Record what was found:**
|
|
106
|
+
- PRD projects found: [list project names]
|
|
107
|
+
- Saved prompts found: [list prompt files]
|
|
108
|
+
|
|
109
|
+
**CHECKPOINT:** Detection complete - found [N] PRD projects, [M] saved prompts
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### Step 1: Ask User What to Refine
|
|
114
|
+
|
|
115
|
+
Based on what was found, ask the user:
|
|
116
|
+
|
|
117
|
+
**If both PRDs and prompts exist:**
|
|
118
|
+
```markdown
|
|
119
|
+
## What Would You Like to Refine?
|
|
120
|
+
|
|
121
|
+
I found refinement targets in your project:
|
|
122
|
+
|
|
123
|
+
**PRD Projects:**
|
|
124
|
+
- [project-name] (mini-prd.md, tasks.md)
|
|
125
|
+
- [other-project] (quick-prd.md)
|
|
126
|
+
|
|
127
|
+
**Saved Prompts:**
|
|
128
|
+
- [timestamp]-[name].md
|
|
129
|
+
- [other-prompt].md
|
|
130
|
+
|
|
131
|
+
**What would you like to refine?**
|
|
132
|
+
1. **A PRD project** - Modify requirements, features, constraints
|
|
133
|
+
2. **A saved prompt** - Improve and optimize a prompt
|
|
134
|
+
|
|
135
|
+
Please let me know which type, and I'll show you the specific options.
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**If only PRDs exist:**
|
|
139
|
+
```markdown
|
|
140
|
+
## What Would You Like to Refine?
|
|
141
|
+
|
|
142
|
+
I found [N] PRD project(s) in your outputs:
|
|
143
|
+
- [project-name] (has mini-prd.md, tasks.md)
|
|
144
|
+
|
|
145
|
+
Would you like to refine this PRD? I can help you:
|
|
146
|
+
- Add new features
|
|
147
|
+
- Modify existing requirements
|
|
148
|
+
- Adjust constraints or scope
|
|
149
|
+
- Update technical requirements
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**If only prompts exist:**
|
|
153
|
+
```markdown
|
|
154
|
+
## What Would You Like to Refine?
|
|
155
|
+
|
|
156
|
+
I found [N] saved prompt(s):
|
|
157
|
+
- [prompt-file-1].md
|
|
158
|
+
- [prompt-file-2].md
|
|
159
|
+
|
|
160
|
+
Would you like to refine one of these prompts? I can help you:
|
|
161
|
+
- Make it more specific
|
|
162
|
+
- Add constraints or context
|
|
163
|
+
- Clarify the objective
|
|
164
|
+
- Improve overall quality
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**If nothing found:**
|
|
168
|
+
```markdown
|
|
169
|
+
## No Refinement Targets Found
|
|
170
|
+
|
|
171
|
+
I couldn't find any existing PRDs or saved prompts to refine.
|
|
172
|
+
|
|
173
|
+
**To create new content:**
|
|
174
|
+
- `/clavix:prd` - Create a new PRD through guided questions
|
|
175
|
+
- `/clavix:improve [prompt]` - Optimize and save a prompt
|
|
176
|
+
- `/clavix:start` → `/clavix:summarize` - Extract requirements from conversation
|
|
177
|
+
|
|
178
|
+
Once you've created content with these commands, you can use `/clavix:refine` to update it.
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**CHECKPOINT:** User selected refinement type: [PRD/Prompt]
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## PRD Refinement Workflow
|
|
186
|
+
|
|
187
|
+
*Only follow this section if user selected PRD refinement*
|
|
188
|
+
|
|
189
|
+
### Step 2a: Load Existing PRD
|
|
190
|
+
|
|
191
|
+
Read the PRD file(s) for the selected project:
|
|
192
|
+
```bash
|
|
193
|
+
# Read the mini-prd or quick-prd
|
|
194
|
+
cat .clavix/outputs/[project-name]/mini-prd.md
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**CHECKPOINT:** Loaded PRD for project: [project-name]
|
|
198
|
+
|
|
199
|
+
### Step 3a: Display Current Requirements Summary
|
|
200
|
+
|
|
201
|
+
Present the current state to the user:
|
|
202
|
+
|
|
203
|
+
```markdown
|
|
204
|
+
## Current Requirements for [Project Name]
|
|
205
|
+
|
|
206
|
+
### Objective
|
|
207
|
+
[Current objective from PRD]
|
|
208
|
+
|
|
209
|
+
### Core Features
|
|
210
|
+
- [Feature 1]
|
|
211
|
+
- [Feature 2]
|
|
212
|
+
- [Feature 3]
|
|
213
|
+
|
|
214
|
+
### Technical Constraints
|
|
215
|
+
- [Constraint 1]
|
|
216
|
+
- [Constraint 2]
|
|
217
|
+
|
|
218
|
+
### Scope
|
|
219
|
+
**In Scope:** [What's included]
|
|
220
|
+
**Out of Scope:** [What's excluded]
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
**What would you like to refine?**
|
|
225
|
+
1. Add new features
|
|
226
|
+
2. Modify existing features
|
|
227
|
+
3. Change technical constraints
|
|
228
|
+
4. Adjust scope (add/remove items)
|
|
229
|
+
5. Update success criteria
|
|
230
|
+
6. Something else
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Step 4a: Refine Through Discussion
|
|
234
|
+
|
|
235
|
+
Enter conversational mode to understand what changes are needed:
|
|
236
|
+
|
|
237
|
+
- Listen to what the user wants to change
|
|
238
|
+
- Ask clarifying questions
|
|
239
|
+
- Propose specific changes
|
|
240
|
+
- Get user approval before modifying
|
|
241
|
+
|
|
242
|
+
**Track changes with markers:**
|
|
243
|
+
- `[ADDED]` - New requirement or feature
|
|
244
|
+
- `[MODIFIED]` - Changed from original
|
|
245
|
+
- `[REMOVED]` - Explicitly removed (with user approval)
|
|
246
|
+
- `[UNCHANGED]` - Kept as-is
|
|
247
|
+
|
|
248
|
+
### Step 5a: Generate Updated PRD
|
|
249
|
+
|
|
250
|
+
After discussion, update the PRD file:
|
|
251
|
+
|
|
252
|
+
**Use the Write tool to update** `.clavix/outputs/[project-name]/mini-prd.md`
|
|
253
|
+
|
|
254
|
+
Add a "Refinement History" section at the bottom:
|
|
255
|
+
|
|
256
|
+
```markdown
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Refinement History
|
|
260
|
+
|
|
261
|
+
### [Date] - Refinement Session
|
|
262
|
+
|
|
263
|
+
**Changes Made:**
|
|
264
|
+
- [ADDED] [Description of what was added]
|
|
265
|
+
- [MODIFIED] [What changed and how]
|
|
266
|
+
- [REMOVED] [What was removed and why]
|
|
267
|
+
|
|
268
|
+
**Reason:** [Brief explanation of why changes were made]
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**CHECKPOINT:** Updated PRD with [N] changes
|
|
272
|
+
|
|
273
|
+
### Step 6a: Notify About Tasks
|
|
274
|
+
|
|
275
|
+
If tasks.md exists for this project:
|
|
276
|
+
|
|
277
|
+
```markdown
|
|
278
|
+
## Note: Tasks May Need Regeneration
|
|
279
|
+
|
|
280
|
+
This project has a `tasks.md` file that was generated from the previous PRD version.
|
|
281
|
+
|
|
282
|
+
After refining the PRD, you may want to regenerate tasks:
|
|
283
|
+
- Run `/clavix:plan` to create an updated task breakdown
|
|
284
|
+
- Or manually update tasks.md to reflect the changes
|
|
285
|
+
|
|
286
|
+
**Changes that likely affect tasks:**
|
|
287
|
+
- [List significant changes that impact implementation]
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Prompt Refinement Workflow
|
|
293
|
+
|
|
294
|
+
*Only follow this section if user selected Prompt refinement*
|
|
295
|
+
|
|
296
|
+
### Step 2b: List Available Prompts
|
|
297
|
+
|
|
298
|
+
If multiple prompts exist:
|
|
299
|
+
```markdown
|
|
300
|
+
## Available Prompts
|
|
301
|
+
|
|
302
|
+
| # | File | Created | Size |
|
|
303
|
+
|---|------|---------|------|
|
|
304
|
+
| 1 | [filename].md | [date] | [lines] |
|
|
305
|
+
| 2 | [filename].md | [date] | [lines] |
|
|
306
|
+
|
|
307
|
+
**Which prompt would you like to refine?**
|
|
308
|
+
Enter the number, or type `latest` to refine the most recent.
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Step 3b: Load Selected Prompt
|
|
312
|
+
|
|
313
|
+
Read the prompt file:
|
|
314
|
+
```bash
|
|
315
|
+
cat .clavix/outputs/prompts/[selected-file].md
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
**CHECKPOINT:** Loaded prompt: [filename]
|
|
319
|
+
|
|
320
|
+
### Step 4b: Display Current Prompt and Quality
|
|
321
|
+
|
|
322
|
+
Present the current prompt to the user:
|
|
323
|
+
|
|
324
|
+
```markdown
|
|
325
|
+
## Current Prompt: [filename]
|
|
326
|
+
|
|
327
|
+
[Display the prompt content]
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
**Quality Assessment:**
|
|
332
|
+
- Clarity: [Score]
|
|
333
|
+
- Specificity: [Score]
|
|
334
|
+
- Completeness: [Score]
|
|
335
|
+
- Actionability: [Score]
|
|
336
|
+
|
|
337
|
+
**What would you like to change?**
|
|
338
|
+
1. Clarify the objective
|
|
339
|
+
2. Add more context or constraints
|
|
340
|
+
3. Make it more specific
|
|
341
|
+
4. Change the approach
|
|
342
|
+
5. Other (describe what you want)
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Step 5b: Refine Through Discussion
|
|
346
|
+
|
|
347
|
+
Enter conversational mode:
|
|
348
|
+
- Understand what the user wants to improve
|
|
349
|
+
- Suggest specific enhancements
|
|
350
|
+
- Re-assess quality as changes are made
|
|
351
|
+
|
|
352
|
+
### Step 6b: Run Quality Assessment
|
|
353
|
+
|
|
354
|
+
After refinement, re-assess using the same 6 dimensions as `/clavix:improve`:
|
|
355
|
+
- Clarity
|
|
356
|
+
- Specificity
|
|
357
|
+
- Context
|
|
358
|
+
- Constraints
|
|
359
|
+
- Actionability
|
|
360
|
+
- Structure
|
|
361
|
+
|
|
362
|
+
### Step 7b: Save Refined Prompt
|
|
363
|
+
|
|
364
|
+
**Use the Write tool** to update the prompt file:
|
|
365
|
+
|
|
366
|
+
Add refinement metadata to frontmatter (if present) or create new:
|
|
367
|
+
|
|
368
|
+
```markdown
|
|
369
|
+
---
|
|
370
|
+
refined: [date]
|
|
371
|
+
original_created: [original date]
|
|
372
|
+
refinements: 1
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
[Refined prompt content]
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Refinement Summary
|
|
380
|
+
|
|
381
|
+
**Before:** [Brief description of original]
|
|
382
|
+
**After:** [Brief description of refined version]
|
|
383
|
+
|
|
384
|
+
**Quality Score:**
|
|
385
|
+
- Before: [X]/100
|
|
386
|
+
- After: [Y]/100
|
|
387
|
+
|
|
388
|
+
**Improvements Applied:**
|
|
389
|
+
- [What was changed and why]
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
**CHECKPOINT:** Saved refined prompt to [filename]
|
|
393
|
+
|
|
394
|
+
### Step 8b: Show Before/After Comparison
|
|
395
|
+
|
|
396
|
+
```markdown
|
|
397
|
+
## Prompt Refinement Complete
|
|
398
|
+
|
|
399
|
+
**Quality Score Improvement:** [X] → [Y] (+[diff])
|
|
400
|
+
|
|
401
|
+
**Key Changes:**
|
|
402
|
+
| Aspect | Before | After |
|
|
403
|
+
|--------|--------|-------|
|
|
404
|
+
| Clarity | [score] | [score] |
|
|
405
|
+
| Specificity | [score] | [score] |
|
|
406
|
+
| ... | ... | ... |
|
|
407
|
+
|
|
408
|
+
**Next Steps:**
|
|
409
|
+
- Run `/clavix:implement --latest` to execute this prompt
|
|
410
|
+
- Or continue refining with another `/clavix:refine` session
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
## Integration Points
|
|
416
|
+
|
|
417
|
+
**After refining a PRD:**
|
|
418
|
+
- Run `/clavix:plan` to regenerate tasks based on updated requirements
|
|
419
|
+
- Note that existing tasks.md may be outdated
|
|
420
|
+
|
|
421
|
+
**After refining a prompt:**
|
|
422
|
+
- Run `/clavix:implement --latest` to execute the refined prompt
|
|
423
|
+
|
|
424
|
+
**Iterative refinement:**
|
|
425
|
+
- You can run `/clavix:refine` multiple times
|
|
426
|
+
- Each session adds to the refinement history
|
|
427
|
+
- Changes are tracked cumulatively
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
## Examples
|
|
432
|
+
|
|
433
|
+
### Example: Adding a Feature to PRD
|
|
434
|
+
|
|
435
|
+
**User:** "/clavix:refine"
|
|
436
|
+
|
|
437
|
+
**Agent:** "I found 1 PRD project: 'user-dashboard'. Would you like to refine it?"
|
|
438
|
+
|
|
439
|
+
**User:** "Yes, I want to add dark mode support."
|
|
440
|
+
|
|
441
|
+
**Agent:**
|
|
442
|
+
```markdown
|
|
443
|
+
## Adding to [user-dashboard] PRD
|
|
444
|
+
|
|
445
|
+
**Current features:**
|
|
446
|
+
- User profile display
|
|
447
|
+
- Activity feed
|
|
448
|
+
- Notifications panel
|
|
449
|
+
|
|
450
|
+
**Proposed addition:**
|
|
451
|
+
- [ADDED] Dark mode toggle with system preference detection
|
|
452
|
+
- [ADDED] Theme persistence across sessions
|
|
453
|
+
- [MODIFIED] All UI components must support both themes
|
|
454
|
+
|
|
455
|
+
Does this capture what you want to add?
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Example: Changing PRD Constraints
|
|
459
|
+
|
|
460
|
+
**User:** "Actually, we need to support mobile now too."
|
|
461
|
+
|
|
462
|
+
**Agent:**
|
|
463
|
+
```markdown
|
|
464
|
+
## Modifying Technical Constraints
|
|
465
|
+
|
|
466
|
+
**Previous constraints:**
|
|
467
|
+
- Desktop-only (1024px minimum)
|
|
468
|
+
- Chrome/Firefox/Safari support
|
|
469
|
+
|
|
470
|
+
**Updated constraints:**
|
|
471
|
+
- [MODIFIED] Responsive design: 320px to 1920px
|
|
472
|
+
- [ADDED] Mobile-first approach
|
|
473
|
+
- [ADDED] Touch interaction support
|
|
474
|
+
- [UNCHANGED] Chrome/Firefox/Safari support
|
|
475
|
+
- [ADDED] iOS Safari and Chrome mobile support
|
|
476
|
+
|
|
477
|
+
This changes scope significantly. Should I also update the success criteria?
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### Example: Making a Prompt More Specific
|
|
481
|
+
|
|
482
|
+
**User:** "/clavix:refine"
|
|
483
|
+
|
|
484
|
+
**Agent:** "I found 2 saved prompts. Which would you like to refine?"
|
|
485
|
+
|
|
486
|
+
**User:** "The API integration one."
|
|
487
|
+
|
|
488
|
+
**Agent:**
|
|
489
|
+
```markdown
|
|
490
|
+
## Current Prompt Assessment
|
|
491
|
+
|
|
492
|
+
"Build an API integration for our system."
|
|
493
|
+
|
|
494
|
+
**Quality Scores:**
|
|
495
|
+
- Clarity: 40/100 (too vague)
|
|
496
|
+
- Specificity: 30/100 (no details)
|
|
497
|
+
- Completeness: 20/100 (missing critical info)
|
|
498
|
+
|
|
499
|
+
**What would you like to specify?**
|
|
500
|
+
1. Which API to integrate?
|
|
501
|
+
2. What operations are needed?
|
|
502
|
+
3. Authentication requirements?
|
|
503
|
+
4. Error handling expectations?
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
**User:** "It's the Stripe API for payments."
|
|
507
|
+
|
|
508
|
+
**Agent:**
|
|
509
|
+
```markdown
|
|
510
|
+
## Refined Prompt
|
|
511
|
+
|
|
512
|
+
"Integrate Stripe API for payment processing:
|
|
513
|
+
- Support one-time payments and subscriptions
|
|
514
|
+
- Handle webhook events for payment status updates
|
|
515
|
+
- Store payment methods securely using Stripe tokens
|
|
516
|
+
- Implement retry logic for failed charges
|
|
517
|
+
- Generate receipts and send confirmation emails
|
|
518
|
+
|
|
519
|
+
Technical: Use Stripe Node.js SDK, handle PCI compliance through Stripe Elements."
|
|
520
|
+
|
|
521
|
+
**Quality Scores (After):**
|
|
522
|
+
- Clarity: 85/100 (+45)
|
|
523
|
+
- Specificity: 90/100 (+60)
|
|
524
|
+
- Completeness: 80/100 (+60)
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Example: Reducing PRD Scope
|
|
528
|
+
|
|
529
|
+
**User:** "We need to cut scope. Remove the analytics feature."
|
|
530
|
+
|
|
531
|
+
**Agent:**
|
|
532
|
+
```markdown
|
|
533
|
+
## Scope Reduction
|
|
534
|
+
|
|
535
|
+
**Removing from scope:**
|
|
536
|
+
- [REMOVED] Analytics dashboard
|
|
537
|
+
- [REMOVED] Usage metrics tracking
|
|
538
|
+
- [REMOVED] Export to CSV feature
|
|
539
|
+
|
|
540
|
+
**Keeping:**
|
|
541
|
+
- [UNCHANGED] Core user management
|
|
542
|
+
- [UNCHANGED] Notification system
|
|
543
|
+
- [UNCHANGED] Settings page
|
|
544
|
+
|
|
545
|
+
**Impact:**
|
|
546
|
+
- Estimated effort reduction: ~30%
|
|
547
|
+
- Dependencies affected: None (analytics was standalone)
|
|
548
|
+
|
|
549
|
+
I'll update the PRD and add this to the refinement history. Confirm?
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
## Agent Transparency (v5.5)
|
|
555
|
+
|
|
556
|
+
### Agent Manual (Universal Protocols)
|
|
557
|
+
{{INCLUDE:agent-protocols/AGENT_MANUAL.md}}
|
|
558
|
+
|
|
559
|
+
### CLI Reference
|
|
560
|
+
{{INCLUDE:agent-protocols/cli-reference.md}}
|
|
561
|
+
|
|
562
|
+
### Workflow State Detection
|
|
563
|
+
{{INCLUDE:agent-protocols/state-awareness.md}}
|
|
564
|
+
|
|
565
|
+
---
|
|
566
|
+
|
|
567
|
+
## Workflow Navigation
|
|
568
|
+
|
|
569
|
+
**You are here:** Refine (Update existing PRD or prompt)
|
|
570
|
+
|
|
571
|
+
**Common workflows:**
|
|
572
|
+
- **PRD refinement**: `/clavix:refine` → update PRD → `/clavix:plan` → regenerate tasks
|
|
573
|
+
- **Prompt refinement**: `/clavix:refine` → improve prompt → `/clavix:implement --latest`
|
|
574
|
+
- **Iterative updates**: `/clavix:refine` → `/clavix:refine` → ... (multiple passes)
|
|
575
|
+
|
|
576
|
+
**Related commands:**
|
|
577
|
+
- `/clavix:prd` - Create new PRD from scratch (not refinement)
|
|
578
|
+
- `/clavix:improve` - Create new optimized prompt (not refinement)
|
|
579
|
+
- `/clavix:plan` - Generate tasks from PRD
|
|
580
|
+
- `/clavix:implement` - Execute tasks or prompts
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
## Troubleshooting
|
|
585
|
+
|
|
586
|
+
### Issue: No refinement targets found
|
|
587
|
+
**Cause**: No PRDs or prompts have been created yet
|
|
588
|
+
**Solution**:
|
|
589
|
+
- Use `/clavix:prd` to create a PRD
|
|
590
|
+
- Use `/clavix:improve [prompt]` to create and save a prompt
|
|
591
|
+
- Use `/clavix:start` → `/clavix:summarize` to extract from conversation
|
|
592
|
+
|
|
593
|
+
### Issue: Can't find specific project
|
|
594
|
+
**Cause**: Project name doesn't match or files moved
|
|
595
|
+
**Solution**:
|
|
596
|
+
- Check `.clavix/outputs/` directory structure
|
|
597
|
+
- Ensure mini-prd.md or quick-prd.md exists in project folder
|
|
598
|
+
- Project names are case-sensitive
|
|
599
|
+
|
|
600
|
+
### Issue: Changes lost after refinement
|
|
601
|
+
**Cause**: Overwrote without tracking changes
|
|
602
|
+
**Solution**:
|
|
603
|
+
- Always use change markers: [ADDED], [MODIFIED], [REMOVED], [UNCHANGED]
|
|
604
|
+
- Include Refinement History section
|
|
605
|
+
- Review changes with user before saving
|
|
606
|
+
|
|
607
|
+
### Issue: tasks.md out of sync with refined PRD
|
|
608
|
+
**Cause**: Normal - tasks were generated from previous PRD version
|
|
609
|
+
**Solution**:
|
|
610
|
+
- Run `/clavix:plan` to regenerate tasks
|
|
611
|
+
- Or manually update tasks.md
|
|
612
|
+
- Previous progress markers may need adjustment
|
|
@@ -82,5 +82,30 @@ export declare class AgentErrorMessages {
|
|
|
82
82
|
* Used by: implement workflow when marking already-done task
|
|
83
83
|
*/
|
|
84
84
|
static taskAlreadyCompleted(taskId: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Error: Template not found
|
|
87
|
+
* Used by: template-loader.ts, commands generating slash commands
|
|
88
|
+
*/
|
|
89
|
+
static templateNotFound(templateName: string, searchPath?: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* Error: Adapter/integration not found
|
|
92
|
+
* Used by: agent-manager.ts, init.ts
|
|
93
|
+
*/
|
|
94
|
+
static adapterNotFound(adapterName: string, availableAdapters?: string[]): string;
|
|
95
|
+
/**
|
|
96
|
+
* Error: Configuration loading failed
|
|
97
|
+
* Used by: init.ts, update.ts when .clavix/config.json is invalid
|
|
98
|
+
*/
|
|
99
|
+
static configLoadFailed(configPath: string, reason?: string): string;
|
|
100
|
+
/**
|
|
101
|
+
* Error: Update command failed
|
|
102
|
+
* Used by: update.ts when template regeneration fails
|
|
103
|
+
*/
|
|
104
|
+
static updateFailed(reason: string): string;
|
|
105
|
+
/**
|
|
106
|
+
* Error: Diagnostic check failed
|
|
107
|
+
* Used by: diagnose.ts when health check identifies issues
|
|
108
|
+
*/
|
|
109
|
+
static diagnosticFailed(issues: string[]): string;
|
|
85
110
|
}
|
|
86
111
|
//# sourceMappingURL=agent-error-messages.d.ts.map
|
|
@@ -191,5 +191,73 @@ export class AgentErrorMessages {
|
|
|
191
191
|
' 3. Check if this was intended\n\n' +
|
|
192
192
|
'No action needed unless forced.');
|
|
193
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Error: Template not found
|
|
196
|
+
* Used by: template-loader.ts, commands generating slash commands
|
|
197
|
+
*/
|
|
198
|
+
static templateNotFound(templateName, searchPath) {
|
|
199
|
+
const pathInfo = searchPath ? `\nSearch path: ${searchPath}` : '';
|
|
200
|
+
return (`Template not found: ${templateName}${pathInfo}\n\n` +
|
|
201
|
+
'Agent recovery options:\n' +
|
|
202
|
+
" 1. Run 'clavix update' to regenerate templates\n" +
|
|
203
|
+
' 2. Check if Clavix is installed correctly\n' +
|
|
204
|
+
' 3. Verify template name is spelled correctly\n\n' +
|
|
205
|
+
'After recovery, retry the command.');
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Error: Adapter/integration not found
|
|
209
|
+
* Used by: agent-manager.ts, init.ts
|
|
210
|
+
*/
|
|
211
|
+
static adapterNotFound(adapterName, availableAdapters) {
|
|
212
|
+
const adapterList = availableAdapters
|
|
213
|
+
? '\n\nAvailable adapters:\n' + availableAdapters.map((a) => ` • ${a}`).join('\n')
|
|
214
|
+
: '';
|
|
215
|
+
return (`Adapter not found: ${adapterName}${adapterList}\n\n` +
|
|
216
|
+
'Agent recovery options:\n' +
|
|
217
|
+
' 1. Check adapter name is spelled correctly\n' +
|
|
218
|
+
" 2. Run 'clavix diagnose' to see available integrations\n" +
|
|
219
|
+
' 3. Adapter may have been removed or renamed\n\n' +
|
|
220
|
+
'Use a valid adapter name and retry.');
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Error: Configuration loading failed
|
|
224
|
+
* Used by: init.ts, update.ts when .clavix/config.json is invalid
|
|
225
|
+
*/
|
|
226
|
+
static configLoadFailed(configPath, reason) {
|
|
227
|
+
const reasonInfo = reason ? `\nReason: ${reason}` : '';
|
|
228
|
+
return (`Failed to load configuration: ${configPath}${reasonInfo}\n\n` +
|
|
229
|
+
'Agent recovery options:\n' +
|
|
230
|
+
" 1. Run 'clavix init' to regenerate configuration\n" +
|
|
231
|
+
' 2. Check .clavix/config.json syntax is valid JSON\n' +
|
|
232
|
+
' 3. Remove .clavix/ and reinitialize\n\n' +
|
|
233
|
+
'After fixing configuration, retry the command.');
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Error: Update command failed
|
|
237
|
+
* Used by: update.ts when template regeneration fails
|
|
238
|
+
*/
|
|
239
|
+
static updateFailed(reason) {
|
|
240
|
+
return (`Update failed: ${reason}\n\n` +
|
|
241
|
+
'Agent recovery options:\n' +
|
|
242
|
+
' 1. Check Clavix is installed correctly: clavix --version\n' +
|
|
243
|
+
' 2. Verify write permissions in project directory\n' +
|
|
244
|
+
" 3. Try removing .clavix/ and running 'clavix init'\n\n" +
|
|
245
|
+
'Fix the underlying issue and retry.');
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Error: Diagnostic check failed
|
|
249
|
+
* Used by: diagnose.ts when health check identifies issues
|
|
250
|
+
*/
|
|
251
|
+
static diagnosticFailed(issues) {
|
|
252
|
+
const issueList = issues.map((issue) => ` • ${issue}`).join('\n');
|
|
253
|
+
return ('Diagnostic check identified issues:\n\n' +
|
|
254
|
+
issueList +
|
|
255
|
+
'\n\n' +
|
|
256
|
+
'Agent recovery options:\n' +
|
|
257
|
+
" 1. Run 'clavix update' to fix template issues\n" +
|
|
258
|
+
" 2. Run 'clavix init' to reinitialize configuration\n" +
|
|
259
|
+
' 3. Check file permissions in project directory\n\n' +
|
|
260
|
+
'Address issues above and rerun diagnose.');
|
|
261
|
+
}
|
|
194
262
|
}
|
|
195
263
|
//# sourceMappingURL=agent-error-messages.js.map
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { AgentManager } from '../core/agent-manager.js';
|
|
2
|
+
/**
|
|
3
|
+
* AGENTS.md is always enabled by default.
|
|
4
|
+
* It provides universal agent guidance that all AI tools can read.
|
|
5
|
+
*/
|
|
6
|
+
export declare const MANDATORY_INTEGRATION = "agents-md";
|
|
2
7
|
/**
|
|
3
8
|
* Interactive integration selection utility
|
|
4
9
|
* Displays multi-select checkbox for all available integrations
|
|
5
10
|
* Used by both init and config commands
|
|
11
|
+
*
|
|
12
|
+
* Note: AGENTS.md is always enabled and not shown in selection
|
|
6
13
|
*/
|
|
7
14
|
export declare function selectIntegrations(agentManager: AgentManager, preSelected?: string[]): Promise<string[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Ensures AGENTS.md is always included in the final integration list.
|
|
17
|
+
* Call this after selectIntegrations() to enforce mandatory integrations.
|
|
18
|
+
*/
|
|
19
|
+
export declare function ensureMandatoryIntegrations(integrations: string[]): string[];
|
|
8
20
|
//# sourceMappingURL=integration-selector.d.ts.map
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
|
+
/**
|
|
3
|
+
* AGENTS.md is always enabled by default.
|
|
4
|
+
* It provides universal agent guidance that all AI tools can read.
|
|
5
|
+
*/
|
|
6
|
+
export const MANDATORY_INTEGRATION = 'agents-md';
|
|
2
7
|
/**
|
|
3
8
|
* Interactive integration selection utility
|
|
4
9
|
* Displays multi-select checkbox for all available integrations
|
|
5
10
|
* Used by both init and config commands
|
|
11
|
+
*
|
|
12
|
+
* Note: AGENTS.md is always enabled and not shown in selection
|
|
6
13
|
*/
|
|
7
14
|
export async function selectIntegrations(agentManager, preSelected = []) {
|
|
8
15
|
const { selectedIntegrations } = await inquirer.prompt([
|
|
@@ -31,8 +38,8 @@ export async function selectIntegrations(agentManager, preSelected = []) {
|
|
|
31
38
|
{ name: 'Roocode (.roo/clavix/)', value: 'roocode' },
|
|
32
39
|
{ name: 'Windsurf (.windsurf/rules/)', value: 'windsurf' },
|
|
33
40
|
new inquirer.Separator(),
|
|
34
|
-
new inquirer.Separator('=== Universal Adapters ==='),
|
|
35
|
-
|
|
41
|
+
new inquirer.Separator('=== Optional Universal Adapters ==='),
|
|
42
|
+
// Note: AGENTS.md is always enabled (not shown here)
|
|
36
43
|
{ name: 'GitHub Copilot (.github/copilot-instructions.md)', value: 'copilot-instructions' },
|
|
37
44
|
{ name: 'OCTO.md (Universal)', value: 'octo-md' },
|
|
38
45
|
{ name: 'WARP.md (Universal)', value: 'warp-md' },
|
|
@@ -57,4 +64,14 @@ export async function selectIntegrations(agentManager, preSelected = []) {
|
|
|
57
64
|
]);
|
|
58
65
|
return selectedIntegrations;
|
|
59
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Ensures AGENTS.md is always included in the final integration list.
|
|
69
|
+
* Call this after selectIntegrations() to enforce mandatory integrations.
|
|
70
|
+
*/
|
|
71
|
+
export function ensureMandatoryIntegrations(integrations) {
|
|
72
|
+
if (!integrations.includes(MANDATORY_INTEGRATION)) {
|
|
73
|
+
return [MANDATORY_INTEGRATION, ...integrations];
|
|
74
|
+
}
|
|
75
|
+
return integrations;
|
|
76
|
+
}
|
|
60
77
|
//# sourceMappingURL=integration-selector.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DataError } from '../types/errors.js';
|
|
1
2
|
/**
|
|
2
3
|
* Parse TOML-based slash command templates (Gemini/Qwen) and extract metadata.
|
|
3
4
|
* Ensures the resulting prompt body does not include duplicated frontmatter.
|
|
@@ -10,13 +11,13 @@ export function parseTomlSlashCommand(content, templateName, integrationName) {
|
|
|
10
11
|
const descriptionMatch = normalized.match(/^\s*description\s*=\s*(['"])(.*?)\1\s*$/m);
|
|
11
12
|
const promptHeaderMatch = normalized.match(/^\s*prompt\s*=\s*"""/m);
|
|
12
13
|
if (!promptHeaderMatch || promptHeaderMatch.index === undefined) {
|
|
13
|
-
throw new
|
|
14
|
+
throw new DataError(`Template ${templateName}.toml for ${integrationName} is missing a prompt = """ ... """ block.`, 'Check the template file format. TOML templates require prompt = """...""" syntax.');
|
|
14
15
|
}
|
|
15
16
|
const bodyStart = promptHeaderMatch.index + promptHeaderMatch[0].length;
|
|
16
17
|
const bodyRemainder = normalized.slice(bodyStart);
|
|
17
18
|
const closingIndex = bodyRemainder.indexOf('"""');
|
|
18
19
|
if (closingIndex === -1) {
|
|
19
|
-
throw new
|
|
20
|
+
throw new DataError(`Template ${templateName}.toml for ${integrationName} does not terminate its prompt = """ ... """ block.`, 'Add closing """ to the prompt block.');
|
|
20
21
|
}
|
|
21
22
|
let promptBody = bodyRemainder.slice(0, closingIndex);
|
|
22
23
|
const promptLines = promptBody.split('\n');
|
package/dist/utils/version.d.ts
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Version utility for Clavix
|
|
3
3
|
* Centralizes version reading from package.json
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
* Get the current Clavix version from package.json
|
|
7
|
-
* Returns '0.0.0' if package.json cannot be read
|
|
8
|
-
*/
|
|
9
|
-
export declare function getVersion(): Promise<string>;
|
|
10
5
|
/**
|
|
11
6
|
* Get version synchronously (for use in type definitions)
|
|
12
7
|
* Falls back to hardcoded version if file cannot be read
|
package/dist/utils/version.js
CHANGED
|
@@ -7,20 +7,6 @@ import path from 'path';
|
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
9
|
const __dirname = path.dirname(__filename);
|
|
10
|
-
/**
|
|
11
|
-
* Get the current Clavix version from package.json
|
|
12
|
-
* Returns '0.0.0' if package.json cannot be read
|
|
13
|
-
*/
|
|
14
|
-
export async function getVersion() {
|
|
15
|
-
try {
|
|
16
|
-
const packageJsonPath = path.join(__dirname, '../../package.json');
|
|
17
|
-
const packageJson = await fs.readJson(packageJsonPath);
|
|
18
|
-
return packageJson.version || '0.0.0';
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
return '0.0.0';
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
10
|
/**
|
|
25
11
|
* Get version synchronously (for use in type definitions)
|
|
26
12
|
* Falls back to hardcoded version if file cannot be read
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavix",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.2",
|
|
4
4
|
"description": "Agentic-first prompt workflows. Markdown templates that teach AI agents how to optimize prompts, create PRDs, and manage implementation.\n\nSLASH COMMANDS (in your AI assistant):\n /clavix:improve Optimize prompts with auto-depth\n /clavix:prd Generate PRD through questions\n /clavix:plan Create task breakdown from PRD\n /clavix:implement Execute tasks with progress tracking\n /clavix:start Begin conversational session\n /clavix:summarize Extract requirements from conversation\n\nWorks with Claude Code, Cursor, Windsurf, and 19+ other AI coding tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|