1 parent
a8f689e39c
commit
c340aec110
59 files changed
+1108
-1590
No files matched your search
@@ -75,7 +75,7 @@ function contextWithTools(credentials, dir) {
|
||||
return { ctx, registered }
|
||||
}
|
||||
|
||||
test('the registered tool runs the CLI with the plugin endpoint, key, and session workspace', async () => {
|
||||
test('the registered tool runs the CLI with the plugin endpoint, key, and session workspace', { skip: process.platform === 'win32' }, async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'geek2api-cli-'))
|
||||
const { script, record } = writeStubCli(dir)
|
||||
const workspace = join(dir, 'workspace')
|
||||
@@ -100,7 +100,7 @@ test('the registered tool runs the CLI with the plugin endpoint, key, and sessio
|
||||
assert.equal(seen.baseUrl, 'https://cf.example')
|
||||
assert.equal(seen.token, 'sk-stub-tool-key-0001')
|
||||
assert.equal(seen.apiKey, null)
|
||||
assert.match(seen.configDir, /geek2api-claude-cli/u)
|
||||
assert.match(seen.configDir, /infstarapi-claude-cli/u)
|
||||
// The default working directory is the session workspace.
|
||||
assert.equal(seen.cwd, realpathSync(workspace))
|
||||
// The task arrives on stdin; argv carries the switches and the delegation note.
|
||||
@@ -109,7 +109,7 @@ test('the registered tool runs the CLI with the plugin endpoint, key, and sessio
|
||||
assert.deepEqual(seen.argv.slice(0, 4), ['-p', '--output-format', 'json', '--append-system-prompt'])
|
||||
assert.match(seen.argv[4], /claude_code tool/u)
|
||||
assert.deepEqual(seen.argv.slice(5, 9), ['--allowedTools', 'Read', 'Grep', 'Glob'])
|
||||
assert.match(seen.argv[9], /^mcp__geek2api_search_[a-f0-9]+__web_search$/u)
|
||||
assert.match(seen.argv[9], /^mcp__infstarapi_search_[a-f0-9]+__web_search$/u)
|
||||
assert.deepEqual(seen.argv.slice(10, 13), ['--disallowedTools', 'WebSearch', '--mcp-config'])
|
||||
assert.match(seen.argv[14] ?? seen.argv[13], /mcp\.json$/u)
|
||||
assert.equal(seen.argv.includes('--strict-mcp-config'), false)
|
||||
@@ -129,11 +129,11 @@ test('a call without a usable key fails before spawning anything', async () => {
|
||||
apply(ctx, { claudeCliPath: script })
|
||||
await assert.rejects(
|
||||
() => registered.tools[0].execute({ prompt: 'x' }, { agent: { session: { header: { cwd: dir } } } }),
|
||||
/needs a usable Geek2API API key/u,
|
||||
/needs a usable InfStarAPI API key/u,
|
||||
)
|
||||
})
|
||||
|
||||
test('an explicit cwd resolves against the session workspace', async () => {
|
||||
test('an explicit cwd resolves against the session workspace', { skip: process.platform === 'win32' }, async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'geek2api-cli-'))
|
||||
const { script, record } = writeStubCli(dir)
|
||||
const workspace = join(dir, 'workspace')
|
||||
@@ -157,7 +157,7 @@ function permissionServices(sandbox, approval) {
|
||||
})[name]
|
||||
}
|
||||
|
||||
test('without any plugin setting the CLI follows the session permission preset', async () => {
|
||||
test('without any plugin setting the CLI follows the session permission preset', { skip: process.platform === 'win32' }, async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'geek2api-cli-'))
|
||||
const { script, record } = writeStubCli(dir)
|
||||
const { ctx, registered } = contextWithTools(fakeCredentials({ record: singleKeyRecord('sk-stub-tool-key-0003') }), dir)
|
||||
@@ -174,7 +174,7 @@ test('without any plugin setting the CLI follows the session permission preset',
|
||||
assert.equal(capped.mode, 'edit', 'a sandboxed session caps a wider request')
|
||||
})
|
||||
|
||||
test('logged DSH plan mode still forces planning while approved exit is pending', async () => {
|
||||
test('logged DSH plan mode still forces planning while approved exit is pending', { skip: process.platform === 'win32' }, async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'geek2api-cli-'))
|
||||
const record = join(dir, 'invocation.json')
|
||||
const script = join(dir, 'claude-plan.mjs')
|
||||
@@ -218,7 +218,7 @@ process.stdin.on('end', () => process.exit(0))
|
||||
assert.match(seen.argv.join('\n'), /ExitPlanMode/u)
|
||||
})
|
||||
|
||||
test('a pending plan entry leaves executing tools at the current full ceiling until the next boundary', async () => {
|
||||
test('a pending plan entry leaves executing tools at the current full ceiling until the next boundary', { skip: process.platform === 'win32' }, async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'geek2api-cli-'))
|
||||
const { script } = writeStubCli(dir)
|
||||
const session = { id: 's-pending-entry', header: { cwd: dir } }
|
||||
@@ -234,7 +234,7 @@ test('a pending plan entry leaves executing tools at the current full ceiling un
|
||||
assert.equal(value.mode, 'full')
|
||||
})
|
||||
|
||||
test('an explicit plugin mode still wins over the session preset', async () => {
|
||||
test('an explicit plugin mode still wins over the session preset', { skip: process.platform === 'win32' }, async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'geek2api-cli-'))
|
||||
const { script } = writeStubCli(dir)
|
||||
const { ctx, registered } = contextWithTools(fakeCredentials({ record: singleKeyRecord('sk-stub-tool-key-0004') }), dir)
|
||||
|
||||
Reference in new issue
Block a user