claudex-setup 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/LICENSE +21 -0
- package/README.md +34 -12
- package/bin/cli.js +42 -5
- package/package.json +3 -2
- package/src/analyze.js +156 -4
- package/src/audit.js +2 -2
- package/src/benchmark.js +81 -7
- package/src/claudex-sync.json +6 -2
- package/src/context.js +3 -2
- package/src/domain-packs.js +223 -0
- package/src/governance.js +207 -2
- package/src/index.js +8 -0
- package/src/mcp-packs.js +139 -0
- package/src/plans.js +329 -59
- package/src/setup.js +60 -36
- package/src/techniques.js +30 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.9.0] - 2026-03-31
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- 3 new domain packs: `monorepo`, `mobile`, `regulated-lite` (7→10 total)
|
|
7
|
+
- 3 new MCP packs: `github-mcp`, `postgres-mcp`, `memory-mcp` (2→5 total)
|
|
8
|
+
- smart MCP pack recommendation based on detected domain packs
|
|
9
|
+
- `suggest-only --out report.md` exports full analysis as shareable markdown
|
|
10
|
+
- `why` explanations for all strengths preserved (20+ specific reasons)
|
|
11
|
+
- `why` explanations for all gap findings (12+ specific reasons)
|
|
12
|
+
- 5 new hooks in governance registry: duplicate-id-check, injection-defense, trust-drift-check, session-init, protect-catalog
|
|
13
|
+
- case study template in `content/case-study-template.md`
|
|
14
|
+
- hook risk level display in governance output (color-coded low/medium/high)
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- **Settings hierarchy bug**: `noBypassPermissions` and `secretsProtection` checks now correctly read `.claude/settings.json` before `.claude/settings.local.json`, so personal maintainer overrides no longer fail the shared audit
|
|
18
|
+
- domain pack detection now handles monorepo (nx.json, turbo.json, lerna.json, workspaces), mobile (React Native, Flutter, iOS/Android dirs), and regulated repos (SECURITY.md, compliance dirs)
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- strengths preserved section now shows 8 items (was 6) with specific value explanations
|
|
22
|
+
- claudex-sync.json updated with domain pack, MCP pack, and anti-pattern counts
|
|
23
|
+
|
|
24
|
+
## [1.8.0] - 2026-03-31
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- domain pack recommendations for backend, frontend, data, infra, OSS, and enterprise-governed repos
|
|
28
|
+
- MCP pack recommendations and merge support for `context7-docs` and `next-devtools`
|
|
29
|
+
- workflow-evidence coverage in benchmark reports
|
|
30
|
+
- runtime settings overlays so `apply --plan` still respects current `--profile` and `--mcp-pack` flags
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- benchmark now respects the selected profile and MCP pack options during isolated-copy runs
|
|
34
|
+
- governance and suggest-only outputs now expose domain packs and MCP packs directly
|
|
35
|
+
- README and docs clarify the local-vs-opt-in-network boundary for core flows vs `deep-review`
|
|
36
|
+
- audit output now frames `setup` as starter-safe generation instead of an automatic full fix
|
|
37
|
+
|
|
3
38
|
## [1.7.0] - 2026-03-31
|
|
4
39
|
|
|
5
40
|
### Added
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CLAUDEX Project
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
npx claudex-setup # Audit your project (10 seconds)
|
|
13
|
-
npx claudex-setup setup #
|
|
13
|
+
npx claudex-setup setup # Create a starter-safe baseline
|
|
14
14
|
npx claudex-setup augment # Repo-aware plan, no writes
|
|
15
15
|
npx claudex-setup plan # Export proposal bundles with file previews
|
|
16
|
+
npx claudex-setup governance # See permission profiles, packs, and pilot guidance
|
|
16
17
|
npx claudex-setup benchmark # Measure before/after in an isolated temp copy
|
|
17
18
|
npx claudex-setup --threshold 60 # Fail CI if score is below 60
|
|
18
19
|
```
|
|
@@ -48,15 +49,15 @@ No install. No config. No dependencies.
|
|
|
48
49
|
design: none (0/2)
|
|
49
50
|
devops: none (0/4)
|
|
50
51
|
|
|
51
|
-
29/
|
|
52
|
-
Run npx claudex-setup setup to
|
|
52
|
+
29/62 checks passing
|
|
53
|
+
Run npx claudex-setup setup to create a starter-safe baseline
|
|
53
54
|
```
|
|
54
55
|
|
|
55
56
|
## All Commands
|
|
56
57
|
|
|
57
58
|
| Command | What it does |
|
|
58
59
|
|---------|-------------|
|
|
59
|
-
| `npx claudex-setup` | **Discover** - Score 0-100 against
|
|
60
|
+
| `npx claudex-setup` | **Discover** - Score 0-100 against 62 checks |
|
|
60
61
|
| `npx claudex-setup discover` | **Discover** - Alias for audit mode |
|
|
61
62
|
| `npx claudex-setup setup` | **Starter** - Smart CLAUDE.md + hooks + commands + agents |
|
|
62
63
|
| `npx claudex-setup starter` | **Starter** - Alias for setup mode |
|
|
@@ -81,6 +82,8 @@ No install. No config. No dependencies.
|
|
|
81
82
|
| `--out FILE` | Write JSON or markdown output to a file |
|
|
82
83
|
| `--plan FILE` | Load a previously exported plan file |
|
|
83
84
|
| `--only A,B` | Limit plan/apply to selected proposal ids |
|
|
85
|
+
| `--profile NAME` | Choose a permission profile for write-capable flows |
|
|
86
|
+
| `--mcp-pack A,B` | Merge named MCP packs into generated or patched settings |
|
|
84
87
|
| `--dry-run` | Preview apply without writing files |
|
|
85
88
|
| `--verbose` | Show all recommendations (not just critical/high) |
|
|
86
89
|
| `--json` | Machine-readable JSON output (for CI) |
|
|
@@ -121,7 +124,7 @@ Each proposal bundle includes:
|
|
|
121
124
|
|
|
122
125
|
- trigger reasons tied to failed checks
|
|
123
126
|
- file previews and diff-style output
|
|
124
|
-
- `create`
|
|
127
|
+
- `create`, `patch`, or `manual-review` classification
|
|
125
128
|
- risk/confidence labels
|
|
126
129
|
|
|
127
130
|
Apply only the bundles you want:
|
|
@@ -130,7 +133,7 @@ Apply only the bundles you want:
|
|
|
130
133
|
npx claudex-setup apply --plan claudex-plan.json --only claude-md,hooks
|
|
131
134
|
```
|
|
132
135
|
|
|
133
|
-
`apply` creates rollback manifests and activity artifacts under `.claude/claudex-setup/`, so every applied batch has a paper trail and a
|
|
136
|
+
`apply` creates rollback manifests and activity artifacts under `.claude/claudex-setup/`, so every applied batch has a paper trail and a create-or-patch rollback path.
|
|
134
137
|
|
|
135
138
|
## Governance And Pilot Readiness
|
|
136
139
|
|
|
@@ -145,8 +148,24 @@ It exposes:
|
|
|
145
148
|
- permission profiles: `read-only`, `suggest-only`, `safe-write`, `power-user`, `internal-research`
|
|
146
149
|
- hook registry with trigger point, purpose, side effects, risk, and rollback path
|
|
147
150
|
- policy packs for baseline engineering, security-sensitive repos, OSS, and regulated-lite teams
|
|
151
|
+
- domain packs for backend, frontend, data, infra, OSS, and enterprise-governed repos
|
|
152
|
+
- MCP packs for live docs and framework-aware tooling such as Context7 and Next.js devtools
|
|
148
153
|
- a pilot rollout kit with scope, approvals, success metrics, and rollback expectations
|
|
149
154
|
|
|
155
|
+
## Domain Packs And MCP Packs
|
|
156
|
+
|
|
157
|
+
`augment` and `suggest-only` now recommend repo-shaped guidance instead of giving every project the same advice.
|
|
158
|
+
|
|
159
|
+
- domain packs identify the repo shape: `backend-api`, `frontend-ui`, `data-pipeline`, `infra-platform`, `oss-library`, `enterprise-governed`
|
|
160
|
+
- MCP packs recommend current-tooling companions: `context7-docs` for live docs, `next-devtools` for Next.js repos
|
|
161
|
+
- write-capable flows can merge MCP packs directly into `.claude/settings.json`
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
npx claudex-setup suggest-only --json
|
|
165
|
+
npx claudex-setup setup --mcp-pack context7-docs
|
|
166
|
+
npx claudex-setup apply --plan claudex-plan.json --only hooks --mcp-pack context7-docs,next-devtools
|
|
167
|
+
```
|
|
168
|
+
|
|
150
169
|
## Benchmark And Evidence
|
|
151
170
|
|
|
152
171
|
Use `benchmark` to measure the impact of starter-safe improvements without modifying your working repo:
|
|
@@ -160,9 +179,11 @@ Benchmark mode:
|
|
|
160
179
|
- runs a baseline audit on your repo
|
|
161
180
|
- copies the repo to an isolated temp workspace
|
|
162
181
|
- applies starter-safe artifacts only in the copy
|
|
163
|
-
- reruns the audit and emits before/after deltas, a case-study summary, and an executive recommendation
|
|
182
|
+
- reruns the audit and emits before/after deltas, workflow-evidence coverage, a case-study summary, and an executive recommendation
|
|
183
|
+
|
|
184
|
+
## 62 Checks Across 14 Categories
|
|
164
185
|
|
|
165
|
-
|
|
186
|
+
The exact applicable count can be lower on a given repo because stack-specific checks are skipped when they do not apply.
|
|
166
187
|
|
|
167
188
|
| Category | Checks | Key items |
|
|
168
189
|
|----------|-------:|-----------|
|
|
@@ -206,7 +227,7 @@ jobs:
|
|
|
206
227
|
runs-on: ubuntu-latest
|
|
207
228
|
steps:
|
|
208
229
|
- uses: actions/checkout@v4
|
|
209
|
-
- uses: DnaFin/claudex-setup@
|
|
230
|
+
- uses: DnaFin/claudex-setup@v1.9.0
|
|
210
231
|
with:
|
|
211
232
|
threshold: 50
|
|
212
233
|
```
|
|
@@ -230,7 +251,7 @@ Already have a solid CLAUDE.md and hooks? Two things for you:
|
|
|
230
251
|
npx claudex-setup deep-review
|
|
231
252
|
```
|
|
232
253
|
|
|
233
|
-
Claude reads your actual config and gives specific feedback: what's strong, what has issues, what's missing for your stack.
|
|
254
|
+
Claude reads your actual config and gives specific feedback: what's strong, what has issues, what's missing for your stack. This is an AI-assisted review, not a local heuristic audit. Your config goes to the Anthropic API only when you run this command; we do not receive it.
|
|
234
255
|
|
|
235
256
|
### Quality-Deep Checks
|
|
236
257
|
|
|
@@ -252,8 +273,9 @@ These checks evaluate **quality**, not just existence. A well-configured project
|
|
|
252
273
|
|
|
253
274
|
## Privacy
|
|
254
275
|
|
|
255
|
-
- **Zero dependencies** - nothing to audit
|
|
256
|
-
- **
|
|
276
|
+
- **Zero dependencies** - nothing extra to audit
|
|
277
|
+
- **Core flows run locally** - audit, setup, augment, plan, apply, governance, and benchmark run on your machine
|
|
278
|
+
- **Deep review is opt-in** - only `deep-review` sends selected config to Anthropic for analysis
|
|
257
279
|
- **Benchmark uses an isolated temp copy** - your live repo is not touched
|
|
258
280
|
- **Anonymous insights** - opt-in, no PII, no file contents (enable with `--insights`)
|
|
259
281
|
- **MIT Licensed** - use anywhere
|
package/bin/cli.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const { audit } = require('../src/audit');
|
|
4
4
|
const { setup } = require('../src/setup');
|
|
5
|
-
const { analyzeProject, printAnalysis } = require('../src/analyze');
|
|
5
|
+
const { analyzeProject, printAnalysis, exportMarkdown } = require('../src/analyze');
|
|
6
6
|
const { buildProposalBundle, printProposalBundle, writePlanFile, applyProposalBundle, printApplyResult } = require('../src/plans');
|
|
7
|
-
const { getGovernanceSummary, printGovernanceSummary } = require('../src/governance');
|
|
7
|
+
const { getGovernanceSummary, printGovernanceSummary, ensureWritableProfile } = require('../src/governance');
|
|
8
8
|
const { runBenchmark, printBenchmark, writeBenchmarkReport } = require('../src/benchmark');
|
|
9
9
|
const { version } = require('../package.json');
|
|
10
10
|
|
|
@@ -58,12 +58,14 @@ function parseArgs(rawArgs) {
|
|
|
58
58
|
let out = null;
|
|
59
59
|
let planFile = null;
|
|
60
60
|
let only = [];
|
|
61
|
+
let profile = 'safe-write';
|
|
62
|
+
let mcpPacks = [];
|
|
61
63
|
let commandSet = false;
|
|
62
64
|
|
|
63
65
|
for (let i = 0; i < rawArgs.length; i++) {
|
|
64
66
|
const arg = rawArgs[i];
|
|
65
67
|
|
|
66
|
-
if (arg === '--threshold' || arg === '--out' || arg === '--plan' || arg === '--only') {
|
|
68
|
+
if (arg === '--threshold' || arg === '--out' || arg === '--plan' || arg === '--only' || arg === '--profile' || arg === '--mcp-pack') {
|
|
67
69
|
const value = rawArgs[i + 1];
|
|
68
70
|
if (!value || value.startsWith('--')) {
|
|
69
71
|
throw new Error(`${arg} requires a value`);
|
|
@@ -72,6 +74,8 @@ function parseArgs(rawArgs) {
|
|
|
72
74
|
if (arg === '--out') out = value;
|
|
73
75
|
if (arg === '--plan') planFile = value;
|
|
74
76
|
if (arg === '--only') only = value.split(',').map(item => item.trim()).filter(Boolean);
|
|
77
|
+
if (arg === '--profile') profile = value.trim();
|
|
78
|
+
if (arg === '--mcp-pack') mcpPacks = value.split(',').map(item => item.trim()).filter(Boolean);
|
|
75
79
|
i++;
|
|
76
80
|
continue;
|
|
77
81
|
}
|
|
@@ -96,6 +100,16 @@ function parseArgs(rawArgs) {
|
|
|
96
100
|
continue;
|
|
97
101
|
}
|
|
98
102
|
|
|
103
|
+
if (arg.startsWith('--profile=')) {
|
|
104
|
+
profile = arg.split('=').slice(1).join('=').trim();
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (arg.startsWith('--mcp-pack=')) {
|
|
109
|
+
mcpPacks = arg.split('=').slice(1).join('=').split(',').map(item => item.trim()).filter(Boolean);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
|
|
99
113
|
if (arg.startsWith('--')) {
|
|
100
114
|
flags.push(arg);
|
|
101
115
|
continue;
|
|
@@ -109,13 +123,13 @@ function parseArgs(rawArgs) {
|
|
|
109
123
|
|
|
110
124
|
const normalizedCommand = COMMAND_ALIASES[command] || command;
|
|
111
125
|
|
|
112
|
-
return { flags, command, normalizedCommand, threshold, out, planFile, only };
|
|
126
|
+
return { flags, command, normalizedCommand, threshold, out, planFile, only, profile, mcpPacks };
|
|
113
127
|
}
|
|
114
128
|
|
|
115
129
|
const HELP = `
|
|
116
130
|
claudex-setup v${version}
|
|
117
131
|
Audit and optimize any project for Claude Code.
|
|
118
|
-
Backed by research
|
|
132
|
+
Backed by CLAUDEX research and evidence.
|
|
119
133
|
|
|
120
134
|
Usage:
|
|
121
135
|
npx claudex-setup Run audit on current directory
|
|
@@ -140,6 +154,8 @@ const HELP = `
|
|
|
140
154
|
--out FILE Write JSON or markdown output to a file
|
|
141
155
|
--plan FILE Load a previously exported plan file
|
|
142
156
|
--only A,B Limit plan/apply to selected proposal ids or technique keys
|
|
157
|
+
--profile NAME Choose permission profile (read-only, suggest-only, safe-write, power-user, internal-research)
|
|
158
|
+
--mcp-pack A,B Merge named MCP packs into generated settings (e.g. context7-docs,next-devtools)
|
|
143
159
|
--dry-run Preview apply without writing files
|
|
144
160
|
--verbose Show all recommendations (not just critical/high)
|
|
145
161
|
--json Output as JSON (for CI pipelines)
|
|
@@ -153,7 +169,11 @@ const HELP = `
|
|
|
153
169
|
npx claudex-setup augment
|
|
154
170
|
npx claudex-setup suggest-only --json
|
|
155
171
|
npx claudex-setup plan --out claudex-plan.json
|
|
172
|
+
npx claudex-setup plan --profile safe-write
|
|
173
|
+
npx claudex-setup setup --mcp-pack context7-docs
|
|
156
174
|
npx claudex-setup apply --plan claudex-plan.json --only hooks,commands
|
|
175
|
+
npx claudex-setup apply --mcp-pack context7-docs,next-devtools --only hooks
|
|
176
|
+
npx claudex-setup apply --profile power-user --only claude-md,hooks
|
|
157
177
|
npx claudex-setup governance --json
|
|
158
178
|
npx claudex-setup benchmark --out benchmark.md
|
|
159
179
|
npx claudex-setup --json --threshold 60
|
|
@@ -195,6 +215,8 @@ async function main() {
|
|
|
195
215
|
out: parsed.out,
|
|
196
216
|
planFile: parsed.planFile,
|
|
197
217
|
only: parsed.only,
|
|
218
|
+
profile: parsed.profile,
|
|
219
|
+
mcpPacks: parsed.mcpPacks,
|
|
198
220
|
dir: process.cwd()
|
|
199
221
|
};
|
|
200
222
|
|
|
@@ -219,6 +241,15 @@ async function main() {
|
|
|
219
241
|
process.exit(1);
|
|
220
242
|
}
|
|
221
243
|
|
|
244
|
+
if (['setup', 'apply', 'benchmark'].includes(normalizedCommand)) {
|
|
245
|
+
try {
|
|
246
|
+
ensureWritableProfile(options.profile, normalizedCommand, options.dryRun);
|
|
247
|
+
} catch (err) {
|
|
248
|
+
console.error(`\n Error: ${err.message}\n`);
|
|
249
|
+
process.exit(1);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
222
253
|
try {
|
|
223
254
|
if (normalizedCommand === 'badge') {
|
|
224
255
|
const { getBadgeMarkdown } = require('../src/badge');
|
|
@@ -264,6 +295,12 @@ async function main() {
|
|
|
264
295
|
return; // keep process alive for http
|
|
265
296
|
} else if (normalizedCommand === 'augment' || normalizedCommand === 'suggest-only') {
|
|
266
297
|
const report = await analyzeProject({ ...options, mode: normalizedCommand });
|
|
298
|
+
if (options.out && !options.json) {
|
|
299
|
+
const fs = require('fs');
|
|
300
|
+
const md = exportMarkdown(report);
|
|
301
|
+
fs.writeFileSync(options.out, md, 'utf8');
|
|
302
|
+
console.log(`\n Report exported to ${options.out}\n`);
|
|
303
|
+
}
|
|
267
304
|
printAnalysis(report, options);
|
|
268
305
|
} else if (normalizedCommand === 'plan') {
|
|
269
306
|
const bundle = await buildProposalBundle(options);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudex-setup",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Audit and
|
|
3
|
+
"version": "1.9.0",
|
|
4
|
+
"description": "Audit and improve Claude Code readiness with discover, plan, apply, governance, and benchmark workflows.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"claudex-setup": "bin/cli.js"
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
16
|
"start": "node bin/cli.js",
|
|
17
|
+
"build": "npm pack --dry-run",
|
|
17
18
|
"test": "node test/run.js"
|
|
18
19
|
},
|
|
19
20
|
"keywords": [
|
package/src/analyze.js
CHANGED
|
@@ -7,6 +7,8 @@ const path = require('path');
|
|
|
7
7
|
const { audit } = require('./audit');
|
|
8
8
|
const { ProjectContext } = require('./context');
|
|
9
9
|
const { STACKS } = require('./techniques');
|
|
10
|
+
const { detectDomainPacks } = require('./domain-packs');
|
|
11
|
+
const { recommendMcpPacks } = require('./mcp-packs');
|
|
10
12
|
|
|
11
13
|
const COLORS = {
|
|
12
14
|
reset: '\x1b[0m',
|
|
@@ -168,6 +170,30 @@ function moduleFromCategory(category) {
|
|
|
168
170
|
return map[category] || category;
|
|
169
171
|
}
|
|
170
172
|
|
|
173
|
+
const STRENGTH_REASONS = {
|
|
174
|
+
claudeMd: 'Foundation of Claude workflow. Every session benefits from this.',
|
|
175
|
+
mermaidArchitecture: 'Architecture diagram saves 73% tokens vs prose — high-value asset.',
|
|
176
|
+
verificationLoop: 'Claude can self-verify, catching errors before human review.',
|
|
177
|
+
hooks: 'Automated enforcement (100% vs 80% from instructions alone).',
|
|
178
|
+
hooksInSettings: 'Hook registration in settings ensures consistent automation.',
|
|
179
|
+
preToolUseHook: 'Pre-execution validation adds a safety layer.',
|
|
180
|
+
postToolUseHook: 'Post-execution automation catches issues immediately.',
|
|
181
|
+
sessionStartHook: 'Session initialization ensures consistent starting state.',
|
|
182
|
+
customCommands: 'Reusable workflows encoded as one-liner commands.',
|
|
183
|
+
settingsPermissions: 'Explicit permissions prevent accidental dangerous operations.',
|
|
184
|
+
permissionDeny: 'Deny rules block risky operations at the system level.',
|
|
185
|
+
pathRules: 'Scoped rules ensure different code areas get appropriate guidance.',
|
|
186
|
+
fewShotExamples: 'Code examples guide Claude to match your conventions.',
|
|
187
|
+
constraintBlocks: 'XML constraint blocks improve rule adherence by 40%.',
|
|
188
|
+
xmlTags: 'Structured prompt sections improve consistency.',
|
|
189
|
+
context7Mcp: 'Real-time docs eliminate version-mismatch hallucinations.',
|
|
190
|
+
mcpServers: 'External tool integration extends Claude capabilities.',
|
|
191
|
+
compactionAwareness: 'Context management keeps sessions efficient.',
|
|
192
|
+
agents: 'Specialized agents delegate complex tasks effectively.',
|
|
193
|
+
noSecretsInClaude: 'No secrets in config — good security hygiene.',
|
|
194
|
+
gitIgnoreEnv: 'Environment files are properly excluded from git.',
|
|
195
|
+
};
|
|
196
|
+
|
|
171
197
|
function toStrengths(results) {
|
|
172
198
|
return results
|
|
173
199
|
.filter(r => r.passed === true)
|
|
@@ -175,15 +201,30 @@ function toStrengths(results) {
|
|
|
175
201
|
const order = { critical: 3, high: 2, medium: 1, low: 0 };
|
|
176
202
|
return (order[b.impact] || 0) - (order[a.impact] || 0);
|
|
177
203
|
})
|
|
178
|
-
.slice(0,
|
|
204
|
+
.slice(0, 8)
|
|
179
205
|
.map(r => ({
|
|
180
206
|
key: r.key,
|
|
181
207
|
name: r.name,
|
|
182
208
|
category: r.category,
|
|
183
|
-
|
|
209
|
+
why: STRENGTH_REASONS[r.key] || `Already configured and working: ${r.name}.`,
|
|
184
210
|
}));
|
|
185
211
|
}
|
|
186
212
|
|
|
213
|
+
const GAP_REASONS = {
|
|
214
|
+
noBypassPermissions: 'bypassPermissions skips all safety checks. Use explicit allow rules for control without risk.',
|
|
215
|
+
secretsProtection: 'Without deny rules for .env, Claude can read secrets and potentially expose them in outputs.',
|
|
216
|
+
testCommand: 'Without a test command, Claude cannot verify its changes work before you review them.',
|
|
217
|
+
lintCommand: 'Without a lint command, Claude may produce inconsistently formatted code.',
|
|
218
|
+
buildCommand: 'Without a build command, Claude cannot catch compilation errors early.',
|
|
219
|
+
ciPipeline: 'CI ensures every change is automatically tested. Without it, bugs reach main branch faster.',
|
|
220
|
+
securityReview: 'Claude Code has built-in OWASP Top 10 scanning. Not using it leaves vulnerabilities undetected.',
|
|
221
|
+
skills: 'Skills encode domain expertise as reusable components. Without them, you repeat context every session.',
|
|
222
|
+
multipleAgents: 'Multiple agents enable parallel specialized work (security review + code writing simultaneously).',
|
|
223
|
+
multipleMcpServers: 'More MCP servers give Claude access to more external context (docs, databases, APIs).',
|
|
224
|
+
roleDefinition: 'A role definition helps Claude calibrate response depth and technical level.',
|
|
225
|
+
importSyntax: '@import keeps CLAUDE.md lean while still providing deep instructions in focused modules.',
|
|
226
|
+
};
|
|
227
|
+
|
|
187
228
|
function toGaps(results) {
|
|
188
229
|
return results
|
|
189
230
|
.filter(r => r.passed === false)
|
|
@@ -198,6 +239,7 @@ function toGaps(results) {
|
|
|
198
239
|
impact: r.impact,
|
|
199
240
|
category: r.category,
|
|
200
241
|
fix: r.fix,
|
|
242
|
+
why: GAP_REASONS[r.key] || r.fix,
|
|
201
243
|
}));
|
|
202
244
|
}
|
|
203
245
|
|
|
@@ -275,6 +317,8 @@ async function analyzeProject(options) {
|
|
|
275
317
|
const metadata = detectProjectMetadata(ctx);
|
|
276
318
|
const maturity = detectMaturity(assets);
|
|
277
319
|
const mainDirs = detectMainDirs(ctx);
|
|
320
|
+
const recommendedDomainPacks = detectDomainPacks(ctx, stacks, assets);
|
|
321
|
+
const recommendedMcpPacks = recommendMcpPacks(stacks, recommendedDomainPacks);
|
|
278
322
|
|
|
279
323
|
const report = {
|
|
280
324
|
mode,
|
|
@@ -284,6 +328,7 @@ async function analyzeProject(options) {
|
|
|
284
328
|
description: metadata.description,
|
|
285
329
|
directory: options.dir,
|
|
286
330
|
stacks: stacks.map(s => s.label),
|
|
331
|
+
domains: recommendedDomainPacks.map(pack => pack.label),
|
|
287
332
|
maturity,
|
|
288
333
|
score: auditResult.score,
|
|
289
334
|
organicScore: auditResult.organicScore,
|
|
@@ -308,6 +353,8 @@ async function analyzeProject(options) {
|
|
|
308
353
|
gapsIdentified: toGaps(auditResult.results),
|
|
309
354
|
topNextActions: auditResult.quickWins,
|
|
310
355
|
recommendedImprovements: toRecommendations(auditResult),
|
|
356
|
+
recommendedDomainPacks,
|
|
357
|
+
recommendedMcpPacks,
|
|
311
358
|
riskNotes: buildRiskNotes(auditResult, assets, maturity),
|
|
312
359
|
optionalModules: buildOptionalModules(stacks, assets),
|
|
313
360
|
};
|
|
@@ -332,6 +379,7 @@ function printAnalysis(report, options = {}) {
|
|
|
332
379
|
console.log(c(' Project Summary', 'blue'));
|
|
333
380
|
console.log(` ${report.projectSummary.name}${report.projectSummary.description ? ` — ${report.projectSummary.description}` : ''}`);
|
|
334
381
|
console.log(c(` Stack: ${report.projectSummary.stacks.join(', ') || 'Unknown'}`, 'dim'));
|
|
382
|
+
console.log(c(` Domain packs: ${report.projectSummary.domains.join(', ') || 'Baseline General'}`, 'dim'));
|
|
335
383
|
console.log(c(` Maturity: ${report.projectSummary.maturity} | Score: ${report.projectSummary.score}/100 | Organic: ${report.projectSummary.organicScore}/100`, 'dim'));
|
|
336
384
|
console.log('');
|
|
337
385
|
|
|
@@ -348,7 +396,10 @@ function printAnalysis(report, options = {}) {
|
|
|
348
396
|
if (report.strengthsPreserved.length > 0) {
|
|
349
397
|
console.log(c(' Strengths Preserved', 'green'));
|
|
350
398
|
for (const item of report.strengthsPreserved) {
|
|
351
|
-
console.log(`
|
|
399
|
+
console.log(` ${c('✓', 'green')} ${item.name}`);
|
|
400
|
+
if (item.why) {
|
|
401
|
+
console.log(c(` ${item.why}`, 'dim'));
|
|
402
|
+
}
|
|
352
403
|
}
|
|
353
404
|
console.log('');
|
|
354
405
|
}
|
|
@@ -371,6 +422,24 @@ function printAnalysis(report, options = {}) {
|
|
|
371
422
|
console.log('');
|
|
372
423
|
}
|
|
373
424
|
|
|
425
|
+
if (report.recommendedDomainPacks.length > 0) {
|
|
426
|
+
console.log(c(' Recommended Domain Packs', 'blue'));
|
|
427
|
+
for (const pack of report.recommendedDomainPacks) {
|
|
428
|
+
console.log(` - ${pack.label}`);
|
|
429
|
+
console.log(c(` ${pack.useWhen}`, 'dim'));
|
|
430
|
+
}
|
|
431
|
+
console.log('');
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
if (report.recommendedMcpPacks.length > 0) {
|
|
435
|
+
console.log(c(' Recommended MCP Packs', 'blue'));
|
|
436
|
+
for (const pack of report.recommendedMcpPacks) {
|
|
437
|
+
console.log(` - ${pack.label}`);
|
|
438
|
+
console.log(c(` ${pack.adoption}`, 'dim'));
|
|
439
|
+
}
|
|
440
|
+
console.log('');
|
|
441
|
+
}
|
|
442
|
+
|
|
374
443
|
if (report.riskNotes.length > 0) {
|
|
375
444
|
console.log(c(' Risk Notes', 'red'));
|
|
376
445
|
for (const note of report.riskNotes) {
|
|
@@ -394,4 +463,87 @@ function printAnalysis(report, options = {}) {
|
|
|
394
463
|
}
|
|
395
464
|
}
|
|
396
465
|
|
|
397
|
-
|
|
466
|
+
function exportMarkdown(report) {
|
|
467
|
+
const lines = [];
|
|
468
|
+
lines.push(`# Claudex Setup Analysis Report`);
|
|
469
|
+
lines.push(`## ${report.mode === 'suggest-only' ? 'Suggest-Only' : 'Augment'} Mode`);
|
|
470
|
+
lines.push('');
|
|
471
|
+
lines.push(`**Project:** ${report.projectSummary.name}${report.projectSummary.description ? ` — ${report.projectSummary.description}` : ''}`);
|
|
472
|
+
lines.push(`**Date:** ${new Date().toISOString().split('T')[0]}`);
|
|
473
|
+
lines.push(`**Score:** ${report.projectSummary.score}/100 | **Organic:** ${report.projectSummary.organicScore}/100`);
|
|
474
|
+
lines.push(`**Stacks:** ${report.projectSummary.stacks.join(', ') || 'None detected'}`);
|
|
475
|
+
lines.push(`**Domain Packs:** ${report.projectSummary.domains.join(', ') || 'Baseline General'}`);
|
|
476
|
+
lines.push(`**Maturity:** ${report.projectSummary.maturity}`);
|
|
477
|
+
lines.push('');
|
|
478
|
+
|
|
479
|
+
if (report.strengthsPreserved.length > 0) {
|
|
480
|
+
lines.push('## Strengths Preserved');
|
|
481
|
+
lines.push('');
|
|
482
|
+
for (const item of report.strengthsPreserved) {
|
|
483
|
+
lines.push(`- **${item.name}** — ${item.why || 'Already configured.'}`);
|
|
484
|
+
}
|
|
485
|
+
lines.push('');
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if (report.gapsIdentified.length > 0) {
|
|
489
|
+
lines.push('## Gaps Identified');
|
|
490
|
+
lines.push('');
|
|
491
|
+
lines.push('| Gap | Impact | Fix |');
|
|
492
|
+
lines.push('|-----|--------|-----|');
|
|
493
|
+
for (const item of report.gapsIdentified) {
|
|
494
|
+
lines.push(`| ${item.name} | ${item.impact} | ${item.fix} |`);
|
|
495
|
+
}
|
|
496
|
+
lines.push('');
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
if (report.topNextActions.length > 0) {
|
|
500
|
+
lines.push('## Top Next Actions');
|
|
501
|
+
lines.push('');
|
|
502
|
+
report.topNextActions.slice(0, 5).forEach((item, index) => {
|
|
503
|
+
lines.push(`${index + 1}. **${item.name}** — ${item.fix}`);
|
|
504
|
+
});
|
|
505
|
+
lines.push('');
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (report.recommendedDomainPacks.length > 0) {
|
|
509
|
+
lines.push('## Recommended Domain Packs');
|
|
510
|
+
lines.push('');
|
|
511
|
+
for (const pack of report.recommendedDomainPacks) {
|
|
512
|
+
lines.push(`- **${pack.label}**: ${pack.useWhen}`);
|
|
513
|
+
}
|
|
514
|
+
lines.push('');
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
if (report.recommendedMcpPacks.length > 0) {
|
|
518
|
+
lines.push('## Recommended MCP Packs');
|
|
519
|
+
lines.push('');
|
|
520
|
+
for (const pack of report.recommendedMcpPacks) {
|
|
521
|
+
lines.push(`- **${pack.label}**: ${pack.useWhen}`);
|
|
522
|
+
}
|
|
523
|
+
lines.push('');
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
if (report.riskNotes.length > 0) {
|
|
527
|
+
lines.push('## Risk Notes');
|
|
528
|
+
lines.push('');
|
|
529
|
+
for (const note of report.riskNotes) {
|
|
530
|
+
lines.push(`- ⚠️ ${note}`);
|
|
531
|
+
}
|
|
532
|
+
lines.push('');
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (report.suggestedRolloutOrder.length > 0) {
|
|
536
|
+
lines.push('## Suggested Rollout Order');
|
|
537
|
+
lines.push('');
|
|
538
|
+
report.suggestedRolloutOrder.forEach((item, index) => {
|
|
539
|
+
lines.push(`${index + 1}. ${item}`);
|
|
540
|
+
});
|
|
541
|
+
lines.push('');
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
lines.push('---');
|
|
545
|
+
lines.push(`*Generated by claudex-setup v${require('../package.json').version}*`);
|
|
546
|
+
return lines.join('\n');
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
module.exports = { analyzeProject, printAnalysis, exportMarkdown };
|
package/src/audit.js
CHANGED
|
@@ -194,7 +194,7 @@ async function audit(options) {
|
|
|
194
194
|
console.log(` ${colorize(`${passed.length}/${applicable.length}`, 'bold')} checks passing${skipped.length > 0 ? colorize(` (${skipped.length} not applicable)`, 'dim') : ''}`);
|
|
195
195
|
|
|
196
196
|
if (failed.length > 0) {
|
|
197
|
-
console.log(` Run ${colorize('npx claudex-setup setup', 'bold')} to
|
|
197
|
+
console.log(` Run ${colorize('npx claudex-setup setup', 'bold')} to create starter-safe defaults`);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
console.log('');
|
|
@@ -212,7 +212,7 @@ async function audit(options) {
|
|
|
212
212
|
console.log('');
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
console.log(colorize('
|
|
215
|
+
console.log(colorize(' Backed by CLAUDEX research and evidence', 'dim'));
|
|
216
216
|
console.log(colorize(' https://github.com/DnaFin/claudex-setup', 'dim'));
|
|
217
217
|
console.log('');
|
|
218
218
|
|