@eltonssouza/development-utility-kit 0.11.0 → 0.12.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.
@@ -16,7 +16,7 @@ running.
16
16
 
17
17
  - Installing the harness on a project WITHOUT `.claude/`
18
18
  - Updating a project that ALREADY has `.claude/` (idempotent)
19
- - Batch adoption (multiple projects via `/active-project`)
19
+ - Batch adoption (multiple projects via `duk sync-all`)
20
20
  - Initial audit: structure, coverage, debt
21
21
  - First feature on a legacy codebase with a GREEN baseline
22
22
  - Stack migration (Java/Spring/Angular major versions)
@@ -39,6 +39,20 @@ running.
39
39
  Scenario: you cloned a legacy repo and want to plug in the harness for the first
40
40
  time.
41
41
 
42
+ ### 2.0 Decide: plugin or npx injection
43
+
44
+ Two distribution models — pick before you start:
45
+
46
+ | | **Plugin** (global) | **npx injection** (vendored) |
47
+ |---|---|---|
48
+ | Command | `/plugin marketplace add eltonssouza/development-utility-kit` → `/plugin install development-utility-kit` | `npx @eltonssouza/development-utility-kit install` |
49
+ | Writes into repo | nothing | `.claude/` + `CLAUDE.md` |
50
+ | Scope | every project on the host | this project only |
51
+ | Per-project stack | small `## Project Identity` block in `CLAUDE.md` (or `detect-stack`) | written for you |
52
+ | Best for | "I want it everywhere, out of my repos" | "I want it pinned and committed in this repo" |
53
+
54
+ If you choose the **plugin**, run the two `/plugin` commands inside Claude Code and skip to §2.6 (just declare `## Project Identity`). The rest of section 2 (§2.1–§2.5) covers the **npx injection** path.
55
+
42
56
  ### 2.1 Preparation
43
57
 
44
58
  ```bash
@@ -64,7 +78,7 @@ Expected output:
64
78
  > Detecting project type...
65
79
  ✓ Detected type: fullstack (backend/pom.xml + frontend/angular.json)
66
80
  ✓ Backup created at .claude.backup-2026-05-27T14-32-18/ (if .claude already existed)
67
- ✓ .claude/agents/ — 25 agents installed
81
+ ✓ .claude/agents/ — 21 agents installed
68
82
  ✓ .claude/skills/ — 18 skills installed
69
83
  ✓ .claude/settings.json — hooks configured
70
84
  ✓ CLAUDE.md — generated/merged preserving Project Identity
@@ -76,8 +90,9 @@ Next step: edit CLAUDE.md → ## Project Identity with the REAL current state of
76
90
 
77
91
  ### 2.3 Install via global binary
78
92
 
79
- If you've already run `npx @eltonssouza/development-utility-kit install` on the
80
- host and have `duk` on PATH:
93
+ The first `npx @eltonssouza/development-utility-kit install` now self-installs the
94
+ `duk` CLI globally (`npm install -g`) at the end, so on every project after that
95
+ you can use the shorter binary directly:
81
96
 
82
97
  ```bash
83
98
  cd C:\my-legacy-project
@@ -88,6 +103,9 @@ duk install
88
103
  prefer; `update` makes it explicit you're re-injecting on a project that
89
104
  already has the harness.
90
105
 
