@icebreakers/monorepo-templates 2.1.0 → 2.2.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/assets/.agents/skills/repoctl/SKILL.md +2 -0
- package/assets/.agents/skills/repoctl/references/commands.md +224 -13
- package/assets/.agents/skills/repoctl/references/config.md +70 -6
- package/assets/.agents/skills/repoctl/references/dependencies.md +37 -0
- package/assets/.agents/skills/repoctl/references/knip.md +34 -0
- package/assets/.agents/skills/repoctl/references/templates.md +23 -0
- package/assets/.github/workflows/ci.yml +10 -10
- package/assets/package.json +5 -9
- package/assets/pnpm-workspace.yaml +2 -1
- package/assets/repoctl.config.ts +1 -1
- package/assets/turbo.json +2 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +281 -1
- package/dist/index.mjs +1137 -74
- package/dist/{prepare-2VvFwYDz.mjs → prepare-BYNSxvoB.mjs} +76 -4
- package/package.json +2 -1
- package/template-data.mjs +24 -0
- package/templates/client/package.json +1 -1
- package/templates/next/README.md +31 -0
- package/templates/next/eslint.config.js +5 -0
- package/templates/next/gitignore +7 -0
- package/templates/next/next.config.ts +5 -0
- package/templates/next/package.json +36 -0
- package/templates/next/src/app/api/health/route.ts +5 -0
- package/templates/next/src/app/counter.tsx +19 -0
- package/templates/next/src/app/favicon.ico +0 -0
- package/templates/next/src/app/globals.css +109 -0
- package/templates/next/src/app/layout.tsx +17 -0
- package/templates/next/src/app/page.tsx +16 -0
- package/templates/next/stylelint.config.js +3 -0
- package/templates/next/test/counter.test.tsx +22 -0
- package/templates/next/tsconfig.json +40 -0
- package/templates/next/turbo.json +24 -0
- package/templates/next/vitest.config.js +9 -0
- package/templates/react-lib/LICENSE +21 -0
- package/templates/react-lib/README.md +52 -0
- package/templates/react-lib/eslint.config.js +5 -0
- package/templates/react-lib/gitignore +4 -0
- package/templates/react-lib/package.json +48 -0
- package/templates/react-lib/src/counter.tsx +28 -0
- package/templates/react-lib/src/index.ts +2 -0
- package/templates/react-lib/src/style.css +36 -0
- package/templates/react-lib/stylelint.config.js +3 -0
- package/templates/react-lib/test/counter.test.tsx +28 -0
- package/templates/react-lib/test-d/index.test-d.ts +11 -0
- package/templates/react-lib/tsconfig.app.json +15 -0
- package/templates/react-lib/tsconfig.build.json +12 -0
- package/templates/react-lib/tsconfig.json +4 -0
- package/templates/react-lib/tsconfig.node.json +11 -0
- package/templates/react-lib/vite.config.ts +22 -0
- package/templates/react-lib/vitest.config.ts +5 -0
- package/templates/react-vite/README.md +27 -0
- package/templates/react-vite/eslint.config.js +5 -0
- package/templates/react-vite/gitignore +6 -0
- package/templates/react-vite/index.html +13 -0
- package/templates/react-vite/package.json +36 -0
- package/templates/react-vite/src/app.tsx +22 -0
- package/templates/react-vite/src/main.tsx +15 -0
- package/templates/react-vite/src/style.css +95 -0
- package/templates/react-vite/stylelint.config.js +3 -0
- package/templates/react-vite/test/app.test.tsx +22 -0
- package/templates/react-vite/tsconfig.app.json +26 -0
- package/templates/react-vite/tsconfig.json +11 -0
- package/templates/react-vite/tsconfig.node.json +18 -0
- package/templates/react-vite/vite.config.ts +6 -0
- package/templates/react-vite/vitest.config.ts +9 -0
- package/templates/vitepress/.vitepress/navigation/routes.ts +7 -0
- package/templates/vitepress/reference/artifacts.md +51 -0
- package/templates/vitepress/reference/commands.md +149 -0
- package/templates/vitepress/reference/config.md +101 -7
- package/templates/vitepress/reference/dependencies.md +116 -0
- package/templates/vitepress/reference/dependency-admission.md +67 -0
- package/templates/vitepress/reference/devcontainer.md +25 -0
- package/templates/vitepress/reference/index.md +1 -0
- package/templates/vitepress/reference/install-security.md +51 -0
- package/templates/vitepress/reference/knip.md +55 -0
- package/templates/vitepress/reference/move.md +39 -0
- package/templates/vitepress/reference/organization-presets.md +89 -0
- package/templates/vitepress/reference/removal.md +42 -0
- package/templates/vitepress/reference/template-assets.md +39 -0
- package/templates/vitepress/reference/templates.md +372 -9
- package/templates/vitepress/start/diagnose.md +19 -2
- package/templates/vitepress/tasks/checks.md +149 -1
- package/templates/vitepress/tasks/ci.md +93 -1
- package/templates/vitepress/tasks/release.md +78 -8
- package/templates/vitepress/zh/reference/artifacts.md +51 -0
- package/templates/vitepress/zh/reference/commands.md +148 -0
- package/templates/vitepress/zh/reference/config.md +94 -2
- package/templates/vitepress/zh/reference/dependencies.md +116 -0
- package/templates/vitepress/zh/reference/dependency-admission.md +67 -0
- package/templates/vitepress/zh/reference/devcontainer.md +25 -0
- package/templates/vitepress/zh/reference/index.md +1 -0
- package/templates/vitepress/zh/reference/install-security.md +51 -0
- package/templates/vitepress/zh/reference/knip.md +55 -0
- package/templates/vitepress/zh/reference/move.md +39 -0
- package/templates/vitepress/zh/reference/organization-presets.md +89 -0
- package/templates/vitepress/zh/reference/removal.md +42 -0
- package/templates/vitepress/zh/reference/template-assets.md +19 -4
- package/templates/vitepress/zh/reference/templates.md +352 -9
- package/templates/vitepress/zh/start/diagnose.md +24 -13
- package/templates/vitepress/zh/tasks/checks.md +150 -0
- package/templates/vitepress/zh/tasks/ci.md +93 -1
- package/templates/vitepress/zh/tasks/release.md +78 -8
- package/templates/vue-lib/package.json +1 -1
|
@@ -29,6 +29,7 @@ pnpm exec repo doctor
|
|
|
29
29
|
| User intent | `--templates` key |
|
|
30
30
|
| ------------------------ | ------------------ |
|
|
31
31
|
| Vue / full-stack web app | `vue-hono` |
|
|
32
|
+
| React SSR / App Router | `next` |
|
|
32
33
|
| API / Hono service | `hono-server` |
|
|
33
34
|
| TypeScript library / SDK | `tsdown` |
|
|
34
35
|
| Vue component library | `vue-lib` |
|
|
@@ -66,3 +67,4 @@ pnpm exec repo check
|
|
|
66
67
|
- `references/templates.md` for template keys and `repo new` flags.
|
|
67
68
|
- `references/commands.md` for other CLI commands.
|
|
68
69
|
- `references/config.md` for `repoctl.config.ts`.
|
|
70
|
+
- `references/knip.md` for explicit unused-code checks and reviewed baselines.
|
|
@@ -28,20 +28,44 @@ Usage:
|
|
|
28
28
|
|
|
29
29
|
## check
|
|
30
30
|
|
|
31
|
+
Explicit unused-code/dependency analysis is available through `repo check knip`.
|
|
32
|
+
See [Optional Knip checks](./knip.md) before enabling native analysis or saving a baseline.
|
|
33
|
+
|
|
31
34
|
Purpose: run recommended local checks.
|
|
32
35
|
Usage:
|
|
33
36
|
|
|
34
37
|
- npx repoctl check
|
|
35
38
|
- npx repoctl check --staged
|
|
36
39
|
- npx repoctl check --full
|
|
40
|
+
- npx repoctl check --affected --base origin/main --head HEAD --json
|
|
41
|
+
- npx repoctl check --affected --filter @acme/web --report reports/affected.json
|
|
37
42
|
- npx repoctl check --dry-run
|
|
38
43
|
- npx repoctl check --json --out reports/check-plan.json
|
|
44
|
+
- npx repoctl check --full --report reports/check-result.json --redact
|
|
45
|
+
- npx repoctl check --full --report reports/check-result.md --report-format markdown
|
|
39
46
|
Notes:
|
|
40
47
|
- default mode runs the lightweight local verification flow
|
|
48
|
+
- `--affected` selects changed packages and consumers, using merge-base plus the current working tree.
|
|
49
|
+
Missing history, manifest/global input changes and unresolved graph diagnostics explicitly fall back
|
|
50
|
+
to full checks. `--filter` intersects exact names/directories; `--global-input` adds globs.
|
|
51
|
+
Both flags are repeatable. Execution uses build, lint, typecheck, tsd, test order; build includes
|
|
52
|
+
dependency prerequisites and pnpm controls package ordering. Plans explain files, paths and skips.
|
|
53
|
+
Existing preview flags remain read-only; reports embed the same model as `affectedPlan`.
|
|
54
|
+
Affected mode cannot combine with full, staged or edit-file. Root scripts implement full fallback
|
|
55
|
+
where available; explicit filters limit fallback checks too. See tasks/checks for global input rules.
|
|
41
56
|
- `--staged` adds staged typecheck routing
|
|
42
|
-
- `--full`
|
|
57
|
+
- `--full` runs the existing root lint, typecheck, test and build scripts
|
|
43
58
|
- `--dry-run` previews the verification route without running checks
|
|
44
59
|
- `--json` and `--out <file>` emit the same plan for automation and imply dry-run
|
|
60
|
+
- `--report <file>` executes checks and writes versioned results separately from live logs;
|
|
61
|
+
`--report-format` accepts `json` (default) or `markdown`. It cannot be combined with preview flags.
|
|
62
|
+
- Reports preserve failures, skipped tasks and graceful signal interruptions, with timestamps,
|
|
63
|
+
duration, exit code and actual command arguments. `--redact` replaces cwd/home prefixes.
|
|
64
|
+
Environment values and child output are not persisted. Abrupt termination cannot guarantee a report.
|
|
65
|
+
|
|
66
|
+
## check cache
|
|
67
|
+
|
|
68
|
+
`repo check cache <current-summary.json> [previous-summary.json] --json` analyzes existing Turbo run summaries without running tasks or mutating caches. Use `--markdown` and redirect stdout for a CI artifact; `--slowest` accepts 1–100. Schema 1 compares stable task IDs and digested input/global/dependency/environment/configuration evidence. Missing evidence or unsupported schemas remain unknown; cache misses are not assigned a speculative cause. Actual durations and a verifiable dependency critical path are reported separately from observed wall span. Environment values and commands never appear in output. Parent execution and file-output flags are rejected; regular check JSON remains preview-only.
|
|
45
69
|
|
|
46
70
|
## doctor
|
|
47
71
|
|
|
@@ -56,8 +80,35 @@ Usage:
|
|
|
56
80
|
- `--json` emits the structured report only and still exits non-zero when blocking failures exist
|
|
57
81
|
- `--out <file>` persists the text or JSON report and still exits non-zero when blocking failures exist
|
|
58
82
|
|
|
83
|
+
```bash
|
|
84
|
+
repo doctor --list-rules
|
|
85
|
+
repo doctor --rules root-scripts,package-manager --strict
|
|
86
|
+
repo doctor --rules root-scripts --fix --out plans/doctor-fix.json
|
|
87
|
+
repo doctor --apply plans/doctor-fix.json --json
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`--rules` selects exact stable check IDs before execution; unknown IDs fail and list the available rules. The CLI replaces `commands.doctor.rules`; omitted rules run all checks, while an explicit empty config array runs none. Shared discovery and rule prerequisites still run. `manifest-health` is an aggregate over the static manifest checks. Workspace boundaries and dependency admission use stable `boundary-*` / `admission-*` IDs; selecting only `boundary-policy` or `admission-policy` preserves the actual aggregate failure status, and prerequisite configuration failures remain visible. Custom policy names appear only in diagnostic details.
|
|
91
|
+
|
|
92
|
+
Configure reasoned waivers under `commands.doctor.suppressions`. Each item needs `id` and a nonempty `reason`; optional `path` matches an exact workspace-relative finding path. Optional `expires` is an inclusive UTC date (`YYYY-MM-DD`). JSON retains the original finding status, `suppression`, `rawSummary`, and every waiver with its matched count. Only active waivers are excluded from effective `summary` and strict exit status; expired and unmatched waivers remain visible.
|
|
93
|
+
|
|
94
|
+
`repo templates drift --json` diagnoses registered instance and trustworthy root asset baselines without modifying them. Versions, local modifications/deletions and missing evidence are independent. Defaults use installed metadata offline; `--source-dir` reads an extracted package, and explicit `--remote` queries public npm. Remote failures remain unknown. `--markdown --out <file>` writes a report without business file bodies. Persistent exclusions are not read, and unowned additions are ignored. Reuse doctor suppressions; `--strict` fails on remaining warnings. Select `template-version-evidence`, `template-instance-registry`, `template-instance-baseline`, `template-instance-version`, `template-instance-drift`, `root-asset-registry`, `root-asset-version` or `root-asset-drift` with doctor rules.
|
|
95
|
+
|
|
96
|
+
`--fix` previews JSON without modifying project files. Only missing `repo:init`, `repo:new`, `repo:check`, and `repo:doctor` keys in the root `package.json` are supported. Existing values, including empty/custom scripts, are preserved for manual review. An actively suppressed or unselected rule produces no fix. Review the additions, complete before/after content, hashes, risk, and diff before using `--apply`. Plans contain original manifest content and cannot be redacted or rendered as Markdown for execution.
|
|
97
|
+
|
|
98
|
+
Apply checks the canonical workspace and original file contents, rejects links and modified operations, reuses the staged file transaction with rollback, and reruns the root-script check without suppression. A changed input stops the fix; regenerate the plan. Reapplying an already applied plan is unchanged. Textual `fix` suggestions are never executed, and dependency installation or release workflow modification is outside this fixer.
|
|
99
|
+
|
|
100
|
+
Doctor fix application holds `.repoctl/doctor-fix.lock` through validation, verification, rollback and cleanup. After a crash, confirm no writer remains and reconcile backups before manually removing the lock.
|
|
101
|
+
|
|
59
102
|
## upgrade
|
|
60
103
|
|
|
104
|
+
Preview the complete operation with `repo upgrade --dry-run`, `--json` or `--markdown`; these modes never write or prepare missing assets. Save JSON and review every add/modify/delete/skip/conflict before `repo upgrade --apply <plan.json>`. Plans contain exact bytes and input hashes, including semantic merges and legacy prerelease metadata migration. Application rejects stale inputs, keeps migration groups together and rolls back recoverable failures. Retained `.repoctl-upgrade-*.bak` originals support manual recovery after interruption or a concurrent edit. `--no-overwrite` protects existing assets and legacy metadata; custom release workflows still require `--overwrite-release`. Public APIs: `planUpgrade`, `formatUpgradePlan`, `applyUpgradePlan`, and `upgradeMonorepo({ dryRun: true })`.
|
|
105
|
+
|
|
106
|
+
Root assets use old-upstream/local/new-upstream three-way merging. Commit `.repoctl/baselines/root/` to preserve the upstream records across clones; record updates are reviewed in each file's `baseline` plan entry and applied atomically with that file. Independent changes merge automatically, while conflicting files and their baselines stay unchanged. Local deletion is never undone. API results expose unresolved `conflicts`; CLI preview and apply exit with code 1 when conflicts remain. Saved plans are reviewed write payloads; their hashes detect stale inputs and inconsistent content, not authorship. Generated app/package directories are outside this feature.
|
|
107
|
+
|
|
108
|
+
Upgrade apply holds `.repoctl/upgrade.lock` through validation, no-op detection, writes, rollback and cleanup. It never removes colliding recovery files, changed recovery bytes or replacement directories. After an interruption, confirm no writer is active and recover retained backups before removing the lock and regenerating the plan.
|
|
109
|
+
|
|
110
|
+
Versioned migrations appear in `migrations` with stable IDs and affected files. The Changesets-to-pnpm migration starts at template 1.1.0. Use `--from-version <exact-semver>` only when the old version is known; dependency ranges are not version evidence. Unknown sources adopt only recognized legacy formats. Commit `.repoctl/migrations/ledger.json` when created; its cursor covers migrations, not all assets. Preview writes nothing. Pending/failed bytes and completed diffs are reviewed together; migration groups cannot be split, and completed is written only at the end of a successful migration transaction. Re-preview pending/failed attempts to see already-applied versus remaining files; third-state local edits block recovery and retain attempt-specific backups. The shared `.repoctl/upgrade.lock` is never stolen by age; confirm no writer is active and recover pending backups before clearing it. Recovery performs no network/publish actions or historical script execution.
|
|
111
|
+
|
|
61
112
|
Purpose: sync repo assets and scripts into the workspace.
|
|
62
113
|
Usage:
|
|
63
114
|
|
|
@@ -69,12 +120,29 @@ Usage:
|
|
|
69
120
|
- --core: sync core config only (skip GitHub assets)
|
|
70
121
|
- --outDir <dir>: write to another directory
|
|
71
122
|
- --skip-overwrite: never overwrite existing files
|
|
123
|
+
- --overwrite: explicitly replace differing managed assets and adopt the new upstream baseline
|
|
72
124
|
- --overwrite-release: explicitly replace an unmarked custom release workflow
|
|
73
125
|
|
|
74
|
-
For the first migration of an existing project,
|
|
75
|
-
`pnpm dlx repoctl@latest upgrade --
|
|
76
|
-
|
|
77
|
-
|
|
126
|
+
For the first migration of an existing project, preview with
|
|
127
|
+
`pnpm dlx repoctl@latest upgrade --json`. A differing asset without a historical
|
|
128
|
+
baseline remains a `baseline-missing` conflict, including a legacy release
|
|
129
|
+
workflow. Review an explicit `--overwrite --json` plan before applying it;
|
|
130
|
+
`--yes` alone does not resolve conflicts. Unmarked custom release workflows
|
|
131
|
+
remain protected unless `--overwrite-release` is supplied.
|
|
132
|
+
|
|
133
|
+
## release plan and branch mapping
|
|
134
|
+
|
|
135
|
+
Use `repo release plan --branch 1.x --json` to inspect native versions before consuming intents.
|
|
136
|
+
`commands.release.branches` maps a primary `stable` branch (default `main`), bounded non-overlapping
|
|
137
|
+
`maintenance: [{ branch, range, tag }]`, and optional `prerelease: [{ branch, lane, tag, target }]`.
|
|
138
|
+
Stable and maintenance use pnpm's `main` lane; `branchRule` reports the Git branch, native lane,
|
|
139
|
+
allowed range, maintenance exclusions, npm dist-tag and target. Private versions are not publication
|
|
140
|
+
candidates. Maintenance ranges apply to every public package; latest excludes those ranges.
|
|
141
|
+
Names and tags must be unique; use `legacy-1`, not a SemVer-like npm tag. `snapshot-` is reserved.
|
|
142
|
+
Preview/apply `repo upgrade` after configuration changes to synchronize managed workflow branches.
|
|
143
|
+
Preparation, PR base, publish tag and original-source recovery all use the selected rule. Recovery
|
|
144
|
+
SHA must belong to `origin/<selected-branch>`. `pre exit` returns the target lane and reports the
|
|
145
|
+
stable/maintenance branch without switching Git branches.
|
|
78
146
|
|
|
79
147
|
## release ci
|
|
80
148
|
|
|
@@ -127,6 +195,43 @@ Usage:
|
|
|
127
195
|
- --include-root: include the workspace root package
|
|
128
196
|
- --pattern <glob>: add custom workspace globs; repeatable
|
|
129
197
|
|
|
198
|
+
## workspace graph / why / impact
|
|
199
|
+
|
|
200
|
+
Purpose: inspect read-only manifest dependency relationships using one stable graph model.
|
|
201
|
+
Usage:
|
|
202
|
+
|
|
203
|
+
- npx repoctl workspace graph --json --redact
|
|
204
|
+
- npx repoctl workspace graph --mermaid
|
|
205
|
+
- npx repoctl workspace graph --package @acme/shared --type dependencies
|
|
206
|
+
- npx repoctl workspace why @acme/web @acme/shared --json
|
|
207
|
+
- npx repoctl workspace impact @acme/shared --direct --json
|
|
208
|
+
|
|
209
|
+
Private packages are included by default; use `--exclude-private` or `--include-root` to adjust discovery.
|
|
210
|
+
`--type` can be repeated with dependencies, devDependencies, peerDependencies or optionalDependencies.
|
|
211
|
+
Graph package filters retain the selected nodes and their direct incoming/outgoing relationships.
|
|
212
|
+
Why returns one deterministic shortest path; impact returns reverse reachability and minimum distances.
|
|
213
|
+
Names must be unambiguous; `./packages/name` explicitly selects a directory. Cycles are safe.
|
|
214
|
+
Workspace aliases/ranges and local paths resolve internally; ordinary semver/npm aliases only connect
|
|
215
|
+
when the local version matches. This does not resolve lockfiles, catalogs, registry tags or source imports.
|
|
216
|
+
Edges distinguish workspace/local references from semver candidates through `resolution`.
|
|
217
|
+
Catalogs and unsupported specifiers with local candidates retain `unresolved_specifier` diagnostics;
|
|
218
|
+
inspect diagnostics before treating the graph as complete or computing affected checks.
|
|
219
|
+
JSON has schema version 1, stable directory IDs and unresolved/ambiguous reference diagnostics.
|
|
220
|
+
Mermaid uses the same graph. Queries do not write files; JSON and Mermaid flags are mutually exclusive.
|
|
221
|
+
|
|
222
|
+
## deps catalog check / plan / apply
|
|
223
|
+
|
|
224
|
+
Inspect default/named catalog references, missing or unused entries, direct-version bypasses,
|
|
225
|
+
and migration candidates with `repo deps catalog check --json`. Integrity checks cover all catalogs;
|
|
226
|
+
`--catalog <name>` selects the policy for direct declarations and migration candidates.
|
|
227
|
+
|
|
228
|
+
Preview one dependency section/cohort with
|
|
229
|
+
`repo deps catalog plan <dependency> --section devDependencies --json > catalog-plan.json`,
|
|
230
|
+
review the linked YAML/manifest changes, then run `repo deps catalog apply catalog-plan.json`.
|
|
231
|
+
`--catalog`, `--group` and `--to` choose a named catalog, configured cohort and explicit common
|
|
232
|
+
subrange. Planning never writes; apply rejects stale inputs and preserves peer ranges.
|
|
233
|
+
See [dependency governance](./dependencies.md) for migration boundaries and pnpm verification.
|
|
234
|
+
|
|
130
235
|
## tooling init (alias: tg init)
|
|
131
236
|
|
|
132
237
|
Purpose: generate tooling config files plus matching devDependencies.
|
|
@@ -142,17 +247,55 @@ Usage:
|
|
|
142
247
|
- Built-in tooling targets: commitlint, eslint, stylelint, lint-staged, tsconfig, vitest
|
|
143
248
|
- Generated files also update root package.json devDependencies
|
|
144
249
|
|
|
250
|
+
## tooling devcontainer
|
|
251
|
+
|
|
252
|
+
Preview an optional root Dev Container with `repo tooling devcontainer --json --out ../plan.json`, review it, then apply with `repo tooling devcontainer --apply ../plan.json`. Preview and application never start Docker or install dependencies. Existing custom configuration blocks application and stays unchanged; a fully applied plan replays without writes. Root engines.node and an exact pnpm packageManager are required. `--node-version` selects an exact compatible Node image version. Start the container explicitly with the Dev Containers extension or CLI. Its setup enables Corepack, checks the exact pnpm version and installs with a frozen lockfile when present. The non-root node user and an external pnpm store volume are configured; customize forwardPorts for the app. Do not add a business package for this preset.
|
|
253
|
+
|
|
254
|
+
## workspace move
|
|
255
|
+
|
|
256
|
+
Use `workspace move <exact-name-or-./directory> --to <relative-directory> --name <npm-name> --json` to preview moving, renaming, or both; either option may be omitted. Save the plan outside the target and review consumers, before/after files, blockers and file/line manual tasks. It updates manifest dependencies/aliases/metadata, workspace patterns and explicit supported TypeScript paths while preserving source code. Git-tracked text scanning is bounded, not complete import analysis; resolve manual source/configuration tasks before building. Dirty targets/updated files, existing destinations, duplicate names, symlinks in ancestry, nested workspaces/repos and stale inputs are blocked. Apply only the saved plan with `workspace move --apply <plan.json>`. Failures preserve concurrent edits and report retained recovery files; committed cleanup failures return `cleanupPending`. Run explicit lockfile-only/frozen pnpm installs and affected checks afterward. Published-package renames create a new npm identity; never publish or deprecate as a side effect.
|
|
257
|
+
|
|
258
|
+
## workspace remove
|
|
259
|
+
|
|
260
|
+
For removal of one specific existing package, prefer `workspace remove <exact-name-or-./directory> --json`. It always previews, including root/private/transitive consumers. Save the JSON outside the selected directory. Consumers block by default; `--remove-references` plans only exact manifest dependency fields and matching metadata. Review source/configuration candidates manually: the scan covers only Git-tracked text literal matches and is not an exhaustive import analysis. Git HEAD and a clean selected directory are required; ignored files are inventoried. Root/outside/linked/nested-workspace boundaries and uncertain dependency relationships cannot be forced. Apply only a reviewed plan with `workspace remove --apply <plan.json>`. The `.repoctl/workspace-remove.lock` serializes replay checks through verification, rollback and cleanup; after interruption, verify no writer is active and recover retained originals before removing it. Before commit, failures restore manifests and the directory when safe, preserving concurrent edits and reporting recovery paths; after commit, `cleanupPending` reports retained operation files. Run `pnpm install --lockfile-only`, `pnpm install --frozen-lockfile`, workspace checks, and review Git diff explicitly afterward. Do not hand-edit the lockfile or remove user documentation/global skills.
|
|
261
|
+
|
|
145
262
|
## workspace clean (alias: ws clean)
|
|
146
263
|
|
|
147
|
-
|
|
148
|
-
|
|
264
|
+
Remove explicitly selected workspace package directories. Nothing is preselected.
|
|
265
|
+
Empty selection or cancelling the prompt changes no files. Repository docs,
|
|
266
|
+
`.qoder`, and global agent skills are not added to the selection or removed as
|
|
267
|
+
cleanup side effects.
|
|
268
|
+
Clean configuration is read from the workspace root, including when invoked from
|
|
269
|
+
a package subdirectory.
|
|
149
270
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
271
|
+
See also `deps check`, `deps plan` and `deps apply` in [Dependency consistency](./dependencies.md) for version policy and reviewed manifest changes.
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
pnpm exec repo workspace clean --dry-run
|
|
275
|
+
pnpm exec repo workspace clean --yes --dry-run
|
|
276
|
+
pnpm exec repo workspace clean --yes
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
- `--yes` selects all eligible packages after `ignorePackages` and private-package filtering.
|
|
280
|
+
- `--dry-run` prints a JSON plan with `deletions` and every root `package.json`
|
|
281
|
+
dependency change; it does not write a report file or modify the workspace.
|
|
282
|
+
- `--include-private` overrides `commands.clean.includePrivate: false`.
|
|
283
|
+
Private packages are included by default for compatibility.
|
|
284
|
+
- `--pinned-version <version>` explicitly replaces `devDependencies.repoctl`.
|
|
285
|
+
Otherwise its current range is retained; when absent, `latest` is used.
|
|
286
|
+
|
|
287
|
+
Only a nonempty selection may also remove the legacy
|
|
288
|
+
`devDependencies.@icebreakers/monorepo` entry and ensure `devDependencies.repoctl`.
|
|
289
|
+
An already-correct manifest is not rewritten. All targets are validated before
|
|
290
|
+
execution: workspace root/outside paths, symbolic-link targets or parent paths,
|
|
291
|
+
linked root manifests, and unselected nested workspaces are rejected. Dependency
|
|
292
|
+
references from consuming packages are not rewritten by this command.
|
|
293
|
+
|
|
294
|
+
## env check
|
|
295
|
+
|
|
296
|
+
Use `repo env check [tasks...]` to compare static source/example variable names with Turbo hash, passthrough and inferred declarations. Default task: `build`; private packages are included. `--json` and `--markdown` show source locations without values or snippets; `--strict` fails warnings and `--no-framework-inference` disables dependency-based prefix assumptions. The command is always read-only and does not run tasks or load actual dotenv values.
|
|
297
|
+
|
|
298
|
+
Root/package JSONC configuration, array replacement, `$TURBO_EXTENDS$`, wildcard exclusions and environment-file input coverage are resolved explicitly. Configure `commands.env` task/include/exclude options and reasoned `suppressions` with rule/package/task/variable/path selectors. Dynamic reads and unsupported source syntax remain visible; unused exceptions warn. Static task reachability, aliases, shadowed globals, template expressions, generated code and cross-package source imports are not resolved. Never suggest placing every discovered variable in `globalEnv`; review task-local hash declarations and intentional passthrough separately.
|
|
156
299
|
|
|
157
300
|
## env info (alias: e i)
|
|
158
301
|
|
|
@@ -242,3 +385,71 @@ Usage:
|
|
|
242
385
|
`--dry-run` and does not write files.
|
|
243
386
|
- Add `--out <file>` to write the preview or JSON plan to disk. It also implies
|
|
244
387
|
`--dry-run`.
|
|
388
|
+
|
|
389
|
+
## Affected CI matrix
|
|
390
|
+
|
|
391
|
+
`repo check --affected --matrix` previews a versioned GitHub Actions matrix without running checks. `--shards N` deterministically groups workspaces into at most 1–256 jobs. Reuse base/head, filters and global inputs from affected mode. Pass only `matrix` to Actions `fromJSON`, gate strategy expansion with `hasWork`, and execute each row's non-skipped executable/args arrays in order from the checkout root. Each job builds dependencies itself. Full fallbacks stay in one job and retain diagnostics. No workflow is changed or triggered; only explicit `--out` writes a report.
|
|
392
|
+
|
|
393
|
+
### Public API baselines
|
|
394
|
+
|
|
395
|
+
Use `repoctl package api check --json` after building opted-in `tooling.apiReports` library declarations. Local API Extractor >=7.52.12 <8 is required. `package api update --json` produces a read-only plan; explicitly review it before `package api update --apply <plan.json>`. Preserve existing baselines on check, report failures, review change intents, and never claim API signature differences determine complete SemVer compatibility. Baseline paths are workspace-relative; entries/tsconfig are package-relative.
|
|
396
|
+
|
|
397
|
+
### Installation security
|
|
398
|
+
|
|
399
|
+
Use `repo doctor security --json` for a read-only, version-aware pnpm policy report. `--expectations policy.json --strict` checks organization requirements. `--preset balanced` previews only absent supported keys; save the JSON and explicitly use `--apply plan.json` after review. Preserve explicit policies, including release age zero and build approvals. Do not run lifecycle scripts or approve dependencies as part of inspection. Unknown versions/configuration are reported, not treated as safe.
|
|
400
|
+
|
|
401
|
+
## `repo tooling references`
|
|
402
|
+
|
|
403
|
+
`check --json` checks existing references without opt-in. `plan` and `sync --dry-run` preview deterministic JSON without writes. With `tooling.projectReferences.enabled: true`, use `sync` or `apply <plan.json>` to maintain only registered references. Existing manual references and TypeScript/Vue validation scripts are preserved; incompatible compiler options, cycles, missing targets and stale plans block application. See [configuration](./config.md#typescript-project-references) for discovery, explicit compilation relationships, ownership and recovery.
|
|
404
|
+
|
|
405
|
+
### Incremental Playwright capability
|
|
406
|
+
|
|
407
|
+
Add browser tests to an existing Vue/React Vite application with `build` and `preview` scripts:
|
|
408
|
+
|
|
409
|
+
```sh
|
|
410
|
+
repo tooling capability list --json
|
|
411
|
+
repo tooling capability plan playwright --target web --route / --role button --name Increment --expect-text 'Count: 1' --json > e2e-plan.json
|
|
412
|
+
repo tooling capability apply e2e-plan.json --json
|
|
413
|
+
pnpm install
|
|
414
|
+
pnpm --filter @repoctl-e2e/web test:e2e:install
|
|
415
|
+
pnpm test:e2e
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Use `--test-id` instead of `--role`/`--name` for a test-id locator. The route, click and expected text describe a real interaction in your application. The plan shows file diffs, dependencies, scripts, conflicts and next steps, without installing anything. Apply uses those exact reviewed bytes, rejects stale inputs and conflicts, and rolls back failed writes. A repeated unchanged apply has no effect. Choose an empty destination (`--directory`) for the new E2E workspace. Existing application sources and differing generated files are protected.
|
|
419
|
+
|
|
420
|
+
The capability creates an independent E2E workspace, headless Chromium tests, Turbo build dependencies, a dedicated CI workflow, HTML reports and failure traces. Browser installation is explicit. `--port` and `--ci-port` set distinct local and CI ports. CI never reuses a running service. `--reuse-existing-server` opts into local reuse; Playwright cleans up its own service after success, failure or interruption, and leaves a borrowed service running. Commit the lockfile after installation.
|
|
421
|
+
|
|
422
|
+
Public APIs: `listToolingCapabilities()`, `planToolingCapability(cwd, options)` and `applyToolingCapability(plan)`. JSON uses schema version 1 and stable English keys regardless of CLI language.
|
|
423
|
+
|
|
424
|
+
### Optional Storybook for a component library
|
|
425
|
+
|
|
426
|
+
`repo tooling capability plan storybook --target <exact-workspace> --framework vue|react --component <named-export> --example example.json --json` previews a separate `stories/<slug>` workspace. Apply the reviewed JSON with `repo tooling capability apply plan.json`. The first version supports Vue 3 and React 18/19 libraries with a build script, public entry and an explicit runtime version range. Install dependencies after applying and commit the resulting lockfile. Discovery and planning do not install Storybook or a browser.
|
|
427
|
+
|
|
428
|
+
A Vue prop-update example is `{"kind":"prop-update","prop":"msg","initial":"Hello Storybook","updated":"Updated component"}`. For a React counter use `{"kind":"click","args":{"initialCount":0},"alternateArgs":{"initialCount":4},"click":{"role":"button","name":"Increase"},"expectText":"1"}`. Component props must be JSON primitives; interaction assertions exercise the selected component. `Default`, `Alternate` and `Interaction` stories provide two states and a play test.
|
|
429
|
+
|
|
430
|
+
Run `pnpm build:storybook` for the static site, then `pnpm --filter @repoctl-stories/<slug> test:storybook:install` and `pnpm test:storybook` for headless Chromium tests. Turbo builds library dependencies first and records `storybook-static/**`; play tests run without caching and write a JUnit report. Use the generated workspace's `storybook` script for local development. Its independent Vitest and Vite configurations leave the library's existing tests, package exports, runtime dependencies and tarball contents unchanged. Existing stories and configuration are preserved; differing generated files block application and require a new review. No hosted visual testing service is enabled.
|
|
431
|
+
|
|
432
|
+
## Maintenance
|
|
433
|
+
|
|
434
|
+
- `repo maintenance upgrade --base <full-sha> --head <full-sha> --out <external-empty-directory>` prepares a managed-asset report and validated patch in a disposable clean checkout when the locked root repoctl version or a directly configured, exactly pinned root preset changes. Existing preset baselines use three-way merging; newly declared files require explicit adoption. Unchanged bytes and unrelated updates produce no PR. Conflicts/failed checks block PR publication.
|
|
435
|
+
- `repo maintenance workflow --out .github/workflows/repoctl-upgrade.yml` exports an opt-in two-job recipe without overwriting files. Use only the trusted default branch; keep project execution in the read-only job and acquire the GitHub App write token only after immutable artifact, SHA, path, mode and hash verification. App permissions must include contents, pull requests and workflows write.
|
|
436
|
+
|
|
437
|
+
Maintenance report hashes describe exact Git blobs; planned working-file bytes are validated before staging. The isolated publisher verifies index bytes and Git-equivalent checkout contents across line-ending conversions, with hooks, executable filters and filesystem monitors disabled through PR creation. Preset reports carry exact raw preconditions and restricted checkout settings; the independent publisher uses Git built-in conversion to bind raw plans to committed and patched blobs while preserving fixed preset ownership. Preset before bytes use HEAD attributes; after bytes use the authorized patched attributes, including .gitattributes updates. Patch/report path mismatches are rejected before apply; final plan checks can still reject the isolated checkout before any write token is obtained.
|
|
438
|
+
|
|
439
|
+
Preset authorization is embedded as fixed package/source/target triples at workflow export from validated installed manifests. The publisher independently verifies committed exact dependencies and existing baseline identity/content hashes before acquiring credentials; report-supplied paths never grant ownership. Refresh a reviewed workflow after explicit new asset adoption. Inherited-only preset changes and provider transfers remain manual. Report schema 1 adds optional `presets`; original root `versions` and `plan` stay compatible.
|
|
440
|
+
|
|
441
|
+
Automatic maintenance can complete the built-in Changesets migration and update only its exact `.repoctl/migrations/ledger.json` metadata path. Preparation and publication share the same fixed migration identity, committed legacy-source, journal and completed-history checks; the target template version comes from the committed root repoctl → monorepo → templates lockfile dependency chain, not the repoctl version number. The publisher binds every migration output to the verified Git patch and checks public-package prerelease lanes against committed workspace membership. Interrupted journals, ambiguous lockfiles, noncanonical workspace patterns, and YAML/JSON5 workspace manifests require a reviewed manual `repo upgrade`; no broader `.repoctl` path is authorized. Refresh the trusted exported workflow to adopt this migration policy.
|
|
442
|
+
|
|
443
|
+
Automatic maintenance can complete the built-in Changesets migration and update only its exact `.repoctl/migrations/ledger.json` metadata path. Preparation and publication share the same fixed migration identity, committed legacy-source, journal and completed-history checks; the target template version comes from the committed root repoctl → monorepo → templates lockfile dependency chain, not the repoctl version number. The publisher binds every migration output to the verified Git patch and checks public-package prerelease lanes against committed workspace membership. Interrupted journals, ambiguous lockfiles, noncanonical workspace patterns, and YAML/JSON5 workspace manifests require a reviewed manual `repo upgrade`; no broader `.repoctl` path is authorized. Refresh the trusted exported workflow to adopt this migration policy.
|
|
444
|
+
|
|
445
|
+
## release snapshot
|
|
446
|
+
|
|
447
|
+
`repo release snapshot --kind pr --pr <number> --commit <full-HEAD-sha> --build-id <run-attempt> --dry-run --json` previews deterministic temporary versions. Use `--kind nightly` without `--pr` for nightly packages. Without dry-run, archive committed HEAD outside the repository, install frozen dependencies, build, pack and validate isolated consumers. `--output` chooses an external artifact parent. Every public package receives an exact snapshot version and internal references follow those versions. Source manifests/intents/ledger/changelogs/Git refs stay unchanged.
|
|
448
|
+
|
|
449
|
+
`--publish` requires `REPOCTL_SNAPSHOT_PUBLISH=1` in a trusted same-repository GitHub Actions event whose SHA matches HEAD: `pull_request` for PRs; `schedule` or `workflow_dispatch` for nightly. Fork and `pull_request_target` publication is rejected. Only snapshot tags are used; no GitHub Releases or Git tags are created. Repeat the same identity only for identical artifacts; metadata and tarball integrity are checked before skipping existing versions. Unknown registry state fails closed. Reports retain exact install instructions, artifact paths and validation errors.
|
|
450
|
+
|
|
451
|
+
## Build contexts and production directories
|
|
452
|
+
|
|
453
|
+
Preview `repo workspace prepare <exact-name-or-./directory> --mode prune|deploy --out ../empty-output --json`; save the plan outside the source workspace. Apply only after review with `repo workspace prepare --apply ../plan.json`. Prune uses local Turbo 2 and optional `--docker`; deploy uses exact pinned pnpm 10/11/12 with production dependencies, frozen lockfile, disabled lifecycle/pnpmfile hooks, optional `--offline`/explicit `--legacy`, and an existing built `--entry` or manifest main/single bin. Native version-specific injection and peer behavior remains authoritative. No application, image publishing or cloud deployment is executed.
|
|
454
|
+
|
|
455
|
+
Native commands receive an isolated copy without node_modules, Git/operation/cache directories, real env files or named authentication files. Public .env.example/.env.sample remain. Source symlinks/special files, source-directed native write settings and inventories above 100,000 entries/1 GiB are unsupported. Output must be outside the workspace; links must remain inside the artifact. Publish files exclusively and commit the receipt last. Replays verify source/tool/config fingerprints and complete output; failures preserve concurrent edits and report retained paths. Review cleanupPending and recover partial output before removing a stale .repoctl/workspace-artifacts.lock. Do not hand-edit lockfiles or overwrite nonempty output. On Windows, transfer junction contents with an appropriate copy/archive mode.
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Preferred filename: `repoctl.config.ts`
|
|
4
4
|
|
|
5
|
-
Compatible legacy filename: `monorepo.config.ts`
|
|
6
|
-
|
|
7
5
|
Rule:
|
|
8
6
|
|
|
9
|
-
- `repoctl.config
|
|
10
|
-
- `
|
|
11
|
-
-
|
|
7
|
+
- Load `repoctl.config.*`; rename legacy `monorepo.config.*`, which is no longer loaded.
|
|
8
|
+
- Validate repoctl-owned fields before command side effects with `repo config validate --json`.
|
|
9
|
+
- Native tooling passthrough and callbacks keep their extension boundary. Config modules are trusted executable project code.
|
|
10
|
+
- Use `repo config inspect --command ai --set 'format="json"' --json` for shared defaults/project/CLI provenance. Contexts: ai, clean, create, deps, doctor, init, mirror, release, upgrade. Runtime selection is explained by each command's plan.
|
|
11
|
+
- Reports redact env values and native tool payloads by default; `--redact` additionally hides local paths. For programmatic safe reports use `explainMonorepoConfig` or `validateConfigFile`; runtime config APIs retain callbacks and should not be serialized for sharing.
|
|
12
|
+
- Replace the old ignored `tooling.lintStaged.monorepoCommand` field with `repoCommand`.
|
|
13
|
+
- Organization presets use `presets: [{ packageName, version }]` with an exact installed dependency and JSON-only `repoctl.preset.json`. Loading never imports package code, installs or fetches. Parents precede declaring presets, then the project and CLI; arrays replace at preset boundaries. `config inspect` exposes ordered layers and precise package/version sources.
|
|
14
|
+
- `repo presets inspect --json` lists recommendations and owned assets. `repo presets plan --json --out new-plan.json` is read-only; `repo presets apply new-plan.json` explicitly applies reviewed assets with three-way merge and a shared root-upgrade lock. Existing files and other provider baselines cannot be adopted implicitly. Commit `.repoctl/baselines/presets` alongside managed files.
|
|
15
|
+
- Preset templates enter the unified catalog as fixed npm sources from the declaring package. `repo templates fetch <key>` prepares verified assets; previews and offline creation require that cache. Capability recommendations do not apply capabilities automatically.
|
|
12
16
|
|
|
13
17
|
Use `defineMonorepoConfig` to set default options for CLI commands.
|
|
14
18
|
Only include the fields you need.
|
|
@@ -33,6 +37,7 @@ export default defineMonorepoConfig({
|
|
|
33
37
|
},
|
|
34
38
|
clean: {
|
|
35
39
|
autoConfirm: false,
|
|
40
|
+
dryRun: false,
|
|
36
41
|
ignorePackages: ['docs'],
|
|
37
42
|
includePrivate: true,
|
|
38
43
|
pinnedVersion: 'latest',
|
|
@@ -61,7 +66,66 @@ Key areas:
|
|
|
61
66
|
|
|
62
67
|
- ai: default output, format, batch tasks
|
|
63
68
|
- create: default template and template directory
|
|
64
|
-
- clean:
|
|
69
|
+
- clean: explicit package selection, optional read-only dryRun, private/ignored package filtering, and an explicit pinnedVersion override; existing repoctl versions are retained otherwise
|
|
65
70
|
- upgrade: overwrite behavior and extra targets
|
|
66
71
|
- init: skip steps for README/package.json/pnpm change intent setup
|
|
67
72
|
- mirror: add or override env mirrors
|
|
73
|
+
|
|
74
|
+
## `commands.doctor`
|
|
75
|
+
|
|
76
|
+
Validate the schema of the whole configuration before executing selected doctor rules. Omitted `rules` selects every rule; explicit `rules: []` selects none. Valid but unsatisfied unselected policies do not contribute findings. `config inspect --command doctor` and doctor both consume workspace-root policy from package directories, with explicit CLI selection taking precedence.
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
export default defineMonorepoConfig({
|
|
80
|
+
commands: {
|
|
81
|
+
doctor: {
|
|
82
|
+
rules: ['root-scripts', 'commit-hooks'],
|
|
83
|
+
suppressions: [{
|
|
84
|
+
id: 'commit-hooks',
|
|
85
|
+
reason: 'CI validates commits while the hooks migration is scheduled',
|
|
86
|
+
expires: '2026-12-31',
|
|
87
|
+
}],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Configure reasoned waivers under `commands.doctor.suppressions`. Each item needs `id` and a nonempty `reason`; optional `path` matches an exact workspace-relative finding path. Optional `expires` is an inclusive UTC date (`YYYY-MM-DD`). JSON retains the original finding status, `suppression`, `rawSummary`, and every waiver with its matched count. Only active waivers are excluded from effective `summary` and strict exit status; expired and unmatched waivers remain visible.
|
|
94
|
+
|
|
95
|
+
## TypeScript project references
|
|
96
|
+
|
|
97
|
+
Check an existing reference graph without enabling writes:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
repo tooling references check --json
|
|
101
|
+
repo tooling references plan > references-plan.json
|
|
102
|
+
repo tooling references sync --dry-run
|
|
103
|
+
repo tooling references apply references-plan.json
|
|
104
|
+
repo tooling references sync
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`check` exits with 1 for diagnostics or pending managed changes. All commands emit versioned JSON. `check`, `plan` and `sync --dry-run` never write. `apply` and `sync` require explicit `tooling.projectReferences.enabled: true`:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
export default defineMonorepoConfig({
|
|
111
|
+
tooling: {
|
|
112
|
+
projectReferences: {
|
|
113
|
+
enabled: true,
|
|
114
|
+
root: 'tsconfig.json',
|
|
115
|
+
projects: ['packages/*/tsconfig.json', 'apps/*/tsconfig.build.json'],
|
|
116
|
+
exclude: ['packages/legacy/tsconfig.json'],
|
|
117
|
+
relations: [
|
|
118
|
+
{ source: 'packages/app/tsconfig.json', target: 'packages/shared/tsconfig.json' },
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
})
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The root solution and selected configs must already exist. Without `projects`, discovery selects `tsconfig.json` in each actual pnpm workspace package, including private packages; non-TS packages are skipped. Patterns are workspace-relative and can select multiple configs per package. Exclusions affect managed discovery, not existing manual references. Configs outside workspace packages are not automatically selected. The source workspace's references are never copied into generated projects.
|
|
126
|
+
|
|
127
|
+
The root aggregates selected projects. Only explicit `relations` add compilation dependencies between them: npm dependencies do not imply a TypeScript reference. TypeScript must be installed in the target workspace. Its compiler reads inherited settings and checks missing targets, reference cycles, `composite`, declaration output and `noEmit` compatibility before writes. repoctl never enables composite, changes compiler options, creates tsconfigs or replaces scripts. The plan lists validation commands, preserving each package's existing `typecheck` script (including `vue-tsc`); run them after synchronization to check actual source files. Planning validates configuration, not a full source compilation.
|
|
128
|
+
|
|
129
|
+
Existing references remain manually owned. Only newly added entries are recorded in `.repoctl/typescript-references.json`; commit that registry alongside the tsconfigs. Removing or excluding a project removes only entries recorded there. Editing/removing an owned entry blocks synchronization: restore it, or deliberately remove its registry entry to return ownership to the user. JSONC content outside the `references` value, BOM and line endings are preserved. Root aggregation and explicit edges produce stable relative config-file paths.
|
|
130
|
+
|
|
131
|
+
Saved plans include input fingerprints and exact diffs. Applying a stale or edited plan fails before writes; reapplying an already completed plan is a no-op. A process lock at `.repoctl/typescript-references.lock` covers revalidation, writing, verification, rollback and cleanup. Changes stage together with backups and roll back on failure. If concurrent edits prevent safe rollback, the error names retained recovery files: preserve them, reconcile the business edit with the original backup, restore the ownership registry consistently and generate a new plan. A killed process can also leave `.repoctl-references-*.bak`/`.tmp` files; verify no writer remains, reconcile matching backups and the registry, then remove the stale lock. No recovery action overwrites a concurrent edit automatically.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Dependency consistency
|
|
2
|
+
|
|
3
|
+
Use `repo deps check --json` to inventory root/private/workspace dependency declarations by name, dependency section and configured cohort. Reports distinguish identical, equivalent, compatible, conflicting, uncomparable, managed and exception groups with exact file locations. Catalog references are resolved for comparison; workspace references and unknown protocols remain report-only. npm aliases retain their actual source package. Peer and development declarations are independent.
|
|
4
|
+
|
|
5
|
+
Create a read-only preview with `repo deps plan <dependency> --section <section> --to <specifier> --json`. `deps fix` aliases `deps plan`; neither writes manifests. The target is explicit and must overlap the entire compatible cohort. No registry queries or automatic major upgrades occur. Save and review JSON, then use `repo deps apply <plan.json>`. pnpm lockfile updates and installation are explicit user steps: `pnpm install --lockfile-only`, then `pnpm install --frozen-lockfile`.
|
|
6
|
+
|
|
7
|
+
Configure `commands.deps.groups` at the workspace root. Each group has a unique `name`, exact workspace-relative `workspaces`, exact `dependencies`, a nonempty `reason`, optional `sections`, and optional `ignore: true` for report-only exceptions. Unmatched declarations use `default`; ambiguous overlapping selectors fail. Choose a cohort with `--group`.
|
|
8
|
+
|
|
9
|
+
Plans carry before/after specifiers and input/file hashes. Applying re-discovers the workspace, verifies every input, reconstructs the planned changes and rejects stale or modified plans before replacement. Repeated applications are no-ops. Multi-file replacements retain backups until completion and roll back failures. On interrupted or failed recovery, inspect the reported `.repoctl-deps-*.bak` backups before generating another plan. Do not overwrite unrelated concurrent edits.
|
|
10
|
+
|
|
11
|
+
Public APIs: `checkDependencies`, `planDependencyFix`, `applyDependencyFixPlan` from `repoctl`. JSON schema/status keys remain independent of locale.
|
|
12
|
+
|
|
13
|
+
## pnpm catalog inspection and migration
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm exec repo deps catalog check --json
|
|
17
|
+
pnpm exec repo deps catalog check --catalog legacy --json
|
|
18
|
+
pnpm exec repo deps catalog plan typescript --section devDependencies --json > catalog-plan.json
|
|
19
|
+
pnpm exec repo deps catalog plan react --section dependencies --group react18 --catalog react18 --to '^18.3.0' --json
|
|
20
|
+
pnpm exec repo deps catalog apply catalog-plan.json --json
|
|
21
|
+
pnpm install --lockfile-only
|
|
22
|
+
pnpm install --frozen-lockfile
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`catalog check` inspects every default and named catalog, root/private workspace consumer, missing catalog or entry, and unused entry. `catalog:` and `catalog:default` are equivalent. The default catalog may live at `catalog` or `catalogs.default`; declaring both is a pnpm configuration error. `--catalog` chooses the policy used to report direct-version bypasses and migration candidates; reference integrity is always checked across all catalogs. Direct peer ranges and explicit ignored version groups are exempt from bypass findings.
|
|
26
|
+
|
|
27
|
+
The versioned JSON includes exact manifest paths, dependency sections, package names, original specifiers, catalog entries, consumers and stable finding codes. `missing_catalog`, `missing_entry` and `direct_declaration` make check exit with code 1. `unused_entry` and `uncomparable_entry` are informational; an unused entry is never automatically deleted. Simple `overrides` consumers, including version-qualified package selectors, are counted. Nested override selectors are reported as `unresolved_selector`, with possibly referenced entries marked `usage_unknown` instead of claiming they are unused.
|
|
28
|
+
|
|
29
|
+
Migration reuses dependency consistency cohorts from `commands.deps.groups`; sections remain separate. Identical or semver-equivalent declarations can propose one entry automatically. Compatible but different ranges return `needs_target`: provide `--to` with a range that is a **subset of every selected declaration**, so migration cannot widen allowed versions or introduce a major upgrade. Mutually incompatible versions require explicit cohorts and separate named catalogs, or no migration. No registry is queried and no newest version is chosen.
|
|
30
|
+
|
|
31
|
+
Only plain semver ranges and same-source npm aliases can migrate. An alias keeps its complete `npm:source@range` in the catalog. Workspace/file/link/Git/URL/tag and unknown declarations stay unchanged. Direct `peerDependencies` are report-only and cannot be migrated by this command. Existing catalog references are preserved; a cohort mixing references to other catalogs requires explicit grouping. Existing entries are never overwritten, including when `--to` differs: choose a new named catalog or separately review an entry change affecting all its consumers.
|
|
32
|
+
|
|
33
|
+
`catalog plan` is always read-only, with or without `--dry-run`. Its JSON contains complete before/after YAML and consumer-manifest contents, file hashes, every discovered input hash and the normalized selection. Review the linked changes before `catalog apply`. YAML AST editing preserves unrelated configuration and comments; an edited catalog mapping shared through YAML anchors/aliases is rejected rather than changing unrelated alias consumers. Existing default/named catalog locations are retained. Lockfile generation remains a separate explicit pnpm action.
|
|
34
|
+
|
|
35
|
+
Apply is bound to the same workspace and full input set. Stale YAML, changed manifests/policies, new packages, linked files, partial application and modified plan contents are rejected before writes. It uses the same staged replacements, backups and rollback as dependency fixes, across both YAML and JSON. A fully applied plan and a repeated migration are no-ops. If recovery cannot safely replace a concurrent edit, inspect the listed `.repoctl-deps-*.bak` originals, restore reviewed files, remove stale temporary files and generate a fresh plan; the concurrent edit is preserved.
|
|
36
|
+
|
|
37
|
+
Public APIs are `checkCatalogs(cwd, options?)`, `planCatalogMigration(cwd, options)` and `applyCatalogMigrationPlan(cwd, plan)`. See [pnpm catalogs](https://pnpm.io/catalogs) for protocol semantics and [Syncpack](https://syncpack.dev/) for intentional version-group policy patterns.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Optional Knip checks
|
|
2
|
+
|
|
3
|
+
Use `pnpm exec repo check knip` only when unused code/dependency analysis is requested.
|
|
4
|
+
Ordinary check modes do not enable it. A workspace-root installation of Knip
|
|
5
|
+
`>=6.39.0 <7` is required; missing-tool guidance is `pnpm add -Dw knip@^6.39.0`.
|
|
6
|
+
repoctl does not download it, fall back to global/parent tools or run native fixes.
|
|
7
|
+
|
|
8
|
+
1. Inspect `repo check knip --recommend-config` and merge useful native settings manually.
|
|
9
|
+
Preserve existing JSON/JS/TS configuration, plugins and intentional dynamic entries.
|
|
10
|
+
Generated outputs have suggested exclusions; review example/fixture exclusions explicitly.
|
|
11
|
+
2. Preview with `repo check knip --dry-run --json`, then run `repo check knip --json`.
|
|
12
|
+
JSON means an actual report on this subcommand. Put all options after `knip`.
|
|
13
|
+
3. Use `--production` or `--strict` only after reviewing native production entries.
|
|
14
|
+
Strict mode implies production and checks direct dependency declarations per workspace.
|
|
15
|
+
4. Review findings before explicitly saving with `--save-baseline knip-baseline.json`.
|
|
16
|
+
Saving preserves the current exit code and cannot overwrite arbitrary files.
|
|
17
|
+
5. Compare with `--baseline knip-baseline.json --new-only` for incremental adoption.
|
|
18
|
+
Do not refresh a baseline silently to hide failures. Baseline errors fail closed.
|
|
19
|
+
|
|
20
|
+
Reports preserve workspace, source location, native category/reason and warn/error severity.
|
|
21
|
+
Exit 0 means the policy passes, 1 means blocking findings, and 2 means incomplete analysis
|
|
22
|
+
or invalid baseline. Baseline comparison reports existing, added and fixed findings.
|
|
23
|
+
Source line shifts do not create new findings; severity escalation does.
|
|
24
|
+
|
|
25
|
+
Baseline scope binds the exact tool version, modes, root name, native workspace set,
|
|
26
|
+
primary config hashes, categories and enabled plugins. Source/dependency fixes are allowed.
|
|
27
|
+
Imported config helpers, environment changes and every plugin auxiliary config are not fully
|
|
28
|
+
fingerprinted: review and explicitly rebaseline after changing those policies.
|
|
29
|
+
Config paths are relative to invocation cwd; baseline paths are relative to the workspace root.
|
|
30
|
+
Review retained temporary paths after interrupted saves or cleanup failures.
|
|
31
|
+
|
|
32
|
+
Public APIs: `planKnipCheck`, `runKnipCheck`, `getKnipConfigurationSuggestions`,
|
|
33
|
+
`saveKnipBaseline`, with exported plan/report/baseline types. Timeout and cancellation fail
|
|
34
|
+
closed. Neither repoctl configuration recommendations nor its analyzer runs edit user config.
|
|
@@ -36,6 +36,7 @@ Built-in template map:
|
|
|
36
36
|
- vue-lib -> templates/vue-lib => packages/vue-lib
|
|
37
37
|
- hono-server -> templates/server => apps/server
|
|
38
38
|
- vue-hono -> templates/client => apps/client
|
|
39
|
+
- next -> templates/next => apps/next (Next.js App Router, server page, client state and health route)
|
|
39
40
|
- nimbus -> templates/nimbus => apps/docs (default documentation template)
|
|
40
41
|
- vitepress -> templates/vitepress => apps/website (explicit alternative)
|
|
41
42
|
- cli -> templates/cli => apps/cli
|
|
@@ -45,3 +46,25 @@ Notes:
|
|
|
45
46
|
- The command prompts for template selection unless defaults are set in
|
|
46
47
|
repoctl.config.ts or monorepo.config.ts.
|
|
47
48
|
- Override mappings with `commands.create.templateMap` and `commands.create.templatesDir`.
|
|
49
|
+
|
|
50
|
+
For `next`, run `typecheck` to generate Next route types before `tsc`. Its local Turbo config caches production output and excludes `.next/cache`. Compiled workspace libraries use public package exports and `^build`; source-exporting libraries must be named in `transpilePackages`. Never copy `.next`, `next-env.d.ts` or an independent pnpm lockfile into the template.
|
|
51
|
+
|
|
52
|
+
## Custom catalog
|
|
53
|
+
|
|
54
|
+
Creation, list/detail, interactive choices and `repo templates --check` share `resolveTemplateCatalog({ cwd })`. Object entries in `commands.create.templateMap` accept `source`, `target`, optional `label`, `description`, and `category` (`app`, `docs`, `library`, `service`, `tool`); string entries still map the same source and target. Absolute sources coexist with installed templates. `templatesDir` replaces the root for all relative sources, including built-ins, and is relative to the configuration file, including when invoked in a nested workspace package. A non-empty `choices` array preserves explicit ordering/inclusion and supplies the same labels/descriptions shown by discovery.
|
|
55
|
+
|
|
56
|
+
Detail/JSON include `origin`, `overridesBuiltin`, `sourceDir`, `configFile` and `configPath`; create JSON includes `templateInfo`. Health checks report invalid declarations, duplicate choices, sources and targets, missing directories/manifests and metadata. Checks are read-only and do not execute template code. Prefer `--check --json` for diagnostic locations; listing JSON keeps the array shape.
|
|
57
|
+
|
|
58
|
+
## Author validation
|
|
59
|
+
|
|
60
|
+
Use `repo templates validate <key> --fixture <workspace-skeleton> --json` for explicit generated-project validation. `--dry-run` inspects required scripts without executing them; repeated `--name` validates renamed samples. `--parameter-matrix matrix.json` reads a JSON array of typed parameter objects and crosses it with names (at most 20 samples). The public helper uses `parameterSets`. Each combination inspects its rendered files and conditional scripts before execution. Sensitive values are redacted, and sensitive combinations hide child output and diagnostic messages while retaining stages, exit codes and diagnostic codes; retained generated files can still contain those inputs. Execution order is install → build → lint/Stylelint → typecheck → tsd for typed libraries → built-artifact tests and declared E2E. Library samples additionally pack, analyze and consume actual tarballs. Default cleanup removes samples; `--keep-failed` retains failure diagnostics and `--keep-temp` retains every sample. `--timeout` bounds each child command, and interruption stops only the validation process tree. Ordinary template discovery/check never executes scripts.
|
|
61
|
+
|
|
62
|
+
## Remote assets
|
|
63
|
+
|
|
64
|
+
A custom entry can add `remote: { kind: 'npm', packageName, version, registry? }` or `remote: { kind: 'git', repository, ref }`; `source` is a relative archive directory, including `.` for its root. npm requires an exact version; prefer a full Git commit for reproducibility across fresh caches. `repo templates fetch <key> --json` prepares verified assets. Actual creation/validation may fetch, while listing, health and previews remain read-only and need a previously fetched cache. `--offline` refuses a miss; `--cache-dir` or `commands.create.cacheDir` overrides the cache relative to invocation cwd.
|
|
65
|
+
|
|
66
|
+
npm configuration supplies scoped registry/authentication. Never put credentials in the remote declaration. Fetching runs no lifecycle scripts, hooks, submodules or dependency installs. Cache hits recheck original archives against extracted asset contents; corruption is an error, not an automatic refresh. A Git ref stays pinned to its first cached commit. Instances record resolved provenance and retained baselines; remote upgrades are explicitly unsupported by the built-in-version `templates upgrade` command. The exported `resolveRemoteTemplateSource` helper is the same acquisition boundary used by the CLI.
|
|
67
|
+
|
|
68
|
+
## Existing-package generators
|
|
69
|
+
|
|
70
|
+
Use `repo generate <vue-component|react-component|hono-route> <kebab-name> --package <exact-name-or-relative-dir> --json` to inspect source and behavior-test files before writing. Run without `--json` to apply; `--export` explicitly adds a named export to `src/index.ts` (or `--barrel`). `--directory` stays inside the selected package. Strict parameters, framework requirements, stale plans, symlinks and conflicting files fail before writes. Repeated identical generation is unchanged. Hono route registration remains an explicit printed next step. Validate generated output with build, ESLint/Stylelint, tsc/vue-tsc and tests. Keep `repo new` for whole new packages; it never overwrites existing directories.
|
|
@@ -4,7 +4,7 @@ on:
|
|
|
4
4
|
# push:
|
|
5
5
|
# branches: ['main']
|
|
6
6
|
pull_request:
|
|
7
|
-
types: [opened, synchronize]
|
|
7
|
+
types: [ opened, synchronize ]
|
|
8
8
|
paths-ignore:
|
|
9
9
|
- '**/*.md'
|
|
10
10
|
- 'docs/**'
|
|
@@ -15,20 +15,26 @@ on:
|
|
|
15
15
|
permissions:
|
|
16
16
|
contents: read
|
|
17
17
|
|
|
18
|
+
concurrency:
|
|
19
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
20
|
+
cancel-in-progress: true
|
|
21
|
+
|
|
18
22
|
jobs:
|
|
19
23
|
build:
|
|
20
24
|
name: Build and Test
|
|
21
|
-
|
|
25
|
+
# Preserve time for full validation and packaged checks on every platform.
|
|
26
|
+
timeout-minutes: 35
|
|
22
27
|
strategy:
|
|
23
28
|
fail-fast: false
|
|
24
29
|
matrix:
|
|
25
|
-
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
26
|
-
node-version: [22, 24]
|
|
30
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
|
31
|
+
node-version: [ 22, 24 ]
|
|
27
32
|
runs-on: ${{ matrix.os }}
|
|
28
33
|
# Remote Caching enabled - configure TURBO_TOKEN and TURBO_TEAM in repository settings
|
|
29
34
|
env:
|
|
30
35
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
31
36
|
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
|
37
|
+
NEXT_TELEMETRY_DISABLED: '1'
|
|
32
38
|
|
|
33
39
|
steps:
|
|
34
40
|
- name: Check out code
|
|
@@ -48,12 +54,6 @@ jobs:
|
|
|
48
54
|
- name: Install dependencies
|
|
49
55
|
run: pnpm install --frozen-lockfile
|
|
50
56
|
|
|
51
|
-
- name: Check tracked build artifacts
|
|
52
|
-
run: pnpm check:no-tracked-build-artifacts
|
|
53
|
-
|
|
54
|
-
- name: Check CI/CD workflow contracts
|
|
55
|
-
run: pnpm check:workflows
|
|
56
|
-
|
|
57
57
|
- name: Security Audit
|
|
58
58
|
run: pnpm audit --audit-level=moderate
|
|
59
59
|
continue-on-error: true
|