magic-spec 1.3.0 → 1.3.2

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/CHANGELOG.md CHANGED
@@ -5,6 +5,44 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.3.2] - 2026-02-28
9
+
10
+ ### Added
11
+
12
+ - **Project Analysis Workflow** (`.magic/analyze.md`): Powerful reverse-engineering tool. Delegated automatically from `spec.md` or directly via `/magic.analyze`. Supports scanning existing source code to generate structured proposals with paired Layer 1 (Concept) and Layer 2 (Implementation) specifications. Features Depth Control for massive codebases.
13
+ - **Bootstrapping Exemption**: Special rules added to bypass standard Draft/RFC phases and create "Stable" specs directly when adopting existing working code into the SDD system.
14
+ - **Improv Mode (Live Simulation)** in `simulate.md`: Added ability for the simulation workflow to synthesize "crisis scenarios" (e.g., INDEX.md desync) and perform full SDK lifecycle stress tests end-to-end on its own, functioning as a fallback if the static test suite is missing.
15
+
16
+ ### Changed
17
+
18
+ - Expanded Test Suite (`.magic/tests/suite.md`) from 28 to 34 scenarios (+6), fully covering Analyze gap detection, L1/L2 generation asserts, depth control limits, and the missing test suite fallback.
19
+
20
+ ## [1.3.1] - 2026-02-27### Added
21
+
22
+ - **Workflow Test Suite** (`.magic/tests/suite.md`): 16 predefined regression test scenarios covering all 8 engine workflows. Run via `/magic.simulate test`.
23
+ - **Test Suite mode** in `simulate.md`: reads `suite.md` and reports PASS/FAIL for each scenario.
24
+ - **Template directory** (`.magic/templates/`): extracted inline templates from core workflow files:
25
+ - `specification.md` — Specification Template (from `spec.md`)
26
+ - `plan.md` — PLAN.md Template (from `task.md`)
27
+ - `tasks.md` — TASKS.md + phase-{n}.md Templates (from `task.md`)
28
+ - `retrospective.md` — RETROSPECTIVE.md Template (from `retrospective.md`)
29
+
30
+ ### Changed
31
+
32
+ - **AOP Optimization**: Compressed verbose prose in `spec.md` (Post-Update Review, Audit/Consistency Reports). ~17% token reduction across core workflows.
33
+ - **Stress-test hardening** across all workflows:
34
+ - `spec.md`: Intra-input self-contradiction guard, Deprecation Cascade (scan Related Specs for stale refs)
35
+ - `task.md`: Circular Dependency Guard, Phantom Done-task preservation (Archive not Cancel), Deprecated Done-task preservation, Convention Sync wording fix
36
+ - `run.md`: Mode Guard — HALT if execution mode not in RULES.md §7
37
+ - `rule.md`: Duplication Guard, convention-not-found handler, Workflow Dependency Check in Remove Impact Analysis
38
+ - `simulate.md`: Checksums mismatch upgraded to HALT, Checksum Rule (generate after approval only)
39
+ - `onboard.md`: Production collision HALT with backup/cancel, re-entry checks production PLAN.md
40
+ - `init.md`: Expanded post-init verification to all 5 artifacts, Maintainer Note for hardcoded RULES.md sync
41
+
42
+ ### Fixed
43
+
44
+ - Template references now explicitly point to `.magic/templates/*.md` in creation steps of `spec.md`, `task.md`, `retrospective.md`, and `onboard.md`.
45
+
8
46
  ## [1.3.0] - 2026-02-25
9
47
 
10
48
  ### Added
