mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +00:00
feat: integrate fork work onto upstream main (squashed)
Squash-merge of feat/autofix-pr-test (69 commits) onto upstream/main with -X ours strategy (upstream as authoritative for content conflicts). Key features brought in from fork: - LocalMemoryRecall + VaultHttpFetch tools (end-to-end wired) - /local-memory, /local-vault, /memory-stores, /skill-store interactive panels - /agents-platform, /schedule, /vault command scaffolding - /login: switch / replace / remove of workspace API key - statusline refactor (built-in status row, /statusline as info command) - autofix-pr command + workflow Conflict resolutions (upstream-wins): - 10 .js command stubs kept from upstream (alongside fork's .ts implementations) - src/components/BuiltinStatusLine.tsx accepted upstream's deletion (fork's wire-up references in StatusLine.tsx will be cleaned up next) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
52
tests/mocks/toolContext.ts
Normal file
52
tests/mocks/toolContext.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Shared minimal ToolUseContext stub for tool unit tests.
|
||||
*
|
||||
* Provides only the fields tools actually access in tests:
|
||||
* - getAppState() returns a context with empty rule arrays for every source
|
||||
* - toolUseId / parentMessageId / assistantMessageId / turnId can be
|
||||
* overridden per test for budget tracking tests
|
||||
*
|
||||
* Usage:
|
||||
* import { mockToolContext } from 'tests/mocks/toolContext'
|
||||
* const ctx = mockToolContext({ toolUseId: 't1' })
|
||||
*
|
||||
* Per memory feedback "Mock dependency not subject" — this exists so each
|
||||
* tool test file does not redefine the same partial stub.
|
||||
*/
|
||||
|
||||
const emptyRules = {
|
||||
user: [],
|
||||
project: [],
|
||||
local: [],
|
||||
session: [],
|
||||
cliArg: [],
|
||||
}
|
||||
|
||||
export interface MockToolContextOptions {
|
||||
toolUseId?: string
|
||||
parentMessageId?: string
|
||||
assistantMessageId?: string
|
||||
turnId?: string
|
||||
/** Override toolPermissionContext fields (e.g. mode, alwaysAllowRules). */
|
||||
permissionOverrides?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export function mockToolContext(opts: MockToolContextOptions = {}): never {
|
||||
return {
|
||||
toolUseId: opts.toolUseId,
|
||||
parentMessageId: opts.parentMessageId,
|
||||
assistantMessageId: opts.assistantMessageId,
|
||||
turnId: opts.turnId,
|
||||
getAppState: () => ({
|
||||
toolPermissionContext: {
|
||||
mode: 'default',
|
||||
additionalWorkingDirectories: new Set(),
|
||||
alwaysAllowRules: { ...emptyRules },
|
||||
alwaysDenyRules: { ...emptyRules },
|
||||
alwaysAskRules: { ...emptyRules },
|
||||
isBypassPermissionsModeAvailable: false,
|
||||
...(opts.permissionOverrides ?? {}),
|
||||
},
|
||||
}),
|
||||
} as never
|
||||
}
|
||||
Reference in New Issue
Block a user