clavix 5.4.0 → 5.5.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.
package/README.md CHANGED
@@ -12,9 +12,8 @@
12
12
 
13
13
  | Version | Highlights | Details |
14
14
  | --- | --- | --- |
15
- | **v5.2.1** (Latest) | Diagnose command, DRY architecture, feature matrix | [Changelog](CHANGELOG.md) |
15
+ | **v5.5.0** (Latest) | Architecture cleanup, consolidated adapters, documentation overhaul | [Changelog](CHANGELOG.md) |
16
16
  | **v5.0.0** | Agentic-first architecture - lean template delivery | [Changelog](CHANGELOG.md#500---2025-01-27) |
17
- | **v4.12.0** | Final v4 release with full CLI commands | [Changelog](docs/archive/v4-changelog.md) |
18
17
 
19
18
  **Requirements:** Node.js >= 18.0.0
20
19
 
@@ -129,7 +128,6 @@ Clavix v5 has 4 CLI commands (for setup and diagnostics, not workflows):
129
128
  - Integrations: [docs/integrations.md](docs/integrations.md)
130
129
  - How it works: [docs/how-it-works.md](docs/how-it-works.md)
131
130
  - Philosophy: [docs/philosophy.md](docs/philosophy.md)
132
- - v4 Architecture (archived): [docs/archive/v4-architecture.md](docs/archive/v4-architecture.md)
133
131
 
134
132
  ## Requirements
135
133
 
@@ -50,10 +50,5 @@ export declare abstract class BaseAdapter implements AgentAdapter {
50
50
  * Override if integration needs doc injection (like Claude Code)
51
51
  */
52
52
  injectDocumentation(_blocks: ManagedBlock[]): Promise<void>;
53
- /**
54
- * Escape special regex characters
55
- * @deprecated Use escapeRegex from utils/string-utils.js directly
56
- */
57
- protected escapeRegex(str: string): string;
58
53
  }
59
54
  //# sourceMappingURL=base-adapter.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import * as path from 'path';
2
2
  import { FileSystem } from '../../utils/file-system.js';
3
3
  import { IntegrationError } from '../../types/errors.js';
4
- import { escapeRegex } from '../../utils/string-utils.js';
4
+ import { logger } from '../../utils/logger.js';
5
5
  /**
6
6
  * Base adapter class with shared logic for all integrations
7
7
  * Ensures consistency and reduces code duplication
@@ -82,7 +82,7 @@ export class BaseAdapter {
82
82
  }
83
83
  catch (error) {
84
84
  // Log warning but continue with other files
85
- console.warn(`Failed to remove ${filePath}: ${error}`);
85
+ logger.warn(`Failed to remove ${filePath}: ${error}`);
86
86
  }
87
87
  }
88
88
  // Also remove clavix/ subdirectory if it exists (legacy cleanup)
@@ -93,7 +93,7 @@ export class BaseAdapter {
93
93
  removed++;
94
94
  }
95
95
  catch (error) {
96
- console.warn(`Failed to remove ${clavixSubdir}: ${error}`);
96
+ logger.warn(`Failed to remove ${clavixSubdir}: ${error}`);
97
97
  }
98
98
  }
99
99
  return removed;
@@ -145,12 +145,5 @@ export class BaseAdapter {
145
145
  // Default: no documentation injection
146
146
  // Override in subclasses if needed
147
147
  }
148
- /**
149
- * Escape special regex characters
150
- * @deprecated Use escapeRegex from utils/string-utils.js directly
151
- */
152
- escapeRegex(str) {
153
- return escapeRegex(str);
154
- }
155
148
  }
156
149
  //# sourceMappingURL=base-adapter.js.map
@@ -2,6 +2,7 @@ import * as path from 'path';
2
2
  import { BaseAdapter } from './base-adapter.js';
3
3
  import { FileSystem } from '../../utils/file-system.js';
4
4
  import { IntegrationError } from '../../types/errors.js';
5
+ import { escapeRegex } from '../../utils/string-utils.js';
5
6
  /**
6
7
  * Claude Code agent adapter
7
8
  */
@@ -65,7 +66,7 @@ export class ClaudeCodeAdapter extends BaseAdapter {
65
66
  const dir = path.dirname(fullPath);
66
67
  await FileSystem.ensureDir(dir);
67
68
  }
