clavix 6.1.2 → 6.2.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/dist/cli/commands/init.js +48 -0
- package/dist/core/adapters/agent-skills-adapter.d.ts +96 -0
- package/dist/core/adapters/agent-skills-adapter.js +235 -0
- package/dist/core/adapters/universal-adapter.d.ts +10 -0
- package/dist/core/adapters/universal-adapter.js +26 -0
- package/dist/core/agent-manager.js +4 -0
- package/dist/templates/agents/agents 5.md +200 -0
- package/dist/templates/agents/octo 4.md +237 -0
- package/dist/templates/skills/archive.md +319 -0
- package/dist/templates/skills/implement.md +397 -0
- package/dist/templates/skills/improve.md +341 -0
- package/dist/templates/skills/plan.md +289 -0
- package/dist/templates/skills/prd.md +345 -0
- package/dist/templates/skills/refine.md +271 -0
- package/dist/templates/skills/review.md +339 -0
- package/dist/templates/skills/start.md +276 -0
- package/dist/templates/skills/summarize.md +343 -0
- package/dist/templates/skills/verify.md +310 -0
- package/dist/templates/slash-commands/_canonical/archive.md +1 -1
- package/dist/templates/slash-commands/_canonical/implement.md +1 -1
- package/dist/templates/slash-commands/_canonical/improve.md +1 -1
- package/dist/templates/slash-commands/_canonical/plan.md +1 -1
- package/dist/templates/slash-commands/_canonical/prd.md +1 -1
- package/dist/templates/slash-commands/_canonical/refine.md +1 -1
- package/dist/templates/slash-commands/_canonical/review.md +1 -1
- package/dist/templates/slash-commands/_canonical/start.md +1 -1
- package/dist/templates/slash-commands/_canonical/summarize.md +1 -1
- package/dist/templates/slash-commands/_canonical/verify.md +1 -1
- package/dist/types/agent.d.ts +1 -1
- package/dist/types/skill.d.ts +88 -0
- package/dist/types/skill.js +18 -0
- package/dist/utils/integration-selector.d.ts +13 -0
- package/dist/utils/integration-selector.js +26 -0
- package/dist/utils/schemas.d.ts +22 -22
- package/dist/utils/skill-template-loader.d.ts +18 -0
- package/dist/utils/skill-template-loader.js +101 -0
- package/package.json +1 -1
|
@@ -16,6 +16,8 @@ import { DEFAULT_CONFIG } from '../../types/config.js';
|
|
|
16
16
|
import { GeminiAdapter } from '../../core/adapters/gemini-adapter.js';
|
|
17
17
|
import { QwenAdapter } from '../../core/adapters/qwen-adapter.js';
|
|
18
18
|
import { loadCommandTemplates } from '../../utils/template-loader.js';
|
|
19
|
+
import { loadSkillTemplates } from '../../utils/skill-template-loader.js';
|
|
20
|
+
import { isAgentSkillsIntegration } from '../../utils/integration-selector.js';
|
|
19
21
|
import { CLAVIX_BLOCK_START, CLAVIX_BLOCK_END } from '../../constants.js';
|
|
20
22
|
import { validateUserConfig } from '../../utils/schemas.js';
|
|
21
23
|
export default class Init extends Command {
|
|
@@ -288,6 +290,33 @@ export default class Init extends Command {
|
|
|
288
290
|
await WarpMdGenerator.generate();
|
|
289
291
|
continue;
|
|
290
292
|
}
|
|
293
|
+
// Handle Agent Skills integrations
|
|
294
|
+
if (isAgentSkillsIntegration(integrationName)) {
|
|
295
|
+
const adapter = agentManager.requireAdapter(integrationName);
|
|
296
|
+
const scope = integrationName === 'agent-skills-global' ? 'global' : 'project';
|
|
297
|
+
const location = scope === 'global' ? '~/.config/agents/skills/' : '.skills/';
|
|
298
|
+
this.log(chalk.gray(` ✓ Generating ${adapter.displayName}...`));
|
|
299
|
+
// Validate before generating
|
|
300
|
+
if (adapter.validate) {
|
|
301
|
+
const validation = await adapter.validate();
|
|
302
|
+
if (validation.warnings?.length) {
|
|
303
|
+
for (const warning of validation.warnings) {
|
|
304
|
+
this.log(chalk.yellow(` ⚠ ${warning}`));
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
// Remove existing skills
|
|
309
|
+
const removed = await adapter.removeAllCommands();
|
|
310
|
+
if (removed > 0) {
|
|
311
|
+
this.log(chalk.gray(` Removed ${removed} existing skill(s)`));
|
|
312
|
+
}
|
|
313
|
+
// Generate skills using skill templates
|
|
314
|
+
const skillTemplates = await loadSkillTemplates();
|
|
315
|
+
await adapter.generateCommands(skillTemplates);
|
|
316
|
+
this.log(chalk.gray(` Created ${skillTemplates.length} skills in ${location}`));
|
|
317
|
+
this.log(chalk.gray(' Skills: clavix-improve, clavix-prd, clavix-plan, clavix-implement, ...'));
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
291
320
|
let adapter = agentManager.requireAdapter(integrationName);
|
|
292
321
|
this.log(chalk.gray(` ✓ Generating ${adapter.displayName} commands...`));
|
|
293
322
|
if (adapter.name === 'codex') {
|
|
@@ -436,6 +465,25 @@ export default class Init extends Command {
|
|
|
436
465
|
await WarpMdGenerator.generate();
|
|
437
466
|
continue;
|
|
438
467
|
}
|
|
468
|
+
// Handle Agent Skills integrations
|
|
469
|
+
if (isAgentSkillsIntegration(integrationName)) {
|
|
470
|
+
const adapter = agentManager.getAdapter(integrationName);
|
|
471
|
+
if (!adapter) {
|
|
472
|
+
this.log(chalk.yellow(` ⚠ Unknown integration: ${integrationName}`));
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
this.log(chalk.gray(` ✓ Regenerating ${adapter.displayName}...`));
|
|
476
|
+
// Remove existing skills
|
|
477
|
+
const removed = await adapter.removeAllCommands();
|
|
478
|
+
if (removed > 0) {
|
|
479
|
+
this.log(chalk.gray(` Removed ${removed} existing skill(s)`));
|
|
480
|
+
}
|
|
481
|
+
// Generate skills using skill templates
|
|
482
|
+
const skillTemplates = await loadSkillTemplates();
|
|
483
|
+
await adapter.generateCommands(skillTemplates);
|
|
484
|
+
this.log(chalk.gray(` Regenerated ${skillTemplates.length} skills`));
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
439
487
|
// Handle regular adapters
|
|
440
488
|
const adapter = agentManager.getAdapter(integrationName);
|
|
441
489
|
if (!adapter) {
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Skills Adapter
|
|
3
|
+
*
|
|
4
|
+
* Generates Agent Skills (per agentskills.io specification) from Clavix templates.
|
|
5
|
+
* Skills are directory-based with SKILL.md + optional references/scripts/assets.
|
|
6
|
+
*
|
|
7
|
+
* Supports both global (~/.config/agents/skills) and project-level (.skills) installation.
|
|
8
|
+
*
|
|
9
|
+
* @since v6.2.0
|
|
10
|
+
*/
|
|
11
|
+
import { BaseAdapter } from './base-adapter.js';
|
|
12
|
+
import { CommandTemplate, IntegrationFeatures } from '../../types/agent.js';
|
|
13
|
+
import { SkillScope } from '../../types/skill.js';
|
|
14
|
+
import { ClavixConfig } from '../../types/config.js';
|
|
15
|
+
export declare class AgentSkillsAdapter extends BaseAdapter {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly displayName: string;
|
|
18
|
+
readonly fileExtension = ".md";
|
|
19
|
+
readonly features: IntegrationFeatures;
|
|
20
|
+
private scope;
|
|
21
|
+
private customPath?;
|
|
22
|
+
protected readonly userConfig?: ClavixConfig;
|
|
23
|
+
constructor(scope?: SkillScope, userConfig?: ClavixConfig);
|
|
24
|
+
/**
|
|
25
|
+
* Get the skill installation scope
|
|
26
|
+
*/
|
|
27
|
+
get installScope(): SkillScope;
|
|
28
|
+
/**
|
|
29
|
+
* Get the directory path based on scope
|
|
30
|
+
*/
|
|
31
|
+
get directory(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Expand tilde in path to home directory
|
|
34
|
+
*/
|
|
35
|
+
private expandPath;
|
|
36
|
+
/**
|
|
37
|
+
* Get full path to skills directory
|
|
38
|
+
*/
|
|
39
|
+
getCommandPath(): string;
|
|
40
|
+
/**
|
|
41
|
+
* Skills use directory names, not filenames
|
|
42
|
+
* Returns the skill directory name (e.g., 'clavix-improve')
|
|
43
|
+
*/
|
|
44
|
+
getTargetFilename(name: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Detect if skills environment is available
|
|
47
|
+
* For global: check if ~/.config/agents/skills directory exists
|
|
48
|
+
* For project: check if .skills directory exists
|
|
49
|
+
*/
|
|
50
|
+
detectProject(): Promise<boolean>;
|
|
51
|
+
/**
|
|
52
|
+
* Generate skills from command templates
|
|
53
|
+
* Creates directory structure per agentskills.io spec:
|
|
54
|
+
* <skill-name>/
|
|
55
|
+
* ├── SKILL.md
|
|
56
|
+
* └── references/
|
|
57
|
+
* └── <reference-files>.md
|
|
58
|
+
*/
|
|
59
|
+
generateCommands(templates: CommandTemplate[]): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Generate a single skill directory from a command template
|
|
62
|
+
*/
|
|
63
|
+
private generateSkill;
|
|
64
|
+
/**
|
|
65
|
+
* Format template content as SKILL.md with proper frontmatter
|
|
66
|
+
*/
|
|
67
|
+
private formatSkillContent;
|
|
68
|
+
/**
|
|
69
|
+
* Generate skill description optimized for agent discovery
|
|
70
|
+
* Descriptions should explain what the skill does AND when to use it
|
|
71
|
+
*/
|
|
72
|
+
private generateSkillDescription;
|
|
73
|
+
/**
|
|
74
|
+
* Remove all Clavix-generated skills
|
|
75
|
+
* Skills are directories matching 'clavix-*' pattern
|
|
76
|
+
*/
|
|
77
|
+
removeAllCommands(): Promise<number>;
|
|
78
|
+
/**
|
|
79
|
+
* Determine if an entry is a Clavix-generated skill
|
|
80
|
+
* Skills are directories starting with 'clavix-'
|
|
81
|
+
*/
|
|
82
|
+
protected isClavixGeneratedCommand(name: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Validate skills directory
|
|
85
|
+
*/
|
|
86
|
+
validate(): Promise<{
|
|
87
|
+
valid: boolean;
|
|
88
|
+
errors?: string[];
|
|
89
|
+
warnings?: string[];
|
|
90
|
+
}>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Factory function to create adapter with scope
|
|
94
|
+
*/
|
|
95
|
+
export declare function createAgentSkillsAdapter(scope: SkillScope, userConfig?: ClavixConfig): AgentSkillsAdapter;
|
|
96
|
+
//# sourceMappingURL=agent-skills-adapter.d.ts.map
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Skills Adapter
|
|
3
|
+
*
|
|
4
|
+
* Generates Agent Skills (per agentskills.io specification) from Clavix templates.
|
|
5
|
+
* Skills are directory-based with SKILL.md + optional references/scripts/assets.
|
|
6
|
+
*
|
|
7
|
+
* Supports both global (~/.config/agents/skills) and project-level (.skills) installation.
|
|
8
|
+
*
|
|
9
|
+
* @since v6.2.0
|
|
10
|
+
*/
|
|
11
|
+
import * as path from 'path';
|
|
12
|
+
import * as os from 'os';
|
|
13
|
+
import { BaseAdapter } from './base-adapter.js';
|
|
14
|
+
import { SKILL_PATHS } from '../../types/skill.js';
|
|
15
|
+
import { FileSystem } from '../../utils/file-system.js';
|
|
16
|
+
import { IntegrationError } from '../../types/errors.js';
|
|
17
|
+
import { logger } from '../../utils/logger.js';
|
|
18
|
+
export class AgentSkillsAdapter extends BaseAdapter {
|
|
19
|
+
name;
|
|
20
|
+
displayName;
|
|
21
|
+
fileExtension = '.md';
|
|
22
|
+
features = {
|
|
23
|
+
supportsSubdirectories: true,
|
|
24
|
+
commandFormat: { separator: '-' },
|
|
25
|
+
};
|
|
26
|
+
scope;
|
|
27
|
+
customPath;
|
|
28
|
+
userConfig;
|
|
29
|
+
constructor(scope = 'global', userConfig) {
|
|
30
|
+
super();
|
|
31
|
+
this.scope = scope;
|
|
32
|
+
this.userConfig = userConfig;
|
|
33
|
+
// Set name and displayName based on scope
|
|
34
|
+
this.name = scope === 'global' ? 'agent-skills-global' : 'agent-skills-project';
|
|
35
|
+
this.displayName = scope === 'global' ? 'Agent Skills (Global)' : 'Agent Skills (Project)';
|
|
36
|
+
// Check for custom path in user config
|
|
37
|
+
const configKey = scope === 'global' ? 'agent-skills-global' : 'agent-skills-project';
|
|
38
|
+
if (userConfig?.experimental?.integrationPaths?.[configKey]) {
|
|
39
|
+
this.customPath = userConfig.experimental.integrationPaths[configKey];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get the skill installation scope
|
|
44
|
+
*/
|
|
45
|
+
get installScope() {
|
|
46
|
+
return this.scope;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get the directory path based on scope
|
|
50
|
+
*/
|
|
51
|
+
get directory() {
|
|
52
|
+
if (this.customPath) {
|
|
53
|
+
return this.customPath;
|
|
54
|
+
}
|
|
55
|
+
return this.scope === 'global' ? SKILL_PATHS.global : SKILL_PATHS.project;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Expand tilde in path to home directory
|
|
59
|
+
*/
|
|
60
|
+
expandPath(p) {
|
|
61
|
+
if (p.startsWith('~/')) {
|
|
62
|
+
return path.join(os.homedir(), p.slice(2));
|
|
63
|
+
}
|
|
64
|
+
return p;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get full path to skills directory
|
|
68
|
+
*/
|
|
69
|
+
getCommandPath() {
|
|
70
|
+
const dir = this.directory;
|
|
71
|
+
if (dir.startsWith('~/') || this.scope === 'global') {
|
|
72
|
+
return this.expandPath(dir);
|
|
73
|
+
}
|
|
74
|
+
return path.join(process.cwd(), dir);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Skills use directory names, not filenames
|
|
78
|
+
* Returns the skill directory name (e.g., 'clavix-improve')
|
|
79
|
+
*/
|
|
80
|
+
getTargetFilename(name) {
|
|
81
|
+
return `clavix-${name}`;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Detect if skills environment is available
|
|
85
|
+
* For global: check if ~/.config/agents/skills directory exists
|
|
86
|
+
* For project: check if .skills directory exists
|
|
87
|
+
*/
|
|
88
|
+
async detectProject() {
|
|
89
|
+
const skillsPath = this.getCommandPath();
|
|
90
|
+
// Check if the skills directory itself exists (not parent)
|
|
91
|
+
return FileSystem.exists(skillsPath);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Generate skills from command templates
|
|
95
|
+
* Creates directory structure per agentskills.io spec:
|
|
96
|
+
* <skill-name>/
|
|
97
|
+
* ├── SKILL.md
|
|
98
|
+
* └── references/
|
|
99
|
+
* └── <reference-files>.md
|
|
100
|
+
*/
|
|
101
|
+
async generateCommands(templates) {
|
|
102
|
+
const skillsPath = this.getCommandPath();
|
|
103
|
+
try {
|
|
104
|
+
// Ensure base directory exists
|
|
105
|
+
await FileSystem.ensureDir(skillsPath);
|
|
106
|
+
// Convert command templates to skill format and generate
|
|
107
|
+
for (const template of templates) {
|
|
108
|
+
await this.generateSkill(template, skillsPath);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
throw new IntegrationError(`Failed to generate Agent Skills: ${error}`, `Ensure ${skillsPath} is writable`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Generate a single skill directory from a command template
|
|
117
|
+
*/
|
|
118
|
+
async generateSkill(template, basePath) {
|
|
119
|
+
const skillName = `clavix-${template.name}`;
|
|
120
|
+
const skillDir = path.join(basePath, skillName);
|
|
121
|
+
// Ensure skill directory exists
|
|
122
|
+
await FileSystem.ensureDir(skillDir);
|
|
123
|
+
// Generate SKILL.md with proper frontmatter
|
|
124
|
+
const skillContent = this.formatSkillContent(template, skillName);
|
|
125
|
+
await FileSystem.writeFileAtomic(path.join(skillDir, 'SKILL.md'), skillContent);
|
|
126
|
+
// Note: References are embedded in the skill template itself
|
|
127
|
+
// The skill templates are pre-assembled with all content
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Format template content as SKILL.md with proper frontmatter
|
|
131
|
+
*/
|
|
132
|
+
formatSkillContent(template, skillName) {
|
|
133
|
+
// Create description optimized for skill discovery
|
|
134
|
+
const description = this.generateSkillDescription(template.name, template.description);
|
|
135
|
+
// Build frontmatter per agentskills.io spec
|
|
136
|
+
const frontmatter = [
|
|
137
|
+
'---',
|
|
138
|
+
`name: ${skillName}`,
|
|
139
|
+
`description: ${description}`,
|
|
140
|
+
'license: Apache-2.0',
|
|
141
|
+
'---',
|
|
142
|
+
'',
|
|
143
|
+
].join('\n');
|
|
144
|
+
return frontmatter + template.content;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Generate skill description optimized for agent discovery
|
|
148
|
+
* Descriptions should explain what the skill does AND when to use it
|
|
149
|
+
*/
|
|
150
|
+
generateSkillDescription(name, baseDescription) {
|
|
151
|
+
const descriptionMap = {
|
|
152
|
+
improve: 'Analyze and optimize prompts using 6-dimension quality assessment (Clarity, Efficiency, Structure, Completeness, Actionability, Specificity). Use when you need to improve a prompt before implementation.',
|
|
153
|
+
prd: 'Create comprehensive Product Requirements Documents through strategic questioning. Use when planning a new feature or project that needs clear requirements.',
|
|
154
|
+
plan: 'Transform PRD documents into actionable task breakdowns with dependencies. Use after creating a PRD to generate implementation tasks.',
|
|
155
|
+
implement: 'Execute implementation tasks or saved prompts with progress tracking. Use when ready to build what was planned in PRD or improved prompts.',
|
|
156
|
+
start: 'Begin conversational exploration to discover requirements through natural discussion. Use when ideas are vague and need refinement through dialogue.',
|
|
157
|
+
summarize: 'Extract structured requirements from conversations into mini-PRD format. Use after conversational exploration to capture what was discussed.',
|
|
158
|
+
refine: 'Iterate on existing PRDs or improved prompts to enhance quality. Use when you have a draft that needs further refinement.',
|
|
159
|
+
verify: 'Verify implementation against PRD requirements with systematic checking. Use after implementation to validate completeness.',
|
|
160
|
+
review: 'Review code changes with criteria-driven analysis (Security, Architecture, Standards, Performance). Use when reviewing PRs or code changes.',
|
|
161
|
+
archive: 'Archive completed projects by moving outputs to archive directory. Use when a project is complete and ready for archival.',
|
|
162
|
+
};
|
|
163
|
+
return descriptionMap[name] || baseDescription;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Remove all Clavix-generated skills
|
|
167
|
+
* Skills are directories matching 'clavix-*' pattern
|
|
168
|
+
*/
|
|
169
|
+
async removeAllCommands() {
|
|
170
|
+
const skillsPath = this.getCommandPath();
|
|
171
|
+
// If directory doesn't exist, nothing to remove
|
|
172
|
+
if (!(await FileSystem.exists(skillsPath))) {
|
|
173
|
+
return 0;
|
|
174
|
+
}
|
|
175
|
+
const entries = await FileSystem.listFiles(skillsPath);
|
|
176
|
+
const clavixSkills = entries.filter((entry) => this.isClavixGeneratedCommand(entry));
|
|
177
|
+
let removed = 0;
|
|
178
|
+
for (const skillName of clavixSkills) {
|
|
179
|
+
const skillDir = path.join(skillsPath, skillName);
|
|
180
|
+
try {
|
|
181
|
+
// Remove entire skill directory
|
|
182
|
+
await FileSystem.remove(skillDir);
|
|
183
|
+
removed++;
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
logger.warn(`Failed to remove skill ${skillDir}: ${error}`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return removed;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Determine if an entry is a Clavix-generated skill
|
|
193
|
+
* Skills are directories starting with 'clavix-'
|
|
194
|
+
*/
|
|
195
|
+
isClavixGeneratedCommand(name) {
|
|
196
|
+
return name.startsWith('clavix-');
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Validate skills directory
|
|
200
|
+
*/
|
|
201
|
+
async validate() {
|
|
202
|
+
const errors = [];
|
|
203
|
+
const warnings = [];
|
|
204
|
+
const skillsPath = this.getCommandPath();
|
|
205
|
+
const parentDir = path.dirname(skillsPath);
|
|
206
|
+
// Check if parent directory exists
|
|
207
|
+
if (!(await FileSystem.exists(parentDir))) {
|
|
208
|
+
if (this.scope === 'global') {
|
|
209
|
+
warnings.push(`Global skills directory ${parentDir} will be created`);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
warnings.push(`Project skills directory will be created`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Try to ensure directory exists
|
|
216
|
+
try {
|
|
217
|
+
await FileSystem.ensureDir(skillsPath);
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
errors.push(`Cannot create skills directory: ${error}`);
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
valid: errors.length === 0,
|
|
224
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
225
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Factory function to create adapter with scope
|
|
231
|
+
*/
|
|
232
|
+
export function createAgentSkillsAdapter(scope, userConfig) {
|
|
233
|
+
return new AgentSkillsAdapter(scope, userConfig);
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=agent-skills-adapter.js.map
|
|
@@ -48,5 +48,15 @@ export declare class UniversalAdapter extends BaseAdapter {
|
|
|
48
48
|
* Check if this adapter supports subdirectories
|
|
49
49
|
*/
|
|
50
50
|
supportsSubdirectories(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Determine if a file is a Clavix-generated command
|
|
53
|
+
*
|
|
54
|
+
* Uses the filenamePattern from config to identify Clavix files.
|
|
55
|
+
* This prevents removal of user's existing command files.
|
|
56
|
+
*
|
|
57
|
+
* For pattern 'clavix-{name}' → matches 'clavix-*.md'
|
|
58
|
+
* For pattern '{name}' → matches '*.md' (all files with extension)
|
|
59
|
+
*/
|
|
60
|
+
protected isClavixGeneratedCommand(filename: string): boolean;
|
|
51
61
|
}
|
|
52
62
|
//# sourceMappingURL=universal-adapter.d.ts.map
|
|
@@ -100,5 +100,31 @@ export class UniversalAdapter extends BaseAdapter {
|
|
|
100
100
|
supportsSubdirectories() {
|
|
101
101
|
return this.config.features.supportsSubdirectories;
|
|
102
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Determine if a file is a Clavix-generated command
|
|
105
|
+
*
|
|
106
|
+
* Uses the filenamePattern from config to identify Clavix files.
|
|
107
|
+
* This prevents removal of user's existing command files.
|
|
108
|
+
*
|
|
109
|
+
* For pattern 'clavix-{name}' → matches 'clavix-*.md'
|
|
110
|
+
* For pattern '{name}' → matches '*.md' (all files with extension)
|
|
111
|
+
*/
|
|
112
|
+
isClavixGeneratedCommand(filename) {
|
|
113
|
+
// Must match our file extension
|
|
114
|
+
if (!filename.endsWith(this.config.fileExtension)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
// Extract prefix from pattern (everything before {name})
|
|
118
|
+
const pattern = this.config.filenamePattern;
|
|
119
|
+
const prefixEnd = pattern.indexOf('{name}');
|
|
120
|
+
if (prefixEnd > 0) {
|
|
121
|
+
// Pattern has a prefix (e.g., 'clavix-{name}')
|
|
122
|
+
const prefix = pattern.substring(0, prefixEnd);
|
|
123
|
+
return filename.startsWith(prefix);
|
|
124
|
+
}
|
|
125
|
+
// Pattern is just '{name}' - this adapter owns all files in its directory
|
|
126
|
+
// This is safe for adapters like Claude Code that use dedicated subdirectories
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
103
129
|
}
|
|
104
130
|
//# sourceMappingURL=universal-adapter.js.map
|
|
@@ -4,6 +4,7 @@ import { GeminiAdapter } from './adapters/gemini-adapter.js';
|
|
|
4
4
|
import { QwenAdapter } from './adapters/qwen-adapter.js';
|
|
5
5
|
import { LlxprtAdapter } from './adapters/llxprt-adapter.js';
|
|
6
6
|
import { VibeAdapter } from './adapters/vibe-adapter.js';
|
|
7
|
+
import { AgentSkillsAdapter } from './adapters/agent-skills-adapter.js';
|
|
7
8
|
import { UniversalAdapter } from './adapters/universal-adapter.js';
|
|
8
9
|
import { getSimpleAdapters } from './adapter-registry.js';
|
|
9
10
|
import { IntegrationError } from '../types/errors.js';
|
|
@@ -27,6 +28,9 @@ export class AgentManager {
|
|
|
27
28
|
this.registerAdapter(new QwenAdapter(userConfig)); // TOML format
|
|
28
29
|
this.registerAdapter(new LlxprtAdapter(userConfig)); // TOML format
|
|
29
30
|
this.registerAdapter(new VibeAdapter(userConfig)); // Vibe CLI skills
|
|
31
|
+
// Register Agent Skills adapters (both global and project scope)
|
|
32
|
+
this.registerAdapter(new AgentSkillsAdapter('global', userConfig));
|
|
33
|
+
this.registerAdapter(new AgentSkillsAdapter('project', userConfig));
|
|
30
34
|
// Register simple adapters from config (using UniversalAdapter factory)
|
|
31
35
|
for (const config of getSimpleAdapters()) {
|
|
32
36
|
// Skip adapters that have special handlers registered above
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Clavix Instructions for Generic Agents
|
|
2
|
+
|
|
3
|
+
This guide is for agents that can only read documentation (no slash-command support). If your platform supports custom slash commands, use those instead.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ⛔ CLAVIX MODE ENFORCEMENT
|
|
8
|
+
|
|
9
|
+
**CRITICAL: Know which mode you're in and STOP at the right point.**
|
|
10
|
+
|
|
11
|
+
**OPTIMIZATION workflows** (NO CODE ALLOWED):
|
|
12
|
+
- Improve mode - Prompt optimization only (auto-selects depth)
|
|
13
|
+
- Your role: Analyze, optimize, show improved prompt, **STOP**
|
|
14
|
+
- ❌ DO NOT implement the prompt's requirements
|
|
15
|
+
- ✅ After showing optimized prompt, tell user: "Run `/clavix:implement --latest` to implement"
|
|
16
|
+
|
|
17
|
+
**PLANNING workflows** (NO CODE ALLOWED):
|
|
18
|
+
- Conversational mode, requirement extraction, PRD generation
|
|
19
|
+
- Your role: Ask questions, create PRDs/prompts, extract requirements
|
|
20
|
+
- ❌ DO NOT implement features during these workflows
|
|
21
|
+
|
|
22
|
+
**IMPLEMENTATION workflows** (CODE ALLOWED):
|
|
23
|
+
- Only after user runs execute/implement commands
|
|
24
|
+
- Your role: Write code, execute tasks, implement features
|
|
25
|
+
- ✅ DO implement code during these workflows
|
|
26
|
+
|
|
27
|
+
**If unsure, ASK:** "Should I implement this now, or continue with planning?"
|
|
28
|
+
|
|
29
|
+
See `.clavix/instructions/core/clavix-mode.md` for complete mode documentation.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 📁 Detailed Workflow Instructions
|
|
34
|
+
|
|
35
|
+
For complete step-by-step workflows, see `.clavix/instructions/`:
|
|
36
|
+
|
|
37
|
+
| Workflow | Instruction File | Purpose |
|
|
38
|
+
|----------|-----------------|---------|
|
|
39
|
+
| **Conversational Mode** | `workflows/start.md` | Natural requirements gathering through discussion |
|
|
40
|
+
| **Extract Requirements** | `workflows/summarize.md` | Analyze conversation → mini-PRD + optimized prompts |
|
|
41
|
+
| **Prompt Optimization** | `workflows/improve.md` | Intent detection + quality assessment + auto-depth selection |
|
|
42
|
+
| **PRD Generation** | `workflows/prd.md` | Socratic questions → full PRD + quick PRD |
|
|
43
|
+
| **Mode Boundaries** | `core/clavix-mode.md` | Planning vs implementation distinction |
|
|
44
|
+
| **File Operations** | `core/file-operations.md` | File creation patterns |
|
|
45
|
+
| **Verification** | `core/verification.md` | Post-implementation verification |
|
|
46
|
+
|
|
47
|
+
**Troubleshooting:**
|
|
48
|
+
- `troubleshooting/jumped-to-implementation.md` - If you started coding during planning
|
|
49
|
+
- `troubleshooting/skipped-file-creation.md` - If files weren't created
|
|
50
|
+
- `troubleshooting/mode-confusion.md` - When unclear about planning vs implementation
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 🔍 Workflow Detection Keywords
|
|
55
|
+
|
|
56
|
+
| Keywords in User Request | Recommended Workflow | File Reference |
|
|
57
|
+
|---------------------------|---------------------|----------------|
|
|
58
|
+
| "improve this prompt", "make it better", "optimize" | Improve mode → Auto-depth optimization | `workflows/improve.md` |
|
|
59
|
+
| "analyze thoroughly", "edge cases", "alternatives" | Improve mode (--comprehensive) | `workflows/improve.md` |
|
|
60
|
+
| "create a PRD", "product requirements" | PRD mode → Socratic questioning | `workflows/prd.md` |
|
|
61
|
+
| "let's discuss", "not sure what I want" | Conversational mode → Start gathering | `workflows/start.md` |
|
|
62
|
+
| "summarize our conversation" | Extract mode → Analyze thread | `workflows/summarize.md` |
|
|
63
|
+
| "refine", "update PRD", "change requirements", "modify prompt" | Refine mode → Update existing content | `workflows/refine.md` |
|
|
64
|
+
| "verify", "check my implementation" | Verify mode → Implementation verification | `core/verification.md` |
|
|
65
|
+
|
|
66
|
+
**When detected:** Reference the corresponding `.clavix/instructions/workflows/{workflow}.md` file.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 📋 Clavix Commands (v5)
|
|
71
|
+
|
|
72
|
+
### Setup Commands (CLI)
|
|
73
|
+
| Command | Purpose |
|
|
74
|
+
|---------|---------|
|
|
75
|
+
| `clavix init` | Initialize Clavix in a project |
|
|
76
|
+
| `clavix update` | Update templates after package update |
|
|
77
|
+
| `clavix diagnose` | Check installation health |
|
|
78
|
+
| `clavix version` | Show version |
|
|
79
|
+
|
|
80
|
+
### Workflow Commands (Slash Commands)
|
|
81
|
+
All workflows are executed via slash commands that AI agents read and follow:
|
|
82
|
+
|
|
83
|
+
> **Command Format:** Commands shown with colon (`:`) format. Some tools use hyphen (`-`): Claude Code uses `/clavix:improve`, Cursor uses `/clavix-improve`. Your tool autocompletes the correct format.
|
|
84
|
+
|
|
85
|
+
| Slash Command | Purpose |
|
|
86
|
+
|---------------|---------|
|
|
87
|
+
| `/clavix:improve` | Optimize prompts (auto-selects depth) |
|
|
88
|
+
| `/clavix:prd` | Generate PRD through guided questions |
|
|
89
|
+
| `/clavix:plan` | Create task breakdown from PRD |
|
|
90
|
+
| `/clavix:implement` | Execute tasks or prompts (auto-detects source) |
|
|
91
|
+
| `/clavix:start` | Begin conversational session |
|
|
92
|
+
| `/clavix:summarize` | Extract requirements from conversation |
|
|
93
|
+
| `/clavix:refine` | Refine existing PRD or saved prompt |
|
|
94
|
+
|
|
95
|
+
### Agentic Utilities (Project Management)
|
|
96
|
+
These utilities provide structured workflows for project completion:
|
|
97
|
+
|
|
98
|
+
| Utility | Purpose |
|
|
99
|
+
|---------|---------|
|
|
100
|
+
| `/clavix:verify` | Check implementation against PRD requirements, run validation |
|
|
101
|
+
| `/clavix:archive` | Archive completed work to `.clavix/archive/` for reference |
|
|
102
|
+
|
|
103
|
+
**Quick start:**
|
|
104
|
+
```bash
|
|
105
|
+
npm install -g clavix
|
|
106
|
+
clavix init
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**How it works:** Slash commands are markdown templates. When invoked, the agent reads the template and follows its instructions using native tools (Read, Write, Edit, Bash).
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 🔄 Standard Workflow
|
|
114
|
+
|
|
115
|
+
**Clavix follows this progression:**
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
PRD Creation → Task Planning → Implementation → Archive
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Detailed steps:**
|
|
122
|
+
|
|
123
|
+
1. **Planning Phase**
|
|
124
|
+
- Run: `/clavix:prd` or `/clavix:start` → `/clavix:summarize`
|
|
125
|
+
- Output: `.clavix/outputs/{project}/full-prd.md` + `quick-prd.md`
|
|
126
|
+
- Mode: PLANNING
|
|
127
|
+
|
|
128
|
+
2. **Task Preparation**
|
|
129
|
+
- Run: `/clavix:plan` transforms PRD into curated task list
|
|
130
|
+
- Output: `.clavix/outputs/{project}/tasks.md`
|
|
131
|
+
- Mode: PLANNING (Pre-Implementation)
|
|
132
|
+
|
|
133
|
+
3. **Implementation Phase**
|
|
134
|
+
- Run: `/clavix:implement`
|
|
135
|
+
- Agent executes tasks systematically
|
|
136
|
+
- Mode: IMPLEMENTATION
|
|
137
|
+
- Agent edits tasks.md directly to mark progress (`- [ ]` → `- [x]`)
|
|
138
|
+
|
|
139
|
+
4. **Completion**
|
|
140
|
+
- Run: `/clavix:archive`
|
|
141
|
+
- Archives completed work
|
|
142
|
+
- Mode: Management
|
|
143
|
+
|
|
144
|
+
**Key principle:** Planning workflows create documents. Implementation workflows write code.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 💡 Best Practices for Generic Agents
|
|
149
|
+
|
|
150
|
+
1. **Always reference instruction files** - Don't recreate workflow steps inline, point to `.clavix/instructions/workflows/`
|
|
151
|
+
|
|
152
|
+
2. **Respect mode boundaries** - Planning mode = no code, Implementation mode = write code
|
|
153
|
+
|
|
154
|
+
3. **Use checkpoints** - Follow the CHECKPOINT pattern from instruction files to track progress
|
|
155
|
+
|
|
156
|
+
4. **Create files explicitly** - Use Write tool for every file, verify with ls, never skip file creation
|
|
157
|
+
|
|
158
|
+
5. **Ask when unclear** - If mode is ambiguous, ask: "Should I implement or continue planning?"
|
|
159
|
+
|
|
160
|
+
6. **Track complexity** - Use conversational mode for complex requirements (15+ exchanges, 5+ features, 3+ topics)
|
|
161
|
+
|
|
162
|
+
7. **Label improvements** - When optimizing prompts, mark changes with [ADDED], [CLARIFIED], [STRUCTURED], [EXPANDED], [SCOPED]
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## ⚠️ Common Mistakes
|
|
167
|
+
|
|
168
|
+
### ❌ Jumping to implementation during planning
|
|
169
|
+
**Wrong:** User discusses feature → agent generates code immediately
|
|
170
|
+
|
|
171
|
+
**Right:** User discusses feature → agent asks questions → creates PRD/prompt → asks if ready to implement
|
|
172
|
+
|
|
173
|
+
### ❌ Skipping file creation
|
|
174
|
+
**Wrong:** Display content in chat, don't write files
|
|
175
|
+
|
|
176
|
+
**Right:** Create directory → Write files → Verify existence → Display paths
|
|
177
|
+
|
|
178
|
+
### ❌ Recreating workflow instructions inline
|
|
179
|
+
**Wrong:** Copy entire fast mode workflow into response
|
|
180
|
+
|
|
181
|
+
**Right:** Reference `.clavix/instructions/workflows/improve.md` and follow its steps
|
|
182
|
+
|
|
183
|
+
### ❌ Not using instruction files
|
|
184
|
+
**Wrong:** Make up workflow steps or guess at process
|
|
185
|
+
|
|
186
|
+
**Right:** Read corresponding `.clavix/instructions/workflows/*.md` file and follow exactly
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
**Artifacts stored under `.clavix/`:**
|
|
191
|
+
- `.clavix/outputs/<project>/` - PRDs, tasks, prompts
|
|
192
|
+
- `.clavix/templates/` - Custom overrides
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
**For complete workflows:** Always reference `.clavix/instructions/workflows/{workflow}.md`
|
|
197
|
+
|
|
198
|
+
**For troubleshooting:** Check `.clavix/instructions/troubleshooting/`
|
|
199
|
+
|
|
200
|
+
**For mode clarification:** See `.clavix/instructions/core/clavix-mode.md`
|