clavix 4.8.0 → 4.8.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.
@@ -13,6 +13,9 @@ export declare class AmpAdapter extends BaseAdapter {
13
13
  supportsSubdirectories: boolean;
14
14
  supportsFrontmatter: boolean;
15
15
  supportsExecutableCommands: boolean;
16
+ commandFormat: {
17
+ separator: "-";
18
+ };
16
19
  };
17
20
  /**
18
21
  * Detect if Amp is available in the project
@@ -14,6 +14,7 @@ export class AmpAdapter extends BaseAdapter {
14
14
  supportsSubdirectories: false,
15
15
  supportsFrontmatter: false,
16
16
  supportsExecutableCommands: true,
17
+ commandFormat: { separator: '-' },
17
18
  };
18
19
  /**
19
20
  * Detect if Amp is available in the project
@@ -19,6 +19,9 @@ export declare class ClineAdapter extends BaseAdapter {
19
19
  readonly features: {
20
20
  supportsSubdirectories: boolean;
21
21
  supportsFrontmatter: boolean;
22
+ commandFormat: {
23
+ separator: "-";
24
+ };
22
25
  };
23
26
  /**
24
27
  * Detect if Cline is available in the project
@@ -20,6 +20,7 @@ export class ClineAdapter extends BaseAdapter {
20
20
  features = {
21
21
  supportsSubdirectories: false,
22
22
  supportsFrontmatter: false,
23
+ commandFormat: { separator: '-' },
23
24
  };
24
25
  /**
25
26
  * Detect if Cline is available in the project
@@ -14,6 +14,9 @@ export declare class CodeBuddyAdapter extends BaseAdapter {
14
14
  supportsFrontmatter: boolean;
15
15
  argumentPlaceholder: string;
16
16
  frontmatterFields: string[];
17
+ commandFormat: {
18
+ separator: "-";
19
+ };
17
20
  };
18
21
  detectProject(): Promise<boolean>;
19
22
  getCommandPath(): string;
@@ -16,6 +16,7 @@ export class CodeBuddyAdapter extends BaseAdapter {
16
16
  supportsFrontmatter: true,
17
17
  argumentPlaceholder: '$1',
18
18
  frontmatterFields: ['description', 'argument-hint'],
19
+ commandFormat: { separator: '-' },
19
20
  };
20
21
  async detectProject() {
21
22
  if (await FileSystem.exists('.codebuddy')) {
@@ -14,6 +14,9 @@ export declare class CodexAdapter extends BaseAdapter {
14
14
  supportsFrontmatter: boolean;
15
15
  argumentPlaceholder: string;
16
16
  frontmatterFields: string[];
17
+ commandFormat: {
18
+ separator: "-";
19
+ };
17
20
  };
18
21
  detectProject(): Promise<boolean>;
19
22
  getCommandPath(): string;
@@ -16,6 +16,7 @@ export class CodexAdapter extends BaseAdapter {
16
16
  supportsFrontmatter: true,
17
17
  argumentPlaceholder: '$ARGUMENTS',
18
18
  frontmatterFields: ['description', 'argument-hint'],
19
+ commandFormat: { separator: '-' },
19
20
  };
20
21
  async detectProject() {
21
22
  const codexDir = path.join(this.getHomeDir(), '.codex');
@@ -11,6 +11,9 @@ export declare class CursorAdapter extends BaseAdapter {
11
11
  readonly features: {
12
12
  supportsSubdirectories: boolean;
13
13
  supportsFrontmatter: boolean;
14
+ commandFormat: {
15
+ separator: "-";
16
+ };
14
17
  };
15
18
  /**
16
19
  * Detect if Cursor is available in the project
@@ -12,6 +12,7 @@ export class CursorAdapter extends BaseAdapter {
12
12
  features = {
13
13
  supportsSubdirectories: false,
14
14
  supportsFrontmatter: false,
15
+ commandFormat: { separator: '-' },
15
16
  };
16
17
  /**
17
18
  * Detect if Cursor is available in the project
@@ -15,6 +15,9 @@ export declare class DroidAdapter extends BaseAdapter {
15
15
  supportsFrontmatter: boolean;
16
16
  frontmatterFields: string[];
17
17
  argumentPlaceholder: string;
18
+ commandFormat: {
19
+ separator: "-";
20
+ };
18
21
  };
19
22
  /**
20
23
  * Detect if Droid CLI is available in the project
@@ -15,6 +15,7 @@ export class DroidAdapter extends BaseAdapter {
15
15
  supportsFrontmatter: true,
16
16
  frontmatterFields: ['description', 'argument-hint'],
17
17
  argumentPlaceholder: '$ARGUMENTS',
18
+ commandFormat: { separator: '-' },
18
19
  };
19
20
  /**
20
21
  * Detect if Droid CLI is available in the project
@@ -1,5 +1,6 @@
1
1
  import { FileSystem } from '../../utils/file-system.js';
2
2
  import { TemplateAssembler } from '../template-assembler.js';
3
+ import { CommandTransformer } from '../command-transformer.js';
3
4
  import * as path from 'path';
4
5
  import { fileURLToPath } from 'url';
5
6
  import { dirname } from 'path';
@@ -79,17 +80,23 @@ export class InstructionsGenerator {
79
80
  // Copy all .md files from canonical, resolving includes
80
81
  const entries = await FileSystem.readdir(canonicalPath, { withFileTypes: true });
81
82
  const mdFiles = entries.filter((f) => f.isFile() && f.name.endsWith('.md'));
83
+ // v4.8.1: Generic integrations use hyphen format for slash commands
84
+ const genericFeatures = { commandFormat: { separator: '-' } };
82
85
  for (const file of mdFiles) {
83
86
  const destPath = path.join(workflowsTarget, file.name);
84
87
  try {
85
88
  // v4.5: Use TemplateAssembler to resolve {{INCLUDE:}} markers
86
89
  const result = await assembler.assembleTemplate(file.name);
87
- await FileSystem.writeFileAtomic(destPath, result.content);
90
+ // v4.8.1: Transform command references to hyphen format for generic integrations
91
+ const transformedContent = CommandTransformer.transform(result.content, genericFeatures);
92
+ await FileSystem.writeFileAtomic(destPath, transformedContent);
88
93
  }
89
94
  catch {
90
95
  // Fallback: copy without include resolution if assembly fails
91
96
  const srcPath = path.join(canonicalPath, file.name);
92
- const content = await FileSystem.readFile(srcPath);
97
+ let content = await FileSystem.readFile(srcPath);
98
+ // v4.8.1: Still transform command references in fallback path
99
+ content = CommandTransformer.transform(content, genericFeatures);
93
100
  await FileSystem.writeFileAtomic(destPath, content);
94
101
  }
95
102
  }
@@ -19,6 +19,9 @@ export declare class KilocodeAdapter extends BaseAdapter {
19
19
  readonly features: {
20
20
  supportsSubdirectories: boolean;
21
21
  supportsFrontmatter: boolean;
22
+ commandFormat: {
23
+ separator: "-";
24
+ };
22
25
  };
23
26
  /**
24
27
  * Detect if Kilocode is available in the project
@@ -20,6 +20,7 @@ export class KilocodeAdapter extends BaseAdapter {
20
20
  features = {
21
21
  supportsSubdirectories: false,
22
22
  supportsFrontmatter: false,
23
+ commandFormat: { separator: '-' },
23
24
  };
24
25
  /**
25
26
  * Detect if Kilocode is available in the project
@@ -15,6 +15,9 @@ export declare class OpenCodeAdapter extends BaseAdapter {
15
15
  supportsFrontmatter: boolean;
16
16
  frontmatterFields: string[];
17
17
  argumentPlaceholder: string;
18
+ commandFormat: {
19
+ separator: "-";
20
+ };
18
21
  };
19
22
  /**
20
23
  * Detect if OpenCode is available in the project
@@ -15,6 +15,7 @@ export class OpenCodeAdapter extends BaseAdapter {
15
15
  supportsFrontmatter: true,
16
16
  frontmatterFields: ['description', 'agent', 'model'],
17
17
  argumentPlaceholder: '$ARGUMENTS',
18
+ commandFormat: { separator: '-' },
18
19
  };
19
20
  /**
20
21
  * Detect if OpenCode is available in the project
@@ -20,6 +20,9 @@ export declare class RoocodeAdapter extends BaseAdapter {
20
20
  readonly features: {
21
21
  supportsSubdirectories: boolean;
22
22
  supportsFrontmatter: boolean;
23
+ commandFormat: {
24
+ separator: "-";
25
+ };
23
26
  };
24
27
  /**
25
28
  * Detect if Roocode is available in the project
@@ -20,6 +20,7 @@ export class RoocodeAdapter extends BaseAdapter {
20
20
  features = {
21
21
  supportsSubdirectories: false,
22
22
  supportsFrontmatter: true,
23
+ commandFormat: { separator: '-' },
23
24
  };
24
25
  /**
25
26
  * Detect if Roocode is available in the project
@@ -19,6 +19,9 @@ export declare class WindsurfAdapter extends BaseAdapter {
19
19
  readonly features: {
20
20
  supportsSubdirectories: boolean;
21
21
  supportsFrontmatter: boolean;
22
+ commandFormat: {
23
+ separator: "-";
24
+ };
22
25
  };
23
26
  /**
24
27
  * Detect if Windsurf is available in the project
@@ -20,6 +20,7 @@ export class WindsurfAdapter extends BaseAdapter {
20
20
  features = {
21
21
  supportsSubdirectories: true,
22
22
  supportsFrontmatter: false,
23
+ commandFormat: { separator: '-' },
23
24
  };
24
25
  /**
25
26
  * Detect if Windsurf is available in the project
@@ -0,0 +1,55 @@
1
+ import { IntegrationFeatures } from '../types/agent.js';
2
+ /**
3
+ * CommandTransformer - Transforms slash command references in template content
4
+ *
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)
8
+ *
9
+ * Preserves CLI commands (clavix prompts list) unchanged - only transforms
10
+ * slash commands that start with /clavix:
11
+ *
12
+ * @since v4.8.1
13
+ */
14
+ export declare class CommandTransformer {
15
+ /**
16
+ * Matches /clavix:commandname pattern
17
+ * Supports hyphenated commands like task-complete
18
+ * Does NOT match CLI usage (no leading slash)
19
+ */
20
+ private static readonly SLASH_COMMAND_PATTERN;
21
+ /** Default command format (canonical/Claude Code style) */
22
+ private static readonly DEFAULT_SEPARATOR;
23
+ /**
24
+ * Transform slash command references in content based on adapter's command format
25
+ *
26
+ * @param content - Template content with canonical /clavix:command references
27
+ * @param features - Adapter's integration features (may include commandFormat)
28
+ * @returns Transformed content with correct command format
29
+ *
30
+ * @example
31
+ * // For Cursor/Droid (hyphen format):
32
+ * transform('/clavix:fast', { commandFormat: { separator: '-' } })
33
+ * // Returns: '/clavix-fast'
34
+ *
35
+ * @example
36
+ * // For Claude Code (colon format, default):
37
+ * transform('/clavix:fast', { commandFormat: { separator: ':' } })
38
+ * // Returns: '/clavix:fast' (unchanged)
39
+ */
40
+ static transform(content: string, features?: IntegrationFeatures): string;
41
+ /**
42
+ * Get the formatted command name for a specific adapter
43
+ * Useful for generating documentation or references
44
+ *
45
+ * @param commandName - Base command name (e.g., 'fast', 'execute', 'task-complete')
46
+ * @param features - Adapter's integration features
47
+ * @returns Formatted slash command (e.g., '/clavix:fast' or '/clavix-fast')
48
+ *
49
+ * @example
50
+ * formatCommand('execute', { commandFormat: { separator: '-' } })
51
+ * // Returns: '/clavix-execute'
52
+ */
53
+ static formatCommand(commandName: string, features?: IntegrationFeatures): string;
54
+ }
55
+ //# sourceMappingURL=command-transformer.d.ts.map
@@ -0,0 +1,65 @@
1
+ /**
2
+ * CommandTransformer - Transforms slash command references in template content
3
+ *
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)
7
+ *
8
+ * Preserves CLI commands (clavix prompts list) unchanged - only transforms
9
+ * slash commands that start with /clavix:
10
+ *
11
+ * @since v4.8.1
12
+ */
13
+ export class CommandTransformer {
14
+ /**
15
+ * Matches /clavix:commandname pattern
16
+ * Supports hyphenated commands like task-complete
17
+ * Does NOT match CLI usage (no leading slash)
18
+ */
19
+ static SLASH_COMMAND_PATTERN = /\/clavix:(\w+(?:-\w+)*)/g;
20
+ /** Default command format (canonical/Claude Code style) */
21
+ static DEFAULT_SEPARATOR = ':';
22
+ /**
23
+ * Transform slash command references in content based on adapter's command format
24
+ *
25
+ * @param content - Template content with canonical /clavix:command references
26
+ * @param features - Adapter's integration features (may include commandFormat)
27
+ * @returns Transformed content with correct command format
28
+ *
29
+ * @example
30
+ * // For Cursor/Droid (hyphen format):
31
+ * transform('/clavix:fast', { commandFormat: { separator: '-' } })
32
+ * // Returns: '/clavix-fast'
33
+ *
34
+ * @example
35
+ * // For Claude Code (colon format, default):
36
+ * transform('/clavix:fast', { commandFormat: { separator: ':' } })
37
+ * // Returns: '/clavix:fast' (unchanged)
38
+ */
39
+ static transform(content, features) {
40
+ const separator = features?.commandFormat?.separator ?? this.DEFAULT_SEPARATOR;
41
+ // If using canonical format (colon), no transformation needed
42
+ if (separator === ':') {
43
+ return content;
44
+ }
45
+ // Transform /clavix:command to /clavix-command (or other separator)
46
+ return content.replace(this.SLASH_COMMAND_PATTERN, `/clavix${separator}$1`);
47
+ }
48
+ /**
49
+ * Get the formatted command name for a specific adapter
50
+ * Useful for generating documentation or references
51
+ *
52
+ * @param commandName - Base command name (e.g., 'fast', 'execute', 'task-complete')
53
+ * @param features - Adapter's integration features
54
+ * @returns Formatted slash command (e.g., '/clavix:fast' or '/clavix-fast')
55
+ *
56
+ * @example
57
+ * formatCommand('execute', { commandFormat: { separator: '-' } })
58
+ * // Returns: '/clavix-execute'
59
+ */
60
+ static formatCommand(commandName, features) {
61
+ const separator = features?.commandFormat?.separator ?? this.DEFAULT_SEPARATOR;
62
+ return `/clavix${separator}${commandName}`;
63
+ }
64
+ }
65
+ //# sourceMappingURL=command-transformer.js.map
@@ -21,6 +21,10 @@ export interface IntegrationFeatures {
21
21
  supportsSubdirectories?: boolean;
22
22
  argumentPlaceholder?: string;
23
23
  frontmatterFields?: string[];
24
+ /** Command format for slash command references in templates. Default: colon (:) */
25
+ commandFormat?: {
26
+ separator: ':' | '-';
27
+ };
24
28
  }
