pi-gsd 1.7.0 → 1.8.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.
@@ -17,14 +17,55 @@
17
17
  */
18
18
 
19
19
  import { execSync } from "node:child_process";
20
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
20
+ import {
21
+ existsSync,
22
+ mkdirSync,
23
+ readFileSync,
24
+ statSync,
25
+ writeFileSync,
26
+ } from "node:fs";
21
27
  import { homedir } from "node:os";
22
28
  import { join } from "node:path";
23
29
  import type { ContextUsage, ExtensionAPI } from "@mariozechner/pi-coding-agent";
24
30
 
31
+ /**
32
+ * Extracts the <core> section from a reference file and writes a derived
33
+ * `-core.md` sibling. Runs on session_start and tool_result so the core
34
+ * file is always fresh — including immediately after the LLM creates the
35
+ * source file mid-session.
36
+ *
37
+ * @param cwd - project root
38
+ * @param ref - name segments, e.g. ['ui', 'brand'] → reads ui-brand.md,
39
+ * writes ui-brand-core.md
40
+ *
41
+ * Fallback: if the source has no <core> tag, copies the full file so
42
+ * prompts that reference the core variant never 404.
43
+ */
44
+ const syncReferenceToCore = (cwd: string, ref: string[]): void => {
45
+ try {
46
+ const refsDir = join(cwd, ".pi", "gsd", "references");
47
+ const refName = ref.join("-") + ".md";
48
+ const coreName = [...ref, "core"].join("-") + ".md";
49
+ const src = join(refsDir, refName);
50
+ const dst = join(refsDir, coreName);
51
+ if (!existsSync(src)) return;
52
+ const srcMtime = statSync(src).mtimeMs;
53
+ const dstMtime = existsSync(dst) ? statSync(dst).mtimeMs : 0;
54
+ if (srcMtime <= dstMtime) return; // already in sync
55
+ const content = readFileSync(src, "utf8");
56
+ const match = content.match(/<core>([\s\S]*?)<\/core>/i);
57
+ writeFileSync(dst, match ? match[1].trim() : content, "utf8");
58
+ } catch {
59
+ /* silent — never block session startup or tool execution */
60
+ }
61
+ };
62
+
25
63
  export default function (pi: ExtensionAPI) {
26
64
  // ── session_start: GSD update check ──────────────────────────────────────
27
65
  pi.on("session_start", async (_event, ctx) => {
66
+ // Sync derived core files from tagged reference sources
67
+ syncReferenceToCore(ctx.cwd, ["ui", "brand"]);
68
+
28
69
  try {
29
70
  const cacheDir = join(homedir(), ".pi", "cache");
30
71
  const cacheFile = join(cacheDir, "gsd-update-check.json");
@@ -529,6 +570,10 @@ export default function (pi: ExtensionAPI) {
529
570
  let lastLevel: "warning" | "critical" | null = null;
530
571
 
531
572
  pi.on("tool_result", async (_event, ctx) => {
573
+ // Keep derived core files in sync after any tool write (e.g. gsd-new-project
574
+ // creating ui-brand.md mid-session — no reboot needed)
575
+ syncReferenceToCore(ctx.cwd, ["ui", "brand"]);
576
+
532
577
  try {
533
578
  const usage: ContextUsage | undefined = ctx.getContextUsage();
534
579
  if (!usage || usage.percent === null) return undefined;
package/README.md CHANGED
@@ -117,30 +117,32 @@ Switch profile: `/gsd-set-profile <profile>`
117
117
 
118
118
  ## Comparison with GSD v1.30.0
119
119
 
120
- | Feature | gsd v1.30 | pi-gsd | Details |
121
- | -----------------------------------: | :-------: | :----: | :----------------------------------------------------------------------------------------------- |
122
- | `.planning/` data format | ✔️ | ✔️ | 100% compatible - projects are portable across tools |
123
- | Workstreams | ✔️ | ✔️ | Full workstream isolation |
124
- | 4 model profiles | ✔️ | ✔️ | quality / balanced / budget / inherit |
125
- | 18 subagents | ✔️ | ✔️ | Identical agent definitions |
126
- | 55 GSD skills | ✔️ | ✔️ | All commands available via pi prompt dispatcher (replaces skill system) |
127
- | Different skills paths for pi | ✔️ | ⚡ | All 55 skills moved to `.pi/gsd/` to enable advanced pi-gsd-tools integration |
128
- | pi harness (`.pi/`) | ❌ | ✔️ | New - GSD installs into pi's config dir |
129
- | Background hooks (pi) | ❌ | ✔️ | TypeScript extension (`gsd-hooks.ts`) installed via postinstall |
130
- | Pi session history ingestion | ❌ | ✔️ | `/gsd-profile-user` reads pi JSONL sessions from `~/.pi/agent/sessions/` |
131
- | `/gsd-setup-pi` onboarding | ❌ | ✔️ | Setup skill for `bun install` where postinstall is skipped (default untrusted behavior) |
132
- | `gsd-tools` → `pi-gsd-tools` CLI | ✔️ | ⚡ | Same commands basic signatures as original (`gsd-tools`) but enhanced |
133
- | `[-o\|--output] [toon\|json]` output | ❌ | ⚡ | Token-efficient toon renderer output (or json, if LLM absolutely needs it...) |
134
- | `[-p\|--pick] {JSONPath}` extraction | ❌ | ⚡ | Field extraction from CLI output |
135
- | TypeScript source | ❌ | ⚡ | Full TS port of gsd-tools (~9k lines) |
136
- | Compile-time type safety | ❌ | ✔️ | Full TypeScript only `FrontmatterObject` root type retains `any` (intentional, documented) |
137
- | Runtime validation (Zod) | ❌ | ✔️ | Zod schemas for all `.planning/` types; `validate health` checks `config.json` (W005) + `STATE.md` (W011) |
138
- | Smarter `--repair` | ❌ | ✔️ | Schema defaults fill missing `config.json` fields; W011 STATE.md issues trigger regeneration |
139
- | Instant commands (no LLM cost) | ❌ | ✔️ | `/gsd-progress`, `/gsd-stats`, `/gsd-health`, `/gsd-help`, `/gsd-next` zero LLM, editor pivot |
140
- | `/gsd-next` auto-advance | ❌ | ✔️ | Deterministic phase routing, pre-fills editor with the correct next command |
141
- | Prompt-dispatch for all skills | ❌ | ✔️ | 54 pi prompt templates clean autocomplete, arg hints, direct workflow dispatch |
142
- | `/gsd-plan-milestone` command | ❌ | ✔️ | Plan all unplanned phasesone mode question, scope pre-check per phase, context-safe checkpoint |
143
- | `/gsd-execute-milestone` command | ❌ | ✔️ | Execute all phases + scope guardian + auto gap/debt retry loop (insert-phase) + audit→complete→cleanup |
120
+ | Feature | gsd v1.30 | pi-gsd | Details |
121
+ | -----------------------------------: | :-------: | :----: | :-------------------------------------------------------------------------------------------------------- |
122
+ | `.planning/` data format | ✔️ | ✔️ | 100% compatible - projects are portable across tools |
123
+ | Workstreams | ✔️ | ✔️ | Full workstream isolation |
124
+ | 4 model profiles | ✔️ | ✔️ | quality / balanced / budget / inherit |
125
+ | 18 subagents | ✔️ | ✔️ | Identical agent definitions |
126
+ | 55 GSD skills | ✔️ | ✔️ | All commands available via pi prompt dispatcher (replaces skill system) |
127
+ | Different skills paths for pi | ✔️ | ⚡ | All 55 skills moved to `.pi/gsd/` to enable advanced pi-gsd-tools integration |
128
+ | pi harness (`.pi/`) | ❌ | ✔️ | New - GSD installs into pi's config dir |
129
+ | Background hooks (pi) | ❌ | ✔️ | TypeScript extension (`gsd-hooks.ts`) installed via postinstall |
130
+ | Pi session history ingestion | ❌ | ✔️ | `/gsd-profile-user` reads pi JSONL sessions from `~/.pi/agent/sessions/` |
131
+ | `/gsd-setup-pi` onboarding | ❌ | ✔️ | Setup skill for `bun install` where postinstall is skipped (default untrusted behavior) |
132
+ | `gsd-tools` → `pi-gsd-tools` CLI | ✔️ | ⚡ | Same commands basic signatures as original (`gsd-tools`) but enhanced |
133
+ | `[-o\|--output] [toon\|json]` output | ❌ | ⚡ | Token-efficient toon renderer output (or json, if LLM absolutely needs it...) |
134
+ | `[-p\|--pick] {JSONPath}` extraction | ❌ | ⚡ | Field extraction from CLI output |
135
+ | TypeScript source | ❌ | ⚡ | Full TS port of gsd-tools (~9k lines) |
136
+ | Compile-time type safety | ❌ | | Full TypeScript - only `FrontmatterObject` root type retains `any` (intentional, documented) |
137
+ | Runtime validation (Zod) | ❌ | | Zod schemas for all `.planning/` types; `validate health` checks `config.json` (W005) + `STATE.md` (W011) |
138
+ | Smarter `--repair` | ❌ | ✔️ | Schema defaults fill missing `config.json` fields; W011 STATE.md issues trigger regeneration |
139
+ | Instant commands (no LLM cost) | ❌ | ✔️ | `/gsd-progress`, `/gsd-stats`, `/gsd-health`, `/gsd-help`, `/gsd-next` - zero LLM, editor pivot |
140
+ | `/gsd-next` auto-advance | ❌ | ✔️ | Deterministic phase routing, pre-fills editor with the correct next command |
141
+ | Prompt-dispatch for all skills | ❌ | ✔️ | 54 pi prompt templates - clean autocomplete, arg hints, direct workflow dispatch |
142
+ | `ui-brand` context modularity | ❌ | ✔️ | `<core>` tag splits ui-brand.mdplanning gets 103 lines, UI commands get full 166 |
143
+ | `syncReferenceToCore` utility | ❌ | ✔️ | Auto-derives `-core.md` from any `<core>`-tagged reference; syncs on session start + after tool writes |
144
+ | `/gsd-plan-milestone` command | ❌ | ✔️ | Plan all unplanned phases - one mode question, scope pre-check per phase, context-safe checkpoint |
145
+ | `/gsd-execute-milestone` command | ❌ | ✔️ | Execute all phases + scope guardian + auto gap/debt retry loop (insert-phase) + audit→complete→cleanup |
144
146
 
145
147
  Legend: ✔️ done · ⚡ enhanced · ❌ not available
146
148
 
@@ -173,7 +175,7 @@ node scripts/validate-model-profiles.cjs
173
175
  ### Pre-commit hook
174
176
 
175
177
  The pre-commit hook runs `ralphi check` (typecheck + build) via [prek](https://github.com/j178/prek).
176
- prek is a dev-only tool install it once:
178
+ prek is a dev-only tool - install it once:
177
179
 
178
180
  ```sh
179
181
  # macOS / Linux (Homebrew)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-gsd",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Get Shit Done - Unofficial port of the renowned AI-native project-planning spec-driven toolkit",
5
5
  "main": "dist/pi-gsd-tools.js",
6
6
  "bin": {
@@ -2,6 +2,6 @@
2
2
  description: Run all remaining phases autonomously - discuss→plan→execute per phase
3
3
  ---
4
4
  @.pi/gsd/workflows/autonomous.md
5
- @.pi/gsd/references/ui-brand.md
5
+ @.pi/gsd/references/ui-brand-core.md
6
6
 
7
7
  $ARGUMENTS
package/prompts/gsd-do.md CHANGED
@@ -2,6 +2,6 @@
2
2
  description: Route freeform text to the right GSD command automatically
3
3
  ---
4
4
  @.pi/gsd/workflows/do.md
5
- @.pi/gsd/references/ui-brand.md
5
+ @.pi/gsd/references/ui-brand-core.md
6
6
 
7
7
  $ARGUMENTS
@@ -2,6 +2,5 @@
2
2
  description: List active GSD workspaces and their status
3
3
  ---
4
4
  @.pi/gsd/workflows/list-workspaces.md
5
- @.pi/gsd/references/ui-brand.md
6
5
 
7
6
  $ARGUMENTS
@@ -2,6 +2,5 @@
2
2
  description: Interactive command center for managing multiple phases from one terminal
3
3
  ---
4
4
  @.pi/gsd/workflows/manager.md
5
- @.pi/gsd/references/ui-brand.md
6
5
 
7
6
  $ARGUMENTS
@@ -3,7 +3,7 @@ description: Start a new milestone cycle - update PROJECT.md and route to requir
3
3
  ---
4
4
  @.pi/gsd/workflows/new-milestone.md
5
5
  @.pi/gsd/references/questioning.md
6
- @.pi/gsd/references/ui-brand.md
6
+ @.pi/gsd/references/ui-brand-core.md
7
7
  @.pi/gsd/templates/project.md
8
8
  @.pi/gsd/templates/requirements.md
9
9
 
@@ -3,7 +3,7 @@ description: Initialize a new project with deep context gathering and PROJECT.md
3
3
  ---
4
4
  @.pi/gsd/workflows/new-project.md
5
5
  @.pi/gsd/references/questioning.md
6
- @.pi/gsd/references/ui-brand.md
6
+ @.pi/gsd/references/ui-brand-core.md
7
7
  @.pi/gsd/templates/project.md
8
8
  @.pi/gsd/templates/requirements.md
9
9
 
@@ -2,6 +2,5 @@
2
2
  description: Create an isolated workspace with repo copies and independent .planning/
3
3
  ---
4
4
  @.pi/gsd/workflows/new-workspace.md
5
- @.pi/gsd/references/ui-brand.md
6
5
 
7
6
  $ARGUMENTS
@@ -2,6 +2,5 @@
2
2
  description: Zero-friction idea capture. Append, list, or promote notes to todos.
3
3
  ---
4
4
  @.pi/gsd/workflows/note.md
5
- @.pi/gsd/references/ui-brand.md
6
5
 
7
6
  $ARGUMENTS
@@ -2,6 +2,6 @@
2
2
  description: Create detailed phase plan (PLAN.md) with verification loop
3
3
  ---
4
4
  @.pi/gsd/workflows/plan-phase.md
5
- @.pi/gsd/references/ui-brand.md
5
+ @.pi/gsd/references/ui-brand-core.md
6
6
 
7
7
  $ARGUMENTS
@@ -2,6 +2,5 @@
2
2
  description: Generate developer behavioral profile and create Claude-discoverable artifacts
3
3
  ---
4
4
  @.pi/gsd/workflows/profile-user.md
5
- @.pi/gsd/references/ui-brand.md
6
5
 
7
6
  $ARGUMENTS
@@ -2,6 +2,5 @@
2
2
  description: Remove a GSD workspace and clean up worktrees
3
3
  ---
4
4
  @.pi/gsd/workflows/remove-workspace.md
5
- @.pi/gsd/references/ui-brand.md
6
5
 
7
6
  $ARGUMENTS