noah-cursor 1.1.0 → 1.3.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/README.md +36 -36
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +3 -3
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/browse.d.ts.map +1 -1
- package/dist/commands/browse.js +7 -5
- package/dist/commands/browse.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +54 -15
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +2 -2
- package/dist/commands/search.js.map +1 -1
- package/dist/constants/index.d.ts +6 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +6 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/core/program.js +2 -2
- package/dist/core/program.js.map +1 -1
- package/dist/metadata/store.d.ts +12 -0
- package/dist/metadata/store.d.ts.map +1 -1
- package/dist/metadata/store.js +61 -2
- package/dist/metadata/store.js.map +1 -1
- package/dist/noah-registry/manifest.json +85 -0
- package/dist/noah-registry/mcp/.gitkeep +0 -0
- package/dist/noah-registry/presets/.gitkeep +0 -0
- package/dist/noah-registry/prompts/.gitkeep +0 -0
- package/dist/noah-registry/rules/laravel-api/RULE.md +62 -0
- package/dist/noah-registry/rules/nextjs-marketing/RULE.md +52 -0
- package/dist/noah-registry/rules/nuxt-marketing/RULE.md +50 -0
- package/dist/noah-registry/rules/react-spa-dashboard/RULE.md +75 -0
- package/dist/noah-registry/rules/stack-architecture/RULE.md +28 -0
- package/dist/noah-registry/rules/test/RULE.md +16 -0
- package/dist/noah-registry/skills/commit-push/SKILL.md +193 -0
- package/dist/noah-registry/skills/larastan-fix/SKILL.md +203 -0
- package/dist/noah-registry/skills/nestjs-knip-fix/SKILL.md +147 -0
- package/dist/noah-registry/skills/nestjs-knip-fix/config/knip.nestjs.json +29 -0
- package/dist/noah-registry/skills/node-doctor-fix/SKILL.md +146 -0
- package/dist/noah-registry/skills/node-doctor-fix/config/node-doctor.knip.json +22 -0
- package/dist/noah-registry/skills/node-doctor-fix/scripts/node-doctor.mjs +393 -0
- package/dist/noah-registry/skills/react-doctor-fix/SKILL.md +185 -0
- package/dist/noah-registry/skills/test/SKILL.md +14 -0
- package/dist/services/doctor-service.js +3 -3
- package/dist/services/doctor-service.js.map +1 -1
- package/dist/services/install-service.d.ts +9 -1
- package/dist/services/install-service.d.ts.map +1 -1
- package/dist/services/install-service.js +22 -7
- package/dist/services/install-service.js.map +1 -1
- package/dist/services/registry-loader.d.ts +7 -1
- package/dist/services/registry-loader.d.ts.map +1 -1
- package/dist/services/registry-loader.js +30 -11
- package/dist/services/registry-loader.js.map +1 -1
- package/dist/ui/banner.d.ts +1 -1
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +11 -8
- package/dist/ui/banner.js.map +1 -1
- package/dist/utils/registry.d.ts +22 -0
- package/dist/utils/registry.d.ts.map +1 -0
- package/dist/utils/registry.js +95 -0
- package/dist/utils/registry.js.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: larastan-fix
|
|
3
|
+
description: >-
|
|
4
|
+
Runs Larastan (PHPStan for Laravel), constructs fixes for all findings, and
|
|
5
|
+
verifies that implementations, features, and functionalities are not broken
|
|
6
|
+
after changes. Use when the user runs /larastan-fix, asks to run Larastan,
|
|
7
|
+
PHPStan on a Laravel app, clean up static analysis errors, or fix Larastan
|
|
8
|
+
findings without regressions.
|
|
9
|
+
disable-model-invocation: true
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# /larastan-fix
|
|
13
|
+
|
|
14
|
+
Run **Larastan** (PHPStan + Laravel extension), fix **all** findings, and prove behavior still works.
|
|
15
|
+
|
|
16
|
+
Do **not** stop after the first file. Do **not** mass-ignore or regenerate a baseline to “pass.” Prefer root-cause fixes. After every batch of edits, re-verify with project checks so implementations, features, and functionalities are not broken.
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
Copy this checklist and track progress:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
Larastan Fix Progress:
|
|
24
|
+
- [ ] 1. Confirm Laravel project + Larastan setup + verification commands
|
|
25
|
+
- [ ] 2. Baseline analyse
|
|
26
|
+
- [ ] 3. Triage findings (priority order)
|
|
27
|
+
- [ ] 4. Fix in batches (explain → edit → verify)
|
|
28
|
+
- [ ] 5. Re-analyse until clean (or document intentional leftovers)
|
|
29
|
+
- [ ] 6. Final verification + report
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 1. Confirm Laravel project + Larastan setup + verification commands
|
|
33
|
+
|
|
34
|
+
From the project root:
|
|
35
|
+
|
|
36
|
+
1. Confirm this is a Laravel app (`artisan`, `composer.json` with `laravel/framework`) — abort with a clear message if not.
|
|
37
|
+
2. Confirm Larastan is available:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
composer show larastan/larastan 2>/dev/null || composer show nunomaduro/larastan 2>/dev/null
|
|
41
|
+
test -f phpstan.neon -o -f phpstan.neon.dist -o -f phpstan.dist.neon
|
|
42
|
+
test -x vendor/bin/phpstan
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If Larastan / PHPStan is missing, install only with user approval:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
composer require --dev larastan/larastan
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Ensure config includes the Larastan extension (create `phpstan.neon` only if none exists and the user wants setup):
|
|
52
|
+
|
|
53
|
+
```neon
|
|
54
|
+
includes:
|
|
55
|
+
- vendor/larastan/larastan/extension.neon
|
|
56
|
+
- vendor/nesbot/carbon/extension.neon
|
|
57
|
+
|
|
58
|
+
parameters:
|
|
59
|
+
paths:
|
|
60
|
+
- app/
|
|
61
|
+
level: 5
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Do **not** raise the configured level unless the user asks. Analyse at the project’s configured level.
|
|
65
|
+
|
|
66
|
+
3. Detect verification commands. Prefer existing Composer / Artisan scripts:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
composer test # or phpunit / pest
|
|
70
|
+
php artisan test
|
|
71
|
+
vendor/bin/pest
|
|
72
|
+
vendor/bin/phpunit
|
|
73
|
+
vendor/bin/pint --test # style check only; not a substitute for tests
|
|
74
|
+
php artisan route:list # smoke when helpful
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Record the chosen commands before editing. If no tests exist, say so and still use the strongest available checks (at least a second Larastan run + Pint if present).
|
|
78
|
+
|
|
79
|
+
### 2. Baseline analyse
|
|
80
|
+
|
|
81
|
+
Use the project binary (respects `phpstan.neon*`):
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
./vendor/bin/phpstan analyse --memory-limit=2G
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
If Composer defines a script (`composer phpstan` / `composer analyse`), prefer that.
|
|
88
|
+
|
|
89
|
+
For machine-readable output when practical:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
./vendor/bin/phpstan analyse --memory-limit=2G --error-format=json > .larastan-baseline.json
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Delete or leave untracked any temporary report files before finishing.
|
|
96
|
+
|
|
97
|
+
Path-scoped cleanup only when the user asks:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
./vendor/bin/phpstan analyse app/Http/Controllers --memory-limit=2G
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Default for this skill is a **full** configured analyse unless the user scopes it.
|
|
104
|
+
|
|
105
|
+
### 3. Triage findings
|
|
106
|
+
|
|
107
|
+
Work findings in this priority:
|
|
108
|
+
|
|
109
|
+
1. **Runtime-breaking** — undefined methods/properties, wrong argument counts, impossible types that would crash
|
|
110
|
+
2. **Null safety** — unsafe property/method access on nullable models, requests, relations
|
|
111
|
+
3. **Laravel / Eloquent correctness** — wrong relation types, builder misuse, container/`auth`/`request` type gaps Larastan flags
|
|
112
|
+
4. **PHPDoc / generics** — collection/model generics, `@var` / `@param` / `@return` that hide real bugs
|
|
113
|
+
5. **Dead code / unreachable** — always-true/false conditions, unused private methods (only remove when safe)
|
|
114
|
+
6. **Remaining level noise** — stricter level complaints that need small, local typing improvements
|
|
115
|
+
|
|
116
|
+
Group by file or by shared root cause (e.g. one incomplete Form Request type used everywhere).
|
|
117
|
+
|
|
118
|
+
### 4. Fix in batches (explain → edit → verify)
|
|
119
|
+
|
|
120
|
+
For each batch (prefer one error identifier / one file group):
|
|
121
|
+
|
|
122
|
+
1. **Explain the fix** briefly: what PHPStan reported, why the change is safe, what runtime behavior must stay the same.
|
|
123
|
+
2. **Edit** the minimum code needed. Match Laravel project patterns (Form Requests, Actions, Eloquent APIs, API Resources).
|
|
124
|
+
3. **Verify immediately** with the commands from step 1 (fastest relevant suite after each batch; full suite before the final report).
|
|
125
|
+
4. If verification fails: **revert or repair** before continuing. Never leave the tree broken to chase a clean Larastan run.
|
|
126
|
+
|
|
127
|
+
#### Fix construction rules
|
|
128
|
+
|
|
129
|
+
- Preserve HTTP contracts: routes, status codes, JSON shapes, validation rules, auth/gates, jobs/events side effects.
|
|
130
|
+
- Prefer real types and narrowing (`=== null` checks, early returns, assert helpers) over silencing.
|
|
131
|
+
- Prefer accurate PHPDoc / generics on Eloquent models and collections when the code is already correct.
|
|
132
|
+
- Do not change business logic to satisfy the analyser when a precise type assertion or request DTO is enough.
|
|
133
|
+
- Do not upgrade Laravel/PHP major versions or rewrite architecture unless the user expands scope.
|
|
134
|
+
- Keep diffs small and reviewable.
|
|
135
|
+
|
|
136
|
+
#### Ignores / baseline (last resort only)
|
|
137
|
+
|
|
138
|
+
Prefer fixing the root cause. Use ignores only when:
|
|
139
|
+
|
|
140
|
+
- the finding is a true false positive for this Laravel version/package, **or**
|
|
141
|
+
- a correct fix would be an out-of-scope rewrite the user did not approve
|
|
142
|
+
|
|
143
|
+
Narrow inline ignore:
|
|
144
|
+
|
|
145
|
+
```php
|
|
146
|
+
// @phpstan-ignore-next-line
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Or identifier-based ignores when the project PHPStan version supports them. Prefer next-line / specific `ignoreErrors` path patterns over global rules.
|
|
150
|
+
|
|
151
|
+
Do **not** run `--generate-baseline` to clear findings unless the user explicitly asks for a baseline workflow.
|
|
152
|
+
|
|
153
|
+
Document every ignore in the final report with file, message/identifier, and reason.
|
|
154
|
+
|
|
155
|
+
### 5. Re-analyse until clean
|
|
156
|
+
|
|
157
|
+
After fixes:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
./vendor/bin/phpstan analyse --memory-limit=2G
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Repeat triage → fix → verify until:
|
|
164
|
+
|
|
165
|
+
- analyse exits 0 with no errors, **or**
|
|
166
|
+
- only explicitly approved / documented ignores or deferred items remain
|
|
167
|
+
|
|
168
|
+
Do not claim “all clear” if analyse still fails.
|
|
169
|
+
|
|
170
|
+
### 6. Final verification + report
|
|
171
|
+
|
|
172
|
+
Run the full verification set from step 1 again.
|
|
173
|
+
|
|
174
|
+
Report in this shape:
|
|
175
|
+
|
|
176
|
+
```markdown
|
|
177
|
+
## Larastan fix report
|
|
178
|
+
|
|
179
|
+
### Analyse
|
|
180
|
+
- Config: <phpstan.neon*|level>
|
|
181
|
+
- Baseline: <N errors>
|
|
182
|
+
- Final: <clean | N remaining>
|
|
183
|
+
|
|
184
|
+
### Fixed
|
|
185
|
+
- <error summary> — file(s) — one-line fix summary
|
|
186
|
+
|
|
187
|
+
### Ignores
|
|
188
|
+
- none | file:line — reason
|
|
189
|
+
|
|
190
|
+
### Verification
|
|
191
|
+
- <command> — pass/fail
|
|
192
|
+
- <command> — pass/fail
|
|
193
|
+
|
|
194
|
+
### Deferred (needs user decision)
|
|
195
|
+
- <finding> — why not fixed
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Safety
|
|
199
|
+
|
|
200
|
+
- Do not commit or push unless the user asks.
|
|
201
|
+
- Do not use `--force` git commands.
|
|
202
|
+
- Do not commit secrets (`.env`, credentials).
|
|
203
|
+
- Stop and ask if a “fix” requires deleting substantial features, changing API contracts, or broad behavioral changes.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nestjs-knip-fix
|
|
3
|
+
description: >-
|
|
4
|
+
Runs Knip on NestJS projects, constructs fixes for unused files, exports, and
|
|
5
|
+
dependencies, and verifies that implementations, features, and functionalities
|
|
6
|
+
are not broken after changes. Use when the user runs /nestjs-knip-fix, asks
|
|
7
|
+
to run knip on NestJS, clean up unused NestJS code, or fix Knip findings
|
|
8
|
+
without regressions.
|
|
9
|
+
disable-model-invocation: true
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# /nestjs-knip-fix
|
|
13
|
+
|
|
14
|
+
Run **`npx knip`** on a **NestJS** app, fix **all** findings, and prove behavior still works.
|
|
15
|
+
|
|
16
|
+
Do **not** stop after the first issue type. Do **not** mass-ignore. Prefer root-cause removals and export cleanups. After every batch of edits, re-verify so implementations, features, and functionalities are not broken.
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
Copy this checklist and track progress:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
NestJS Knip Fix Progress:
|
|
24
|
+
- [ ] 1. Confirm NestJS project + verification commands
|
|
25
|
+
- [ ] 2. Ensure Knip config (Nest-aware)
|
|
26
|
+
- [ ] 3. Baseline knip scan
|
|
27
|
+
- [ ] 4. Triage findings (priority order)
|
|
28
|
+
- [ ] 5. Fix in batches (explain → edit → verify)
|
|
29
|
+
- [ ] 6. Re-scan until clean (or document intentional leftovers)
|
|
30
|
+
- [ ] 7. Final verification + report
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 1. Confirm NestJS project + verification commands
|
|
34
|
+
|
|
35
|
+
From the project root:
|
|
36
|
+
|
|
37
|
+
1. Confirm NestJS (`@nestjs/core` in `package.json`, usually `nest-cli.json` / `src/main.ts`) — abort if not.
|
|
38
|
+
2. Detect verification commands (prefer existing scripts):
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm test # or pnpm / yarn / bun
|
|
42
|
+
npm run test:e2e
|
|
43
|
+
npm run build # nest build / tsc
|
|
44
|
+
npm run lint
|
|
45
|
+
npx tsc --noEmit
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Record the chosen commands before editing.
|
|
49
|
+
|
|
50
|
+
### 2. Ensure Knip config (Nest-aware)
|
|
51
|
+
|
|
52
|
+
If the project has no `knip.json` / `knip.ts` / `knip` field in `package.json`, copy the skill template into the project root as `knip.json`:
|
|
53
|
+
|
|
54
|
+
- Template: [`config/knip.nestjs.json`](config/knip.nestjs.json)
|
|
55
|
+
|
|
56
|
+
Adjust `entry` / `project` for monorepos (`apps/*`, `libs/*`) when needed. Prefer extending the template over inventing a blank config.
|
|
57
|
+
|
|
58
|
+
Do not overwrite an existing Knip config unless the user asks — merge Nest entry patterns into the existing config instead.
|
|
59
|
+
|
|
60
|
+
### 3. Baseline knip scan
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx knip --no-progress
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
If a local config path is required:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npx knip --config knip.json --no-progress
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Optional production-only pass (after the default scan is clean or when the user asks):
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npx knip --production --no-progress
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Capture output for triage. Default for this skill is a **full** workspace scan unless the user scopes it.
|
|
79
|
+
|
|
80
|
+
### 4. Triage findings
|
|
81
|
+
|
|
82
|
+
Work findings in this priority:
|
|
83
|
+
|
|
84
|
+
1. **Unused dependencies / devDependencies** — remove from `package.json` only after confirming Nest/CLI/plugins do not need them
|
|
85
|
+
2. **Unlisted dependencies** — add the real import to `dependencies` / `devDependencies` (do not rely on transitive deps)
|
|
86
|
+
3. **Unused files** — delete only when not dynamically loaded (`i18n`, `assets`, `path.join(__dirname, …)`, Nest schematics paths)
|
|
87
|
+
4. **Unused exports** — remove `export` or delete dead symbols; keep Nest decorators’ public APIs (`@Module` providers/controllers/imports that Knip misunderstands → fix config, don’t gut the module)
|
|
88
|
+
5. **Duplicate / enum / namespace export noise** — resolve carefully; suppress only as last resort
|
|
89
|
+
|
|
90
|
+
**NestJS cautions**
|
|
91
|
+
|
|
92
|
+
- Controllers, providers, guards, interceptors, pipes, filters registered only via module metadata must stay reachable from entry modules — if Knip says unused, verify `*.module.ts` wiring first.
|
|
93
|
+
- Do not remove `main.ts`, `app.module.ts`, or Nest CLI schematics entrypoints.
|
|
94
|
+
- Spec / e2e files: prefer config `ignore` / project patterns over deleting tests.
|
|
95
|
+
|
|
96
|
+
### 5. Fix in batches (explain → edit → verify)
|
|
97
|
+
|
|
98
|
+
For each batch:
|
|
99
|
+
|
|
100
|
+
1. **Explain** what Knip reported and why the change is safe.
|
|
101
|
+
2. **Edit** the minimum (package.json, exports, delete files).
|
|
102
|
+
3. **Verify** with build + unit tests (and e2e when relevant).
|
|
103
|
+
4. If verification fails: **revert or repair** before continuing.
|
|
104
|
+
|
|
105
|
+
#### Fix construction rules
|
|
106
|
+
|
|
107
|
+
- Preserve HTTP routes, DTO contracts, swagger models, queues, cron jobs, and microservice patterns.
|
|
108
|
+
- Prefer removing unused exports over deleting whole Nest providers that are still registered.
|
|
109
|
+
- Run `npm install` / lockfile update after dependency changes.
|
|
110
|
+
- Keep diffs small. No drive-by refactors.
|
|
111
|
+
|
|
112
|
+
#### Ignores (last resort)
|
|
113
|
+
|
|
114
|
+
Use Knip `ignore`, `ignoreDependencies`, or `ignoreBinaries` only for true false positives (Nest dynamic modules, intentional public SDK barrels). Document each ignore in the final report.
|
|
115
|
+
|
|
116
|
+
### 6. Re-scan until clean
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npx knip --no-progress
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Repeat until exit 0 or only approved ignores remain.
|
|
123
|
+
|
|
124
|
+
### 7. Final verification + report
|
|
125
|
+
|
|
126
|
+
```markdown
|
|
127
|
+
## NestJS Knip fix report
|
|
128
|
+
|
|
129
|
+
### Scan
|
|
130
|
+
- Baseline: <summary>
|
|
131
|
+
- Final: <clean | remaining>
|
|
132
|
+
|
|
133
|
+
### Fixed
|
|
134
|
+
- <issue type> — <what changed>
|
|
135
|
+
|
|
136
|
+
### Ignores / config
|
|
137
|
+
- none | <item> — reason
|
|
138
|
+
|
|
139
|
+
### Verification
|
|
140
|
+
- <command> — pass/fail
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Safety
|
|
144
|
+
|
|
145
|
+
- Do not commit or push unless the user asks.
|
|
146
|
+
- Do not delete `.env` or secrets.
|
|
147
|
+
- Stop and ask before removing large feature modules or public API packages.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/knip@5/schema.json",
|
|
3
|
+
"entry": [
|
|
4
|
+
"src/main.ts",
|
|
5
|
+
"src/main.js",
|
|
6
|
+
"apps/**/src/main.ts",
|
|
7
|
+
"src/**/*.module.ts",
|
|
8
|
+
"apps/**/*.module.ts",
|
|
9
|
+
"libs/**/src/index.ts",
|
|
10
|
+
"test/**/*.ts",
|
|
11
|
+
"test/**/*.js"
|
|
12
|
+
],
|
|
13
|
+
"project": [
|
|
14
|
+
"src/**/*.{ts,js}",
|
|
15
|
+
"apps/**/*.{ts,js}",
|
|
16
|
+
"libs/**/*.{ts,js}",
|
|
17
|
+
"test/**/*.{ts,js}"
|
|
18
|
+
],
|
|
19
|
+
"ignore": [
|
|
20
|
+
"**/*.spec.ts",
|
|
21
|
+
"**/*.e2e-spec.ts",
|
|
22
|
+
"dist/**",
|
|
23
|
+
"coverage/**"
|
|
24
|
+
],
|
|
25
|
+
"ignoreDependencies": [
|
|
26
|
+
"@nestjs/schematics",
|
|
27
|
+
"@nestjs/testing"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: node-doctor-fix
|
|
3
|
+
description: >-
|
|
4
|
+
Runs the bundled node-doctor tool (Knip + package hygiene) on generic Node.js
|
|
5
|
+
projects, constructs fixes for all findings, and verifies that implementations,
|
|
6
|
+
features, and functionalities are not broken after changes. Use when the user
|
|
7
|
+
runs /node-doctor-fix, asks to doctor a Node.js package/CLI, clean unused
|
|
8
|
+
Node exports/deps, or fix node-doctor findings without regressions.
|
|
9
|
+
disable-model-invocation: true
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# /node-doctor-fix
|
|
13
|
+
|
|
14
|
+
Run the bundled **`node-doctor`** tool on a **generic Node.js** project (library, CLI, or service — not Nest/Next-first apps), fix **all** findings, and prove behavior still works.
|
|
15
|
+
|
|
16
|
+
`node-doctor` = **Knip** (unused files / exports / dependencies) using [`config/node-doctor.knip.json`](config/node-doctor.knip.json) when the project has no Knip config, **plus** package hygiene checks (`bin` / `main` / `exports` / script paths / `engines.node`).
|
|
17
|
+
|
|
18
|
+
Do **not** mass-ignore. Prefer root-cause fixes. After every batch of edits, re-verify so implementations, features, and functionalities are not broken.
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
Copy this checklist and track progress:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Node Doctor Fix Progress:
|
|
26
|
+
- [ ] 1. Confirm Node project + route frameworks elsewhere
|
|
27
|
+
- [ ] 2. Baseline node-doctor scan
|
|
28
|
+
- [ ] 3. Triage findings (priority order)
|
|
29
|
+
- [ ] 4. Fix in batches (explain → edit → verify)
|
|
30
|
+
- [ ] 5. Re-scan until clean (or document intentional leftovers)
|
|
31
|
+
- [ ] 6. Final verification + report
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 1. Confirm Node project + route frameworks elsewhere
|
|
35
|
+
|
|
36
|
+
From the project root:
|
|
37
|
+
|
|
38
|
+
1. Confirm `package.json` exists.
|
|
39
|
+
2. If the app is primarily **NestJS** → use `/nestjs-knip-fix` instead.
|
|
40
|
+
3. If the app is primarily **React** → use `/react-doctor-fix` (optionally Knip later).
|
|
41
|
+
4. Detect verification commands:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm test
|
|
45
|
+
npm run typecheck # or npx tsc --noEmit
|
|
46
|
+
npm run lint
|
|
47
|
+
npm run build
|
|
48
|
+
node ./dist/index.js --help # CLIs when applicable
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 2. Baseline node-doctor scan
|
|
52
|
+
|
|
53
|
+
Resolve the skill directory (installed under `.cursor/skills/node-doctor-fix` or this registry path), then:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
node <skillDir>/scripts/node-doctor.mjs . --json > .node-doctor-baseline.json
|
|
57
|
+
node <skillDir>/scripts/node-doctor.mjs .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Examples:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
node .cursor/skills/node-doctor-fix/scripts/node-doctor.mjs .
|
|
64
|
+
node skills/node-doctor-fix/scripts/node-doctor.mjs .
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Flags:
|
|
68
|
+
|
|
69
|
+
- `--json` — machine-readable findings
|
|
70
|
+
- `--knip-only` — skip package hygiene
|
|
71
|
+
- `--hygiene-only` — skip Knip
|
|
72
|
+
|
|
73
|
+
If the project already has `knip.json` / `package.json#knip`, node-doctor uses that for Knip; otherwise it uses the bundled [`config/node-doctor.knip.json`](config/node-doctor.knip.json).
|
|
74
|
+
|
|
75
|
+
Delete temporary report files before finishing (or keep them untracked).
|
|
76
|
+
|
|
77
|
+
### 3. Triage findings
|
|
78
|
+
|
|
79
|
+
Priority:
|
|
80
|
+
|
|
81
|
+
1. **Broken package entrypoints** — missing `bin` / `main` / `exports` / script paths (hygiene errors)
|
|
82
|
+
2. **Unlisted dependencies** — add real imports to package.json
|
|
83
|
+
3. **Unused dependencies** — remove only when not required by tooling/config plugins
|
|
84
|
+
4. **Unused files** — delete when not dynamically required
|
|
85
|
+
5. **Unused exports / types** — remove or stop exporting
|
|
86
|
+
6. **Hygiene warnings** — e.g. missing `engines.node`
|
|
87
|
+
|
|
88
|
+
### 4. Fix in batches (explain → edit → verify)
|
|
89
|
+
|
|
90
|
+
For each batch:
|
|
91
|
+
|
|
92
|
+
1. **Explain** the finding and why the fix is safe.
|
|
93
|
+
2. **Edit** minimally (`package.json`, exports, delete dead files).
|
|
94
|
+
3. **Verify** with test / typecheck / build / CLI smoke.
|
|
95
|
+
4. On failure: **revert or repair** before continuing.
|
|
96
|
+
|
|
97
|
+
#### Fix construction rules
|
|
98
|
+
|
|
99
|
+
- Preserve public package API (`exports`, documented CLI flags, published bin names).
|
|
100
|
+
- Do not remove files loaded dynamically (`fs.readFile`, runtime plugin paths) without proof.
|
|
101
|
+
- Update the lockfile after dependency changes.
|
|
102
|
+
- Do not convert the project into Nest/Next-specific structure.
|
|
103
|
+
|
|
104
|
+
#### Ignores (last resort)
|
|
105
|
+
|
|
106
|
+
Prefer fixing. If Knip false-positives remain, add narrow `ignore` / `ignoreDependencies` to the **project** Knip config (create one from the bundled config rather than silencing the tool). Document every ignore.
|
|
107
|
+
|
|
108
|
+
### 5. Re-scan until clean
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
node <skillDir>/scripts/node-doctor.mjs .
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Exit code must be `0` (or only approved documented leftovers remain).
|
|
115
|
+
|
|
116
|
+
### 6. Final verification + report
|
|
117
|
+
|
|
118
|
+
```markdown
|
|
119
|
+
## Node doctor fix report
|
|
120
|
+
|
|
121
|
+
### Scan
|
|
122
|
+
- Baseline: <N findings>
|
|
123
|
+
- Final: <clean | N remaining>
|
|
124
|
+
|
|
125
|
+
### Fixed
|
|
126
|
+
- <type> — summary
|
|
127
|
+
|
|
128
|
+
### Ignores / config
|
|
129
|
+
- none | item — reason
|
|
130
|
+
|
|
131
|
+
### Verification
|
|
132
|
+
- <command> — pass/fail
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Tool reference
|
|
136
|
+
|
|
137
|
+
| Path | Role |
|
|
138
|
+
|------|------|
|
|
139
|
+
| `scripts/node-doctor.mjs` | CLI analyser |
|
|
140
|
+
| `config/node-doctor.knip.json` | Default Knip config for generic Node |
|
|
141
|
+
|
|
142
|
+
## Safety
|
|
143
|
+
|
|
144
|
+
- Do not commit or push unless the user asks.
|
|
145
|
+
- Do not commit secrets.
|
|
146
|
+
- Stop and ask before deleting public API surface or major packages.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/knip@5/schema.json",
|
|
3
|
+
"entry": [
|
|
4
|
+
"{index,cli,main,app,server}.{js,cjs,mjs,ts,cts,mts}",
|
|
5
|
+
"src/{index,cli,main,app,server}.{js,cjs,mjs,ts,cts,mts}",
|
|
6
|
+
"bin/**/*.{js,cjs,mjs,ts}",
|
|
7
|
+
"scripts/**/*.{js,cjs,mjs,ts}"
|
|
8
|
+
],
|
|
9
|
+
"project": [
|
|
10
|
+
"**/*.{js,cjs,mjs,ts,cts,mts}!"
|
|
11
|
+
],
|
|
12
|
+
"ignore": [
|
|
13
|
+
"**/dist/**",
|
|
14
|
+
"**/build/**",
|
|
15
|
+
"**/coverage/**",
|
|
16
|
+
"**/.next/**",
|
|
17
|
+
"**/node_modules/**"
|
|
18
|
+
],
|
|
19
|
+
"ignoreBinaries": [
|
|
20
|
+
"noah-cursor"
|
|
21
|
+
]
|
|
22
|
+
}
|