@nerviq/cli 0.9.6 → 1.0.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.
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Certification system for Nerviq.
3
+ * Evaluates a project against all active platforms and assigns a certification level.
4
+ */
5
+
6
+ const path = require('path');
7
+ const { audit } = require('./audit');
8
+ const { harmonyAudit } = require('./harmony/audit');
9
+ const { detectPlatforms } = require('./public-api');
10
+
11
+ const LEVELS = {
12
+ GOLD: 'Nerviq Certified Gold',
13
+ SILVER: 'Nerviq Certified Silver',
14
+ BRONZE: 'Nerviq Certified Bronze',
15
+ NONE: 'Not Certified',
16
+ };
17
+
18
+ const BADGE_COLORS = {
19
+ [LEVELS.GOLD]: 'gold',
20
+ [LEVELS.SILVER]: 'silver',
21
+ [LEVELS.BRONZE]: 'cd7f32',
22
+ [LEVELS.NONE]: 'lightgrey',
23
+ };
24
+
25
+ /**
26
+ * Certify a project directory.
27
+ * Runs harmony audit and per-platform audits, then determines certification level.
28
+ *
29
+ * @param {string} dir - Project directory path
30
+ * @returns {Promise<{ level: string, harmonyScore: number, platformScores: Object, badge: string }>}
31
+ */
32
+ async function certifyProject(dir) {
33
+ const resolvedDir = path.resolve(dir || '.');
34
+
35
+ // Detect active platforms
36
+ const platforms = detectPlatforms(resolvedDir);
37
+
38
+ // Run per-platform audits
39
+ const platformScores = {};
40
+ for (const platform of platforms) {
41
+ try {
42
+ const result = await audit({ dir: resolvedDir, platform, silent: true });
43
+ platformScores[platform] = result.score;
44
+ } catch {
45
+ platformScores[platform] = 0;
46
+ }
47
+ }
48
+
49
+ // Run harmony audit
50
+ let harmonyScore = 0;
51
+ try {
52
+ const harmonyResult = await harmonyAudit({ dir: resolvedDir, silent: true });
53
+ harmonyScore = harmonyResult.harmonyScore || 0;
54
+ } catch {
55
+ harmonyScore = 0;
56
+ }
57
+
58
+ // Determine certification level
59
+ const scores = Object.values(platformScores);
60
+ const allAbove70 = scores.length > 0 && scores.every(s => s >= 70);
61
+ const allAbove50 = scores.length > 0 && scores.every(s => s >= 50);
62
+ const anyAbove40 = scores.some(s => s >= 40);
63
+
64
+ let level;
65
+ if (harmonyScore >= 80 && allAbove70) {
66
+ level = LEVELS.GOLD;
67
+ } else if (harmonyScore >= 60 && allAbove50) {
68
+ level = LEVELS.SILVER;
69
+ } else if (anyAbove40) {
70
+ level = LEVELS.BRONZE;
71
+ } else {
72
+ level = LEVELS.NONE;
73
+ }
74
+
75
+ const badge = generateCertBadge(level);
76
+
77
+ return {
78
+ level,
79
+ harmonyScore,
80
+ platformScores,
81
+ platforms,
82
+ badge,
83
+ };
84
+ }
85
+
86
+ /**
87
+ * Generate a shields.io badge markdown string for a certification level.
88
+ *
89
+ * @param {string} level - One of the LEVELS values
90
+ * @returns {string} Markdown badge string
91
+ */
92
+ function generateCertBadge(level) {
93
+ const color = BADGE_COLORS[level] || 'lightgrey';
94
+ const label = encodeURIComponent('Nerviq');
95
+ const message = encodeURIComponent(level);
96
+ const url = `https://img.shields.io/badge/${label}-${message}-${color}`;
97
+ return `[![${level}](${url})](https://nerviq.net)`;
98
+ }
99
+
100
+ module.exports = { certifyProject, generateCertBadge, LEVELS };
package/CHANGELOG.md DELETED
@@ -1,181 +0,0 @@
1
- # Changelog
2
-
3
- ## [1.16.2] - 2026-04-03
4
-
5
- ### Changed
6
- - bumped the local release line to `1.16.2` so the next publish does not overwrite the already-live `1.16.1` npm release
7
- - synchronized README, docs, launch copy, and proof-facing state to distinguish clearly between public npm latest (`1.16.1`) and local release prep (`1.16.2`)
8
-
9
- ### Fixed
10
- - release-truth drift across package metadata, docs, and public-facing proof references
11
-
12
- ## [1.16.1] - 2026-04-03
13
-
14
- ### Added
15
- - `feedback` command validation on the public npm package line
16
- - stronger secret detection coverage for Anthropic-style keys
17
- - deep-review sanitization and secret redaction hardening
18
- - watch-mode resilience improvements across recursive and non-recursive platforms
19
-
20
- ### Changed
21
- - increased verified check count from `84` to `85`
22
- - proof-backed product copy and case-study traceability improvements
23
-
24
- ## [1.10.3] - 2026-04-02
25
-
26
- ### Added
27
- - `--snapshot` support for `audit`, `augment`, `suggest-only`, `benchmark`, and `governance`, writing normalized evidence artifacts under `.claude/claudex-setup/snapshots/`
28
- - shared snapshot history via `index.json` so before/after work can accumulate into a single local evidence spine
29
- - `governance --out governance.md` for a shareable governance / pilot-readiness artifact
30
- - packaged Claude-native `audit-repo` skill template under `content/claude-code/audit-repo/`
31
- - lightweight release checklist in `content/release-checklist.md`
32
-
33
- ### Changed
34
- - default audit now surfaces `Top 5 Next Actions` with rationale, traceability, risk, confidence, and a suggested next command
35
- - `--lite` now gives a shorter beginner-first top-3 quick scan
36
- - README and docs now reflect snapshot artifacts, governance export, and the Claude-native skill path
37
- - packaged content and public-facing counts are now aligned with the current CLAUDEX state
38
-
39
- ## [1.14.0] - 2026-04-03
40
-
41
- ### Added
42
- - Check-level test matrix: 327 verified scenarios across all 84 checks
43
- - Golden matrix: 12 repo profile tests with expected results
44
-
45
- ### Fixed
46
- - `hooks` check now detects hooks in settings.json (not only .claude/hooks/ dir)
47
- - `context7Mcp` check now reads .mcp.json
48
- - `skillUsesPaths` now traverses skill subdirectories (skills/name/SKILL.md)
49
- - `lintCommand` now matches npm/yarn/pnpm/bun lint commands
50
-
51
- ## [1.13.0] - 2026-04-03
52
-
53
- ### Added
54
- - 10 new checks (74→84): project description, directory structure, multiple hook types, stop-failure hook, skill paths, MCP env config, gitignore local settings, .env.example, package scripts, type checking
55
- - 15 new tests (58→73): history/compare/trend, new checks structure, CLI commands, deny depth, negative instructions, --require flag
56
- - All references updated to 74→84 checks
57
-
58
- ## [1.12.0] - 2026-04-03
59
-
60
- ### Added
61
- - 12 new checks (62→74): test coverage, agent tool restrictions, auto-memory, sandbox, deny rule depth, git attribution, effort level, snapshot history, worktree, negative instructions, output style, CI variants
62
- - 8 new stacks (22→30): Deno, Bun, Elixir, Astro, Remix, NestJS, Laravel, .NET
63
- - Deeper domain detection: llamaindex, crewai, autogen, ollama for AI/ML; paypal, square, adyen, medusa for ecommerce; chromatic, style-dictionary for design; capacitor, ionic for mobile
64
-
65
- ### Fixed
66
- - `githubActionsOrCI` check used non-existent `ctx.hasFile()` — now uses `ctx.fileContent()`
67
- - `.NET` stack detection no longer uses glob patterns
68
-
69
- ## [1.11.0] - 2026-04-03
70
-
71
- ### Added
72
- - `history` command — show score timeline from saved snapshots
73
- - `compare` command — diff latest vs previous snapshot with delta, regressions, improvements
74
- - `trend --out report.md` — export trend report as shareable markdown
75
- - `--require A,B` CI flag — exit code 1 if named checks fail (policy guardrails)
76
- - Agentic DX positioning in README
77
- - Real results table (4 case studies) in README
78
- - Claude-native integration guide (skill, hook, agent examples)
79
- - Trust-first help text reordering
80
-
81
- ### Fixed
82
- - Hook checks (hooksInSettings, preToolUse, postToolUse, sessionStart) now OR across settings.json and settings.local.json
83
-
84
- ## [1.10.2] - 2026-04-02
85
-
86
- ### Fixed
87
- - MCP recommendations are now less speculative: `postgres-mcp` requires explicit Postgres signals, `figma-mcp` only appears for design-system repos, and `mcp-security` is no longer auto-added just because multiple packs were suggested
88
- - `sentry-mcp` now requires real observability signals or stricter operational domains instead of appearing for every frontend/backend repo
89
- - design-system detection now respects `.storybook/` directories directly, improving frontend pack accuracy
90
-
91
- ### Added
92
- - MCP preflight warnings for `setup`, `plan`, and `apply` when selected packs require missing environment variables
93
- - user-facing docs now reflect the actual 22 detected stacks
94
-
95
- ## [1.10.1] - 2026-04-02
96
-
97
- ### Fixed
98
- - corrected MCP pack package names to verified npm packages
99
- - aligned settings hierarchy checks with shared settings precedence
100
-
101
- ## [1.10.0] - 2026-04-01
102
-
103
- ### Added
104
- - 11 new MCP packs (15→26): sequential-thinking, jira-confluence, ga4-analytics, search-console, n8n-workflows, zendesk, infisical-secrets, shopify, huggingface, blender, wordpress
105
- - 7 new domain packs (10→17→16 final): ecommerce, ai-ml, devops-cicd, design-system, docs-content, security-focused
106
- - Smart recommendation for all new packs based on detected stack and domain
107
- - Detection logic: Storybook, Docusaurus, Stripe, LangChain, GitHub Actions, auth deps
108
-
109
- ## [1.9.0] - 2026-03-31
110
-
111
- ### Added
112
- - 3 new domain packs: `monorepo`, `mobile`, `regulated-lite` (7→10 total)
113
- - 3 new MCP packs: `github-mcp`, `postgres-mcp`, `memory-mcp` (2→5 total)
114
- - smart MCP pack recommendation based on detected domain packs
115
- - `suggest-only --out report.md` exports full analysis as shareable markdown
116
- - `why` explanations for all strengths preserved (20+ specific reasons)
117
- - `why` explanations for all gap findings (12+ specific reasons)
118
- - 5 new hooks in governance registry: duplicate-id-check, injection-defense, trust-drift-check, session-init, protect-catalog
119
- - case study template in `content/case-study-template.md`
120
- - hook risk level display in governance output (color-coded low/medium/high)
121
-
122
- ### Fixed
123
- - **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
124
- - 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)
125
-
126
- ### Changed
127
- - strengths preserved section now shows 8 items (was 6) with specific value explanations
128
- - claudex-sync.json updated with domain pack, MCP pack, and anti-pattern counts
129
-
130
- ## [1.8.0] - 2026-03-31
131
-
132
- ### Added
133
- - domain pack recommendations for backend, frontend, data, infra, OSS, and enterprise-governed repos
134
- - MCP pack recommendations and merge support for `context7-docs` and `next-devtools`
135
- - workflow-evidence coverage in benchmark reports
136
- - runtime settings overlays so `apply --plan` still respects current `--profile` and `--mcp-pack` flags
137
-
138
- ### Changed
139
- - benchmark now respects the selected profile and MCP pack options during isolated-copy runs
140
- - governance and suggest-only outputs now expose domain packs and MCP packs directly
141
- - README and docs clarify the local-vs-opt-in-network boundary for core flows vs `deep-review`
142
- - audit output now frames `setup` as starter-safe generation instead of an automatic full fix
143
-
144
- ## [1.7.0] - 2026-03-31
145
-
146
- ### Added
147
- - `augment` / `suggest-only` repo-aware analysis with strengths, gaps, top actions, risk notes, and rollout order
148
- - `plan` command for exportable proposal bundles with file previews and diff-style output
149
- - `apply` command for selective starter-safe apply flows with rollback manifests and activity artifacts
150
- - `governance` command with permission profiles, hook registry, policy packs, and pilot rollout guidance
151
- - `benchmark` command that measures before/after impact in an isolated temp copy and exports evidence reports
152
- - claims governance and pilot rollout docs in `content/`
153
-
154
- ### Changed
155
- - `setup` now exposes reusable planning primitives and returns written/preserved file summaries
156
- - CLI now supports `--out`, `--plan`, `--only`, and `--dry-run`
157
- - README and docs now reflect the actual product surface instead of only audit/setup flows
158
- - benchmark and proposal workflows now preserve existing files by default and treat mature repos as review-first
159
-
160
- ## [0.2.0] - 2026-03-31
161
-
162
- ### Added
163
- - 50+ audit checks (up from 16)
164
- - 8 new categories: Design, DevOps, Hygiene, Performance, MCP, Prompting, Git Safety, Automation
165
- - 6 new stack detections: Svelte, Flutter, Ruby, Java, Kotlin, Swift
166
- - Improved CLAUDE.md template with Mermaid diagrams and XML constraints
167
- - Auto-sync with CLAUDEX research catalog (1,107 items)
168
- - Copy-paste config snippets in fix suggestions
169
-
170
- ### Changed
171
- - Knowledge base upgraded from 972 to 1,107 verified techniques
172
- - Better scoring weights per category
173
-
174
- ## [0.1.0] - 2026-03-30
175
-
176
- ### Added
177
- - Initial release
178
- - 16 audit checks
179
- - Automatic setup with CLAUDE.md, hooks, commands, skills, rules, agents
180
- - Stack detection for 12 frameworks
181
- - JSON output mode
@@ -1,91 +0,0 @@
1
- # Case Study: [Project Name]
2
-
3
- ## Overview
4
-
5
- | Field | Value |
6
- |-------|-------|
7
- | Project | [name] |
8
- | Repo type | [e.g., backend API, frontend SPA, monorepo, data pipeline] |
9
- | Team size | [e.g., solo, 3 developers, 15-person team] |
10
- | Prior Claude setup | [none / basic CLAUDE.md / mature .claude/ config] |
11
- | Claudex Setup version | [e.g., 1.9.0] |
12
- | Date | [YYYY-MM-DD] |
13
-
14
- ## Before State
15
-
16
- **Audit score:** [X/100]
17
- **Organic score:** [X/100]
18
-
19
- What existed before running claudex-setup:
20
- - [ ] CLAUDE.md
21
- - [ ] .claude/settings.json
22
- - [ ] Custom commands
23
- - [ ] Rules
24
- - [ ] Hooks
25
- - [ ] Agents
26
- - [ ] MCP servers
27
-
28
- Key observations:
29
- - [What was good already]
30
- - [What was missing]
31
- - [What was risky or misconfigured]
32
-
33
- ## What We Did
34
-
35
- **Mode used:** [discover / starter / augment / plan+apply / suggest-only]
36
-
37
- **Steps:**
38
- 1. Ran `npx claudex-setup discover` to understand current state
39
- 2. [Next step]
40
- 3. [Next step]
41
-
42
- **Domain pack matched:** [e.g., backend-api]
43
- **MCP packs recommended:** [e.g., context7-docs, postgres-mcp]
44
-
45
- ## Changes Applied
46
-
47
- | Change | Type | Risk | Applied? |
48
- |--------|------|------|----------|
49
- | [e.g., Created CLAUDE.md with architecture] | new file | low | yes |
50
- | [e.g., Added hooks for auto-lint] | new config | medium | yes |
51
- | [e.g., Added permission deny rules] | security | low | yes |
52
-
53
- **Strengths preserved:**
54
- - [What we explicitly kept unchanged]
55
-
56
- ## After State
57
-
58
- **Audit score:** [X/100] (was [X/100])
59
- **Organic score:** [X/100] (was [X/100])
60
- **Score improvement:** +[X] points
61
-
62
- ## Measured Impact
63
-
64
- | Metric | Before | After | Change |
65
- |--------|--------|-------|--------|
66
- | Audit score | X | X | +X |
67
- | Checks passing | X/84 | X/84 | +X |
68
- | Time to first productive session | Xm | Xm | -Xm |
69
- | [Other metric] | | | |
70
-
71
- ## What Worked Well
72
-
73
- - [Specific thing that added clear value]
74
- - [Another]
75
-
76
- ## What Could Be Better
77
-
78
- - [Specific improvement suggestion for the tool]
79
- - [Another]
80
-
81
- ## Verdict
82
-
83
- **Would recommend:** [Yes / Yes with caveats / Not yet]
84
-
85
- **Best for:** [Who should try this based on our experience]
86
-
87
- **One-line summary:** [e.g., "Took our Claude setup from basic to production-ready in 15 minutes with zero breakage."]
88
-
89
- ---
90
-
91
- *Generated with claudex-setup v[version]. Case study template from CLAUDEX.*
@@ -1,37 +0,0 @@
1
- # Claims Governance
2
-
3
- Use this checklist before publishing product-facing claims about Claudex Setup.
4
-
5
- ## Allowed only with evidence
6
-
7
- - score delta claims
8
- - organic score delta claims
9
- - time-to-value claims
10
- - recommendation acceptance rate claims
11
- - reduction in manual corrections
12
- - benchmark outcomes on named repo types
13
-
14
- ## Evidence standard
15
-
16
- Every claim should have:
17
-
18
- - a benchmark run or pilot report
19
- - the repo type or cohort it applies to
20
- - the date the evidence was collected
21
- - the exact metric definition
22
- - the comparison method (`before/after`, `control/pilot`, or `observed over time`)
23
-
24
- ## Avoid
25
-
26
- - universal productivity multipliers
27
- - unsupported token savings claims
28
- - “works for every repo” language
29
- - suspiciously precise numbers without a method section
30
- - implying quality scores are objective truth rather than framework coverage
31
-
32
- ## Safer phrasing
33
-
34
- - "In benchmark mode, this repo improved from 41/100 to 60/100."
35
- - "Starter-safe artifacts improved readiness on an isolated temp copy."
36
- - "Suggest-only mode gives mature teams a zero-write review path."
37
- - "Use governance mode to select permission profiles and inspect shipped hooks."
@@ -1,20 +0,0 @@
1
- ---
2
- name: audit-repo
3
- description: Run claudex-setup on the current repo and summarize the score, top gaps, and next command
4
- ---
5
-
6
- Run `npx claudex-setup --json` in the current project directory and summarize the result.
7
-
8
- Your output should include:
9
-
10
- 1. The overall score and organic score
11
- 2. The top 3 next actions from `topNextActions`
12
- 3. The suggested next command from `suggestedNextCommand`
13
- 4. A short explanation of what the repo already does well if there are notable strengths
14
-
15
- Behavior rules:
16
-
17
- - If the user asks for the shortest version, run `npx claudex-setup --lite`
18
- - If the user wants deeper no-write analysis, run `npx claudex-setup augment --json`
19
- - If the score is below 50, explicitly recommend `npx claudex-setup setup`
20
- - Never apply changes automatically from this skill
@@ -1,60 +0,0 @@
1
- # Using claudex-setup from inside Claude Code
2
-
3
- ## Skill: Audit Repo
4
-
5
- Add this to `.claude/skills/audit-repo.md` in any project:
6
-
7
- ```markdown
8
- ---
9
- name: audit-repo
10
- description: Run claudex-setup audit on the current project and show score + top gaps
11
- ---
12
-
13
- Run `npx claudex-setup --json` on the current project directory.
14
- Parse the JSON output and present:
15
- 1. Score X/100
16
- 2. Top 3 critical/high gaps with fix descriptions
17
- 3. Suggest next command based on score
18
-
19
- $ARGUMENTS — optional: --lite for quick scan
20
- ```
21
-
22
- ## Hook: Auto-audit on SessionStart
23
-
24
- Add to `.claude/settings.json`:
25
-
26
- ```json
27
- {
28
- "hooks": {
29
- "SessionStart": [
30
- {
31
- "type": "command",
32
- "command": "node -e \"try{const r=require('child_process').execSync('npx claudex-setup --json 2>/dev/null',{timeout:15000}).toString();const d=JSON.parse(r);if(d.score<50)console.log(JSON.stringify({systemMessage:'⚠️ Claude Code setup score: '+d.score+'/100. Consider running: npx claudex-setup --lite'}))}catch(e){console.log('{}')}\"",
33
- "timeout": 20,
34
- "statusMessage": "Checking Claude Code setup..."
35
- }
36
- ]
37
- }
38
- }
39
- ```
40
-
41
- ## Agent: Setup Advisor
42
-
43
- Add to `.claude/agents/setup-advisor.md`:
44
-
45
- ```markdown
46
- ---
47
- name: setup-advisor
48
- description: Analyzes Claude Code setup and recommends improvements
49
- tools: [Bash, Read, Glob, Grep]
50
- model: haiku
51
- maxTurns: 10
52
- ---
53
-
54
- You are a Claude Code setup advisor.
55
-
56
- 1. Run `npx claudex-setup augment --json` on the current project
57
- 2. Analyze gaps and strengths
58
- 3. Recommend top 5 improvements with rationale
59
- 4. If user approves, guide them through applying changes
60
- ```
@@ -1,9 +0,0 @@
1
- {
2
- "article": {
3
- "title": "Your Claude Code project scores 10/100. Here's how to fix it in 60 seconds.",
4
- "published": false,
5
- "tags": ["claude", "ai", "productivity", "devtools"],
6
- "series": "Claude Code Optimization",
7
- "body_markdown": "After cataloging **1,107 Claude Code entries** and verifying **948 with real evidence**, I found that most projects use barely 10% of what's available.\n\nI built a CLI that scores your project:\n\n```bash\nnpx claudex-setup\n```\n\nMost projects score **10-20 out of 100**. After running setup, they jump to **70+**.\n\n## The Top 10 Things You're Missing\n\n### 1. CLAUDE.md (Critical)\n\nClaude reads this file at the start of every session. Without it, Claude doesn't know your build commands, code style, or project rules.\n\nOur tool generates a smart CLAUDE.md that detects your framework, TypeScript config, and creates a Mermaid architecture diagram automatically.\n\n### 2. Mermaid Architecture Diagrams (73% Token Savings)\n\nA Mermaid diagram in CLAUDE.md gives Claude your project structure in a fraction of the tokens that prose requires.\n\n### 3. Hooks > CLAUDE.md Rules (100% vs 80%)\n\nCLAUDE.md instructions are advisory (~80% compliance). Hooks are deterministic (100%). Auto-lint after every edit. Every time.\n\n### 4. Custom Commands\n\nStop typing the same prompts. Create `/test`, `/deploy`, `/review` in `.claude/commands/`.\n\n### 5. Verification Loops (The #1 Best Practice)\n\n> *This is the single highest-leverage thing you can do.* — Anthropic Best Practices\n\nClaude performs dramatically better when it can verify its own work.\n\n### 6. XML Tags (30% Quality Boost)\n\nUse `<constraints>`, `<validation>` in CLAUDE.md for unambiguous instructions.\n\n### 7. Secrets Protection\n\nClaude Code loads `.env` automatically. Add deny rules to prevent reading sensitive files.\n\n### 8. /security-review\n\nBuilt-in OWASP Top 10 scanning. Most people don't know this command exists.\n\n### 9. Custom Agents\n\nSpecialized subagents: security-reviewer, test-writer in `.claude/agents/`.\n\n### 10. Skills (On-Demand Knowledge)\n\nReusable skills package expertise that Claude can load on demand.\n\n## Try It Now\n\n```bash\nnpx claudex-setup --lite # Quick scan\nnpx claudex-setup # Full audit\nnpx claudex-setup --snapshot # Save evidence artifact\nnpx claudex-setup governance --out governance.md\n```\n\nFree, open source, zero dependencies.\n\n**GitHub:** [github.com/DnaFin/claudex-setup](https://github.com/DnaFin/claudex-setup)\n**npm:** [npmjs.com/package/claudex-setup](https://www.npmjs.com/package/claudex-setup)\n\n---\n\n*Built from a research catalog of 1,107 Claude Code entries, 948 verified with evidence.*"
8
- }
9
- }