mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
feat: Add support for --add-dir to exec and TypeScript SDK (#6565)
## Summary Adds support for specifying additional directories in the TypeScript SDK through a new `additionalDirectories` option in `ThreadOptions`. ## Changes - Added `additionalDirectories` parameter to `ThreadOptions` interface - Updated `CodexExec` to accept and pass through additional directories via the `--config` flag for `sandbox_workspace_write.writable_roots` - Added comprehensive test coverage for the new functionality ## Test plan - Added test case that verifies `additionalDirectories` is correctly passed as repeated flags - Existing tests continue to pass --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,8 @@ export type CodexExecArgs = {
|
||||
sandboxMode?: SandboxMode;
|
||||
// --cd
|
||||
workingDirectory?: string;
|
||||
// --add-dir
|
||||
additionalDirectories?: string[];
|
||||
// --skip-git-repo-check
|
||||
skipGitRepoCheck?: boolean;
|
||||
// --output-schema
|
||||
@@ -58,6 +60,12 @@ export class CodexExec {
|
||||
commandArgs.push("--cd", args.workingDirectory);
|
||||
}
|
||||
|
||||
if (args.additionalDirectories?.length) {
|
||||
for (const dir of args.additionalDirectories) {
|
||||
commandArgs.push("--add-dir", dir);
|
||||
}
|
||||
}
|
||||
|
||||
if (args.skipGitRepoCheck) {
|
||||
commandArgs.push("--skip-git-repo-check");
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@ export class Thread {
|
||||
networkAccessEnabled: options?.networkAccessEnabled,
|
||||
webSearchEnabled: options?.webSearchEnabled,
|
||||
approvalPolicy: options?.approvalPolicy,
|
||||
additionalDirectories: options?.additionalDirectories,
|
||||
});
|
||||
try {
|
||||
for await (const item of generator) {
|
||||
|
||||
@@ -13,4 +13,5 @@ export type ThreadOptions = {
|
||||
networkAccessEnabled?: boolean;
|
||||
webSearchEnabled?: boolean;
|
||||
approvalPolicy?: ApprovalMode;
|
||||
additionalDirectories?: string[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user