106
+ > The installer refuses to run from a drive root (`C:\`) or a Windows system
107
+ > directory — always `cd` into the project folder first.
108
+
91
109
  ### 2.4 Preview without writing
92
110
 
93
111
  ```bash
@@ -191,30 +209,58 @@ Same triggers as `update-template`. Use whichever vocabulary feels natural.
191
209
 
192
210
  ## 4. Batch adoption — multiple projects
193
211
 
194
- If you have 5+ legacy repos and want to adopt them all without entering each:
212
+ If you have 5+ legacy repos under one directory and want to adopt them all
213
+ without entering each, use the `duk sync-all` CLI (non-interactive, path-driven).
214
+ It auto-detects each project's type and applies the installed harness:
195
215
 
196
- ```text
197
- /active-project C:/projects/legacy-1
198
- /active-project C:/projects/legacy-2 --force-type=backend
199
- /active-project C:/projects/legacy-3 --template=C:/development/tools/development-utility-kit
200
- /active-project C:/projects/legacy-4 --dry-run
216
+ ```bash
217
+ # Preview which projects would be adopted (dry-run is the DEFAULT — writes nothing):
218
+ duk sync-all C:/projects
219
+
220
+ # Apply to all detected projects:
221
+ duk sync-all C:/projects --apply
222
+
223
+ # Narrow the batch with filters:
224
+ duk sync-all C:/projects --filter stack:java --apply
225
+ duk sync-all C:/projects --filter age:30d --apply
226
+
227
+ # Exclude specific projects:
228
+ duk sync-all C:/projects --exclude prod-critical --apply
229
+ ```
230
+
231
+ To adopt a SINGLE project from outside, `cd` into it and run the per-project
232
+ installer (it auto-detects type from `pom.xml` / `package.json`):
233
+
234
+ ```bash
235
+ cd C:/projects/legacy-1
236
+ duk install
201
237
  ```
202
238
 
203
- ### 4.1 `/active-project` flags
239
+ ### 4.1 Relevant `duk` flags
240
+
241
+ `duk sync-all <dir>`:
242
+
243
+ - (no flag) — dry-run preview by default, writes nothing
244
+ - `--apply` — actually write `.claude/` + `CLAUDE.md` to each detected project
245
+ - `--filter stack:<lang>` / `--filter age:<N>d` / `--filter harness-version:<X>` —
246
+ narrow which projects are included
247
+ - `--exclude <name>` — skip specific projects
248
+
249
+ `duk install` (run from the project directory):
250
+
251
+ - `--check-only` — compare local vs latest harness without writing
252
+ - `--dry-run` — preview the install without writing
253
+ - `--sub <dir>` — install into a subfolder of the current repo
204
254
 
205
- - `--dry-run` preview, writes nothing
206
- - `--force-type=<backend|frontend|fullstack|mobile>` force type when
207
- auto-detect gets it wrong (e.g. backend with `package.json` for build tools
208
- but actually Java)
209
- - `--template=<path>` — use an alternate template path (local forks, pending
210
- upstream fix)
211
- - `--skip-brain` — don't provision `docs/brain/`
255
+ > Type is auto-detected from project files (`pom.xml`, `package.json`, etc.);
256
+ > there is no manual `--force-type` for the batch flow. The template used is
257
+ > always the installed harness no alternate `--template` path.
212
258
 
213
259
  ### 4.2 Fast-lane vs interactive
214
260
 
215
- | Skill | Mode | When to use |
261
+ | Entry point | Mode | When to use |
216
262
  |---|---|---|
217
- | `active-project` | Non-interactive, path-driven | Batch, multiple projects, CI |
263
+ | `duk sync-all` | Non-interactive, path-driven | Batch, multiple projects, CI |
218
264
  | `update-template` | Interactive, prompt-driven | Single project, manual validation |
219
265
  | `duk install` (CLI) | Non-interactive, CWD-driven | Local, first contact |
220
266
 
@@ -562,7 +608,7 @@ All trigger the `update-template` agent (haiku). Result identical to CLI.
562
608
 
563
609
  | I want to... | Type |
564
610
  |---|---|
565
- | Adopt project without .claude/ | `duk install` (terminal) OR `/active-project <path>` (chat) |
611
+ | Adopt project without .claude/ | `duk install` (terminal) OR `update-template` (chat) |
566
612
  | Update template | `duk install` (terminal) OR `update the template` (chat) |
567
613
  | Compare with official template | `auditor compares .claude structure with official template` |
568
614
  | Audit coverage | `audit the tests` |
@@ -574,7 +620,7 @@ All trigger the `update-template` agent (haiku). Result identical to CLI.
574
620
  | First feature on legacy | `run the tests` → `grill me about <X>` |
575
621
  | Bug on legacy | `let's debug <X>` |
576
622
  | PRD-ready check | `is this ready for production?` |
577
- | Batch adoption | `/active-project <path>` repeated |
623
+ | Batch adoption | `duk sync-all <dir> --apply` |
578
624
  | Remember state | `remember that the project is on <stack>` |
579
625
  | Register feature/ADR/debt | `register in the brain` |
580
626
  | Debt-payment sprint | `run sprint 0` (after tech-lead plan) |
@@ -583,7 +629,7 @@ All trigger the `update-template` agent (haiku). Result identical to CLI.
583
629
 
584
630
  ```text
585
631
  .claude/ absent in the project?
586
- → duk install (CLI) or /active-project <path> (chat batch)
632
+ → duk install (CLI) or update-template (chat)
587
633
 
588
634
  .claude/ present but outdated?
589
635
  → duk install (idempotent) OR "update the template"
@@ -604,7 +650,7 @@ About to start a new feature?
604
650
  → Gate RED? → pay debt first
605
651
 
606
652
  Several projects to adopt at once?
607
- → "/active-project <path>" in batch (non-interactive)
653
+ → "duk sync-all <dir> --apply" (non-interactive batch)
608
654
 
609
655
  Obscure/intermittent bug on legacy?
610
656
  → "let's debug <X>" (pair-debug, hypothesis-driven)
@@ -707,10 +753,11 @@ conflict on the next merge.
707
753
  | Obsidian vault without `MOC.md` | New vault, brain-keeper hasn't run yet | `register in the brain` creates MOC and indices |
708
754
  | `settings.json` customizations lost | Merge overwrote on update | Restore from `.claude.backup-<date>/settings.json` |
709
755
  | Agents with old path after update | Incomplete backup | `duk install --force` or remove `.claude/` and reinstall |
710
- | `npx @eltonssouza/development-utility-kit install` fails with EACCES | Permission on target directory | Run as admin OR `--path <dir-with-permission>` |
756
+ | `npx @eltonssouza/development-utility-kit install` fails with EACCES | Permission on target directory | `cd` into a directory you own and re-run, or run the shell as admin |
757
+ | `npx … install` aborts with "unsafe install target" | Ran from a drive root (`C:\`) or system dir | `cd` into the project folder first — the installer refuses drive roots / system dirs |
711
758
  | `duk install --sub <folder>` doesn't detect type | Subfolder without `pom.xml`/`package.json` at root | `--force-type=<backend\|frontend>` |
712
759
  | Dashboard 4242 won't start | Port in use or Node < 18 | `node -v` and free the port |
713
- | `/active-project` doesn't recognize path | Path with spaces or backslash | Use forward slash: `C:/projects/legacy-1` |
760
+ | `duk install` / `duk sync-all` doesn't recognize path | Path with spaces or backslash | Use forward slash: `C:/projects/legacy-1` |
714
761
 
715
762
  ## 16. Active hooks after `duk install`
716
763
 
@@ -49,6 +49,8 @@ npx @eltonssouza/development-utility-kit install
49
49
 
50
50
  Idempotent: runs `git pull` if the repository already exists.
51
51
 
52
+ > **Prefer a global install?** Install the harness as a Claude Code plugin instead — `/plugin marketplace add eltonssouza/development-utility-kit` then `/plugin install development-utility-kit`. Skills and agents load in every project with nothing written into the repo; you keep only a short `## Project Identity` block per project. The npx form is for vendoring the harness into this repo.
53
+
52
54
  ### Step 2 — Create (or enter) the frontend project
53
55
 
54
56
  ```bash
@@ -241,7 +241,6 @@ conversational.
241
241
  | `prd-ready-check` | `is it production-ready?`, `DoD` | GO / NO-GO |
242
242
  | `pair-debug` | `let's debug <X>`, `investigate this bug` | Hypothesis loop |
243
243
  | `brain-keeper` | `record in brain`, `update the brain` | `docs/brain/` vault |
244
- | `active-project` | `/active-project <path>`, `adopt project at <path>` | Non-interactive adoption |
245
244
  | `update-template` | `update the template` | Sync `.claude/` + `CLAUDE.md` (merge) |
246
245
  | `project-manager` | front-controller | Intercepts all; ROUTE / ORCHESTRATE / ESCALATE |
247
246
 
@@ -333,17 +332,6 @@ Provisions / updates `docs/brain/`:
333
332
  All in Obsidian (vault) format, with `[[wiki]]` links, `#feature`, `#bug`,
334
333
  `#adr` tags, and a MOC (Map of Content) per area.
335
334
 
336
- ### 5.11. `active-project`
337
-
338
- Non-interactive adoption of a legacy project:
339
-
340
- ```text
341
- > "/active-project C:\projects\legacy-fullstack"
342
- ```
343
-
344
- Equivalent to the fast lane of `update-template` when you want to skip the
345
- wizard.
346
-
347
335
  ### 5.12. `update-template`
348
336
 
349
337
  Syncs `.claude/` + `CLAUDE.md` with the latest harness release. The merge
@@ -891,6 +879,8 @@ duk install --dry-run
891
879
  non-destructive merge and creates `CLAUDE.md.bak-<timestamp>` before
892
880
  touching anything.
893
881
 
882
+ > **Prefer a global install?** Install the harness as a Claude Code plugin instead — `/plugin marketplace add eltonssouza/development-utility-kit` then `/plugin install development-utility-kit`. Skills and agents load in every project with nothing written into the repo; you keep only a short `## Project Identity` block per project. The npx form above is for vendoring the harness into this repo.
883
+
894
884
  Edit `CLAUDE.md`:
895
885
 
896
886
  ```markdown
@@ -910,10 +900,11 @@ In chat:
910
900
  > "migrate to Spring Boot 4 + Angular 21" (optional)
911
901
  ```
912
902
 
913
- For non-interactive adoption:
903
+ For non-interactive adoption, run the `duk` CLI from inside the project (or
904
+ trigger `update-template` in chat):
914
905
 
915
- ```text
916
- > "/active-project C:\projects\legacy-fullstack"
906
+ ```bash
907
+ duk install # run from C:\projects\legacy-fullstack
917
908
  ```
918
909
 
919
910
  ---
@@ -1157,7 +1148,7 @@ Big table, ordered by intent.
1157
1148
  |---|---|---|
1158
1149
  | New monorepo from scratch | `scaffold the monorepo` | `bootstrap-fullstack` |
1159
1150
  | Adopt existing project | `duk install` (CLI) + `auditor, compare structure` | `update-template` + `auditor` |
1160
- | Non-interactive adoption | `/active-project C:\projects\X` | `active-project` |
1151
+ | Non-interactive adoption | `duk install` (per project) / `duk sync-all` (batch) | `duk` CLI |
1161
1152
  | Idea discovery | `grill me about <X>` | `grill-me` |
1162
1153
  | Generate PRD | `generate PRD` | `to-prd` |
1163
1154
  | PRD into issues | `break into issues` | `to-issues` |
@@ -49,6 +49,8 @@ duk install
49
49
  # ✓ scripts/hooks/ installed
50
50
  ```
51
51
 
52
+ > **Prefer a global install?** Install the harness as a Claude Code plugin instead — `/plugin marketplace add eltonssouza/development-utility-kit` then `/plugin install development-utility-kit`. Skills and agents load in every project with nothing written into the repo; you keep only a short `## Project Identity` block per project. The `duk install` form above vendors the harness into this repo.
53
+
52
54
  Edit `CLAUDE.md` under the `Project Identity` section:
53
55
 
54
56
  ```markdown
@@ -140,7 +142,6 @@ Mobile uses the harness's general skill catalog. There is no mobile-specific ski
140
142
  | `pair-debug` | "let's debug X", "investigate this bug" | Hypothesis -> probe -> confirm loop |
141
143
  | `prd-ready-check` | "PRD ready?", "DoD" | GO / NO-GO |
142
144
  | `brain-keeper` | "record in brain", end of PLAN | Notes in `docs/brain/` |
143
- | `active-project` | "/active-project <path>" | Fast-lane adoption |
144
145
  | `update-template` | "update template" | Sync `.claude/` + `CLAUDE.md` |
145
146
  | `caveman` | always-on, "stop caveman" | Telegraphic output |
146
147
 
@@ -834,4 +835,4 @@ Check:
834
835
  - [Backend manual](./backend) — Java 25 + Spring Boot 4
835
836
  - [Frontend manual](./frontend) — Angular 21
836
837
  - [Fullstack manual](./fullstack) — backend + frontend monorepo
837
- - [Existing project manual](./existing-project) — adoption via active-project
838
+ - [Existing project manual](./existing-project) — adoption via update-template / duk install
@@ -15,7 +15,27 @@ git --version # any recent version
15
15
 
16
16
  If both pass, you are ready. If not, install Node 18+ and Git first.
17
17
 
18
- You also need either **Claude Code** (CLI) or **Cowork** (the conversational desktop app). They are how the harness gets its work done. The harness itself is just installable skills and agents that live in your project — there is no `duk run` command that talks to an LLM. The LLM client (Claude Code / Cowork) reads the skills and invokes the agents.
18
+ You also need either **Claude Code** (CLI) or **Cowork** (the conversational desktop app). They are how the harness gets its work done. The harness itself is just installable skills and agents — there is no `duk run` command that talks to an LLM. The LLM client (Claude Code / Cowork) reads the skills and invokes the agents.
19
+
20
+ ---
21
+
22
+ ## Two ways to install
23
+
24
+ Pick one:
25
+
26
+ - **Plugin (recommended)** — installs globally into `~/.claude/plugins/`, available in every project, nothing written into your repo. Best when you want the harness everywhere without vendoring it.
27
+ - **npx injection** — writes `.claude/` + `CLAUDE.md` into a specific project (Paths A/B below). Best when you want the harness vendored into the repo and version-pinned per project.
28
+
29
+ Both deliver the same skills, agents, stack packs and the flow-governance hook.
30
+
31
+ ### Path 0 — Install as a Claude Code plugin (30 seconds)
32
+
33
+ ```
34
+ /plugin marketplace add eltonssouza/development-utility-kit
35
+ /plugin install development-utility-kit
36
+ ```
37
+
38
+ Run those two in Claude Code. Every skill and agent is now available in any project you open — no per-project setup. Declare your stack in a short `## Project Identity` block in the project's `CLAUDE.md` (or let `detect-stack` infer it) so `stack-resolver` picks the right pack. Plugins cannot ship a project `CLAUDE.md`, so that small block stays per-project.
19
39
 
20
40
  ---
21
41
 
@@ -150,6 +170,8 @@ If you adopt the harness on a real project and ship something with it, please co
150
170
  | Symptom | Likely cause | Fix |
151
171
  |---|---|---|
152
172
  | `duk doctor` reports Node < 18 | Old Node installed | Install Node 18+ from nodejs.org or your package manager |
173
+ | `npx … install` aborts with "unsafe install target" | You ran it from a drive root (`C:\`) or a system directory | `cd` into your project folder first, then re-run. The installer refuses drive roots / system dirs to avoid writing `C:\CLAUDE.md` |
174
+ | `duk` not found after `npx … install` | Older versions did not self-install the CLI | `npx … install` now runs `npm install -g` automatically; if it still fails, run `npm install -g @eltonssouza/development-utility-kit` once. (Plugin install does not need `duk` on PATH at all.) |
153
175
  | `duk install` aborts with "drift detected" | You modified `.claude/` after the previous install | Move your changes to `.claude/local/` (preserved across installs) OR run `duk install --force` (overwrite + backup) |
154
176
  | Chat does not seem to trigger any skill | Keywords do not match any skill's `description` | Try a more explicit phrasing OR fall through to `project-manager` (front-controller) by phrasing as a normal dev request like "create endpoint POST /api/v1/foo" |
155
177
  | `duk dashboard` says "port 4242 in use" | Another process holds the port | Pass `--port 5000` (or any free port) |
@@ -466,11 +466,6 @@ describe('T-012: manual content — existing project adoption scenario', () => {
466
466
  }
467
467
  });
468
468
 
469
- test('existing-project.pt.md mentions active-project', () => {
470
- const content = fs.readFileSync(ptFile, 'utf8');
471
- assert.ok(content.includes('active-project'), 'Missing active-project mention in existing-project.pt.md');
472
- });
473
-
474
469
  test('existing-project.pt.md mentions update-template', () => {
475
470
  const content = fs.readFileSync(ptFile, 'utf8');
476
471
  assert.ok(content.includes('update-template'), 'Missing update-template mention in existing-project.pt.md');
@@ -486,11 +481,6 @@ describe('T-012: manual content — existing project adoption scenario', () => {
486
481
  assert.ok(content.includes('Project Identity'), 'Missing Project Identity mention in existing-project.pt.md');
487
482
  });
488
483
 
489
- test('existing-project.en.md mentions active-project', () => {
490
- const content = fs.readFileSync(enFile, 'utf8');
491
- assert.ok(content.includes('active-project'), 'Missing active-project mention in existing-project.en.md');
492
- });
493
-
494
484
  test('existing-project.en.md mentions update-template', () => {
495
485
  const content = fs.readFileSync(enFile, 'utf8');
496
486
  assert.ok(content.includes('update-template'), 'Missing update-template mention in existing-project.en.md');
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "@eltonssouza/development-utility-kit",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "npx installer for the development-utility-kit harness",
5
5
  "bin": {
6
6
  "duk": "bin/cli.js"
7
7
  },
8
+ "scripts": {
9
+ "build:plugin": "node scripts/build-plugin.mjs",
10
+ "build:plugin:check": "node scripts/build-plugin.mjs --check",
11
+ "prepack": "node scripts/swap-readme.mjs pre",
12
+ "postpack": "node scripts/swap-readme.mjs post"
13
+ },
8
14
  "files": [
9
15
  "bin",
10
16
  "bin/lib",
@@ -1,131 +0,0 @@
1
- ---
2
- name: active-project
3
- description: Use to ACTIVATE/ADOPT a project to the `development-utility-kit` template in ONE shot — accepts the project path as the FIRST argument and runs `scripts/adopt-project.sh` directly without preview/checkpoint. Triggers when the user types `/active-project <path>` or says "active project at <path>", "activate project <path>", "ativar projeto", "adota o projeto X", "aplica o template no projeto Y", "ativar template em <path>". Same end-result as `update-template`, but path-driven and non-interactive — preferred for scripted batch adoptions. Supports `--dry-run`, `--force-type=<backend|frontend|fullstack>`, `--template=<path>`. Do NOT use to develop features (use run-sprint), scaffold empty projects (use scaffold), or update the current project's template from inside it (use update-template). PT triggers: 'ativar projeto', 'adota o projeto', 'aplica o template', 'ativa o template em', 'ativar projeto em', 'sincronizar template no projeto'.
4
- tools: Read, Write, Glob, Grep, Bash(bash:*), Bash(git:*)
5
- model: sonnet
6
- ---
7
-
8
- # Active Project — Adopt a project to the template (path-driven, non-interactive)
9
-
10
- Always reply in **Brazilian Portuguese**.
11
-
12
- ---
13
-
14
- ## 1. When it triggers
15
-
16
- Exact invocations:
17
- - `/active-project /path/to/project`
18
- - `/active-project /path/to/project --dry-run`
19
- - `/active-project /path/to/project --force-type=fullstack`
20
- - `/active-project /path/to/project --template=/alt/template`
21
-
22
- Natural-language equivalents:
23
- - "ativar projeto em `/path`"
24
- - "adota o projeto em `/path` com template fullstack"
25
- - "aplica o template no projeto X em modo dry-run"
26
-
27
- If the user asks **without a path**, ask for it before running anything.
28
-
29
- ---
30
-
31
- ## 2. What it does
32
-
33
- Single-shot wrapper around `scripts/adopt-project.sh`:
34
-
35
- 1. Detects project type (`backend | frontend | fullstack` + stack `angular | vite-vanilla`) from `backend/pom.xml`, `frontend/angular.json`, `frontend/vite.config.*`.
36
- 2. Backs up the existing `.claude/` to `.claude.backup-YYYYMMDD-HHMMSS/`.
37
- 3. Copies the template `.claude/` into the project, preserving local files outside the template.
38
- 4. Copies the template `CLAUDE.md` and appends the **"Identidade deste projeto"** block (project name, type, stack, adoption date).
39
- 5. Copies `.claude-version.json` and flags as outdated when versions diverge.
40
- 6. Reports backup paths, detected type, and any `[WARN]`/`[ERROR]` from the script.
41
-
42
- This is the **fast path** of `update-template`: no preview, no checkpoint, no confirmation.
43
-
44
- ---
45
-
46
- ## 3. Difference from `update-template`
47
-
48
- | | `active-project` (this) | `update-template` |
49
- |---|---|---|
50
- | Path | First positional ARG | Current working directory |
51
- | Preview/checkpoint | NO (direct execution) | YES (interactive) |
52
- | Best for | Scripts, batch adoptions | Manual flow inside Claude Code with confirmation |
53
- | Idempotent | YES (same as adopt-project.sh) | YES |
54
-
55
- Both ultimately call `scripts/adopt-project.sh` — they share the engine.
56
-
57
- ---
58
-
59
- ## 4. Procedure
60
-
61
- 1. **Parse the user message** to extract:
62
- - PROJECT_PATH (first non-flag argument; absolute path expected)
63
- - FLAGS (`--dry-run`, `--force-type=<tipo>`, `--template=<path>`)
64
- 2. **Validate** that PROJECT_PATH exists:
65
- ```bash
66
- [ -d "<PROJECT_PATH>" ] || echo "[ERROR] Pasta nao existe: <PROJECT_PATH>"
67
- ```
68
- If it does not exist, STOP and tell the user.
69
- 3. **Locate the template** (default: `C:\development\tools\development-utility-kit` on Windows, `~/workspace/tools/development-utility-kit` on Linux/Mac). Override with `--template` if provided.
70
- 4. **Run** via the `terminal` tool:
71
- ```bash
72
- bash <TEMPLATE>/scripts/adopt-project.sh "<PROJECT_PATH>" [FLAGS]
73
- ```
74
- 5. **Capture full stdout/stderr** and surface it to the user in **PT-BR**, including:
75
- - Detected (or forced) type
76
- - Backup paths created
77
- - `[OK]/[WARN]/[ERROR]` messages from the script
78
- - The final "Adoption/update finished" block
79
- - Whether the project was flagged as outdated (template/project version mismatch)
80
- 6. If the script reports `[WARN] Could not detect project type`, suggest re-running with `--force-type=<backend|frontend|fullstack>`.
81
-
82
- ---
83
-
84
- ## 5. Quick Reference
85
-
86
- | Case | Command |
87
- |---|---|
88
- | Adopt a fullstack project | `bash adopt-project.sh /path/to/project` |
89
- | Force the type (no code yet) | `bash adopt-project.sh /path --force-type=fullstack` |
90
- | Simulate without applying | `bash adopt-project.sh /path --dry-run` |
91
- | Alternative template | `bash adopt-project.sh /path --template=/other/template` |
92
-
93
- ---
94
-
95
- ## 6. Pitfalls
96
-
97
- - **Path does not exist** → script aborts with `[ERROR] Folder does not exist`. Validate before invoking.
98
- - **No `backend/` or `frontend/`** → script fails with `[WARN] Could not detect project type`. Use `--force-type=<tipo>` for projects without code yet.
99
- - **Path with spaces** → always wrap in quotes when building the command.
100
- - **Already adopted** → script silently creates a backup (`.claude.backup-*`). Mention this to the user.
101
- - **Output verbosity** → if the user requests "mostre tudo" / "literal output", echo the captured stdout verbatim (do NOT summarize).
102
-
103
- ---
104
-
105
- ## 7. Verification
106
-
107
- After applying (no `--dry-run`):
108
-
109
- 1. `<PROJECT_PATH>/.claude/agents`, `<PROJECT_PATH>/.claude/commands`, `<PROJECT_PATH>/.claude/skills` exist.
110
- 2. `<PROJECT_PATH>/CLAUDE.md` contains the block `## Identidade deste projeto`.
111
- 3. `<PROJECT_PATH>/.claude-version.json` matches the template's version (otherwise report as outdated).
112
- 4. The script printed `Adoption/update finished: <project-name>`.
113
-
114
- ---
115
-
116
- ## 8. Inviolable rules
117
-
118
- 1. NEVER infer or invent a `PROJECT_PATH` from context — if the user did not provide one, ASK.
119
- 2. NEVER execute without `--dry-run` if the user explicitly asked for a simulation.
120
- 3. ALWAYS surface `[WARN]`/`[ERROR]` lines verbatim — do not omit them in the summary.
121
- 4. ALWAYS report the backup paths so the user can recover.
122
- 5. If invoked non-interactively (e.g. from a script), prefer non-blocking mode (no interactive prompts).
123
-
124
- ---
125
-
126
- ## 9. References
127
-
128
- - Engine script: `scripts/adopt-project.sh`
129
- - Interactive sibling: [`update-template`](../update-template/SKILL.md)
130
- - Bootstrap (different purpose — creates new projects): [`scaffold`](../scaffold/SKILL.md)
131
- - Canonical project directory: `C:\development\source\projects\<name>\`