chad-code 1.3.1 → 1.3.2
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 +55 -6
- package/package.json +36 -98
- package/AGENTS.md +0 -27
- package/Dockerfile +0 -18
- package/README.npm.md +0 -64
- package/bunfig.toml +0 -7
- package/eslint.config.js +0 -29
- package/parsers-config.ts +0 -253
- package/script/build.ts +0 -167
- package/script/publish-registries.ts +0 -187
- package/script/publish.ts +0 -93
- package/script/schema.ts +0 -47
- package/src/acp/README.md +0 -164
- package/src/acp/agent.ts +0 -1086
- package/src/acp/session.ts +0 -101
- package/src/acp/types.ts +0 -22
- package/src/agent/agent.ts +0 -253
- package/src/agent/generate.txt +0 -75
- package/src/agent/prompt/compaction.txt +0 -12
- package/src/agent/prompt/explore.txt +0 -18
- package/src/agent/prompt/summary.txt +0 -11
- package/src/agent/prompt/title.txt +0 -36
- package/src/auth/index.ts +0 -70
- package/src/bun/index.ts +0 -130
- package/src/bus/bus-event.ts +0 -43
- package/src/bus/global.ts +0 -10
- package/src/bus/index.ts +0 -105
- package/src/cli/bootstrap.ts +0 -17
- package/src/cli/cmd/acp.ts +0 -69
- package/src/cli/cmd/agent.ts +0 -257
- package/src/cli/cmd/auth.ts +0 -132
- package/src/cli/cmd/cmd.ts +0 -7
- package/src/cli/cmd/debug/agent.ts +0 -28
- package/src/cli/cmd/debug/config.ts +0 -15
- package/src/cli/cmd/debug/file.ts +0 -91
- package/src/cli/cmd/debug/index.ts +0 -45
- package/src/cli/cmd/debug/lsp.ts +0 -48
- package/src/cli/cmd/debug/ripgrep.ts +0 -83
- package/src/cli/cmd/debug/scrap.ts +0 -15
- package/src/cli/cmd/debug/skill.ts +0 -15
- package/src/cli/cmd/debug/snapshot.ts +0 -48
- package/src/cli/cmd/export.ts +0 -88
- package/src/cli/cmd/generate.ts +0 -38
- package/src/cli/cmd/github.ts +0 -32
- package/src/cli/cmd/import.ts +0 -98
- package/src/cli/cmd/mcp.ts +0 -670
- package/src/cli/cmd/models.ts +0 -42
- package/src/cli/cmd/pr.ts +0 -112
- package/src/cli/cmd/run.ts +0 -374
- package/src/cli/cmd/serve.ts +0 -16
- package/src/cli/cmd/session.ts +0 -135
- package/src/cli/cmd/stats.ts +0 -402
- package/src/cli/cmd/tui/app.tsx +0 -705
- package/src/cli/cmd/tui/attach.ts +0 -32
- package/src/cli/cmd/tui/component/border.tsx +0 -21
- package/src/cli/cmd/tui/component/dialog-agent.tsx +0 -31
- package/src/cli/cmd/tui/component/dialog-command.tsx +0 -124
- package/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -86
- package/src/cli/cmd/tui/component/dialog-model.tsx +0 -232
- package/src/cli/cmd/tui/component/dialog-provider.tsx +0 -228
- package/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -115
- package/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
- package/src/cli/cmd/tui/component/dialog-stash.tsx +0 -86
- package/src/cli/cmd/tui/component/dialog-status.tsx +0 -162
- package/src/cli/cmd/tui/component/dialog-tag.tsx +0 -44
- package/src/cli/cmd/tui/component/dialog-theme-list.tsx +0 -50
- package/src/cli/cmd/tui/component/did-you-know.tsx +0 -85
- package/src/cli/cmd/tui/component/logo.tsx +0 -43
- package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -654
- package/src/cli/cmd/tui/component/prompt/history.tsx +0 -108
- package/src/cli/cmd/tui/component/prompt/index.tsx +0 -1078
- package/src/cli/cmd/tui/component/prompt/stash.tsx +0 -101
- package/src/cli/cmd/tui/component/textarea-keybindings.ts +0 -73
- package/src/cli/cmd/tui/component/tips.ts +0 -92
- package/src/cli/cmd/tui/component/todo-item.tsx +0 -32
- package/src/cli/cmd/tui/context/args.tsx +0 -14
- package/src/cli/cmd/tui/context/directory.ts +0 -13
- package/src/cli/cmd/tui/context/exit.tsx +0 -23
- package/src/cli/cmd/tui/context/helper.tsx +0 -25
- package/src/cli/cmd/tui/context/keybind.tsx +0 -101
- package/src/cli/cmd/tui/context/kv.tsx +0 -49
- package/src/cli/cmd/tui/context/local.tsx +0 -392
- package/src/cli/cmd/tui/context/prompt.tsx +0 -18
- package/src/cli/cmd/tui/context/route.tsx +0 -46
- package/src/cli/cmd/tui/context/sdk.tsx +0 -75
- package/src/cli/cmd/tui/context/sync.tsx +0 -384
- package/src/cli/cmd/tui/context/theme/aura.json +0 -69
- package/src/cli/cmd/tui/context/theme/ayu.json +0 -80
- package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +0 -233
- package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +0 -233
- package/src/cli/cmd/tui/context/theme/catppuccin.json +0 -112
- package/src/cli/cmd/tui/context/theme/chad.json +0 -245
- package/src/cli/cmd/tui/context/theme/cobalt2.json +0 -228
- package/src/cli/cmd/tui/context/theme/cursor.json +0 -249
- package/src/cli/cmd/tui/context/theme/dracula.json +0 -219
- package/src/cli/cmd/tui/context/theme/everforest.json +0 -241
- package/src/cli/cmd/tui/context/theme/flexoki.json +0 -237
- package/src/cli/cmd/tui/context/theme/github.json +0 -233
- package/src/cli/cmd/tui/context/theme/gruvbox.json +0 -95
- package/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
- package/src/cli/cmd/tui/context/theme/lucent-orng.json +0 -227
- package/src/cli/cmd/tui/context/theme/material.json +0 -235
- package/src/cli/cmd/tui/context/theme/matrix.json +0 -77
- package/src/cli/cmd/tui/context/theme/mercury.json +0 -252
- package/src/cli/cmd/tui/context/theme/monokai.json +0 -221
- package/src/cli/cmd/tui/context/theme/nightowl.json +0 -221
- package/src/cli/cmd/tui/context/theme/nord.json +0 -223
- package/src/cli/cmd/tui/context/theme/one-dark.json +0 -84
- package/src/cli/cmd/tui/context/theme/orng.json +0 -245
- package/src/cli/cmd/tui/context/theme/osaka-jade.json +0 -93
- package/src/cli/cmd/tui/context/theme/palenight.json +0 -222
- package/src/cli/cmd/tui/context/theme/rosepine.json +0 -234
- package/src/cli/cmd/tui/context/theme/solarized.json +0 -223
- package/src/cli/cmd/tui/context/theme/synthwave84.json +0 -226
- package/src/cli/cmd/tui/context/theme/tokyonight.json +0 -243
- package/src/cli/cmd/tui/context/theme/vercel.json +0 -245
- package/src/cli/cmd/tui/context/theme/vesper.json +0 -218
- package/src/cli/cmd/tui/context/theme/zenburn.json +0 -223
- package/src/cli/cmd/tui/context/theme.tsx +0 -1137
- package/src/cli/cmd/tui/event.ts +0 -46
- package/src/cli/cmd/tui/routes/home.tsx +0 -138
- package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +0 -64
- package/src/cli/cmd/tui/routes/session/dialog-message.tsx +0 -109
- package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +0 -26
- package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +0 -47
- package/src/cli/cmd/tui/routes/session/footer.tsx +0 -88
- package/src/cli/cmd/tui/routes/session/header.tsx +0 -125
- package/src/cli/cmd/tui/routes/session/index.tsx +0 -1814
- package/src/cli/cmd/tui/routes/session/permission.tsx +0 -416
- package/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -318
- package/src/cli/cmd/tui/spawn.ts +0 -48
- package/src/cli/cmd/tui/thread.ts +0 -111
- package/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -57
- package/src/cli/cmd/tui/ui/dialog-confirm.tsx +0 -83
- package/src/cli/cmd/tui/ui/dialog-export-options.tsx +0 -204
- package/src/cli/cmd/tui/ui/dialog-help.tsx +0 -38
- package/src/cli/cmd/tui/ui/dialog-prompt.tsx +0 -77
- package/src/cli/cmd/tui/ui/dialog-select.tsx +0 -345
- package/src/cli/cmd/tui/ui/dialog.tsx +0 -171
- package/src/cli/cmd/tui/ui/link.tsx +0 -28
- package/src/cli/cmd/tui/ui/spinner.ts +0 -368
- package/src/cli/cmd/tui/ui/toast.tsx +0 -100
- package/src/cli/cmd/tui/util/clipboard.ts +0 -127
- package/src/cli/cmd/tui/util/editor.ts +0 -32
- package/src/cli/cmd/tui/util/signal.ts +0 -7
- package/src/cli/cmd/tui/util/terminal.ts +0 -114
- package/src/cli/cmd/tui/util/transcript.ts +0 -98
- package/src/cli/cmd/tui/worker.ts +0 -68
- package/src/cli/cmd/uninstall.ts +0 -344
- package/src/cli/cmd/upgrade.ts +0 -67
- package/src/cli/cmd/web.ts +0 -73
- package/src/cli/error.ts +0 -56
- package/src/cli/network.ts +0 -53
- package/src/cli/ui.ts +0 -87
- package/src/cli/upgrade.ts +0 -25
- package/src/command/index.ts +0 -131
- package/src/command/template/initialize.txt +0 -10
- package/src/command/template/review.txt +0 -97
- package/src/config/config.ts +0 -1124
- package/src/config/markdown.ts +0 -41
- package/src/env/index.ts +0 -26
- package/src/file/ignore.ts +0 -83
- package/src/file/index.ts +0 -411
- package/src/file/ripgrep.ts +0 -402
- package/src/file/time.ts +0 -64
- package/src/file/watcher.ts +0 -117
- package/src/flag/flag.ts +0 -52
- package/src/format/formatter.ts +0 -359
- package/src/format/index.ts +0 -137
- package/src/global/index.ts +0 -55
- package/src/id/id.ts +0 -73
- package/src/ide/index.ts +0 -77
- package/src/index.ts +0 -159
- package/src/installation/index.ts +0 -198
- package/src/lsp/client.ts +0 -252
- package/src/lsp/index.ts +0 -485
- package/src/lsp/language.ts +0 -119
- package/src/lsp/server.ts +0 -2023
- package/src/mcp/auth.ts +0 -135
- package/src/mcp/index.ts +0 -874
- package/src/mcp/oauth-callback.ts +0 -200
- package/src/mcp/oauth-provider.ts +0 -154
- package/src/patch/index.ts +0 -622
- package/src/permission/arity.ts +0 -163
- package/src/permission/index.ts +0 -210
- package/src/permission/next.ts +0 -268
- package/src/plugin/index.ts +0 -106
- package/src/project/bootstrap.ts +0 -31
- package/src/project/instance.ts +0 -78
- package/src/project/project.ts +0 -263
- package/src/project/state.ts +0 -65
- package/src/project/vcs.ts +0 -76
- package/src/provider/auth.ts +0 -143
- package/src/provider/models-macro.ts +0 -4
- package/src/provider/models.ts +0 -77
- package/src/provider/provider.ts +0 -516
- package/src/provider/transform.ts +0 -114
- package/src/pty/index.ts +0 -212
- package/src/server/error.ts +0 -36
- package/src/server/mdns.ts +0 -57
- package/src/server/project.ts +0 -79
- package/src/server/server.ts +0 -2866
- package/src/server/tui.ts +0 -71
- package/src/session/compaction.ts +0 -225
- package/src/session/index.ts +0 -469
- package/src/session/llm.ts +0 -213
- package/src/session/message-v2.ts +0 -742
- package/src/session/message.ts +0 -189
- package/src/session/processor.ts +0 -402
- package/src/session/prompt/anthropic-20250930.txt +0 -166
- package/src/session/prompt/anthropic.txt +0 -105
- package/src/session/prompt/anthropic_spoof.txt +0 -1
- package/src/session/prompt/beast.txt +0 -147
- package/src/session/prompt/build-switch.txt +0 -5
- package/src/session/prompt/codex.txt +0 -318
- package/src/session/prompt/copilot-gpt-5.txt +0 -143
- package/src/session/prompt/gemini.txt +0 -155
- package/src/session/prompt/max-steps.txt +0 -16
- package/src/session/prompt/plan-reminder-anthropic.txt +0 -67
- package/src/session/prompt/plan.txt +0 -26
- package/src/session/prompt/qwen.txt +0 -109
- package/src/session/prompt.ts +0 -1621
- package/src/session/retry.ts +0 -90
- package/src/session/revert.ts +0 -108
- package/src/session/status.ts +0 -76
- package/src/session/summary.ts +0 -194
- package/src/session/system.ts +0 -108
- package/src/session/todo.ts +0 -37
- package/src/share/share-next.ts +0 -194
- package/src/share/share.ts +0 -23
- package/src/shell/shell.ts +0 -67
- package/src/skill/index.ts +0 -1
- package/src/skill/skill.ts +0 -124
- package/src/snapshot/index.ts +0 -197
- package/src/storage/storage.ts +0 -226
- package/src/tool/bash.ts +0 -262
- package/src/tool/bash.txt +0 -116
- package/src/tool/batch.ts +0 -175
- package/src/tool/batch.txt +0 -24
- package/src/tool/codesearch.ts +0 -132
- package/src/tool/codesearch.txt +0 -12
- package/src/tool/edit.ts +0 -655
- package/src/tool/edit.txt +0 -10
- package/src/tool/glob.ts +0 -75
- package/src/tool/glob.txt +0 -6
- package/src/tool/grep.ts +0 -132
- package/src/tool/grep.txt +0 -8
- package/src/tool/invalid.ts +0 -17
- package/src/tool/ls.ts +0 -119
- package/src/tool/ls.txt +0 -1
- package/src/tool/lsp.ts +0 -94
- package/src/tool/lsp.txt +0 -19
- package/src/tool/multiedit.ts +0 -46
- package/src/tool/multiedit.txt +0 -41
- package/src/tool/patch.ts +0 -210
- package/src/tool/patch.txt +0 -1
- package/src/tool/read.ts +0 -191
- package/src/tool/read.txt +0 -12
- package/src/tool/registry.ts +0 -137
- package/src/tool/skill.ts +0 -77
- package/src/tool/task.ts +0 -167
- package/src/tool/task.txt +0 -60
- package/src/tool/todo.ts +0 -53
- package/src/tool/todoread.txt +0 -14
- package/src/tool/todowrite.txt +0 -167
- package/src/tool/tool.ts +0 -73
- package/src/tool/webfetch.ts +0 -182
- package/src/tool/webfetch.txt +0 -13
- package/src/tool/websearch.ts +0 -144
- package/src/tool/websearch.txt +0 -11
- package/src/tool/write.ts +0 -84
- package/src/tool/write.txt +0 -8
- package/src/util/archive.ts +0 -16
- package/src/util/color.ts +0 -19
- package/src/util/context.ts +0 -25
- package/src/util/defer.ts +0 -12
- package/src/util/eventloop.ts +0 -20
- package/src/util/filesystem.ts +0 -83
- package/src/util/fn.ts +0 -11
- package/src/util/iife.ts +0 -3
- package/src/util/keybind.ts +0 -102
- package/src/util/lazy.ts +0 -18
- package/src/util/locale.ts +0 -81
- package/src/util/lock.ts +0 -98
- package/src/util/log.ts +0 -180
- package/src/util/queue.ts +0 -32
- package/src/util/rpc.ts +0 -42
- package/src/util/scrap.ts +0 -10
- package/src/util/signal.ts +0 -12
- package/src/util/timeout.ts +0 -14
- package/src/util/token.ts +0 -7
- package/src/util/wildcard.ts +0 -54
- package/src/worktree/index.ts +0 -217
- package/sst-env.d.ts +0 -9
- package/test/agent/agent.test.ts +0 -448
- package/test/bun.test.ts +0 -53
- package/test/cli/github-action.test.ts +0 -129
- package/test/cli/github-remote.test.ts +0 -80
- package/test/cli/tui/transcript.test.ts +0 -297
- package/test/config/agent-color.test.ts +0 -66
- package/test/config/config.test.ts +0 -870
- package/test/config/markdown.test.ts +0 -89
- package/test/file/ignore.test.ts +0 -10
- package/test/file/path-traversal.test.ts +0 -115
- package/test/fixture/fixture.ts +0 -45
- package/test/fixture/lsp/fake-lsp-server.js +0 -77
- package/test/ide/ide.test.ts +0 -82
- package/test/keybind.test.ts +0 -421
- package/test/lsp/client.test.ts +0 -95
- package/test/mcp/headers.test.ts +0 -153
- package/test/patch/patch.test.ts +0 -348
- package/test/permission/arity.test.ts +0 -33
- package/test/permission/next.test.ts +0 -652
- package/test/preload.ts +0 -63
- package/test/project/project.test.ts +0 -120
- package/test/provider/amazon-bedrock.test.ts +0 -236
- package/test/provider/provider.test.ts +0 -2127
- package/test/provider/transform.test.ts +0 -980
- package/test/server/session-select.test.ts +0 -78
- package/test/session/compaction.test.ts +0 -251
- package/test/session/message-v2.test.ts +0 -570
- package/test/session/retry.test.ts +0 -131
- package/test/session/revert-compact.test.ts +0 -285
- package/test/session/session.test.ts +0 -71
- package/test/skill/skill.test.ts +0 -185
- package/test/snapshot/snapshot.test.ts +0 -939
- package/test/tool/__snapshots__/tool.test.ts.snap +0 -9
- package/test/tool/bash.test.ts +0 -232
- package/test/tool/grep.test.ts +0 -109
- package/test/tool/patch.test.ts +0 -261
- package/test/tool/read.test.ts +0 -167
- package/test/util/iife.test.ts +0 -36
- package/test/util/lazy.test.ts +0 -50
- package/test/util/timeout.test.ts +0 -21
- package/test/util/wildcard.test.ts +0 -55
- package/tsconfig.json +0 -16
- /package/{script/postinstall.mjs → postinstall.mjs} +0 -0
package/src/worktree/index.ts
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { $ } from "bun"
|
|
2
|
-
import fs from "fs/promises"
|
|
3
|
-
import path from "path"
|
|
4
|
-
import z from "zod"
|
|
5
|
-
import { NamedError } from "@opencode-ai/util/error"
|
|
6
|
-
import { Global } from "../global"
|
|
7
|
-
import { Instance } from "../project/instance"
|
|
8
|
-
import { Project } from "../project/project"
|
|
9
|
-
import { fn } from "../util/fn"
|
|
10
|
-
import { Config } from "@/config/config"
|
|
11
|
-
|
|
12
|
-
export namespace Worktree {
|
|
13
|
-
export const Info = z
|
|
14
|
-
.object({
|
|
15
|
-
name: z.string(),
|
|
16
|
-
branch: z.string(),
|
|
17
|
-
directory: z.string(),
|
|
18
|
-
})
|
|
19
|
-
.meta({
|
|
20
|
-
ref: "Worktree",
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export type Info = z.infer<typeof Info>
|
|
24
|
-
|
|
25
|
-
export const CreateInput = z
|
|
26
|
-
.object({
|
|
27
|
-
name: z.string().optional(),
|
|
28
|
-
startCommand: z.string().optional(),
|
|
29
|
-
})
|
|
30
|
-
.meta({
|
|
31
|
-
ref: "WorktreeCreateInput",
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
export type CreateInput = z.infer<typeof CreateInput>
|
|
35
|
-
|
|
36
|
-
export const NotGitError = NamedError.create(
|
|
37
|
-
"WorktreeNotGitError",
|
|
38
|
-
z.object({
|
|
39
|
-
message: z.string(),
|
|
40
|
-
}),
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
export const NameGenerationFailedError = NamedError.create(
|
|
44
|
-
"WorktreeNameGenerationFailedError",
|
|
45
|
-
z.object({
|
|
46
|
-
message: z.string(),
|
|
47
|
-
}),
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
export const CreateFailedError = NamedError.create(
|
|
51
|
-
"WorktreeCreateFailedError",
|
|
52
|
-
z.object({
|
|
53
|
-
message: z.string(),
|
|
54
|
-
}),
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
export const StartCommandFailedError = NamedError.create(
|
|
58
|
-
"WorktreeStartCommandFailedError",
|
|
59
|
-
z.object({
|
|
60
|
-
message: z.string(),
|
|
61
|
-
}),
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
const ADJECTIVES = [
|
|
65
|
-
"brave",
|
|
66
|
-
"calm",
|
|
67
|
-
"clever",
|
|
68
|
-
"cosmic",
|
|
69
|
-
"crisp",
|
|
70
|
-
"curious",
|
|
71
|
-
"eager",
|
|
72
|
-
"gentle",
|
|
73
|
-
"glowing",
|
|
74
|
-
"happy",
|
|
75
|
-
"hidden",
|
|
76
|
-
"jolly",
|
|
77
|
-
"kind",
|
|
78
|
-
"lucky",
|
|
79
|
-
"mighty",
|
|
80
|
-
"misty",
|
|
81
|
-
"neon",
|
|
82
|
-
"nimble",
|
|
83
|
-
"playful",
|
|
84
|
-
"proud",
|
|
85
|
-
"quick",
|
|
86
|
-
"quiet",
|
|
87
|
-
"shiny",
|
|
88
|
-
"silent",
|
|
89
|
-
"stellar",
|
|
90
|
-
"sunny",
|
|
91
|
-
"swift",
|
|
92
|
-
"tidy",
|
|
93
|
-
"witty",
|
|
94
|
-
] as const
|
|
95
|
-
|
|
96
|
-
const NOUNS = [
|
|
97
|
-
"cabin",
|
|
98
|
-
"cactus",
|
|
99
|
-
"canyon",
|
|
100
|
-
"circuit",
|
|
101
|
-
"comet",
|
|
102
|
-
"eagle",
|
|
103
|
-
"engine",
|
|
104
|
-
"falcon",
|
|
105
|
-
"forest",
|
|
106
|
-
"garden",
|
|
107
|
-
"harbor",
|
|
108
|
-
"island",
|
|
109
|
-
"knight",
|
|
110
|
-
"lagoon",
|
|
111
|
-
"meadow",
|
|
112
|
-
"moon",
|
|
113
|
-
"mountain",
|
|
114
|
-
"nebula",
|
|
115
|
-
"orchid",
|
|
116
|
-
"otter",
|
|
117
|
-
"panda",
|
|
118
|
-
"pixel",
|
|
119
|
-
"planet",
|
|
120
|
-
"river",
|
|
121
|
-
"rocket",
|
|
122
|
-
"sailor",
|
|
123
|
-
"squid",
|
|
124
|
-
"star",
|
|
125
|
-
"tiger",
|
|
126
|
-
"wizard",
|
|
127
|
-
"wolf",
|
|
128
|
-
] as const
|
|
129
|
-
|
|
130
|
-
function pick<const T extends readonly string[]>(list: T) {
|
|
131
|
-
return list[Math.floor(Math.random() * list.length)]
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function slug(input: string) {
|
|
135
|
-
return input
|
|
136
|
-
.trim()
|
|
137
|
-
.toLowerCase()
|
|
138
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
139
|
-
.replace(/^-+/, "")
|
|
140
|
-
.replace(/-+$/, "")
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function randomName() {
|
|
144
|
-
return `${pick(ADJECTIVES)}-${pick(NOUNS)}`
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async function exists(target: string) {
|
|
148
|
-
return fs
|
|
149
|
-
.stat(target)
|
|
150
|
-
.then(() => true)
|
|
151
|
-
.catch(() => false)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function outputText(input: Uint8Array | undefined) {
|
|
155
|
-
if (!input?.length) return ""
|
|
156
|
-
return new TextDecoder().decode(input).trim()
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function errorText(result: { stdout?: Uint8Array; stderr?: Uint8Array }) {
|
|
160
|
-
return [outputText(result.stderr), outputText(result.stdout)].filter(Boolean).join("\n")
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
async function candidate(root: string, base?: string) {
|
|
164
|
-
for (const attempt of Array.from({ length: 26 }, (_, i) => i)) {
|
|
165
|
-
const name = base ? (attempt === 0 ? base : `${base}-${randomName()}`) : randomName()
|
|
166
|
-
const branch = `chad-code/${name}`
|
|
167
|
-
const directory = path.join(root, name)
|
|
168
|
-
|
|
169
|
-
if (await exists(directory)) continue
|
|
170
|
-
|
|
171
|
-
const ref = `refs/heads/${branch}`
|
|
172
|
-
const branchCheck = await $`git show-ref --verify --quiet ${ref}`.quiet().nothrow().cwd(Instance.worktree)
|
|
173
|
-
if (branchCheck.exitCode === 0) continue
|
|
174
|
-
|
|
175
|
-
return Info.parse({ name, branch, directory })
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
throw new NameGenerationFailedError({ message: "Failed to generate a unique worktree name" })
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
async function runStartCommand(directory: string, cmd: string) {
|
|
182
|
-
if (process.platform === "win32") {
|
|
183
|
-
return $`cmd /c ${cmd}`.nothrow().cwd(directory)
|
|
184
|
-
}
|
|
185
|
-
return $`bash -lc ${cmd}`.nothrow().cwd(directory)
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export const create = fn(CreateInput.optional(), async (input) => {
|
|
189
|
-
if (Instance.project.vcs !== "git") {
|
|
190
|
-
throw new NotGitError({ message: "Worktrees are only supported for git projects" })
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const root = path.join(Global.Path.data, "worktree", Instance.project.id)
|
|
194
|
-
await fs.mkdir(root, { recursive: true })
|
|
195
|
-
|
|
196
|
-
const base = input?.name ? slug(input.name) : ""
|
|
197
|
-
const info = await candidate(root, base || undefined)
|
|
198
|
-
|
|
199
|
-
const created = await $`git worktree add -b ${info.branch} ${info.directory}`
|
|
200
|
-
.quiet()
|
|
201
|
-
.nothrow()
|
|
202
|
-
.cwd(Instance.worktree)
|
|
203
|
-
if (created.exitCode !== 0) {
|
|
204
|
-
throw new CreateFailedError({ message: errorText(created) || "Failed to create git worktree" })
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const cmd = input?.startCommand?.trim()
|
|
208
|
-
if (!cmd) return info
|
|
209
|
-
|
|
210
|
-
const ran = await runStartCommand(info.directory, cmd)
|
|
211
|
-
if (ran.exitCode !== 0) {
|
|
212
|
-
throw new StartCommandFailedError({ message: errorText(ran) || "Worktree start command failed" })
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return info
|
|
216
|
-
})
|
|
217
|
-
}
|
package/sst-env.d.ts
DELETED
package/test/agent/agent.test.ts
DELETED
|
@@ -1,448 +0,0 @@
|
|
|
1
|
-
import { test, expect } from "bun:test"
|
|
2
|
-
import { tmpdir } from "../fixture/fixture"
|
|
3
|
-
import { Instance } from "../../src/project/instance"
|
|
4
|
-
import { Agent } from "../../src/agent/agent"
|
|
5
|
-
import { PermissionNext } from "../../src/permission/next"
|
|
6
|
-
|
|
7
|
-
// Helper to evaluate permission for a tool with wildcard pattern
|
|
8
|
-
function evalPerm(agent: Agent.Info | undefined, permission: string): PermissionNext.Action | undefined {
|
|
9
|
-
if (!agent) return undefined
|
|
10
|
-
return PermissionNext.evaluate(permission, "*", agent.permission).action
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
test("returns default native agents when no config", async () => {
|
|
14
|
-
await using tmp = await tmpdir()
|
|
15
|
-
await Instance.provide({
|
|
16
|
-
directory: tmp.path,
|
|
17
|
-
fn: async () => {
|
|
18
|
-
const agents = await Agent.list()
|
|
19
|
-
const names = agents.map((a) => a.name)
|
|
20
|
-
expect(names).toContain("build")
|
|
21
|
-
expect(names).toContain("plan")
|
|
22
|
-
expect(names).toContain("general")
|
|
23
|
-
expect(names).toContain("explore")
|
|
24
|
-
expect(names).toContain("compaction")
|
|
25
|
-
expect(names).toContain("title")
|
|
26
|
-
expect(names).toContain("summary")
|
|
27
|
-
},
|
|
28
|
-
})
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
test("build agent has correct default properties", async () => {
|
|
32
|
-
await using tmp = await tmpdir()
|
|
33
|
-
await Instance.provide({
|
|
34
|
-
directory: tmp.path,
|
|
35
|
-
fn: async () => {
|
|
36
|
-
const build = await Agent.get("build")
|
|
37
|
-
expect(build).toBeDefined()
|
|
38
|
-
expect(build?.mode).toBe("primary")
|
|
39
|
-
expect(build?.native).toBe(true)
|
|
40
|
-
expect(evalPerm(build, "edit")).toBe("allow")
|
|
41
|
-
expect(evalPerm(build, "bash")).toBe("allow")
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
test("plan agent denies edits except .opencode/plan/*", async () => {
|
|
47
|
-
await using tmp = await tmpdir()
|
|
48
|
-
await Instance.provide({
|
|
49
|
-
directory: tmp.path,
|
|
50
|
-
fn: async () => {
|
|
51
|
-
const plan = await Agent.get("plan")
|
|
52
|
-
expect(plan).toBeDefined()
|
|
53
|
-
// Wildcard is denied
|
|
54
|
-
expect(evalPerm(plan, "edit")).toBe("deny")
|
|
55
|
-
// But specific path is allowed
|
|
56
|
-
expect(PermissionNext.evaluate("edit", ".opencode/plan/foo.md", plan!.permission).action).toBe("allow")
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
test("explore agent denies edit and write", async () => {
|
|
62
|
-
await using tmp = await tmpdir()
|
|
63
|
-
await Instance.provide({
|
|
64
|
-
directory: tmp.path,
|
|
65
|
-
fn: async () => {
|
|
66
|
-
const explore = await Agent.get("explore")
|
|
67
|
-
expect(explore).toBeDefined()
|
|
68
|
-
expect(explore?.mode).toBe("subagent")
|
|
69
|
-
expect(evalPerm(explore, "edit")).toBe("deny")
|
|
70
|
-
expect(evalPerm(explore, "write")).toBe("deny")
|
|
71
|
-
expect(evalPerm(explore, "todoread")).toBe("deny")
|
|
72
|
-
expect(evalPerm(explore, "todowrite")).toBe("deny")
|
|
73
|
-
},
|
|
74
|
-
})
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
test("general agent denies todo tools", async () => {
|
|
78
|
-
await using tmp = await tmpdir()
|
|
79
|
-
await Instance.provide({
|
|
80
|
-
directory: tmp.path,
|
|
81
|
-
fn: async () => {
|
|
82
|
-
const general = await Agent.get("general")
|
|
83
|
-
expect(general).toBeDefined()
|
|
84
|
-
expect(general?.mode).toBe("subagent")
|
|
85
|
-
expect(general?.hidden).toBe(true)
|
|
86
|
-
expect(evalPerm(general, "todoread")).toBe("deny")
|
|
87
|
-
expect(evalPerm(general, "todowrite")).toBe("deny")
|
|
88
|
-
},
|
|
89
|
-
})
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
test("compaction agent denies all permissions", async () => {
|
|
93
|
-
await using tmp = await tmpdir()
|
|
94
|
-
await Instance.provide({
|
|
95
|
-
directory: tmp.path,
|
|
96
|
-
fn: async () => {
|
|
97
|
-
const compaction = await Agent.get("compaction")
|
|
98
|
-
expect(compaction).toBeDefined()
|
|
99
|
-
expect(compaction?.hidden).toBe(true)
|
|
100
|
-
expect(evalPerm(compaction, "bash")).toBe("deny")
|
|
101
|
-
expect(evalPerm(compaction, "edit")).toBe("deny")
|
|
102
|
-
expect(evalPerm(compaction, "read")).toBe("deny")
|
|
103
|
-
},
|
|
104
|
-
})
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
test("custom agent from config creates new agent", async () => {
|
|
108
|
-
await using tmp = await tmpdir({
|
|
109
|
-
config: {
|
|
110
|
-
agent: {
|
|
111
|
-
my_custom_agent: {
|
|
112
|
-
model: "openai/gpt-4",
|
|
113
|
-
description: "My custom agent",
|
|
114
|
-
temperature: 0.5,
|
|
115
|
-
top_p: 0.9,
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
})
|
|
120
|
-
await Instance.provide({
|
|
121
|
-
directory: tmp.path,
|
|
122
|
-
fn: async () => {
|
|
123
|
-
const custom = await Agent.get("my_custom_agent")
|
|
124
|
-
expect(custom).toBeDefined()
|
|
125
|
-
expect(custom?.model?.providerID).toBe("openai")
|
|
126
|
-
expect(custom?.model?.modelID).toBe("gpt-4")
|
|
127
|
-
expect(custom?.description).toBe("My custom agent")
|
|
128
|
-
expect(custom?.temperature).toBe(0.5)
|
|
129
|
-
expect(custom?.topP).toBe(0.9)
|
|
130
|
-
expect(custom?.native).toBe(false)
|
|
131
|
-
expect(custom?.mode).toBe("all")
|
|
132
|
-
},
|
|
133
|
-
})
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
test("custom agent config overrides native agent properties", async () => {
|
|
137
|
-
await using tmp = await tmpdir({
|
|
138
|
-
config: {
|
|
139
|
-
agent: {
|
|
140
|
-
build: {
|
|
141
|
-
model: "anthropic/claude-3",
|
|
142
|
-
description: "Custom build agent",
|
|
143
|
-
temperature: 0.7,
|
|
144
|
-
color: "#FF0000",
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
})
|
|
149
|
-
await Instance.provide({
|
|
150
|
-
directory: tmp.path,
|
|
151
|
-
fn: async () => {
|
|
152
|
-
const build = await Agent.get("build")
|
|
153
|
-
expect(build).toBeDefined()
|
|
154
|
-
expect(build?.model?.providerID).toBe("anthropic")
|
|
155
|
-
expect(build?.model?.modelID).toBe("claude-3")
|
|
156
|
-
expect(build?.description).toBe("Custom build agent")
|
|
157
|
-
expect(build?.temperature).toBe(0.7)
|
|
158
|
-
expect(build?.color).toBe("#FF0000")
|
|
159
|
-
expect(build?.native).toBe(true)
|
|
160
|
-
},
|
|
161
|
-
})
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
test("agent disable removes agent from list", async () => {
|
|
165
|
-
await using tmp = await tmpdir({
|
|
166
|
-
config: {
|
|
167
|
-
agent: {
|
|
168
|
-
explore: { disable: true },
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
})
|
|
172
|
-
await Instance.provide({
|
|
173
|
-
directory: tmp.path,
|
|
174
|
-
fn: async () => {
|
|
175
|
-
const explore = await Agent.get("explore")
|
|
176
|
-
expect(explore).toBeUndefined()
|
|
177
|
-
const agents = await Agent.list()
|
|
178
|
-
const names = agents.map((a) => a.name)
|
|
179
|
-
expect(names).not.toContain("explore")
|
|
180
|
-
},
|
|
181
|
-
})
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
test("agent permission config merges with defaults", async () => {
|
|
185
|
-
await using tmp = await tmpdir({
|
|
186
|
-
config: {
|
|
187
|
-
agent: {
|
|
188
|
-
build: {
|
|
189
|
-
permission: {
|
|
190
|
-
bash: {
|
|
191
|
-
"rm -rf *": "deny",
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
})
|
|
198
|
-
await Instance.provide({
|
|
199
|
-
directory: tmp.path,
|
|
200
|
-
fn: async () => {
|
|
201
|
-
const build = await Agent.get("build")
|
|
202
|
-
expect(build).toBeDefined()
|
|
203
|
-
// Specific pattern is denied
|
|
204
|
-
expect(PermissionNext.evaluate("bash", "rm -rf *", build!.permission).action).toBe("deny")
|
|
205
|
-
// Edit still allowed
|
|
206
|
-
expect(evalPerm(build, "edit")).toBe("allow")
|
|
207
|
-
},
|
|
208
|
-
})
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
test("global permission config applies to all agents", async () => {
|
|
212
|
-
await using tmp = await tmpdir({
|
|
213
|
-
config: {
|
|
214
|
-
permission: {
|
|
215
|
-
bash: "deny",
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
})
|
|
219
|
-
await Instance.provide({
|
|
220
|
-
directory: tmp.path,
|
|
221
|
-
fn: async () => {
|
|
222
|
-
const build = await Agent.get("build")
|
|
223
|
-
expect(build).toBeDefined()
|
|
224
|
-
expect(evalPerm(build, "bash")).toBe("deny")
|
|
225
|
-
},
|
|
226
|
-
})
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
test("agent steps/maxSteps config sets steps property", async () => {
|
|
230
|
-
await using tmp = await tmpdir({
|
|
231
|
-
config: {
|
|
232
|
-
agent: {
|
|
233
|
-
build: { steps: 50 },
|
|
234
|
-
plan: { maxSteps: 100 },
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
})
|
|
238
|
-
await Instance.provide({
|
|
239
|
-
directory: tmp.path,
|
|
240
|
-
fn: async () => {
|
|
241
|
-
const build = await Agent.get("build")
|
|
242
|
-
const plan = await Agent.get("plan")
|
|
243
|
-
expect(build?.steps).toBe(50)
|
|
244
|
-
expect(plan?.steps).toBe(100)
|
|
245
|
-
},
|
|
246
|
-
})
|
|
247
|
-
})
|
|
248
|
-
|
|
249
|
-
test("agent mode can be overridden", async () => {
|
|
250
|
-
await using tmp = await tmpdir({
|
|
251
|
-
config: {
|
|
252
|
-
agent: {
|
|
253
|
-
explore: { mode: "primary" },
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
})
|
|
257
|
-
await Instance.provide({
|
|
258
|
-
directory: tmp.path,
|
|
259
|
-
fn: async () => {
|
|
260
|
-
const explore = await Agent.get("explore")
|
|
261
|
-
expect(explore?.mode).toBe("primary")
|
|
262
|
-
},
|
|
263
|
-
})
|
|
264
|
-
})
|
|
265
|
-
|
|
266
|
-
test("agent name can be overridden", async () => {
|
|
267
|
-
await using tmp = await tmpdir({
|
|
268
|
-
config: {
|
|
269
|
-
agent: {
|
|
270
|
-
build: { name: "Builder" },
|
|
271
|
-
},
|
|
272
|
-
},
|
|
273
|
-
})
|
|
274
|
-
await Instance.provide({
|
|
275
|
-
directory: tmp.path,
|
|
276
|
-
fn: async () => {
|
|
277
|
-
const build = await Agent.get("build")
|
|
278
|
-
expect(build?.name).toBe("Builder")
|
|
279
|
-
},
|
|
280
|
-
})
|
|
281
|
-
})
|
|
282
|
-
|
|
283
|
-
test("agent prompt can be set from config", async () => {
|
|
284
|
-
await using tmp = await tmpdir({
|
|
285
|
-
config: {
|
|
286
|
-
agent: {
|
|
287
|
-
build: { prompt: "Custom system prompt" },
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
|
-
})
|
|
291
|
-
await Instance.provide({
|
|
292
|
-
directory: tmp.path,
|
|
293
|
-
fn: async () => {
|
|
294
|
-
const build = await Agent.get("build")
|
|
295
|
-
expect(build?.prompt).toBe("Custom system prompt")
|
|
296
|
-
},
|
|
297
|
-
})
|
|
298
|
-
})
|
|
299
|
-
|
|
300
|
-
test("unknown agent properties are placed into options", async () => {
|
|
301
|
-
await using tmp = await tmpdir({
|
|
302
|
-
config: {
|
|
303
|
-
agent: {
|
|
304
|
-
build: {
|
|
305
|
-
random_property: "hello",
|
|
306
|
-
another_random: 123,
|
|
307
|
-
},
|
|
308
|
-
},
|
|
309
|
-
},
|
|
310
|
-
})
|
|
311
|
-
await Instance.provide({
|
|
312
|
-
directory: tmp.path,
|
|
313
|
-
fn: async () => {
|
|
314
|
-
const build = await Agent.get("build")
|
|
315
|
-
expect(build?.options.random_property).toBe("hello")
|
|
316
|
-
expect(build?.options.another_random).toBe(123)
|
|
317
|
-
},
|
|
318
|
-
})
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
test("agent options merge correctly", async () => {
|
|
322
|
-
await using tmp = await tmpdir({
|
|
323
|
-
config: {
|
|
324
|
-
agent: {
|
|
325
|
-
build: {
|
|
326
|
-
options: {
|
|
327
|
-
custom_option: true,
|
|
328
|
-
another_option: "value",
|
|
329
|
-
},
|
|
330
|
-
},
|
|
331
|
-
},
|
|
332
|
-
},
|
|
333
|
-
})
|
|
334
|
-
await Instance.provide({
|
|
335
|
-
directory: tmp.path,
|
|
336
|
-
fn: async () => {
|
|
337
|
-
const build = await Agent.get("build")
|
|
338
|
-
expect(build?.options.custom_option).toBe(true)
|
|
339
|
-
expect(build?.options.another_option).toBe("value")
|
|
340
|
-
},
|
|
341
|
-
})
|
|
342
|
-
})
|
|
343
|
-
|
|
344
|
-
test("multiple custom agents can be defined", async () => {
|
|
345
|
-
await using tmp = await tmpdir({
|
|
346
|
-
config: {
|
|
347
|
-
agent: {
|
|
348
|
-
agent_a: {
|
|
349
|
-
description: "Agent A",
|
|
350
|
-
mode: "subagent",
|
|
351
|
-
},
|
|
352
|
-
agent_b: {
|
|
353
|
-
description: "Agent B",
|
|
354
|
-
mode: "primary",
|
|
355
|
-
},
|
|
356
|
-
},
|
|
357
|
-
},
|
|
358
|
-
})
|
|
359
|
-
await Instance.provide({
|
|
360
|
-
directory: tmp.path,
|
|
361
|
-
fn: async () => {
|
|
362
|
-
const agentA = await Agent.get("agent_a")
|
|
363
|
-
const agentB = await Agent.get("agent_b")
|
|
364
|
-
expect(agentA?.description).toBe("Agent A")
|
|
365
|
-
expect(agentA?.mode).toBe("subagent")
|
|
366
|
-
expect(agentB?.description).toBe("Agent B")
|
|
367
|
-
expect(agentB?.mode).toBe("primary")
|
|
368
|
-
},
|
|
369
|
-
})
|
|
370
|
-
})
|
|
371
|
-
|
|
372
|
-
test("Agent.get returns undefined for non-existent agent", async () => {
|
|
373
|
-
await using tmp = await tmpdir()
|
|
374
|
-
await Instance.provide({
|
|
375
|
-
directory: tmp.path,
|
|
376
|
-
fn: async () => {
|
|
377
|
-
const nonExistent = await Agent.get("does_not_exist")
|
|
378
|
-
expect(nonExistent).toBeUndefined()
|
|
379
|
-
},
|
|
380
|
-
})
|
|
381
|
-
})
|
|
382
|
-
|
|
383
|
-
test("default permission includes doom_loop and external_directory as ask", async () => {
|
|
384
|
-
await using tmp = await tmpdir()
|
|
385
|
-
await Instance.provide({
|
|
386
|
-
directory: tmp.path,
|
|
387
|
-
fn: async () => {
|
|
388
|
-
const build = await Agent.get("build")
|
|
389
|
-
expect(evalPerm(build, "doom_loop")).toBe("ask")
|
|
390
|
-
expect(evalPerm(build, "external_directory")).toBe("ask")
|
|
391
|
-
},
|
|
392
|
-
})
|
|
393
|
-
})
|
|
394
|
-
|
|
395
|
-
test("webfetch is allowed by default", async () => {
|
|
396
|
-
await using tmp = await tmpdir()
|
|
397
|
-
await Instance.provide({
|
|
398
|
-
directory: tmp.path,
|
|
399
|
-
fn: async () => {
|
|
400
|
-
const build = await Agent.get("build")
|
|
401
|
-
expect(evalPerm(build, "webfetch")).toBe("allow")
|
|
402
|
-
},
|
|
403
|
-
})
|
|
404
|
-
})
|
|
405
|
-
|
|
406
|
-
test("legacy tools config converts to permissions", async () => {
|
|
407
|
-
await using tmp = await tmpdir({
|
|
408
|
-
config: {
|
|
409
|
-
agent: {
|
|
410
|
-
build: {
|
|
411
|
-
tools: {
|
|
412
|
-
bash: false,
|
|
413
|
-
read: false,
|
|
414
|
-
},
|
|
415
|
-
},
|
|
416
|
-
},
|
|
417
|
-
},
|
|
418
|
-
})
|
|
419
|
-
await Instance.provide({
|
|
420
|
-
directory: tmp.path,
|
|
421
|
-
fn: async () => {
|
|
422
|
-
const build = await Agent.get("build")
|
|
423
|
-
expect(evalPerm(build, "bash")).toBe("deny")
|
|
424
|
-
expect(evalPerm(build, "read")).toBe("deny")
|
|
425
|
-
},
|
|
426
|
-
})
|
|
427
|
-
})
|
|
428
|
-
|
|
429
|
-
test("legacy tools config maps write/edit/patch/multiedit to edit permission", async () => {
|
|
430
|
-
await using tmp = await tmpdir({
|
|
431
|
-
config: {
|
|
432
|
-
agent: {
|
|
433
|
-
build: {
|
|
434
|
-
tools: {
|
|
435
|
-
write: false,
|
|
436
|
-
},
|
|
437
|
-
},
|
|
438
|
-
},
|
|
439
|
-
},
|
|
440
|
-
})
|
|
441
|
-
await Instance.provide({
|
|
442
|
-
directory: tmp.path,
|
|
443
|
-
fn: async () => {
|
|
444
|
-
const build = await Agent.get("build")
|
|
445
|
-
expect(evalPerm(build, "edit")).toBe("deny")
|
|
446
|
-
},
|
|
447
|
-
})
|
|
448
|
-
})
|