@phuc1403/musketeer 0.5.0 → 0.7.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.
Files changed (111) hide show
  1. package/INSTALLATION.md +52 -32
  2. package/bin/musketeer.js +168 -79
  3. package/manifest.json +9 -9
  4. package/package.json +48 -46
  5. package/src/dotnet-scaffold-copier.js +79 -72
  6. package/src/provisioner/detect.js +93 -93
  7. package/src/self-update.js +77 -73
  8. package/template/.claude/hooks/block-unsafe-adr-title.cjs +85 -70
  9. package/template/.claude/hooks/init-adr-dir.cjs +173 -110
  10. package/template/.claude/hooks/inject-adr-flags.cjs +94 -0
  11. package/template/.claude/hooks/lib/adr/command-scan.cjs +115 -0
  12. package/template/.claude/hooks/sync-adr-toc.cjs +146 -111
  13. package/template/.claude/skills/adr-writer/SKILL.md +48 -46
  14. package/template/.claude/hooks/inject-adr-env.cjs +0 -82
  15. package/template/dotnet-scaffold/src/__SolutionName__.Api/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs +0 -4
  16. package/template/dotnet-scaffold/src/__SolutionName__.Api/obj/Debug/net10.0/__SolutionName__.Api.AssemblyInfo.cs +0 -22
  17. package/template/dotnet-scaffold/src/__SolutionName__.Api/obj/Debug/net10.0/__SolutionName__.Api.AssemblyInfoInputs.cache +0 -1
  18. package/template/dotnet-scaffold/src/__SolutionName__.Api/obj/Debug/net10.0/__SolutionName__.Api.GeneratedMSBuildEditorConfig.editorconfig +0 -23
  19. package/template/dotnet-scaffold/src/__SolutionName__.Api/obj/Debug/net10.0/__SolutionName__.Api.GlobalUsings.g.cs +0 -17
  20. package/template/dotnet-scaffold/src/__SolutionName__.Api/obj/Debug/net10.0/__SolutionName__.Api.assets.cache +0 -0
  21. package/template/dotnet-scaffold/src/__SolutionName__.Api/obj/__SolutionName__.Api.csproj.nuget.dgspec.json +0 -1536
  22. package/template/dotnet-scaffold/src/__SolutionName__.Api/obj/__SolutionName__.Api.csproj.nuget.g.props +0 -16
  23. package/template/dotnet-scaffold/src/__SolutionName__.Api/obj/__SolutionName__.Api.csproj.nuget.g.targets +0 -2
  24. package/template/dotnet-scaffold/src/__SolutionName__.Api/obj/project.assets.json +0 -559
  25. package/template/dotnet-scaffold/src/__SolutionName__.Api/obj/project.nuget.cache +0 -8
  26. package/template/dotnet-scaffold/src/__SolutionName__.Application/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs +0 -4
  27. package/template/dotnet-scaffold/src/__SolutionName__.Application/obj/Debug/net10.0/__SolutionName__.Application.AssemblyInfo.cs +0 -22
  28. package/template/dotnet-scaffold/src/__SolutionName__.Application/obj/Debug/net10.0/__SolutionName__.Application.AssemblyInfoInputs.cache +0 -1
  29. package/template/dotnet-scaffold/src/__SolutionName__.Application/obj/Debug/net10.0/__SolutionName__.Application.GeneratedMSBuildEditorConfig.editorconfig +0 -17
  30. package/template/dotnet-scaffold/src/__SolutionName__.Application/obj/Debug/net10.0/__SolutionName__.Application.GlobalUsings.g.cs +0 -8
  31. package/template/dotnet-scaffold/src/__SolutionName__.Application/obj/Debug/net10.0/__SolutionName__.Application.assets.cache +0 -0
  32. package/template/dotnet-scaffold/src/__SolutionName__.Application/obj/__SolutionName__.Application.csproj.nuget.dgspec.json +0 -690
  33. package/template/dotnet-scaffold/src/__SolutionName__.Application/obj/__SolutionName__.Application.csproj.nuget.g.props +0 -16
  34. package/template/dotnet-scaffold/src/__SolutionName__.Application/obj/__SolutionName__.Application.csproj.nuget.g.targets +0 -2
  35. package/template/dotnet-scaffold/src/__SolutionName__.Application/obj/project.assets.json +0 -376
  36. package/template/dotnet-scaffold/src/__SolutionName__.Application/obj/project.nuget.cache +0 -8
  37. package/template/dotnet-scaffold/src/__SolutionName__.Domain/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs +0 -4
  38. package/template/dotnet-scaffold/src/__SolutionName__.Domain/obj/Debug/net10.0/__SolutionName__.Domain.AssemblyInfo.cs +0 -22
  39. package/template/dotnet-scaffold/src/__SolutionName__.Domain/obj/Debug/net10.0/__SolutionName__.Domain.AssemblyInfoInputs.cache +0 -1
  40. package/template/dotnet-scaffold/src/__SolutionName__.Domain/obj/Debug/net10.0/__SolutionName__.Domain.GeneratedMSBuildEditorConfig.editorconfig +0 -17
  41. package/template/dotnet-scaffold/src/__SolutionName__.Domain/obj/Debug/net10.0/__SolutionName__.Domain.GlobalUsings.g.cs +0 -8
  42. package/template/dotnet-scaffold/src/__SolutionName__.Domain/obj/Debug/net10.0/__SolutionName__.Domain.assets.cache +0 -0
  43. package/template/dotnet-scaffold/src/__SolutionName__.Domain/obj/__SolutionName__.Domain.csproj.nuget.dgspec.json +0 -347
  44. package/template/dotnet-scaffold/src/__SolutionName__.Domain/obj/__SolutionName__.Domain.csproj.nuget.g.props +0 -16
  45. package/template/dotnet-scaffold/src/__SolutionName__.Domain/obj/__SolutionName__.Domain.csproj.nuget.g.targets +0 -2
  46. package/template/dotnet-scaffold/src/__SolutionName__.Domain/obj/project.assets.json +0 -353
  47. package/template/dotnet-scaffold/src/__SolutionName__.Domain/obj/project.nuget.cache +0 -8
  48. package/template/dotnet-scaffold/src/__SolutionName__.Infrastructure/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs +0 -4
  49. package/template/dotnet-scaffold/src/__SolutionName__.Infrastructure/obj/Debug/net10.0/__SolutionName__.Infrastructure.AssemblyInfo.cs +0 -22
  50. package/template/dotnet-scaffold/src/__SolutionName__.Infrastructure/obj/Debug/net10.0/__SolutionName__.Infrastructure.AssemblyInfoInputs.cache +0 -1
  51. package/template/dotnet-scaffold/src/__SolutionName__.Infrastructure/obj/Debug/net10.0/__SolutionName__.Infrastructure.GeneratedMSBuildEditorConfig.editorconfig +0 -17
  52. package/template/dotnet-scaffold/src/__SolutionName__.Infrastructure/obj/Debug/net10.0/__SolutionName__.Infrastructure.GlobalUsings.g.cs +0 -8
  53. package/template/dotnet-scaffold/src/__SolutionName__.Infrastructure/obj/Debug/net10.0/__SolutionName__.Infrastructure.assets.cache +0 -0
  54. package/template/dotnet-scaffold/src/__SolutionName__.Infrastructure/obj/Debug/net10.0/__SolutionName__.Infrastructure.csproj.AssemblyReference.cache +0 -0
  55. package/template/dotnet-scaffold/src/__SolutionName__.Infrastructure/obj/__SolutionName__.Infrastructure.csproj.nuget.dgspec.json +0 -1047
  56. package/template/dotnet-scaffold/src/__SolutionName__.Infrastructure/obj/__SolutionName__.Infrastructure.csproj.nuget.g.props +0 -16
  57. package/template/dotnet-scaffold/src/__SolutionName__.Infrastructure/obj/__SolutionName__.Infrastructure.csproj.nuget.g.targets +0 -7
  58. package/template/dotnet-scaffold/src/__SolutionName__.Infrastructure/obj/project.assets.json +0 -858
  59. package/template/dotnet-scaffold/src/__SolutionName__.Infrastructure/obj/project.nuget.cache +0 -17
  60. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/bin/Debug/net10.0/.msCoverageSourceRootsMapping___SolutionName__.Api.Tests +0 -0
  61. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs +0 -4
  62. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/obj/Debug/net10.0/__SolutionName__.Api.Tests.AssemblyInfo.cs +0 -22
  63. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/obj/Debug/net10.0/__SolutionName__.Api.Tests.AssemblyInfoInputs.cache +0 -1
  64. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/obj/Debug/net10.0/__SolutionName__.Api.Tests.GeneratedMSBuildEditorConfig.editorconfig +0 -17
  65. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/obj/Debug/net10.0/__SolutionName__.Api.Tests.GlobalUsings.g.cs +0 -9
  66. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/obj/Debug/net10.0/__SolutionName__.Api.Tests.assets.cache +0 -0
  67. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/obj/Debug/net10.0/__SolutionName__.Api.Tests.csproj.AssemblyReference.cache +0 -0
  68. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/obj/__SolutionName__.Api.Tests.csproj.nuget.dgspec.json +0 -1908
  69. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/obj/__SolutionName__.Api.Tests.csproj.nuget.g.props +0 -27
  70. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/obj/__SolutionName__.Api.Tests.csproj.nuget.g.targets +0 -16
  71. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/obj/project.assets.json +0 -3283
  72. package/template/dotnet-scaffold/tests/__SolutionName__.Api.Tests/obj/project.nuget.cache +0 -60
  73. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/bin/Debug/net10.0/.msCoverageSourceRootsMapping___SolutionName__.Application.Tests +0 -0
  74. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs +0 -4
  75. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/obj/Debug/net10.0/__SolutionName__.Application.Tests.AssemblyInfo.cs +0 -22
  76. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/obj/Debug/net10.0/__SolutionName__.Application.Tests.AssemblyInfoInputs.cache +0 -1
  77. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/obj/Debug/net10.0/__SolutionName__.Application.Tests.GeneratedMSBuildEditorConfig.editorconfig +0 -17
  78. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/obj/Debug/net10.0/__SolutionName__.Application.Tests.GlobalUsings.g.cs +0 -9
  79. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/obj/Debug/net10.0/__SolutionName__.Application.Tests.assets.cache +0 -0
  80. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/obj/Debug/net10.0/__SolutionName__.Application.Tests.csproj.AssemblyReference.cache +0 -0
  81. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/obj/__SolutionName__.Application.Tests.csproj.nuget.dgspec.json +0 -1055
  82. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/obj/__SolutionName__.Application.Tests.csproj.nuget.g.props +0 -26
  83. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/obj/__SolutionName__.Application.Tests.csproj.nuget.g.targets +0 -11
  84. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/obj/project.assets.json +0 -1662
  85. package/template/dotnet-scaffold/tests/__SolutionName__.Application.Tests/obj/project.nuget.cache +0 -30
  86. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/bin/Debug/net10.0/.msCoverageSourceRootsMapping___SolutionName__.Domain.Tests +0 -0
  87. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs +0 -4
  88. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/obj/Debug/net10.0/__SolutionName__.Domain.Tests.AssemblyInfo.cs +0 -22
  89. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/obj/Debug/net10.0/__SolutionName__.Domain.Tests.AssemblyInfoInputs.cache +0 -1
  90. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/obj/Debug/net10.0/__SolutionName__.Domain.Tests.GeneratedMSBuildEditorConfig.editorconfig +0 -17
  91. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/obj/Debug/net10.0/__SolutionName__.Domain.Tests.GlobalUsings.g.cs +0 -9
  92. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/obj/Debug/net10.0/__SolutionName__.Domain.Tests.assets.cache +0 -0
  93. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/obj/Debug/net10.0/__SolutionName__.Domain.Tests.csproj.AssemblyReference.cache +0 -0
  94. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/obj/__SolutionName__.Domain.Tests.csproj.nuget.dgspec.json +0 -712
  95. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/obj/__SolutionName__.Domain.Tests.csproj.nuget.g.props +0 -26
  96. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/obj/__SolutionName__.Domain.Tests.csproj.nuget.g.targets +0 -11
  97. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/obj/project.assets.json +0 -1644
  98. package/template/dotnet-scaffold/tests/__SolutionName__.Domain.Tests/obj/project.nuget.cache +0 -30
  99. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/bin/Debug/net10.0/.msCoverageSourceRootsMapping___SolutionName__.Infrastructure.Tests +0 -0
  100. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.cs +0 -4
  101. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/obj/Debug/net10.0/__SolutionName__.Infrastructure.Tests.AssemblyInfo.cs +0 -22
  102. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/obj/Debug/net10.0/__SolutionName__.Infrastructure.Tests.AssemblyInfoInputs.cache +0 -1
  103. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/obj/Debug/net10.0/__SolutionName__.Infrastructure.Tests.GeneratedMSBuildEditorConfig.editorconfig +0 -17
  104. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/obj/Debug/net10.0/__SolutionName__.Infrastructure.Tests.GlobalUsings.g.cs +0 -9
  105. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/obj/Debug/net10.0/__SolutionName__.Infrastructure.Tests.assets.cache +0 -0
  106. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/obj/Debug/net10.0/__SolutionName__.Infrastructure.Tests.csproj.AssemblyReference.cache +0 -0
  107. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/obj/__SolutionName__.Infrastructure.Tests.csproj.nuget.dgspec.json +0 -1412
  108. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/obj/__SolutionName__.Infrastructure.Tests.csproj.nuget.g.props +0 -26
  109. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/obj/__SolutionName__.Infrastructure.Tests.csproj.nuget.g.targets +0 -13
  110. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/obj/project.assets.json +0 -2130
  111. package/template/dotnet-scaffold/tests/__SolutionName__.Infrastructure.Tests/obj/project.nuget.cache +0 -38
