pi-odd-worktree 1.2.0 → 2.1.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.
- package/README.md +65 -26
- package/extensions/odd-worktree-tools.ts +576 -119
- package/lib/odd-prompt/odd-worktrees.with-codegraph.md +19 -0
- package/lib/odd-prompt/odd-worktrees.without-codegraph.md +15 -0
- package/lib/odd-worktrees-prompt.js +25 -28
- package/lib/warp-delete-confirm.js +1 -1
- package/lib/worktree-card.js +7 -7
- package/lib/worktree-close-herdr.js +1 -1
- package/lib/worktree-hooks.js +7 -6
- package/lib/worktree-model-result.js +2 -2
- package/lib/worktree-session-guard.js +1 -1
- package/lib/worktree-warp-busy.js +488 -43
- package/package.json +1 -1
- package/tools/odd-worktrees-prompt.test.js +36 -29
- package/tools/package-surface.test.js +7 -4
- package/tools/t5-session-identity.test.js +4 -4
- package/tools/warp-busy-guard.test.js +812 -172
- package/tools/warp-delete-confirm.test.js +1 -1
- package/tools/worktree-close-herdr-async.test.js +2 -2
- package/tools/worktree-session-guard.test.js +1 -1
- package/tools/worktree-tools.test.js +177 -13
|
@@ -86,7 +86,7 @@ describe('registration', () => {
|
|
|
86
86
|
const { hasCodegraph } = require('../lib/codegraph-session.js');
|
|
87
87
|
const expected = hasCodegraph(process.env) ? [...base, ...codegraph].sort() : base;
|
|
88
88
|
assert.deepEqual(registered, expected, 'the command list is the base three plus the codegraph triple exactly when the CLI is present');
|
|
89
|
-
assert.deepEqual([...tools.keys()].sort(), ['
|
|
89
|
+
assert.deepEqual([...tools.keys()].sort(), ['worktree_create', 'worktree_delete', 'worktree_list', 'worktree_warp']);
|
|
90
90
|
assert.deepEqual([...messageRenderers.keys()], ['worktree-warp']);
|
|
91
91
|
});
|
|
92
92
|
|
|
@@ -98,13 +98,13 @@ describe('registration', () => {
|
|
|
98
98
|
};
|
|
99
99
|
assert.deepEqual(summary('worktree_create'), { name: 'worktree_create', label: 'Worktree Create' });
|
|
100
100
|
assert.deepEqual(summary('worktree_list'), { name: 'worktree_list', label: 'Worktree List' });
|
|
101
|
-
assert.deepEqual(summary('
|
|
101
|
+
assert.deepEqual(summary('worktree_delete'), { name: 'worktree_delete', label: 'Worktree Delete' });
|
|
102
102
|
assert.deepEqual(summary('worktree_warp'), { name: 'worktree_warp', label: 'Worktree Warp' });
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
-
test('the
|
|
105
|
+
test('the delete help text names the active-session refusal and no Herdr workspace', async () => {
|
|
106
106
|
const { tools } = await loadExtension({});
|
|
107
|
-
const description = tools.get('
|
|
107
|
+
const description = tools.get('worktree_delete').description;
|
|
108
108
|
assert.match(description, /live Pi session working in that checkout/);
|
|
109
109
|
assert.match(description, /warp to another checkout first/i);
|
|
110
110
|
assert.match(description, /git/);
|
|
@@ -139,7 +139,10 @@ describe('removed surface', () => {
|
|
|
139
139
|
assert.equal(commands.has(gone), false, `no /${gone} command`);
|
|
140
140
|
}
|
|
141
141
|
assert.equal(commands.has('issues'), true, '/issues is the migrated command');
|
|
142
|
+
// Modules only: `lib/` also holds the prompt prose (`lib/odd-prompt/*.md`),
|
|
143
|
+
// which no module reads through `require`.
|
|
142
144
|
for (const file of fs.readdirSync(path.join(ROOT, 'lib'))) {
|
|
145
|
+
if (!fs.statSync(path.join(LIB_DIR, file)).isFile()) continue;
|
|
143
146
|
const text = fs.readFileSync(path.join(LIB_DIR, file), 'utf8');
|
|
144
147
|
assert.equal(/require\(['"]\.\/gh-issues\.js['"]\)/.test(text), false, `lib/${file} does not pull the issues reader`);
|
|
145
148
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// names that session. Nothing else may: no label, no prefix, no saved history.
|
|
15
15
|
//
|
|
16
16
|
// These cases are written against the PUBLIC surfaces only — the two exported
|
|
17
|
-
// guard functions and the registered `
|
|
17
|
+
// guard functions and the registered `worktree_delete` tool — so they keep
|
|
18
18
|
// working if internals move. Every fixture is a throwaway repository and agent
|
|
19
19
|
// home under the system temp directory; no real worktree, presence store or
|
|
20
20
|
// session is touched.
|
|
@@ -255,7 +255,7 @@ describe('S7 identity join through the registered tool', () => {
|
|
|
255
255
|
const sessionHash = publishPresence(AGENT_HOME, { sessionId: 'raw-session-7', label: 'Worker', workspace: target, heartbeat: Date.now(), incarnationIndex: 4 });
|
|
256
256
|
publishTransport(AGENT_HOME, { sessionId: 'raw-session-7' });
|
|
257
257
|
|
|
258
|
-
const closed = await tools.get('
|
|
258
|
+
const closed = await tools.get('worktree_delete').execute('t5-c2', { name: 'feat-t5-joined' }, undefined, undefined, ctx);
|
|
259
259
|
assert.equal(closed.isError, true);
|
|
260
260
|
const text = resultText(closed);
|
|
261
261
|
assert.ok(text.includes('id raw-session-7'), text);
|
|
@@ -277,7 +277,7 @@ describe('S7 identity join through the registered tool', () => {
|
|
|
277
277
|
const target = path.join(path.dirname(repo), `${path.basename(repo)}-worktrees`, 'feat-t5-unjoined');
|
|
278
278
|
const sessionHash = publishPresence(AGENT_HOME, { sessionId: 'raw-session-8', label: 'Worker', workspace: target, heartbeat: Date.now(), incarnationIndex: 5 });
|
|
279
279
|
|
|
280
|
-
const closed = await tools.get('
|
|
280
|
+
const closed = await tools.get('worktree_delete').execute('t5-c5', { name: 'feat-t5-unjoined' }, undefined, undefined, ctx);
|
|
281
281
|
assert.equal(closed.isError, true);
|
|
282
282
|
const text = resultText(closed);
|
|
283
283
|
assert.ok(text.includes(`presence ${sessionHash.slice(0, 12)}`), text);
|
|
@@ -295,7 +295,7 @@ describe('S7 identity join through the registered tool', () => {
|
|
|
295
295
|
// never be attributed to this checkout, and it must never block.
|
|
296
296
|
publishPresence(AGENT_HOME, { sessionId: 'legacy-peer', label: 'Legacy', heartbeat: Date.now(), incarnationIndex: 6, discovery: false });
|
|
297
297
|
|
|
298
|
-
const closed = await tools.get('
|
|
298
|
+
const closed = await tools.get('worktree_delete').execute('t5-c7', { name: 'feat-t5-notice' }, undefined, undefined, ctx);
|
|
299
299
|
assert.notEqual(closed.isError, true, resultText(closed));
|
|
300
300
|
const text = resultText(closed);
|
|
301
301
|
assert.match(text, /published no workspace/);
|