specweave 0.6.8 ā 0.7.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/.claude-plugin/README.md +1 -1
- package/CLAUDE.md +903 -99
- package/README.md +143 -207
- package/bin/specweave.js +67 -0
- package/dist/cli/commands/abandon.d.ts +13 -0
- package/dist/cli/commands/abandon.d.ts.map +1 -0
- package/dist/cli/commands/abandon.js +15 -0
- package/dist/cli/commands/abandon.js.map +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +90 -18
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/pause.d.ts +13 -0
- package/dist/cli/commands/pause.d.ts.map +1 -0
- package/dist/cli/commands/pause.js +15 -0
- package/dist/cli/commands/pause.js.map +1 -0
- package/dist/cli/commands/qa.d.ts +54 -0
- package/dist/cli/commands/qa.d.ts.map +1 -0
- package/dist/cli/commands/qa.js +98 -0
- package/dist/cli/commands/qa.js.map +1 -0
- package/dist/cli/commands/resume.d.ts +12 -0
- package/dist/cli/commands/resume.d.ts.map +1 -0
- package/dist/cli/commands/resume.js +14 -0
- package/dist/cli/commands/resume.js.map +1 -0
- package/dist/cli/commands/status.d.ts +12 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +23 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/helpers/issue-tracker/ado.d.ts +57 -0
- package/dist/cli/helpers/issue-tracker/ado.d.ts.map +1 -0
- package/dist/cli/helpers/issue-tracker/ado.js +223 -0
- package/dist/cli/helpers/issue-tracker/ado.js.map +1 -0
- package/dist/cli/helpers/issue-tracker/github.d.ts +65 -0
- package/dist/cli/helpers/issue-tracker/github.d.ts.map +1 -0
- package/dist/cli/helpers/issue-tracker/github.js +284 -0
- package/dist/cli/helpers/issue-tracker/github.js.map +1 -0
- package/dist/cli/helpers/issue-tracker/index.d.ts +22 -0
- package/dist/cli/helpers/issue-tracker/index.d.ts.map +1 -0
- package/dist/cli/helpers/issue-tracker/index.js +270 -0
- package/dist/cli/helpers/issue-tracker/index.js.map +1 -0
- package/dist/cli/helpers/issue-tracker/jira.d.ts +61 -0
- package/dist/cli/helpers/issue-tracker/jira.d.ts.map +1 -0
- package/dist/cli/helpers/issue-tracker/jira.js +265 -0
- package/dist/cli/helpers/issue-tracker/jira.js.map +1 -0
- package/dist/cli/helpers/issue-tracker/types.d.ts +86 -0
- package/dist/cli/helpers/issue-tracker/types.d.ts.map +1 -0
- package/dist/cli/helpers/issue-tracker/types.js +16 -0
- package/dist/cli/helpers/issue-tracker/types.js.map +1 -0
- package/dist/cli/helpers/issue-tracker/utils.d.ts +103 -0
- package/dist/cli/helpers/issue-tracker/utils.d.ts.map +1 -0
- package/dist/cli/helpers/issue-tracker/utils.js +240 -0
- package/dist/cli/helpers/issue-tracker/utils.js.map +1 -0
- package/dist/core/increment/limits.d.ts +68 -0
- package/dist/core/increment/limits.d.ts.map +1 -0
- package/dist/core/increment/limits.js +224 -0
- package/dist/core/increment/limits.js.map +1 -0
- package/dist/core/increment/metadata-manager.d.ts +114 -0
- package/dist/core/increment/metadata-manager.d.ts.map +1 -0
- package/dist/core/increment/metadata-manager.js +320 -0
- package/dist/core/increment/metadata-manager.js.map +1 -0
- package/dist/core/increment/status-commands.d.ts +43 -0
- package/dist/core/increment/status-commands.d.ts.map +1 -0
- package/dist/core/increment/status-commands.js +277 -0
- package/dist/core/increment/status-commands.js.map +1 -0
- package/dist/core/plugin-detector.d.ts +1 -0
- package/dist/core/plugin-detector.d.ts.map +1 -1
- package/dist/core/plugin-detector.js +25 -0
- package/dist/core/plugin-detector.js.map +1 -1
- package/dist/core/qa/qa-runner.d.ts +16 -0
- package/dist/core/qa/qa-runner.d.ts.map +1 -0
- package/dist/core/qa/qa-runner.js +404 -0
- package/dist/core/qa/qa-runner.js.map +1 -0
- package/dist/core/qa/quality-gate-decider.d.ts +53 -0
- package/dist/core/qa/quality-gate-decider.d.ts.map +1 -0
- package/dist/core/qa/quality-gate-decider.js +268 -0
- package/dist/core/qa/quality-gate-decider.js.map +1 -0
- package/dist/core/qa/risk-calculator.d.ts +126 -0
- package/dist/core/qa/risk-calculator.d.ts.map +1 -0
- package/dist/core/qa/risk-calculator.js +247 -0
- package/dist/core/qa/risk-calculator.js.map +1 -0
- package/dist/core/qa/types.d.ts +315 -0
- package/dist/core/qa/types.d.ts.map +1 -0
- package/dist/core/qa/types.js +8 -0
- package/dist/core/qa/types.js.map +1 -0
- package/dist/core/types/config.d.ts +35 -0
- package/dist/core/types/config.d.ts.map +1 -1
- package/dist/core/types/config.js +16 -0
- package/dist/core/types/config.js.map +1 -1
- package/dist/core/types/increment-metadata.d.ts +120 -0
- package/dist/core/types/increment-metadata.d.ts.map +1 -0
- package/dist/core/types/increment-metadata.js +138 -0
- package/dist/core/types/increment-metadata.js.map +1 -0
- package/dist/hooks/lib/invoke-translator-skill.d.ts +60 -0
- package/dist/hooks/lib/invoke-translator-skill.d.ts.map +1 -0
- package/dist/hooks/lib/invoke-translator-skill.js +201 -0
- package/dist/hooks/lib/invoke-translator-skill.js.map +1 -0
- package/dist/hooks/lib/translate-file.d.ts +59 -0
- package/dist/hooks/lib/translate-file.d.ts.map +1 -0
- package/dist/hooks/lib/translate-file.js +350 -0
- package/dist/hooks/lib/translate-file.js.map +1 -0
- package/dist/locales/en/cli.json +3 -1
- package/dist/metrics/calculators/change-failure-rate.d.ts +22 -0
- package/dist/metrics/calculators/change-failure-rate.d.ts.map +1 -0
- package/dist/metrics/calculators/change-failure-rate.js +70 -0
- package/dist/metrics/calculators/change-failure-rate.js.map +1 -0
- package/dist/metrics/calculators/deployment-frequency.d.ts +20 -0
- package/dist/metrics/calculators/deployment-frequency.d.ts.map +1 -0
- package/dist/metrics/calculators/deployment-frequency.js +61 -0
- package/dist/metrics/calculators/deployment-frequency.js.map +1 -0
- package/dist/metrics/calculators/lead-time.d.ts +22 -0
- package/dist/metrics/calculators/lead-time.d.ts.map +1 -0
- package/dist/metrics/calculators/lead-time.js +82 -0
- package/dist/metrics/calculators/lead-time.js.map +1 -0
- package/dist/metrics/calculators/mttr.d.ts +21 -0
- package/dist/metrics/calculators/mttr.d.ts.map +1 -0
- package/dist/metrics/calculators/mttr.js +60 -0
- package/dist/metrics/calculators/mttr.js.map +1 -0
- package/dist/metrics/dora-calculator.d.ts +24 -0
- package/dist/metrics/dora-calculator.d.ts.map +1 -0
- package/dist/metrics/dora-calculator.js +104 -0
- package/dist/metrics/dora-calculator.js.map +1 -0
- package/dist/metrics/github-client.d.ts +51 -0
- package/dist/metrics/github-client.d.ts.map +1 -0
- package/dist/metrics/github-client.js +133 -0
- package/dist/metrics/github-client.js.map +1 -0
- package/dist/metrics/types.d.ts +112 -0
- package/dist/metrics/types.d.ts.map +1 -0
- package/dist/metrics/types.js +10 -0
- package/dist/metrics/types.js.map +1 -0
- package/dist/metrics/utils/percentile.d.ts +25 -0
- package/dist/metrics/utils/percentile.d.ts.map +1 -0
- package/dist/metrics/utils/percentile.js +46 -0
- package/dist/metrics/utils/percentile.js.map +1 -0
- package/dist/metrics/utils/tier-classifier.d.ts +61 -0
- package/dist/metrics/utils/tier-classifier.d.ts.map +1 -0
- package/dist/metrics/utils/tier-classifier.js +100 -0
- package/dist/metrics/utils/tier-classifier.js.map +1 -0
- package/dist/utils/auth-helpers.d.ts +58 -0
- package/dist/utils/auth-helpers.d.ts.map +1 -0
- package/dist/utils/auth-helpers.js +108 -0
- package/dist/utils/auth-helpers.js.map +1 -0
- package/dist/utils/env-file.d.ts +88 -0
- package/dist/utils/env-file.d.ts.map +1 -0
- package/dist/utils/env-file.js +180 -0
- package/dist/utils/env-file.js.map +1 -0
- package/dist/utils/plugin-detection.d.ts +50 -0
- package/dist/utils/plugin-detection.d.ts.map +1 -0
- package/dist/utils/plugin-detection.js +229 -0
- package/dist/utils/plugin-detection.js.map +1 -0
- package/dist/utils/secrets-loader.d.ts +88 -0
- package/dist/utils/secrets-loader.d.ts.map +1 -0
- package/dist/utils/secrets-loader.js +271 -0
- package/dist/utils/secrets-loader.js.map +1 -0
- package/dist/utils/translation.d.ts +187 -0
- package/dist/utils/translation.d.ts.map +1 -0
- package/dist/utils/translation.js +414 -0
- package/dist/utils/translation.js.map +1 -0
- package/package.json +28 -44
- package/plugins/specweave/.claude-plugin/plugin.json +3 -3
- package/plugins/specweave/agents/pm/AGENT.md +330 -54
- package/plugins/specweave/agents/test-aware-planner/AGENT.md +1035 -0
- package/plugins/specweave/agents/test-aware-planner/templates/README.md +118 -0
- package/plugins/specweave/agents/test-aware-planner/templates/task-non-testable.md.template +24 -0
- package/plugins/specweave/agents/test-aware-planner/templates/task-testable.md.template +53 -0
- package/plugins/specweave/agents/test-aware-planner/templates/tasks-frontmatter.md.template +11 -0
- package/plugins/specweave/commands/README.md +88 -163
- package/plugins/specweave/commands/specweave-abandon.md +314 -0
- package/plugins/specweave/commands/specweave-check-tests.md +546 -0
- package/plugins/specweave/commands/{do.md ā specweave-do.md} +5 -7
- package/plugins/specweave/commands/{increment.md ā specweave-increment.md} +231 -4
- package/plugins/specweave/commands/specweave-pause.md +189 -0
- package/plugins/specweave/commands/specweave-qa.md +245 -0
- package/plugins/specweave/commands/specweave-resume.md +216 -0
- package/plugins/specweave/commands/specweave-status.md +397 -0
- package/plugins/specweave/commands/specweave-sync-tasks.md +256 -0
- package/plugins/specweave/commands/{translate.md ā specweave-translate.md} +3 -3
- package/plugins/specweave/commands/specweave-update-scope.md +351 -0
- package/plugins/specweave/commands/specweave.md +21 -21
- package/plugins/specweave/hooks/post-increment-planning.sh +335 -0
- package/plugins/specweave/hooks/post-task-completion.sh +141 -0
- package/plugins/specweave/skills/SKILLS-INDEX.md +1 -1
- package/plugins/specweave/skills/brownfield-analyzer/SKILL.md +9 -9
- package/plugins/specweave/skills/increment-planner/SKILL.md +400 -212
- package/plugins/specweave/skills/increment-quality-judge-v2/SKILL.md +499 -0
- package/plugins/specweave/skills/plugin-detector/SKILL.md +114 -1
- package/plugins/specweave/skills/project-kickstarter/SKILL.md +74 -1
- package/plugins/specweave/skills/{rfc-generator ā spec-generator}/SKILL.md +22 -29
- package/plugins/specweave/skills/specweave-detector/SKILL.md +3 -3
- package/plugins/specweave/skills/specweave-framework/SKILL.md +2 -2
- package/plugins/specweave-ado/.claude-plugin/plugin.json +18 -4
- package/plugins/specweave-ado/agents/ado-manager/AGENT.md +426 -0
- package/plugins/specweave-ado/commands/close-workitem.md +52 -0
- package/plugins/specweave-ado/commands/create-workitem.md +53 -0
- package/plugins/specweave-ado/commands/status.md +53 -0
- package/plugins/specweave-ado/commands/sync.md +55 -0
- package/plugins/specweave-ado/lib/ado-client.ts +361 -0
- package/plugins/specweave-ado/reference/ado-specweave-mapping.md +552 -0
- package/plugins/specweave-ado/skills/ado-sync/SKILL.md +344 -193
- package/plugins/specweave-docs/skills/docusaurus/SKILL.md +73 -0
- package/plugins/specweave-github/agents/github-manager/AGENT.md +49 -0
- package/plugins/specweave-github/commands/{github-close-issue.md ā close-issue.md} +1 -1
- package/plugins/specweave-github/commands/{github-create-issue.md ā create-issue.md} +1 -1
- package/plugins/specweave-github/commands/{github-status.md ā status.md} +1 -1
- package/plugins/specweave-github/commands/{github-sync-tasks.md ā sync-tasks.md} +1 -1
- package/plugins/specweave-github/commands/{github-sync.md ā sync.md} +1 -1
- package/plugins/specweave-github/reference/github-specweave-mapping.md +377 -0
- package/plugins/specweave-github/skills/github-sync/SKILL.md +11 -3
- package/plugins/specweave-infrastructure/commands/{specweave.monitor-setup.md ā monitor-setup.md} +5 -0
- package/plugins/specweave-infrastructure/commands/{specweave.slo-implement.md ā slo-implement.md} +5 -0
- package/plugins/specweave-jira/agents/jira-manager/AGENT.md +380 -0
- package/plugins/specweave-jira/commands/{specweave.sync-jira.md ā sync.md} +1 -1
- package/plugins/specweave-jira/reference/jira-specweave-mapping.md +508 -0
- package/plugins/specweave-ml/commands/ml-deploy.md +1 -1
- package/plugins/specweave-ml/commands/ml-evaluate.md +1 -1
- package/plugins/specweave-ml/commands/ml-explain.md +1 -1
- package/plugins/specweave-ml/commands/{specweave.ml-pipeline.md ā ml-pipeline.md} +5 -0
- package/src/templates/AGENTS.md.template +331 -31
- package/src/templates/CLAUDE.md.template +36 -21
- package/src/templates/COMPLETION-REPORT.template.md +128 -0
- package/src/templates/README.md.template +17 -16
- package/src/templates/docs/README.md +11 -9
- package/src/templates/docs/spec-template.md +229 -0
- package/plugins/specweave/commands/inc.md +0 -85
- package/plugins/specweave/commands/list-increments.md +0 -180
- package/src/adapters/README.md +0 -275
- package/src/adapters/adapter-base.ts +0 -182
- package/src/adapters/adapter-interface.ts +0 -166
- package/src/adapters/adapter-loader.ts +0 -256
- package/src/adapters/agents-md-generator.ts +0 -228
- package/src/adapters/claude/README.md +0 -233
- package/src/adapters/claude/adapter.ts +0 -468
- package/src/adapters/claude-md-generator.ts +0 -377
- package/src/adapters/codex/README.md +0 -105
- package/src/adapters/codex/adapter.ts +0 -333
- package/src/adapters/cursor/.cursor/context/docs-context.md +0 -62
- package/src/adapters/cursor/.cursor/context/increments-context.md +0 -71
- package/src/adapters/cursor/.cursor/context/strategy-context.md +0 -73
- package/src/adapters/cursor/.cursor/context/tests-context.md +0 -89
- package/src/adapters/cursor/README.md +0 -283
- package/src/adapters/cursor/adapter.ts +0 -451
- package/src/adapters/doc-generator.ts +0 -331
- package/src/adapters/gemini/README.md +0 -97
- package/src/adapters/gemini/adapter.ts +0 -298
- package/src/adapters/generic/README.md +0 -277
- package/src/adapters/generic/adapter.ts +0 -378
- package/src/adapters/registry.yaml +0 -187
- /package/plugins/specweave/commands/{costs.md ā specweave-costs.md} +0 -0
- /package/plugins/specweave/commands/{done.md ā specweave-done.md} +0 -0
- /package/plugins/specweave/commands/{next.md ā specweave-next.md} +0 -0
- /package/plugins/specweave/commands/{progress.md ā specweave-progress.md} +0 -0
- /package/plugins/specweave/commands/{sync-docs.md ā specweave-sync-docs.md} +0 -0
- /package/plugins/specweave/commands/{tdd-cycle.md ā specweave-tdd-cycle.md} +0 -0
- /package/plugins/specweave/commands/{tdd-green.md ā specweave-tdd-green.md} +0 -0
- /package/plugins/specweave/commands/{tdd-red.md ā specweave-tdd-red.md} +0 -0
- /package/plugins/specweave/commands/{tdd-refactor.md ā specweave-tdd-refactor.md} +0 -0
- /package/plugins/specweave/commands/{validate.md ā specweave-validate.md} +0 -0
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
# Claude Code Adapter
|
|
2
|
-
|
|
3
|
-
**Automation Level**: Full (Best-in-class experience)
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The Claude Code adapter provides **full automation** for SpecWeave, leveraging Claude Code's native capabilities for skills, agents, hooks, and slash commands.
|
|
8
|
-
|
|
9
|
-
This adapter represents the **gold standard** - all other adapters attempt to approximate this experience within their tool's capabilities.
|
|
10
|
-
|
|
11
|
-
## Why Claude Code Provides Superior Results
|
|
12
|
-
|
|
13
|
-
**Anthropic Defines Industry Standards:**
|
|
14
|
-
|
|
15
|
-
### 1. MCP (Model Context Protocol)
|
|
16
|
-
- **What**: Standardized protocol for context management
|
|
17
|
-
- **Why**: Efficient, tool-integrated, proven pattern
|
|
18
|
-
- **Benefit**: Native context loading, 70%+ token reduction
|
|
19
|
-
|
|
20
|
-
### 2. Skills + Agents Architecture
|
|
21
|
-
- **What**: Proven pattern for AI capabilities and roles
|
|
22
|
-
- **Skills**: Auto-activating capabilities (specweave-detector, skill-router)
|
|
23
|
-
- **Agents**: Specialized roles with separate context windows (PM, Architect, DevOps)
|
|
24
|
-
- **Why**: Context isolation, role-based expertise, automatic activation
|
|
25
|
-
- **Benefit**: More accurate, faster, better UX
|
|
26
|
-
|
|
27
|
-
### 3. Native Tool Integration
|
|
28
|
-
- **What**: Direct access to Read, Write, Edit, Bash, Grep, Glob
|
|
29
|
-
- **Why**: Real-time file system access, command execution
|
|
30
|
-
- **Benefit**: Seamless development workflow
|
|
31
|
-
|
|
32
|
-
## What This Adapter Provides
|
|
33
|
-
|
|
34
|
-
### Skills (Auto-Activating)
|
|
35
|
-
| Skill | Purpose | Activation |
|
|
36
|
-
|-------|---------|------------|
|
|
37
|
-
| `specweave-detector` | Detect SpecWeave projects | Always (proactive) |
|
|
38
|
-
| `skill-router` | Route requests to appropriate skills/agents | Automatic |
|
|
39
|
-
| `context-loader` | Load context manifests (70%+ token savings) | When loading context |
|
|
40
|
-
| `increment-planner` | Plan features with context awareness | When creating features |
|
|
41
|
-
| `role-orchestrator` | Coordinate multi-agent workflows | Complex tasks |
|
|
42
|
-
| `brownfield-analyzer` | Analyze existing codebases | Brownfield projects |
|
|
43
|
-
|
|
44
|
-
**Plus 18+ more skills** (see `src/skills/`)
|
|
45
|
-
|
|
46
|
-
### Agents (Specialized Roles)
|
|
47
|
-
| Agent | Role | When Used |
|
|
48
|
-
|-------|------|-----------|
|
|
49
|
-
| `pm` | Product Manager | Requirements, user stories |
|
|
50
|
-
| `architect` | System Architect | Design, ADRs, architecture |
|
|
51
|
-
| `devops` | DevOps Engineer | Infrastructure, deployment |
|
|
52
|
-
| `qa-lead` | QA Lead | Test strategy, test cases |
|
|
53
|
-
| `security` | Security Engineer | Threat modeling, audits |
|
|
54
|
-
| `tech-lead` | Technical Lead | Code review, best practices |
|
|
55
|
-
| `frontend` | Frontend Developer | UI implementation |
|
|
56
|
-
| `python-backend` | Python Backend Dev | FastAPI, Django APIs |
|
|
57
|
-
| `nodejs-backend` | Node.js Backend Dev | Express, NestJS APIs |
|
|
58
|
-
| `nextjs` | Next.js Specialist | Next.js apps |
|
|
59
|
-
|
|
60
|
-
**Plus 10+ more agents** (see `src/agents/`)
|
|
61
|
-
|
|
62
|
-
### Slash Commands
|
|
63
|
-
| Command | Purpose |
|
|
64
|
-
|---------|---------|
|
|
65
|
-
| `/create-increment` | Create new feature increment |
|
|
66
|
-
| `/sync-docs` | Review strategic documentation |
|
|
67
|
-
| `/sync-github` | Sync to GitHub issues |
|
|
68
|
-
| `specweave init` | Bootstrap new project |
|
|
69
|
-
|
|
70
|
-
**Plus more commands** (see `.claude/commands/`)
|
|
71
|
-
|
|
72
|
-
### Hooks (Auto-Update)
|
|
73
|
-
| Hook | Purpose |
|
|
74
|
-
|------|---------|
|
|
75
|
-
| `post-task-completion` | Auto-update docs after tasks |
|
|
76
|
-
| `pre-implementation` | Check regression risk |
|
|
77
|
-
| `docs-changed` | Validate documentation |
|
|
78
|
-
|
|
79
|
-
## Installation
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
# Install SpecWeave with Claude adapter (default)
|
|
83
|
-
npx specweave init my-project
|
|
84
|
-
|
|
85
|
-
# Or explicitly specify Claude adapter
|
|
86
|
-
npx specweave init my-project --adapter claude
|
|
87
|
-
|
|
88
|
-
# Install skills and agents
|
|
89
|
-
cd my-project
|
|
90
|
-
npm run install:skills
|
|
91
|
-
npm run install:agents
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Directory Structure
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
.claude/
|
|
98
|
-
āāā skills/ # Auto-activating capabilities
|
|
99
|
-
ā āāā specweave-detector/
|
|
100
|
-
ā āāā skill-router/
|
|
101
|
-
ā āāā context-loader/
|
|
102
|
-
ā āāā ...
|
|
103
|
-
āāā agents/ # Specialized roles
|
|
104
|
-
ā āāā pm/
|
|
105
|
-
ā āāā architect/
|
|
106
|
-
ā āāā devops/
|
|
107
|
-
ā āāā ...
|
|
108
|
-
āāā commands/ # Slash commands
|
|
109
|
-
ā āāā create-increment.md
|
|
110
|
-
ā āāā sync-docs.md
|
|
111
|
-
ā āāā ...
|
|
112
|
-
āāā hooks/ # Auto-update mechanisms
|
|
113
|
-
āāā post-task-completion.sh
|
|
114
|
-
āāā pre-implementation.sh
|
|
115
|
-
āāā ...
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## Usage Examples
|
|
119
|
-
|
|
120
|
-
### Example 1: Create Feature (Full Automation)
|
|
121
|
-
|
|
122
|
-
**User**: "Create increment for user authentication"
|
|
123
|
-
|
|
124
|
-
**What Happens** (Automatic):
|
|
125
|
-
1. ā
`specweave-detector` skill activates (detects SpecWeave project)
|
|
126
|
-
2. ā
`skill-router` routes to `increment-planner`
|
|
127
|
-
3. ā
`increment-planner` invokes `pm` agent
|
|
128
|
-
4. ā
`pm` agent creates `spec.md` (WHAT/WHY)
|
|
129
|
-
5. ā
`increment-planner` invokes `architect` agent
|
|
130
|
-
6. ā
`architect` agent creates `plan.md` (HOW)
|
|
131
|
-
7. ā
`increment-planner` creates `tasks.md` (implementation steps)
|
|
132
|
-
8. ā
`context-loader` creates `context-manifest.yaml` (70%+ token savings)
|
|
133
|
-
|
|
134
|
-
**Result**: Complete increment ready for implementation!
|
|
135
|
-
|
|
136
|
-
### Example 2: Review Documentation
|
|
137
|
-
|
|
138
|
-
**User**: `/sync-docs`
|
|
139
|
-
|
|
140
|
-
**What Happens** (Automatic):
|
|
141
|
-
1. ā
Slash command loads `.claude/commands/sync-docs.md`
|
|
142
|
-
2. ā
Reviews strategic docs (.specweave/docs/internal/strategy/)
|
|
143
|
-
3. ā
Compares against actual implementation
|
|
144
|
-
4. ā
Identifies gaps (undocumented features, outdated docs, tech debt)
|
|
145
|
-
5. ā
Generates report
|
|
146
|
-
|
|
147
|
-
### Example 3: Sync to GitHub
|
|
148
|
-
|
|
149
|
-
**User**: `/sync-github`
|
|
150
|
-
|
|
151
|
-
**What Happens** (Automatic):
|
|
152
|
-
1. ā
Reads increment spec.md and tasks.md
|
|
153
|
-
2. ā
Creates/updates GitHub issue
|
|
154
|
-
3. ā
Adds user stories as description
|
|
155
|
-
4. ā
Adds tasks as checkable checklist
|
|
156
|
-
5. ā
Stores issue number for bidirectional sync
|
|
157
|
-
|
|
158
|
-
## Comparison with Other Adapters
|
|
159
|
-
|
|
160
|
-
| Feature | Claude | Cursor | Copilot | Generic |
|
|
161
|
-
|---------|--------|--------|---------|---------|
|
|
162
|
-
| **Automation** | Full | Semi | Basic | Manual |
|
|
163
|
-
| **Skills** | Native | Simulated | N/A | N/A |
|
|
164
|
-
| **Agents** | Native | Manual invoke | Manual invoke | Copy-paste |
|
|
165
|
-
| **Hooks** | Native | N/A | N/A | N/A |
|
|
166
|
-
| **Commands** | Slash commands | Instructions | Instructions | Copy-paste |
|
|
167
|
-
| **Context Loading** | Auto | Manual ref | Manual ref | Copy-paste |
|
|
168
|
-
| **File Access** | Native | Native | Native | Manual |
|
|
169
|
-
|
|
170
|
-
**Claude Code = Gold Standard**
|
|
171
|
-
|
|
172
|
-
## Technical Details
|
|
173
|
-
|
|
174
|
-
### Skills Activation
|
|
175
|
-
|
|
176
|
-
Skills activate automatically based on:
|
|
177
|
-
- Description matching user's request
|
|
178
|
-
- Keywords in skill YAML frontmatter
|
|
179
|
-
- Context (SpecWeave project detected)
|
|
180
|
-
|
|
181
|
-
**Example**:
|
|
182
|
-
```yaml
|
|
183
|
-
---
|
|
184
|
-
name: increment-planner
|
|
185
|
-
description: Plan features with context awareness. Activates for: create feature, plan increment, new feature.
|
|
186
|
-
---
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
When user says "create feature", Claude Code automatically activates `increment-planner` skill.
|
|
190
|
-
|
|
191
|
-
### Agents Invocation
|
|
192
|
-
|
|
193
|
-
Agents are invoked explicitly via Task tool:
|
|
194
|
-
|
|
195
|
-
```typescript
|
|
196
|
-
await Task({
|
|
197
|
-
subagent_type: "pm",
|
|
198
|
-
prompt: "Create product requirements for user authentication",
|
|
199
|
-
description: "Product requirements analysis"
|
|
200
|
-
});
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
Agents have separate context windows to prevent pollution of main conversation.
|
|
204
|
-
|
|
205
|
-
### Hooks Execution
|
|
206
|
-
|
|
207
|
-
Hooks run automatically on events:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
When task completes ā hook fires ā docs auto-update.
|
|
212
|
-
|
|
213
|
-
## Why Other Tools Can't Fully Replicate This
|
|
214
|
-
|
|
215
|
-
1. **No native skills/agents support** - Must simulate via instruction files
|
|
216
|
-
2. **No separate context windows** - All context shared (can cause pollution)
|
|
217
|
-
3. **No hooks** - Can't auto-update on events
|
|
218
|
-
4. **No native MCP** - Context loading less efficient
|
|
219
|
-
|
|
220
|
-
**But they can get close!** See Cursor, Copilot, and Generic adapters for approximations.
|
|
221
|
-
|
|
222
|
-
## Related Documentation
|
|
223
|
-
|
|
224
|
-
- [SPECWEAVE.md](../../SPECWEAVE.md) - Complete development guide
|
|
225
|
-
- [src/skills/](../../skills/) - All available skills
|
|
226
|
-
- [src/agents/](../../agents/) - All available agents
|
|
227
|
-
- [Adapter Architecture](../README.md) - Multi-tool design philosophy
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
**Status**: Active (v0.1.0-beta.1+)
|
|
232
|
-
**Market Share**: ~10% (Claude Code users)
|
|
233
|
-
**Priority**: P1 (baseline/reference adapter)
|
|
@@ -1,468 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude Code Adapter
|
|
3
|
-
*
|
|
4
|
-
* Full automation adapter for Claude Code.
|
|
5
|
-
* Provides best-in-class experience with native skills, agents, hooks, and slash commands.
|
|
6
|
-
*
|
|
7
|
-
* This is the BASELINE adapter - all other adapters try to approximate this experience
|
|
8
|
-
* within their tool's capabilities.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import * as path from 'path';
|
|
12
|
-
import fs from 'fs-extra';
|
|
13
|
-
import { AdapterBase } from '../adapter-base.js';
|
|
14
|
-
import { AdapterOptions, AdapterFile } from '../adapter-interface.js';
|
|
15
|
-
import type { Plugin } from '../../core/types/plugin.js';
|
|
16
|
-
import { LanguageManager, getSystemPromptForLanguage } from '../../core/i18n/language-manager.js';
|
|
17
|
-
import type { SupportedLanguage, I18nConfig } from '../../core/i18n/types.js';
|
|
18
|
-
|
|
19
|
-
export class ClaudeAdapter extends AdapterBase {
|
|
20
|
-
name = 'claude';
|
|
21
|
-
description = 'Claude Code adapter - Full automation with skills, agents, hooks, and slash commands';
|
|
22
|
-
automationLevel = 'full' as const;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Detect if Claude Code is available
|
|
26
|
-
*
|
|
27
|
-
* Checks for:
|
|
28
|
-
* - claude command in PATH
|
|
29
|
-
* - Claude Code CLI installation
|
|
30
|
-
*/
|
|
31
|
-
async detect(): Promise<boolean> {
|
|
32
|
-
// Check if claude CLI exists
|
|
33
|
-
const hasClaudeCLI = await this.commandExists('claude');
|
|
34
|
-
|
|
35
|
-
// Check if .claude directory exists (already using Claude)
|
|
36
|
-
const hasClaudeDir = await this.fileExists('.claude');
|
|
37
|
-
|
|
38
|
-
return hasClaudeCLI || hasClaudeDir;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Get files to install for Claude adapter
|
|
43
|
-
*
|
|
44
|
-
* Claude Code v0.5.0+ uses native plugin loading via marketplace.
|
|
45
|
-
* No file copying needed!
|
|
46
|
-
*/
|
|
47
|
-
getFiles(): AdapterFile[] {
|
|
48
|
-
return []; // No files to copy - native loading!
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Install Claude adapter
|
|
53
|
-
*
|
|
54
|
-
* Claude Code v0.5.0+ uses native plugin system with marketplace.
|
|
55
|
-
* Installation steps:
|
|
56
|
-
* 1. Create .specweave/ structure (project data)
|
|
57
|
-
* 2. Show marketplace installation instructions
|
|
58
|
-
* 3. User adds marketplace: /plugin marketplace add anton-abyzov/specweave
|
|
59
|
-
* 4. User installs plugins: /plugin install specweave@specweave
|
|
60
|
-
*/
|
|
61
|
-
async install(options: AdapterOptions): Promise<void> {
|
|
62
|
-
console.log('\nš¦ Installing Claude Code Adapter (Native Plugin System)\n');
|
|
63
|
-
|
|
64
|
-
// Create .specweave/ structure (project data only)
|
|
65
|
-
const specweaveDir = path.join(options.projectPath, '.specweave');
|
|
66
|
-
await fs.ensureDir(specweaveDir);
|
|
67
|
-
await fs.ensureDir(path.join(specweaveDir, 'increments'));
|
|
68
|
-
await fs.ensureDir(path.join(specweaveDir, 'increments', '_backlog'));
|
|
69
|
-
await fs.ensureDir(path.join(specweaveDir, 'docs', 'internal', 'strategy'));
|
|
70
|
-
await fs.ensureDir(path.join(specweaveDir, 'docs', 'internal', 'architecture', 'adr'));
|
|
71
|
-
await fs.ensureDir(path.join(specweaveDir, 'docs', 'internal', 'architecture', 'rfc'));
|
|
72
|
-
await fs.ensureDir(path.join(specweaveDir, 'docs', 'internal', 'architecture', 'diagrams'));
|
|
73
|
-
await fs.ensureDir(path.join(specweaveDir, 'docs', 'internal', 'delivery'));
|
|
74
|
-
await fs.ensureDir(path.join(specweaveDir, 'docs', 'public', 'guides'));
|
|
75
|
-
await fs.ensureDir(path.join(specweaveDir, 'logs'));
|
|
76
|
-
|
|
77
|
-
console.log('\nā
Created .specweave/ structure');
|
|
78
|
-
console.log('\nš Next steps - Install SpecWeave plugins:');
|
|
79
|
-
console.log('\n 1ļøā£ Add SpecWeave marketplace:');
|
|
80
|
-
console.log(' /plugin marketplace add anton-abyzov/specweave');
|
|
81
|
-
console.log('\n 2ļøā£ Install SpecWeave core:');
|
|
82
|
-
console.log(' /plugin install specweave@specweave');
|
|
83
|
-
console.log('\n 3ļøā£ (Optional) Install GitHub plugin:');
|
|
84
|
-
console.log(' /plugin install specweave-github@specweave');
|
|
85
|
-
console.log('\n 4ļøā£ Start using SpecWeave:');
|
|
86
|
-
console.log(' /specweave.inc "create a todo app"');
|
|
87
|
-
console.log('\nš” Tip: Plugins load natively - no file copying needed!');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Post-installation instructions
|
|
92
|
-
*/
|
|
93
|
-
async postInstall(options: AdapterOptions): Promise<void> {
|
|
94
|
-
console.log(this.getInstructions());
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Get usage instructions for Claude adapter
|
|
99
|
-
*/
|
|
100
|
-
getInstructions(): string {
|
|
101
|
-
return `
|
|
102
|
-
|
|
103
|
-
================================================================
|
|
104
|
-
Claude Code Adapter - Full Automation
|
|
105
|
-
================================================================
|
|
106
|
-
|
|
107
|
-
Your project is now configured for Claude Code with FULL automation!
|
|
108
|
-
|
|
109
|
-
QUICK START:
|
|
110
|
-
|
|
111
|
-
1. Install components:
|
|
112
|
-
npm run install:skills # Install all skills
|
|
113
|
-
npm run install:agents # Install all agents
|
|
114
|
-
|
|
115
|
-
2. Create your first feature:
|
|
116
|
-
Just ask Claude: "Create increment for user authentication"
|
|
117
|
-
- specweave-detector skill activates automatically
|
|
118
|
-
- skill-router routes to increment-planner
|
|
119
|
-
- PM agent creates spec.md
|
|
120
|
-
- Architect agent creates plan.md
|
|
121
|
-
|
|
122
|
-
3. Use slash commands:
|
|
123
|
-
/create-increment "payment processing"
|
|
124
|
-
/review-docs
|
|
125
|
-
/sync-github
|
|
126
|
-
|
|
127
|
-
WHAT THIS PROVIDES:
|
|
128
|
-
|
|
129
|
-
- Skills (Auto-Activating): specweave-detector, skill-router, context-loader, increment-planner
|
|
130
|
-
- Agents (Specialized Roles): PM, Architect, DevOps, QA, Security, and 14 more
|
|
131
|
-
- Slash Commands: /specweave inc, /specweave do, /specweave validate, /specweave sync-github
|
|
132
|
-
- Hooks (Auto-Update): post-task-completion, pre-implementation, docs-changed
|
|
133
|
-
|
|
134
|
-
WHY CLAUDE CODE IS BEST:
|
|
135
|
-
|
|
136
|
-
Anthropic Sets Standards (MCP, Skills, Agents) that provide superior results:
|
|
137
|
-
- MCP Protocol: Native context management, efficient, standardized
|
|
138
|
-
- Skills + Agents: Proven patterns, auto-activation, role-based, separate contexts
|
|
139
|
-
- Native Tools: Direct file access, real-time execution
|
|
140
|
-
- Result: Superior accuracy, speed, and developer UX
|
|
141
|
-
|
|
142
|
-
DOCUMENTATION:
|
|
143
|
-
|
|
144
|
-
- SPECWEAVE.md: Complete development guide
|
|
145
|
-
- .specweave/docs/: Project documentation (5-pillar)
|
|
146
|
-
- src/skills/: All available skills
|
|
147
|
-
- src/agents/: All available agents
|
|
148
|
-
|
|
149
|
-
You're ready to build with SpecWeave on Claude Code!
|
|
150
|
-
|
|
151
|
-
For complete documentation, see: .claude/README.md
|
|
152
|
-
`;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Check if Claude adapter supports plugins
|
|
157
|
-
*
|
|
158
|
-
* Claude Code has FULL plugin support via native .claude/ directory
|
|
159
|
-
*
|
|
160
|
-
* @returns boolean Always true
|
|
161
|
-
*/
|
|
162
|
-
supportsPlugins(): boolean {
|
|
163
|
-
return true;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Check if Claude Code native plugin system is available
|
|
168
|
-
*
|
|
169
|
-
* Detects if /plugin commands are supported in current Claude Code version
|
|
170
|
-
*
|
|
171
|
-
* @returns boolean True if native plugin commands available
|
|
172
|
-
*/
|
|
173
|
-
async supportsNativePlugins(): Promise<boolean> {
|
|
174
|
-
// Check if .claude/plugins directory exists (indicates native plugin support)
|
|
175
|
-
const projectPath = process.cwd();
|
|
176
|
-
const nativePluginsDir = path.join(projectPath, '.claude', 'plugins');
|
|
177
|
-
|
|
178
|
-
if (await fs.pathExists(nativePluginsDir)) {
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Check if plugin.json format is present in any installed plugins
|
|
183
|
-
const claudeDir = path.join(projectPath, '.claude');
|
|
184
|
-
if (await fs.pathExists(claudeDir)) {
|
|
185
|
-
const entries = await fs.readdir(claudeDir, { withFileTypes: true });
|
|
186
|
-
for (const entry of entries) {
|
|
187
|
-
if (entry.isDirectory()) {
|
|
188
|
-
const pluginJsonPath = path.join(claudeDir, entry.name, '.claude-plugin', 'plugin.json');
|
|
189
|
-
if (await fs.pathExists(pluginJsonPath)) {
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return false;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Get installation instructions based on available plugin system
|
|
201
|
-
*
|
|
202
|
-
* Returns instructions for either:
|
|
203
|
-
* - Native /plugin commands (if supported)
|
|
204
|
-
* - SpecWeave CLI fallback (always available)
|
|
205
|
-
*
|
|
206
|
-
* @param pluginName Name of plugin to install
|
|
207
|
-
* @returns Installation instructions
|
|
208
|
-
*/
|
|
209
|
-
async getPluginInstallInstructions(pluginName: string): Promise<string> {
|
|
210
|
-
const hasNativePlugins = await this.supportsNativePlugins();
|
|
211
|
-
|
|
212
|
-
if (hasNativePlugins) {
|
|
213
|
-
return `
|
|
214
|
-
Installation Options:
|
|
215
|
-
|
|
216
|
-
Option 1 (Recommended): Native Claude Code
|
|
217
|
-
/plugin marketplace add specweave/marketplace
|
|
218
|
-
/plugin install ${pluginName}@specweave
|
|
219
|
-
|
|
220
|
-
Option 2: SpecWeave CLI
|
|
221
|
-
specweave plugin install ${pluginName}
|
|
222
|
-
|
|
223
|
-
Both methods install the same plugin - choose based on preference!
|
|
224
|
-
`.trim();
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
return `
|
|
228
|
-
Installation:
|
|
229
|
-
specweave plugin install ${pluginName}
|
|
230
|
-
|
|
231
|
-
Note: Native /plugin commands not detected in your Claude Code version.
|
|
232
|
-
Using SpecWeave CLI for plugin management.
|
|
233
|
-
`.trim();
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Read language configuration from project config
|
|
238
|
-
*
|
|
239
|
-
* @returns Language setting from config, defaults to 'en'
|
|
240
|
-
*/
|
|
241
|
-
private async getLanguageConfig(): Promise<SupportedLanguage> {
|
|
242
|
-
const projectPath = process.cwd();
|
|
243
|
-
const configPath = path.join(projectPath, '.specweave', 'config.json');
|
|
244
|
-
|
|
245
|
-
if (!(await fs.pathExists(configPath))) {
|
|
246
|
-
return 'en'; // Default to English if no config
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
try {
|
|
250
|
-
const config = await fs.readJson(configPath);
|
|
251
|
-
return (config.language as SupportedLanguage) || 'en';
|
|
252
|
-
} catch (error) {
|
|
253
|
-
console.warn('ā ļø Could not read language from config, defaulting to English');
|
|
254
|
-
return 'en';
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Inject system prompt for non-English languages
|
|
260
|
-
*
|
|
261
|
-
* Prepends language instruction to markdown content if language !== 'en'
|
|
262
|
-
*
|
|
263
|
-
* @param content Original markdown content
|
|
264
|
-
* @param language Target language
|
|
265
|
-
* @returns Modified content with system prompt (or unchanged if English)
|
|
266
|
-
*/
|
|
267
|
-
private injectSystemPrompt(content: string, language: SupportedLanguage): string {
|
|
268
|
-
if (language === 'en') {
|
|
269
|
-
return content; // No changes for English - preserve default behavior
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// Get system prompt for target language
|
|
273
|
-
const systemPrompt = getSystemPromptForLanguage(language);
|
|
274
|
-
|
|
275
|
-
// Inject system prompt at the top (after YAML frontmatter if present)
|
|
276
|
-
if (content.startsWith('---')) {
|
|
277
|
-
// Has YAML frontmatter - inject after closing ---
|
|
278
|
-
const endOfFrontmatter = content.indexOf('---', 3);
|
|
279
|
-
if (endOfFrontmatter !== -1) {
|
|
280
|
-
const frontmatter = content.substring(0, endOfFrontmatter + 3);
|
|
281
|
-
const body = content.substring(endOfFrontmatter + 3);
|
|
282
|
-
return `${frontmatter}\n\n${systemPrompt}\n${body}`;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// No frontmatter - inject at the very top
|
|
287
|
-
return `${systemPrompt}\n\n${content}`;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Compile and install a plugin for Claude Code
|
|
292
|
-
*
|
|
293
|
-
* Claude uses native plugin installation:
|
|
294
|
-
* - Copy skills to .claude/skills/{plugin-name}/{skill-name}/
|
|
295
|
-
* - Copy agents to .claude/agents/{plugin-name}/{agent-name}/
|
|
296
|
-
* - Copy commands to .claude/commands/
|
|
297
|
-
*
|
|
298
|
-
* Supports both:
|
|
299
|
-
* - Native /plugin install (if Claude Code supports it)
|
|
300
|
-
* - SpecWeave CLI fallback (always available)
|
|
301
|
-
*
|
|
302
|
-
* NEW: Injects system prompts for non-English languages
|
|
303
|
-
*
|
|
304
|
-
* @param plugin Plugin to install
|
|
305
|
-
*/
|
|
306
|
-
async compilePlugin(plugin: Plugin): Promise<void> {
|
|
307
|
-
const projectPath = process.cwd();
|
|
308
|
-
const claudeDir = path.join(projectPath, '.claude');
|
|
309
|
-
|
|
310
|
-
console.log(`\nš¦ Installing plugin: ${plugin.manifest.name}`);
|
|
311
|
-
|
|
312
|
-
// Get language configuration for system prompt injection
|
|
313
|
-
const language = await this.getLanguageConfig();
|
|
314
|
-
if (language !== 'en') {
|
|
315
|
-
console.log(` š Language: ${language} (system prompts will be injected)`);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// Check for native plugin support
|
|
319
|
-
const hasNativePlugins = await this.supportsNativePlugins();
|
|
320
|
-
if (hasNativePlugins) {
|
|
321
|
-
console.log(' š” Tip: You can also use native /plugin commands:');
|
|
322
|
-
console.log(` /plugin marketplace add specweave/marketplace`);
|
|
323
|
-
console.log(` /plugin install ${plugin.manifest.name.replace('specweave-', '')}@specweave`);
|
|
324
|
-
console.log('');
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
// Ensure base directories exist
|
|
328
|
-
await fs.ensureDir(path.join(claudeDir, 'skills'));
|
|
329
|
-
await fs.ensureDir(path.join(claudeDir, 'agents'));
|
|
330
|
-
await fs.ensureDir(path.join(claudeDir, 'commands'));
|
|
331
|
-
|
|
332
|
-
// Install skills
|
|
333
|
-
for (const skill of plugin.skills) {
|
|
334
|
-
const targetPath = path.join(claudeDir, 'skills', skill.name);
|
|
335
|
-
await fs.ensureDir(targetPath);
|
|
336
|
-
|
|
337
|
-
// Copy SKILL.md (with language injection if needed)
|
|
338
|
-
const skillMdPath = path.join(skill.path, 'SKILL.md');
|
|
339
|
-
if (await fs.pathExists(skillMdPath)) {
|
|
340
|
-
const content = await fs.readFile(skillMdPath, 'utf-8');
|
|
341
|
-
const modifiedContent = this.injectSystemPrompt(content, language);
|
|
342
|
-
await fs.writeFile(path.join(targetPath, 'SKILL.md'), modifiedContent, 'utf-8');
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
// Copy test cases if they exist
|
|
346
|
-
const testCasesDir = path.join(skill.path, 'test-cases');
|
|
347
|
-
if (await fs.pathExists(testCasesDir)) {
|
|
348
|
-
await fs.copy(testCasesDir, path.join(targetPath, 'test-cases'));
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
console.log(` ā Skill: ${skill.name}`);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// Install agents
|
|
355
|
-
for (const agent of plugin.agents) {
|
|
356
|
-
const targetPath = path.join(claudeDir, 'agents', agent.name);
|
|
357
|
-
await fs.ensureDir(targetPath);
|
|
358
|
-
|
|
359
|
-
// Copy AGENT.md (with language injection if needed)
|
|
360
|
-
const agentMdPath = path.join(agent.path, 'AGENT.md');
|
|
361
|
-
if (await fs.pathExists(agentMdPath)) {
|
|
362
|
-
const content = await fs.readFile(agentMdPath, 'utf-8');
|
|
363
|
-
const modifiedContent = this.injectSystemPrompt(content, language);
|
|
364
|
-
await fs.writeFile(path.join(targetPath, 'AGENT.md'), modifiedContent, 'utf-8');
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
console.log(` ā Agent: ${agent.name}`);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
// Install commands
|
|
371
|
-
for (const command of plugin.commands) {
|
|
372
|
-
// Commands use their full name as filename
|
|
373
|
-
const fileName = command.name.replace(/\./g, '-') + '.md';
|
|
374
|
-
const targetPath = path.join(claudeDir, 'commands', fileName);
|
|
375
|
-
|
|
376
|
-
if (await fs.pathExists(command.path)) {
|
|
377
|
-
const content = await fs.readFile(command.path, 'utf-8');
|
|
378
|
-
const modifiedContent = this.injectSystemPrompt(content, language);
|
|
379
|
-
await fs.writeFile(targetPath, modifiedContent, 'utf-8');
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
console.log(` ā Command: /${command.name}`);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
console.log(`\nā
Plugin ${plugin.manifest.name} installed!`);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* Unload a plugin from Claude Code
|
|
390
|
-
*
|
|
391
|
-
* Removes plugin files from .claude/ directory
|
|
392
|
-
*
|
|
393
|
-
* @param pluginName Name of plugin to unload
|
|
394
|
-
*/
|
|
395
|
-
async unloadPlugin(pluginName: string): Promise<void> {
|
|
396
|
-
const projectPath = process.cwd();
|
|
397
|
-
const claudeDir = path.join(projectPath, '.claude');
|
|
398
|
-
|
|
399
|
-
console.log(`\nšļø Unloading plugin: ${pluginName}`);
|
|
400
|
-
|
|
401
|
-
// Read plugin manifest to know what to remove
|
|
402
|
-
const pluginsDir = path.join(projectPath, 'src', 'plugins');
|
|
403
|
-
const pluginPath = path.join(pluginsDir, pluginName);
|
|
404
|
-
|
|
405
|
-
if (!(await fs.pathExists(pluginPath))) {
|
|
406
|
-
console.warn(`ā ļø Plugin ${pluginName} not found`);
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// Load plugin to get its components
|
|
411
|
-
const { PluginLoader } = await import('../../core/plugin-loader.js');
|
|
412
|
-
const loader = new PluginLoader();
|
|
413
|
-
const plugin = await loader.loadFromDirectory(pluginPath);
|
|
414
|
-
|
|
415
|
-
// Remove skills
|
|
416
|
-
for (const skill of plugin.skills) {
|
|
417
|
-
const skillPath = path.join(claudeDir, 'skills', skill.name);
|
|
418
|
-
if (await fs.pathExists(skillPath)) {
|
|
419
|
-
await fs.remove(skillPath);
|
|
420
|
-
console.log(` ā Removed skill: ${skill.name}`);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// Remove agents
|
|
425
|
-
for (const agent of plugin.agents) {
|
|
426
|
-
const agentPath = path.join(claudeDir, 'agents', agent.name);
|
|
427
|
-
if (await fs.pathExists(agentPath)) {
|
|
428
|
-
await fs.remove(agentPath);
|
|
429
|
-
console.log(` ā Removed agent: ${agent.name}`);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// Remove commands
|
|
434
|
-
for (const command of plugin.commands) {
|
|
435
|
-
const fileName = command.name.replace(/\./g, '-') + '.md';
|
|
436
|
-
const commandPath = path.join(claudeDir, 'commands', fileName);
|
|
437
|
-
if (await fs.pathExists(commandPath)) {
|
|
438
|
-
await fs.remove(commandPath);
|
|
439
|
-
console.log(` ā Removed command: /${command.name}`);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
console.log(`\nā
Plugin ${pluginName} unloaded!`);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Get list of installed plugins
|
|
448
|
-
*
|
|
449
|
-
* Returns plugin names that are currently installed in .claude/
|
|
450
|
-
*
|
|
451
|
-
* @returns Array of installed plugin names
|
|
452
|
-
*/
|
|
453
|
-
async getInstalledPlugins(): Promise<string[]> {
|
|
454
|
-
const projectPath = process.cwd();
|
|
455
|
-
const configPath = path.join(projectPath, '.specweave', 'config.yaml');
|
|
456
|
-
|
|
457
|
-
if (!(await fs.pathExists(configPath))) {
|
|
458
|
-
return [];
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
// Read config to get enabled plugins
|
|
462
|
-
const yaml = await import('js-yaml');
|
|
463
|
-
const content = await fs.readFile(configPath, 'utf-8');
|
|
464
|
-
const config = yaml.load(content) as any;
|
|
465
|
-
|
|
466
|
-
return config.plugins?.enabled || [];
|
|
467
|
-
}
|
|
468
|
-
}
|