package/INSTALLATION.md CHANGED
@@ -1,32 +1,52 @@
1
- # Prerequisites & Auto-Install
2
-
3
- `musketeer` auto-installs the external prerequisites required by your selected company
4
- (announced before each install, never silent). When no OS package manager is available — or
5
- an elevation prompt is refused — it falls back to printing the exact manual command below.
6
-
7
- > Filled in detail during Phase 06 (provisioner) / Phase 08 (publish).
8
-
9
- ## Per-prerequisite matrix
10
-
11
- | Prereq | Needed by | Windows | macOS | Linux |
12
- |--------|-----------|---------|-------|-------|
13
- | Node 18+ | core | `winget install OpenJS.NodeJS.LTS` | `brew install node` | NodeSource / distro |
14
- | git | core, code-review | `winget install Git.Git` | `brew install git` | `apt/dnf/pacman install git` |
15
- | Python 3.8+ | core (skill-creator) | `winget install Python.Python.3.12` | `brew install python@3.12` | `apt install python3 python3-pip` |
16
- | Java 8+ | architecture (context-map) | `winget install Microsoft.OpenJDK` | `brew install --cask temurin` | `apt install openjdk-17-jdk` |
17
- | adr-tools | architecture (adr-writer) | download the [release zip](https://github.com/npryce/adr-tools/releases), copy `src/*` into `C:\Program Files\Git\usr\bin` (Git Bash) | `brew install adr-tools` | `apt install adr-tools` · Arch: AUR `adr-tools` · Fedora/RHEL: clone + add `src/` to `PATH` |
18
- | gh | code-review (PR mode) | `winget install GitHub.cli` | `brew install gh` | `apt install gh` |
19
-
20
- > `adr-tools` is a set of bash scripts. On Windows it runs inside Git Bash (already required by
21
- > core), so the skill works — but `musketeer muster` cannot detect it from `cmd.exe` and will print
22
- > a manual-install line every run. Expected; ignore it once `adr config` works in Git Bash.
23
- >
24
- > Running `musketeer muster` non-interactively (CI, onboarding scripts)? The `apt`/`brew` install
25
- > commands can prompt for `sudo` or hang waiting for input. Pre-install the prereqs yourself, or
26
- > set `MUSKETEER_SKIP_INSTALL=1` to print the manual command instead of executing it (red team
27
- > finding 8).
28
-
29
- ## Secrets (never auto-installed)
30
-
31
- - `ANTHROPIC_API_KEY` needed only by skill-creator's improve/loop scripts. You will be
32
- prompted / shown how to set it; musketeer never writes it to the repo.
1
+ # Prerequisites & Auto-Install
2
+
3
+ `musketeer` auto-installs the external prerequisites required by your selected company
4
+ (announced before each install, never silent). When no OS package manager is available — or
5
+ an elevation prompt is refused — it falls back to printing the exact manual command below.
6
+
7
+ > Filled in detail during Phase 06 (provisioner) / Phase 08 (publish).
8
+
9
+ ## Per-prerequisite matrix
10
+
11
+ | Prereq | Needed by | Windows | macOS | Linux |
12
+ |--------|-----------|---------|-------|-------|
13
+ | Node 18+ | core | `winget install OpenJS.NodeJS.LTS` | `brew install node` | NodeSource / distro |
14
+ | git | core, code-review | `winget install Git.Git` | `brew install git` | `apt/dnf/pacman install git` |
15
+ | Python 3.8+ | core (skill-creator) | `winget install Python.Python.3.12` | `brew install python@3.12` | `apt install python3 python3-pip` |
16
+ | Java 8+ | architecture (context-map) | `winget install Microsoft.OpenJDK` | `brew install --cask temurin` | `apt install openjdk-17-jdk` |
17
+ | adr-tools | architecture (adr-writer) | `npm i -g @meza/adr-tools@2` | `npm i -g @meza/adr-tools@2` | `npm i -g @meza/adr-tools@2` |
18
+ | gh | code-review (PR mode) | `winget install GitHub.cli` | `brew install gh` | `apt install gh` |
19
+
20
+ > `adr-tools` is [`@meza/adr-tools`](https://www.npmjs.com/package/@meza/adr-tools) the maintained
21
+ > Node port of `npryce/adr-tools`. Same `adr` binary, same `.adr-dir`, same `NNNN-slug.md` files, so
22
+ > existing ADRs carry over untouched. One npm command on every platform: no Git Bash, no admin
23
+ > rights, no release zip.
24
+ >
25
+ > It is the one prereq that needs **Node >= 22.13.0** (musketeer itself still only needs 18). It is
26
+ > installed as a prereq rather than bundled: it is GPL-3.0 and musketeer is MIT, so musketeer
27
+ > invokes it as a subprocess instead of depending on it.
28
+ >
29
+ > Upgrading from `npryce/adr-tools`? Remove the old scripts first. They install as loose files in
30
+ > `~/bin` or Git's `usr/bin`, and if either is earlier on your `PATH` the old `adr` keeps winning —
31
+ > most visibly inside Git Bash.
32
+
33
+ ### Running muster without a terminal
34
+
35
+ `musketeer muster` opens a picker, which needs a terminal. For CI, onboarding scripts, and agent
36
+ sessions, name the company instead and the picker is skipped:
37
+
38
+ ```bash
39
+ musketeer muster --company architecture,dotnet # set the company to exactly these
40
+ musketeer muster --keep # refresh the company already in .musketeer.json
41
+ ```
42
+
43
+ `--keep` is the one to reach for after upgrading the CLI: it re-applies the latest templates
44
+ without changing which musketeers are installed. Both flags survive the self-update re-exec.
45
+
46
+ The `apt`/`brew` prereq installs can still prompt for `sudo` or wait on input. Pre-install them, or
47
+ set `MUSKETEER_SKIP_INSTALL=1` to print the manual command instead of running it.
48
+
49
+ ## Secrets (never auto-installed)
50
+
51
+ - `ANTHROPIC_API_KEY` — needed only by skill-creator's improve/loop scripts. You will be
52
+ prompted / shown how to set it; musketeer never writes it to the repo.
package/bin/musketeer.js CHANGED
@@ -1,79 +1,168 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- const { parseArgs } = require('node:util');
5
-
6
- const USAGE = `musketeer — scaffold a curated company of Claude Code musketeers into ./.claude
7
-
8
- Usage:
9
- musketeer muster Self-update to latest, then pick your company and refresh all selected skills
10
- musketeer promote Update the musketeer CLI itself to the latest published version
11
- musketeer Show this help
12
- musketeer --help Show this help
13
-
14
- Notes:
15
- * "muster" changes which musketeers are in THIS project; "promote" upgrades the CLI itself.
16
- * On confirm, muster REFRESHES every selected musketeer's files to the latest template (overwrites local edits).
17
- * muster auto-updates the CLI to the latest published version first (set MUSKETEER_NO_SELF_UPDATE=1 to skip).
18
- * "core" is always installed and locked — it cannot be removed.
19
- * The muster is multi-select: check every musketeer you want, then confirm.
20
- * settings.json is GENERATED per-selection; missing prereqs are auto-installed (announced).`;
21
-
22
- function parse(argv) {
23
- return parseArgs({
24
- args: argv,
25
- options: {
26
- help: { type: 'boolean', short: 'h', default: false },
27
- },
28
- allowPositionals: true,
29
- });
30
- }
31
-
32
- async function main(argv = process.argv.slice(2)) {
33
- let parsed;
34
- try {
35
- parsed = parse(argv);
36
- } catch (err) {
37
- process.stderr.write(`${err.message}\n\n${USAGE}\n`);
38
- process.exitCode = 2;
39
- return;
40
- }
41
-
42
- const { values, positionals } = parsed;
43
- const command = positionals[0];
44
-
45
- // `musketeer` alone (or --help) usage.
46
- if (values.help || !command) {
47
- process.stdout.write(`${USAGE}\n`);
48
- return;
49
- }
50
-
51
- if (command === 'muster') {
52
- // Pull the latest published version first, so the picker refreshes installed
53
- // skills to the newest template (not a stale package's). Re-execs when behind.
54
- const { ensureLatest } = require('../src/self-update');
55
- const reexecCode = ensureLatest();
56
- if (reexecCode !== null) {
57
- process.exitCode = reexecCode;
58
- return;
59
- }
60
- // Lazy-require so help never pays the cost of loading the engine/manifest.
61
- const reconcile = require('../src/reconcile');
62
- await reconcile.run({ desiredIds: null, interactive: true });
63
- return;
64
- }
65
-
66
- if (command === 'promote') {
67
- const promote = require('../src/promote');
68
- await promote.run();
69
- return;
70
- }
71
-
72
- process.stderr.write(`Unknown command "${command}".\n\n${USAGE}\n`);
73
- process.exitCode = 2;
74
- }
75
-
76
- main().catch((err) => {
77
- process.stderr.write(`musketeer: ${err && err.message ? err.message : err}\n`);
78
- process.exitCode = 1;
79
- });
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { parseArgs } = require('node:util');
5
+
6
+ const USAGE = `musketeer — scaffold a curated company of Claude Code musketeers into ./.claude
7
+
8
+ Usage:
9
+ musketeer muster Self-update to latest, then pick your company and refresh all selected skills
10
+ musketeer muster --keep
11
+ Refresh the company already recorded in .musketeer.json, no picker
12
+ musketeer muster --company a,b
13
+ Set the company to exactly these musketeers, no picker
14
+ musketeer promote Update the musketeer CLI itself to the latest published version
15
+ musketeer Show this help
16
+ musketeer --help Show this help
17
+
18
+ Notes:
19
+ * "muster" changes which musketeers are in THIS project; "promote" upgrades the CLI itself.
20
+ * On confirm, muster REFRESHES every selected musketeer's files to the latest template (overwrites local edits).
21
+ * muster auto-updates the CLI to the latest published version first (set MUSKETEER_NO_SELF_UPDATE=1 to skip).
22
+ * "core" is always installed and locked — it cannot be removed.
23
+ * The muster is multi-select: check every musketeer you want, then confirm.
24
+ * settings.json is GENERATED per-selection; missing prereqs are auto-installed (announced).
25
+ * --keep and --company skip the picker, so muster runs in CI and other sessions with no terminal.
26
+ * Without either flag and without a terminal, muster stops and tells you which flag to use.`;
27
+
28
+ function parse(argv) {
29
+ return parseArgs({
30
+ args: argv,
31
+ options: {
32
+ help: { type: 'boolean', short: 'h', default: false },
33
+ company: { type: 'string' },
34
+ keep: { type: 'boolean', default: false },
35
+ },
36
+ allowPositionals: true,
37
+ });
38
+ }
39
+
40
+ /**
41
+ * Work out what this muster should do before anything touches the disk.
42
+ *
43
+ * Bare `muster` opens the picker, which needs a terminal. Under CI, or any
44
+ * agent without one, the picker used to die inside its own TTY setup with no
45
+ * hint that a flag could have avoided it. Both flags skip the picker: --company
46
+ * states the company outright, --keep reconciles the one already recorded.
47
+ *
48
+ * `forward` is what the self-update must replay when it re-execs the newer
49
+ * binary, so a scripted run does not land back at the picker.
50
+ *
51
+ * @param {{company?:string, keep:boolean}} values parsed flags
52
+ * @param {{isTTY:boolean, projectDir:string, readLockfile:function}} ctx
53
+ * @returns {{desiredIds:?string[], interactive:boolean, forward:string[]}}
54
+ */
55
+ function resolveMusterPlan(values, ctx) {
56
+ if (values.company !== undefined && values.keep) {
57
+ throw new Error('Use either --company or --keep, not both: one sets the company, the other keeps it.');
58
+ }
59
+
60
+ if (values.company !== undefined) {
61
+ const ids = values.company
62
+ .split(',')
63
+ .map((s) => s.trim())
64
+ .filter(Boolean);
65
+ if (ids.length === 0) {
66
+ throw new Error('--company needs at least one musketeer, for example: --company architecture,dotnet');
67
+ }
68
+ return { desiredIds: ids, interactive: false, forward: [`--company=${ids.join(',')}`] };
69
+ }
70
+
71
+ if (values.keep) {
72
+ const prev = ctx.readLockfile(ctx.projectDir);
73
+ if (!prev.musketeers || prev.musketeers.length === 0) {
74
+ throw new Error(
75
+ 'No company recorded in .musketeer.json, so there is nothing for --keep to keep. ' +
76
+ 'Name one with --company, for example: --company architecture,dotnet'
77
+ );
78
+ }
79
+ return { desiredIds: prev.musketeers, interactive: false, forward: ['--keep'] };
80
+ }
81
+
82
+ if (!ctx.isTTY) {
83
+ throw new Error(
84
+ 'muster needs a terminal for its picker, and this session has none. ' +
85
+ 'Refresh the company already recorded with `musketeer muster --keep`, ' +
86
+ 'or state one with `musketeer muster --company architecture,dotnet`.'
87
+ );
88
+ }
89
+
90
+ return { desiredIds: null, interactive: true, forward: [] };
91
+ }
92
+
93
+ async function main(argv = process.argv.slice(2)) {
94
+ let parsed;
95
+ try {
96
+ parsed = parse(argv);
97
+ } catch (err) {
98
+ process.stderr.write(`${err.message}\n\n${USAGE}\n`);
99
+ process.exitCode = 2;
100
+ return;
101
+ }
102
+
103
+ const { values, positionals } = parsed;
104
+ const command = positionals[0];
105
+
106
+ // `musketeer` alone (or --help) → usage.
107
+ if (values.help || !command) {
108
+ process.stdout.write(`${USAGE}\n`);
109
+ return;
110
+ }
111
+
112
+ if (command === 'muster') {
113
+ const { readLockfile } = require('../src/lockfile');
114
+ let plan;
115
+ try {
116
+ plan = resolveMusterPlan(values, {
117
+ isTTY: !!process.stdin.isTTY,
118
+ projectDir: process.cwd(),
119
+ readLockfile,
120
+ });
121
+ } catch (err) {
122
+ process.stderr.write(`${err.message}\n`);
123
+ process.exitCode = 2;
124
+ return;
125
+ }
126
+
127
+ // Pull the latest published version first, so the picker refreshes installed
128
+ // skills to the newest template (not a stale package's). Re-execs when behind.
129
+ const { ensureLatest } = require('../src/self-update');
130
+ const reexecCode = ensureLatest({ args: plan.forward });
131
+ if (reexecCode !== null) {
132
+ if (reexecCode !== 0) {
133
+ // The update landed, the refresh did not. Say so: the CLI is now newer
134
+ // than the templates in this project, and nothing announced the split.
135
+ process.stderr.write(
136
+ 'The CLI was updated but this project was not refreshed — nothing in .claude changed. ' +
137
+ 'Re-run `musketeer muster` once the problem above is resolved.\n'
138
+ );
139
+ }
140
+ process.exitCode = reexecCode;
141
+ return;
142
+ }
143
+ // Lazy-require so help never pays the cost of loading the engine/manifest.
144
+ const reconcile = require('../src/reconcile');
145
+ await reconcile.run({ desiredIds: plan.desiredIds, interactive: plan.interactive });
146
+ return;
147
+ }
148
+
149
+ if (command === 'promote') {
150
+ const promote = require('../src/promote');
151
+ await promote.run();
152
+ return;
153
+ }
154
+
155
+ process.stderr.write(`Unknown command "${command}".\n\n${USAGE}\n`);
156
+ process.exitCode = 2;
157
+ }
158
+
159
+ // Only run as a command. Requiring this file (the tests do, for
160
+ // resolveMusterPlan) must not start a muster.
161
+ if (require.main === module) {
162
+ main().catch((err) => {
163
+ process.stderr.write(`musketeer: ${err && err.message ? err.message : err}\n`);
164
+ process.exitCode = 1;
165
+ });
166
+ }
167
+
168
+ module.exports = { resolveMusterPlan, main };
package/manifest.json CHANGED
@@ -59,11 +59,12 @@
59
59
  "hooks/validate-cml-hook.js",
60
60
  "hooks/validate-characteristics-hook.cjs",
61
61
  "hooks/lib/characteristics/**",
62
+ "hooks/lib/adr/**",
62
63
  "hooks/sync-adr-toc.cjs",
63
64
  "hooks/warn-missing-characteristics.cjs",
64
65
  "hooks/block-unsafe-adr-title.cjs",
65
66
  "hooks/init-adr-dir.cjs",
66
- "hooks/inject-adr-env.cjs"
67
+ "hooks/inject-adr-flags.cjs"
67
68
  ],
68
69
  "settings": [
69
70
  {
@@ -89,9 +90,9 @@
89
90
  {
90
91
  "event": "PreToolUse",
91
92
  "matcher": "Bash",
92
- "command": "node \"${CLAUDE_PROJECT_DIR}/.claude/hooks/inject-adr-env.cjs\"",
93
+ "command": "node \"${CLAUDE_PROJECT_DIR}/.claude/hooks/inject-adr-flags.cjs\"",
93
94
  "order": 3,
94
- "statusMessage": "Filling in adr new env vars"
95
+ "statusMessage": "Adding -q to adr new"
95
96
  },
96
97
  {
97
98
  "event": "PreToolUse",
@@ -266,14 +267,13 @@
266
267
  "needs": ["java"]
267
268
  },
268
269
  "adr-tools": {
269
- "detect": "adr config",
270
+ "detect": "adr --version",
271
+ "minVersion": "2",
270
272
  "kind": "package",
271
- "needs": ["git"],
272
273
  "install": {
273
- "mac": "brew install adr-tools",
274
- "linux": {
275
- "apt": "sudo apt-get install -y adr-tools"
276
- }
274
+ "win": "npm install -g @meza/adr-tools@2",
275
+ "mac": "npm install -g @meza/adr-tools@2",
276
+ "linux": "npm install -g @meza/adr-tools@2"
277
277
  }
278
278
  },
279
279
  "gh": {
package/package.json CHANGED
@@ -1,46 +1,48 @@
1
- {
2
- "name": "@phuc1403/musketeer",
3
- "version": "0.5.0",
4
- "description": "Distributable custom Claude Code harness — one declarative command scaffolds a curated company of musketeers (skills/agents/hooks) into any project's .claude/.",
5
- "type": "commonjs",
6
- "bin": {
7
- "musketeer": "bin/musketeer.js"
8
- },
9
- "engines": {
10
- "node": ">=18"
11
- },
12
- "scripts": {
13
- "test": "node --test"
14
- },
15
- "files": [
16
- "bin",
17
- "src",
18
- "manifest.json",
19
- "template",
20
- "README.md",
21
- "INSTALLATION.md",
22
- "LICENSE"
23
- ],
24
- "keywords": [
25
- "claude",
26
- "claude-code",
27
- "harness",
28
- "scaffolder",
29
- "cli",
30
- "skills",
31
- "agents",
32
- "hooks"
33
- ],
34
- "license": "MIT",
35
- "repository": {
36
- "type": "git",
37
- "url": "git+https://github.com/phamhongphuc1403/musketeer.git"
38
- },
39
- "bugs": {
40
- "url": "https://github.com/phamhongphuc1403/musketeer/issues"
41
- },
42
- "homepage": "https://github.com/phamhongphuc1403/musketeer#readme",
43
- "dependencies": {
44
- "@clack/prompts": "^0.7.0"
45
- }
46
- }
1
+ {
2
+ "name": "@phuc1403/musketeer",
3
+ "version": "0.7.0",
4
+ "description": "Distributable custom Claude Code harness — one declarative command scaffolds a curated company of musketeers (skills/agents/hooks) into any project's .claude/.",
5
+ "type": "commonjs",
6
+ "bin": {
7
+ "musketeer": "bin/musketeer.js"
8
+ },
9
+ "engines": {
10
+ "node": ">=18"
11
+ },
12
+ "scripts": {
13
+ "test": "node --test"
14
+ },
15
+ "files": [
16
+ "bin",
17
+ "src",
18
+ "manifest.json",
19
+ "template",
20
+ "README.md",
21
+ "INSTALLATION.md",
22
+ "LICENSE",
23
+ "!template/**/bin",
24
+ "!template/**/obj"
25
+ ],
26
+ "keywords": [
27
+ "claude",
28
+ "claude-code",
29
+ "harness",
30
+ "scaffolder",
31
+ "cli",
32
+ "skills",
33
+ "agents",
34
+ "hooks"
35
+ ],
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/phamhongphuc1403/musketeer.git"
40
+ },
41
+ "bugs": {
42
+ "url": "https://github.com/phamhongphuc1403/musketeer/issues"
43
+ },
44
+ "homepage": "https://github.com/phamhongphuc1403/musketeer#readme",
45
+ "dependencies": {
46
+ "@clack/prompts": "^0.7.0"
47
+ }
48
+ }
@@ -1,72 +1,79 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
-
6
- function containedPath(root, candidate) {
7
- const resolvedRoot = path.resolve(root);
8
- const resolved = path.resolve(candidate);
9
- if (resolved !== resolvedRoot && !resolved.startsWith(resolvedRoot + path.sep)) return null;
10
- return resolved;
11
- }
12
-
13
- function substitute(text, token, replacement) {
14
- return text.split(token).join(replacement);
15
- }
16
-
17
- /**
18
- * Recursively copy every file under srcDir into stagingDir, substituting
19
- * `token` with `replacement` in both path segments and file contents. Every
20
- * computed destination path is validated to stay under `stagingDir` — rejects
21
- * (throws) rather than writing outside it.
22
- * @param {string} srcDir
23
- * @param {string} stagingDir
24
- * @param {string} token
25
- * @param {string} replacement
26
- */
27
- function copyTemplateWithTokenSubstitution(srcDir, stagingDir, token, replacement) {
28
- walk(srcDir, stagingDir, stagingDir, token, replacement);
29
- }
30
-
31
- function walk(currentSrc, currentDest, stagingRoot, token, replacement) {
32
- const entries = fs.readdirSync(currentSrc, { withFileTypes: true });
33
- for (const entry of entries) {
34
- const substitutedName = substitute(entry.name, token, replacement);
35
- const srcPath = path.join(currentSrc, entry.name);
36
- const destPath = containedPath(stagingRoot, path.join(currentDest, substitutedName));
37
- if (!destPath) {
38
- throw new Error(`copyTemplateWithTokenSubstitution: computed path escapes staging dir: "${substitutedName}"`);
39
- }
40
-
41
- if (entry.isDirectory()) {
42
- fs.mkdirSync(destPath, { recursive: true });
43
- walk(srcPath, destPath, stagingRoot, token, replacement);
44
- } else if (entry.isFile()) {
45
- fs.mkdirSync(path.dirname(destPath), { recursive: true });
46
- const content = fs.readFileSync(srcPath, 'utf8');
47
- fs.writeFileSync(destPath, substitute(content, token, replacement), 'utf8');
48
- }
49
- }
50
- }
51
-
52
- /**
53
- * Move every top-level entry from stagingDir into projectDir. Pre-checks all
54
- * names for collisions before moving any of them, then moves each via
55
- * fs.renameSync (atomic per entry on the same filesystem). Throws instead of
56
- * silently overwriting if a destination name already exists.
57
- * @param {string} stagingDir
58
- * @param {string} projectDir
59
- */
60
- function promoteStagedScaffold(stagingDir, projectDir) {
61
- const entries = fs.readdirSync(stagingDir, { withFileTypes: true });
62
- for (const entry of entries) {
63
- if (fs.existsSync(path.join(projectDir, entry.name))) {
64
- throw new Error(`promoteStagedScaffold: "${entry.name}" already exists at destination`);
65
- }
66
- }
67
- for (const entry of entries) {
68
- fs.renameSync(path.join(stagingDir, entry.name), path.join(projectDir, entry.name));
69
- }
70
- }
71
-
72
- module.exports = { copyTemplateWithTokenSubstitution, promoteStagedScaffold };
1
+ 'use strict';
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ function containedPath(root, candidate) {
7
+ const resolvedRoot = path.resolve(root);
8
+ const resolved = path.resolve(candidate);
9
+ if (resolved !== resolvedRoot && !resolved.startsWith(resolvedRoot + path.sep)) return null;
10
+ return resolved;
11
+ }
12
+
13
+ // Build output directories. These are regenerated by `dotnet build` and must
14
+ // never reach a generated project: they embed absolute paths from whichever
15
+ // machine built the template, and their binaries would be mangled by the
16
+ // UTF-8 read + token substitution below.
17
+ const EXCLUDED_DIRS = new Set(["bin", "obj"]);
18
+
19
+ function substitute(text, token, replacement) {
20
+ return text.split(token).join(replacement);
21
+ }
22
+
23
+ /**
24
+ * Recursively copy every file under srcDir into stagingDir, substituting
25
+ * `token` with `replacement` in both path segments and file contents. Every
26
+ * computed destination path is validated to stay under `stagingDir` — rejects
27
+ * (throws) rather than writing outside it.
28
+ * @param {string} srcDir
29
+ * @param {string} stagingDir
30
+ * @param {string} token
31
+ * @param {string} replacement
32
+ */
33
+ function copyTemplateWithTokenSubstitution(srcDir, stagingDir, token, replacement) {
34
+ walk(srcDir, stagingDir, stagingDir, token, replacement);
35
+ }
36
+
37
+ function walk(currentSrc, currentDest, stagingRoot, token, replacement) {
38
+ const entries = fs.readdirSync(currentSrc, { withFileTypes: true });
39
+ for (const entry of entries) {
40
+ if (entry.isDirectory() && EXCLUDED_DIRS.has(entry.name)) continue;
41
+ const substitutedName = substitute(entry.name, token, replacement);
42
+ const srcPath = path.join(currentSrc, entry.name);
43
+ const destPath = containedPath(stagingRoot, path.join(currentDest, substitutedName));
44
+ if (!destPath) {
45
+ throw new Error(`copyTemplateWithTokenSubstitution: computed path escapes staging dir: "${substitutedName}"`);
46
+ }
47
+
48
+ if (entry.isDirectory()) {
49
+ fs.mkdirSync(destPath, { recursive: true });
50
+ walk(srcPath, destPath, stagingRoot, token, replacement);
51
+ } else if (entry.isFile()) {
52
+ fs.mkdirSync(path.dirname(destPath), { recursive: true });
53
+ const content = fs.readFileSync(srcPath, 'utf8');
54
+ fs.writeFileSync(destPath, substitute(content, token, replacement), 'utf8');
55
+ }
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Move every top-level entry from stagingDir into projectDir. Pre-checks all
61
+ * names for collisions before moving any of them, then moves each via
62
+ * fs.renameSync (atomic per entry on the same filesystem). Throws instead of
63
+ * silently overwriting if a destination name already exists.
64
+ * @param {string} stagingDir
65
+ * @param {string} projectDir
66
+ */
67
+ function promoteStagedScaffold(stagingDir, projectDir) {
68
+ const entries = fs.readdirSync(stagingDir, { withFileTypes: true });
69
+ for (const entry of entries) {
70
+ if (fs.existsSync(path.join(projectDir, entry.name))) {
71
+ throw new Error(`promoteStagedScaffold: "${entry.name}" already exists at destination`);
72
+ }
73
+ }
74
+ for (const entry of entries) {
75
+ fs.renameSync(path.join(stagingDir, entry.name), path.join(projectDir, entry.name));
76
+ }
77
+ }
78
+
79
+ module.exports = { copyTemplateWithTokenSubstitution, promoteStagedScaffold };