clavix 5.1.1 → 5.3.0

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 (66) hide show
  1. package/README.md +22 -5
  2. package/dist/cli/commands/diagnose.d.ts +15 -0
  3. package/dist/cli/commands/diagnose.js +295 -0
  4. package/dist/cli/commands/init.d.ts +4 -0
  5. package/dist/cli/commands/init.js +130 -24
  6. package/dist/cli/commands/update.js +1 -1
  7. package/dist/constants.d.ts +18 -0
  8. package/dist/constants.js +24 -0
  9. package/dist/core/adapter-registry.d.ts +39 -0
  10. package/dist/core/adapter-registry.js +208 -0
  11. package/dist/core/adapters/agents-md-generator.d.ts +0 -10
  12. package/dist/core/adapters/agents-md-generator.js +7 -41
  13. package/dist/core/adapters/base-adapter.d.ts +1 -0
  14. package/dist/core/adapters/base-adapter.js +3 -1
  15. package/dist/core/adapters/copilot-instructions-generator.d.ts +0 -10
  16. package/dist/core/adapters/copilot-instructions-generator.js +7 -41
  17. package/dist/core/adapters/gemini-adapter.d.ts +2 -18
  18. package/dist/core/adapters/gemini-adapter.js +7 -48
  19. package/dist/core/adapters/llxprt-adapter.d.ts +2 -18
  20. package/dist/core/adapters/llxprt-adapter.js +7 -48
  21. package/dist/core/adapters/octo-md-generator.d.ts +0 -10
  22. package/dist/core/adapters/octo-md-generator.js +7 -41
  23. package/dist/core/adapters/qwen-adapter.d.ts +2 -18
  24. package/dist/core/adapters/qwen-adapter.js +7 -46
  25. package/dist/core/adapters/toml-formatting-adapter.d.ts +50 -0
  26. package/dist/core/adapters/toml-formatting-adapter.js +74 -0
  27. package/dist/core/adapters/universal-adapter.d.ts +49 -0
  28. package/dist/core/adapters/universal-adapter.js +88 -0
  29. package/dist/core/adapters/warp-md-generator.d.ts +3 -4
  30. package/dist/core/adapters/warp-md-generator.js +10 -30
  31. package/dist/core/command-transformer.d.ts +11 -12
  32. package/dist/core/command-transformer.js +11 -12
  33. package/dist/core/doc-injector.d.ts +0 -4
  34. package/dist/core/doc-injector.js +9 -15
  35. package/dist/core/template-assembler.d.ts +1 -1
  36. package/dist/core/template-assembler.js +1 -1
  37. package/dist/templates/agents/agents.md +9 -4
  38. package/dist/templates/agents/copilot-instructions.md +7 -4
  39. package/dist/templates/agents/octo.md +7 -3
  40. package/dist/templates/agents/warp.md +8 -4
  41. package/dist/templates/instructions/core/file-operations.md +15 -11
  42. package/dist/templates/slash-commands/_canonical/plan.md +1 -2
  43. package/dist/templates/slash-commands/_components/MANIFEST.md +81 -0
  44. package/dist/templates/slash-commands/_components/agent-protocols/AGENT_MANUAL.md +1 -1
  45. package/dist/templates/slash-commands/_components/agent-protocols/cli-reference.md +15 -17
  46. package/dist/types/adapter-config.d.ts +73 -0
  47. package/dist/types/adapter-config.js +24 -0
  48. package/dist/types/config.d.ts +0 -80
  49. package/dist/types/config.js +3 -2
  50. package/dist/utils/error-utils.d.ts +4 -0
  51. package/dist/utils/error-utils.js +6 -0
  52. package/dist/utils/file-system.js +7 -12
  53. package/dist/utils/legacy-command-cleanup.d.ts +14 -0
  54. package/dist/utils/legacy-command-cleanup.js +14 -0
  55. package/dist/utils/logger.d.ts +32 -0
  56. package/dist/utils/logger.js +56 -0
  57. package/dist/utils/string-utils.d.ts +10 -0
  58. package/dist/utils/string-utils.js +12 -0
  59. package/dist/utils/version.d.ts +20 -0
  60. package/dist/utils/version.js +43 -0
  61. package/oclif.manifest.json +130 -0
  62. package/package.json +2 -2
  63. package/dist/cli/commands/config.d.ts +0 -30
  64. package/dist/cli/commands/config.js +0 -456
  65. package/dist/templates/slash-commands/_components/agent-protocols/decision-rules.md +0 -232
  66. package/dist/templates/slash-commands/_components/agent-protocols/error-handling.md +0 -177
