@negikirin/repo-pattern 0.1.1
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/CLAUDE.md +61 -0
- package/.claude/settings.example.json +40 -0
- package/.claude/settings.local.example.json +24 -0
- package/.github/workflows/nodejs-package.yml +60 -0
- package/.repo-pattern.json +25 -0
- package/.repo-pattern.lock.json +23 -0
- package/LICENSE +21 -0
- package/README.md +145 -0
- package/THIRD_PARTY_NOTICES.md +51 -0
- package/docs/repo-pattern/setup-guide.md +725 -0
- package/docs/repo-pattern/workflow.md +429 -0
- package/mcp/profiles/backend.json +7 -0
- package/mcp/profiles/full.json +11 -0
- package/mcp/profiles/minimal.json +6 -0
- package/mcp/profiles/research.json +8 -0
- package/mcp/profiles/web.json +8 -0
- package/mcp/servers/chrome-devtools.json +10 -0
- package/mcp/servers/context7.json +13 -0
- package/mcp/servers/filesystem.json +11 -0
- package/mcp/servers/gitnexus.json +11 -0
- package/mcp/servers/playwright.json +12 -0
- package/mcp/servers/sequential-thinking.json +10 -0
- package/mcp/servers/tavily.json +13 -0
- package/package.json +71 -0
- package/scripts/lib/audit.mjs +127 -0
- package/scripts/lib/cleanup.mjs +35 -0
- package/scripts/lib/doctor.mjs +86 -0
- package/scripts/lib/ecc-rules.mjs +98 -0
- package/scripts/lib/ecc.mjs +61 -0
- package/scripts/lib/fs-utils.mjs +133 -0
- package/scripts/lib/mcp.mjs +203 -0
- package/scripts/lib/project-detect.mjs +107 -0
- package/scripts/lib/prompt.mjs +226 -0
- package/scripts/lib/provision.mjs +184 -0
- package/scripts/lib/rules.mjs +142 -0
- package/scripts/lib/setup.mjs +299 -0
- package/scripts/lib/skills.mjs +249 -0
- package/scripts/repo-pattern.mjs +156 -0
- package/scripts/self-check.mjs +175 -0
|
@@ -0,0 +1,725 @@
|
|
|
1
|
+
# Repo Pattern Setup Guide
|
|
2
|
+
|
|
3
|
+
This guide focuses on the guided terminal path:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Use `setup` when you want an arrow-key UI for profile choice, optional ECC rules, migration safety, and confirmation.
|
|
10
|
+
|
|
11
|
+
Use scriptable `setup --yes` when you already know the exact options:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project --profile web --yes
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Use this when you want to initialize a new project with:
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
minimal Claude Code setup
|
|
21
|
+
+ ECC setup flow
|
|
22
|
+
+ MCP profile
|
|
23
|
+
+ generated .mcp.json
|
|
24
|
+
+ repo-pattern metadata
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`repo-pattern` is intentionally not a Claude runtime pack. It does not install local Claude skills, commands, hooks, scripts, or rules by default. Project-local ECC rules are explicit opt-in via `setup --with-rules`, `rules`, or interactive `setup`. Optional external skills are explicit opt-in via `setup --with-skill <name>` or interactive `setup`.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## npmjs publishing
|
|
33
|
+
|
|
34
|
+
The repository includes:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
.github/workflows/nodejs-package.yml
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Create a GitHub Release to trigger publishing to npmjs. The workflow expects an `NPM_TOKEN` repository secret and publishes with:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
registry-url: https://registry.npmjs.org/
|
|
44
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## NPX package usage
|
|
48
|
+
|
|
49
|
+
When published to npmjs, `repo-pattern` can be used without cloning the repository:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx @negikirin/repo-pattern setup --target . --profile web --yes
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The package exposes one CLI binary:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
repo-pattern
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Local package test before publishing:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm pack
|
|
65
|
+
npm exec --yes --package ./repo-pattern-0.1.0.tgz -- repo-pattern --help
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 1. One-step setup for a new project
|
|
69
|
+
|
|
70
|
+
Run from the `repo-pattern` repository:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Example:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
node scripts/repo-pattern.mjs setup --target ~/Code/my-app
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
For scripts or CI, use the non-interactive path:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
node scripts/repo-pattern.mjs setup --target ~/Code/my-app --profile web --yes
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Setup first checks `claude --version`, then uses a library-backed terminal wizard. It can auto-detect ECC rules or let you choose rule packs by type, asks for selected MCP API keys/relative paths when needed, then asks for Anthropic provider/model values and writes them to the target's gitignored `.claude/settings.local.json`.
|
|
89
|
+
|
|
90
|
+
Keys:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
↑ / ↓ move
|
|
94
|
+
Space toggle MCP/rules choices
|
|
95
|
+
Enter confirm current step
|
|
96
|
+
Esc/Ctrl+C cancel
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
For non-interactive scripts, use `setup --yes`.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 2. What `setup` does
|
|
104
|
+
|
|
105
|
+
`setup` runs the full setup flow:
|
|
106
|
+
|
|
107
|
+
```text
|
|
108
|
+
1. Audit the target project.
|
|
109
|
+
2. Create minimal `.claude/` setup.
|
|
110
|
+
3. Create empty root `CLAUDE.md` if missing. If it already exists, keep it unchanged.
|
|
111
|
+
4. Write `.claude/CLAUDE.md` if missing.
|
|
112
|
+
5. Write `.claude/settings.json` from `.claude/settings.example.json`.
|
|
113
|
+
6. In interactive setup, ask whether commit attribution is off, on, or custom.
|
|
114
|
+
7. During `setup`, write gitignored `.claude/settings.local.json` from prompted provider/model values.
|
|
115
|
+
8. Read MCP profiles and server definitions from `repo-pattern`.
|
|
116
|
+
9. In interactive mode, ask for selected MCP API keys and relative paths when placeholders require them.
|
|
117
|
+
10. Generate `.mcp.json` from the selected profile.
|
|
118
|
+
11. Write `.repo-pattern.json`.
|
|
119
|
+
12. Write `.repo-pattern.lock.json`.
|
|
120
|
+
13. Run or attempt ECC setup flow.
|
|
121
|
+
14. During `setup` with rules enabled, apply ECC rules.
|
|
122
|
+
15. Run doctor.
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
After setup, the target project should contain:
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
target-project/
|
|
129
|
+
├── CLAUDE.md
|
|
130
|
+
├── .claude/
|
|
131
|
+
│ ├── CLAUDE.md
|
|
132
|
+
│ ├── settings.json
|
|
133
|
+
│ └── settings.local.json # setup only, gitignored
|
|
134
|
+
├── .mcp.json
|
|
135
|
+
├── .repo-pattern.json
|
|
136
|
+
└── .repo-pattern.lock.json
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Root `CLAUDE.md` policy
|
|
140
|
+
|
|
141
|
+
`repo-pattern setup` creates the target project's root `CLAUDE.md` as an empty file when it is missing.
|
|
142
|
+
|
|
143
|
+
If the target project already has `CLAUDE.md`, `repo-pattern setup` leaves it unchanged.
|
|
144
|
+
|
|
145
|
+
This keeps root `CLAUDE.md` reserved for project-specific instructions instead of copying repo-pattern's own instructions into every target project.
|
|
146
|
+
|
|
147
|
+
The target project should not contain these unmanaged runtime surfaces by default:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
.claude/skills/
|
|
151
|
+
.claude/commands/
|
|
152
|
+
.claude/hooks/
|
|
153
|
+
.claude/scripts/
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Project-local rules are opt-in and limited to repo-pattern-managed `.claude/rules/ecc/`.
|
|
157
|
+
|
|
158
|
+
Optional external skills are also opt-in and limited to repo-pattern-managed `.claude/skills/`:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
repo-pattern setup --with-skill taste --yes
|
|
162
|
+
repo-pattern setup --with-skill document-specialist --yes
|
|
163
|
+
repo-pattern setup --with-skill ui-ux-pro-max --yes
|
|
164
|
+
repo-pattern setup --with-skill impeccable --yes
|
|
165
|
+
repo-pattern setup --with-skill huashu-design --yes
|
|
166
|
+
repo-pattern setup --with-skills taste,document-specialist,ui-ux-pro-max,impeccable,huashu-design --yes
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Available optional skills:
|
|
170
|
+
|
|
171
|
+
- `taste` — UI taste/design skills from https://github.com/Leonxlnx/taste-skill/ (MIT).
|
|
172
|
+
- `document-specialist` — documentation specialist from https://github.com/SpillwaveSolutions/document-specialist-skill/ (license not declared upstream; choose only when you accept that source).
|
|
173
|
+
- `ui-ux-pro-max` — UI/UX design intelligence from https://github.com/nextlevelbuilder/ui-ux-pro-max-skill/ (MIT; requires Python 3.x).
|
|
174
|
+
- `impeccable` — visual design QA from https://github.com/pbakaus/impeccable/ (Apache-2.0; skill-only install, scripts require Node >=24).
|
|
175
|
+
- `huashu-design` — multimedia design workflow from https://github.com/alchaincyf/huashu-design/ (MIT; scripts may need Playwright, Python, and ffmpeg).
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## 3. MCP profiles
|
|
180
|
+
|
|
181
|
+
MCP config is generated from a profile. In interactive `setup`, choose `custom` when you want to select exact MCP servers instead of using a preset.
|
|
182
|
+
|
|
183
|
+
Default profile:
|
|
184
|
+
|
|
185
|
+
```text
|
|
186
|
+
web
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Select a profile with:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project --profile <profile> --yes
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
or regenerate later:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
node scripts/repo-pattern.mjs mcp --target /path/to/project --profile <profile>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Interactive `setup` and `mcp` ask for selected MCP placeholders such as `CONTEXT7_API_KEY` and `TAVILY_API_KEY`. The filesystem MCP server uses the target project root (`.`) as its allowed directory. Other MCP paths, when prompted, must be relative (`src`, `packages/api`); absolute machine paths and `..` are rejected. With `--yes` or non-TTY runs, unresolved secret placeholders stay in `.mcp.json` and the CLI prints the values to fill later.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## 4. Profile: `minimal`
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project --profile minimal --yes
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Enabled servers:
|
|
212
|
+
|
|
213
|
+
```text
|
|
214
|
+
context7
|
|
215
|
+
filesystem
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Use this when:
|
|
219
|
+
|
|
220
|
+
```text
|
|
221
|
+
- you want the smallest setup;
|
|
222
|
+
- the project does not need browser automation;
|
|
223
|
+
- the project does not need web research tools;
|
|
224
|
+
- you want minimal MCP/tooling noise.
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Best for:
|
|
228
|
+
|
|
229
|
+
```text
|
|
230
|
+
small libraries
|
|
231
|
+
backend utilities
|
|
232
|
+
CLI tools
|
|
233
|
+
simple experiments
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## 5. Profile: `web`
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project --profile web --yes
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Enabled servers:
|
|
245
|
+
|
|
246
|
+
```text
|
|
247
|
+
context7
|
|
248
|
+
filesystem
|
|
249
|
+
playwright
|
|
250
|
+
chrome-devtools
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Use this when:
|
|
254
|
+
|
|
255
|
+
```text
|
|
256
|
+
- the project has frontend or browser behavior;
|
|
257
|
+
- Claude needs to inspect runtime UI behavior;
|
|
258
|
+
- you want browser automation and debugging support;
|
|
259
|
+
- you want a strong default for most app projects.
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Best for:
|
|
263
|
+
|
|
264
|
+
```text
|
|
265
|
+
web apps
|
|
266
|
+
full-stack apps
|
|
267
|
+
frontend-heavy projects
|
|
268
|
+
UI debugging
|
|
269
|
+
E2E testing workflows
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Recommended default:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
node scripts/repo-pattern.mjs setup --target ~/Code/my-app --profile web --yes
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## 6. Profile: `backend`
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project --profile backend --yes
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Enabled servers:
|
|
287
|
+
|
|
288
|
+
```text
|
|
289
|
+
context7
|
|
290
|
+
filesystem
|
|
291
|
+
gitnexus
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Use this when:
|
|
295
|
+
|
|
296
|
+
```text
|
|
297
|
+
- the project is mainly backend;
|
|
298
|
+
- codebase structure and impact analysis matter;
|
|
299
|
+
- frontend/browser tooling is not needed by default.
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Best for:
|
|
303
|
+
|
|
304
|
+
```text
|
|
305
|
+
APIs
|
|
306
|
+
services
|
|
307
|
+
monorepo backend packages
|
|
308
|
+
codebase analysis
|
|
309
|
+
impact analysis
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## 7. Profile: `research`
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project --profile research --yes
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Enabled servers:
|
|
321
|
+
|
|
322
|
+
```text
|
|
323
|
+
context7
|
|
324
|
+
filesystem
|
|
325
|
+
tavily
|
|
326
|
+
sequential-thinking
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Use this when:
|
|
330
|
+
|
|
331
|
+
```text
|
|
332
|
+
- the project needs frequent documentation lookup;
|
|
333
|
+
- tasks involve external research;
|
|
334
|
+
- implementation decisions need structured reasoning;
|
|
335
|
+
- current information is important.
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Best for:
|
|
339
|
+
|
|
340
|
+
```text
|
|
341
|
+
research-heavy projects
|
|
342
|
+
technical investigations
|
|
343
|
+
library comparison
|
|
344
|
+
architecture exploration
|
|
345
|
+
documentation-driven work
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Required or recommended environment variables:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
export TAVILY_API_KEY="..."
|
|
352
|
+
export CONTEXT7_API_KEY="..."
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## 8. Profile: `full`
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project --profile full --yes
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Enabled servers:
|
|
364
|
+
|
|
365
|
+
```text
|
|
366
|
+
context7
|
|
367
|
+
filesystem
|
|
368
|
+
playwright
|
|
369
|
+
chrome-devtools
|
|
370
|
+
gitnexus
|
|
371
|
+
tavily
|
|
372
|
+
sequential-thinking
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
Use this only when:
|
|
376
|
+
|
|
377
|
+
```text
|
|
378
|
+
- you intentionally want all included example MCP servers;
|
|
379
|
+
- you understand the extra tool/context surface;
|
|
380
|
+
- you are testing repo-pattern itself.
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
Not recommended as the default for normal projects.
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## 9. Custom MCP selection
|
|
388
|
+
|
|
389
|
+
In interactive setup, choose `custom` to select exact MCP servers from the available `mcp/servers/*.json` definitions.
|
|
390
|
+
|
|
391
|
+
Use this when no preset profile matches the project.
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
## 10. Claude Code settings
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
## Context and token guards
|
|
400
|
+
|
|
401
|
+
Claude Code currently exposes `autoCompactEnabled`, but not a documented project setting for a custom auto-compact token threshold. `repo-pattern` therefore uses official context/token guards instead of adding fake settings:
|
|
402
|
+
|
|
403
|
+
```json
|
|
404
|
+
{
|
|
405
|
+
"autoCompactEnabled": true,
|
|
406
|
+
"showClearContextOnPlanAccept": true,
|
|
407
|
+
"env": {
|
|
408
|
+
"ENABLE_TOOL_SEARCH": "auto:5"}
|
|
409
|
+
}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Meaning:
|
|
413
|
+
|
|
414
|
+
- skill listing and skill description limits are intentionally left at Claude Code defaults
|
|
415
|
+
- keep auto-compact enabled
|
|
416
|
+
- show the clear-context option after accepting a plan
|
|
417
|
+
- defer MCP tool loading unless tools fit within 5% of context
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
`repo-pattern setup` writes local ignored project settings from the tracked `.claude/settings.example.json` template:
|
|
421
|
+
|
|
422
|
+
```text
|
|
423
|
+
.claude/settings.json
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
The template is intentionally safe by default:
|
|
427
|
+
|
|
428
|
+
```text
|
|
429
|
+
permissions.allow = []
|
|
430
|
+
permissions.ask = dangerous shell operations
|
|
431
|
+
permissions.deny = common secrets and credential files
|
|
432
|
+
hooks = {}
|
|
433
|
+
attribution.commit = "" (disables Claude Code Co-Authored-By trailers)
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Interactive setup asks whether commit attribution should be `off`, `on`, or `custom`. `on` leaves Claude Code's default attribution behavior in place; `custom` writes your exact trailer string to `attribution.commit`.
|
|
437
|
+
|
|
438
|
+
The selected MCP profile is also approved in:
|
|
439
|
+
|
|
440
|
+
```json
|
|
441
|
+
"enabledMcpjsonServers": [...]
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
For example, profile `web` sets:
|
|
445
|
+
|
|
446
|
+
```json
|
|
447
|
+
"enabledMcpjsonServers": [
|
|
448
|
+
"context7",
|
|
449
|
+
"filesystem",
|
|
450
|
+
"playwright",
|
|
451
|
+
"chrome-devtools"
|
|
452
|
+
]
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
Local preferences and Anthropic provider/model values should go in:
|
|
456
|
+
|
|
457
|
+
```text
|
|
458
|
+
.claude/settings.local.json
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
`setup` asks for these values and writes the file for you:
|
|
462
|
+
|
|
463
|
+
```text
|
|
464
|
+
ANTHROPIC_BASE_URL
|
|
465
|
+
ANTHROPIC_AUTH_TOKEN
|
|
466
|
+
ANTHROPIC_DEFAULT_OPUS_MODEL
|
|
467
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL
|
|
468
|
+
ANTHROPIC_DEFAULT_HAIKU_MODEL
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
Do not commit that file; `setup` adds it to `.gitignore`.
|
|
472
|
+
|
|
473
|
+
## 12. Repo-pattern commands
|
|
474
|
+
|
|
475
|
+
### `setup`
|
|
476
|
+
|
|
477
|
+
Guided terminal setup.
|
|
478
|
+
|
|
479
|
+
```bash
|
|
480
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
Behavior:
|
|
484
|
+
|
|
485
|
+
```text
|
|
486
|
+
EMPTY/PARTIAL → recommends setup
|
|
487
|
+
LEGACY_VENDOR → recommends migrate and requires confirmation
|
|
488
|
+
ECC_NATIVE_MINIMAL → offers doctor, MCP regeneration, or exit
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Interactive mode uses ↑/↓ to move, Space to toggle MCP/rules choices, Enter to confirm. It writes `.claude/settings.local.json` and adds that path to the target `.gitignore`. Use `setup --yes` for CI/scripts.
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
### `setup --yes`
|
|
496
|
+
|
|
497
|
+
Initialize a new project non-interactively.
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project --profile web --yes
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
This is the scriptable setup path.
|
|
504
|
+
|
|
505
|
+
It performs:
|
|
506
|
+
|
|
507
|
+
```text
|
|
508
|
+
minimal Claude setup
|
|
509
|
+
MCP generation
|
|
510
|
+
ECC setup flow
|
|
511
|
+
optional ECC rules sync
|
|
512
|
+
doctor check
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
### `audit`
|
|
518
|
+
|
|
519
|
+
Inspect the target project state.
|
|
520
|
+
|
|
521
|
+
```bash
|
|
522
|
+
node scripts/repo-pattern.mjs audit --target /path/to/project
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
Use this before setup when you are unsure whether the project already has Claude Code files.
|
|
526
|
+
|
|
527
|
+
Possible states:
|
|
528
|
+
|
|
529
|
+
```text
|
|
530
|
+
EMPTY
|
|
531
|
+
PARTIAL
|
|
532
|
+
ECC_NATIVE_MINIMAL
|
|
533
|
+
LEGACY_VENDOR
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
### `mcp`
|
|
539
|
+
|
|
540
|
+
Regenerate `.mcp.json` from a profile.
|
|
541
|
+
|
|
542
|
+
```bash
|
|
543
|
+
node scripts/repo-pattern.mjs mcp --target /path/to/project --profile web
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
Use this when switching profiles.
|
|
547
|
+
|
|
548
|
+
Example:
|
|
549
|
+
|
|
550
|
+
```bash
|
|
551
|
+
node scripts/repo-pattern.mjs mcp --target ~/Code/my-app --profile research
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
---
|
|
555
|
+
|
|
556
|
+
### `doctor`
|
|
557
|
+
|
|
558
|
+
Validate the target project.
|
|
559
|
+
|
|
560
|
+
```bash
|
|
561
|
+
node scripts/repo-pattern.mjs doctor --target /path/to/project
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
Doctor checks that:
|
|
565
|
+
|
|
566
|
+
```text
|
|
567
|
+
unmanaged local Claude runtime surfaces are absent
|
|
568
|
+
settings hooks are empty
|
|
569
|
+
.mcp.json has no hardcoded machine path
|
|
570
|
+
.repo-pattern.json is valid
|
|
571
|
+
ECC setup status is recorded
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
Run this after setup or after changing MCP profiles.
|
|
575
|
+
|
|
576
|
+
---
|
|
577
|
+
|
|
578
|
+
### `cleanup`
|
|
579
|
+
|
|
580
|
+
Advanced recovery command for removing old local Claude runtime surfaces.
|
|
581
|
+
|
|
582
|
+
```bash
|
|
583
|
+
node scripts/repo-pattern.mjs cleanup --target /path/to/project
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
Use this when you only want to clear old setup before running `setup`.
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
### `ecc`
|
|
591
|
+
|
|
592
|
+
Advanced/manual command to rerun or print ECC setup instructions.
|
|
593
|
+
|
|
594
|
+
```bash
|
|
595
|
+
node scripts/repo-pattern.mjs ecc --target /path/to/project
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
Usually not needed because `setup` already runs ECC setup flow.
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
### `rules`
|
|
603
|
+
|
|
604
|
+
Advanced/manual command to apply repo-pattern-managed ECC rules under `.claude/rules/ecc/`.
|
|
605
|
+
|
|
606
|
+
```bash
|
|
607
|
+
node scripts/repo-pattern.mjs rules --target /path/to/project
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
Usually not needed when `setup --with-rules` was used.
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
## 13. Recommended flows
|
|
615
|
+
|
|
616
|
+
### New web/full-stack project
|
|
617
|
+
|
|
618
|
+
```bash
|
|
619
|
+
node scripts/repo-pattern.mjs setup --target ~/Code/my-app
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
### New backend project
|
|
623
|
+
|
|
624
|
+
```bash
|
|
625
|
+
node scripts/repo-pattern.mjs setup --target ~/Code/my-api --profile backend --yes
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### Minimal project
|
|
629
|
+
|
|
630
|
+
```bash
|
|
631
|
+
node scripts/repo-pattern.mjs setup --target ~/Code/my-tool --profile minimal --yes
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
### Research-heavy project
|
|
635
|
+
|
|
636
|
+
```bash
|
|
637
|
+
node scripts/repo-pattern.mjs setup --target ~/Code/my-research --profile research --yes
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
### Existing project with old setup
|
|
641
|
+
|
|
642
|
+
```bash
|
|
643
|
+
node scripts/repo-pattern.mjs audit --target ~/Code/old-project
|
|
644
|
+
node scripts/repo-pattern.mjs setup --target ~/Code/old-project --profile web --migrate --yes
|
|
645
|
+
node scripts/repo-pattern.mjs doctor --target ~/Code/old-project
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
### Change MCP profile later
|
|
649
|
+
|
|
650
|
+
```bash
|
|
651
|
+
node scripts/repo-pattern.mjs mcp --target ~/Code/my-app --profile research
|
|
652
|
+
node scripts/repo-pattern.mjs doctor --target ~/Code/my-app
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
---
|
|
656
|
+
|
|
657
|
+
## 14. Summary
|
|
658
|
+
|
|
659
|
+
For normal usage:
|
|
660
|
+
|
|
661
|
+
```bash
|
|
662
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
For scripted usage:
|
|
666
|
+
|
|
667
|
+
```bash
|
|
668
|
+
node scripts/repo-pattern.mjs setup --target /path/to/project --profile web --yes
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
Use another profile only when the project clearly needs it:
|
|
672
|
+
|
|
673
|
+
```text
|
|
674
|
+
minimal → smallest setup
|
|
675
|
+
web → default app setup
|
|
676
|
+
backend → backend/codebase analysis
|
|
677
|
+
research → docs/search/reasoning-heavy work
|
|
678
|
+
full → local testing only
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
## ECC rules auto-cache
|
|
683
|
+
|
|
684
|
+
ECC rules are opt-in. `repo-pattern` can select ECC rule packs from the target project's stack and apply them to project scope.
|
|
685
|
+
|
|
686
|
+
Run rules explicitly with:
|
|
687
|
+
|
|
688
|
+
```bash
|
|
689
|
+
node scripts/repo-pattern.mjs rules --target /path/to/project
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
Rules are always installed under:
|
|
693
|
+
|
|
694
|
+
```text
|
|
695
|
+
.claude/rules/ecc/
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
`repo-pattern` does not flatten rules and does not touch custom rules outside the `ecc/` namespace.
|
|
699
|
+
|
|
700
|
+
The ECC repository is cloned and cached automatically inside the target project:
|
|
701
|
+
|
|
702
|
+
```text
|
|
703
|
+
.repo-pattern/cache/ECC/
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
The first run needs network access. Later runs reuse the cache.
|
|
707
|
+
|
|
708
|
+
Recommended rules are selected from the official ECC rule packs:
|
|
709
|
+
|
|
710
|
+
```text
|
|
711
|
+
common
|
|
712
|
+
typescript
|
|
713
|
+
angular
|
|
714
|
+
vue
|
|
715
|
+
nuxt
|
|
716
|
+
python
|
|
717
|
+
golang
|
|
718
|
+
web
|
|
719
|
+
swift
|
|
720
|
+
php
|
|
721
|
+
ruby
|
|
722
|
+
arkts
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
For scriptable setup, use `--with-rules --yes` to run this rules step after ECC setup and before doctor.
|