magic-spec 1.0.0 → 1.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/README.md +196 -180
- package/installers/node/index.js +275 -0
- package/package.json +11 -20
- package/.agent/workflows/magic/plan.md +0 -12
- package/.agent/workflows/magic/retrospective.md +0 -12
- package/.agent/workflows/magic/rule.md +0 -12
- package/.agent/workflows/magic/specification.md +0 -12
- package/.agent/workflows/magic/task.md +0 -12
- package/.magic/init.md +0 -63
- package/.magic/plan.md +0 -289
- package/.magic/retrospective.md +0 -276
- package/.magic/rule.md +0 -96
- package/.magic/scripts/init.ps1 +0 -88
- package/.magic/scripts/init.sh +0 -85
- package/.magic/specification.md +0 -378
- package/.magic/task.md +0 -443
- package/src/index.js +0 -81
package/.magic/task.md
DELETED
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Workflow for generating and executing implementation tasks from the project plan.
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Task Workflow
|
|
6
|
-
|
|
7
|
-
This workflow reads `.design/PLAN.md` and decomposes it into atomic, executable tasks.
|
|
8
|
-
It operates **after** the Plan Workflow — the plan is its input, not its concern.
|
|
9
|
-
|
|
10
|
-
> **Scope**: Task generation, execution tracking, parallelism, and agent coordination.
|
|
11
|
-
> Specification authoring → Spec Workflow. Planning → Plan Workflow. Execution → this workflow.
|
|
12
|
-
|
|
13
|
-
## Agent Guidelines
|
|
14
|
-
|
|
15
|
-
**CRITICAL INSTRUCTIONS FOR AI:**
|
|
16
|
-
|
|
17
|
-
1. **Plan First**: Never generate tasks without reading `.design/PLAN.md`. Tasks are derived from the plan — they do not invent scope.
|
|
18
|
-
2. **Auto-Init**: If `.design/` or its system files are missing, automatically trigger the Init pre-flight check (`.magic/init.md`) before proceeding.
|
|
19
|
-
3. **Atomic Tasks**: Each task must map to exactly one section of one spec file. A task that touches two specs is two tasks.
|
|
20
|
-
4. **Dependency Respect**: Never mark a task as available if its declared dependencies are not `Done`.
|
|
21
|
-
5. **Mode Awareness**: Always know the current execution mode (Sequential or Parallel). Behaviour differs significantly between them.
|
|
22
|
-
6. **Manager Role**: In Parallel mode, the Manager Agent coordinates — it does not implement. It reads status, unblocks tracks, and escalates conflicts.
|
|
23
|
-
7. **Checklist Before Done**: Every workflow operation must end with the *Task Completion Checklist*.
|
|
24
|
-
|
|
25
|
-
## Directory Structure
|
|
26
|
-
|
|
27
|
-
```plaintext
|
|
28
|
-
.design/
|
|
29
|
-
├── INDEX.md
|
|
30
|
-
├── RULES.md
|
|
31
|
-
├── PLAN.md # Input: implementation plan
|
|
32
|
-
├── specifications/
|
|
33
|
-
└── tasks/ # Output: task files
|
|
34
|
-
├── TASKS.md # Master index: all tasks, all phases, all statuses
|
|
35
|
-
└── phase-{n}.md # Per-phase task breakdown with tracks
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Task Anatomy
|
|
39
|
-
|
|
40
|
-
Every task has a fixed structure:
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
[T-{phase}{track}{seq}] {Title}
|
|
44
|
-
Spec: {spec-name}.md §{section}
|
|
45
|
-
Phase: {n} / Track {A|B|C...}
|
|
46
|
-
Depends: {T-ID, T-ID, ... | —}
|
|
47
|
-
Status: {Todo | In Progress | Done | Blocked}
|
|
48
|
-
Assignee: {Developer-A | Developer-B | ... | unassigned}
|
|
49
|
-
Notes: {optional}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**ID format**: `T-1A01` = Phase 1, Track A, task 01.
|
|
53
|
-
|
|
54
|
-
**Status rules:**
|
|
55
|
-
|
|
56
|
-
- `Todo` — not yet started; dependencies may or may not be satisfied
|
|
57
|
-
- `In Progress` — actively being worked on
|
|
58
|
-
- `Done` — implementation complete, output verified
|
|
59
|
-
- `Blocked` — cannot proceed; blocking reason must be stated in Notes
|
|
60
|
-
|
|
61
|
-
## Execution Tracks
|
|
62
|
-
|
|
63
|
-
Within each phase, tasks are grouped into **Execution Tracks**. Tasks in different tracks are independent and can run in parallel. Tasks within the same track run sequentially.
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
Phase 2
|
|
67
|
-
Track A: [T-2A01] → [T-2A02] → [T-2A03] ══╗
|
|
68
|
-
║ (parallel)
|
|
69
|
-
Track B: [T-2B01] → [T-2B02] ══╣
|
|
70
|
-
║
|
|
71
|
-
Track C: [T-2C01] (depends on A + B) ══╝ (after A and B complete)
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Track assignment is derived from the dependency graph in PLAN.md — specs that don't depend on each other can be different tracks.
|
|
75
|
-
|
|
76
|
-
## Execution Modes
|
|
77
|
-
|
|
78
|
-
### Sequential Mode
|
|
79
|
-
|
|
80
|
-
One agent works through tasks in track order, phase by phase. Default mode for solo development or single-agent setups.
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
Manager Agent: reads TASKS.md, picks next available task, executes, updates status, repeats.
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### Parallel Mode
|
|
87
|
-
|
|
88
|
-
Multiple Developer Agents work simultaneously, each owning one track. A Manager Agent coordinates.
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
Manager Agent: reads TASKS.md → assigns tracks → monitors → unblocks → escalates
|
|
92
|
-
Developer Agent A: owns Track A → executes T-xA01, T-xA02... → reports Done/Blocked
|
|
93
|
-
Developer Agent B: owns Track B → executes T-xB01, T-xB02... → reports Done/Blocked
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
The execution mode is stored in `RULES.md §7` as a Project Convention and does not need to be re-asked on subsequent runs.
|
|
97
|
-
|
|
98
|
-
## Workflow Steps
|
|
99
|
-
|
|
100
|
-
### Initializing Tasks
|
|
101
|
-
|
|
102
|
-
Use when `.design/tasks/TASKS.md` does not exist.
|
|
103
|
-
|
|
104
|
-
**Trigger phrase**: *"Generate tasks"* or *"Create tasks"*
|
|
105
|
-
|
|
106
|
-
```mermaid
|
|
107
|
-
graph TD
|
|
108
|
-
A[Trigger: Generate Tasks] --> B[Read PLAN.md]
|
|
109
|
-
B --> C[Read all referenced spec files]
|
|
110
|
-
C --> D{First run?}
|
|
111
|
-
D -->|Yes| E[Ask execution mode]
|
|
112
|
-
D -->|No| F[Read mode from RULES.md §7]
|
|
113
|
-
E --> G[Save mode to RULES.md §7]
|
|
114
|
-
G --> H[Decompose phases into tasks]
|
|
115
|
-
F --> H
|
|
116
|
-
H --> I[Assign tracks based on dependency graph]
|
|
117
|
-
I --> J[Propose task breakdown to user]
|
|
118
|
-
J -->|Approved| K[Write TASKS.md + phase files]
|
|
119
|
-
J -->|Adjusted| H
|
|
120
|
-
K --> L[Task Completion Checklist]
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
1. **Read PLAN.md**: Get phases, specs per phase, dependency graph, and critical path.
|
|
124
|
-
2. **Read spec files**: For each spec in PLAN.md, read its `Implementation Notes` (§4) if present — these directly inform task decomposition.
|
|
125
|
-
3. **Ask execution mode** (first run only):
|
|
126
|
-
|
|
127
|
-
```
|
|
128
|
-
How should tasks be executed?
|
|
129
|
-
|
|
130
|
-
A) Sequential — one agent works through tasks in order (default)
|
|
131
|
-
B) Parallel — Manager Agent + Developer Agents per track
|
|
132
|
-
|
|
133
|
-
This choice will be saved to RULES.md §7 and used for all future runs.
|
|
134
|
-
You can change it at any time with: "Switch to parallel mode"
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
4. **Decompose**: For each spec in each phase, extract atomic tasks from:
|
|
138
|
-
- Numbered sections in `Detailed Design`
|
|
139
|
-
- Steps listed in `Implementation Notes`
|
|
140
|
-
- Logical units implied by the spec's structure
|
|
141
|
-
|
|
142
|
-
One spec section = one task (or a few if the section is large). Never bundle multiple specs into one task.
|
|
143
|
-
|
|
144
|
-
5. **Assign tracks**: Group tasks into tracks based on independence:
|
|
145
|
-
- Tasks with no shared dependencies → separate tracks (can run in parallel)
|
|
146
|
-
- Tasks that depend on the same prerequisite → may share a track or be sequenced
|
|
147
|
-
|
|
148
|
-
6. **Propose breakdown**: Show the user the full task structure before writing:
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
Proposed Task Breakdown — Phase 1
|
|
152
|
-
|
|
153
|
-
Execution mode: Sequential
|
|
154
|
-
|
|
155
|
-
Track A — Core Layer
|
|
156
|
-
[T-1A01] Define AppState FSM structure
|
|
157
|
-
Spec: architecture.md §3.1
|
|
158
|
-
Depends: —
|
|
159
|
-
|
|
160
|
-
[T-1A02] Implement Path Reliability (current_exe)
|
|
161
|
-
Spec: architecture.md §3.2
|
|
162
|
-
Depends: T-1A01
|
|
163
|
-
|
|
164
|
-
Track B — API Contract (parallel with A)
|
|
165
|
-
[T-1B01] Define LaunchpadBuilder interface
|
|
166
|
-
Spec: api.md §2.1
|
|
167
|
-
Depends: —
|
|
168
|
-
|
|
169
|
-
Track C — Settings Schema (after A)
|
|
170
|
-
[T-1C01] Define RON schema root structure
|
|
171
|
-
Spec: settings-schema.md §1.1
|
|
172
|
-
Depends: T-1A01
|
|
173
|
-
|
|
174
|
-
[T-1C02] Define Graphics and Audio blocks
|
|
175
|
-
Spec: settings-schema.md §2.1, §2.2
|
|
176
|
-
Depends: T-1C01
|
|
177
|
-
|
|
178
|
-
Total: 5 tasks, 3 tracks
|
|
179
|
-
Parallelisable at start: Track A and Track B simultaneously
|
|
180
|
-
|
|
181
|
-
Proceed? (yes / adjust)
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
7. **Write files**: Create `TASKS.md` (master index) and `phase-1.md`, `phase-2.md`... using the templates below.
|
|
185
|
-
8. **Task Completion Checklist**: Present the checklist.
|
|
186
|
-
|
|
187
|
-
### Executing Tasks (Sequential Mode)
|
|
188
|
-
|
|
189
|
-
**Trigger phrase**: *"Start tasks"*, *"Next task"*, *"Continue"*
|
|
190
|
-
|
|
191
|
-
```mermaid
|
|
192
|
-
graph TD
|
|
193
|
-
A[Trigger: Execute] --> B[Read TASKS.md]
|
|
194
|
-
B --> C[Find next available task]
|
|
195
|
-
C --> D{Dependencies satisfied?}
|
|
196
|
-
D -->|No| E[Report blocked, show what is needed]
|
|
197
|
-
D -->|Yes| F[Execute task]
|
|
198
|
-
F --> G{Result?}
|
|
199
|
-
G -->|Done| H[Mark Done in TASKS.md + phase file]
|
|
200
|
-
G -->|Blocked| I[Mark Blocked, state reason in Notes]
|
|
201
|
-
H --> J[Check if phase complete]
|
|
202
|
-
J -->|Phase done| K[Auto-snapshot: run retrospective Level 1]
|
|
203
|
-
K --> L{Entire plan complete?}
|
|
204
|
-
L -->|Yes| M[Auto-run: full retrospective Level 2]
|
|
205
|
-
L -->|No| N[Report phase complete, propose next phase]
|
|
206
|
-
J -->|More tasks| C
|
|
207
|
-
I --> O[Escalate to user]
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
1. **Find next available task**: The task with status `Todo` whose all dependencies are `Done`. In sequential mode: pick the first one in track order.
|
|
211
|
-
2. **Execute**: Perform the implementation work described by the task. Stay within the task's spec section — do not expand scope.
|
|
212
|
-
3. **Update status**: Mark `In Progress` when starting, `Done` when complete, `Blocked` if a blocker is encountered.
|
|
213
|
-
4. **Report**: After each task, briefly state what was done and what is next.
|
|
214
|
-
5. **On phase completion**:
|
|
215
|
-
- Run **retrospective Level 1 (auto-snapshot)**: read INDEX.md, TASKS.md, RULES.md → count stats → append one row to `.design/RETROSPECTIVE.md` Snapshots table. Do this **silently** — no user confirmation needed.
|
|
216
|
-
- Check if the **entire plan** is complete (all phases, all tasks Done). If yes → auto-run **retrospective Level 2 (full)** as the final step.
|
|
217
|
-
- If not done → report phase complete and propose the next phase.
|
|
218
|
-
|
|
219
|
-
### Executing Tasks (Parallel Mode)
|
|
220
|
-
|
|
221
|
-
**Trigger phrase**: *"Start parallel execution"*, *"Launch agents"*
|
|
222
|
-
|
|
223
|
-
```mermaid
|
|
224
|
-
graph TD
|
|
225
|
-
A[Trigger: Parallel Execute] --> B[Manager: Read TASKS.md]
|
|
226
|
-
B --> C[Manager: Identify available tracks]
|
|
227
|
-
C --> D[Manager: Assign tracks to Developer Agents]
|
|
228
|
-
D --> E[Developer Agents: Execute in parallel]
|
|
229
|
-
E --> F{Agent reports}
|
|
230
|
-
F -->|Done| G[Manager: Update status, check for newly unblocked tasks]
|
|
231
|
-
F -->|Blocked| H[Manager: Resolve or escalate]
|
|
232
|
-
G --> I{All tasks done?}
|
|
233
|
-
I -->|No| C
|
|
234
|
-
I -->|Yes| J[Auto-snapshot: run retrospective Level 1]
|
|
235
|
-
J --> L{Entire plan complete?}
|
|
236
|
-
L -->|Yes| M[Auto-run: full retrospective Level 2]
|
|
237
|
-
L -->|No| N[Manager: Report phase complete]
|
|
238
|
-
H --> K[User decision]
|
|
239
|
-
K --> C
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
#### Manager Agent Responsibilities
|
|
243
|
-
|
|
244
|
-
The Manager Agent does not write implementation code. Its job is coordination:
|
|
245
|
-
|
|
246
|
-
- **At start of phase**: Read TASKS.md, identify all `Todo` tasks whose dependencies are satisfied, assign each available track to a Developer Agent.
|
|
247
|
-
- **On task completion**: Update task status to `Done`, recalculate which tasks are now unblocked, assign newly available tasks.
|
|
248
|
-
- **On blocking**: Read the blocker reason, determine if it can be resolved (missing spec detail → consult spec file, dependency not done → reorder), escalate to user if not resolvable.
|
|
249
|
-
- **On conflict**: If two Developer Agents need to modify the same file simultaneously, Manager serializes access — one waits while the other finishes.
|
|
250
|
-
- **Status report**: After each round of completions, show a compact summary:
|
|
251
|
-
|
|
252
|
-
```
|
|
253
|
-
Phase 2 Status — {timestamp}
|
|
254
|
-
|
|
255
|
-
Track A: [T-2A01] Done ✓ [T-2A02] In Progress...
|
|
256
|
-
Track B: [T-2B01] Done ✓ [T-2B02] Done ✓
|
|
257
|
-
Track C: [T-2C01] Blocked — waiting for T-2A02
|
|
258
|
-
|
|
259
|
-
Newly unblocked: none
|
|
260
|
-
Active agents: Developer-A (T-2A02)
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
#### Developer Agent Responsibilities
|
|
264
|
-
|
|
265
|
-
Each Developer Agent owns one track for the duration of a phase:
|
|
266
|
-
|
|
267
|
-
- Execute tasks in track order, one at a time.
|
|
268
|
-
- Report `Done` to Manager when complete, `Blocked` with reason when stuck.
|
|
269
|
-
- Do not touch files outside the assigned track's scope without Manager approval.
|
|
270
|
-
- Do not start the next task until the current one is `Done`.
|
|
271
|
-
|
|
272
|
-
### Updating Tasks
|
|
273
|
-
|
|
274
|
-
**Trigger phrase**: *"Update tasks"*, *"Sync tasks"*
|
|
275
|
-
|
|
276
|
-
Use when specs or the plan have changed after tasks were generated.
|
|
277
|
-
|
|
278
|
-
1. Read current `TASKS.md` and compare against `PLAN.md`.
|
|
279
|
-
2. Detect changes:
|
|
280
|
-
- New spec added to plan → propose new tasks for that spec
|
|
281
|
-
- Spec updated (new section) → propose additional task
|
|
282
|
-
- Spec deprecated → mark related tasks as `Cancelled` in TASKS.md
|
|
283
|
-
3. Show diff to user before writing:
|
|
284
|
-
|
|
285
|
-
```
|
|
286
|
-
Task sync detected changes:
|
|
287
|
-
|
|
288
|
-
+ New tasks proposed (gameplay-config.md added to Phase 4):
|
|
289
|
-
[T-4A01] Implement gameplay.ron deserialization
|
|
290
|
-
[T-4A02] Implement hot-reload event (GameplayConfigChanged)
|
|
291
|
-
|
|
292
|
-
~ Modified tasks (architecture.md §3.2 updated):
|
|
293
|
-
[T-1A02] "Implement Path Reliability" — spec section updated
|
|
294
|
-
→ Recommend: re-verify if task is still accurate
|
|
295
|
-
|
|
296
|
-
Apply? (yes / select / skip)
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
### Task Completion Checklist
|
|
300
|
-
|
|
301
|
-
**Must be shown at the end of every task workflow operation.**
|
|
302
|
-
|
|
303
|
-
```
|
|
304
|
-
Task Workflow Checklist — {operation description}
|
|
305
|
-
|
|
306
|
-
Input Integrity
|
|
307
|
-
☐ PLAN.md was read before any tasks were generated or modified
|
|
308
|
-
☐ All task-to-spec mappings reference real sections in real spec files
|
|
309
|
-
|
|
310
|
-
Task Structure
|
|
311
|
-
☐ Each task maps to exactly one spec section (no cross-spec bundling)
|
|
312
|
-
☐ All task IDs follow the T-{phase}{track}{seq} format
|
|
313
|
-
☐ All dependencies declared explicitly (or marked —)
|
|
314
|
-
|
|
315
|
-
Track Integrity
|
|
316
|
-
☐ Tasks in different tracks have no hidden shared dependencies
|
|
317
|
-
☐ Track C (or later) tasks correctly depend on earlier track completions
|
|
318
|
-
☐ No circular dependencies between tasks
|
|
319
|
-
|
|
320
|
-
Execution Mode
|
|
321
|
-
☐ Execution mode recorded in RULES.md §7
|
|
322
|
-
☐ In Parallel mode: Manager Agent role is clearly defined
|
|
323
|
-
☐ In Parallel mode: no two agents assigned to the same file simultaneously
|
|
324
|
-
|
|
325
|
-
Status
|
|
326
|
-
☐ TASKS.md updated to reflect current state
|
|
327
|
-
☐ Per-phase files updated to match TASKS.md
|
|
328
|
-
☐ All Blocked tasks have a reason stated in Notes
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
## Templates
|
|
332
|
-
|
|
333
|
-
### TASKS.md — Master Index
|
|
334
|
-
|
|
335
|
-
```markdown
|
|
336
|
-
# Task Index
|
|
337
|
-
|
|
338
|
-
**Version:** {X.Y.Z}
|
|
339
|
-
**Generated:** {YYYY-MM-DD}
|
|
340
|
-
**Based on:** .design/PLAN.md v{X.Y.Z}
|
|
341
|
-
**Execution Mode:** {Sequential | Parallel}
|
|
342
|
-
**Status:** Active
|
|
343
|
-
|
|
344
|
-
## Overview
|
|
345
|
-
|
|
346
|
-
Master index of all implementation tasks. Detailed breakdowns: see `phase-{n}.md` files.
|
|
347
|
-
|
|
348
|
-
## Summary
|
|
349
|
-
|
|
350
|
-
| Phase | Total | Todo | In Progress | Done | Blocked |
|
|
351
|
-
| :---- | ----: | ---: | ----------: | ---: | ------: |
|
|
352
|
-
| Phase 1 — Foundation | 5 | 3 | 1 | 1 | 0 |
|
|
353
|
-
| Phase 2 — Services & Data | 8 | 8 | 0 | 0 | 0 |
|
|
354
|
-
| **Total** | **13** | **11** | **1** | **1** | **0** |
|
|
355
|
-
|
|
356
|
-
## Phase 1 — Foundation
|
|
357
|
-
|
|
358
|
-
See [phase-1.md](phase-1.md) for full breakdown.
|
|
359
|
-
|
|
360
|
-
| ID | Title | Track | Status |
|
|
361
|
-
| :- | :---- | :---- | :----- |
|
|
362
|
-
| T-1A01 | Define AppState FSM structure | A | Done ✓ |
|
|
363
|
-
| T-1A02 | Implement Path Reliability | A | In Progress |
|
|
364
|
-
| T-1B01 | Define LaunchpadBuilder interface | B | Todo |
|
|
365
|
-
| T-1C01 | Define RON schema root structure | C | Todo |
|
|
366
|
-
|
|
367
|
-
## Phase 2 — Services & Data
|
|
368
|
-
|
|
369
|
-
See [phase-2.md](phase-2.md) for full breakdown.
|
|
370
|
-
|
|
371
|
-
| ID | Title | Track | Status |
|
|
372
|
-
| :- | :---- | :---- | :----- |
|
|
373
|
-
| T-2A01 | Implement Asset Manifest loader | A | Todo |
|
|
374
|
-
|
|
375
|
-
## Archived / Cancelled
|
|
376
|
-
|
|
377
|
-
| ID | Title | Reason |
|
|
378
|
-
| :- | :---- | :----- |
|
|
379
|
-
<!-- Tasks cancelled due to spec deprecation appear here -->
|
|
380
|
-
|
|
381
|
-
## Task History
|
|
382
|
-
|
|
383
|
-
| Version | Date | Author | Description |
|
|
384
|
-
| :--- | :--- | :--- | :--- |
|
|
385
|
-
| 1.0.0 | YYYY-MM-DD | Agent | Initial task generation |
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
### phase-{n}.md — Per-Phase Task File
|
|
389
|
-
|
|
390
|
-
```markdown
|
|
391
|
-
# Phase {N} — {Phase Name}
|
|
392
|
-
|
|
393
|
-
**Status:** {Active | Completed}
|
|
394
|
-
**Execution Mode:** {Sequential | Parallel}
|
|
395
|
-
**Tracks:** {A, B, C...}
|
|
396
|
-
|
|
397
|
-
## Track A — {Track Name}
|
|
398
|
-
|
|
399
|
-
### [T-{N}A01] {Task Title}
|
|
400
|
-
|
|
401
|
-
- **Spec:** [{spec-name}.md](../specifications/{spec-name}.md) §{section}
|
|
402
|
-
- **Depends:** —
|
|
403
|
-
- **Status:** Todo
|
|
404
|
-
- **Assignee:** unassigned
|
|
405
|
-
- **Notes:** —
|
|
406
|
-
|
|
407
|
-
### [T-{N}A02] {Task Title}
|
|
408
|
-
|
|
409
|
-
- **Spec:** [{spec-name}.md](../specifications/{spec-name}.md) §{section}
|
|
410
|
-
- **Depends:** T-{N}A01
|
|
411
|
-
- **Status:** Todo
|
|
412
|
-
- **Assignee:** unassigned
|
|
413
|
-
- **Notes:** —
|
|
414
|
-
|
|
415
|
-
## Track B — {Track Name} *(parallel with A)*
|
|
416
|
-
|
|
417
|
-
### [T-{N}B01] {Task Title}
|
|
418
|
-
|
|
419
|
-
- **Spec:** [{spec-name}.md](../specifications/{spec-name}.md) §{section}
|
|
420
|
-
- **Depends:** —
|
|
421
|
-
- **Status:** Todo
|
|
422
|
-
- **Assignee:** unassigned
|
|
423
|
-
- **Notes:** —
|
|
424
|
-
|
|
425
|
-
## Track C — {Track Name} *(after A + B)*
|
|
426
|
-
|
|
427
|
-
### [T-{N}C01] {Task Title}
|
|
428
|
-
|
|
429
|
-
- **Spec:** [{spec-name}.md](../specifications/{spec-name}.md) §{section}
|
|
430
|
-
- **Depends:** T-{N}A02, T-{N}B01
|
|
431
|
-
- **Status:** Todo
|
|
432
|
-
- **Assignee:** unassigned
|
|
433
|
-
- **Notes:** —
|
|
434
|
-
|
|
435
|
-
## Phase Completion
|
|
436
|
-
|
|
437
|
-
- [ ] All tasks Done
|
|
438
|
-
- [ ] No open blockers
|
|
439
|
-
- [ ] TASKS.md summary updated
|
|
440
|
-
- [ ] Retrospective auto-snapshot appended to RETROSPECTIVE.md
|
|
441
|
-
- [ ] Next phase unlocked: Phase {N+1}
|
|
442
|
-
- [ ] If all phases complete: full retrospective (Level 2) was run
|
|
443
|
-
```
|
package/src/index.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { spawnSync } = require('child_process');
|
|
6
|
-
|
|
7
|
-
// Package root: installers/node/ — .magic, .agent, adapters synced here before publish
|
|
8
|
-
const pkgRoot = path.join(__dirname, '..');
|
|
9
|
-
const cwd = process.cwd();
|
|
10
|
-
|
|
11
|
-
// Parse arguments
|
|
12
|
-
const args = process.argv.slice(2);
|
|
13
|
-
const envFlag = args.find(a => a.startsWith('--env'));
|
|
14
|
-
const envValues = envFlag
|
|
15
|
-
? envFlag.includes('=')
|
|
16
|
-
? envFlag.split('=')[1].split(',')
|
|
17
|
-
: (args[args.indexOf(envFlag) + 1] || '').split(',').filter(Boolean)
|
|
18
|
-
: [];
|
|
19
|
-
|
|
20
|
-
const ADAPTERS = {
|
|
21
|
-
cursor: '.cursor/rules',
|
|
22
|
-
github: '.github',
|
|
23
|
-
kilocode: '.kilocode',
|
|
24
|
-
windsurf: '.windsurf/rules',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
function copyDir(src, dest) {
|
|
28
|
-
if (!fs.existsSync(src)) {
|
|
29
|
-
console.warn(`⚠️ Source not found: ${src}`);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
fs.cpSync(src, dest, { recursive: true, force: true });
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
console.log('🪄 Initializing magic-spec...');
|
|
36
|
-
|
|
37
|
-
// 1. Copy .magic (SDD engine)
|
|
38
|
-
copyDir(path.join(pkgRoot, '.magic'), path.join(cwd, '.magic'));
|
|
39
|
-
|
|
40
|
-
// 2. Copy default agent adapter OR env-specific adapter
|
|
41
|
-
if (envValues.length > 0) {
|
|
42
|
-
for (const env of envValues) {
|
|
43
|
-
const adapterSrc = path.join(pkgRoot, 'adapters', env);
|
|
44
|
-
const adapterDest = path.join(cwd, ADAPTERS[env] || `.${env}`);
|
|
45
|
-
if (!ADAPTERS[env]) {
|
|
46
|
-
console.warn(`⚠️ Unknown --env value: "${env}". Falling back to default .agent/`);
|
|
47
|
-
console.warn(` Valid values: ${Object.keys(ADAPTERS).join(', ')}`);
|
|
48
|
-
console.warn(` To request a new adapter: https://github.com/teratron/magic-spec/issues`);
|
|
49
|
-
copyDir(path.join(pkgRoot, '.agent'), path.join(cwd, '.agent'));
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
if (!fs.existsSync(adapterSrc)) {
|
|
53
|
-
console.warn(`⚠️ Adapter "${env}" not yet implemented. Falling back to default .agent/`);
|
|
54
|
-
console.warn(` Copy .agent/workflows/magic/ manually to ${ADAPTERS[env]}/`);
|
|
55
|
-
copyDir(path.join(pkgRoot, '.agent'), path.join(cwd, '.agent'));
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
copyDir(adapterSrc, adapterDest);
|
|
59
|
-
console.log(`✅ Adapter installed: ${env} → ${ADAPTERS[env]}/`);
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
// Default: install .agent/
|
|
63
|
-
copyDir(path.join(pkgRoot, '.agent'), path.join(cwd, '.agent'));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// 3. Run init script
|
|
67
|
-
const isWindows = process.platform === 'win32';
|
|
68
|
-
const initScript = isWindows
|
|
69
|
-
? path.join(cwd, '.magic', 'scripts', 'init.ps1')
|
|
70
|
-
: path.join(cwd, '.magic', 'scripts', 'init.sh');
|
|
71
|
-
|
|
72
|
-
if (fs.existsSync(initScript)) {
|
|
73
|
-
if (isWindows) {
|
|
74
|
-
spawnSync('powershell.exe', ['-ExecutionPolicy', 'Bypass', '-File', initScript], { stdio: 'inherit' });
|
|
75
|
-
} else {
|
|
76
|
-
fs.chmodSync(initScript, '755');
|
|
77
|
-
spawnSync('bash', [initScript], { stdio: 'inherit' });
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
console.log('✅ magic-spec initialized successfully!');
|