pi-odd-worktree 3.16.0 → 3.16.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.
|
@@ -2891,7 +2891,12 @@ function observeOddWriteForNaming(event, ctx, pi, allowPhaseTrigger) {
|
|
|
2891
2891
|
if (ODD_NAMING_TOOLS.has(oddToolNameOf(event))) {
|
|
2892
2892
|
for (const raw of oddTouchedPaths(oddArgsOf(event))) {
|
|
2893
2893
|
const abs = path.isAbsolute(raw) ? raw : path.join(cwd, raw);
|
|
2894
|
-
|
|
2894
|
+
// Naming follows the DOCUMENT, not the checkout the call started in: an
|
|
2895
|
+
// `odd/tasks/<name>.md` inside a registered worktree names the session even
|
|
2896
|
+
// when the session's cwd is the principal checkout, which is how a harness
|
|
2897
|
+
// that keeps its session in `main` writes its ODDs.
|
|
2898
|
+
const documentEntry = oddEntryForCwd(rows, abs) || entry;
|
|
2899
|
+
const rel = oddRelFor(abs, documentEntry.path, principalRoot);
|
|
2895
2900
|
if (!rel) continue;
|
|
2896
2901
|
touched.push(rel);
|
|
2897
2902
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-odd-worktree",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.1",
|
|
4
4
|
"description": "Pi package for odd-worktree: the Git worktree tools a Pi session uses (create and list the checkouts the agent works in), the /warp worktree panel, the /odd ODD viewer, and the /issues GitHub issue reader. Needs only Pi and git: no companion app, no extra service.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -39,6 +39,15 @@ function git(cwd, args) {
|
|
|
39
39
|
return execFileSync('git', args, { cwd, encoding: 'utf8' }).trim();
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
// A checkout this package owns — `<repo-parent>/<repo-name>-worktrees/<odd>`, the
|
|
43
|
+
// one path rule the registry has — with its own `odd/tasks/`.
|
|
44
|
+
function makeWorktree(repo, odd) {
|
|
45
|
+
const dir = path.join(path.dirname(repo), `${path.basename(repo)}-worktrees`, odd);
|
|
46
|
+
git(repo, ['worktree', 'add', '-q', dir, '-b', `feat/${odd}`]);
|
|
47
|
+
fs.mkdirSync(path.join(dir, 'odd', 'tasks'), { recursive: true });
|
|
48
|
+
return dir;
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
// A repository whose principal checkout IS the ODD's home: one commit, `odd/tasks/`
|
|
43
52
|
// present, nothing registered.
|
|
44
53
|
function makeRepo() {
|
|
@@ -157,3 +166,33 @@ describe('naming from the principal checkout', () => {
|
|
|
157
166
|
assert.equal(host.state.name, 'Mi sesión de investigación');
|
|
158
167
|
});
|
|
159
168
|
});
|
|
169
|
+
|
|
170
|
+
describe('naming follows the document, not the checkout the call started in', () => {
|
|
171
|
+
test('a write into a registered worktree renames from the principal checkout', async () => {
|
|
172
|
+
const repo = makeRepo();
|
|
173
|
+
const worktree = makeWorktree(repo, 'older-session');
|
|
174
|
+
const host = makeHost();
|
|
175
|
+
const extension = await loadExtension(host);
|
|
176
|
+
// The harness keeps its session in the principal checkout and the agent writes
|
|
177
|
+
// the ODD document where the work actually lives: the worktree.
|
|
178
|
+
fireToolCall(
|
|
179
|
+
extension,
|
|
180
|
+
{ toolName: 'write', arguments: { path: path.join(worktree, 'odd/tasks/prompt-card-fix.md') } },
|
|
181
|
+
contextFor(host, repo),
|
|
182
|
+
);
|
|
183
|
+
assert.equal(host.state.name, 'Prompt card fix');
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
test('a write from inside that same worktree still renames', async () => {
|
|
187
|
+
const repo = makeRepo();
|
|
188
|
+
const worktree = makeWorktree(repo, 'older-session');
|
|
189
|
+
const host = makeHost();
|
|
190
|
+
const extension = await loadExtension(host);
|
|
191
|
+
fireToolCall(
|
|
192
|
+
extension,
|
|
193
|
+
{ toolName: 'edit', arguments: { path: 'odd/tasks/warp-odd-picker.md' } },
|
|
194
|
+
contextFor(host, worktree),
|
|
195
|
+
);
|
|
196
|
+
assert.equal(host.state.name, 'Warp odd picker');
|
|
197
|
+
});
|
|
198
|
+
});
|