4runr-cursor-setup 0.1.19 → 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 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`)
@@ -111,14 +115,26 @@ The `/close` command (from the `core` group) produces a session handoff summary.
111
115
  - **No hallucination:** The command cannot invent work, summarize changes without evidence, or list files that don't exist
112
116
  - **Clean repo → clean close:** A clean repository results in a read-only close output
113
117
 
114
- ### Verification Block
115
-
116
- Every `/close` output starts with a mandatory verification block:
117
- - `git status` output
118
- - `git diff --name-only` output
119
- - Explicit list of modified files (or "NONE")
120
-
121
- If evidence is unavailable, the output must state "NOT AVAILABLE" rather than guessing.
118
+ ### Verification Gate
119
+
120
+ Every `/close` output starts with a mandatory **REPO CONTEXT PROOF** section:
121
+ - `pwd` (current directory)
122
+ - `git rev-parse --show-toplevel` (repo root verification)
123
+ - `git status --porcelain` (working tree status)
124
+
125
+ **If git is unavailable (not a git repo or wrong directory):**
126
+ - `/close` switches to **NON-GIT MODE**
127
+ - Output states: "NOT A GIT REPO / WRONG DIRECTORY"
128
+ - **No claims about file modifications, diffs, or line numbers**
129
+ - Provides a corrective hint (cd to repo root, or initialize git)
130
+
131
+ **If git is available:**
132
+ - Proceeds with **VERIFICATION** block:
133
+ - `git status` output
134
+ - `git diff --name-only` output
135
+ - Explicit list of modified files (or "NONE")
136
+ - Only lists changes with evidence (git diff, file paths, quoted snippets)
137
+ - If evidence is unavailable, states "NOT AVAILABLE" rather than guessing
122
138
 
123
139
  ### What It Does
124
140
 
@@ -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
- if (group === "core")
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;
@@ -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 {
@@ -13,11 +13,56 @@ We are ending this session. Produce a clean handoff.
13
13
  - **Do NOT infer or summarize changes unless you can point to the exact file and evidence.**
14
14
  - **Do NOT describe "improvements", "fixes", or "updates" without proof.**
15
15
  - **Do NOT list files unless they actually exist or were modified.**
16
+ - **Do NOT claim line numbers, diffs, or file changes without evidence.**
16
17
  - **If unsure, state uncertainty explicitly.**
17
18
 
18
- ## Mandatory Verification Block
19
+ ## Mandatory Repo Context Proof (FIRST STEP)
19
20
 
20
- **You MUST start your output with this verification block:**
21
+ **You MUST run these commands FIRST and report the results:**
22
+
23
+ ```
24
+ REPO CONTEXT PROOF
25
+ - pwd: [run `pwd` and report the current directory]
26
+ - git rev-parse --show-toplevel: [run `git rev-parse --show-toplevel` and report the repo root or ERROR]
27
+ - git status --porcelain: [run `git status --porcelain` and report output or ERROR]
28
+ ```
29
+
30
+ **If `git rev-parse --show-toplevel` fails (returns error or non-zero exit code):**
31
+ - **STOP. Switch to NON-GIT MODE immediately.**
32
+ - Do NOT attempt to run any other git commands.
33
+ - Do NOT produce a "What changed" section.
34
+ - Do NOT claim any file modifications, diffs, or line numbers.
35
+
36
+ ## Mode C: NON-GIT MODE (Git Unavailable)
37
+
38
+ **Use this if `git rev-parse --show-toplevel` fails:**
39
+
40
+ 1. **REPO CONTEXT PROOF** (mandatory, at top)
41
+ - pwd: [actual current directory]
42
+ - git rev-parse --show-toplevel: **ERROR - NOT A GIT REPO / WRONG DIRECTORY**
43
+ - git status --porcelain: **NOT RUN (git unavailable)**
44
+
45
+ 2. **Session summary**
46
+ - **MUST state explicitly:**
47
+ ```
48
+ NOT A GIT REPO / WRONG DIRECTORY
49
+
50
+ Cannot verify changes. No claims about file modifications, diffs, or line numbers.
51
+ ```
52
+
53
+ 3. **Corrective step**
54
+ - **Provide ONE corrective hint:**
55
+ - "cd to repo root / open correct folder"
56
+ - OR: "initialize git (git init) if intended"
57
+
58
+ 4. **Next steps** (if any, minimal)
59
+ - 1–3 steps, atomic
60
+
61
+ **Output must be short and boring. No invented "evidence". No "What changed" section. No file lists without proof.**
62
+
63
+ ## Mandatory Verification Block (Git Mode Only)
64
+
65
+ **Use this ONLY if `git rev-parse --show-toplevel` succeeds:**
21
66
 
22
67
  ```
