Skip to content

Commit 3a4c8cd

Browse files
revert(core): remove portable shell permission scanner (#42571)
Co-authored-by: Kit Langton <[email protected]>
1 parent 8d71099 commit 3a4c8cd

44 files changed

Lines changed: 237 additions & 2388 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.changeset/shell-permission-scan.md‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎.github/workflows/test.yml‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,6 @@ jobs:
7676
env:
7777
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
7878

79-
- name: Verify PowerShell 7 scanner conformance
80-
if: always() && runner.os == 'Windows'
81-
working-directory: packages/shell-scan
82-
run: PWSH=pwsh bun run research:powershell
83-
84-
- name: Verify Windows PowerShell scanner conformance
85-
if: always() && runner.os == 'Windows'
86-
working-directory: packages/shell-scan
87-
run: PWSH=powershell.exe bun run research:powershell
88-
8979
- name: Verify compiled service lifecycle
9080
if: always()
9181
timeout-minutes: 10

‎bun.lock‎

Lines changed: 16 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@
145145
"esbuild",
146146
"node-pty",
147147
"protobufjs",
148+
"tree-sitter",
149+
"tree-sitter-bash",
150+
"tree-sitter-powershell",
151+
"web-tree-sitter",
148152
"electron"
149153
],
150154
"overrides": {

‎packages/app/e2e/regression/session-request-docks.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ test("shows a pending permission dock", async ({ page }) => {
8787
permission: "bash",
8888
patterns: ["git status", "git diff"],
8989
metadata: {},
90-
always: ["git *"],
90+
always: [],
9191
},
9292
],
9393
})

‎packages/app/src/pages/session/composer/session-permission-dock.tsx‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,14 @@ export function SessionPermissionDock(props: {
3737
<Button variant="ghost" size="normal" onClick={() => props.onDecide("reject")} disabled={props.responding}>
3838
{language.t("ui.permission.deny")}
3939
</Button>
40-
<Show when={props.request.save?.length}>
41-
<Button
42-
variant="secondary"
43-
size="normal"
44-
onClick={() => props.onDecide("always")}
45-
disabled={props.responding}
46-
>
47-
{language.t("ui.permission.allowAlways")}
48-
</Button>
49-
</Show>
40+
<Button
41+
variant="secondary"
42+
size="normal"
43+
onClick={() => props.onDecide("always")}
44+
disabled={props.responding}
45+
>
46+
{language.t("ui.permission.allowAlways")}
47+
</Button>
5048
<Button variant="primary" size="normal" onClick={() => props.onDecide("once")} disabled={props.responding}>
5149
{language.t("ui.permission.allowOnce")}
5250
</Button>

‎packages/cli/package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
"open": "10.1.2",
4141
"semver": "catalog:",
4242
"solid-js": "catalog:",
43+
"tree-sitter-bash": "0.25.0",
44+
"tree-sitter-powershell": "0.25.10",
45+
"web-tree-sitter": "0.25.10",
4346
"uqr": "0.1.3",
4447
"ws": "8.21.0"
4548
},

‎packages/cli/script/node-assets.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { copyFile, mkdir, readdir, readFile, stat } from "node:fs/promises"
33
import path from "node:path"
44
import { fileURLToPath } from "node:url"
55
import { getNodeAssets } from "@opentui/core/node-assets"
6-
import { attentionSoundAssets, type NodeTarget, photonWasmAsset } from "../src/node/target"
6+
import { attentionSoundAssets, type NodeTarget, photonWasmAsset, shellParserWasmAssets } from "../src/node/target"
77

88
const dir = path.resolve(import.meta.dirname, "..")
99

@@ -43,6 +43,10 @@ export async function collectNodeAssets(target: NodeTarget) {
4343
key: photonWasmAsset,
4444
source: fileURLToPath(import.meta.resolve(photonWasmAsset)),
4545
},
46+
...Object.values(shellParserWasmAssets).map((key) => ({
47+
key,
48+
source: fileURLToPath(import.meta.resolve(key)),
49+
})),
4650
...attentionSoundAssets.map((key) => ({
4751
key,
4852
source: path.resolve(dir, "../ui/src/assets/audio", path.basename(key)),

‎packages/cli/src/acp/permission.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export async function replyPermission(input: {
4747
locations: permissionLocations(toolName, toolInput, input.event.data.resources, input.cwd, previews),
4848
...(previews.length > 0 ? { content: previews } : {}),
4949
},
50-
options: input.event.data.save?.length ? options : options.filter((option) => option.optionId !== "always"),
50+
options,
5151
})
5252
.catch(() => undefined)
5353
const selected = result?.outcome.outcome === "selected" ? result.outcome.optionId : undefined

‎packages/cli/src/node/target.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export function nodeTarget(platform: string, arch: string) {
2929
}
3030

3131
export const photonWasmAsset = "@silvia-odwyer/photon-node/photon_rs_bg.wasm"
32+
export const shellParserWasmAssets = {
33+
runtime: "web-tree-sitter/tree-sitter.wasm",
34+
bash: "tree-sitter-bash/tree-sitter-bash.wasm",
35+
powershell: "tree-sitter-powershell/tree-sitter-powershell.wasm",
36+
} as const
3237
export const nodeExecArgv = ["--experimental-ffi", "--use-system-ca", "--disable-warning=ExperimentalWarning"] as const
3338

3439
export const attentionSoundAssets = [

0 commit comments

Comments
 (0)