pi-odd-worktree 3.7.2 → 3.8.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/README.md +17 -16
- package/extensions/odd-worktree-tools.ts +85 -31
- package/lib/bash-design.js +49 -20
- package/lib/codegraph-card.js +52 -0
- package/lib/codegraph-session.js +4 -23
- package/lib/diff-design.js +5 -2
- package/lib/file-card-resolver.js +3 -3
- package/lib/file-card.js +1 -1
- package/lib/jobs-card-resolver.js +1 -1
- package/lib/jobs-card.js +2 -2
- package/lib/message-card.js +2 -2
- package/lib/modules.js +125 -0
- package/lib/odd-worktrees-prompt.js +12 -52
- package/lib/worktree-guard.js +20 -17
- package/lib/worktree-list.js +4 -4
- package/package.json +1 -1
- package/tools/bash-activity.test.js +4 -4
- package/tools/bash-design.test.js +56 -41
- package/tools/codegraph-card.test.js +96 -20
- package/tools/codegraph-session.test.js +0 -32
- package/tools/diff-design.test.js +2 -3
- package/tools/file-card.test.js +3 -3
- package/tools/jobs-card.test.js +3 -3
- package/tools/message-card.test.js +3 -3
- package/tools/modules-wiring.test.js +133 -0
- package/tools/modules.test.js +124 -0
- package/tools/odd-worktrees-prompt.test.js +12 -90
- package/tools/package-surface.test.js +14 -8
- package/tools/worktree-cards.test.js +1 -1
- package/tools/worktree-guard.test.js +16 -25
- package/tools/worktree-list.test.js +8 -8
- package/tools/worktree-tools.test.js +1 -1
- package/tools/worktree-write-guard.test.js +36 -1
- package/lib/odd-prompt/odd-worktrees-child.md +0 -3
|
@@ -107,6 +107,41 @@ function harness(options = {}) {
|
|
|
107
107
|
return { run, reads };
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// ---- S1/S3 (odd-write-exempt): an `odd/` path is always writable ----
|
|
111
|
+
|
|
112
|
+
describe('an ODD artifact is never refused, whatever branch the checkout is on', () => {
|
|
113
|
+
const oddFile = (name = 'tasks/probe.md') => path.join(PRINCIPAL, 'odd', name);
|
|
114
|
+
|
|
115
|
+
test('a write under `odd/` in the primary checkout on the default branch passes', { skip: NEEDS_NON_TEMP }, () => {
|
|
116
|
+
for (const toolName of ['edit', 'write']) {
|
|
117
|
+
const { run, reads } = harness();
|
|
118
|
+
assert.deepEqual(run([oddFile()], { toolName }), { block: false }, toolName);
|
|
119
|
+
assert.deepEqual(reads, { identity: 0, defaultBranch: 0, currentBranch: 0 }, `${toolName}: no git is read`);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test('the folder decides, wherever it sits, and a FILE named `odd` is not inside one', { skip: NEEDS_NON_TEMP }, () => {
|
|
124
|
+
const { run } = harness();
|
|
125
|
+
assert.deepEqual(run([path.join(PRINCIPAL, 'odd', 'tasks', 'a.md')]), { block: false });
|
|
126
|
+
assert.deepEqual(run([path.join(PRINCIPAL, 'sub', 'odd', 'b.md')]), { block: false }, 'a nested odd folder is one too');
|
|
127
|
+
// A file whose own name is `odd`, or a folder that only starts with those letters, is not exempt.
|
|
128
|
+
assert.equal(run([path.join(PRINCIPAL, 'lib', 'odd')]).block, true, 'a file named odd is a file');
|
|
129
|
+
assert.equal(run([path.join(PRINCIPAL, 'docs', 'a.md')]).block, true, 'a sibling folder is not odd/');
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('the exemption is per path: a refused path beside an ODD one still refuses, and names itself', { skip: NEEDS_NON_TEMP }, () => {
|
|
133
|
+
const { run } = harness();
|
|
134
|
+
assert.deepEqual(run([oddFile(), PRINCIPAL_FILE]), { block: true, reason: refusal(PRINCIPAL_FILE) });
|
|
135
|
+
assert.deepEqual(run([PRINCIPAL_FILE, oddFile()]), { block: true, reason: refusal(PRINCIPAL_FILE) });
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test('every other exemption is untouched: another branch still passes, a temp path still passes', { skip: NEEDS_NON_TEMP }, () => {
|
|
139
|
+
const { run } = harness({ currentBranch: 'feat/x' });
|
|
140
|
+
assert.deepEqual(run([PRINCIPAL_FILE]), { block: false });
|
|
141
|
+
assert.deepEqual(harness().run([path.join(scratch('odd-exempt'), 'a.txt')]), { block: false });
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
110
145
|
// ---- S4: the refusal itself ----
|
|
111
146
|
|
|
112
147
|
describe('the refusal is one sentence (S4)', () => {
|
|
@@ -440,7 +475,7 @@ describe('the tool_call handler the extension registers (S4)', () => {
|
|
|
440
475
|
assert.equal(await callTool({ toolName: 'read', input: { path: target } }, PRINCIPAL), undefined);
|
|
441
476
|
assert.equal(await callTool({ toolName: 'grep', input: { pattern: 'x', path: PRINCIPAL } }, PRINCIPAL), undefined);
|
|
442
477
|
assert.deepEqual(await callTool(bash('git worktree add ../odd-b'), PRINCIPAL), { block: true, reason: WORKTREE_ADD_REFUSAL });
|
|
443
|
-
assert.
|
|
478
|
+
assert.equal(await callTool(bash('git worktree list --porcelain'), PRINCIPAL), undefined);
|
|
444
479
|
assert.deepEqual(await callTool(bash('git switch develop'), PRINCIPAL), { block: true, reason: BRANCH_SWITCH_REFUSAL });
|
|
445
480
|
assert.equal(await callTool(bash('git switch develop'), linked), undefined);
|
|
446
481
|
assert.equal(await callTool(bash('git status'), PRINCIPAL), undefined);
|