23
68
  VERIFICATION
@@ -28,35 +73,42 @@ VERIFICATION
28
73
 
29
74
  **If you cannot populate this truthfully, you must say "NOT AVAILABLE" for that field.**
30
75
 
31
- ## Output Format
76
+ ## Output Format (Git Mode Only)
32
77
 
33
78
  ### Mode A: Evidence Mode (Changes Exist)
34
79
 
35
80
  **Use this ONLY if you have evidence of changes:**
36
81
 
37
- 1. **VERIFICATION** (mandatory, at top)
82
+ 1. **REPO CONTEXT PROOF** (mandatory, at top)
83
+ - pwd: [actual current directory]
84
+ - git rev-parse --show-toplevel: [actual repo root]
85
+ - git status --porcelain: [actual output]
86
+
87
+ 2. **VERIFICATION** (mandatory)
38
88
  - git status: [actual output or "not run"]
39
89
  - git diff --name-only: [list or "none"]
40
90
  - Files modified: [explicit list or "NONE"]
41
91
 
42
- 2. **What changed** (evidence-required)
43
- - For each claimed change, include:
44
- - File path
45
- - What changed (specific, not vague)
46
- - Evidence: diff snippet, command output, or exact file content quote
92
+ 3. **What changed** (evidence-required, strict gating)
93
+ - **For each claimed change, you MUST include ONE of:**
94
+ - `git diff --name-only` showing the file
95
+ - A `git diff` snippet (exact quoted output)
96
+ - A direct file excerpt with explicit file path + exact quoted lines
97
+ - **If you cannot provide evidence, write "Not verified" and omit from "What changed".**
98
+ - **No evidence → do not claim changes.**
47
99
 
48
- 3. **Files involved**
49
- - Exact file paths (only files that exist or were modified)
100
+ 4. **Files involved**
101
+ - Exact file paths (only files that exist or were modified, with evidence)
50
102
 
51
- 4. **Decisions** (if any)
103
+ 5. **Decisions** (if any)
52
104
  - Decision
53
105
  - Why
54
106
  - Trade-offs
55
107
 
56
- 5. **Next steps**
108
+ 6. **Next steps**
57
109
  - 3–7 steps, atomic
58
110
 
59
- 6. **Project memory updates**
111
+ 7. **Project memory updates**
60
112
  - Provide copy-paste text for:
61
113
  - docs/status.md
62
114
  - docs/todo.md
@@ -66,27 +118,32 @@ VERIFICATION
66
118
 
67
119
  **Use this if no evidence of changes exists:**
68
120
 
69
- 1. **VERIFICATION** (mandatory, at top)
121
+ 1. **REPO CONTEXT PROOF** (mandatory, at top)
122
+ - pwd: [actual current directory]
123
+ - git rev-parse --show-toplevel: [actual repo root]
124
+ - git status --porcelain: [actual output]
125
+
126
+ 2. **VERIFICATION** (mandatory)
70
127
  - git status: [actual output]
71
128
  - git diff --name-only: [actual output]
72
129
  - Files modified: NONE
73
130
 
74
- 2. **Session summary**
131
+ 3. **Session summary**
75
132
  - **MUST state explicitly:**
76
133
  ```
77
134
  No files were created, modified, or deleted.
78
135
  This session was read-only inspection only.
79
136
  ```
80
137
 
81
- 3. **What was inspected** (optional, only if relevant)
138
+ 4. **What was inspected** (optional, only if relevant)
82
139
  - Files read
