4runr-cursor-setup 0.1.20 → 0.1.21
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 +4 -0
- package/dist/commands/commands.js +19 -1
- package/dist/commands/doctor.js +48 -0
- package/package.json +1 -1
- package/scripts/smoke.ps1 +10 -0
package/README.md
CHANGED
|
@@ -34,9 +34,11 @@ npx -y 4runr-cursor-setup@latest doctor --strict
|
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
# Repair / normalize any repo (safe)
|
|
37
|
+
# Installs: manifest + docs + .cursor/rules/project.md
|
|
37
38
|
npx -y 4runr-cursor-setup@latest doctor --fix --purge-orphans --strict
|
|
38
39
|
|
|
39
40
|
# Install core commands (updates if already installed)
|
|
41
|
+
# Installs: .cursor/commands/* (4runr-start.md, 4runr-close.md)
|
|
40
42
|
npx -y 4runr-cursor-setup@latest add core --force
|
|
41
43
|
|
|
42
44
|
# CI / health check (fails if issues)
|
|
@@ -46,6 +48,8 @@ npx -y 4runr-cursor-setup@latest doctor --strict
|
|
|
46
48
|
npx -y 4runr-cursor-setup@latest doctor --plan
|
|
47
49
|
```
|
|
48
50
|
|
|
51
|
+
**Note:** If Cursor UI doesn't show Project Rules after running `doctor --fix`, reload the window (Ctrl+Shift+P → Developer: Reload Window).
|
|
52
|
+
|
|
49
53
|
## Contract / Invariants
|
|
50
54
|
|
|
51
55
|
- Tool never overwrites un-managed files (even with `--force`)
|
|
@@ -248,8 +248,26 @@ export function addGroup(opts) {
|
|
|
248
248
|
else {
|
|
249
249
|
console.log('Installed group "' + group + '" into .cursor/commands (' + copied + " file(s) written).");
|
|
250
250
|
}
|
|
251
|
-
|
|
251
|
+
// Check for rules file and provide hints (for core group, after successful write or when already installed)
|
|
252
|
+
if (group === "core" && (copied > 0 || (copied === 0 && !hasAnyFileToWrite))) {
|
|
253
|
+
const rulesPath = path.join(cwd, ".cursor/rules/project.md");
|
|
254
|
+
const rulesExistedBefore = fs.existsSync(rulesPath);
|
|
255
|
+
// Call ensureMemory (creates empty file if missing)
|
|
252
256
|
ensureMemory(cwd);
|
|
257
|
+
// Check if rules were missing before ensureMemory created them
|
|
258
|
+
if (!rulesExistedBefore) {
|
|
259
|
+
// Rules were missing, hint user to run doctor --fix for proper setup
|
|
260
|
+
console.log("Hint: Project rules not found (.cursor/rules/project.md). Run: doctor --fix --purge-orphans --strict");
|
|
261
|
+
}
|
|
262
|
+
else if (fs.existsSync(rulesPath)) {
|
|
263
|
+
// Rules exist, show reload tip
|
|
264
|
+
console.log("Cursor tip: if rules exist but don't appear, reload Cursor window (Ctrl+Shift+P → Developer: Reload Window).");
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
else if (group === "core") {
|
|
268
|
+
// Still call ensureMemory even if we don't show hints
|
|
269
|
+
ensureMemory(cwd);
|
|
270
|
+
}
|
|
253
271
|
}
|
|
254
272
|
export function removeGroup(opts) {
|
|
255
273
|
const { cwd, group, dryRun = false } = opts;
|
package/dist/commands/doctor.js
CHANGED
|
@@ -79,9 +79,25 @@ function purgeOrphans(cwd, dryRun, silent) {
|
|
|
79
79
|
return { count: deleted, files: deletedFiles };
|
|
80
80
|
}
|
|
81
81
|
export function doctor(cwd, toolVersion, opts) {
|
|
82
|
+
// Track files created/verified during --fix
|
|
83
|
+
const rulesPath = path.join(cwd, ".cursor/rules/project.md");
|
|
84
|
+
const rulesExistedBefore = opts.fix && !opts.dryRun ? fs.existsSync(rulesPath) : false;
|
|
85
|
+
let rulesCreated = false;
|
|
86
|
+
let rulesVerified = false;
|
|
82
87
|
// Run fixes first if requested
|
|
83
88
|
if (opts.fix) {
|
|
84
89
|
ensureMemory(cwd, { dryRun: !!opts.dryRun });
|
|
90
|
+
// Check if rules were created or verified
|
|
91
|
+
if (!opts.dryRun) {
|
|
92
|
+
if (fs.existsSync(rulesPath)) {
|
|
93
|
+
if (!rulesExistedBefore) {
|
|
94
|
+
rulesCreated = true;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
rulesVerified = true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
85
101
|
// Always ensure manifest exists when --fix is used
|
|
86
102
|
if (!loadManifest(cwd)) {
|
|
87
103
|
const nm = createEmptyManifest(toolVersion);
|
|
@@ -190,6 +206,20 @@ export function doctor(cwd, toolVersion, opts) {
|
|
|
190
206
|
if (opts.plan) {
|
|
191
207
|
planItems = generatePlan(issues, m || null);
|
|
192
208
|
}
|
|
209
|
+
// Prepare fixed files info for output
|
|
210
|
+
const fixedInfo = { created: [], verified: [] };
|
|
211
|
+
const notes = [];
|
|
212
|
+
if (opts.fix && !opts.dryRun) {
|
|
213
|
+
if (rulesCreated) {
|
|
214
|
+
fixedInfo.created.push(".cursor/rules/project.md");
|
|
215
|
+
}
|
|
216
|
+
else if (rulesVerified) {
|
|
217
|
+
fixedInfo.verified.push(".cursor/rules/project.md");
|
|
218
|
+
}
|
|
219
|
+
if (fs.existsSync(rulesPath)) {
|
|
220
|
+
notes.push("Reload Cursor window to apply Project Rules.");
|
|
221
|
+
}
|
|
222
|
+
}
|
|
193
223
|
if (opts.json) {
|
|
194
224
|
const jsonOutput = { ok: !hasErrors, issues };
|
|
195
225
|
if (purgedInfo) {
|
|
@@ -198,6 +228,12 @@ export function doctor(cwd, toolVersion, opts) {
|
|
|
198
228
|
if (opts.plan) {
|
|
199
229
|
jsonOutput.plan = planItems;
|
|
200
230
|
}
|
|
231
|
+
if (opts.fix && (fixedInfo.created.length > 0 || fixedInfo.verified.length > 0)) {
|
|
232
|
+
jsonOutput.fixed = fixedInfo;
|
|
233
|
+
}
|
|
234
|
+
if (notes.length > 0) {
|
|
235
|
+
jsonOutput.notes = notes;
|
|
236
|
+
}
|
|
201
237
|
console.log(JSON.stringify(jsonOutput, null, 2));
|
|
202
238
|
}
|
|
203
239
|
else {
|
|
@@ -220,6 +256,18 @@ export function doctor(cwd, toolVersion, opts) {
|
|
|
220
256
|
}
|
|
221
257
|
else {
|
|
222
258
|
// Normal output mode
|
|
259
|
+
// Print rules status if --fix was used
|
|
260
|
+
if (opts.fix && !opts.dryRun) {
|
|
261
|
+
if (rulesCreated) {
|
|
262
|
+
console.log("CREATED rules: .cursor/rules/project.md");
|
|
263
|
+
}
|
|
264
|
+
else if (rulesVerified) {
|
|
265
|
+
console.log("OK rules: .cursor/rules/project.md");
|
|
266
|
+
}
|
|
267
|
+
if (fs.existsSync(rulesPath)) {
|
|
268
|
+
console.log("Note: if Cursor doesn't show Project Rules yet, reload the window (Ctrl+Shift+P → Developer: Reload Window).");
|
|
269
|
+
}
|
|
270
|
+
}
|
|
223
271
|
if (issues.length === 0)
|
|
224
272
|
console.log("✅ doctor: OK");
|
|
225
273
|
else {
|
package/package.json
CHANGED
package/scripts/smoke.ps1
CHANGED
|
@@ -69,6 +69,16 @@ try {
|
|
|
69
69
|
Pop-Location
|
|
70
70
|
Write-Host ""
|
|
71
71
|
|
|
72
|
+
# Verify .cursor/rules/project.md exists after doctor fix
|
|
73
|
+
$rulesPath = Join-Path $tempDir ".cursor\rules\project.md"
|
|
74
|
+
if (-not (Test-Path $rulesPath)) {
|
|
75
|
+
Write-Host "FAILED: .cursor/rules/project.md not found after doctor --fix" -ForegroundColor Red
|
|
76
|
+
$exitCode = 1
|
|
77
|
+
} else {
|
|
78
|
+
Write-Host "PASSED: .cursor/rules/project.md exists" -ForegroundColor Green
|
|
79
|
+
}
|
|
80
|
+
Write-Host ""
|
|
81
|
+
|
|
72
82
|
if ($exitCode -ne 0) {
|
|
73
83
|
exit $exitCode
|
|
74
84
|
}
|