@@ -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
@@ -0,0 +1,49 @@
1
+ /**
2
+ * UniversalAdapter - Config-driven adapter implementation
3
+ *
4
+ * This adapter can handle any simple adapter by accepting configuration
5
+ * at construction time. It provides the same interface as dedicated
6
+ * adapter classes but derives all behavior from AdapterConfig.
7
+ *
8
+ * For adapters requiring custom logic (TOML formatting, doc injection),
9
+ * dedicated adapter classes should be used instead.
10
+ *
11
+ * @since v5.3.0
12
+ */
13
+ import { BaseAdapter } from './base-adapter.js';
14
+ import { AdapterConfig } from '../../types/adapter-config.js';
15
+ import { IntegrationFeatures } from '../../types/agent.js';
16
+ export declare class UniversalAdapter extends BaseAdapter {
17
+ private config;
18
+ constructor(config: AdapterConfig);
19
+ get name(): string;
20
+ get displayName(): string;
21
+ get directory(): string;
22
+ get fileExtension(): string;
23
+ /**
24
+ * Get integration features for command transformation
25
+ */
26
+ getIntegrationFeatures(): IntegrationFeatures;
27
+ /**
28
+ * Generate the target filename based on config pattern
29
+ */
30
+ getTargetFilename(commandName: string): string;
31
+ /**
32
+ * Get full command path
33
+ */
34
+ getCommandPath(): string;
35
+ /**
36
+ * Check if this adapter's project environment is detected
37
+ * Required by BaseAdapter abstract class
38
+ */
39
+ detectProject(): Promise<boolean>;
40
+ /**
41
+ * Check if this adapter supports subdirectories
42
+ */
43
+ supportsSubdirectories(): boolean;
44
+ /**
45
+ * Check if this adapter supports frontmatter
46
+ */
47
+ supportsFrontmatter(): boolean;
48
+ }
49
+ //# sourceMappingURL=universal-adapter.d.ts.map
@@ -0,0 +1,88 @@
1
+ /**
2
+ * UniversalAdapter - Config-driven adapter implementation
3
+ *
4
+ * This adapter can handle any simple adapter by accepting configuration
5
+ * at construction time. It provides the same interface as dedicated
6
+ * adapter classes but derives all behavior from AdapterConfig.
7
+ *
8
+ * For adapters requiring custom logic (TOML formatting, doc injection),
9
+ * dedicated adapter classes should be used instead.
10
+ *
11
+ * @since v5.3.0
12
+ */
13
+ import { BaseAdapter } from './base-adapter.js';
14
+ import * as path from 'path';
15
+ export class UniversalAdapter extends BaseAdapter {
16
+ config;
17
+ constructor(config) {
18
+ super();
19
+ this.config = config;
20
+ }
21
+ get name() {
22
+ return this.config.name;
23
+ }
24
+ get displayName() {
25
+ return this.config.displayName;
26
+ }
27
+ get directory() {
28
+ return this.config.directory;
29
+ }
30
+ get fileExtension() {
31
+ return this.config.fileExtension;
32
+ }
33
+ /**
34
+ * Get integration features for command transformation
35
+ */
36
+ getIntegrationFeatures() {
37
+ return {
38
+ commandFormat: {
39
+ separator: this.config.features.commandSeparator,
40
+ },
41
+ };
42
+ }
43
+ /**
44
+ * Generate the target filename based on config pattern
45
+ */
46
+ getTargetFilename(commandName) {
47
+ const pattern = this.config.filenamePattern;
48
+ const filename = pattern.replace('{name}', commandName);
49
+ return `${filename}${this.config.fileExtension}`;
50
+ }
51
+ /**
52
+ * Get full command path
53
+ */
54
+ getCommandPath() {
55
+ return path.join(process.cwd(), this.config.directory);
56
+ }
57
+ /**
58
+ * Check if this adapter's project environment is detected
59
+ * Required by BaseAdapter abstract class
60
+ */
61
+ async detectProject() {
62
+ const { detection } = this.config;
63
+ const fs = await import('fs-extra');
64
+ switch (detection.type) {
65
+ case 'directory':
66
+ return fs.pathExists(detection.path);
67
+ case 'file':
68
+ return fs.pathExists(detection.path);
69
+ case 'config':
70
+ return fs.pathExists(detection.path);
71
+ default:
72
+ return false;
73
+ }
74
+ }
75
+ /**
76
+ * Check if this adapter supports subdirectories
77
+ */
78
+ supportsSubdirectories() {
79
+ return this.config.features.supportsSubdirectories;
80
+ }
81
+ /**
82
+ * Check if this adapter supports frontmatter
83
+ */
84
+ supportsFrontmatter() {
85
+ return this.config.features.supportsFrontmatter;
86
+ }
87
+ }
88
+ //# sourceMappingURL=universal-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
@@ -3,11 +3,10 @@ import { IntegrationFeatures } from '../types/agent.js';
3
3
  * CommandTransformer - Transforms slash command references in template content
4
4
  *
5
5
  * Handles conversion between command formats:
6
- * - Colon format: /clavix:fast (Claude Code style - uses subdirectories)
7
- * - Hyphen format: /clavix-fast (Cursor, Droid style - flat files)
6
+ * - Colon format: /clavix:improve (Claude Code style - uses subdirectories)
7
+ * - Hyphen format: /clavix-improve (Cursor, Droid style - flat files)
8
8
  *
9
- * Preserves CLI commands (clavix prompts list) unchanged - only transforms
10
- * slash commands that start with /clavix:
9
+ * Only transforms slash commands that start with /clavix:
11
10
  *
