clavix 2.3.1 → 2.4.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 (179) hide show
  1. package/dist/core 2/adapters/agents-md-generator.d.ts +26 -0
  2. package/dist/core 2/adapters/agents-md-generator.js +102 -0
  3. package/dist/core 2/adapters/amp-adapter.d.ts +27 -0
  4. package/dist/core 2/adapters/amp-adapter.js +42 -0
  5. package/dist/core 2/adapters/augment-adapter.d.ts +22 -0
  6. package/dist/core 2/adapters/augment-adapter.js +77 -0
  7. package/dist/core 2/adapters/base-adapter.d.ts +45 -0
  8. package/dist/core 2/adapters/base-adapter.js +142 -0
  9. package/dist/core 2/adapters/claude-code-adapter.d.ts +32 -0
  10. package/dist/core 2/adapters/claude-code-adapter.js +116 -0
  11. package/dist/core 2/adapters/cline-adapter.d.ts +34 -0
  12. package/dist/core 2/adapters/cline-adapter.js +52 -0
  13. package/dist/core 2/adapters/codebuddy-adapter.d.ts +24 -0
  14. package/dist/core 2/adapters/codebuddy-adapter.js +82 -0
  15. package/dist/core 2/adapters/codex-adapter.d.ts +24 -0
  16. package/dist/core 2/adapters/codex-adapter.js +79 -0
  17. package/dist/core 2/adapters/copilot-instructions-generator.d.ts +26 -0
  18. package/dist/core 2/adapters/copilot-instructions-generator.js +104 -0
  19. package/dist/core 2/adapters/crush-adapter.d.ts +35 -0
  20. package/dist/core 2/adapters/crush-adapter.js +49 -0
  21. package/dist/core 2/adapters/cursor-adapter.d.ts +25 -0
  22. package/dist/core 2/adapters/cursor-adapter.js +40 -0
  23. package/dist/core 2/adapters/droid-adapter.d.ts +33 -0
  24. package/dist/core 2/adapters/droid-adapter.js +57 -0
  25. package/dist/core 2/adapters/gemini-adapter.d.ts +27 -0
  26. package/dist/core 2/adapters/gemini-adapter.js +90 -0
  27. package/dist/core 2/adapters/kilocode-adapter.d.ts +34 -0
  28. package/dist/core 2/adapters/kilocode-adapter.js +49 -0
  29. package/dist/core 2/adapters/octo-md-generator.d.ts +26 -0
  30. package/dist/core 2/adapters/octo-md-generator.js +102 -0
  31. package/dist/core 2/adapters/opencode-adapter.d.ts +33 -0
  32. package/dist/core 2/adapters/opencode-adapter.js +56 -0
  33. package/dist/core 2/adapters/qwen-adapter.d.ts +27 -0
  34. package/dist/core 2/adapters/qwen-adapter.js +90 -0
  35. package/dist/core 2/adapters/roocode-adapter.d.ts +40 -0
  36. package/dist/core 2/adapters/roocode-adapter.js +68 -0
  37. package/dist/core 2/adapters/warp-md-generator.d.ts +17 -0
  38. package/dist/core 2/adapters/warp-md-generator.js +88 -0
  39. package/dist/core 2/adapters/windsurf-adapter.d.ts +34 -0
  40. package/dist/core 2/adapters/windsurf-adapter.js +49 -0
  41. package/dist/core 2/agent-manager.d.ts +51 -0
  42. package/dist/core 2/agent-manager.js +126 -0
  43. package/dist/core 2/archive-manager.d.ts +100 -0
  44. package/dist/core 2/archive-manager.js +338 -0
  45. package/dist/core 2/conversation-analyzer.d.ts +86 -0
  46. package/dist/core 2/doc-injector.d.ts +51 -0
  47. package/dist/core 2/doc-injector.js +236 -0
  48. package/dist/core 2/git-manager.d.ts +100 -0
  49. package/dist/core 2/git-manager.js +214 -0
  50. package/dist/core 2/prompt-optimizer.d.ts +268 -0
  51. package/dist/core 2/prompt-optimizer.js +963 -0
  52. package/dist/core 2/question-engine.d.ts +167 -0
  53. package/dist/core 2/question-engine.js +395 -0
  54. package/dist/core 2/session-manager.d.ts +139 -0
  55. package/dist/core 2/session-manager.js +403 -0
  56. package/dist/core 2/task-manager.d.ts +155 -0
  57. package/dist/core 2/task-manager.js +689 -0
  58. package/dist/utils/template-loader.js +24 -22
  59. package/package.json +1 -1
  60. package/dist/templates/slash-commands/augment/archive.md +0 -291
  61. package/dist/templates/slash-commands/augment/deep.md +0 -207
  62. package/dist/templates/slash-commands/augment/fast.md +0 -183
  63. package/dist/templates/slash-commands/augment/implement.md +0 -267
  64. package/dist/templates/slash-commands/augment/plan.md +0 -173
  65. package/dist/templates/slash-commands/augment/prd.md +0 -178
  66. package/dist/templates/slash-commands/augment/start.md +0 -142
  67. package/dist/templates/slash-commands/augment/summarize.md +0 -179
  68. package/dist/templates/slash-commands/claude-code/archive.md +0 -291
  69. package/dist/templates/slash-commands/claude-code/deep.md +0 -207
  70. package/dist/templates/slash-commands/claude-code/fast.md +0 -183
  71. package/dist/templates/slash-commands/claude-code/implement.md +0 -267
  72. package/dist/templates/slash-commands/claude-code/plan.md +0 -173
  73. package/dist/templates/slash-commands/claude-code/prd.md +0 -178
  74. package/dist/templates/slash-commands/claude-code/start.md +0 -142
  75. package/dist/templates/slash-commands/claude-code/summarize.md +0 -179
  76. package/dist/templates/slash-commands/cline/archive.md +0 -291
  77. package/dist/templates/slash-commands/cline/deep.md +0 -207
  78. package/dist/templates/slash-commands/cline/fast.md +0 -183
  79. package/dist/templates/slash-commands/cline/implement.md +0 -267
  80. package/dist/templates/slash-commands/cline/plan.md +0 -173
  81. package/dist/templates/slash-commands/cline/prd.md +0 -178
  82. package/dist/templates/slash-commands/cline/start.md +0 -142
  83. package/dist/templates/slash-commands/cline/summarize.md +0 -179
  84. package/dist/templates/slash-commands/codebuddy/archive.md +0 -291
  85. package/dist/templates/slash-commands/codebuddy/deep.md +0 -207
  86. package/dist/templates/slash-commands/codebuddy/fast.md +0 -183
  87. package/dist/templates/slash-commands/codebuddy/implement.md +0 -267
  88. package/dist/templates/slash-commands/codebuddy/plan.md +0 -173
  89. package/dist/templates/slash-commands/codebuddy/prd.md +0 -178
  90. package/dist/templates/slash-commands/codebuddy/start.md +0 -142
  91. package/dist/templates/slash-commands/codebuddy/summarize.md +0 -179
  92. package/dist/templates/slash-commands/codex/archive.md +0 -291
  93. package/dist/templates/slash-commands/codex/deep.md +0 -207
  94. package/dist/templates/slash-commands/codex/fast.md +0 -183
  95. package/dist/templates/slash-commands/codex/implement.md +0 -267
  96. package/dist/templates/slash-commands/codex/plan.md +0 -173
  97. package/dist/templates/slash-commands/codex/prd.md +0 -178
  98. package/dist/templates/slash-commands/codex/start.md +0 -142
  99. package/dist/templates/slash-commands/codex/summarize.md +0 -179
  100. package/dist/templates/slash-commands/crush/archive.md +0 -291
  101. package/dist/templates/slash-commands/crush/deep.md +0 -207
  102. package/dist/templates/slash-commands/crush/fast.md +0 -183
  103. package/dist/templates/slash-commands/crush/implement.md +0 -267
  104. package/dist/templates/slash-commands/crush/plan.md +0 -173
  105. package/dist/templates/slash-commands/crush/prd.md +0 -178
  106. package/dist/templates/slash-commands/crush/start.md +0 -142
  107. package/dist/templates/slash-commands/crush/summarize.md +0 -179
  108. package/dist/templates/slash-commands/cursor/archive.md +0 -291
  109. package/dist/templates/slash-commands/cursor/deep.md +0 -207
  110. package/dist/templates/slash-commands/cursor/fast.md +0 -183
  111. package/dist/templates/slash-commands/cursor/implement.md +0 -267
  112. package/dist/templates/slash-commands/cursor/plan.md +0 -173
  113. package/dist/templates/slash-commands/cursor/prd.md +0 -178
  114. package/dist/templates/slash-commands/cursor/start.md +0 -142
  115. package/dist/templates/slash-commands/cursor/summarize.md +0 -179
  116. package/dist/templates/slash-commands/droid/archive.md +0 -291
  117. package/dist/templates/slash-commands/droid/deep.md +0 -207
  118. package/dist/templates/slash-commands/droid/fast.md +0 -183
  119. package/dist/templates/slash-commands/droid/implement.md +0 -267
  120. package/dist/templates/slash-commands/droid/plan.md +0 -173
  121. package/dist/templates/slash-commands/droid/prd.md +0 -178
  122. package/dist/templates/slash-commands/droid/start.md +0 -142
  123. package/dist/templates/slash-commands/droid/summarize.md +0 -179
  124. package/dist/templates/slash-commands/gemini/archive.toml +0 -290
  125. package/dist/templates/slash-commands/gemini/deep.toml +0 -206
  126. package/dist/templates/slash-commands/gemini/fast.toml +0 -182
  127. package/dist/templates/slash-commands/gemini/implement.toml +0 -266
  128. package/dist/templates/slash-commands/gemini/plan.toml +0 -170
  129. package/dist/templates/slash-commands/gemini/prd.toml +0 -177
  130. package/dist/templates/slash-commands/gemini/start.toml +0 -141
  131. package/dist/templates/slash-commands/gemini/summarize.toml +0 -178
  132. package/dist/templates/slash-commands/kilocode/archive.md +0 -291
  133. package/dist/templates/slash-commands/kilocode/deep.md +0 -207
  134. package/dist/templates/slash-commands/kilocode/fast.md +0 -183
  135. package/dist/templates/slash-commands/kilocode/implement.md +0 -267
  136. package/dist/templates/slash-commands/kilocode/plan.md +0 -173
  137. package/dist/templates/slash-commands/kilocode/prd.md +0 -178
  138. package/dist/templates/slash-commands/kilocode/start.md +0 -142
  139. package/dist/templates/slash-commands/kilocode/summarize.md +0 -179
  140. package/dist/templates/slash-commands/opencode/archive.md +0 -291
  141. package/dist/templates/slash-commands/opencode/deep.md +0 -207
  142. package/dist/templates/slash-commands/opencode/fast.md +0 -183
  143. package/dist/templates/slash-commands/opencode/implement.md +0 -267
  144. package/dist/templates/slash-commands/opencode/plan.md +0 -173
  145. package/dist/templates/slash-commands/opencode/prd.md +0 -178
  146. package/dist/templates/slash-commands/opencode/start.md +0 -142
  147. package/dist/templates/slash-commands/opencode/summarize.md +0 -179
  148. package/dist/templates/slash-commands/qwen/archive.toml +0 -290
  149. package/dist/templates/slash-commands/qwen/deep.toml +0 -206
  150. package/dist/templates/slash-commands/qwen/fast.toml +0 -182
  151. package/dist/templates/slash-commands/qwen/implement.toml +0 -266
  152. package/dist/templates/slash-commands/qwen/plan.toml +0 -170
  153. package/dist/templates/slash-commands/qwen/prd.toml +0 -177
  154. package/dist/templates/slash-commands/qwen/start.toml +0 -141
  155. package/dist/templates/slash-commands/qwen/summarize.toml +0 -178
  156. package/dist/templates/slash-commands/roocode/archive.md +0 -291
  157. package/dist/templates/slash-commands/roocode/deep.md +0 -207
  158. package/dist/templates/slash-commands/roocode/fast.md +0 -183
  159. package/dist/templates/slash-commands/roocode/implement.md +0 -267
  160. package/dist/templates/slash-commands/roocode/plan.md +0 -173
  161. package/dist/templates/slash-commands/roocode/prd.md +0 -178
  162. package/dist/templates/slash-commands/roocode/start.md +0 -142
  163. package/dist/templates/slash-commands/roocode/summarize.md +0 -179
  164. package/dist/templates/slash-commands/windsurf/archive.md +0 -291
  165. package/dist/templates/slash-commands/windsurf/deep.md +0 -207
  166. package/dist/templates/slash-commands/windsurf/fast.md +0 -183
  167. package/dist/templates/slash-commands/windsurf/implement.md +0 -267
  168. package/dist/templates/slash-commands/windsurf/plan.md +0 -173
  169. package/dist/templates/slash-commands/windsurf/prd.md +0 -178
  170. package/dist/templates/slash-commands/windsurf/start.md +0 -142
  171. package/dist/templates/slash-commands/windsurf/summarize.md +0 -179
  172. /package/dist/templates/slash-commands/{amp → _canonical}/archive.md +0 -0
  173. /package/dist/templates/slash-commands/{amp → _canonical}/deep.md +0 -0
  174. /package/dist/templates/slash-commands/{amp → _canonical}/fast.md +0 -0
  175. /package/dist/templates/slash-commands/{amp → _canonical}/implement.md +0 -0
  176. /package/dist/templates/slash-commands/{amp → _canonical}/plan.md +0 -0
  177. /package/dist/templates/slash-commands/{amp → _canonical}/prd.md +0 -0
  178. /package/dist/templates/slash-commands/{amp → _canonical}/start.md +0 -0
  179. /package/dist/templates/slash-commands/{amp → _canonical}/summarize.md +0 -0
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Generator for universal AGENTS.md file
3
+ * Provides workflow instructions for AI tools without slash command support
4
+ */
5
+ export declare class AgentsMdGenerator {
6
+ static readonly TARGET_FILE = "AGENTS.md";
7
+ static readonly START_MARKER = "<!-- CLAVIX:START -->";
8
+ static readonly END_MARKER = "<!-- CLAVIX:END -->";
9
+ /**
10
+ * Generate or update AGENTS.md with Clavix workflows
11
+ */
12
+ static generate(): Promise<void>;
13
+ /**
14
+ * Inject or update managed block in AGENTS.md
15
+ */
16
+ private static injectManagedBlock;
17
+ /**
18
+ * Escape special regex characters
19
+ */
20
+ private static escapeRegex;
21
+ /**
22
+ * Check if AGENTS.md has Clavix block
23
+ */
24
+ static hasClavixBlock(): Promise<boolean>;
25
+ }
26
+ //# sourceMappingURL=agents-md-generator.d.ts.map
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.AgentsMdGenerator = void 0;
37
+ const file_system_1 = require("../../utils/file-system");
38
+ const path = __importStar(require("path"));
39
+ /**
40
+ * Generator for universal AGENTS.md file
41
+ * Provides workflow instructions for AI tools without slash command support
42
+ */
43
+ class AgentsMdGenerator {
44
+ /**
45
+ * Generate or update AGENTS.md with Clavix workflows
46
+ */
47
+ static async generate() {
48
+ const templatePath = path.join(__dirname, '../../templates/agents/agents.md');
49
+ // Check if template exists
50
+ if (!(await file_system_1.FileSystem.exists(templatePath))) {
51
+ throw new Error(`AGENTS.md template not found at ${templatePath}`);
52
+ }
53
+ const template = await file_system_1.FileSystem.readFile(templatePath);
54
+ // Inject into AGENTS.md using managed blocks
55
+ await this.injectManagedBlock(this.TARGET_FILE, template);
56
+ }
57
+ /**
58
+ * Inject or update managed block in AGENTS.md
59
+ */
60
+ static async injectManagedBlock(filePath, content) {
61
+ let fileContent = '';
62
+ // Read existing file or start with empty content
63
+ if (await file_system_1.FileSystem.exists(filePath)) {
64
+ fileContent = await file_system_1.FileSystem.readFile(filePath);
65
+ }
66
+ const blockRegex = new RegExp(`${this.escapeRegex(this.START_MARKER)}[\\s\\S]*?${this.escapeRegex(this.END_MARKER)}`, 'g');
67
+ const wrappedContent = `${this.START_MARKER}\n${content}\n${this.END_MARKER}`;
68
+ if (blockRegex.test(fileContent)) {
69
+ // Replace existing block
70
+ fileContent = fileContent.replace(blockRegex, wrappedContent);
71
+ }
72
+ else {
73
+ // Append new block
74
+ if (fileContent && !fileContent.endsWith('\n\n')) {
75
+ fileContent += '\n\n';
76
+ }
77
+ fileContent += wrappedContent + '\n';
78
+ }
79
+ await file_system_1.FileSystem.writeFileAtomic(filePath, fileContent);
80
+ }
81
+ /**
82
+ * Escape special regex characters
83
+ */
84
+ static escapeRegex(str) {
85
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
86
+ }
87
+ /**
88
+ * Check if AGENTS.md has Clavix block
89
+ */
90
+ static async hasClavixBlock() {
91
+ if (!(await file_system_1.FileSystem.exists(this.TARGET_FILE))) {
92
+ return false;
93
+ }
94
+ const content = await file_system_1.FileSystem.readFile(this.TARGET_FILE);
95
+ return content.includes(this.START_MARKER);
96
+ }
97
+ }
98
+ exports.AgentsMdGenerator = AgentsMdGenerator;
99
+ AgentsMdGenerator.TARGET_FILE = 'AGENTS.md';
100
+ AgentsMdGenerator.START_MARKER = '<!-- CLAVIX:START -->';
101
+ AgentsMdGenerator.END_MARKER = '<!-- CLAVIX:END -->';
102
+ //# sourceMappingURL=agents-md-generator.js.map
@@ -0,0 +1,27 @@
1
+ import { BaseAdapter } from './base-adapter';
2
+ /**
3
+ * Amp adapter
4
+ * Commands stored in .agents/commands/ (simple markdown, no frontmatter)
5
+ * Supports executable commands (experimental)
6
+ */
7
+ export declare class AmpAdapter extends BaseAdapter {
8
+ readonly name = "amp";
9
+ readonly displayName = "Amp";
10
+ readonly directory = ".agents/commands";
11
+ readonly fileExtension = ".md";
12
+ readonly features: {
13
+ supportsSubdirectories: boolean;
14
+ supportsFrontmatter: boolean;
15
+ supportsExecutableCommands: boolean;
16
+ };
17
+ /**
18
+ * Detect if Amp is available in the project
19
+ */
20
+ detectProject(): Promise<boolean>;
21
+ /**
22
+ * Get command path for Amp
23
+ */
24
+ getCommandPath(): string;
25
+ getTargetFilename(name: string): string;
26
+ }
27
+ //# sourceMappingURL=amp-adapter.d.ts.map
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AmpAdapter = void 0;
4
+ const base_adapter_1 = require("./base-adapter");
5
+ const file_system_1 = require("../../utils/file-system");
6
+ /**
7
+ * Amp adapter
8
+ * Commands stored in .agents/commands/ (simple markdown, no frontmatter)
9
+ * Supports executable commands (experimental)
10
+ */
11
+ class AmpAdapter extends base_adapter_1.BaseAdapter {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.name = 'amp';
15
+ this.displayName = 'Amp';
16
+ this.directory = '.agents/commands';
17
+ this.fileExtension = '.md';
18
+ this.features = {
19
+ supportsSubdirectories: false,
20
+ supportsFrontmatter: false,
21
+ supportsExecutableCommands: true,
22
+ };
23
+ // Uses default formatCommand from BaseAdapter (no special formatting)
24
+ }
25
+ /**
26
+ * Detect if Amp is available in the project
27
+ */
28
+ async detectProject() {
29
+ return await file_system_1.FileSystem.exists('.agents');
30
+ }
31
+ /**
32
+ * Get command path for Amp
33
+ */
34
+ getCommandPath() {
35
+ return this.directory;
36
+ }
37
+ getTargetFilename(name) {
38
+ return `clavix-${name}${this.fileExtension}`;
39
+ }
40
+ }
41
+ exports.AmpAdapter = AmpAdapter;
42
+ //# sourceMappingURL=amp-adapter.js.map
@@ -0,0 +1,22 @@
1
+ import { BaseAdapter } from './base-adapter';
2
+ import { CommandTemplate } from '../../types/agent';
3
+ /**
4
+ * Augment CLI adapter
5
+ * Commands stored in .augment/commands/clavix with optional subdirectories
6
+ */
7
+ export declare class AugmentAdapter extends BaseAdapter {
8
+ readonly name = "augment";
9
+ readonly displayName = "Augment CLI";
10
+ readonly directory = ".augment/commands/clavix";
11
+ readonly fileExtension = ".md";
12
+ readonly features: {
13
+ supportsSubdirectories: boolean;
14
+ supportsFrontmatter: boolean;
15
+ frontmatterFields: string[];
16
+ };
17
+ detectProject(): Promise<boolean>;
18
+ getCommandPath(): string;
19
+ protected formatCommand(template: CommandTemplate): string;
20
+ private getHomeDir;
21
+ }
22
+ //# sourceMappingURL=augment-adapter.d.ts.map
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.AugmentAdapter = void 0;
37
+ const os = __importStar(require("os"));
38
+ const path = __importStar(require("path"));
39
+ const base_adapter_1 = require("./base-adapter");
40
+ const file_system_1 = require("../../utils/file-system");
41
+ /**
42
+ * Augment CLI adapter
43
+ * Commands stored in .augment/commands/clavix with optional subdirectories
44
+ */
45
+ class AugmentAdapter extends base_adapter_1.BaseAdapter {
46
+ constructor() {
47
+ super(...arguments);
48
+ this.name = 'augment';
49
+ this.displayName = 'Augment CLI';
50
+ this.directory = '.augment/commands/clavix';
51
+ this.fileExtension = '.md';
52
+ this.features = {
53
+ supportsSubdirectories: true,
54
+ supportsFrontmatter: true,
55
+ frontmatterFields: ['description', 'argument-hint', 'model'],
56
+ };
57
+ }
58
+ async detectProject() {
59
+ if (await file_system_1.FileSystem.exists('.augment')) {
60
+ return true;
61
+ }
62
+ const homeAugmentDir = path.join(this.getHomeDir(), '.augment');
63
+ return file_system_1.FileSystem.exists(homeAugmentDir);
64
+ }
65
+ getCommandPath() {
66
+ return this.directory;
67
+ }
68
+ formatCommand(template) {
69
+ const frontmatter = `---\ndescription: ${template.description}\nargument-hint: [prompt]\n---\n\n`;
70
+ return frontmatter + template.content;
71
+ }
72
+ getHomeDir() {
73
+ return process.env.CLAVIX_HOME_OVERRIDE || os.homedir();
74
+ }
75
+ }
76
+ exports.AugmentAdapter = AugmentAdapter;
77
+ //# sourceMappingURL=augment-adapter.js.map
@@ -0,0 +1,45 @@
1
+ import { AgentAdapter, CommandTemplate, ManagedBlock, ProviderFeatures, ValidationResult } from '../../types/agent';
2
+ /**
3
+ * Base adapter class with shared logic for all providers
4
+ * Ensures consistency and reduces code duplication
5
+ */
6
+ export declare abstract class BaseAdapter implements AgentAdapter {
7
+ abstract readonly name: string;
8
+ abstract readonly displayName: string;
9
+ abstract readonly directory: string;
10
+ abstract readonly fileExtension: string;
11
+ readonly features?: ProviderFeatures;
12
+ abstract detectProject(): Promise<boolean>;
13
+ abstract getCommandPath(): string;
14
+ /**
15
+ * Determine the target filename for a generated command
16
+ * Providers can override to customize filename conventions
17
+ */
18
+ getTargetFilename(name: string): string;
19
+ /**
20
+ * Default validation logic - can be overridden
21
+ * Checks if directory can be created and is writable
22
+ */
23
+ validate(): Promise<ValidationResult>;
24
+ /**
25
+ * Generate commands - default implementation
26
+ * Creates command files in the provider's directory
27
+ */
28
+ generateCommands(templates: CommandTemplate[]): Promise<void>;
29
+ /**
30
+ * Format command content for this provider
31
+ * Default: return content as-is
32
+ * Override for provider-specific formatting (frontmatter, placeholders, etc.)
33
+ */
34
+ protected formatCommand(template: CommandTemplate): string;
35
+ /**
36
+ * Default documentation injection - no-op
37
+ * Override if provider needs doc injection (like Claude Code)
38
+ */
39
+ injectDocumentation(_blocks: ManagedBlock[]): Promise<void>;
40
+ /**
41
+ * Escape special regex characters
42
+ */
43
+ protected escapeRegex(str: string): string;
44
+ }
45
+ //# sourceMappingURL=base-adapter.d.ts.map
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.BaseAdapter = void 0;
37
+ const path = __importStar(require("path"));
38
+ const file_system_1 = require("../../utils/file-system");
39
+ const errors_1 = require("../../types/errors");
40
+ /**
41
+ * Base adapter class with shared logic for all providers
42
+ * Ensures consistency and reduces code duplication
43
+ */
44
+ class BaseAdapter {
45
+ /**
46
+ * Determine the target filename for a generated command
47
+ * Providers can override to customize filename conventions
48
+ */
49
+ getTargetFilename(name) {
50
+ return `${name}${this.fileExtension}`;
51
+ }
52
+ /**
53
+ * Default validation logic - can be overridden
54
+ * Checks if directory can be created and is writable
55
+ */
56
+ async validate() {
57
+ const errors = [];
58
+ const warnings = [];
59
+ const commandPath = this.getCommandPath();
60
+ // Check if parent directory exists
61
+ const parentDir = path.dirname(commandPath);
62
+ if (!(await file_system_1.FileSystem.exists(parentDir))) {
63
+ // Check if we can create parent by finding first existing ancestor
64
+ let ancestorDir = parentDir;
65
+ let canCreate = false;
66
+ // Walk up the directory tree until we find an existing directory
67
+ while (ancestorDir !== '.' && ancestorDir !== '/' && ancestorDir.length > 0) {
68
+ ancestorDir = path.dirname(ancestorDir);
69
+ if (await file_system_1.FileSystem.exists(ancestorDir)) {
70
+ canCreate = true;
71
+ break;
72
+ }
73
+ }
74
+ // If we reached '.' or '/', it means we can create the directory
75
+ if (ancestorDir === '.' || ancestorDir === '/' || canCreate) {
76
+ warnings.push(`Parent directory ${parentDir} will be created`);
77
+ }
78
+ else {
79
+ errors.push(`Parent directory ${parentDir} does not exist and cannot be created`);
80
+ }
81
+ }
82
+ // Try to ensure directory exists
83
+ if (errors.length === 0) {
84
+ try {
85
+ await file_system_1.FileSystem.ensureDir(commandPath);
86
+ }
87
+ catch (error) {
88
+ errors.push(`Cannot create command directory: ${error}`);
89
+ }
90
+ }
91
+ return {
92
+ valid: errors.length === 0,
93
+ errors: errors.length > 0 ? errors : undefined,
94
+ warnings: warnings.length > 0 ? warnings : undefined,
95
+ };
96
+ }
97
+ /**
98
+ * Generate commands - default implementation
99
+ * Creates command files in the provider's directory
100
+ */
101
+ async generateCommands(templates) {
102
+ const commandPath = this.getCommandPath();
103
+ try {
104
+ // Ensure directory exists
105
+ await file_system_1.FileSystem.ensureDir(commandPath);
106
+ // Generate each command file
107
+ for (const template of templates) {
108
+ const content = this.formatCommand(template);
109
+ const filename = this.getTargetFilename(template.name);
110
+ const filePath = path.join(commandPath, filename);
111
+ await file_system_1.FileSystem.writeFileAtomic(filePath, content);
112
+ }
113
+ }
114
+ catch (error) {
115
+ throw new errors_1.IntegrationError(`Failed to generate ${this.displayName} commands: ${error}`, `Ensure ${commandPath} is writable`);
116
+ }
117
+ }
118
+ /**
119
+ * Format command content for this provider
120
+ * Default: return content as-is
121
+ * Override for provider-specific formatting (frontmatter, placeholders, etc.)
122
+ */
123
+ formatCommand(template) {
124
+ return template.content;
125
+ }
126
+ /**
127
+ * Default documentation injection - no-op
128
+ * Override if provider needs doc injection (like Claude Code)
129
+ */
130
+ async injectDocumentation(_blocks) {
131
+ // Default: no documentation injection
132
+ // Override in subclasses if needed
133
+ }
134
+ /**
135
+ * Escape special regex characters
136
+ */
137
+ escapeRegex(str) {
138
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
139
+ }
140
+ }
141
+ exports.BaseAdapter = BaseAdapter;
142
+ //# sourceMappingURL=base-adapter.js.map
@@ -0,0 +1,32 @@
1
+ import { BaseAdapter } from './base-adapter';
2
+ import { ManagedBlock } from '../../types/agent';
3
+ /**
4
+ * Claude Code agent adapter
5
+ */
6
+ export declare class ClaudeCodeAdapter extends BaseAdapter {
7
+ readonly name = "claude-code";
8
+ readonly displayName = "Claude Code";
9
+ readonly directory = ".claude/commands/clavix";
10
+ readonly fileExtension = ".md";
11
+ readonly features: {
12
+ supportsSubdirectories: boolean;
13
+ supportsFrontmatter: boolean;
14
+ };
15
+ /**
16
+ * Detect if Claude Code is available in the project
17
+ */
18
+ detectProject(): Promise<boolean>;
19
+ /**
20
+ * Get command path for Claude Code
21
+ */
22
+ getCommandPath(): string;
23
+ /**
24
+ * Inject documentation blocks into CLAUDE.md
25
+ */
26
+ injectDocumentation(blocks: ManagedBlock[]): Promise<void>;
27
+ /**
28
+ * Inject or update a managed block in a file
29
+ */
30
+ private injectManagedBlock;
31
+ }
32
+ //# sourceMappingURL=claude-code-adapter.d.ts.map
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ClaudeCodeAdapter = void 0;
37
+ const path = __importStar(require("path"));
38
+ const base_adapter_1 = require("./base-adapter");
39
+ const file_system_1 = require("../../utils/file-system");
40
+ const errors_1 = require("../../types/errors");
41
+ /**
42
+ * Claude Code agent adapter
43
+ */
44
+ class ClaudeCodeAdapter extends base_adapter_1.BaseAdapter {
45
+ constructor() {
46
+ super(...arguments);
47
+ this.name = 'claude-code';
48
+ this.displayName = 'Claude Code';
49
+ this.directory = '.claude/commands/clavix';
50
+ this.fileExtension = '.md';
51
+ this.features = {
52
+ supportsSubdirectories: true,
53
+ supportsFrontmatter: false,
54
+ };
55
+ // escapeRegex is inherited from BaseAdapter
56
+ }
57
+ /**
58
+ * Detect if Claude Code is available in the project
59
+ */
60
+ async detectProject() {
61
+ // Check if .claude directory exists
62
+ return await file_system_1.FileSystem.exists('.claude');
63
+ }
64
+ /**
65
+ * Get command path for Claude Code
66
+ */
67
+ getCommandPath() {
68
+ return this.directory;
69
+ }
70
+ // generateCommands is inherited from BaseAdapter
71
+ /**
72
+ * Inject documentation blocks into CLAUDE.md
73
+ */
74
+ async injectDocumentation(blocks) {
75
+ try {
76
+ for (const block of blocks) {
77
+ await this.injectManagedBlock(block.targetFile, block.content, block.startMarker, block.endMarker);
78
+ }
79
+ }
80
+ catch (error) {
81
+ throw new errors_1.IntegrationError(`Failed to inject documentation: ${error}`, 'Ensure target files are writable');
82
+ }
83
+ }
84
+ /**
85
+ * Inject or update a managed block in a file
86
+ */
87
+ async injectManagedBlock(filePath, content, startMarker, endMarker) {
88
+ const fullPath = path.resolve(filePath);
89
+ let fileContent = '';
90
+ // Read existing file or create new
91
+ if (await file_system_1.FileSystem.exists(fullPath)) {
92
+ fileContent = await file_system_1.FileSystem.readFile(fullPath);
93
+ }
94
+ else {
95
+ // Create parent directory if needed
96
+ const dir = path.dirname(fullPath);
97
+ await file_system_1.FileSystem.ensureDir(dir);
98
+ }
99
+ const blockRegex = new RegExp(`${this.escapeRegex(startMarker)}[\\s\\S]*?${this.escapeRegex(endMarker)}`, 'g');
100
+ const wrappedContent = `${startMarker}\n${content}\n${endMarker}`;
101
+ if (blockRegex.test(fileContent)) {
102
+ // Replace existing block
103
+ fileContent = fileContent.replace(blockRegex, wrappedContent);
104
+ }
105
+ else {
106
+ // Append new block
107
+ if (fileContent && !fileContent.endsWith('\n\n')) {
108
+ fileContent += '\n\n';
109
+ }
110
+ fileContent += wrappedContent + '\n';
111
+ }
112
+ await file_system_1.FileSystem.writeFileAtomic(fullPath, fileContent);
113
+ }
114
+ }
115
+ exports.ClaudeCodeAdapter = ClaudeCodeAdapter;
116
+ //# sourceMappingURL=claude-code-adapter.js.map
@@ -0,0 +1,34 @@
1
+ import { BaseAdapter } from './base-adapter';
2
+ /**
3
+ * Cline adapter
4
+ * Workflows stored in .cline/workflows/ (flat structure, no subdirectories)
5
+ * Slash command format: /<name.md> (includes .md extension with leading slash)
6
+ *
7
+ * Features:
8
+ * - Lives alongside Cline Rules
9
+ * - Clear step-by-step instructions in markdown
10
+ * - Supports built-in tools, CLI utilities, and MCP integrations
11
+ *
12
+ * Reference: https://docs.cline.bot/features/slash-commands/workflows
13
+ */
14
+ export declare class ClineAdapter extends BaseAdapter {
15
+ readonly name = "cline";
16
+ readonly displayName = "Cline";
17
+ readonly directory = ".clinerules/workflows";
18
+ readonly fileExtension = ".md";
19
+ readonly features: {
20
+ supportsSubdirectories: boolean;
21
+ supportsFrontmatter: boolean;
22
+ };
23
+ /**
24
+ * Detect if Cline is available in the project
25
+ * Checks for .cline directory
26
+ */
27
+ detectProject(): Promise<boolean>;
28
+ /**
29
+ * Get command path for Cline
30
+ */
31
+ getCommandPath(): string;
32
+ getTargetFilename(name: string): string;
33
+ }
34
+ //# sourceMappingURL=cline-adapter.d.ts.map