83
140
  - Commands run
84
141
  - Information gathered
85
142
 
86
- 4. **Next steps** (if any)
143
+ 5. **Next steps** (if any)
87
144
  - 3–7 steps, atomic
88
145
 
89
- 5. **Project memory updates** (if any changes to understanding)
146
+ 6. **Project memory updates** (if any changes to understanding)
90
147
  - Provide copy-paste text for:
91
148
  - docs/status.md
92
149
  - docs/todo.md
@@ -99,4 +156,7 @@ VERIFICATION
99
156
  - No "this should work"
100
157
  - No vague summaries without evidence
101
158
  - No claiming changes without proof
159
+ - No line numbers, diffs, or file changes without evidence
102
160
  - Clean repo → clean close (read-only mode)
161
+ - If git is unavailable, ignore change-reporting sections entirely
162
+ - /close is read-only: suggest commands, do not run changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "4runr-cursor-setup",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
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
  }
@@ -13,11 +13,56 @@ We are ending this session. Produce a clean handoff.
13
13
  - **Do NOT infer or summarize changes unless you can point to the exact file and evidence.**
14
14
  - **Do NOT describe "improvements", "fixes", or "updates" without proof.**
15
15
  - **Do NOT list files unless they actually exist or were modified.**
16
+ - **Do NOT claim line numbers, diffs, or file changes without evidence.**
16
17
  - **If unsure, state uncertainty explicitly.**
17
18
 
18
- ## Mandatory Verification Block
19
+ ## Mandatory Repo Context Proof (FIRST STEP)
19
20
 
20
- **You MUST start your output with this verification block:**
21
+ **You MUST run these commands FIRST and report the results:**
22
+
23
+ ```
24
+ REPO CONTEXT PROOF
25
+ - pwd: [run `pwd` and report the current directory]
26
+ - git rev-parse --show-toplevel: [run `git rev-parse --show-toplevel` and report the repo root or ERROR]
27
+ - git status --porcelain: [run `git status --porcelain` and report output or ERROR]
28
+ ```
29
+
30
+ **If `git rev-parse --show-toplevel` fails (returns error or non-zero exit code):**
31
+ - **STOP. Switch to NON-GIT MODE immediately.**
32
+ - Do NOT attempt to run any other git commands.
33
+ - Do NOT produce a "What changed" section.
34
+ - Do NOT claim any file modifications, diffs, or line numbers.
35
+
36
+ ## Mode C: NON-GIT MODE (Git Unavailable)
37
+
38
+ **Use this if `git rev-parse --show-toplevel` fails:**
39
+
40
+ 1. **REPO CONTEXT PROOF** (mandatory, at top)
41
+ - pwd: [actual current directory]
42
+ - git rev-parse --show-toplevel: **ERROR - NOT A GIT REPO / WRONG DIRECTORY**
43
+ - git status --porcelain: **NOT RUN (git unavailable)**
44
+
45
+ 2. **Session summary**
46
+ - **MUST state explicitly:**
47
+ ```
48
+ NOT A GIT REPO / WRONG DIRECTORY
49
+
50
+ Cannot verify changes. No claims about file modifications, diffs, or line numbers.
51
+ ```
52
+
53
+ 3. **Corrective step**
54
+ - **Provide ONE corrective hint:**
55
+ - "cd to repo root / open correct folder"
56
+ - OR: "initialize git (git init) if intended"
57
+
58
+ 4. **Next steps** (if any, minimal)
59
+ - 1–3 steps, atomic
60
+
61
+ **Output must be short and boring. No invented "evidence". No "What changed" section. No file lists without proof.**
62
+
63
+ ## Mandatory Verification Block (Git Mode Only)
64
+
65
+ **Use this ONLY if `git rev-parse --show-toplevel` succeeds:**
21
66
 
