@vpxa/aikit 0.1.126 → 0.1.127
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/package.json +2 -2
- package/TECH.md +0 -1348
- package/scaffold/README.md +0 -228
package/scaffold/README.md
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
# Scaffold System — Contributor Guide
|
|
2
|
-
|
|
3
|
-
> **⚠️ GOLDEN RULE: Never edit files in `scaffold/general/` or `scaffold/claude-code/` directly.**
|
|
4
|
-
> They are **generated output** and will be overwritten by `generate.mjs`.
|
|
5
|
-
> Always edit the **source files** in `scaffold/definitions/`.
|
|
6
|
-
|
|
7
|
-
## Architecture
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
scaffold/
|
|
11
|
-
├── definitions/ ← SOURCE OF TRUTH (edit here)
|
|
12
|
-
│ ├── agents.mjs Agent metadata (name, description, model, tools, category)
|
|
13
|
-
│ ├── bodies.mjs Agent body text (mode instructions per agent)
|
|
14
|
-
│ ├── flows.mjs Flow step instruction content (step READMEs as JS strings)
|
|
15
|
-
│ ├── skills.mjs Skill content (SKILL.md + reference files as JS strings)
|
|
16
|
-
│ ├── models.mjs Available models per IDE
|
|
17
|
-
│ ├── protocols.mjs Shared protocol files (_shared/*.md) + templates
|
|
18
|
-
│ ├── tools.mjs Tool capability → IDE tool mappings
|
|
19
|
-
│ ├── prompts.mjs Prompt file content
|
|
20
|
-
│ ├── hooks.mjs Hook definitions
|
|
21
|
-
│ └── plugins.mjs Plugin definitions
|
|
22
|
-
│
|
|
23
|
-
├── adapters/ ← IDE-specific generators
|
|
24
|
-
│ ├── copilot.mjs GitHub Copilot adapter (active — generates ~32 files)
|
|
25
|
-
│ ├── claude-code.mjs Claude Code adapter (stub — no output yet)
|
|
26
|
-
│ ├── flows.mjs Flow step file generator (reads definitions/flows.mjs)
|
|
27
|
-
│ └── skills.mjs Skill file generator (reads definitions/skills.mjs)
|
|
28
|
-
│
|
|
29
|
-
├── generate.mjs ← BUILD SCRIPT (run after any change)
|
|
30
|
-
│
|
|
31
|
-
├── general/ ← GENERATED OUTPUT for Copilot (DO NOT EDIT)
|
|
32
|
-
│ ├── agents/
|
|
33
|
-
│ │ ├── _shared/ Protocol files (from PROTOCOLS in protocols.mjs)
|
|
34
|
-
│ │ ├── templates/ Template files (from TEMPLATES in protocols.mjs)
|
|
35
|
-
│ │ └── *.agent.md Agent files (from AGENT_BODIES in bodies.mjs)
|
|
36
|
-
│ └── prompts/ Prompt files (from PROMPTS in prompts.mjs)
|
|
37
|
-
│
|
|
38
|
-
└── claude-code/ ← GENERATED OUTPUT for Claude Code (stub, DO NOT EDIT)
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Data Flow
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
definitions/*.mjs → generate.mjs → scaffold/general/ → aikit init → .github/ (user project)
|
|
45
|
-
(source) (build script) (generated output) (deploy) (user workspace)
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## How to Make Changes
|
|
49
|
-
|
|
50
|
-
### Step 1: Edit Source Files
|
|
51
|
-
|
|
52
|
-
| What you want to change | Edit this file |
|
|
53
|
-
|--------------------------|---------------|
|
|
54
|
-
| An agent's body/instructions | `definitions/bodies.mjs` → `AGENT_BODIES[agentName]` |
|
|
55
|
-
| Shared rules for code agents | `definitions/protocols.mjs` → `PROTOCOLS['code-agent-base']` |
|
|
56
|
-
| Shared rules for researchers | `definitions/protocols.mjs` → `PROTOCOLS['researcher-base']` |
|
|
57
|
-
| Agent metadata (model, tools) | `definitions/agents.mjs` → `AGENTS[agentName]` |
|
|
58
|
-
| Flow step instructions | `definitions/flows.mjs` → `FLOWS['<flow-name>']` find the step file entry |
|
|
59
|
-
| Skill content | `definitions/skills.mjs` → `SKILLS['<skill-name>']` find the file entry |
|
|
60
|
-
| Available models | `definitions/models.mjs` |
|
|
61
|
-
| Tool mappings | `definitions/tools.mjs` |
|
|
62
|
-
| Prompt files | `definitions/prompts.mjs` |
|
|
63
|
-
|
|
64
|
-
### Step 2: Regenerate Output
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
node scaffold/generate.mjs
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
This will:
|
|
71
|
-
1. Clean `general/agents/` and `general/prompts/` directories
|
|
72
|
-
2. Regenerate all files from definitions via the copilot adapter
|
|
73
|
-
3. Print every file written (expect ~32 files)
|
|
74
|
-
|
|
75
|
-
To generate for a specific IDE only:
|
|
76
|
-
```bash
|
|
77
|
-
node scaffold/generate.mjs --ide copilot
|
|
78
|
-
node scaffold/generate.mjs --ide claude-code
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Step 3: Verify
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
# Syntax check the source file you edited
|
|
85
|
-
node -e "import('./scaffold/definitions/bodies.mjs')"
|
|
86
|
-
node -e "import('./scaffold/definitions/flows.mjs')"
|
|
87
|
-
|
|
88
|
-
# Verify your changes appear in generated output
|
|
89
|
-
# (use grep/Select-String for key phrases)
|
|
90
|
-
grep -r "your key phrase" scaffold/general/agents/
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Step 4: Commit Both Source AND Generated
|
|
94
|
-
|
|
95
|
-
Always commit the definition source files AND the regenerated output together.
|
|
96
|
-
The generated files are checked into git so `aikit init` can deploy them without
|
|
97
|
-
running the generator.
|
|
98
|
-
|
|
99
|
-
## Source File Details
|
|
100
|
-
|
|
101
|
-
### bodies.mjs
|
|
102
|
-
|
|
103
|
-
Contains `AGENT_BODIES` — an object mapping agent names to their body text.
|
|
104
|
-
|
|
105
|
-
- Most values are **template literal strings** (`` `...` ``)
|
|
106
|
-
- The **Orchestrator** body is a **function** `(agentTable) => string` because it
|
|
107
|
-
dynamically includes the agent roster table
|
|
108
|
-
- Backticks inside content must be escaped: `` \` ``
|
|
109
|
-
|
|
110
|
-
```js
|
|
111
|
-
export const AGENT_BODIES = {
|
|
112
|
-
Orchestrator: (agentTable) => `# Orchestrator\n${agentTable}\n...`,
|
|
113
|
-
Implementer: `# Implementer\n...`,
|
|
114
|
-
Debugger: `# Debugger\n...`,
|
|
115
|
-
// ...
|
|
116
|
-
};
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### flows.mjs
|
|
120
|
-
|
|
121
|
-
Contains `FLOWS` — flow step instruction content for all builtin flows.
|
|
122
|
-
|
|
123
|
-
- Keys are flow names: `'aikit-advanced'`, `'aikit-basic'`, `'_epilogue'`
|
|
124
|
-
- Each value is an array of `{ file, content }` objects — one per step README
|
|
125
|
-
- `file` is the relative path (e.g. `'steps/plan/README.md'`)
|
|
126
|
-
- `content` is the markdown string (escape backticks as `` \` ``)
|
|
127
|
-
|
|
128
|
-
```js
|
|
129
|
-
export const FLOWS = {
|
|
130
|
-
'aikit-advanced': [
|
|
131
|
-
{ file: 'steps/plan/README.md', content: `# Planning\n...` },
|
|
132
|
-
...
|
|
133
|
-
],
|
|
134
|
-
};
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### skills.mjs
|
|
138
|
-
|
|
139
|
-
Contains `SKILLS` — content for all builtin skills.
|
|
140
|
-
|
|
141
|
-
- Keys are skill names: `'aikit'`, `'brainstorming'`, `'typescript'`, etc.
|
|
142
|
-
- Each value is an array of `{ file, content }` objects — SKILL.md + reference files
|
|
143
|
-
- Edit content inline; no markdown files to maintain separately
|
|
144
|
-
|
|
145
|
-
### protocols.mjs
|
|
146
|
-
|
|
147
|
-
Contains `PROTOCOLS` and `TEMPLATES` — objects mapping names to markdown content.
|
|
148
|
-
|
|
149
|
-
- Each `PROTOCOLS` key becomes a file in `_shared/`:
|
|
150
|
-
- `'code-agent-base'` → `agents/_shared/code-agent-base.md`
|
|
151
|
-
- `'researcher-base'` → `agents/_shared/researcher-base.md`
|
|
152
|
-
- `'decision-protocol'` → `agents/_shared/decision-protocol.md`
|
|
153
|
-
- etc.
|
|
154
|
-
- Each `TEMPLATES` key becomes a file in `templates/`
|
|
155
|
-
- All values are template literals — escape backticks as `` \` ``
|
|
156
|
-
|
|
157
|
-
**Protocol → Agent mapping:**
|
|
158
|
-
|
|
159
|
-
| Protocol | Used by |
|
|
160
|
-
|----------|---------|
|
|
161
|
-
| `code-agent-base` | Implementer, Frontend, Refactor, Debugger |
|
|
162
|
-
| `researcher-base` | Researcher-Alpha/Beta/Gamma/Delta |
|
|
163
|
-
| `code-reviewer-base` | Code-Reviewer-Alpha/Beta |
|
|
164
|
-
| `architect-reviewer-base` | Architect-Reviewer-Alpha/Beta |
|
|
165
|
-
| `decision-protocol` | Referenced by Orchestrator workflow |
|
|
166
|
-
| `forge-protocol` | Referenced by code-agent-base |
|
|
167
|
-
|
|
168
|
-
### agents.mjs
|
|
169
|
-
|
|
170
|
-
Defines every agent's metadata:
|
|
171
|
-
- `description`, `argumentHint` — displayed in the agent picker
|
|
172
|
-
- `model` — which LLM model to use
|
|
173
|
-
- `tools` — abstract capability list (mapped to IDE-specific tools by the adapter)
|
|
174
|
-
- `category` — orchestration, implementation, diagnostics, research, review, etc.
|
|
175
|
-
- `sharedBase` — for variant agents (e.g., Researcher-Alpha uses `researcher-base`)
|
|
176
|
-
|
|
177
|
-
## How Users Receive Changes
|
|
178
|
-
|
|
179
|
-
When users run `aikit init`, the scaffold files are deployed to their `.github/` directory.
|
|
180
|
-
|
|
181
|
-
### First Install (Legacy Path)
|
|
182
|
-
|
|
183
|
-
`copyDirectoryRecursive()` — copies all scaffold files, **skips existing** files.
|
|
184
|
-
No tracking, no merging.
|
|
185
|
-
|
|
186
|
-
### Updates (Smart Path)
|
|
187
|
-
|
|
188
|
-
`smartCopyScaffold()` — manifest-based with `.aikit-scaffold.json`:
|
|
189
|
-
|
|
190
|
-
| File Status | Strategy | Behavior |
|
|
191
|
-
|-------------|----------|----------|
|
|
192
|
-
| `new` (not in manifest, not on disk) | deploy | Copy file, record hash |
|
|
193
|
-
| `new` (not in manifest, exists on disk) | record | Record hash only (preserve user edits) |
|
|
194
|
-
| `outdated` (source hash changed) | `merge-frontmatter` | **Agent files**: update body, union tools, keep user's model choice |
|
|
195
|
-
| `outdated` (source hash changed) | `overwrite` | **Protocol/shared files**: replace entirely |
|
|
196
|
-
| `current` (unchanged) | skip | No action |
|
|
197
|
-
|
|
198
|
-
The update strategy is determined by `getUpdateStrategy(relPath)` based on the file path.
|
|
199
|
-
|
|
200
|
-
**Key implication**: When you update an agent body in `bodies.mjs`, existing users will
|
|
201
|
-
get the updated body text while preserving their custom model choice and any extra tools
|
|
202
|
-
they added. Protocol files (`_shared/*.md`) are fully replaced.
|
|
203
|
-
|
|
204
|
-
## Common Mistakes
|
|
205
|
-
|
|
206
|
-
| Mistake | Why it's wrong | What to do instead |
|
|
207
|
-
|---------|---------------|-------------------|
|
|
208
|
-
| Editing deployed files directly (e.g. `~/.copilot/skills/`, `~/.github/agents/`) | These are **deploy targets**, not source. Changes will be overwritten on next `aikit init` or `generate.mjs` run | Always edit in `scaffold/definitions/` -> run `generate.mjs` -> then `aikit init` to deploy |
|
|
209
|
-
| Editing `.agent.md` in `general/agents/` | Will be overwritten by `generate.mjs` | Edit `bodies.mjs` for agent bodies |
|
|
210
|
-
| Editing `_shared/*.md` in `general/agents/` | Will be overwritten by `generate.mjs` | Edit `protocols.mjs` PROTOCOLS constant |
|
|
211
|
-
| Editing flow step content in `_preview/flows/` | Will be overwritten by `generate.mjs` | Edit `definitions/flows.mjs` |
|
|
212
|
-
| Editing skill content in `_preview/skills/` | Will be overwritten by `generate.mjs` | Edit `definitions/skills.mjs` |
|
|
213
|
-
| Forgetting to run `generate.mjs` | Generated files will be stale, `aikit init` deploys stale files | Always run after editing definitions |
|
|
214
|
-
| Committing only source OR only generated | Source and output will be out of sync | Commit both together |
|
|
215
|
-
| Unescaped backticks in template literals | JS syntax error in definitions | Use `` \` `` inside template literal strings |
|
|
216
|
-
|
|
217
|
-
## PR Checklist
|
|
218
|
-
|
|
219
|
-
- [ ] Changes made in `scaffold/definitions/*.mjs` (NOT in generated output)
|
|
220
|
-
- [ ] `node scaffold/generate.mjs` runs without errors
|
|
221
|
-
- [ ] Generated output contains expected changes (verified with grep)
|
|
222
|
-
- [ ] Both source and generated files included in commit
|
|
223
|
-
- [ ] If adding a new agent: entry in `agents.mjs` + body in `bodies.mjs`
|
|
224
|
-
- [ ] If adding a new protocol: entry in `protocols.mjs` + reference in relevant agent bodies
|
|
225
|
-
- [ ] If adding/updating a flow step: edit `definitions/flows.mjs` → correct `FLOWS` entry
|
|
226
|
-
- [ ] If adding/updating a skill: edit `definitions/skills.mjs` → correct `SKILLS` entry
|
|
227
|
-
- [ ] If adding a new file type: check `getUpdateStrategy()` returns correct merge strategy
|
|
228
|
-
- [ ] Consider impact on existing user installations (will merge preserve their customizations?)
|