package/README.md CHANGED
@@ -4,75 +4,192 @@
4
4
  [![PyPI version](https://img.shields.io/pypi/v/magic-spec?color=blue&label=pypi)](https://pypi.org/project/magic-spec/)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
6
6
 
7
- **The Specification-Driven Development (SDD) Operating System for AI Agents.**
7
+ ## 📖 Description
8
8
 
9
- Stop your AI from writing code before it understands the problem. `magic-spec` installs a high-performance, structured pipeline *Thought → Spec → Task → Run → Code* — directly into any project.
9
+ **The Specification-Driven Development (SDD) Operating System for AI Coding Agents.**
10
10
 
11
- ---
11
+ Stop your AI from writing fragile code before it fully understands the problem. `magic-spec` installs a high-performance, structured pipeline — *Thought → Spec → Task → Run → Code* — directly into any project, regardless of the tech stack.
12
12
 
13
- ## Features
13
+ Whether you are a **coding novice** building your first application or a **senior engineer** architecting enterprise systems, Magic Spec brings **maximum automation** and professional rigor to your development process. It enforces a deterministic workflow that ensures your AI agent perfectly aligns with your vision before writing a single line of code.
14
14
 
15
- - 🏗️ **Deterministic Pipeline**: Forced structure ensures architectural integrity.
16
- - 🎯 **Multi-Agent Core**: Works with Cursor, Windsurf, Claude, Gemini, and more.
17
- - 🔍 **Auto-Retrospective**: Built-in self-analysis engine that improves your workflow automatically.
18
- - 📦 **Thin-Client Installers**: Lightweight Node.js and Python installers for zero-friction setup.
19
- - 🗺️ **Phased Planning**: Intelligent dependency tracking and implementation roadmaps.
15
+ ### The Core Concept
20
16
 
21
- ---
17
+ `magic-spec` is a set of **markdown-based workflow instructions** specifically designed for AI coding agents like Cursor, Windsurf, Claude, and Gemini. It acts as a project-level operating system that orchestrates agentic development.
22
18
 
23
- ## 🚀 Quick Start
19
+ Instead of chaotic prompt-engineering, Magic Spec provides a rigorous pipeline:
24
20
 
25
- Works with **any project** — Rust, Go, Python, JavaScript, C++, or anything else.
21
+ ```plaintext
22
+ 💡 Idea → 📋 Specification → 🗺️ Task & Plan → ⚡ Run → 🚀 Code
23
+ ```
24
+
25
+ Once initialized, your AI agent will automatically:
26
+
27
+ - Formulate a strong conceptual and technical specification.
28
+ - Build a phased implementation plan with hierarchical dependencies.
29
+ - Decompose the plan into prioritized, atomic, trackable tasks.
30
+ - Facilitate safe architectural brainstorming via **Explore Mode**.
31
+ - Analyze its own workflow and suggest improvements via Auto-Retrospectives.
32
+
33
+ ### What Gets Installed
34
+
35
+ After running the installer, your project directory will be augmented with the following structure:
36
+
37
+ ```plaintext
38
+ root-project/
39
+ ├── .agent/workflows/ # Slash commands wrapper (e.g., magic.spec, magic.task)
40
+ ├── .magic/ # The SDD Engine (workflow logic and scripts - read-only)
41
+ └── .design/ # Your Project Design Workspace (INDEX.md, RULES.md, PLAN.md)
42
+ ```
43
+
44
+ 1. **`.magic/`**: Deploys the core SDD engine.
45
+ 2. **`.agent/`**: Sets up workflows for your AI.
46
+ 3. **`.design/`**: Initializes your project's workspace for Specifications, Rules, and Plans.
47
+ 4. **Onboarding**: An interactive tutorial (`magic.onboard`) helps you and your AI get started smoothly.
48
+
49
+ ## 🖼️ Visuals
50
+
51
+ The engine operates on a smart, self-correcting feedback loop:
52
+
53
+ ```mermaid
54
+ graph TD
55
+ IDEA["💡 Idea"] --> INIT{"🏗️ Auto-Init"}
56
+ INIT -->|.design/ exists| SPEC
57
+ INIT -->|.design/ missing| CREATE["Create .design/ structure"] --> SPEC
58
+ SPEC["📋 Specification"] <--> RULE["📜 Rule"]
59
+ SPEC --> TASK["🗺️ Task & Plan"]
60
+ TASK --> RUN["⚡ Run"]
61
+ RUN --> CODE["🚀 Code"]
62
+ RUN -.->|"auto: phase done"| RETRO["🔍 Retrospective"]
63
+ RETRO -.->|Feedback loop| SPEC
64
+ ```
65
+
66
+ ## ⚙️ Requirements
26
67
 
27
- ### Option A: Node.js (npx)
68
+ Before installing Magic Spec, ensure you have one of the following available on your system:
69
+
70
+ | Requirement | Details |
71
+ | :--- | :--- |
72
+ | **Node.js** | Version `16.x` or higher (for `npx` method) |
73
+ | **Python** | Version `3.8` or higher (for `uvx` or `pipx` methods) |
74
+ | **Git** | Required for installing edge versions directly from GitHub |
75
+ | **Terminal** | `tar` utility (pre-installed on Windows/Linux/macOS) |
76
+
77
+ ## 📦 Installation
78
+
79
+ Works perfectly with **any project** — Rust, Go, Python, JavaScript, C++, or anything else. No runtime lock-in.
80
+
81
+ ### Option A: Node.js (`npx`)
82
+
83
+ **Stable Release:**
28
84
 
29
85
  ```bash
30
86
  npx magic-spec@latest
31
87
  ```
32
88
 
33
- ### Option B: Python (uvx)
89
+ **Edge Version (GitHub):**
90
+
91
+ ```bash
92
+ npx --yes github:teratron/magic-spec
93
+ ```
94
+
95
+ ### Option B: Python (`uvx`)
96
+
97
+ **Stable Release:**
34
98
 
35
99
  ```bash
36
100
  uvx magic-spec
37
101
  ```
38
102
 
39
- **What happens next?**
103
+ **Edge Version (GitHub):**
104
+
105
+ ```bash
106
+ uvx --from git+https://github.com/teratron/magic-spec.git magic-spec
107
+ ```
108
+
109
+ ### Option C: Python (`pipx`)
110
+
111
+ ```bash
112
+ pipx run magic-spec
113
+ ```
114
+
115
+ ### Option D: Manual Installation
40
116
 
41
- 1. Magic Spec deploys the `.magic/` engine and `.agent/` workflows.
42
- 2. An interactive onboarding tutorial (`magic.onboard`) helps you and your AI get started.
43
- 3. Your project gains a dedicated `.design/` workspace for Specifications, Rules, and Plans.
117
+ If automated installers do not fit your environment:
44
118
 
45
- ---
119
+ 1. **Engine**: Download the `.magic/` folder from the [GitHub repository](https://github.com/teratron/magic-spec).
120
+ 2. **Workflows**: Download command wrappers from [`.agent/workflows/`](https://github.com/teratron/magic-spec/tree/main/.agent/workflows).
121
+ 3. **Deploy**: Place files into your AI agent's instruction directory (e.g., `.cursor/commands`).
46
122
 
47
- ## 🧭 The Workflow
123
+ ## 🚀 Usage
48
124
 
49
- 1. **Specification**: Convert raw ideas into formal, versioned specs.
50
- 2. **Task & Plan**: Generate a phased roadmap with atomic, trackable tasks.
51
- 3. **Run**: Execute the plan with automatic progress tracking and quality gates.
52
- 4. **Rule**: Manage project conventions in a central `RULES.md` constitution.
125
+ Just talk to your AI agent naturally in your prompt interface. No complex commands to learn:
53
126
 
54
- ---
127
+ - *"Dispatch this thought into specs..."* → Triggers **Specification** workflow.
128
+ - *"Create an implementation plan"* → Triggers **Task & Plan** workflow.
129
+ - *"Execute the next task"* → Triggers **Run** workflow.
130
+ - *"Add a rule: always use Inter font"* → Triggers **Rule** workflow.
55
131
 
56
- ## 📖 Documentation & Guides
132
+ ### 🤝 Compatibility
57
133
 
58
- - [**Main Documentation**](./docs/README.md) Detailed guide on workflows and architecture.
134
+ Magic Spec is heavily optimized and provides native workflow generation for the world's most powerful AI development environments:
135
+
136
+ | AI Agent / IDE | Installation Flag |
137
+ | :--- | :--- |
138
+ | [**Cursor**](https://cursor.com) (Agent Mode) | `--cursor` |
139
+ | [**Windsurf**](https://codeium.com/windsurf) (Cascade) | `--windsurf` |
140
+ | [**Claude Code**](https://claude.ai/code) | `--claude` |
141
+ | [**Gemini CLI**](https://gemini.google.com) | `--gemini` |
142
+ | [**GitHub Copilot**](https://github.com/features/copilot) | `--copilot` |
143
+ | **Roo Code** | `--roo` |
144
+ | **Amp** | `--amp` |
145
+ | **Amazon Q Developer** | `--q` |
146
+ | **Kilo Code** | `--kilocode` |
147
+ | **Qwen Code** | `--qwen` |
148
+ | **OpenCode** | `--opencode` |
149
+ | **SHAI (OVHcloud)** | `--shai` |
150
+ | **IBM Bob** | `--bob` |
151
+ | **CodeBuddy** | `--codebuddy` |
152
+ | **Qoder IDE** | `--qoder` |
153
+ | **Codex CLI** | `--codex` |
154
+ | **Auggie CLI** | `--augment` |
155
+ | **Antigravity IDE** | `--antigravity` |
156
+ | **Lingma IDE** | `--lingma` |
157
+
158
+ ## 📚 Documentation
159
+
160
+ - [**Main Documentation**](./docs/README.md) — Detailed guide on workflows, architecture, and advanced features.
59
161
  - [**Installers Guide**](./installers/README.md) — Advanced CLI options and platform specifics.
60
- - [**Contributing**](./docs/contributing.md) — How to develop and extend the engine.
162
+ - [**Contributing**](./docs/contributing.md) — How to develop, test, and extend the engine.
163
+
164
+ ## 🛟 Support
165
+
166
+ If you encounter issues or have questions:
61
167
 
62
- ---
168
+ - Open an [Issue](https://github.com/teratron/magic-spec/issues) on GitHub.
169
+ - Run `magic.onboard` in your agent to restart the interactive tutorial.
63
170
 
64
- ## 🤝 Compatibility
171
+ ## 🗺️ Roadmap
65
172
 
66
- Magic Spec is optimized for the world's most powerful AI development environments:
173
+ - [x] Multi-agent adapter system.
174
+ - [x] Phased implementation planning.
175
+ - [ ] Extended support for local-first LLM agents.
176
+ - [ ] Advanced visual dashboard for project health.
177
+ - [ ] Integration with CI/CD for automated spec validation.
67
178
 
68
- - [**Cursor**](https://cursor.com) (Rule definitions & Agent Mode)
69
- - [**Windsurf**](https://codeium.com/windsurf) (Cascade & Flows)
70
- - [**GitHub Copilot**](https://github.com/features/copilot) (Custom Instructions)
71
- - [**Claude**](https://claude.ai) (Project context)
179
+ ## 🤝 Contributing
72
180
 
73
- ---
181
+ We welcome contributions! Whether it's a bug fix, a new adapter, or an improvement to the workflow logic.
182
+ Please see [**Contributing Guide**](./docs/contributing.md) for details.
183
+
184
+ ## 👥 Authors and Acknowledgments
185
+
186
+ - **Oleg Alexandrov** — Creator and Lead Maintainer.
187
+ - Special thanks to the AI agent community for inspiration and testing.
74
188
 
75
189
  ## 📄 License
76
190
 
77
- Distributed under the [MIT License](./LICENSE).
78
- © 2026 Oleg Alexandrov & teratron. ✨
191
+ Distributed under the [MIT License](./LICENSE).
192
+
193
+ ## 📊 Project Status
194
+
195
+ **Active Development** (v1.x). We are constantly refining the SDD engine based on real-world usage.
@@ -6,6 +6,37 @@
6
6
  "agentDir": ".agent",
7
7
  "workflowsDir": "workflows",
8
8
  "defaultExt": ".md",
9
+ "workflows": [
10
+ "magic.onboard",
11
+ "magic.rule",
12
+ "magic.run",
13
+ "magic.simulate",
14
+ "magic.spec",
15
+ "magic.task"
16
+ ],
17
+ "magicFiles": [
18
+ "analyze.md",
19
+ "onboard.md",
20
+ "retrospective.md",
21
+ "rule.md",
22
+ "run.md",
23
+ "simulate.md",
24
+ "spec.md",
25
+ "task.md",
26
+ ".version",
27
+ ".checksums",
28
+ "scripts/check-prerequisites.ps1",
29
+ "scripts/check-prerequisites.sh",
30
+ "scripts/executor.js",
31
+ "scripts/generate-context.ps1",
32
+ "scripts/generate-context.sh",
33
+ "scripts/init.ps1",
34
+ "scripts/init.sh",
35
+ "templates/plan.md",
36
+ "templates/retrospective.md",
37
+ "templates/specification.md",
38
+ "templates/tasks.md"
39
+ ],
9
40
  "download": {
10
41
  "timeoutMs": 60000,
11
42
  "tempPrefix": "magic-spec-"
@@ -68,6 +68,14 @@ function loadInstallerConfig() {
68
68
  const agentDir = requireNonEmptyString(parsed.agentDir, 'agentDir');
69
69
  const workflowsDir = requireNonEmptyString(parsed.workflowsDir, 'workflowsDir');
70
70
  const defaultExt = requireNonEmptyString(parsed.defaultExt, 'defaultExt');
71
+ const workflows = Array.isArray(parsed.workflows) ? parsed.workflows : null;
72
+ if (!workflows) {
73
+ failConfig("field 'workflows' must be an array of strings");
74
+ }
75
+ const magicFiles = Array.isArray(parsed.magicFiles) ? parsed.magicFiles : null;
76
+ if (!magicFiles) {
77
+ failConfig("field 'magicFiles' must be an array of strings");
78
+ }
71
79
 
72
80
  return {
73
81
  githubRepo,
@@ -77,6 +85,8 @@ function loadInstallerConfig() {
77
85
  agentDir,
78
86
  workflowsDir,
79
87
  defaultExt,
88
+ workflows,
89
+ magicFiles,
80
90
  download: { timeoutMs, tempPrefix },
81
91
  userAgent: { node: nodeUserAgent },
82
92
  ejectTargets: parsed.eject.targets
@@ -90,6 +100,8 @@ const ENGINE_DIR = INSTALLER_CONFIG.engineDir;
90
100
  const AGENT_DIR = INSTALLER_CONFIG.agentDir;
91
101
  const WORKFLOWS_DIR = INSTALLER_CONFIG.workflowsDir;
92
102
  const DEFAULT_EXT = INSTALLER_CONFIG.defaultExt;
103
+ const WORKFLOWS = INSTALLER_CONFIG.workflows;
104
+ const MAGIC_FILES = INSTALLER_CONFIG.magicFiles;
93
105
  const DEFAULT_REMOVE_PREFIX = INSTALLER_CONFIG.removePrefix;
94
106
  const DOWNLOAD_TIMEOUT_MS = INSTALLER_CONFIG.download.timeoutMs;
95
107
  const NODE_USER_AGENT = INSTALLER_CONFIG.userAgent.node;
@@ -197,9 +209,11 @@ function installAdapter(sourceRoot, env, adapters) {
197
209
 
198
210
  fs.mkdirSync(destDir, { recursive: true });
199
211
 
200
- const files = fs.readdirSync(srcDir).filter(f => f.endsWith(DEFAULT_EXT));
201
- for (const file of files) {
212
+ for (const wfName of WORKFLOWS) {
213
+ const file = wfName + DEFAULT_EXT;
202
214
  const srcFile = path.join(srcDir, file);
215
+ if (!fs.existsSync(srcFile)) continue;
216
+
203
217
  let destName = file.replace(new RegExp(`${DEFAULT_EXT.replace('.', '\\.')}$`), adapter.ext);
204
218
  const removePrefix = adapter.hasOwnProperty('removePrefix') ? adapter.removePrefix : DEFAULT_REMOVE_PREFIX;
205
219
  if (removePrefix) {
@@ -719,22 +733,20 @@ async function main() {
719
733
  }
720
734
  }
721
735
 
722
- // 1. Copy .magic
723
- if (conflictsToSkip.length > 0) {
724
- const srcMagic = path.join(sourceRoot, '.magic');
725
- const destMagic = path.join(cwd, '.magic');
726
- const items = fs.readdirSync(srcMagic, { withFileTypes: true });
727
- for (const item of items) {
728
- if (conflictsToSkip.includes(item.name)) continue;
729
- if (item.name === '.checksums') continue;
730
- if (item.isDirectory()) {
731
- copyDir(path.join(srcMagic, item.name), path.join(destMagic, item.name));
732
- } else {
733
- fs.copyFileSync(path.join(srcMagic, item.name), path.join(destMagic, item.name));
734
- }
736
+ // 1. Copy .magic (engine) - selective based on whitelist [T-3A01]
737
+ const srcMagic = path.join(sourceRoot, ENGINE_DIR);
738
+ const destMagic = path.join(cwd, ENGINE_DIR);
739
+ fs.mkdirSync(destMagic, { recursive: true });
740
+
741
+ for (const relPath of MAGIC_FILES) {
742
+ if (conflictsToSkip.includes(relPath)) continue;
743
+
744
+ const srcFile = path.join(srcMagic, relPath);
745
+ const destFile = path.join(destMagic, relPath);
746
+ if (fs.existsSync(srcFile)) {
747
+ fs.mkdirSync(path.dirname(destFile), { recursive: true });
748
+ fs.copyFileSync(srcFile, destFile);
735
749
  }
736
- } else {
737
- copyDir(path.join(sourceRoot, '.magic'), path.join(cwd, '.magic'));
738
750
  }
739
751
 
740
752
  // 2. Adapters
@@ -746,7 +758,30 @@ async function main() {
746
758
  } else if (selectedEnvResolved) {
747
759
  installAdapter(sourceRoot, selectedEnvResolved, ADAPTERS);
748
760
  } else {
749
- copyDir(path.join(sourceRoot, '.agent'), path.join(cwd, '.agent'));
761
+ // Default install
762
+ const srcEng = path.join(sourceRoot, AGENT_DIR);
763
+ const destEng = path.join(cwd, AGENT_DIR);
764
+ fs.mkdirSync(destEng, { recursive: true });
765
+ fs.mkdirSync(path.join(destEng, WORKFLOWS_DIR), { recursive: true });
766
+
767
+ for (const wfName of WORKFLOWS) {
768
+ const file = wfName + DEFAULT_EXT;
769
+ const srcWf = path.join(srcEng, WORKFLOWS_DIR, file);
770
+ if (fs.existsSync(srcWf)) {
771
+ fs.copyFileSync(srcWf, path.join(destEng, WORKFLOWS_DIR, file));
772
+ }
773
+ }
774
+
775
+ // Copy other files in .agent if any (not workflows subfolder which we handled selectively)
776
+ const items = fs.readdirSync(srcEng, { withFileTypes: true });
777
+ for (const item of items) {
778
+ if (item.name === WORKFLOWS_DIR) continue;
779
+ if (item.isDirectory()) {
780
+ copyDir(path.join(srcEng, item.name), path.join(destEng, item.name));
781
+ } else {
782
+ fs.copyFileSync(path.join(srcEng, item.name), path.join(destEng, item.name));
783
+ }
784
+ }
750
785
  }
751
786
  }
752
787
 
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "magic-spec",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Magic Specification-Driven Development (SDD) Workflow",
5
5
  "author": "Oleg Alexandrov <alexandrovoleg.ru@gmail.com>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/teratron/magic-spec",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/teratron/magic-spec.git"
11
+ },
8
12
  "main": "installers/node/index.js",
9
13
  "bin": {
10
14
  "magic-spec": "installers/node/index.js"