pi-odd-worktree 3.15.1 → 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.
- package/README.md +48 -25
- package/extensions/odd-worktree-tools.ts +70 -212
- package/lib/shell-api/api.ts +523 -0
- package/lib/shell-api/arm.ts +83 -0
- package/lib/shell-api/bus.ts +1389 -0
- package/lib/shell-api/capture.ts +1340 -0
- package/lib/shell-api/card-style-line.ts +112 -0
- package/lib/shell-api/card-style-rows.ts +390 -0
- package/lib/shell-api/card-style-transform.ts +862 -0
- package/lib/shell-api/card-style-wiring.ts +477 -0
- package/lib/shell-api/card-styles.ts +153 -0
- package/lib/shell-api/config.ts +71 -0
- package/lib/shell-api/extension.ts +247 -0
- package/lib/shell-api/hook.ts +322 -0
- package/lib/shell-api/index.ts +88 -0
- package/lib/shell-api/message-design-adoption.ts +549 -0
- package/lib/shell-api/message-design-rows.ts +313 -0
- package/lib/shell-api/message-design-wiring.ts +369 -0
- package/lib/shell-api/message-designs.ts +746 -0
- package/lib/shell-api/notices.ts +137 -0
- package/lib/shell-api/plugin-lines.ts +877 -0
- package/lib/shell-api/presence.ts +258 -0
- package/lib/shell-api/repaint.ts +351 -0
- package/lib/shell-api/row-labels.ts +146 -0
- package/lib/shell-api/row-names.ts +273 -0
- package/lib/shell-api/row-origin.ts +144 -0
- package/lib/shell-api/rows.ts +591 -0
- package/lib/shell-api/section-panel.ts +378 -0
- package/lib/shell-api/section-pointer.ts +164 -0
- package/lib/shell-api/sections-preview.ts +275 -0
- package/lib/shell-api/sections-rows.ts +133 -0
- package/lib/shell-api/sidebar-render.ts +705 -0
- package/lib/shell-api/sidebar.ts +1126 -0
- package/lib/shell-api/store.ts +279 -0
- package/lib/shell-api/tool-design-adoption.ts +263 -0
- package/lib/shell-api/tool-design-rows.ts +307 -0
- package/lib/shell-api/tool-design-wiring.ts +481 -0
- package/lib/shell-api/tool-designs.ts +1411 -0
- package/lib/shell-api/transform-pipeline.ts +351 -0
- package/lib/shell-api/types.ts +803 -0
- package/lib/shell-api/visibility.ts +154 -0
- package/package.json +3 -2
- package/tools/files-bridge.test.js +81 -66
- package/tools/fixtures/load-extension.js +40 -18
- package/tools/issues-command.test.js +4 -7
- package/tools/issues-section.test.js +71 -81
- package/tools/odd-rail-wiring.test.js +16 -10
- package/tools/package-surface.test.js +42 -13
- package/tools/prs-command.test.js +11 -6
- package/tools/session-auto-name-wiring.test.js +39 -0
- package/tools/shell-api/api.test.ts +484 -0
- package/tools/shell-api/apply-on-move.test.ts +529 -0
- package/tools/shell-api/arm.test.ts +220 -0
- package/tools/shell-api/bridge-ready.test.ts +309 -0
- package/tools/shell-api/bus.test.ts +194 -0
- package/tools/shell-api/button-rows.test.ts +435 -0
- package/tools/shell-api/capture.test.ts +583 -0
- package/tools/shell-api/card-style-rows.test.ts +493 -0
- package/tools/shell-api/card-style-transform.test.ts +379 -0
- package/tools/shell-api/card-style-wiring.test.ts +258 -0
- package/tools/shell-api/card-styles-e2e.test.ts +502 -0
- package/tools/shell-api/card-styles.test.ts +324 -0
- package/tools/shell-api/card-transcript-path.test.ts +178 -0
- package/tools/shell-api/compatibility-regression.test.mjs +64 -0
- package/tools/shell-api/config.test.ts +93 -0
- package/tools/shell-api/docs-coverage.test.ts +82 -0
- package/tools/shell-api/e2e.test.ts +562 -0
- package/tools/shell-api/example-bash-identity.test.ts +372 -0
- package/tools/shell-api/example-bash-matrix.test.ts +856 -0
- package/tools/shell-api/example-designs.test.ts +737 -0
- package/tools/shell-api/example-neon-transform.test.ts +283 -0
- package/tools/shell-api/example-plain-style.test.ts +1225 -0
- package/tools/shell-api/extension.test.ts +157 -0
- package/tools/shell-api/fake-events.ts +58 -0
- package/tools/shell-api/fake-host.ts +211 -0
- package/tools/shell-api/fake-sidebar.ts +516 -0
- package/tools/shell-api/fake-transcript.ts +486 -0
- package/tools/shell-api/frame-telemetry.test.ts +317 -0
- package/tools/shell-api/hook.test.ts +196 -0
- package/tools/shell-api/manifest.test.ts +47 -0
- package/tools/shell-api/message-design-adoption.test.ts +611 -0
- package/tools/shell-api/message-design-follows.test.ts +361 -0
- package/tools/shell-api/message-design-pi-release.test.mjs +157 -0
- package/tools/shell-api/message-design-regressions.test.mjs +162 -0
- package/tools/shell-api/message-design-rows.test.ts +266 -0
- package/tools/shell-api/message-design-wiring.test.ts +362 -0
- package/tools/shell-api/message-designs.test.ts +339 -0
- package/tools/shell-api/new-category.test.ts +1101 -0
- package/tools/shell-api/notices.test.ts +292 -0
- package/tools/shell-api/plugin-integration-lines.test.ts +827 -0
- package/tools/shell-api/presence.test.ts +396 -0
- package/tools/shell-api/rail-part-hits.test.ts +281 -0
- package/tools/shell-api/rail-surfaces.test.ts +402 -0
- package/tools/shell-api/rail-width.test.ts +406 -0
- package/tools/shell-api/regression.test.ts +434 -0
- package/tools/shell-api/repaint-api.test.ts +200 -0
- package/tools/shell-api/reserved-categories.test.ts +250 -0
- package/tools/shell-api/row-labels.test.ts +261 -0
- package/tools/shell-api/row-names.test.ts +407 -0
- package/tools/shell-api/row-origin.test.ts +395 -0
- package/tools/shell-api/row-placement-regression.test.ts +797 -0
- package/tools/shell-api/row-placement.test.ts +410 -0
- package/tools/shell-api/section-interaction.test.ts +364 -0
- package/tools/shell-api/section-panel.test.ts +430 -0
- package/tools/shell-api/section-placement-rail.test.ts +390 -0
- package/tools/shell-api/section-placement.test.ts +386 -0
- package/tools/shell-api/sections-preview.test.ts +312 -0
- package/tools/shell-api/sections-rows.test.ts +293 -0
- package/tools/shell-api/sidebar-backend.test.ts +477 -0
- package/tools/shell-api/sidebar-e2e.test.ts +317 -0
- package/tools/shell-api/sidebar-hover.test.ts +276 -0
- package/tools/shell-api/sidebar-independent.test.ts +291 -0
- package/tools/shell-api/sidebar-render.test.ts +281 -0
- package/tools/shell-api/sidebar-sections.test.ts +247 -0
- package/tools/shell-api/store.test.ts +192 -0
- package/tools/shell-api/surface-repaint-cost.test.ts +520 -0
- package/tools/shell-api/tool-design-card-style.test.ts +308 -0
- package/tools/shell-api/tool-design-chain.test.ts +471 -0
- package/tools/shell-api/tool-design-cost.test.ts +591 -0
- package/tools/shell-api/tool-design-rows.test.ts +627 -0
- package/tools/shell-api/tool-design-scopes-audit.test.ts +212 -0
- package/tools/shell-api/tool-designs.test.ts +2412 -0
- package/tools/shell-api/transform-pipeline.test.ts +376 -0
- package/tools/shell-api/transforms-bus.test.ts +233 -0
- package/tools/shell-api/verifier-width-regressions.test.ts +147 -0
- package/tools/shell-api-rpc.test.js +189 -0
- package/tools/user-prompt-card.test.js +8 -9
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S19 / L14: the CLAIM SET of `scopes` is every OWN key, and the `scope` shorthand keeps the
|
|
3
|
+
* diagnostics it had before `scopes` existed.
|
|
4
|
+
*
|
|
5
|
+
* Two defects the first S19 audit found, both observable through the published surface:
|
|
6
|
+
*
|
|
7
|
+
* 1. `scopes` was validated through `Object.keys` but READ through every own key, so a key that is
|
|
8
|
+
* not enumerable (a non-enumerable `read: null`, or a hidden foreign `find`) passed validation and
|
|
9
|
+
* then reached the live registry — and, through the legacy-selection migration, the persisted
|
|
10
|
+
* selection. S19 now validates EVERY own key (a symbol key included), and validation and reading
|
|
11
|
+
* use the SAME key set, so a refused registration leaves the registry and the store untouched.
|
|
12
|
+
* 2. The `scope` shorthand regressed against 262632d: the S8 conflict text and the ungrouped refusal
|
|
13
|
+
* text changed shape when `scopes` arrived. The shorthand must keep the previous text BYTE FOR
|
|
14
|
+
* BYTE (it IS `scopes` with one object, so S2 pins it); the per-tool wording belongs to `scopes`.
|
|
15
|
+
*
|
|
16
|
+
* Everything asserted here is public: `registerToolDesign`, the conflict record the diagnostics record
|
|
17
|
+
* prints, the live snapshot, and the bytes of the store file.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import assert from "node:assert/strict";
|
|
21
|
+
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
22
|
+
import { tmpdir } from "node:os";
|
|
23
|
+
import { join } from "node:path";
|
|
24
|
+
import test from "node:test";
|
|
25
|
+
|
|
26
|
+
import { resetNoticesForTests } from "../../lib/shell-api/notices.ts";
|
|
27
|
+
import { resetPluginLinesForTests } from "../../lib/shell-api/plugin-lines.ts";
|
|
28
|
+
import { createStore, resetStoreStateForTests } from "../../lib/shell-api/store.ts";
|
|
29
|
+
import {
|
|
30
|
+
TOOL_DESIGN_STORE_ID,
|
|
31
|
+
TOOL_DESIGN_STORE_KEY,
|
|
32
|
+
getToolDesignConflicts,
|
|
33
|
+
registerToolDesign,
|
|
34
|
+
resetToolDesignsForTests,
|
|
35
|
+
snapshotToolDesigns,
|
|
36
|
+
toolDesignClaims,
|
|
37
|
+
} from "../../lib/shell-api/tool-designs.ts";
|
|
38
|
+
import type { ToolDesignRegistration, ToolDesignScope } from "../../lib/shell-api/types.ts";
|
|
39
|
+
|
|
40
|
+
let configHome: string;
|
|
41
|
+
let previousConfigHome: string | undefined;
|
|
42
|
+
|
|
43
|
+
test.before(() => {
|
|
44
|
+
configHome = mkdtempSync(join(tmpdir(), "gsb-tool-design-scopes-audit-"));
|
|
45
|
+
previousConfigHome = process.env.GENTLE_PI_CONFIG_HOME;
|
|
46
|
+
process.env.GENTLE_PI_CONFIG_HOME = configHome;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test.after(() => {
|
|
50
|
+
if (previousConfigHome === undefined) delete process.env.GENTLE_PI_CONFIG_HOME;
|
|
51
|
+
else process.env.GENTLE_PI_CONFIG_HOME = previousConfigHome;
|
|
52
|
+
rmSync(configHome, { recursive: true, force: true });
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
/** Fresh state per case, the way `test/tool-designs.test.ts` resets the registry and the store. */
|
|
56
|
+
const resetAll = (): void => {
|
|
57
|
+
rmSync(join(configHome, "gentle-shell-bridge"), { recursive: true, force: true });
|
|
58
|
+
resetToolDesignsForTests();
|
|
59
|
+
resetStoreStateForTests();
|
|
60
|
+
resetNoticesForTests();
|
|
61
|
+
resetPluginLinesForTests();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
test.beforeEach(resetAll);
|
|
65
|
+
|
|
66
|
+
const apply = (lines: readonly string[]): string[] => [...lines];
|
|
67
|
+
const scope: ToolDesignScope = { description: "under odd/", matches: () => false };
|
|
68
|
+
|
|
69
|
+
/** The one store file this surface writes, so a refusal can be shown to leave it byte for byte. */
|
|
70
|
+
const storeFile = (): string => join(configHome, "gentle-shell-bridge", `${TOOL_DESIGN_STORE_ID}.json`);
|
|
71
|
+
|
|
72
|
+
const invalidKeys = [
|
|
73
|
+
["read", null, /scopes for tool "read" must be an object/u],
|
|
74
|
+
["find", scope, /scopes names tool "find", which is not one/u],
|
|
75
|
+
] as const;
|
|
76
|
+
|
|
77
|
+
test("S19: a non-enumerable `scopes` key is validated before anything is stored", () => {
|
|
78
|
+
for (const [key, value, reason] of invalidKeys) {
|
|
79
|
+
resetAll();
|
|
80
|
+
const id = `acme.hidden-${key}`;
|
|
81
|
+
// A legacy per-tool selection is exactly what a hidden key used to reach through the migration.
|
|
82
|
+
createStore(TOOL_DESIGN_STORE_ID).set(TOOL_DESIGN_STORE_KEY, { write: id });
|
|
83
|
+
const bytes = readFileSync(storeFile());
|
|
84
|
+
const registry = snapshotToolDesigns();
|
|
85
|
+
const scopes = Object.defineProperty({ write: scope }, key, { value });
|
|
86
|
+
assert.throws(
|
|
87
|
+
() =>
|
|
88
|
+
registerToolDesign({
|
|
89
|
+
line: "tools",
|
|
90
|
+
tools: ["write", "read"],
|
|
91
|
+
scopes,
|
|
92
|
+
id,
|
|
93
|
+
label: `hidden ${key}`,
|
|
94
|
+
apply,
|
|
95
|
+
}),
|
|
96
|
+
reason,
|
|
97
|
+
`${key}: a hidden key is refused`,
|
|
98
|
+
);
|
|
99
|
+
assert.deepEqual(snapshotToolDesigns(), registry, `${key}: the registry is unchanged`);
|
|
100
|
+
assert.deepEqual(readFileSync(storeFile()), bytes, `${key}: the persisted store is unchanged`);
|
|
101
|
+
const conflict = getToolDesignConflicts().find((candidate) => candidate.id === id);
|
|
102
|
+
assert.equal(conflict?.kind, "scope", `${key}: recorded under the scope kind`);
|
|
103
|
+
assert.equal(conflict?.tool, "tools", `${key}: a grouped refusal carries its line`);
|
|
104
|
+
assert.match(conflict?.message ?? "", reason, `${key}: and the same text is recorded`);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test("S19: a symbol `scopes` key is refused too, enumerable or not", () => {
|
|
109
|
+
for (const enumerable of [false, true]) {
|
|
110
|
+
resetAll();
|
|
111
|
+
const id = `acme.symbol-${String(enumerable)}`;
|
|
112
|
+
createStore(TOOL_DESIGN_STORE_ID).set(TOOL_DESIGN_STORE_KEY, { write: id });
|
|
113
|
+
const bytes = readFileSync(storeFile());
|
|
114
|
+
const registry = snapshotToolDesigns();
|
|
115
|
+
const foreign = Symbol("find");
|
|
116
|
+
const scopes = Object.defineProperty({ write: scope }, foreign, { value: scope, enumerable });
|
|
117
|
+
assert.throws(
|
|
118
|
+
() =>
|
|
119
|
+
registerToolDesign({ line: "tools", tools: ["write", "read"], scopes, id, label: "symbol", apply }),
|
|
120
|
+
/scopes carries the symbol key Symbol\(find\)/u,
|
|
121
|
+
`enumerable ${String(enumerable)}: a symbol cannot name a tool`,
|
|
122
|
+
);
|
|
123
|
+
assert.deepEqual(snapshotToolDesigns(), registry, "the registry is unchanged");
|
|
124
|
+
assert.deepEqual(readFileSync(storeFile()), bytes, "the persisted store is unchanged");
|
|
125
|
+
const conflict = getToolDesignConflicts().find((candidate) => candidate.id === id);
|
|
126
|
+
assert.equal(conflict?.kind, "scope");
|
|
127
|
+
assert.equal(conflict?.tool, "tools");
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test("S19: enumerable invalid `scopes` keys are still rejected unchanged", () => {
|
|
132
|
+
for (const [key, value, reason] of invalidKeys) {
|
|
133
|
+
resetAll();
|
|
134
|
+
const id = `acme.plain-${key}`;
|
|
135
|
+
createStore(TOOL_DESIGN_STORE_ID).set(TOOL_DESIGN_STORE_KEY, { write: id });
|
|
136
|
+
const bytes = readFileSync(storeFile());
|
|
137
|
+
const registry = snapshotToolDesigns();
|
|
138
|
+
const scopes = { write: scope, [key]: value } as unknown as Readonly<Record<string, ToolDesignScope>>;
|
|
139
|
+
assert.throws(
|
|
140
|
+
() =>
|
|
141
|
+
registerToolDesign({ line: "tools", tools: ["write", "read"], scopes, id, label: `plain ${key}`, apply }),
|
|
142
|
+
reason,
|
|
143
|
+
`${key}: the ordinary path is unchanged by the own-key validation`,
|
|
144
|
+
);
|
|
145
|
+
assert.deepEqual(snapshotToolDesigns(), registry, `${key}: the registry is unchanged`);
|
|
146
|
+
assert.deepEqual(readFileSync(storeFile()), bytes, `${key}: the persisted store is unchanged`);
|
|
147
|
+
assert.equal(
|
|
148
|
+
getToolDesignConflicts().find((candidate) => candidate.id === id)?.kind,
|
|
149
|
+
"scope",
|
|
150
|
+
`${key}: recorded under the scope kind`,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test("S19: a validated non-enumerable key is READ too, so one key set serves both", () => {
|
|
156
|
+
const hidden = "write";
|
|
157
|
+
const scopes = Object.defineProperty({ read: scope }, hidden, { value: scope });
|
|
158
|
+
registerToolDesign({
|
|
159
|
+
line: "tools",
|
|
160
|
+
tools: ["write", "read"],
|
|
161
|
+
scopes,
|
|
162
|
+
id: "acme.hidden-valid",
|
|
163
|
+
label: "hidden valid",
|
|
164
|
+
apply,
|
|
165
|
+
});
|
|
166
|
+
assert.equal(getToolDesignConflicts().length, 0, "nothing was refused");
|
|
167
|
+
assert.equal(toolDesignClaims("write")[0]?.scopeDescription, scope.description);
|
|
168
|
+
assert.equal(toolDesignClaims("read")[0]?.scopeDescription, scope.description);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test("S19: `scopes` keeps the per-tool wording, naming `scopes` on the ungrouped shape", (t) => {
|
|
172
|
+
const dispose = registerToolDesign({
|
|
173
|
+
line: "tools",
|
|
174
|
+
tools: ["write"],
|
|
175
|
+
id: "acme.scoped-owner",
|
|
176
|
+
label: "scoped owner",
|
|
177
|
+
scopes: { write: scope },
|
|
178
|
+
apply,
|
|
179
|
+
});
|
|
180
|
+
t.after(dispose);
|
|
181
|
+
assert.throws(
|
|
182
|
+
() =>
|
|
183
|
+
registerToolDesign({
|
|
184
|
+
line: "tools",
|
|
185
|
+
tools: ["write"],
|
|
186
|
+
id: "acme.scoped-other",
|
|
187
|
+
label: "scoped other",
|
|
188
|
+
scopes: { write: { ...scope } },
|
|
189
|
+
apply,
|
|
190
|
+
}),
|
|
191
|
+
/the line already carries a different scope on tool "write"/u,
|
|
192
|
+
"a map disagrees per (line, tool)",
|
|
193
|
+
);
|
|
194
|
+
assert.throws(
|
|
195
|
+
() =>
|
|
196
|
+
registerToolDesign({
|
|
197
|
+
tool: "write",
|
|
198
|
+
id: "acme.scoped-ungrouped",
|
|
199
|
+
label: "scoped ungrouped",
|
|
200
|
+
scopes: { write: scope },
|
|
201
|
+
apply,
|
|
202
|
+
} as unknown as ToolDesignRegistration),
|
|
203
|
+
(error: Error) => {
|
|
204
|
+
assert.ok(
|
|
205
|
+
error.message.includes("{ line, tools, scopes, id, label, apply }"),
|
|
206
|
+
"the grouped shape names `scopes`, the member the registration used",
|
|
207
|
+
);
|
|
208
|
+
assert.ok(error.message.includes("`scopes` on an ungrouped registration was refused"));
|
|
209
|
+
return true;
|
|
210
|
+
},
|
|
211
|
+
);
|
|
212
|
+
});
|