@dreadedzombie/pi-init 1.3.0 → 1.4.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +17 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreadedzombie/pi-init",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Generates a typed AGENTS.md for your project — /init, /init research, /init debug, /init code",
5
5
  "license": "MIT",
6
6
  "author": "DreadedZombie",
package/src/index.ts CHANGED
@@ -18,6 +18,9 @@ import * as path from "node:path";
18
18
 
19
19
  const TEMPLATE_CODE = `# Project Agent
20
20
 
21
+ **Workspace Path:** \`{{CWD}}\`
22
+ *(Note to Pi: Your file write/edit tools run in a different directory by default. You MUST use absolute paths starting with the Workspace Path above for ALL file operations!)*
23
+
21
24
  <!-- Pi: before writing anything, explore this project:
22
25
  1. Read package.json / pyproject.toml / Cargo.toml / go.mod — identify stack and versions
23
26
  2. Scan directory structure: rg --files | head -60
@@ -58,11 +61,14 @@ const TEMPLATE_CODE = `# Project Agent
58
61
 
59
62
  const TEMPLATE_RESEARCH = `# Research Agent
60
63
 
64
+ **Workspace Path:** \`{{CWD}}\`
65
+ *(Note to Pi: Your file write/edit tools run in a different directory by default. You MUST use absolute paths starting with the Workspace Path above for ALL file operations!)*
66
+
61
67
  **Started:** <!-- Pi: insert today's date (YYYY-MM-DD) -->
62
68
 
63
69
  ## Output Rule — Files Before Chat
64
70
  **Never summarize findings in chat.** Every finding goes into a file.
65
- - Create \`research/<topic>.md\` as you complete each topic — not at the end
71
+ - Create \`{{CWD}}/research/<topic>.md\` as you complete each topic — not at the end
66
72
  - Update the Research Findings section in this file after writing each doc
67
73
  - Chat response comes last, only to say what files were written and what to do next
68
74
  - **If you are about to type a finding into chat — stop. Write it to a file instead.**
@@ -85,7 +91,7 @@ const TEMPLATE_RESEARCH = `# Research Agent
85
91
  2. **Dive** — read the full content of the 5-6 most relevant sources
86
92
  3. **Cross-reference** — identify what sources agree and disagree on
87
93
  4. **Synthesize** — build a coherent picture with citations
88
- 5. **Write** — save to \`research/<topic>.md\` with full detail, citations, code snippets, and gaps
94
+ 5. **Write** — save to \`{{CWD}}/research/<topic>.md\` with full detail, citations, code snippets, and gaps
89
95
  6. **Update AGENTS.md** — add the file to Research Findings below, one line per file
90
96
  7. Repeat steps 1-6 for each sub-topic before moving on
91
97
 
@@ -107,13 +113,16 @@ Each file should contain:
107
113
  - \`pi-docparser\` — for PDFs, papers, Word docs, spreadsheets
108
114
 
109
115
  ## Research Findings
110
- <!-- Pi: after writing each research/<topic>.md, add a line here immediately:
116
+ <!-- Pi: after writing each {{CWD}}/research/<topic>.md, add a line here immediately:
111
117
  - [Topic title](research/filename.md) — one-line summary of what was found
112
118
  Do not wait until the end. Update this section after every file written. -->
113
119
  `;
114
120
 
115
121
  const TEMPLATE_DEBUG = `# Debug Agent
116
122
 
123
+ **Workspace Path:** \`{{CWD}}\`
124
+ *(Note to Pi: Your file write/edit tools run in a different directory by default. You MUST use absolute paths starting with the Workspace Path above for ALL file operations!)*
125
+
117
126
  ## Research Findings
118
127
  <!-- Pi: read every file linked here before starting investigation — prior research is your context -->
119
128
 
@@ -260,10 +269,14 @@ export default function (pi: ExtensionAPI) {
260
269
  }
261
270
  }
262
271
 
263
- const content = type === "research" ? TEMPLATE_RESEARCH
272
+ let content = type === "research" ? TEMPLATE_RESEARCH
264
273
  : type === "debug" ? TEMPLATE_DEBUG
265
274
  : TEMPLATE_CODE;
266
275
 
276
+ // Ensure paths are absolute and formatted correctly for the LLM
277
+ const absoluteCwd = cwd.replace(/\\/g, "/");
278
+ content = content.replace(/\{\{CWD\}\}/g, absoluteCwd);
279
+
267
280
  fs.writeFileSync(dest, content, "utf8");
268
281
 
269
282
  // ── Research: scaffold research/ dir and plan.md so Pi fills in existing files ──