clavix 5.1.0 → 5.2.1

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.
Files changed (44) hide show
  1. package/README.md +21 -3
  2. package/dist/cli/commands/config.d.ts +1 -3
  3. package/dist/cli/commands/config.js +4 -13
  4. package/dist/cli/commands/diagnose.d.ts +15 -0
  5. package/dist/cli/commands/diagnose.js +295 -0
  6. package/dist/core/adapters/agents-md-generator.d.ts +0 -10
  7. package/dist/core/adapters/agents-md-generator.js +7 -41
  8. package/dist/core/adapters/copilot-instructions-generator.d.ts +0 -10
  9. package/dist/core/adapters/copilot-instructions-generator.js +7 -41
  10. package/dist/core/adapters/gemini-adapter.d.ts +2 -18
  11. package/dist/core/adapters/gemini-adapter.js +7 -46
  12. package/dist/core/adapters/llxprt-adapter.d.ts +2 -18
  13. package/dist/core/adapters/llxprt-adapter.js +7 -46
  14. package/dist/core/adapters/octo-md-generator.d.ts +0 -10
  15. package/dist/core/adapters/octo-md-generator.js +7 -41
  16. package/dist/core/adapters/qwen-adapter.d.ts +2 -18
  17. package/dist/core/adapters/qwen-adapter.js +7 -46
  18. package/dist/core/adapters/toml-formatting-adapter.d.ts +50 -0
  19. package/dist/core/adapters/toml-formatting-adapter.js +74 -0
  20. package/dist/core/adapters/warp-md-generator.d.ts +3 -4
  21. package/dist/core/adapters/warp-md-generator.js +10 -30
  22. package/dist/core/doc-injector.js +4 -5
  23. package/dist/templates/agents/agents.md +8 -2
  24. package/dist/templates/agents/copilot-instructions.md +6 -2
  25. package/dist/templates/agents/octo.md +6 -2
  26. package/dist/templates/agents/warp.md +6 -2
  27. package/dist/templates/slash-commands/_canonical/archive.md +4 -7
  28. package/dist/templates/slash-commands/_canonical/implement.md +4 -7
  29. package/dist/templates/slash-commands/_canonical/improve.md +4 -7
  30. package/dist/templates/slash-commands/_canonical/plan.md +4 -7
  31. package/dist/templates/slash-commands/_canonical/prd.md +4 -7
  32. package/dist/templates/slash-commands/_canonical/start.md +3 -6
  33. package/dist/templates/slash-commands/_canonical/summarize.md +3 -6
  34. package/dist/templates/slash-commands/_canonical/verify.md +4 -7
  35. package/dist/templates/slash-commands/_components/agent-protocols/AGENT_MANUAL.md +284 -0
  36. package/dist/types/agent.d.ts +0 -4
  37. package/dist/types/config.d.ts +0 -80
  38. package/dist/types/config.js +1 -1
  39. package/dist/utils/agent-error-messages.d.ts +5 -5
  40. package/dist/utils/agent-error-messages.js +5 -5
  41. package/dist/utils/error-utils.d.ts +1 -7
  42. package/dist/utils/error-utils.js +12 -11
  43. package/dist/utils/toml-templates.js +4 -1
  44. package/package.json +3 -8
@@ -1,54 +1,15 @@
1
- import * as os from 'os';
2
- import * as path from 'path';
3
- import { BaseAdapter } from './base-adapter.js';
4
- import { FileSystem } from '../../utils/file-system.js';
1
+ import { TomlFormattingAdapter } from './toml-formatting-adapter.js';
5
2
  /**
6
3
  * Gemini CLI adapter
7
4
  * Commands stored as TOML files under .gemini/commands/clavix by default
8
5
  */