22
67
  ```
23
68
  VERIFICATION
@@ -28,35 +73,42 @@ VERIFICATION
28
73
 
29
74
  **If you cannot populate this truthfully, you must say "NOT AVAILABLE" for that field.**
30
75
 
31
- ## Output Format
76
+ ## Output Format (Git Mode Only)
32
77
 
33
78
  ### Mode A: Evidence Mode (Changes Exist)
34
79
 
35
80
  **Use this ONLY if you have evidence of changes:**
36
81
 
37
- 1. **VERIFICATION** (mandatory, at top)
82
+ 1. **REPO CONTEXT PROOF** (mandatory, at top)
83
+ - pwd: [actual current directory]
84
+ - git rev-parse --show-toplevel: [actual repo root]
85
+ - git status --porcelain: [actual output]
86
+
87
+ 2. **VERIFICATION** (mandatory)
38
88
  - git status: [actual output or "not run"]
39
89
  - git diff --name-only: [list or "none"]
40
90
  - Files modified: [explicit list or "NONE"]
41
91
 
42
- 2. **What changed** (evidence-required)
43
- - For each claimed change, include:
44
- - File path
45
- - What changed (specific, not vague)
46
- - Evidence: diff snippet, command output, or exact file content quote
92
+ 3. **What changed** (evidence-required, strict gating)
93
+ - **For each claimed change, you MUST include ONE of:**
94
+ - `git diff --name-only` showing the file
95
+ - A `git diff` snippet (exact quoted output)
96
+ - A direct file excerpt with explicit file path + exact quoted lines
97
+ - **If you cannot provide evidence, write "Not verified" and omit from "What changed".**
98
+ - **No evidence → do not claim changes.**
47
99
 
48
- 3. **Files involved**
49
- - Exact file paths (only files that exist or were modified)
100
+ 4. **Files involved**
101
+ - Exact file paths (only files that exist or were modified, with evidence)
50
102
 
51
- 4. **Decisions** (if any)
103
+ 5. **Decisions** (if any)
52
104
  - Decision
53
105
  - Why
54
106
  - Trade-offs
55
107
 
56
- 5. **Next steps**
108
+ 6. **Next steps**
57
109
  - 3–7 steps, atomic
58
110
 
59
- 6. **Project memory updates**
111
+ 7. **Project memory updates**
60
112
  - Provide copy-paste text for:
61
113
  - docs/status.md
62
114
  - docs/todo.md
@@ -66,27 +118,32 @@ VERIFICATION
66
118
 
67
119
  **Use this if no evidence of changes exists:**
68
120
 
69
- 1. **VERIFICATION** (mandatory, at top)
121
+ 1. **REPO CONTEXT PROOF** (mandatory, at top)
122
+ - pwd: [actual current directory]
123
+ - git rev-parse --show-toplevel: [actual repo root]
124
+ - git status --porcelain: [actual output]
125
+
126
+ 2. **VERIFICATION** (mandatory)
70
127
  - git status: [actual output]
71
128
  - git diff --name-only: [actual output]
72
129
  - Files modified: NONE
73
130
 
74
- 2. **Session summary**
131
+ 3. **Session summary**
75
132
  - **MUST state explicitly:**
76
133
  ```
77
134
  No files were created, modified, or deleted.
78
135
  This session was read-only inspection only.
79
136
  ```
80
137
 
81
- 3. **What was inspected** (optional, only if relevant)
138
+ 4. **What was inspected** (optional, only if relevant)
82
139
  - Files read
83
140
  - Commands run
84
141
  - Information gathered
85
142
 
86
- 4. **Next steps** (if any)
143
+ 5. **Next steps** (if any)
87
144
  - 3–7 steps, atomic
88
145
 
89
- 5. **Project memory updates** (if any changes to understanding)
146
+ 6. **Project memory updates** (if any changes to understanding)
90
147
  - Provide copy-paste text for:
91
148
  - docs/status.md
92
149
  - docs/todo.md
@@ -99,4 +156,7 @@ VERIFICATION
99
156
  - No "this should work"
100
157
  - No vague summaries without evidence
101
158
  - No claiming changes without proof
159
+ - No line numbers, diffs, or file changes without evidence
102
160
  - Clean repo → clean close (read-only mode)
161
+ - If git is unavailable, ignore change-reporting sections entirely
162
+ - /close is read-only: suggest commands, do not run changes