3 -This document captures all planned work before implementation begins.
7 -##
Mission 1: Simplify README 9 -Restructure the README into two clear audiences: users who just want to install, and developers who want to hack locally.
11 -###
User section (top) 13 -Keep it terse. Show git install first, default branch as alternative. Preserve the filtering example so users who only want a subset of extensions know how to do it.
16 -pi install git:github.com/bugabinga/pi-ext@v0.0.3
22 -pi install git:github.com/bugabinga/pi-ext
25 -Keep the `settings.json` filter example with its existing bullet rules.
27 -###
Development section (bottom) 29 -Move local checkout instructions here. Add a note about the bun/npm subtlety.
32 -- Run `bun install` inside the repo (local paths do not auto-install dependencies)
33 -- Then either `pi install /absolute/path` or add to `settings.json`
34 -- Terse note: pi runs `npm install --omit=dev` for git sources; it ignores `bun.lock`. In practice npm 7+ resolves the workspace correctly.
36 -Remove local path examples from the user section.
40 -##
Mission 2: Inline `ignore` in `llmiterate` 42 -The `llmiterate` extension depends on the `ignore` npm package. Remove it by inlining a minimal gitignore matcher.
46 -Only `llmiterate` and `diff-review` pull in non-pi runtime dependencies.
47 -`ignore` is tiny and used for a narrow purpose. Replacing it with a local implementation removes one `node_modules` requirement.
48 -The `@pierre/*` packages in `diff-review` are large and used for browser UI; they stay.
52 -`watcher.ts` uses two things from the `ignore` package:
54 -- `ignore()` — factory function returning a matcher
55 -- `matcher.add(source: string)` — adds patterns from `.gitignore`/`.ignore` content
56 -- `matcher.ignores(path: string)` — checks if a path matches
58 -The watcher feeds multiline strings (file contents) into `add()`, then checks individual file paths with `ignores()`.
62 -1. **Verify baseline green**
64 - bun test extensions/llmiterate/__tests__/
*.test.ts
67 -2. **Add isolated matcher tests**
68 - Create `extensions/llmiterate/__tests__/gitignore.test.ts` covering the semantics the watcher relies on:
69 - - Comments and blank lines are skipped
70 - - `logs/` ignores the directory and anything inside
71 - - `*.tmp` ignores files at any depth
72 - - `!important.log` negates a previous ignore
73 - - `/build/` anchors to the context root
74 - - `src/noisy/` ignores the directory and descendants
75 - - Multiple patterns from a multiline string
76 - - `**` matches any number of directory levels (`a/**/b`)
77 - - Character classes `[abc]` match single chars
78 - - Escaped specials (`\#`, `\!`, `\ `, `\*`) are treated as literals
79 - - Trailing-slash semantics: `build/` ignores only directories; `build` ignores files and directories
80 - - Multiple negations in sequence (`*.log` → `!a.log` → `!b.log`)
81 - - Nested directory patterns (`node_modules/**/package.json`)
82 - - Edge: pattern `*` does NOT match path separator (`a/b` should not match `*`)
84 -3. **Implement replacement**
85 - Create `extensions/llmiterate/gitignore.ts` with a `GitIgnoreMatcher` class:
86 - - `add(source: string): this` — parses patterns line by line
87 - - `ignores(path: string): boolean` — checks against accumulated patterns
88 - - Tracks negation (`!`), directory-only (trailing `/`), and anchoring (leading `/`)
89 - - Converts glob patterns to regexes:
92 - - Unanchored patterns match at any depth
93 - - Leading `/` anchors to the context root
94 - - Applies patterns in order; negation flips state
95 - - Estimated: ~120 lines
97 -4. **Swap dependency in `watcher.ts`**
98 - - Remove `import ignore, { type Ignore } from "ignore";`
99 - - Add `import { GitIgnoreMatcher } from "./gitignore";`
100 - - Replace `ignore()` with `new GitIgnoreMatcher()`
101 - - Update `IgnoreContext` type
103 -5. **Remove dependency**
104 - - Delete `"ignore": "^7.0.5"` from `extensions/llmiterate/package.json`
106 -6. **Verify all tests pass**
108 - bun test extensions/llmiterate/__tests__/
*.test.ts
113 -##
Mission 3: Move pi-ext into dotfiles 115 -Your dotfiles repo (`~/Workspace/dotfiles`) already symlinks `pi/` → `~/.pi`. Add pi-ext as a tracked submodule so it lives under dotfiles control.
117 -###
Git config confirmation 119 -Both your personal and work git configs already have:
126 -This means `git pull` in dotfiles will automatically recurse into submodules and update them to the pinned commit.
130 -1. **Add submodule**
132 - cd ~/Workspace/dotfiles
133 - git submodule add https://github.com/bugabinga/pi-ext.git pi-ext
134 - git config -f .gitmodules submodule.pi-ext.branch trunk
135 - git submodule update --init --recursive
140 -2. **Update settings.json**
141 - Edit `~/Workspace/dotfiles/pi/agent/settings.json`:
147 - "source":
"~/Workspace/dotfiles/pi-ext" 153 -3. **Clean up old paths**
154 - - Delete `pi-ext` / `~/Workspace/pi-ext` lines from `desktop.symlinks`
155 - - Remove the old `~/Workspace/pi-ext` directory if it still exists
156 - - The canonical location becomes `~/Workspace/dotfiles/pi-ext`
158 -4. **Development workflow**
160 - cd ~/Workspace/dotfiles/pi-ext
164 - cd ~/Workspace/dotfiles
166 - git commit -m
"update pi-ext" 169 - After `git pull` in dotfiles, the submodule updates automatically.
170 - To also pull latest trunk for the submodule:
172 - git pull --recurse-submodules
174 - git submodule update --remote
177 -###
Post-update ritual 179 -After pulling dotfiles updates, you may need:
182 -cd ~/Workspace/dotfiles/pi-ext
&& bun install
185 -Consider adding this to a `just update` recipe or similar.
191 -1. `docs: add PLAN.md` (this document)
192 -2. `docs: simplify README — separate user and dev install sections`
193 -3. `refactor(llmiterate): inline gitignore matcher, remove ignore dependency`
194 -4. `chore: move pi-ext into dotfiles as submodule`
198 -*Prepared before implementation session.*