68
- const blockRegex = new RegExp(`${this.escapeRegex(startMarker)}[\\s\\S]*?${this.escapeRegex(endMarker)}`, 'g');
69
+ const blockRegex = new RegExp(`${escapeRegex(startMarker)}[\\s\\S]*?${escapeRegex(endMarker)}`, 'g');
69
70
  const wrappedContent = `${startMarker}\n${content}\n${endMarker}`;
70
71
  if (blockRegex.test(fileContent)) {
71
72
  // Replace existing block
@@ -15,6 +15,7 @@ import { AdapterConfig } from '../../types/adapter-config.js';
15
15
  import { IntegrationFeatures } from '../../types/agent.js';
16
16
  export declare class UniversalAdapter extends BaseAdapter {
17
17
  private config;
18
+ readonly features: IntegrationFeatures;
18
19
  constructor(config: AdapterConfig);
19
20
  get name(): string;
20
21
  get displayName(): string;
@@ -14,9 +14,18 @@ import { BaseAdapter } from './base-adapter.js';
14
14
  import * as path from 'path';
15
15
  export class UniversalAdapter extends BaseAdapter {
16
16
  config;
17
+ features;
17
18
  constructor(config) {
18
19
  super();
19
20
  this.config = config;
21
+ // Set features from config for interface compatibility
22
+ this.features = {
23
+ supportsSubdirectories: config.features.supportsSubdirectories,
24
+ supportsFrontmatter: config.features.supportsFrontmatter,
25
+ commandFormat: {
26
+ separator: config.features.commandSeparator,
27
+ },
28
+ };
20
29
  }
21
30
  get name() {
22
31
  return this.config.name;
@@ -1,6 +1,11 @@
1
1
  import { AgentAdapter, ValidationResult } from '../types/agent.js';
2
2
  /**
3
3
  * Agent Manager - handles agent detection and registration
4
+ *
5
+ * Uses factory pattern with ADAPTER_CONFIGS for simple adapters,
6
+ * while keeping dedicated classes for special adapters (TOML, doc injection).
7
+ *
8
+ * @since v5.5.0 - Refactored to use config-driven factory pattern
4
9
  */
5
10
  export declare class AgentManager {
6
11
  private adapters;
@@ -1,43 +1,33 @@
1
1
  import { ClaudeCodeAdapter } from './adapters/claude-code-adapter.js';
2
- import { CursorAdapter } from './adapters/cursor-adapter.js';
3
- import { DroidAdapter } from './adapters/droid-adapter.js';
4
- import { OpenCodeAdapter } from './adapters/opencode-adapter.js';
5
- import { AmpAdapter } from './adapters/amp-adapter.js';
6
- import { CrushAdapter } from './adapters/crush-adapter.js';
7
- import { WindsurfAdapter } from './adapters/windsurf-adapter.js';
8
- import { KilocodeAdapter } from './adapters/kilocode-adapter.js';
9
- import { ClineAdapter } from './adapters/cline-adapter.js';
10
- import { RoocodeAdapter } from './adapters/roocode-adapter.js';
11
- import { IntegrationError } from '../types/errors.js';
12
- import { CodeBuddyAdapter } from './adapters/codebuddy-adapter.js';
13
2
  import { GeminiAdapter } from './adapters/gemini-adapter.js';
14
3
  import { QwenAdapter } from './adapters/qwen-adapter.js';
15
- import { CodexAdapter } from './adapters/codex-adapter.js';
16
- import { AugmentAdapter } from './adapters/augment-adapter.js';
17
4
  import { LlxprtAdapter } from './adapters/llxprt-adapter.js';
5
+ import { UniversalAdapter } from './adapters/universal-adapter.js';
6
+ import { getSimpleAdapters } from './adapter-registry.js';
7
+ import { IntegrationError } from '../types/errors.js';
18
8
  /**
19
9
  * Agent Manager - handles agent detection and registration
10
+ *
11
+ * Uses factory pattern with ADAPTER_CONFIGS for simple adapters,
12
+ * while keeping dedicated classes for special adapters (TOML, doc injection).
13
+ *
14
+ * @since v5.5.0 - Refactored to use config-driven factory pattern
20
15
  */
21
16
  export class AgentManager {
22
17
  adapters = new Map();
23
18
  constructor() {
24
- // Register all built-in adapters
25
- this.registerAdapter(new ClaudeCodeAdapter());
26
- this.registerAdapter(new CursorAdapter());
27
- this.registerAdapter(new DroidAdapter());
28
- this.registerAdapter(new OpenCodeAdapter());
29
- this.registerAdapter(new AmpAdapter());
30
- this.registerAdapter(new CrushAdapter());
31
- this.registerAdapter(new WindsurfAdapter());
32
- this.registerAdapter(new KilocodeAdapter());
33
- this.registerAdapter(new LlxprtAdapter());
34
- this.registerAdapter(new ClineAdapter());
35
- this.registerAdapter(new RoocodeAdapter());
36
- this.registerAdapter(new AugmentAdapter());
37
- this.registerAdapter(new CodeBuddyAdapter());
38
- this.registerAdapter(new GeminiAdapter());
39
- this.registerAdapter(new QwenAdapter());
40
- this.registerAdapter(new CodexAdapter());
19
+ // Register special adapters (require custom logic)
20
+ this.registerAdapter(new ClaudeCodeAdapter()); // Doc injection
21
+ this.registerAdapter(new GeminiAdapter()); // TOML format
22
+ this.registerAdapter(new QwenAdapter()); // TOML format
23
+ this.registerAdapter(new LlxprtAdapter()); // TOML format
24
+ // Register simple adapters from config (using UniversalAdapter factory)
25
+ for (const config of getSimpleAdapters()) {
26
+ // Skip adapters that have special handlers registered above
27
+ if (this.adapters.has(config.name))
28
+ continue;
29
+ this.registerAdapter(new UniversalAdapter(config));
30
+ }
41
31
  }
42
32
  /**
43
33
  * Register a new agent adapter
@@ -2,6 +2,7 @@ import * as path from 'path';
2
2
  import { FileSystem } from '../utils/file-system.js';
3
3
  import { DataError } from '../types/errors.js';
4
4
  import { escapeRegex } from '../utils/string-utils.js';
5
+ import { logger } from '../utils/logger.js';
5
6
  /**
6
7
  * DocInjector - manages injection and updating of managed blocks in documentation files
7
8
  */
@@ -124,7 +125,7 @@ export class DocInjector {
124
125
  const openBrackets = (content.match(/\[/g) || []).length;
125
126
  const closeBrackets = (content.match(/\]/g) || []).length;
126
127
  if (openBrackets !== closeBrackets) {
127
- console.warn('Warning: Unbalanced brackets in markdown');
128
+ logger.warn('Unbalanced brackets in markdown');
128
129
  }
129
130
  }
130
131
  /**
@@ -4,6 +4,7 @@ import { dirname } from 'path';
4
4
  import { FileSystem } from './file-system.js';
5
5
  import { TemplateAssembler } from '../core/template-assembler.js';
6
6
  import { CommandTransformer } from '../core/command-transformer.js';
7
+ import { DataError } from '../types/errors.js';
7
8
  const __filename = fileURLToPath(import.meta.url);
8
9
  const __dirname = dirname(__filename);
9
10
  // v4.0: Singleton assembler instance for caching
@@ -39,8 +40,8 @@ export async function loadCommandTemplates(adapter) {
39
40
  content = result.content;
40
41
  }
41
42
  catch (error) {
42
- // If assembly fails, use original content
43
- console.warn(`Template assembly warning for ${file}:`, error);
43
+ // Template assembly failures are critical - throw typed error
44
+ throw new DataError(`Template assembly failed for ${file}: ${error}`, `Check that all {{INCLUDE:}} references exist in templates directory`);
44
45
  }
45
46
  }
46
47
  // v4.8.1: Transform command references based on adapter format
@@ -126,5 +126,5 @@
126
126
  ]
127
127
  }
128
128
  },
129
- "version": "5.4.0"
129
+ "version": "5.5.0"
130
130
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavix",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "description": "Agentic-first prompt workflows. Markdown templates that teach AI agents how to optimize prompts, create PRDs, and manage implementation.\n\nSLASH COMMANDS (in your AI assistant):\n /clavix:improve Optimize prompts with auto-depth\n /clavix:prd Generate PRD through questions\n /clavix:plan Create task breakdown from PRD\n /clavix:implement Execute tasks with progress tracking\n /clavix:start Begin conversational session\n /clavix:summarize Extract requirements from conversation\n\nWorks with Claude Code, Cursor, Windsurf, and 19+ other AI coding tools.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",