9
- export class GeminiAdapter extends BaseAdapter {
10
- options;
11
- name = 'gemini';
12
- displayName = 'Gemini CLI';
13
- fileExtension = '.toml';
14
- features = {
15
- supportsSubdirectories: true,
16
- supportsFrontmatter: false,
17
- argumentPlaceholder: '{{args}}',
18
- };
6
+ export class GeminiAdapter extends TomlFormattingAdapter {
19
7
  constructor(options = {}) {
20
- super();
21
- this.options = options;
22
- }
23
- get directory() {
24
- const useNamespace = this.options.useNamespace ?? true;
25
- return useNamespace ? path.join('.gemini', 'commands', 'clavix') : path.join('.gemini', 'commands');
26
- }
27
- async detectProject() {
28
- if (await FileSystem.exists('.gemini')) {
29
- return true;
30
- }
31
- const homePath = path.join(this.getHomeDir(), '.gemini');
32
- return await FileSystem.exists(homePath);
33
- }
34
- getCommandPath() {
35
- return this.directory;
36
- }
37
- getTargetFilename(name) {
38
- const commandPath = this.getCommandPath();
39
- const namespaced = commandPath.endsWith(path.join('commands', 'clavix'));
40
- const baseName = namespaced ? name : `clavix-${name}`;
41
- return `${baseName}${this.fileExtension}`;
42
- }
43
- formatCommand(template) {
44
- const description = template.description.trim().length > 0
45
- ? `description = ${JSON.stringify(template.description)}\n\n`
46
- : '';
47
- const content = template.content.replace(/\{\{ARGS\}\}/g, '{{args}}');
48
- return `${description}prompt = """\n${content}\n"""\n`;
49
- }
50
- getHomeDir() {
51
- return process.env.CLAVIX_HOME_OVERRIDE || os.homedir();
8
+ super({
9
+ name: 'gemini',
10
+ displayName: 'Gemini CLI',
11
+ rootDir: '.gemini',
12
+ }, options);
52
13
  }
53
14
  }
54
15
  //# sourceMappingURL=gemini-adapter.js.map
@@ -1,27 +1,11 @@
1
- import { BaseAdapter } from './base-adapter.js';
2
- import { CommandTemplate } from '../../types/agent.js';
1
+ import { TomlFormattingAdapter } from './toml-formatting-adapter.js';
3
2
  /**
4
3
  * LLXPRT adapter
5
4
  * Commands stored as TOML files under .llxprt/commands/clavix by default
6
5
  */
7
- export declare class LlxprtAdapter extends BaseAdapter {
8
- private readonly options;
9
- readonly name = "llxprt";
10
- readonly displayName = "LLXPRT";
11
- readonly fileExtension = ".toml";
12
- readonly features: {
13
- supportsSubdirectories: boolean;
14
- supportsFrontmatter: boolean;
15
- argumentPlaceholder: string;
16
- };
6
+ export declare class LlxprtAdapter extends TomlFormattingAdapter {
17
7
  constructor(options?: {
18
8
  useNamespace?: boolean;
19
9
  });
20
- get directory(): string;
21
- detectProject(): Promise<boolean>;
22
- getCommandPath(): string;
23
- getTargetFilename(name: string): string;
24
- protected formatCommand(template: CommandTemplate): string;
25
- private getHomeDir;
26
10
  }
27
11
  //# sourceMappingURL=llxprt-adapter.d.ts.map
@@ -1,54 +1,15 @@
1
- import * as os from 'os';
2
- import * as path from 'path';
3
- import { BaseAdapter } from './base-adapter.js';
4
- import { FileSystem } from '../../utils/file-system.js';
1
+ import { TomlFormattingAdapter } from './toml-formatting-adapter.js';
5
2
  /**
6
3
  * LLXPRT adapter
7
4
  * Commands stored as TOML files under .llxprt/commands/clavix by default
8
5
  */
9
- export class LlxprtAdapter extends BaseAdapter {
10
- options;
11
- name = 'llxprt';
12
- displayName = 'LLXPRT';
13
- fileExtension = '.toml';
14
- features = {
15
- supportsSubdirectories: true,
16
- supportsFrontmatter: false,
17
- argumentPlaceholder: '{{args}}',
18
- };
6
+ export class LlxprtAdapter extends TomlFormattingAdapter {
19
7
  constructor(options = {}) {
20
- super();
21
- this.options = options;
22
- }
23
- get directory() {
24
- const useNamespace = this.options.useNamespace ?? true;
25
- return useNamespace ? path.join('.llxprt', 'commands', 'clavix') : path.join('.llxprt', 'commands');
26
- }
27
- async detectProject() {
28
- if (await FileSystem.exists('.llxprt')) {
29
- return true;
30
- }
31
- const homePath = path.join(this.getHomeDir(), '.llxprt');
32
- return await FileSystem.exists(homePath);
33
- }
34
- getCommandPath() {
35
- return this.directory;
36
- }
37
- getTargetFilename(name) {
38
- const commandPath = this.getCommandPath();
39
- const namespaced = commandPath.endsWith(path.join('commands', 'clavix'));
40
- const baseName = namespaced ? name : `clavix-${name}`;
41
- return `${baseName}${this.fileExtension}`;
42
- }
43
- formatCommand(template) {
44
- const description = template.description.trim().length > 0
45
- ? `description = ${JSON.stringify(template.description)}\n\n`
46
- : '';
47
- const content = template.content.replace(/\{\{ARGS\}\}/g, '{{args}}');
48
- return `${description}prompt = """\n${content}\n"""\n`;
49
- }
50
- getHomeDir() {
51
- return process.env.CLAVIX_HOME_OVERRIDE || os.homedir();
8
+ super({
9
+ name: 'llxprt',
10
+ displayName: 'LLXPRT',
11
+ rootDir: '.llxprt',
12
+ }, options);
52
13
  }
53
14
  }
54
15
  //# sourceMappingURL=llxprt-adapter.js.map
@@ -4,20 +4,10 @@
4
4
  */
5
5
  export declare class OctoMdGenerator {
6
6
  static readonly TARGET_FILE = "OCTO.md";
7
- static readonly START_MARKER = "<!-- CLAVIX:START -->";
8
- static readonly END_MARKER = "<!-- CLAVIX:END -->";
9
7
  /**
10
8
  * Generate or update OCTO.md with Clavix workflows
11
9
  */
12
10
  static generate(): Promise<void>;
13
- /**
14
- * Inject or update managed block in OCTO.md
15
- */
16
- private static injectManagedBlock;
17
- /**
18
- * Escape special regex characters
19
- */
20
- private static escapeRegex;
21
11
  /**
22
12
  * Check if OCTO.md has Clavix block
23
13
  */
@@ -1,7 +1,8 @@
1
- import { FileSystem } from '../../utils/file-system.js';
2
1
  import * as path from 'path';
3
2
  import { fileURLToPath } from 'url';
4
3
  import { dirname } from 'path';
4
+ import { FileSystem } from '../../utils/file-system.js';
5
+ import { DocInjector } from '../doc-injector.js';
5
6
  const __filename = fileURLToPath(import.meta.url);
6
7
  const __dirname = dirname(__filename);
7
8
  /**
@@ -10,60 +11,25 @@ const __dirname = dirname(__filename);
10
11
  */
11
12
  export class OctoMdGenerator {
12
13
  static TARGET_FILE = 'OCTO.md';
13
- static START_MARKER = '<!-- CLAVIX:START -->';
14
- static END_MARKER = '<!-- CLAVIX:END -->';
15
14
  /**
16
15
  * Generate or update OCTO.md with Clavix workflows
17
16
  */
18
17
  static async generate() {
19
18
  const templatePath = path.join(__dirname, '../../templates/agents/octo.md');
20
- // Check if template exists
21
19
  if (!(await FileSystem.exists(templatePath))) {
22
20
  throw new Error(`OCTO.md template not found at ${templatePath}`);
23
21
  }
24
22
  const template = await FileSystem.readFile(templatePath);
25
- // Inject into OCTO.md using managed blocks
26
- await this.injectManagedBlock(this.TARGET_FILE, template);
27
- }
28
- /**
29
- * Inject or update managed block in OCTO.md
30
- */
31
- static async injectManagedBlock(filePath, content) {
32
- let fileContent = '';
33
- // Read existing file or start with empty content
34
- if (await FileSystem.exists(filePath)) {
35
- fileContent = await FileSystem.readFile(filePath);
36
- }
37
- const blockRegex = new RegExp(`${this.escapeRegex(this.START_MARKER)}[\\s\\S]*?${this.escapeRegex(this.END_MARKER)}`, 'g');
38
- const wrappedContent = `${this.START_MARKER}\n${content}\n${this.END_MARKER}`;
39
- if (blockRegex.test(fileContent)) {
40
- // Replace existing block
41
- fileContent = fileContent.replace(blockRegex, wrappedContent);
42
- }
43
- else {
44
- // Append new block
45
- if (fileContent && !fileContent.endsWith('\n\n')) {
46
- fileContent += '\n\n';
47
- }
48
- fileContent += wrappedContent + '\n';
49
- }
50
- await FileSystem.writeFileAtomic(filePath, fileContent);
51
- }
52
- /**
53
- * Escape special regex characters
54
- */
55
- static escapeRegex(str) {
56
- return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
23
+ await DocInjector.injectBlock(this.TARGET_FILE, template, {
24
+ createIfMissing: true,
25
+ validateMarkdown: false,
26
+ });
57
27
  }
58
28
  /**
59
29
  * Check if OCTO.md has Clavix block
60
30
  */
61
31
  static async hasClavixBlock() {
62
- if (!(await FileSystem.exists(this.TARGET_FILE))) {
63
- return false;
64
- }
65
- const content = await FileSystem.readFile(this.TARGET_FILE);
66
- return content.includes(this.START_MARKER);
32
+ return DocInjector.hasBlock(this.TARGET_FILE);
67
33
  }
68
34
  }
69
35
  //# sourceMappingURL=octo-md-generator.js.map
@@ -1,27 +1,11 @@
1
- import { BaseAdapter } from './base-adapter.js';
2
- import { CommandTemplate } from '../../types/agent.js';
1
+ import { TomlFormattingAdapter } from './toml-formatting-adapter.js';
3
2
  /**
4
3
  * Qwen Code CLI adapter
5
4
  * Commands stored as TOML files under .qwen/commands/clavix by default
6
5
  */
7
- export declare class QwenAdapter extends BaseAdapter {
8
- private readonly options;
9
- readonly name = "qwen";
10
- readonly displayName = "Qwen Code";
11
- readonly fileExtension = ".toml";
12
- readonly features: {
13
- supportsSubdirectories: boolean;
14
- supportsFrontmatter: boolean;
15
- argumentPlaceholder: string;
16
- };
6
+ export declare class QwenAdapter extends TomlFormattingAdapter {
17
7
  constructor(options?: {
18
8
  useNamespace?: boolean;
19
9
  });
20
- get directory(): string;
21
- detectProject(): Promise<boolean>;
22
- getCommandPath(): string;
23
- getTargetFilename(name: string): string;
24
- protected formatCommand(template: CommandTemplate): string;
25
- private getHomeDir;
26
10
  }
27
11
  //# sourceMappingURL=qwen-adapter.d.ts.map
@@ -1,54 +1,15 @@
1
- import * as os from 'os';
2
- import * as path from 'path';
3
- import { BaseAdapter } from './base-adapter.js';
4
- import { FileSystem } from '../../utils/file-system.js';
1
+ import { TomlFormattingAdapter } from './toml-formatting-adapter.js';
5
2
  /**
6
3
  * Qwen Code CLI adapter
7
4
  * Commands stored as TOML files under .qwen/commands/clavix by default
8
5
  */
9
- export class QwenAdapter extends BaseAdapter {
10
- options;
11
- name = 'qwen';
12
- displayName = 'Qwen Code';
13
- fileExtension = '.toml';
14
- features = {
15
- supportsSubdirectories: true,
16
- supportsFrontmatter: false,
17
- argumentPlaceholder: '{{args}}',
18
- };
6
+ export class QwenAdapter extends TomlFormattingAdapter {
19
7
  constructor(options = {}) {
20
- super();
21
- this.options = options;
22
- }
23
- get directory() {
24
- const useNamespace = this.options.useNamespace ?? true;
25
- return useNamespace ? path.join('.qwen', 'commands', 'clavix') : path.join('.qwen', 'commands');
26
- }
27
- async detectProject() {
28
- if (await FileSystem.exists('.qwen')) {
29
- return true;
30
- }
31
- const homePath = path.join(this.getHomeDir(), '.qwen');
32
- return await FileSystem.exists(homePath);
33
- }
34
- getCommandPath() {
35
- return this.directory;
36
- }
37
- getTargetFilename(name) {
38
- const commandPath = this.getCommandPath();
39
- const namespaced = commandPath.endsWith(path.join('commands', 'clavix'));
40
- const baseName = namespaced ? name : `clavix-${name}`;
41
- return `${baseName}${this.fileExtension}`;
42
- }
43
- formatCommand(template) {
44
- const description = template.description.trim().length > 0
45
- ? `description = ${JSON.stringify(template.description)}\n\n`
46
- : '';
47
- const content = template.content.replace(/\{\{ARGS\}\}/g, '{{args}}');
48
- return `${description}prompt = """\n${content}\n"""\n`;
49
- }
50
- getHomeDir() {
51
- return process.env.CLAVIX_HOME_OVERRIDE || os.homedir();
8
+ super({
9
+ name: 'qwen',
10
+ displayName: 'Qwen Code',
11
+ rootDir: '.qwen',
12
+ }, options);
52
13
  }
53
14
  }
54
15
  //# sourceMappingURL=qwen-adapter.js.map
@@ -0,0 +1,50 @@
1
+ import { BaseAdapter } from './base-adapter.js';
2
+ import { CommandTemplate } from '../../types/agent.js';
3
+ /**
4
+ * Configuration for TOML-based adapters
5
+ */
6
+ export interface TomlAdapterConfig {
7
+ /** Internal adapter name (e.g., 'gemini') */
8
+ name: string;
9
+ /** Display name for UI (e.g., 'Gemini CLI') */
10
+ displayName: string;
11
+ /** Root directory name (e.g., '.gemini') */
12
+ rootDir: string;
13
+ /** Whether to use namespace subdirectory by default */
14
+ useNamespace?: boolean;
15
+ }
16
+ /**
17
+ * Base adapter for TOML-formatted command files
18
+ * Used by Gemini CLI, Qwen Code, LLXPRT, and similar tools
19
+ *
20
+ * Handles:
21
+ * - TOML file format with description and prompt fields
22
+ * - {{args}} placeholder conversion
23
+ * - Namespace subdirectories (e.g., .gemini/commands/clavix/)
24
+ * - Home directory detection for global installations
25
+ */
26
+ export declare abstract class TomlFormattingAdapter extends BaseAdapter {
27
+ readonly fileExtension = ".toml";
28
+ readonly features: {
29
+ supportsSubdirectories: boolean;
30
+ supportsFrontmatter: boolean;
31
+ argumentPlaceholder: string;
32
+ };
33
+ protected readonly config: TomlAdapterConfig;
34
+ constructor(config: TomlAdapterConfig, options?: {
35
+ useNamespace?: boolean;
36
+ });
37
+ get name(): string;
38
+ get displayName(): string;
39
+ get directory(): string;
40
+ detectProject(): Promise<boolean>;
41
+ getCommandPath(): string;
42
+ getTargetFilename(name: string): string;
43
+ /**
44
+ * Format command as TOML with description and prompt fields
45
+ * Converts {{ARGS}} placeholder to {{args}} for TOML tools
46
+ */
47
+ protected formatCommand(template: CommandTemplate): string;
48
+ protected getHomeDir(): string;
49
+ }
50
+ //# sourceMappingURL=toml-formatting-adapter.d.ts.map
@@ -0,0 +1,74 @@
1
+ import * as os from 'os';
2
+ import * as path from 'path';
3
+ import { BaseAdapter } from './base-adapter.js';
4
+ import { FileSystem } from '../../utils/file-system.js';
5
+ /**
6
+ * Base adapter for TOML-formatted command files
7
+ * Used by Gemini CLI, Qwen Code, LLXPRT, and similar tools
8
+ *
9
+ * Handles:
10
+ * - TOML file format with description and prompt fields
11
+ * - {{args}} placeholder conversion
12
+ * - Namespace subdirectories (e.g., .gemini/commands/clavix/)
13
+ * - Home directory detection for global installations
14
+ */
15
+ export class TomlFormattingAdapter extends BaseAdapter {
16
+ fileExtension = '.toml';
17
+ features = {
18
+ supportsSubdirectories: true,
19
+ supportsFrontmatter: false,
20
+ argumentPlaceholder: '{{args}}',
21
+ };
22
+ config;
23
+ constructor(config, options = {}) {
24
+ super();
25
+ this.config = {
26
+ ...config,
27
+ useNamespace: options.useNamespace ?? config.useNamespace ?? true,
28
+ };
29
+ }
30
+ get name() {
31
+ return this.config.name;
32
+ }
33
+ get displayName() {
34
+ return this.config.displayName;
35
+ }
36
+ get directory() {
37
+ return this.config.useNamespace
38
+ ? path.join(this.config.rootDir, 'commands', 'clavix')
39
+ : path.join(this.config.rootDir, 'commands');
40
+ }
41
+ async detectProject() {
42
+ // Check local project directory
43
+ if (await FileSystem.exists(this.config.rootDir)) {
44
+ return true;
45
+ }
46
+ // Check home directory for global installation
47
+ const homePath = path.join(this.getHomeDir(), this.config.rootDir);
48
+ return await FileSystem.exists(homePath);
49
+ }
50
+ getCommandPath() {
51
+ return this.directory;
52
+ }
53
+ getTargetFilename(name) {
54
+ const commandPath = this.getCommandPath();
55
+ const namespaced = commandPath.endsWith(path.join('commands', 'clavix'));
56
+ const baseName = namespaced ? name : `clavix-${name}`;
57
+ return `${baseName}${this.fileExtension}`;
58
+ }
59
+ /**
60
+ * Format command as TOML with description and prompt fields
61
+ * Converts {{ARGS}} placeholder to {{args}} for TOML tools
62
+ */
63
+ formatCommand(template) {
64
+ const description = template.description.trim().length > 0
65
+ ? `description = ${JSON.stringify(template.description)}\n\n`
66
+ : '';
67
+ const content = template.content.replace(/\{\{ARGS\}\}/g, '{{args}}');
68
+ return `${description}prompt = """\n${content}\n"""\n`;
69
+ }
70
+ getHomeDir() {
71
+ return process.env.CLAVIX_HOME_OVERRIDE || os.homedir();
72
+ }
73
+ }
74
+ //# sourceMappingURL=toml-formatting-adapter.js.map
@@ -4,14 +4,13 @@
4
4
  */
5
5
  export declare class WarpMdGenerator {
6
6
  static readonly TARGET_FILE = "WARP.md";
7
- static readonly START_MARKER = "<!-- CLAVIX:START -->";
8
- static readonly END_MARKER = "<!-- CLAVIX:END -->";
9
7
  /**
10
8
  * Generate or update WARP.md with Clavix workflows
11
9
  */
12
10
  static generate(): Promise<void>;
13
- private static injectManagedBlock;
14
- private static escapeRegex;
11
+ /**
12
+ * Check if WARP.md has Clavix block
13
+ */
15
14
  static hasClavixBlock(): Promise<boolean>;
16
15
  }
17
16
  //# sourceMappingURL=warp-md-generator.d.ts.map
@@ -1,7 +1,8 @@
1
- import { FileSystem } from '../../utils/file-system.js';
2
1
  import * as path from 'path';
3
2
  import { fileURLToPath } from 'url';
4
3
  import { dirname } from 'path';
4
+ import { FileSystem } from '../../utils/file-system.js';
5
+ import { DocInjector } from '../doc-injector.js';
5
6
  const __filename = fileURLToPath(import.meta.url);
6
7
  const __dirname = dirname(__filename);
7
8
  /**
@@ -10,8 +11,6 @@ const __dirname = dirname(__filename);
10
11
  */
11
12
  export class WarpMdGenerator {
12
13
  static TARGET_FILE = 'WARP.md';
13
- static START_MARKER = '<!-- CLAVIX:START -->';
14
- static END_MARKER = '<!-- CLAVIX:END -->';
15
14
  /**
16
15
  * Generate or update WARP.md with Clavix workflows
17
16
  */
@@ -21,35 +20,16 @@ export class WarpMdGenerator {
21
20
  throw new Error(`WARP.md template not found at ${templatePath}`);
22
21
  }
23
22
  const template = await FileSystem.readFile(templatePath);
24
- await this.injectManagedBlock(this.TARGET_FILE, template);
25
- }
26
- static async injectManagedBlock(filePath, content) {
27
- let fileContent = '';
28
- if (await FileSystem.exists(filePath)) {
29
- fileContent = await FileSystem.readFile(filePath);
30
- }
31
- const blockRegex = new RegExp(`${this.escapeRegex(this.START_MARKER)}[\\s\\S]*?${this.escapeRegex(this.END_MARKER)}`, 'g');
32
- const wrappedContent = `${this.START_MARKER}\n${content}\n${this.END_MARKER}`;
33
- if (blockRegex.test(fileContent)) {
34
- fileContent = fileContent.replace(blockRegex, wrappedContent);
35
- }
36
- else {
37
- if (fileContent && !fileContent.endsWith('\n\n')) {
38
- fileContent += '\n\n';
39
- }
40
- fileContent += wrappedContent + '\n';
41
- }
42
- await FileSystem.writeFileAtomic(filePath, fileContent);
43
- }
44
- static escapeRegex(str) {
45
- return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
23
+ await DocInjector.injectBlock(this.TARGET_FILE, template, {
24
+ createIfMissing: true,
25
+ validateMarkdown: false,
26
+ });
46
27
  }
28
+ /**
29
+ * Check if WARP.md has Clavix block
30
+ */
47
31
  static async hasClavixBlock() {
48
- if (!(await FileSystem.exists(this.TARGET_FILE))) {
49
- return false;
50
- }
51
- const content = await FileSystem.readFile(this.TARGET_FILE);
52
- return content.includes(this.START_MARKER);
32
+ return DocInjector.hasBlock(this.TARGET_FILE);
53
33
  }
54
34
  }
55
35
  //# sourceMappingURL=warp-md-generator.js.map
@@ -198,13 +198,12 @@ Enter conversational mode for iterative prompt development. Discuss your require
198
198
  #### /clavix:summarize
199
199
  Analyze the current conversation and extract key requirements into a structured prompt and mini-PRD.
200
200
 
201
- ### Utility Commands
201
+ ### Agentic Utilities
202
202
 
203
- #### /clavix:verify
204
- Verify implementation against checklist. Run automated checks and generate pass/fail reports.
203
+ These utilities provide structured workflows for common tasks. Invoke them using the slash commands below:
205
204
 
206
- #### /clavix:archive
207
- Archive completed projects. Move finished PRDs and outputs to the archive for future reference.
205
+ - **Verify** (\`/clavix:verify\`): Check implementation against PRD requirements. Runs automated validation and generates pass/fail reports.
206
+ - **Archive** (\`/clavix:archive\`): Archive completed work. Moves finished PRDs and outputs to archive for future reference.
208
207
 
209
208
  **When to use which mode:**
210
209
  - **Improve mode** (\`/clavix:improve\`): Smart prompt optimization with auto-depth selection
@@ -87,8 +87,14 @@ All workflows are executed via slash commands that AI agents read and follow:
87
87
  | `/clavix:implement` | Execute tasks or prompts (auto-detects source) |
88
88
  | `/clavix:start` | Begin conversational session |
89
89
  | `/clavix:summarize` | Extract requirements from conversation |
90
- | `/clavix:verify` | Verify implementation |
91
- | `/clavix:archive` | Archive completed projects |
90
+
91
+ ### Agentic Utilities (Project Management)
92
+ These utilities provide structured workflows for project completion:
93
+
94
+ | Utility | Purpose |
95
+ |---------|---------|
96
+ | `/clavix:verify` | Check implementation against PRD requirements, run validation |
97
+ | `/clavix:archive` | Archive completed work to `.clavix/archive/` for reference |
92
98
 
93
99
  **Quick start:**
94
100
  ```bash
@@ -74,8 +74,12 @@ All workflows are executed via slash commands:
74
74
  | `/clavix:implement` | Execute tasks or prompts (auto-detects source) |
75
75
  | `/clavix:start` | Begin conversational session |
76
76
  | `/clavix:summarize` | Extract requirements from conversation |
77
- | `/clavix:verify` | Verify implementation |
78
- | `/clavix:archive` | Archive completed projects |
77
+
78
+ ### Agentic Utilities (Project Management)
79
+ | Utility | Purpose |
80
+ |---------|---------|
81
+ | `/clavix:verify` | Check implementation against PRD requirements |
82
+ | `/clavix:archive` | Archive completed work to `.clavix/archive/` |
79
83
 
80
84
  ---
81
85
 
@@ -135,8 +135,12 @@ Autofix handles edge cases gracefully - let it work.
135
135
  | `/clavix:implement` | Execute tasks or prompts (auto-detects source) |
136
136
  | `/clavix:start` | Begin conversational session |
137
137
  | `/clavix:summarize` | Extract requirements from conversation |
138
- | `/clavix:verify` | Verify implementation |
139
- | `/clavix:archive` | Archive completed projects |
138
+
139
+ ### Agentic Utilities (Project Management)
140
+ | Utility | Purpose |
141
+ |---------|---------|
142
+ | `/clavix:verify` | Check implementation against PRD requirements |
143
+ | `/clavix:archive` | Archive completed work to `.clavix/archive/` |
140
144
 
141
145
  ---
142
146
 
@@ -63,8 +63,12 @@ For complete step-by-step workflows, see `.clavix/instructions/`:
63
63
  | `/clavix:implement` | Execute tasks or prompts (auto-detects source) |
64
64
  | `/clavix:start` | Begin conversational session |
65
65
  | `/clavix:summarize` | Extract requirements from conversation |
66
- | `/clavix:verify` | Verify implementation |
67
- | `/clavix:archive` | Archive completed projects |
66
+
67
+ ### Agentic Utilities (Project Management)
68
+ | Utility | Purpose |
69
+ |---------|---------|
70
+ | `/clavix:verify` | Check implementation against PRD requirements |
71
+ | `/clavix:archive` | Archive completed work to `.clavix/archive/` |
68
72
 
69
73
  ### Outputs
70
74
  - Project artifacts live under `.clavix/outputs/<project>/`
@@ -234,18 +234,15 @@ Result: Project permanently deleted
234
234
 
235
235
  ## Agent Transparency (v5.1)
236
236
 
237
- ### CLI Reference (Commands I Execute)
238
- {{INCLUDE:agent-protocols/cli-reference.md}}
237
+ ### Agent Manual (Universal Protocols)
238
+ {{INCLUDE:agent-protocols/AGENT_MANUAL.md}}
239
239
 
240
- ### Error Handling
241
- {{INCLUDE:agent-protocols/error-handling.md}}
240
+ ### CLI Reference
241
+ {{INCLUDE:agent-protocols/cli-reference.md}}
242
242
 
243
243
  ### Recovery Patterns
244
244
  {{INCLUDE:troubleshooting/vibecoder-recovery.md}}
245
245
 
246
- ### Agent Decision Rules
247
- {{INCLUDE:agent-protocols/decision-rules.md}}
248
-
249
246
  ## Workflow Navigation
250
247
 
251
248
  **You are here:** Archive (Project Cleanup)