ai-dev-setup 1.0.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/LICENSE +21 -0
- package/README.md +338 -0
- package/bin/ai-dev-setup.js +7 -0
- package/package.json +35 -0
- package/src/cli/index.js +142 -0
- package/src/cli/logger.js +29 -0
- package/src/cli/prompts.js +267 -0
- package/src/commands/init.js +321 -0
- package/src/commands/update.js +6 -0
- package/src/constants.js +34 -0
- package/src/core/detector.js +164 -0
- package/src/core/git-ref.js +28 -0
- package/src/core/gitignore-vendor.js +126 -0
- package/src/core/renderer.js +97 -0
- package/src/core/vendors.js +354 -0
- package/src/core/writer.js +67 -0
- package/src/platforms/claude-code.js +33 -0
- package/src/platforms/cursor.js +33 -0
- package/src/platforms/platform.js +18 -0
- package/src/platforms/registry.js +56 -0
- package/src/templates/claude-code/claude.md.tmpl +58 -0
- package/src/templates/claude-code/commands/kickoff.md.tmpl +18 -0
- package/src/templates/claude-code/commands/review.md.tmpl +20 -0
- package/src/templates/claude-code/commands/ship.md.tmpl +19 -0
- package/src/templates/claude-code/settings.json.tmpl +17 -0
- package/src/templates/cursor/cursorrules.tmpl +36 -0
- package/src/templates/cursor/rules/agents.mdc.tmpl +12 -0
- package/src/templates/cursor/rules/core-rules.mdc.tmpl +14 -0
- package/src/templates/cursor/rules/review.mdc.tmpl +13 -0
- package/src/templates/cursor/rules/workflow.mdc.tmpl +12 -0
- package/src/templates/ignore/claudeignore.tmpl +25 -0
- package/src/templates/ignore/cursorignore.tmpl +25 -0
- package/src/templates/shared/agents.md.tmpl +41 -0
- package/src/templates/shared/docs/api-patterns.md.tmpl +39 -0
- package/src/templates/shared/docs/architecture.md.tmpl +41 -0
- package/src/templates/shared/docs/conventions.md.tmpl +50 -0
- package/src/templates/shared/docs/error-handling.md.tmpl +32 -0
- package/src/templates/shared/docs/security.md.tmpl +37 -0
- package/src/templates/shared/docs/testing.md.tmpl +34 -0
- package/src/templates/shared/rules.md.tmpl +65 -0
- package/src/templates/shared/workflow.md.tmpl +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 fahadsubzwari924
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
# ai-dev-setup
|
|
2
|
+
|
|
3
|
+
**One command** scaffolds a **token-aware** AI assistant setup for **Claude Code** and **Cursor**: shared rules (`.ai/`, `docs/`), tool-specific entrypoints, plus **vendored [Superpowers](https://github.com/obra/superpowers)** (workflow engine) and **[Agency Agents](https://github.com/msitarzewski/agency-agents)** (specialists) in your project.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx ai-dev-setup init
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
**npm package dependencies:** none. **Your machine:** Node.js **18+**, and (when running the vendor step) **`git`** + **`bash`** on PATH.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Recommended team workflow (no `vendor/` in git)
|
|
14
|
+
|
|
15
|
+
This is the **default adoption path** we recommend: small git history, explicit security posture, one non-interactive command for teammates.
|
|
16
|
+
|
|
17
|
+
1. **Maintainer** generates the **scaffold** without vendored trees (or removes `vendor/` after a local full run), then commits everything **except** `vendor/`:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx ai-dev-setup init --yes --skip-vendor
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Every **`init`** (including **`--skip-vendor`** and **`--vendor-only`**) **merges** a small managed section into **`.gitignore`** so **`/vendor/`** is ignored by default—reducing the chance of accidentally committing large vendored trees. If you use an older CLI or deleted that block, add **`/vendor/`** yourself.
|
|
24
|
+
|
|
25
|
+
2. **Commit** the scaffold: `.ai/`, `docs/`, `CLAUDE.md`, `.claude/`, `.cursorrules`, `.cursor/rules/*.mdc`, `.cursor-plugin/` (if present from a prior run), `.claudeignore`, `.cursorignore`.
|
|
26
|
+
|
|
27
|
+
3. **Teammates** (after `git clone` and `npm install`): run **vendor only** — this does **not** rewrite templates and does **not** use interactive prompts:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx ai-dev-setup init --vendor-only --platforms=claude,cursor
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Pin upstream refs** for reproducible installs (tags preferred over floating `main`):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx ai-dev-setup init --vendor-only --platforms=claude,cursor --superpowers-ref=v5.0.7 --agency-ref=main
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
4. **Optional — `package.json` script** in your app (keeps pins in one place):
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"ai-dev-setup": "^1.0.0"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"vendor:ai": "ai-dev-setup init --vendor-only --platforms=claude,cursor --superpowers-ref=v5.0.7 --agency-ref=main"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Teammates run: `npm run vendor:ai` (after `npm install`).
|
|
53
|
+
|
|
54
|
+
**Important:** `npm install` **only** installs the `ai-dev-setup` package into `node_modules`. It does **not** clone Superpowers or Agency Agents. Populating `vendor/` always requires running **`init --vendor-only`** (or a full `init` without `--skip-vendor`) explicitly.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Security and trust
|
|
59
|
+
|
|
60
|
+
- **This package** does not register a `postinstall` script. Running the vendor step is **always explicit** (`init` or your own script).
|
|
61
|
+
- **Git refs** passed to `git clone -b` are validated (alphanumeric branch/tag style only) to reduce misuse.
|
|
62
|
+
- **Advanced (optional):** if your team adds a **consumer** `postinstall` that runs `vendor:ai`, document it, skip when `CI=true`, and expect some environments to use `npm install --ignore-scripts`.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Who this is for
|
|
67
|
+
|
|
68
|
+
- Teams who want **one repeatable setup** per project instead of hand-writing `CLAUDE.md`, Cursor rules, and workflow docs.
|
|
69
|
+
- Teams who want **Superpowers + Agency** available **locally** under `vendor/`, either **committed** or **materialized after clone** via `--vendor-only`.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## What to expect
|
|
74
|
+
|
|
75
|
+
| Mode | What happens |
|
|
76
|
+
|------|----------------|
|
|
77
|
+
| **Interactive** (default) | Prompts for project name, language, framework, test/lint/build, database, and platforms. Uses **auto-detected** defaults when possible. |
|
|
78
|
+
| **`--yes`** | No prompts: detection + defaults; both platforms unless `--platforms=`. |
|
|
79
|
+
| **`--vendor-only`** | **No template writes.** Only clones/copies Superpowers + Agency (same as the vendor phase of a full `init`). Uses `--platforms=` or defaults to both. |
|
|
80
|
+
|
|
81
|
+
**Full `init` (without `--skip-vendor`)** writes templates, updates **`.gitignore`** (managed `/vendor/` block), then vendors upstream (unless template writes failed). **First vendor run** may take **1–2 minutes** (network + `git clone`; with **Cursor**, `convert.sh` is slow). **Disk:** `vendor/` is large.
|
|
82
|
+
|
|
83
|
+
**Failure** (no `git`, `bash`, or network): the process **exits with an error**.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Prerequisites
|
|
88
|
+
|
|
89
|
+
| Tool | Why |
|
|
90
|
+
|------|-----|
|
|
91
|
+
| Node.js 18+ | Runs the CLI |
|
|
92
|
+
| `git` | Shallow-clones `vendor/superpowers` and `vendor/agency-agents` |
|
|
93
|
+
| `bash` | Runs `vendor/agency-agents/scripts/convert.sh` when **Cursor** is selected |
|
|
94
|
+
|
|
95
|
+
**Windows:** use **Git Bash** or **WSL** so `bash` is available.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Quick start
|
|
100
|
+
|
|
101
|
+
**1.** `cd` to your project root.
|
|
102
|
+
|
|
103
|
+
**2.** Run:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npx ai-dev-setup init
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Or non-interactive full setup (templates + vendor):
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npx ai-dev-setup init --yes
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**3.** Follow **Recommended team workflow** above if you are **not** committing `vendor/`.
|
|
116
|
+
|
|
117
|
+
**4.** Open the project in Claude Code or Cursor.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## First-time usage: Superpowers + Agency
|
|
122
|
+
|
|
123
|
+
After **`init`** has finished (full run **or** **`init --vendor-only`** so `vendor/` exists), you can start using the setup in plain language. Exact UI (slash menus, rules picker) depends on your **Claude Code** or **Cursor** version; the ideas below always apply.
|
|
124
|
+
|
|
125
|
+
### Example 1 — Claude Code: `/kickoff` on a small feature
|
|
126
|
+
|
|
127
|
+
1. Open the **project root** in Claude Code.
|
|
128
|
+
2. Let the session load **`CLAUDE.md`** (stack, commands, and where **Superpowers** / **Agency** live under `vendor/`).
|
|
129
|
+
3. Run **`/kickoff`** and describe one feature, e.g. *“Add a `/health` JSON route and tests.”*
|
|
130
|
+
4. That command is aligned with **`.ai/workflow.md`**: you get scoped goals, risks, and a task list tied to your repo’s **test/lint/build** commands—your first practical use of the **Superpowers-style** planning loop without naming individual skills.
|
|
131
|
+
|
|
132
|
+
### Example 2 — Cursor: one chat, workflow + Superpowers
|
|
133
|
+
|
|
134
|
+
1. Open the project in Cursor.
|
|
135
|
+
2. If needed, enable the workspace **Superpowers** plugin (see **After `init`: checklist** later in this README).
|
|
136
|
+
3. In chat, ask something specific, e.g. *“Read `.cursorrules` and `.ai/workflow.md`. I need to fix a bug in `[path/to/file]`. Propose a short plan, then implement.”*
|
|
137
|
+
4. **`.cursor/rules/`** (workflow, review, agents) plus **Superpowers** (via **`.cursor-plugin`** → `vendor/superpowers/`) keep the assistant in a structured flow; you do not need to hand-edit those paths each time.
|
|
138
|
+
|
|
139
|
+
### Example 3 — Agency: pick a specialist from `.ai/agents.md`
|
|
140
|
+
|
|
141
|
+
1. Open **`.ai/agents.md`** and skim the **Engineering** and **Quality** tables (e.g. tests, review, security).
|
|
142
|
+
2. Ask the assistant to work in that role, e.g. *“Using the testing specialist from `.ai/agents.md`, review tests for `[module]` and list missing cases.”*
|
|
143
|
+
3. **Claude Code** maps this to **`.claude/agents/`**. **Cursor** maps to **`agency-*.mdc`** under **`.cursor/rules/`** when the task matches that specialist.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Usage examples
|
|
148
|
+
|
|
149
|
+
| Goal | Command |
|
|
150
|
+
|------|---------|
|
|
151
|
+
| Full setup, both tools, no questions | `npx ai-dev-setup init --yes` |
|
|
152
|
+
| **Templates only** (commit scaffold; ignore `vendor/`) | `npx ai-dev-setup init --yes --skip-vendor` |
|
|
153
|
+
| **Vendor only** (after clone; do not overwrite templates) | `npx ai-dev-setup init --vendor-only --platforms=claude,cursor` |
|
|
154
|
+
| **Claude Code only** | `npx ai-dev-setup init --yes --platforms=claude` |
|
|
155
|
+
| **Cursor only** | `npx ai-dev-setup init --yes --platforms=cursor` |
|
|
156
|
+
| Overwrite templates + refresh `vendor/` | `npx ai-dev-setup init --yes --force` |
|
|
157
|
+
| Pin upstream branches/tags | `npx ai-dev-setup init --yes --superpowers-ref=v5.0.7 --agency-ref=main` |
|
|
158
|
+
| Help | `npx ai-dev-setup --help` |
|
|
159
|
+
|
|
160
|
+
**Note:** `npx ai-dev-setup` defaults to `init`.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## After `init`: checklist
|
|
165
|
+
|
|
166
|
+
1. Fill in **`docs/ARCHITECTURE.md`** (and other `docs/*` as needed).
|
|
167
|
+
2. Skim **`.ai/rules.md`** and adjust for your team.
|
|
168
|
+
3. **Commit** scaffold files (including **`.gitignore`**). If you use **templates-only** flow, **do not commit** `vendor/`; **`.gitignore`** should already list **`/vendor/`** from `init`. Ensure teammates run **`--vendor-only`** (or your `vendor:ai` script) after clone.
|
|
169
|
+
4. In **Cursor**, enable the workspace **Superpowers** plugin if your Cursor version requires it.
|
|
170
|
+
5. **Updates:** re-run `init --yes --force` or `init --vendor-only --force` with pinned refs, or `git pull` inside `vendor/*` manually.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## What gets generated
|
|
175
|
+
|
|
176
|
+
### Templates (full `init`; skipped with `--vendor-only`)
|
|
177
|
+
|
|
178
|
+
```text
|
|
179
|
+
.ai/
|
|
180
|
+
rules.md
|
|
181
|
+
workflow.md
|
|
182
|
+
agents.md
|
|
183
|
+
docs/
|
|
184
|
+
ARCHITECTURE.md
|
|
185
|
+
CONVENTIONS.md
|
|
186
|
+
TESTING-STRATEGY.md
|
|
187
|
+
API-PATTERNS.md
|
|
188
|
+
ERROR-HANDLING.md
|
|
189
|
+
SECURITY.md
|
|
190
|
+
.claudeignore
|
|
191
|
+
.cursorignore
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**`.gitignore`:** each **`init`** merges in a managed **`/vendor/`** block (safe with existing rules); not listed above as a static template file.
|
|
195
|
+
|
|
196
|
+
**Claude Code** (when `claude` is selected): `CLAUDE.md`, `.claude/settings.json`, `.claude/commands/*`.
|
|
197
|
+
|
|
198
|
+
**Cursor** (when `cursor` is selected): `.cursorrules`, `.cursor/rules/core-rules.mdc`, `workflow.mdc`, `review.mdc`, `agents.mdc`.
|
|
199
|
+
|
|
200
|
+
### Vendor step (`--vendor-only` or full `init` without `--skip-vendor`)
|
|
201
|
+
|
|
202
|
+
| Path | Purpose |
|
|
203
|
+
|------|---------|
|
|
204
|
+
| `vendor/superpowers/` | Superpowers (shallow clone) |
|
|
205
|
+
| `vendor/agency-agents/` | Agency Agents (shallow clone) |
|
|
206
|
+
| `.cursor-plugin/plugin.json` | Points at `vendor/superpowers/` (Cursor) |
|
|
207
|
+
| `.claude/skills/` | Superpowers skills (Claude) |
|
|
208
|
+
| `.claude/agents/` | Agency agents, project-local |
|
|
209
|
+
| `.cursor/rules/agency-*.mdc` | Agency Cursor rules |
|
|
210
|
+
|
|
211
|
+
`convert.sh` runs **only when Cursor is selected**.
|
|
212
|
+
|
|
213
|
+
**Alternative:** commit `vendor/` so clones need no second step — at the cost of a large repo. **To do that**, remove the **ai-dev-setup** managed block from **`.gitignore`** (from `# --- ai-dev-setup: vendor (managed) ---` through `# --- end ai-dev-setup vendor ---`) or otherwise stop ignoring **`vendor/`**, then commit the `vendor/` directory as usual.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Escape hatch: manual clone
|
|
218
|
+
|
|
219
|
+
If you used `--skip-vendor` or `--vendor-only` is not an option:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
git clone --depth 1 --branch main https://github.com/obra/superpowers.git vendor/superpowers
|
|
223
|
+
git clone --depth 1 --branch main https://github.com/msitarzewski/agency-agents.git vendor/agency-agents
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
For Cursor Agency rules, run `bash scripts/convert.sh` in `vendor/agency-agents`, then copy `integrations/cursor/rules/*.mdc` to `.cursor/rules/` with an `agency-` prefix — or use **`init --vendor-only`** when you can.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## CLI reference
|
|
231
|
+
|
|
232
|
+
| Flag | Meaning |
|
|
233
|
+
|------|---------|
|
|
234
|
+
| `-y`, `--yes` | Non-interactive full `init` (templates + vendor unless `--skip-vendor`) |
|
|
235
|
+
| `-f`, `--force` | Overwrite templates **and** refresh vendor checkouts |
|
|
236
|
+
| `--skip-vendor` | Templates only (mutually exclusive with `--vendor-only`) |
|
|
237
|
+
| `--vendor-only` | Vendor step only; no template writes |
|
|
238
|
+
| `--superpowers-ref=REF` | Branch/tag for Superpowers (default: `main`; validated) |
|
|
239
|
+
| `--agency-ref=REF` | Branch/tag for Agency (default: `main`; validated) |
|
|
240
|
+
| `--stack=a,b` | Merge stack keys with auto-detect |
|
|
241
|
+
| `--platforms=a,b` | `claude`, `cursor` (default: both when omitted) |
|
|
242
|
+
| `-h`, `--help` | Help |
|
|
243
|
+
| `-v`, `--version` | Version |
|
|
244
|
+
|
|
245
|
+
Commands: `init` (default), `update` (placeholder).
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Supported platforms
|
|
250
|
+
|
|
251
|
+
| Key | What you get |
|
|
252
|
+
|-----|----------------|
|
|
253
|
+
| `claude` | `CLAUDE.md`, `.claude/`, skills + Agency agents when vendor runs |
|
|
254
|
+
| `cursor` | `.cursorrules`, `.cursor/rules/`, `.cursor-plugin`, `agency-*.mdc` when vendor runs |
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Supported stacks (auto-detect + `--stack`)
|
|
259
|
+
|
|
260
|
+
| Key | Meaning |
|
|
261
|
+
|-----|---------|
|
|
262
|
+
| `ts` | TypeScript |
|
|
263
|
+
| `react` | React |
|
|
264
|
+
| `nextjs` | Next.js |
|
|
265
|
+
| `node` | Node HTTP APIs |
|
|
266
|
+
| `nestjs` | NestJS |
|
|
267
|
+
| `python` | Python |
|
|
268
|
+
| `go` | Go |
|
|
269
|
+
| `flutter` | Flutter / Dart |
|
|
270
|
+
|
|
271
|
+
Detection uses `package.json`, `tsconfig.json`, `next.config.*`, `nest-cli.json`, `go.mod`, `pyproject.toml` / `requirements.txt`, `pubspec.yaml`, and common dependencies.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Superpowers + Agency (core behavior)
|
|
276
|
+
|
|
277
|
+
- **Superpowers** — workflow engine under `vendor/superpowers`, `.claude/skills/`, `.cursor-plugin`.
|
|
278
|
+
- **Agency** — specialists: `agency-*.mdc`, `.claude/agents/`.
|
|
279
|
+
- Generated docs treat both as **required** for this scaffold.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Token optimization
|
|
284
|
+
|
|
285
|
+
| File | Role |
|
|
286
|
+
|------|------|
|
|
287
|
+
| `CLAUDE.md` / `.cursorrules` | Short index |
|
|
288
|
+
| `.ai/*.md` | Shared standards |
|
|
289
|
+
| `docs/*.md` | Deeper references |
|
|
290
|
+
| `core-rules.mdc` | Small **alwaysApply** surface |
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Troubleshooting
|
|
295
|
+
|
|
296
|
+
| Problem | What to do |
|
|
297
|
+
|---------|------------|
|
|
298
|
+
| Scaffold committed; need `vendor/` only | `npx ai-dev-setup init --vendor-only --platforms=claude,cursor` |
|
|
299
|
+
| `git is required` / clone errors | Install Git; network; valid refs |
|
|
300
|
+
| `bash is required` | Git Bash / WSL, or `--platforms=claude` |
|
|
301
|
+
| `Invalid git ref` | Use only safe branch/tag characters (see `--superpowers-ref` / `--agency-ref`) |
|
|
302
|
+
| `Cannot use --skip-vendor with --vendor-only` | Pick one mode |
|
|
303
|
+
| `npm install` did not create `vendor/` | Expected. Run `init --vendor-only` or `npm run vendor:ai` |
|
|
304
|
+
| Huge repo if committing `vendor/` | Use **Recommended team workflow** instead |
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Risk register
|
|
309
|
+
|
|
310
|
+
- Upstream layout may change. Pin with `--superpowers-ref` / `--agency-ref`.
|
|
311
|
+
- Cursor plugin behavior may vary by version.
|
|
312
|
+
- Vendor failures are **loud** (non-zero exit).
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Contributing: add a platform
|
|
317
|
+
|
|
318
|
+
1. Subclass `Platform` in `src/platforms/your-platform.js` and implement `async getFiles(config)`.
|
|
319
|
+
2. `register(new YourPlatform())` in that file.
|
|
320
|
+
3. Import from `src/commands/init.js` and add to `PLATFORMS` in `src/constants.js`.
|
|
321
|
+
4. Add templates under `src/templates/your-platform/`.
|
|
322
|
+
5. Extend `tests/platforms.test.js`.
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Development (this package)
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
git clone <repo> && cd ai-dev-setup
|
|
330
|
+
npm test
|
|
331
|
+
node bin/ai-dev-setup.js --help
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## License
|
|
337
|
+
|
|
338
|
+
MIT — see [LICENSE](./LICENSE).
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ai-dev-setup",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "One command to scaffold optimized AI coding assistant rules for Claude Code, Cursor, and more",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ai-dev-setup": "bin/ai-dev-setup.js"
|
|
8
|
+
},
|
|
9
|
+
"files": ["bin/", "src/"],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "node --test tests/*.test.js",
|
|
12
|
+
"lint": "echo 'no external linter — zero deps'",
|
|
13
|
+
"start": "node bin/ai-dev-setup.js"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"ai",
|
|
17
|
+
"claude",
|
|
18
|
+
"cursor",
|
|
19
|
+
"rules",
|
|
20
|
+
"scaffold",
|
|
21
|
+
"cli",
|
|
22
|
+
"coding-assistant",
|
|
23
|
+
"superpowers",
|
|
24
|
+
"agency-agents"
|
|
25
|
+
],
|
|
26
|
+
"author": "fahadsubzwari924",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/fahadsubzwari924/ai-dev-setup"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/cli/index.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { VERSION, PLATFORMS, STACKS } from '../constants.js';
|
|
2
|
+
import { initCommand } from '../commands/init.js';
|
|
3
|
+
import { updateCommand } from '../commands/update.js';
|
|
4
|
+
import { bold, dim, green } from './logger.js';
|
|
5
|
+
|
|
6
|
+
function printHelp() {
|
|
7
|
+
const lines = [
|
|
8
|
+
bold('ai-dev-setup') + ' — scaffold AI assistant config (Claude Code, Cursor)',
|
|
9
|
+
'',
|
|
10
|
+
dim('Usage:'),
|
|
11
|
+
' npx ai-dev-setup [init] [options]',
|
|
12
|
+
' npx ai-dev-setup update (placeholder)',
|
|
13
|
+
'',
|
|
14
|
+
dim('Options:'),
|
|
15
|
+
' -y, --yes Non-interactive: detect project + defaults, no prompts',
|
|
16
|
+
' -f, --force Overwrite existing generated files',
|
|
17
|
+
' --stack=a,b Merge stack keys (' +
|
|
18
|
+
STACKS.map((s) => s.key).join(', ') +
|
|
19
|
+
')',
|
|
20
|
+
' --platforms=a,b Platforms: claude, cursor (non-interactive)',
|
|
21
|
+
' --skip-vendor Skip git clone + Agency convert (templates only)',
|
|
22
|
+
' --vendor-only Only run vendor step (no template writes; for teammates / vendor in .gitignore)',
|
|
23
|
+
' --superpowers-ref=REF Git branch/tag for obra/superpowers (default: main)',
|
|
24
|
+
' --agency-ref=REF Git branch/tag for agency-agents (default: main)',
|
|
25
|
+
' -h, --help Show help',
|
|
26
|
+
' -v, --version Show version',
|
|
27
|
+
'',
|
|
28
|
+
dim('Platforms:'),
|
|
29
|
+
...PLATFORMS.map((p) => ` ${green(p.key.padEnd(8))} ${p.label} — ${p.desc}`),
|
|
30
|
+
'',
|
|
31
|
+
dim('Examples:'),
|
|
32
|
+
' npx ai-dev-setup init',
|
|
33
|
+
' npx ai-dev-setup init --yes --platforms=claude,cursor',
|
|
34
|
+
' npx ai-dev-setup init --yes --skip-vendor # templates only; commit without vendor/',
|
|
35
|
+
' npx ai-dev-setup init --vendor-only --platforms=claude,cursor',
|
|
36
|
+
'',
|
|
37
|
+
];
|
|
38
|
+
console.log(lines.join('\n'));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @param {string[]} argv
|
|
43
|
+
*/
|
|
44
|
+
export function parseArgv(argv) {
|
|
45
|
+
const flags = {
|
|
46
|
+
yes: false,
|
|
47
|
+
force: false,
|
|
48
|
+
skipVendor: false,
|
|
49
|
+
vendorOnly: false,
|
|
50
|
+
help: false,
|
|
51
|
+
version: false,
|
|
52
|
+
stack: null,
|
|
53
|
+
platforms: null,
|
|
54
|
+
superpowersRef: null,
|
|
55
|
+
agencyRef: null,
|
|
56
|
+
};
|
|
57
|
+
const positional = [];
|
|
58
|
+
|
|
59
|
+
for (let i = 0; i < argv.length; i++) {
|
|
60
|
+
const a = argv[i];
|
|
61
|
+
if (a === '--yes' || a === '-y') {
|
|
62
|
+
flags.yes = true;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (a === '--force' || a === '-f') {
|
|
66
|
+
flags.force = true;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (a === '--skip-vendor') {
|
|
70
|
+
flags.skipVendor = true;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (a === '--vendor-only') {
|
|
74
|
+
flags.vendorOnly = true;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (a === '--help' || a === '-h') {
|
|
78
|
+
flags.help = true;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (a === '--version' || a === '-v') {
|
|
82
|
+
flags.version = true;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (a.startsWith('--stack=')) {
|
|
86
|
+
flags.stack = a.slice('--stack='.length);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (a.startsWith('--platforms=')) {
|
|
90
|
+
flags.platforms = a.slice('--platforms='.length);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (a.startsWith('--superpowers-ref=')) {
|
|
94
|
+
flags.superpowersRef = a.slice('--superpowers-ref='.length);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (a.startsWith('--agency-ref=')) {
|
|
98
|
+
flags.agencyRef = a.slice('--agency-ref='.length);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (a.startsWith('-')) {
|
|
102
|
+
throw new Error(`Unknown flag: ${a}`);
|
|
103
|
+
}
|
|
104
|
+
positional.push(a);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return { flags, positional };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param {string[]} argv
|
|
112
|
+
*/
|
|
113
|
+
export async function run(argv) {
|
|
114
|
+
const { flags, positional } = parseArgv(argv);
|
|
115
|
+
|
|
116
|
+
if (flags.help) {
|
|
117
|
+
printHelp();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (flags.version) {
|
|
121
|
+
console.log(VERSION);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const cmd = positional[0] ?? 'init';
|
|
126
|
+
const rest = positional.slice(1);
|
|
127
|
+
|
|
128
|
+
if (rest.length > 0) {
|
|
129
|
+
throw new Error(`Unexpected arguments: ${rest.join(' ')}`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (cmd === 'init') {
|
|
133
|
+
await initCommand(flags);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (cmd === 'update') {
|
|
137
|
+
await updateCommand(flags);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
throw new Error(`Unknown command: ${cmd}. Try --help`);
|
|
142
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
|
|
3
|
+
function noAnsi() {
|
|
4
|
+
return !process.stdout.isTTY || process.env.NO_COLOR != null;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function ansi(code) {
|
|
8
|
+
return (s) => (noAnsi() ? s : `\x1b[${code}m${s}\x1b[0m`);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function bold(s) {
|
|
12
|
+
return ansi('1')(s);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function green(s) {
|
|
16
|
+
return ansi('32')(s);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function yellow(s) {
|
|
20
|
+
return ansi('33')(s);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function dim(s) {
|
|
24
|
+
return ansi('2')(s);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function red(s) {
|
|
28
|
+
return ansi('31')(s);
|
|
29
|
+
}
|