fix(workspace-context): escape instruction metadata
This commit is contained in:
@@ -155,6 +155,13 @@ export interface RunOptions {
|
||||
* start from an empty workspace.
|
||||
*/
|
||||
workspaceDir?: string
|
||||
/**
|
||||
* Optional final workspace preparation, run after {@link workspaceDir} is
|
||||
* copied and before the agent starts. This is for fixtures that cannot be
|
||||
* represented portably in Git (for example, a POSIX-only filename that is
|
||||
* invalid on Windows); ordinary seeded files belong in `workspaceDir`.
|
||||
*/
|
||||
prepareWorkspace?: (cwd: string) => void | Promise<void>
|
||||
/**
|
||||
* Parent directory for the generated session cwd. Defaults to
|
||||
* `os.tmpdir()`. A scenario that must distinguish its workspace from the
|
||||
@@ -221,6 +228,7 @@ export async function runScenario(input: InputScript, opts: RunOptions): Promise
|
||||
if (opts.workspaceDir !== undefined && existsSync(opts.workspaceDir)) {
|
||||
await cp(opts.workspaceDir, cwd, { recursive: true })
|
||||
}
|
||||
await opts.prepareWorkspace?.(cwd)
|
||||
const env: NodeJS.ProcessEnv = {
|
||||
...opts.env,
|
||||
DSH_SNAPSHOT: opts.mode,
|
||||
|
||||
@@ -114,6 +114,12 @@ export interface Scenario {
|
||||
* test and the scenario needs an independent project location.
|
||||
*/
|
||||
workspaceParent?: string
|
||||
/**
|
||||
* Optional final workspace preparation after the committed fixture is
|
||||
* copied. Reserve this for paths that Git cannot represent portably; normal
|
||||
* scenario files belong under the scenario's `workspace/` directory.
|
||||
*/
|
||||
prepareWorkspace?: (cwd: string) => void | Promise<void>
|
||||
/**
|
||||
* Whether Windows additionally compares stdout with native separators against
|
||||
* `stdout.expected.windows.jsonl`. The shared canonical stdout expected output is still
|
||||
@@ -849,6 +855,7 @@ export function defineAcpSnapshotSuite(options: SnapshotSuiteOptions): void {
|
||||
// replays from its own script. In RECORD they are harvested, not read.
|
||||
...!RECORDING && childFixtureFiles.length > 0 ? { childFiles: childFixtureFiles.map(file => join(dir, file)) } : {},
|
||||
...existsSync(workspaceDir) ? { workspaceDir } : {},
|
||||
...scenario.prepareWorkspace !== undefined ? { prepareWorkspace: scenario.prepareWorkspace } : {},
|
||||
...scenario.workspaceParent !== undefined ? { workspaceParent: scenario.workspaceParent } : {},
|
||||
// A scenario booting an overlay tree passes its own live config; the
|
||||
// bin's replay swap derives the sibling `*cordis.snapshot.yml` from it.
|
||||
|
||||
Reference in New Issue
Block a user