12
11
  * @since v4.8.1
13
12
  */
@@ -29,26 +28,26 @@ export declare class CommandTransformer {
29
28
  *
30
29
  * @example
31
30
  * // For Cursor/Droid (hyphen format):
32
- * transform('/clavix:fast', { commandFormat: { separator: '-' } })
33
- * // Returns: '/clavix-fast'
31
+ * transform('/clavix:improve', { commandFormat: { separator: '-' } })
32
+ * // Returns: '/clavix-improve'
34
33
  *
35
34
  * @example
36
35
  * // For Claude Code (colon format, default):
37
- * transform('/clavix:fast', { commandFormat: { separator: ':' } })
38
- * // Returns: '/clavix:fast' (unchanged)
36
+ * transform('/clavix:improve', { commandFormat: { separator: ':' } })
37
+ * // Returns: '/clavix:improve' (unchanged)
39
38
  */
40
39
  static transform(content: string, features?: IntegrationFeatures): string;
41
40
  /**
42
41
  * Get the formatted command name for a specific adapter
43
42
  * Useful for generating documentation or references
44
43
  *
45
- * @param commandName - Base command name (e.g., 'fast', 'execute', 'task-complete')
44
+ * @param commandName - Base command name (e.g., 'improve', 'prd', 'implement')
46
45
  * @param features - Adapter's integration features
47
- * @returns Formatted slash command (e.g., '/clavix:fast' or '/clavix-fast')
46
+ * @returns Formatted slash command (e.g., '/clavix:improve' or '/clavix-improve')
48
47
  *
49
48
  * @example
50
- * formatCommand('execute', { commandFormat: { separator: '-' } })
51
- * // Returns: '/clavix-execute'
49
+ * formatCommand('improve', { commandFormat: { separator: '-' } })
50
+ * // Returns: '/clavix-improve'
52
51
  */
53
52
  static formatCommand(commandName: string, features?: IntegrationFeatures): string;
54
53
  }
@@ -2,11 +2,10 @@
2
2
  * CommandTransformer - Transforms slash command references in template content
3
3
  *
4
4
  * Handles conversion between command formats:
5
- * - Colon format: /clavix:fast (Claude Code style - uses subdirectories)
6
- * - Hyphen format: /clavix-fast (Cursor, Droid style - flat files)
5
+ * - Colon format: /clavix:improve (Claude Code style - uses subdirectories)
6
+ * - Hyphen format: /clavix-improve (Cursor, Droid style - flat files)
7
7
  *
8
- * Preserves CLI commands (clavix prompts list) unchanged - only transforms
9
- * slash commands that start with /clavix:
8
+ * Only transforms slash commands that start with /clavix:
10
9
  *
11
10
  * @since v4.8.1
12
11
  */
@@ -28,13 +27,13 @@ export class CommandTransformer {
28
27
  *
29
28
  * @example
30
29
  * // For Cursor/Droid (hyphen format):
31
- * transform('/clavix:fast', { commandFormat: { separator: '-' } })
32
- * // Returns: '/clavix-fast'
30
+ * transform('/clavix:improve', { commandFormat: { separator: '-' } })
31
+ * // Returns: '/clavix-improve'
33
32
  *
34
33
  * @example
35
34
  * // For Claude Code (colon format, default):
36
- * transform('/clavix:fast', { commandFormat: { separator: ':' } })
37
- * // Returns: '/clavix:fast' (unchanged)
35
+ * transform('/clavix:improve', { commandFormat: { separator: ':' } })
36
+ * // Returns: '/clavix:improve' (unchanged)
38
37
  */
39
38
  static transform(content, features) {
40
39
  const separator = features?.commandFormat?.separator ?? this.DEFAULT_SEPARATOR;
@@ -49,13 +48,13 @@ export class CommandTransformer {
49
48
  * Get the formatted command name for a specific adapter
50
49
  * Useful for generating documentation or references
51
50
  *
52
- * @param commandName - Base command name (e.g., 'fast', 'execute', 'task-complete')
51
+ * @param commandName - Base command name (e.g., 'improve', 'prd', 'implement')
53
52
  * @param features - Adapter's integration features
54
- * @returns Formatted slash command (e.g., '/clavix:fast' or '/clavix-fast')
53
+ * @returns Formatted slash command (e.g., '/clavix:improve' or '/clavix-improve')
55
54
  *
56
55
  * @example
57
- * formatCommand('execute', { commandFormat: { separator: '-' } })
58
- * // Returns: '/clavix-execute'
56
+ * formatCommand('improve', { commandFormat: { separator: '-' } })
57
+ * // Returns: '/clavix-improve'
59
58
  */
60
59
  static formatCommand(commandName, features) {
61
60
  const separator = features?.commandFormat?.separator ?? this.DEFAULT_SEPARATOR;
@@ -31,10 +31,6 @@ export declare class DocInjector {
31
31
  * Wrap content with markers
32
32
  */
33
33
  private static wrapContent;
34
- /**
35
- * Escape special regex characters
36
- */
37
- private static escapeRegex;
38
34
  /**
39
35
  * Basic markdown validation
40
36
  */