25
29
  /**
26
30
  * @deprecated Use IntegrationFeatures instead. Will be removed in v4.0.0
@@ -1,3 +1,3 @@
1
1
  import { AgentAdapter, CommandTemplate } from '../types/agent.js';
2
- export declare function loadCommandTemplates(_adapter: AgentAdapter): Promise<CommandTemplate[]>;
2
+ export declare function loadCommandTemplates(adapter: AgentAdapter): Promise<CommandTemplate[]>;
3
3
  //# sourceMappingURL=template-loader.d.ts.map
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'url';
3
3
  import { dirname } from 'path';
4
4
  import { FileSystem } from './file-system.js';
5
5
  import { TemplateAssembler } from '../core/template-assembler.js';
6
+ import { CommandTransformer } from '../core/command-transformer.js';
6
7
  const __filename = fileURLToPath(import.meta.url);
7
8
  const __dirname = dirname(__filename);
8
9
  // v4.0: Singleton assembler instance for caching
@@ -14,7 +15,7 @@ function getAssembler() {
14
15
  }
15
16
  return assemblerInstance;
16
17
  }
17
- export async function loadCommandTemplates(_adapter) {
18
+ export async function loadCommandTemplates(adapter) {
18
19
  // Load from canonical template source (always .md files)
19
20
  const templatesDir = getCanonicalTemplatesDirectory();
20
21
  const files = await FileSystem.listFiles(templatesDir);
@@ -42,6 +43,9 @@ export async function loadCommandTemplates(_adapter) {
42
43
  console.warn(`Template assembly warning for ${file}:`, error);
43
44
  }
44
45
  }
46
+ // v4.8.1: Transform command references based on adapter format
47
+ // Converts /clavix:command to /clavix-command for flat-file integrations
48
+ content = CommandTransformer.transform(content, adapter.features);
45
49
  // Clean content from markdown
46
50
  const cleanContent = stripFrontmatter(content);
47
51
  templates.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavix",
3
- "version": "4.8.0",
3
+ "version": "4.8.1",
4
4
  "description": "Clavix Intelligence™ for AI coding. Automatically optimizes prompts with intent detection, quality assessment, and adaptive patterns—no framework to learn. Works with Claude Code, Cursor, Windsurf, and 19+ other AI coding tools.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",