@aethrekh/pi-cs 0.1.9 → 0.1.10-alpha.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ---
9
9
 
10
+ ## [0.1.10-alpha.1](https://github.com/AshishBagdane/pi-cs/compare/v0.1.10-alpha.0...v0.1.10-alpha.1) (2026-06-05)
11
+
12
+ ### ### Fixed
13
+
14
+ * self-heal stale APPEND_SYSTEM.md on session_start ([c0c5027](https://github.com/AshishBagdane/pi-cs/commit/c0c50279d8682a5e8d15e6789ffdbc229ab5cfeb))
15
+
16
+ ## [0.1.10-alpha.0](https://github.com/AshishBagdane/pi-cs/compare/v0.1.9...v0.1.10-alpha.0) (2026-06-05)
17
+
18
+ ### ### Fixed
19
+
20
+ * scope persona injection to active sessions, remove global APPEND_SYSTEM.md write ([eb86028](https://github.com/AshishBagdane/pi-cs/commit/eb86028a14c2f34eb982da127e0806e1a7bad219))
21
+
22
+ ### ### Changed
23
+
24
+ * fix and expand CLAUDE.md with accurate architecture details ([fc7d4d8](https://github.com/AshishBagdane/pi-cs/commit/fc7d4d8c382b1bea1286de2f6dc8be59f5bcf74b))
25
+
10
26
  ## [0.1.9](https://github.com/AshishBagdane/pi-cs/compare/v0.1.8...v0.1.9) (2026-06-04)
11
27
 
12
28
  ### Fixed
package/README.md CHANGED
@@ -29,14 +29,12 @@ It covers every dimension of a CS degree:
29
29
  ## Quick Start
30
30
 
31
31
  ```bash
32
- # Install pi-cs
33
- pi install npm:@aethrekh/pi-cs
34
-
35
- # Navigate to your university folder
36
- cd ~/university/fall2025
32
+ # Install Pisces in your university workspace (recommended)
33
+ cd ~/university
34
+ pi install npm:@aethrekh/pi-cs -l
37
35
 
38
36
  # Initialize your semester context
39
- /semester
37
+ /semester --init
40
38
 
41
39
  # Start working
42
40
  /homework
@@ -44,6 +42,8 @@ cd ~/university/fall2025
44
42
  /leetcode 42
45
43
  ```
46
44
 
45
+ > **Global install:** `pi install npm:@aethrekh/pi-cs` (without `-l`) activates Pisces in every Pi session, including non-university projects. Use this only if you want Pisces everywhere.
46
+
47
47
  ---
48
48
 
49
49
  ## Semester Context
@@ -193,7 +193,7 @@ See [`config/schema.json`](config/schema.json) for the full configuration refere
193
193
 
194
194
  ## Installation
195
195
 
196
- **Requirements:** Pi >= 1.0.0, Node.js >= 18
196
+ **Requirements:** Pi >= 0.78.0, Node.js >= 18
197
197
 
198
198
  ```bash
199
199
  pi install npm:@aethrekh/pi-cs
@@ -182,11 +182,10 @@ function semesterContextBlock(ctx) {
182
182
  .filter(Boolean)
183
183
  .join("\n");
184
184
  }
185
- // ─── Persona ───────────────────────────────────────────────────────────────
186
- const APPEND_SYSTEM_PATH = path.join(os.homedir(), ".pi", "agent", "APPEND_SYSTEM.md");
185
+ // ─── Persona Loader ────────────────────────────────────────────────────────
187
186
  function loadPersona() {
188
187
  const candidates = [
189
- path.resolve(__dirname, "../SYSTEM.md"), // compiled: extensions/ → package root
188
+ path.resolve(__dirname, "../SYSTEM.md"), // compiled: dist/extensions/ → dist/
190
189
  path.resolve(__dirname, "../../SYSTEM.md"), // dev ts-node: src/extensions/ → project root
191
190
  path.resolve(__dirname, "../../../SYSTEM.md"),
192
191
  ];
@@ -202,31 +201,31 @@ function loadPersona() {
202
201
  }
203
202
  return "";
204
203
  }
205
- const PERSONA = loadPersona();
206
- function ensurePersonaInstalled() {
207
- if (!PERSONA)
208
- return "noop";
204
+ // ─── Stale Global File Cleanup ─────────────────────────────────────────────
205
+ const LEGACY_APPEND_PATH = path.join(os.homedir(), ".pi", "agent", "APPEND_SYSTEM.md");
206
+ function removeLegacyGlobalPersona(persona) {
207
+ if (!persona)
208
+ return false;
209
209
  try {
210
- const existing = fs.existsSync(APPEND_SYSTEM_PATH)
211
- ? fs.readFileSync(APPEND_SYSTEM_PATH, "utf-8").trim()
212
- : "";
213
- if (existing === PERSONA)
214
- return "noop";
215
- fs.mkdirSync(path.dirname(APPEND_SYSTEM_PATH), { recursive: true });
216
- fs.writeFileSync(APPEND_SYSTEM_PATH, PERSONA, "utf-8");
217
- return existing === "" ? "installed" : "updated";
210
+ if (!fs.existsSync(LEGACY_APPEND_PATH))
211
+ return false;
212
+ const existing = fs.readFileSync(LEGACY_APPEND_PATH, "utf-8").trim();
213
+ if (existing !== persona)
214
+ return false;
215
+ fs.unlinkSync(LEGACY_APPEND_PATH);
216
+ return true;
218
217
  }
219
218
  catch {
220
- return "noop";
219
+ return false;
221
220
  }
222
221
  }
223
222
  // ─── Pi Extension Factory ──────────────────────────────────────────────────
224
223
  function default_1(pi) {
224
+ const persona = loadPersona();
225
225
  let semesterCtx = null;
226
226
  pi.on("session_start", async (_event, ctx) => {
227
- const personaStatus = ensurePersonaInstalled();
228
- if (personaStatus === "installed" || personaStatus === "updated") {
229
- ctx.ui.notify(`🐠 Pisces persona ${personaStatus} — restart Pi for it to take effect.`, "info");
227
+ if (removeLegacyGlobalPersona(persona)) {
228
+ ctx.ui.notify("🐠 Pisces: cleaned up a stale ~/.pi/agent/APPEND_SYSTEM.md from an older install. Persona is now session-scoped.", "info");
230
229
  }
231
230
  const result = detectSemesterContext();
232
231
  if (result.found && result.context) {
@@ -239,9 +238,14 @@ function default_1(pi) {
239
238
  }
240
239
  });
241
240
  pi.on("before_agent_start", async (event) => {
242
- if (!semesterCtx)
241
+ const parts = [];
242
+ if (persona)
243
+ parts.push(persona);
244
+ if (semesterCtx)
245
+ parts.push(semesterContextBlock(semesterCtx));
246
+ if (parts.length === 0)
243
247
  return;
244
- return { systemPrompt: `${event.systemPrompt}\n\n${semesterContextBlock(semesterCtx)}` };
248
+ return { systemPrompt: [event.systemPrompt, ...parts].join("\n\n") };
245
249
  });
246
250
  }
247
251
  // ─── Pi Extension Entry Point ──────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aethrekh/pi-cs",
3
- "version": "0.1.9",
3
+ "version": "0.1.10-alpha.1",
4
4
  "description": "Pisces — The CS Student Edition for Pi Coding Agent. Your personal AI teaching assistant from homework to thesis.",
5
5
  "keywords": [
6
6
  "academic",
package/pi-cs.meta.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-cs",
3
- "version": "0.1.9",
4
- "built_at": "2026-06-04T17:05:59.017Z",
3
+ "version": "0.1.10-alpha.1",
4
+ "built_at": "2026-06-05T10:16:13.700Z",
5
5
  "entry": "index.js",
6
6
  "node_minimum": "18.0.0"
7
7
  }
package/pi-package.yaml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: pi-cs
2
- version: 0.1.9-alpha.0
2
+ version: 0.1.10-alpha.1
3
3
  display_name: "pi-cs (Pisces)"
4
4
  description: "The CS Student Edition for Pi — Your personal AI teaching assistant for Computer Science, from homework to thesis."
5
5
  icon: public/pisces-logo-512.png
package/postinstall.d.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  * postinstall.ts
3
3
  *
4
4
  * Runs automatically after `pi install npm:@aethrekh/pi-cs`.
5
- * Writes SYSTEM.md to ~/.pi/agent/APPEND_SYSTEM.md so the Pisces persona
6
- * is active from the very first Pi session — no restart required.
5
+ * Persona injection is handled at runtime via the before_agent_start hook
6
+ * in semester-detector.ts, scoped to sessions where pi-cs is active.
7
+ * No global APPEND_SYSTEM.md write is performed.
7
8
  */
8
- export {};
9
9
  //# sourceMappingURL=postinstall.d.ts.map
package/postinstall.js CHANGED
@@ -3,64 +3,8 @@
3
3
  * postinstall.ts
4
4
  *
5
5
  * Runs automatically after `pi install npm:@aethrekh/pi-cs`.
6
- * Writes SYSTEM.md to ~/.pi/agent/APPEND_SYSTEM.md so the Pisces persona
7
- * is active from the very first Pi session — no restart required.
6
+ * Persona injection is handled at runtime via the before_agent_start hook
7
+ * in semester-detector.ts, scoped to sessions where pi-cs is active.
8
+ * No global APPEND_SYSTEM.md write is performed.
8
9
  */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || (function () {
26
- var ownKeys = function(o) {
27
- ownKeys = Object.getOwnPropertyNames || function (o) {
28
- var ar = [];
29
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
- return ar;
31
- };
32
- return ownKeys(o);
33
- };
34
- return function (mod) {
35
- if (mod && mod.__esModule) return mod;
36
- var result = {};
37
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
- __setModuleDefault(result, mod);
39
- return result;
40
- };
41
- })();
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- const fs = __importStar(require("fs"));
44
- const path = __importStar(require("path"));
45
- const os = __importStar(require("os"));
46
- const systemMdPath = path.join(__dirname, "SYSTEM.md");
47
- const appendPath = path.join(os.homedir(), ".pi", "agent", "APPEND_SYSTEM.md");
48
- try {
49
- if (!fs.existsSync(systemMdPath))
50
- process.exit(0);
51
- const content = fs.readFileSync(systemMdPath, "utf-8").trim();
52
- if (!content)
53
- process.exit(0);
54
- fs.mkdirSync(path.dirname(appendPath), { recursive: true });
55
- const existing = fs.existsSync(appendPath)
56
- ? fs.readFileSync(appendPath, "utf-8").trim()
57
- : "";
58
- if (existing !== content) {
59
- fs.writeFileSync(appendPath, content, "utf-8");
60
- console.log("🐠 Pisces persona installed → ~/.pi/agent/APPEND_SYSTEM.md");
61
- }
62
- }
63
- catch {
64
- // Never fail install
65
- }
66
10
  //# sourceMappingURL=postinstall.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"postinstall.js","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AACvD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;AAE/E,IAAI,CAAC;IACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9D,IAAI,CAAC,OAAO;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAE9B,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;QACxC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE;QAC7C,CAAC,CAAC,EAAE,CAAC;IACP,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC;AAAC,MAAM,CAAC;IACP,qBAAqB;AACvB,CAAC"}
1
+ {"version":3,"file":"postinstall.js","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG"}