unbound-cli 1.23.0 → 1.25.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 +26 -0
- package/package.json +1 -1
- package/src/commands/delivery.js +567 -0
- package/src/commands/policy.js +16 -0
- package/src/index.js +10 -0
- package/src/lib/pack-export.js +5 -1
- package/src/lib/pack-plan.js +18 -2
- package/src/lib/pack-schema.js +5 -6
- package/test/delivery.test.js +591 -0
- package/test/no-ai-guard.test.js +35 -0
- package/test/pack-export.test.js +21 -0
- package/test/pack-plan.test.js +31 -0
- package/test/pack-schema.test.js +2 -2
package/test/pack-plan.test.js
CHANGED
|
@@ -121,6 +121,22 @@ test('buildPlan: MCP server change and type change are replace', () => {
|
|
|
121
121
|
assert.equal(plan.buildPlan(type, { tool: [LIVE_MCP], generic: [] })[0].op, 'replace');
|
|
122
122
|
});
|
|
123
123
|
|
|
124
|
+
test('buildPlan: a replace keeps live tool targets the pack does not manage, and uses the pack list when it does', () => {
|
|
125
|
+
const live = { tool: [{ ...LIVE_MCP, scope_tool_types: ['CURSOR'] }], generic: [] };
|
|
126
|
+
const unmanaged = plan.toDesired(pack([{ ...MCP, mcp: { server: 'slack', tool: 'post_message' } }]), REF);
|
|
127
|
+
assert.deepEqual(plan.buildPlan(unmanaged, live)[0].body.scope_tool_types, ['CURSOR']);
|
|
128
|
+
const managed = plan.toDesired(pack([{ ...MCP, mcp: { server: 'slack', tool: 'post_message' }, scope: { toolTypes: [] } }]), REF);
|
|
129
|
+
assert.deepEqual(plan.buildPlan(managed, live)[0].body.scope_tool_types, []);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('buildPlan: an unpatchable-field replace keeps live tool targets the pack does not manage', () => {
|
|
133
|
+
const live = { tool: [{ ...LIVE_MCP, mcp_tools: ['push_files'], mcp_canonical_group: null, scope_tool_types: ['CURSOR'] }], generic: [] };
|
|
134
|
+
const [op] = plan.buildPlan(plan.toDesired(pack([MCP]), REF), live);
|
|
135
|
+
assert.equal(op.op, 'replace');
|
|
136
|
+
assert.match(op.reason, /cannot be patched in place/);
|
|
137
|
+
assert.deepEqual(op.body.scope_tool_types, ['CURSOR']);
|
|
138
|
+
});
|
|
139
|
+
|
|
124
140
|
test('an action-type selector the catalogue cannot resolve is an error, never "unchanged"', () => {
|
|
125
141
|
const unknownServer = { ...MCP, mcp: { server: 'nope', actionType: 'write' } };
|
|
126
142
|
assert.throws(() => plan.toDesired(pack([unknownServer]), REF), /not in this org's MCP catalogue/);
|
|
@@ -216,3 +232,18 @@ test('a name already used elsewhere in the org is a conflict at plan time, not a
|
|
|
216
232
|
const renamedOps = plan.buildPlan(renamed, { tool: [], generic: [{ ...LIVE_SECURITY, name: 'PII guard' }], names }, { prune: true });
|
|
217
233
|
assert.deepEqual(renamedOps.map((o) => o.op), ['conflict'], 'a refused rename is a conflict and never also an orphan or delete');
|
|
218
234
|
});
|
|
235
|
+
|
|
236
|
+
test('tool policy targets: a pack without toolTypes plans no change, a changed list patches only it', () => {
|
|
237
|
+
const live = { tool: [{ ...LIVE_TERMINAL, scope_tool_types: ['CURSOR'] }], generic: [] };
|
|
238
|
+
const unmanaged = plan.buildPlan(plan.toDesired(pack([TERMINAL]), REF), live);
|
|
239
|
+
assert.equal(unmanaged[0].op, 'unchanged', 'targets set elsewhere are left alone');
|
|
240
|
+
|
|
241
|
+
const same = { ...TERMINAL, scope: { ...TERMINAL.scope, toolTypes: ['CURSOR'] } };
|
|
242
|
+
assert.equal(plan.buildPlan(plan.toDesired(pack([same]), REF), live)[0].op, 'unchanged');
|
|
243
|
+
|
|
244
|
+
const changed = { ...TERMINAL, scope: { ...TERMINAL.scope, toolTypes: ['UNBOUND_CODEX', 'CURSOR'] } };
|
|
245
|
+
const ops = plan.buildPlan(plan.toDesired(pack([changed]), REF), live);
|
|
246
|
+
assert.equal(ops[0].op, 'update');
|
|
247
|
+
assert.deepEqual(ops[0].body, { scope_tool_types: ['CODEX', 'CURSOR'] }, 'legacy ids compare as their current name');
|
|
248
|
+
});
|
|
249
|
+
|
package/test/pack-schema.test.js
CHANGED
|
@@ -93,8 +93,8 @@ test('validatePack: kind-specific keys are enforced', () => {
|
|
|
93
93
|
assert.throws(() => load(BASE.replace(' kind: cost', ' kind: cost\n action: BLOCK')), /unknown key "action"/);
|
|
94
94
|
// generic-only key on a tool policy
|
|
95
95
|
assert.throws(() => load(BASE.replace(' kind: tool\n type: TERMINAL_COMMAND', ' kind: tool\n priority: 1\n type: TERMINAL_COMMAND')), /unknown key "priority"/);
|
|
96
|
-
// toolTypes scope
|
|
97
|
-
assert.throws(() => load(BASE.replace(' userGroups: [Contractors]', ' toolTypes:
|
|
96
|
+
// toolTypes scope must be a list on any policy kind
|
|
97
|
+
assert.throws(() => load(BASE.replace(' userGroups: [Contractors]', ' toolTypes: cursor')), /scope.toolTypes must be a list/);
|
|
98
98
|
// guardrails only on security
|
|
99
99
|
assert.throws(() => load(BASE.replace(' kind: cost', ' kind: cost\n guardrails: []')), /unknown key "guardrails"/);
|
|
100
100
|
});
|