clavix 5.4.0 → 5.5.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.
- package/README.md +54 -97
- package/dist/cli/commands/init.js +33 -10
- package/dist/core/adapters/base-adapter.d.ts +0 -5
- package/dist/core/adapters/base-adapter.js +3 -10
- package/dist/core/adapters/claude-code-adapter.js +2 -1
- package/dist/core/adapters/universal-adapter.d.ts +1 -0
- package/dist/core/adapters/universal-adapter.js +9 -0
- package/dist/core/agent-manager.d.ts +5 -0
- package/dist/core/agent-manager.js +20 -30
- package/dist/core/doc-injector.js +2 -1
- package/dist/utils/template-loader.js +3 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,65 +1,27 @@
|
|
|
1
1
|
# Clavix
|
|
2
|
-
> Agentic-first prompt workflows. Markdown templates that teach AI agents how to optimize prompts, create PRDs, and manage implementation. Works with Claude Code, Cursor, Windsurf, and 19+ other AI coding tools.
|
|
3
|
-
|
|
4
|
-
## Table of contents
|
|
5
|
-
- [Why Clavix?](#why-clavix)
|
|
6
|
-
- [How It Works](#how-it-works)
|
|
7
|
-
- [Supported AI Tools](#supported-ai-tools)
|
|
8
|
-
- [Quickstart](#quickstart)
|
|
9
|
-
- [Full documentation](#full-documentation)
|
|
10
|
-
|
|
11
|
-
## Release Notes
|
|
12
|
-
|
|
13
|
-
| Version | Highlights | Details |
|
|
14
|
-
| --- | --- | --- |
|
|
15
|
-
| **v5.2.1** (Latest) | Diagnose command, DRY architecture, feature matrix | [Changelog](CHANGELOG.md) |
|
|
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
|
-
|
|
19
|
-
**Requirements:** Node.js >= 18.0.0
|
|
20
|
-
|
|
21
|
-
## Why Clavix?
|
|
22
|
-
|
|
23
|
-
Better prompts lead to better code. Clavix provides **markdown templates** that teach AI agents how to:
|
|
24
|
-
- **Optimize prompts** - Transform rough ideas into structured, AI-ready prompts
|
|
25
|
-
- **Create PRDs** - Generate comprehensive requirements documents through guided questions
|
|
26
|
-
- **Plan implementations** - Break down PRDs into phased task lists
|
|
27
|
-
- **Track progress** - Manage task completion with optional git commits
|
|
28
|
-
|
|
29
|
-
**No framework to learn.** Just describe what you want, and your AI agent follows the Clavix templates to structure it properly.
|
|
30
|
-
|
|
31
|
-
Learn more in [docs/why-clavix.md](docs/why-clavix.md).
|
|
32
2
|
|
|
33
|
-
|
|
3
|
+
> Agentic-first prompt workflows. Markdown templates that teach AI agents how to optimize prompts, create PRDs, and manage implementation. Works with Claude Code, Cursor, Windsurf, and 19+ other AI coding tools.
|
|
34
4
|
|
|
35
|
-
|
|
5
|
+
## Quick Links
|
|
36
6
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
7
|
+
| I want to... | Go to |
|
|
8
|
+
|--------------|-------|
|
|
9
|
+
| Get started | [Quickstart](#quickstart) |
|
|
10
|
+
| See all commands | [docs/commands.md](docs/commands.md) |
|
|
11
|
+
| Understand the architecture | [docs/architecture.md](docs/architecture.md) |
|
|
12
|
+
| Check integrations | [docs/integrations.md](docs/integrations.md) |
|
|
13
|
+
| Contribute | [CONTRIBUTING.md](CONTRIBUTING.md) |
|
|
42
14
|
|
|
43
|
-
|
|
15
|
+
## Command Format
|
|
44
16
|
|
|
45
|
-
|
|
17
|
+
**Your command format depends on your AI tool:**
|
|
46
18
|
|
|
47
|
-
|
|
|
48
|
-
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
| Universal adapters | AGENTS.md, GitHub Copilot, OCTO.md, WARP.md |
|
|
19
|
+
| Tool Type | Format | Example |
|
|
20
|
+
|-----------|--------|---------|
|
|
21
|
+
| **CLI tools** (Claude Code, Gemini, Qwen) | Colon (`:`) | `/clavix:improve` |
|
|
22
|
+
| **IDE extensions** (Cursor, Windsurf, Cline) | Hyphen (`-`) | `/clavix-improve` |
|
|
52
23
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
| Feature | Claude Code | Cursor/Windsurf | Gemini/Qwen | Generic Agents |
|
|
56
|
-
|---------|-------------|-----------------|-------------|----------------|
|
|
57
|
-
| Slash commands | ✅ Native | ✅ Native | ✅ TOML | ❌ Read-only |
|
|
58
|
-
| Doc injection | ✅ CLAUDE.md | ✅ .cursor/rules | ✅ N/A | ✅ AGENTS.md |
|
|
59
|
-
| Namespace dirs | ✅ clavix/ | ✅ clavix/ | ✅ clavix/ | N/A |
|
|
60
|
-
| Auto-detection | ✅ Yes | ✅ Yes | ✅ Yes | N/A |
|
|
61
|
-
|
|
62
|
-
Full list and configuration: [docs/integrations.md](docs/integrations.md)
|
|
24
|
+
**Rule of thumb:** CLI tools use colon, IDE extensions use hyphen.
|
|
63
25
|
|
|
64
26
|
## Quickstart
|
|
65
27
|
|
|
@@ -70,81 +32,76 @@ npm install -g clavix
|
|
|
70
32
|
clavix init
|
|
71
33
|
```
|
|
72
34
|
|
|
73
|
-
This creates `.clavix/` with slash command templates and injects documentation into your CLAUDE.md (or equivalent).
|
|
74
|
-
|
|
75
35
|
### 2. Use Slash Commands
|
|
76
36
|
|
|
77
|
-
In your AI coding assistant (Claude Code, Cursor, etc.):
|
|
78
|
-
|
|
79
37
|
```
|
|
80
38
|
/clavix:improve "Create a secure login page with JWT"
|
|
81
39
|
```
|
|
82
40
|
|
|
83
|
-
The AI agent reads the
|
|
84
|
-
- Analyzes your prompt for quality
|
|
85
|
-
- Applies optimization patterns
|
|
86
|
-
- Saves the improved version to `.clavix/outputs/prompts/`
|
|
41
|
+
The AI agent reads the template and optimizes your prompt.
|
|
87
42
|
|
|
88
43
|
### 3. Choose Your Workflow
|
|
89
44
|
|
|
90
|
-
**Core Workflows:**
|
|
91
45
|
| Command | When to Use |
|
|
92
46
|
|---------|-------------|
|
|
93
|
-
| `/clavix:improve` | Optimize a single prompt
|
|
47
|
+
| `/clavix:improve` | Optimize a single prompt |
|
|
94
48
|
| `/clavix:prd` | Plan something new with guided questions |
|
|
95
|
-
| `/clavix:start` | Explore ideas conversationally first |
|
|
96
49
|
| `/clavix:plan` | Generate tasks from a PRD |
|
|
97
50
|
| `/clavix:implement` | Execute tasks with progress tracking |
|
|
98
|
-
| `/clavix:summarize` | Extract requirements from conversation |
|
|
99
51
|
|
|
100
|
-
|
|
101
|
-
| Utility | Purpose |
|
|
102
|
-
|---------|---------|
|
|
103
|
-
| `/clavix:verify` | Check implementation against PRD requirements |
|
|
104
|
-
| `/clavix:archive` | Archive completed projects to `.clavix/archive/` |
|
|
52
|
+
See [Getting Started](docs/getting-started.md) for the full guide.
|
|
105
53
|
|
|
106
|
-
|
|
54
|
+
## How It Works
|
|
107
55
|
|
|
108
|
-
|
|
56
|
+
Clavix is **agentic-first**:
|
|
109
57
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
58
|
+
1. **You run `clavix init`** - Sets up slash command templates
|
|
59
|
+
2. **You invoke a slash command** - Like `/clavix:improve`
|
|
60
|
+
3. **AI agent reads the template** - Markdown instructions
|
|
61
|
+
4. **Agent follows instructions** - Using its native tools
|
|
62
|
+
5. **Output is saved** - To `.clavix/outputs/`
|
|
113
63
|
|
|
114
|
-
|
|
64
|
+
**No TypeScript executes during slash commands.** The markdown templates ARE the product.
|
|
115
65
|
|
|
116
|
-
|
|
66
|
+
See [Architecture](docs/architecture.md) for details.
|
|
67
|
+
|
|
68
|
+
## Supported AI Tools
|
|
69
|
+
|
|
70
|
+
| Category | Tools |
|
|
71
|
+
|----------|-------|
|
|
72
|
+
| IDE extensions | Cursor, Windsurf, Kilocode, Roocode, Cline |
|
|
73
|
+
| CLI agents | Claude Code, Gemini CLI, Qwen Code, Droid CLI, CodeBuddy, OpenCode, LLXPRT, Amp, Crush CLI, Codex CLI, Augment CLI |
|
|
74
|
+
| Universal | AGENTS.md, GitHub Copilot, OCTO.md, WARP.md |
|
|
75
|
+
|
|
76
|
+
Full list: [docs/integrations.md](docs/integrations.md)
|
|
77
|
+
|
|
78
|
+
## CLI Commands
|
|
117
79
|
|
|
118
80
|
| Command | Purpose |
|
|
119
81
|
|---------|---------|
|
|
120
|
-
| `clavix init` | Initialize
|
|
121
|
-
| `clavix update` |
|
|
122
|
-
| `clavix diagnose` | Check installation
|
|
82
|
+
| `clavix init` | Initialize Clavix in a project |
|
|
83
|
+
| `clavix update` | Regenerate templates |
|
|
84
|
+
| `clavix diagnose` | Check installation |
|
|
123
85
|
| `clavix version` | Show version |
|
|
124
86
|
|
|
125
|
-
|
|
87
|
+
All workflows (`/clavix:improve`, etc.) are **slash commands** that AI agents execute.
|
|
126
88
|
|
|
127
|
-
##
|
|
128
|
-
- Overview & navigation: [docs/README.md](docs/README.md)
|
|
129
|
-
- Integrations: [docs/integrations.md](docs/integrations.md)
|
|
130
|
-
- How it works: [docs/how-it-works.md](docs/how-it-works.md)
|
|
131
|
-
- Philosophy: [docs/philosophy.md](docs/philosophy.md)
|
|
132
|
-
- v4 Architecture (archived): [docs/archive/v4-architecture.md](docs/archive/v4-architecture.md)
|
|
89
|
+
## Documentation
|
|
133
90
|
|
|
134
|
-
|
|
91
|
+
- [Getting Started](docs/getting-started.md) - Installation and first workflow
|
|
92
|
+
- [Commands Reference](docs/commands.md) - All commands in one place
|
|
93
|
+
- [Architecture](docs/architecture.md) - How Clavix works
|
|
94
|
+
- [Integrations](docs/integrations.md) - Full tool matrix
|
|
95
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md) - Contribute to Clavix
|
|
135
96
|
|
|
136
|
-
|
|
137
|
-
- **Node.js >= 18.0.0**
|
|
138
|
-
- npm or yarn package manager
|
|
139
|
-
- An AI coding assistant (Claude Code, Cursor, Windsurf, etc.)
|
|
97
|
+
## Requirements
|
|
140
98
|
|
|
141
|
-
### For Contributors
|
|
142
99
|
- **Node.js >= 18.0.0**
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
- Build: `npm run build`
|
|
100
|
+
- npm or yarn
|
|
101
|
+
- An AI coding tool (Claude Code, Cursor, etc.)
|
|
146
102
|
|
|
147
103
|
## License
|
|
104
|
+
|
|
148
105
|
Apache-2.0
|
|
149
106
|
|
|
150
107
|
## Star History
|
|
@@ -272,18 +272,30 @@ export default class Init extends Command {
|
|
|
272
272
|
await InstructionsGenerator.generate();
|
|
273
273
|
console.log(chalk.gray(' ✓ Created detailed workflow guides for generic integrations'));
|
|
274
274
|
}
|
|
275
|
-
// Success message
|
|
276
|
-
// v4.11: Use generic command names - format varies by integration
|
|
277
|
-
// (claude-code uses colon like /clavix:improve, droid uses hyphen like /clavix-improve)
|
|
275
|
+
// Success message with prominent command format display
|
|
278
276
|
console.log(chalk.bold.green('\n✅ Clavix initialized successfully!\n'));
|
|
279
|
-
|
|
277
|
+
// Determine the primary command format based on selected integrations
|
|
278
|
+
const colonTools = ['claude-code', 'gemini', 'qwen', 'crush', 'llxprt', 'augment'];
|
|
279
|
+
const usesColon = selectedIntegrations.some((i) => colonTools.includes(i));
|
|
280
|
+
const usesHyphen = selectedIntegrations.some((i) => !colonTools.includes(i));
|
|
281
|
+
const separator = usesColon && !usesHyphen ? ':' : usesHyphen && !usesColon ? '-' : ':';
|
|
282
|
+
const altSeparator = separator === ':' ? '-' : ':';
|
|
283
|
+
// Show command format prominently at the TOP
|
|
284
|
+
console.log(chalk.bold('📋 Your command format:'), chalk.bold.cyan(`/clavix${separator}improve`));
|
|
285
|
+
if (usesColon && usesHyphen) {
|
|
286
|
+
console.log(chalk.gray(' (Some integrations use'), chalk.cyan(`/clavix${altSeparator}improve`), chalk.gray('instead)'));
|
|
287
|
+
}
|
|
288
|
+
console.log();
|
|
289
|
+
// Available commands
|
|
290
|
+
console.log(chalk.gray('Available slash commands:'));
|
|
291
|
+
console.log(chalk.gray(' •'), chalk.cyan(`/clavix${separator}improve`), chalk.gray('- Smart prompt optimization'));
|
|
292
|
+
console.log(chalk.gray(' •'), chalk.cyan(`/clavix${separator}prd`), chalk.gray('- Generate PRD through guided questions'));
|
|
293
|
+
console.log(chalk.gray(' •'), chalk.cyan(`/clavix${separator}plan`), chalk.gray('- Create task breakdown from PRD'));
|
|
294
|
+
console.log(chalk.gray(' •'), chalk.cyan(`/clavix${separator}implement`), chalk.gray('- Execute tasks or prompts'));
|
|
295
|
+
console.log(chalk.gray('\nNext steps:'));
|
|
280
296
|
console.log(chalk.gray(' • Slash commands are now available in your AI agent'));
|
|
281
|
-
console.log(chalk.gray(' • Run'), chalk.cyan('clavix
|
|
282
|
-
console.log(
|
|
283
|
-
console.log(chalk.gray(' ◦'), chalk.cyan('improve'), chalk.gray('- Smart prompt optimization with auto depth selection'));
|
|
284
|
-
console.log(chalk.gray(' ◦'), chalk.cyan('prd'), chalk.gray('- Generate PRD through guided questions'));
|
|
285
|
-
console.log(chalk.gray(' ◦'), chalk.cyan('execute'), chalk.gray('- Run saved prompts'));
|
|
286
|
-
console.log(chalk.gray('\n Command format varies by integration (colon vs hyphen)\n'));
|
|
297
|
+
console.log(chalk.gray(' • Run'), chalk.cyan('clavix diagnose'), chalk.gray('to verify installation'));
|
|
298
|
+
console.log();
|
|
287
299
|
}
|
|
288
300
|
catch (error) {
|
|
289
301
|
const { getErrorMessage, toError } = await import('../../utils/error-utils.js');
|
|
@@ -378,6 +390,17 @@ export default class Init extends Command {
|
|
|
378
390
|
|
|
379
391
|
Welcome to Clavix! This directory contains your local Clavix configuration and data.
|
|
380
392
|
|
|
393
|
+
## Command Format
|
|
394
|
+
|
|
395
|
+
**Your command format depends on your AI tool:**
|
|
396
|
+
|
|
397
|
+
| Tool Type | Format | Example |
|
|
398
|
+
|-----------|--------|---------|
|
|
399
|
+
| **CLI tools** (Claude Code, Gemini, Qwen) | Colon (\`:\`) | \`/clavix:improve\` |
|
|
400
|
+
| **IDE extensions** (Cursor, Windsurf, Cline) | Hyphen (\`-\`) | \`/clavix-improve\` |
|
|
401
|
+
|
|
402
|
+
**Rule of thumb:** CLI tools use colon, IDE extensions use hyphen.
|
|
403
|
+
|
|
381
404
|
## Directory Structure
|
|
382
405
|
|
|
383
406
|
\`\`\`
|
|
@@ -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 {
|
|
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
|
-
|
|
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
|
-
|
|
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(`${
|
|
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
|
|
25
|
-
this.registerAdapter(new ClaudeCodeAdapter());
|
|
26
|
-
this.registerAdapter(new
|
|
27
|
-
this.registerAdapter(new
|
|
28
|
-
this.registerAdapter(new
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
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
|
-
//
|
|
43
|
-
|
|
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
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavix",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.1",
|
|
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",
|