@open-mercato/cezar 0.1.5-pr506.357
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 +573 -0
- package/dist/config.d.ts +144 -0
- package/dist/config.js +106 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-runner.d.ts +169 -0
- package/dist/core/agent-runner.js +23 -0
- package/dist/core/agent-runner.js.map +1 -0
- package/dist/core/backend-detect.d.ts +16 -0
- package/dist/core/backend-detect.js +118 -0
- package/dist/core/backend-detect.js.map +1 -0
- package/dist/core/claude-cli-runner.d.ts +56 -0
- package/dist/core/claude-cli-runner.js +416 -0
- package/dist/core/claude-cli-runner.js.map +1 -0
- package/dist/core/claude-ui-mapper.d.ts +71 -0
- package/dist/core/claude-ui-mapper.js +567 -0
- package/dist/core/claude-ui-mapper.js.map +1 -0
- package/dist/core/codex-app-server-runner.d.ts +29 -0
- package/dist/core/codex-app-server-runner.js +489 -0
- package/dist/core/codex-app-server-runner.js.map +1 -0
- package/dist/core/codex-ui-mapper.d.ts +63 -0
- package/dist/core/codex-ui-mapper.js +491 -0
- package/dist/core/codex-ui-mapper.js.map +1 -0
- package/dist/core/ndjson.d.ts +6 -0
- package/dist/core/ndjson.js +23 -0
- package/dist/core/ndjson.js.map +1 -0
- package/dist/core/opencode-server-runner.d.ts +30 -0
- package/dist/core/opencode-server-runner.js +488 -0
- package/dist/core/opencode-server-runner.js.map +1 -0
- package/dist/core/opencode-ui-mapper.d.ts +105 -0
- package/dist/core/opencode-ui-mapper.js +588 -0
- package/dist/core/opencode-ui-mapper.js.map +1 -0
- package/dist/core/process-usage.d.ts +63 -0
- package/dist/core/process-usage.js +181 -0
- package/dist/core/process-usage.js.map +1 -0
- package/dist/core/runner-factory.d.ts +8 -0
- package/dist/core/runner-factory.js +22 -0
- package/dist/core/runner-factory.js.map +1 -0
- package/dist/core/tool-display.d.ts +30 -0
- package/dist/core/tool-display.js +156 -0
- package/dist/core/tool-display.js.map +1 -0
- package/dist/core/ui-events.d.ts +308 -0
- package/dist/core/ui-events.js +25 -0
- package/dist/core/ui-events.js.map +1 -0
- package/dist/core/usage.d.ts +11 -0
- package/dist/core/usage.js +15 -0
- package/dist/core/usage.js.map +1 -0
- package/dist/git-worktree.d.ts +88 -0
- package/dist/git-worktree.js +297 -0
- package/dist/git-worktree.js.map +1 -0
- package/dist/handoff.d.ts +62 -0
- package/dist/handoff.js +147 -0
- package/dist/handoff.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +466 -0
- package/dist/index.js.map +1 -0
- package/dist/install-as-command.d.ts +39 -0
- package/dist/install-as-command.js +51 -0
- package/dist/install-as-command.js.map +1 -0
- package/dist/pack-check.d.ts +17 -0
- package/dist/pack-check.js +27 -0
- package/dist/pack-check.js.map +1 -0
- package/dist/paths.d.ts +23 -0
- package/dist/paths.js +34 -0
- package/dist/paths.js.map +1 -0
- package/dist/planner.d.ts +17 -0
- package/dist/planner.js +248 -0
- package/dist/planner.js.map +1 -0
- package/dist/release/snapshot.d.ts +64 -0
- package/dist/release/snapshot.js +75 -0
- package/dist/release/snapshot.js.map +1 -0
- package/dist/release/stable.d.ts +46 -0
- package/dist/release/stable.js +57 -0
- package/dist/release/stable.js.map +1 -0
- package/dist/runs/auto-name.d.ts +75 -0
- package/dist/runs/auto-name.js +168 -0
- package/dist/runs/auto-name.js.map +1 -0
- package/dist/runs/retention.d.ts +60 -0
- package/dist/runs/retention.js +86 -0
- package/dist/runs/retention.js.map +1 -0
- package/dist/runs/review-gate.d.ts +18 -0
- package/dist/runs/review-gate.js +21 -0
- package/dist/runs/review-gate.js.map +1 -0
- package/dist/runs/store.d.ts +408 -0
- package/dist/runs/store.js +526 -0
- package/dist/runs/store.js.map +1 -0
- package/dist/runs/task-refs.d.ts +24 -0
- package/dist/runs/task-refs.js +74 -0
- package/dist/runs/task-refs.js.map +1 -0
- package/dist/runs/ui-event-sink.d.ts +81 -0
- package/dist/runs/ui-event-sink.js +210 -0
- package/dist/runs/ui-event-sink.js.map +1 -0
- package/dist/server/capabilities.d.ts +33 -0
- package/dist/server/capabilities.js +43 -0
- package/dist/server/capabilities.js.map +1 -0
- package/dist/server/forge/github.d.ts +70 -0
- package/dist/server/forge/github.js +375 -0
- package/dist/server/forge/github.js.map +1 -0
- package/dist/server/forge/index.d.ts +24 -0
- package/dist/server/forge/index.js +45 -0
- package/dist/server/forge/index.js.map +1 -0
- package/dist/server/forge/types.d.ts +80 -0
- package/dist/server/forge/types.js +2 -0
- package/dist/server/forge/types.js.map +1 -0
- package/dist/server/git-changes.d.ts +195 -0
- package/dist/server/git-changes.js +497 -0
- package/dist/server/git-changes.js.map +1 -0
- package/dist/server/git.d.ts +26 -0
- package/dist/server/git.js +103 -0
- package/dist/server/git.js.map +1 -0
- package/dist/server/github.d.ts +8 -0
- package/dist/server/github.js +8 -0
- package/dist/server/github.js.map +1 -0
- package/dist/server/launch-key.d.ts +7 -0
- package/dist/server/launch-key.js +33 -0
- package/dist/server/launch-key.js.map +1 -0
- package/dist/server/open-in-app.d.ts +51 -0
- package/dist/server/open-in-app.js +189 -0
- package/dist/server/open-in-app.js.map +1 -0
- package/dist/server/open-in-terminal.d.ts +25 -0
- package/dist/server/open-in-terminal.js +120 -0
- package/dist/server/open-in-terminal.js.map +1 -0
- package/dist/server/pr.d.ts +7 -0
- package/dist/server/pr.js +7 -0
- package/dist/server/pr.js.map +1 -0
- package/dist/server/server.d.ts +41 -0
- package/dist/server/server.js +1390 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/static-ui.d.ts +49 -0
- package/dist/server/static-ui.js +92 -0
- package/dist/server/static-ui.js.map +1 -0
- package/dist/server/wsl.d.ts +25 -0
- package/dist/server/wsl.js +92 -0
- package/dist/server/wsl.js.map +1 -0
- package/dist/server-install/engine.d.ts +33 -0
- package/dist/server-install/engine.js +314 -0
- package/dist/server-install/engine.js.map +1 -0
- package/dist/server-install/platforms/macosx-ngrok.d.ts +6 -0
- package/dist/server-install/platforms/macosx-ngrok.js +345 -0
- package/dist/server-install/platforms/macosx-ngrok.js.map +1 -0
- package/dist/server-install/platforms/ubuntu-vps.d.ts +39 -0
- package/dist/server-install/platforms/ubuntu-vps.js +746 -0
- package/dist/server-install/platforms/ubuntu-vps.js.map +1 -0
- package/dist/server-install/state.d.ts +26 -0
- package/dist/server-install/state.js +125 -0
- package/dist/server-install/state.js.map +1 -0
- package/dist/server-install/steps.d.ts +109 -0
- package/dist/server-install/steps.js +330 -0
- package/dist/server-install/steps.js.map +1 -0
- package/dist/server-install/strategies.d.ts +4 -0
- package/dist/server-install/strategies.js +20 -0
- package/dist/server-install/strategies.js.map +1 -0
- package/dist/server-install/types.d.ts +597 -0
- package/dist/server-install/types.js +98 -0
- package/dist/server-install/types.js.map +1 -0
- package/dist/server-install/ui.d.ts +42 -0
- package/dist/server-install/ui.js +130 -0
- package/dist/server-install/ui.js.map +1 -0
- package/dist/skills-banner.d.ts +21 -0
- package/dist/skills-banner.js +40 -0
- package/dist/skills-banner.js.map +1 -0
- package/dist/skills-remote.d.ts +35 -0
- package/dist/skills-remote.js +266 -0
- package/dist/skills-remote.js.map +1 -0
- package/dist/skills.d.ts +45 -0
- package/dist/skills.js +182 -0
- package/dist/skills.js.map +1 -0
- package/dist/todos.d.ts +63 -0
- package/dist/todos.js +168 -0
- package/dist/todos.js.map +1 -0
- package/dist/ui-state.d.ts +12 -0
- package/dist/ui-state.js +25 -0
- package/dist/ui-state.js.map +1 -0
- package/dist/update-check.d.ts +12 -0
- package/dist/update-check.js +41 -0
- package/dist/update-check.js.map +1 -0
- package/dist/workflows/load.d.ts +15 -0
- package/dist/workflows/load.js +56 -0
- package/dist/workflows/load.js.map +1 -0
- package/dist/workflows/run.d.ts +281 -0
- package/dist/workflows/run.js +1511 -0
- package/dist/workflows/run.js.map +1 -0
- package/dist/workflows/types.d.ts +307 -0
- package/dist/workflows/types.js +171 -0
- package/dist/workflows/types.js.map +1 -0
- package/package.json +90 -0
- package/scripts/check-pack.mjs +46 -0
- package/scripts/dev.mjs +74 -0
- package/scripts/install-as-command.mjs +120 -0
- package/scripts/mock-claude.mjs +310 -0
- package/scripts/release-snapshot.mjs +130 -0
- package/scripts/release.mjs +119 -0
- package/scripts/test-process-usage.mjs +47 -0
- package/web/dist/assets/arrow-left-BE957rJs.js +1 -0
- package/web/dist/assets/bundle-mjs-DLPpRFyl.js +1 -0
- package/web/dist/assets/centered-state-BddhEEtO.js +43 -0
- package/web/dist/assets/chunk-BO2N2NFS-f5igTtpB.js +131 -0
- package/web/dist/assets/command-CjhFbABo.js +1 -0
- package/web/dist/assets/compare-variants-Cs52IAEG.js +1 -0
- package/web/dist/assets/core-BuMqAF_1.js +12 -0
- package/web/dist/assets/css-BsVw1vtW.js +1 -0
- package/web/dist/assets/dialog-DFvXTkFv.js +1 -0
- package/web/dist/assets/diff-view-C9b8AITq.js +4 -0
- package/web/dist/assets/diff-woXpYk--.js +1 -0
- package/web/dist/assets/dist-FBs4wmIY.js +1 -0
- package/web/dist/assets/dist-o_kVMXjg.js +1 -0
- package/web/dist/assets/engine-javascript-FQvzRocB.js +141 -0
- package/web/dist/assets/file-BVuztAOd.js +1 -0
- package/web/dist/assets/folder-0pJ1NZ_S.js +1 -0
- package/web/dist/assets/git-pull-request-DJkAMT0f.js +1 -0
- package/web/dist/assets/git-toolbar-CwhQdx3J.js +1 -0
- package/web/dist/assets/github-D0rAX4-r.js +1 -0
- package/web/dist/assets/go-rLFTqkRN.js +1 -0
- package/web/dist/assets/highlighted-body-OFNGDK62-DGHHie_q.js +1 -0
- package/web/dist/assets/highlighter-BKVEsACy.js +3 -0
- package/web/dist/assets/html-BY76lXLH.js +1 -0
- package/web/dist/assets/index-CEkI7QxN.css +2 -0
- package/web/dist/assets/index-CO2lH2et.js +11 -0
- package/web/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/web/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/web/dist/assets/javascript-BgS3c2Ky.js +1 -0
- package/web/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/web/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/web/dist/assets/json-qhed-kSA.js +1 -0
- package/web/dist/assets/jsonc-CYpm1nAK.js +1 -0
- package/web/dist/assets/jsx-Bz0zcwM4.js +1 -0
- package/web/dist/assets/lib-CNGa3Dig.js +1 -0
- package/web/dist/assets/loader-circle-BV3DO9mE.js +1 -0
- package/web/dist/assets/markdown-BYOwaDjH.js +1 -0
- package/web/dist/assets/markdown-D4-ADgH9.js +1 -0
- package/web/dist/assets/mermaid-GHXKKRXX-DM2VsGBG.js +1 -0
- package/web/dist/assets/open-mercato-toBr6SOa.svg +11 -0
- package/web/dist/assets/prompt-templates-C7ptKvDd.js +15 -0
- package/web/dist/assets/python-gzcpVVnB.js +1 -0
- package/web/dist/assets/react-dom-Ddtik4qM.js +1 -0
- package/web/dist/assets/refresh-cw-DCa-Rlwz.js +1 -0
- package/web/dist/assets/repo-git-DIhryGDx.js +1 -0
- package/web/dist/assets/run-diff-Dyow8B1q.js +3 -0
- package/web/dist/assets/run-header-jx9-18b8.js +1 -0
- package/web/dist/assets/rust-Cfkwpbl8.js +1 -0
- package/web/dist/assets/search-x-CoCyl7zT.js +1 -0
- package/web/dist/assets/shellscript-CLZ0U2zV.js +1 -0
- package/web/dist/assets/skill-detail-DB7x_FQp.js +1 -0
- package/web/dist/assets/skills-98vCroU8.js +1 -0
- package/web/dist/assets/skills-BKIoqD6K.js +1 -0
- package/web/dist/assets/sql-BsFa4tDR.js +1 -0
- package/web/dist/assets/square-terminal-B6PZX4Qp.js +1 -0
- package/web/dist/assets/tab-link-C5--YMQd.js +1 -0
- package/web/dist/assets/task-changes-ejxPGVJw.js +1 -0
- package/web/dist/assets/task-commits-C6GO5qT-.js +1 -0
- package/web/dist/assets/task-files-CatpCBXa.js +2 -0
- package/web/dist/assets/task-thread-BMbXDM3d.js +5 -0
- package/web/dist/assets/tasks-table-dgezlCcg.js +1 -0
- package/web/dist/assets/trash-2-CDtxmmc8.js +1 -0
- package/web/dist/assets/triangle-alert-6su4Js5O.js +1 -0
- package/web/dist/assets/tsx-udAQXfEw.js +1 -0
- package/web/dist/assets/typescript-bsJCZSQ-.js +1 -0
- package/web/dist/assets/upload-Bp7hQxll.js +1 -0
- package/web/dist/assets/use-desktop-CvTwojOJ.js +3 -0
- package/web/dist/assets/utils-rQGbOrwc.js +1 -0
- package/web/dist/assets/workflows-Dy2c6790.js +11 -0
- package/web/dist/assets/x-Br_jIDBw.js +1 -0
- package/web/dist/assets/yaml-rwi0_p6S.js +1 -0
- package/web/dist/index.html +70 -0
- package/web/open-mercato.svg +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/server/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAoBjC,KAAK,UAAU,GAAG,CAAC,IAAY,EAAE,IAAc;IAC7C,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC,CAAC;IACvF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,qDAAqD;AACrD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAW;IAC3C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACvE,MAAM,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,IAA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IAAI,EAAE;QAC1B,KAAK;QACL,IAAI,KAAK,EAAE;QACX,wCAAwC;KACzC,CAAC,CAAC;IACH,OAAO,GAAG;SACP,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,CAAC,IAAI,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin delegate — the gh-CLI listing logic moved behind the forge-driver seam
|
|
3
|
+
* (`src/server/forge/github.ts`, cockpit-ui redesign spec §"Forge-driver
|
|
4
|
+
* seam"). Kept so existing imports and the protected `/api/github` response
|
|
5
|
+
* shape (BACKWARD_COMPATIBILITY.md §2) stay exactly as they were.
|
|
6
|
+
*/
|
|
7
|
+
export { fetchGithub, GH_MAX_LIMIT } from './forge/github.js';
|
|
8
|
+
export type { GithubData, GithubItem } from './forge/github.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin delegate — the gh-CLI listing logic moved behind the forge-driver seam
|
|
3
|
+
* (`src/server/forge/github.ts`, cockpit-ui redesign spec §"Forge-driver
|
|
4
|
+
* seam"). Kept so existing imports and the protected `/api/github` response
|
|
5
|
+
* shape (BACKWARD_COMPATIBILITY.md §2) stay exactly as they were.
|
|
6
|
+
*/
|
|
7
|
+
export { fetchGithub, GH_MAX_LIMIT } from './forge/github.js';
|
|
8
|
+
//# sourceMappingURL=github.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/server/github.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Launch-key (spec 011): a random secret baked into the bookmarklets so only
|
|
3
|
+
* pages that got it from THIS cockpit can auto-start a run via `/new?auto=1`.
|
|
4
|
+
* A rogue web page can navigate the browser to localhost, but it cannot read
|
|
5
|
+
* `.ai/cezar/launch-key` — without the key `/new` only prefills the form.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ensureLaunchKey(dataDir: string): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
/**
|
|
5
|
+
* Launch-key (spec 011): a random secret baked into the bookmarklets so only
|
|
6
|
+
* pages that got it from THIS cockpit can auto-start a run via `/new?auto=1`.
|
|
7
|
+
* A rogue web page can navigate the browser to localhost, but it cannot read
|
|
8
|
+
* `.ai/cezar/launch-key` — without the key `/new` only prefills the form.
|
|
9
|
+
*/
|
|
10
|
+
export function ensureLaunchKey(dataDir) {
|
|
11
|
+
const path = join(dataDir, 'launch-key');
|
|
12
|
+
try {
|
|
13
|
+
if (existsSync(path)) {
|
|
14
|
+
const existing = readFileSync(path, 'utf8').trim();
|
|
15
|
+
if (existing)
|
|
16
|
+
return existing;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// unreadable — fall through and regenerate
|
|
21
|
+
}
|
|
22
|
+
const key = randomUUID();
|
|
23
|
+
try {
|
|
24
|
+
mkdirSync(dataDir, { recursive: true });
|
|
25
|
+
writeFileSync(path, `${key}\n`, { encoding: 'utf8', mode: 0o600 });
|
|
26
|
+
chmodSync(path, 0o600); // best-effort — mode is ignored on pre-existing files
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// non-fatal: the key still protects auto-start for this process lifetime
|
|
30
|
+
}
|
|
31
|
+
return key;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=launch-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch-key.js","sourceRoot":"","sources":["../../src/server/launch-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC;QACH,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;YACnD,IAAI,QAAQ;gBAAE,OAAO,QAAQ,CAAC;QAChC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,2CAA2C;IAC7C,CAAC;IACD,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,IAAI,CAAC;QACH,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACxC,aAAa,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACnE,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,sDAAsD;IAChF,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;IAC3E,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Open in…" session takeover (#open-in): detect the editors / file managers / terminals on THIS
|
|
3
|
+
* machine, and open a run's worktree in the one the user picks — the desktop-app equivalent of
|
|
4
|
+
* the "cd <path>" hint. Local-only; the server gates these behind `localHandoff` (CEZ_REMOTE).
|
|
5
|
+
*
|
|
6
|
+
* Detection is best-effort and cross-platform: an editor counts as present if its CLI is on PATH
|
|
7
|
+
* or (macOS) its .app bundle is installed. Finder/file-manager and Terminal are always offered.
|
|
8
|
+
*
|
|
9
|
+
* WSL (#361): when this process itself runs inside WSL, `process.platform` reads `linux` but the
|
|
10
|
+
* user's GUI apps mostly live on the Windows side, reachable through interop. `resolveOnPath`
|
|
11
|
+
* additionally probes directly-spawnable `.com`/`.exe` suffixes there (Node's own PATH lookup
|
|
12
|
+
* only does that under real win32), and `openInApp`/`openFileManager` translate the worktree path
|
|
13
|
+
* to its `\\wsl$\…` (or `C:\…`) form before handing it to a resolved Windows-side binary — a WSL-native
|
|
14
|
+
* launcher (e.g. VS Code's Remote-WSL `code` shim) keeps the POSIX path unchanged.
|
|
15
|
+
*/
|
|
16
|
+
export interface OpenTarget {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
/** A stable icon key the UI maps to a concrete icon component (#361). Optional so an older
|
|
20
|
+
* server talking to a newer client (or vice versa) just falls back to a generic icon —
|
|
21
|
+
* never a protocol break. */
|
|
22
|
+
icon?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Is `bin` (with a directly-spawnable Windows suffix under win32/WSL interop) on PATH?
|
|
25
|
+
* Returns the exact resolved name (which may carry the suffix) — pure filesystem probe, no
|
|
26
|
+
* child process — or null. `.cmd`/`.bat` are intentionally excluded: modern Node refuses to
|
|
27
|
+
* spawn them directly, while launching them through a shell would reintroduce the BatBadBut
|
|
28
|
+
* command-injection surface fixed in #459. An unavailable target is safer than one the menu
|
|
29
|
+
* offers and then silently fails to open (#469 review).
|
|
30
|
+
*
|
|
31
|
+
* The optional environment arguments keep Windows/WSL suffix behavior testable on any host. */
|
|
32
|
+
export declare function resolveOnPath(bin: string, platform?: NodeJS.Platform, wsl?: boolean, searchPath?: string): string | null;
|
|
33
|
+
/** The runner behind a `cli:<runner>` open target, or null when the id isn't a CLI handoff. */
|
|
34
|
+
export declare function agentCliRunner(targetId: string): 'claude' | 'codex' | 'opencode' | null;
|
|
35
|
+
/** The open targets available on this machine: the file manager, a terminal, every detected
|
|
36
|
+
* editor, and every installed coding-agent CLI. Order is stable so the menu never reshuffles. */
|
|
37
|
+
export declare function detectOpenTargets(): OpenTarget[];
|
|
38
|
+
/** The (bin, args) a file-manager launch resolves to — pure so the per-platform routing
|
|
39
|
+
* (including the WSL→Explorer interop branch) is unit-testable without spawning anything.
|
|
40
|
+
* `platform`/`wsl` default to the real environment; tests pass them explicitly. */
|
|
41
|
+
export declare function fileManagerLaunch(dir: string, platform?: NodeJS.Platform, wsl?: boolean): {
|
|
42
|
+
bin: string;
|
|
43
|
+
args: string[];
|
|
44
|
+
};
|
|
45
|
+
/** Open `dir` in the given target. Unknown/unavailable target → false (the caller 409s). */
|
|
46
|
+
export declare function openInApp(targetId: string, dir: string): Promise<boolean>;
|
|
47
|
+
/** The path argument to hand a resolved binary: a Windows-suffixed name found through WSL
|
|
48
|
+
* interop needs the Windows-side path; a bare-name binary (native Linux, or a WSL-aware shim
|
|
49
|
+
* like VS Code's Remote-WSL `code`) takes the POSIX path unchanged. `wsl` defaults to the real
|
|
50
|
+
* environment; tests pass it explicitly so this needs no global platform stubbing. */
|
|
51
|
+
export declare function launchPathFor(resolvedBin: string, dir: string, wsl?: boolean): string;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { accessSync, constants, existsSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { openInTerminal } from './open-in-terminal.js';
|
|
6
|
+
import { isWsl, translateToWindowsPath } from './wsl.js';
|
|
7
|
+
const EDITORS = [
|
|
8
|
+
{ id: 'vscode', label: 'VS Code', icon: 'vscode', cli: 'code', mac: 'Visual Studio Code' },
|
|
9
|
+
{ id: 'cursor', label: 'Cursor', icon: 'cursor', cli: 'cursor', mac: 'Cursor' },
|
|
10
|
+
{ id: 'zed', label: 'Zed', icon: 'zed', cli: 'zed', mac: 'Zed' },
|
|
11
|
+
{ id: 'windsurf', label: 'Windsurf', icon: 'windsurf', cli: 'windsurf', mac: 'Windsurf' },
|
|
12
|
+
{ id: 'sublime', label: 'Sublime Text', icon: 'sublime', cli: 'subl', mac: 'Sublime Text' },
|
|
13
|
+
// JetBrains (#361 gap 3): Toolbox's "generate shell scripts" produces one bare-name launcher
|
|
14
|
+
// per product on every OS (idea, pycharm, …); the .app names below cover the Community /
|
|
15
|
+
// Ultimate / Professional edition splits Toolbox and the standalone installers both produce.
|
|
16
|
+
{ id: 'idea', label: 'IntelliJ IDEA', icon: 'idea', cli: 'idea', mac: ['IntelliJ IDEA', 'IntelliJ IDEA CE', 'IntelliJ IDEA Ultimate'] },
|
|
17
|
+
{ id: 'pycharm', label: 'PyCharm', icon: 'pycharm', cli: 'pycharm', mac: ['PyCharm', 'PyCharm CE', 'PyCharm Professional'] },
|
|
18
|
+
{ id: 'webstorm', label: 'WebStorm', icon: 'webstorm', cli: 'webstorm', mac: 'WebStorm' },
|
|
19
|
+
{ id: 'goland', label: 'GoLand', icon: 'goland', cli: 'goland', mac: 'GoLand' },
|
|
20
|
+
{ id: 'rubymine', label: 'RubyMine', icon: 'rubymine', cli: 'rubymine', mac: 'RubyMine' },
|
|
21
|
+
{ id: 'phpstorm', label: 'PhpStorm', icon: 'phpstorm', cli: 'phpstorm', mac: 'PhpStorm' },
|
|
22
|
+
{ id: 'clion', label: 'CLion', icon: 'clion', cli: 'clion', mac: 'CLion' },
|
|
23
|
+
{ id: 'rider', label: 'Rider', icon: 'rider', cli: 'rider', mac: 'Rider' },
|
|
24
|
+
{ id: 'android-studio', label: 'Android Studio', icon: 'android-studio', cli: 'studio', mac: 'Android Studio' },
|
|
25
|
+
{ id: 'xcode', label: 'Xcode', icon: 'xcode', mac: 'Xcode' },
|
|
26
|
+
{ id: 'warp', label: 'Warp', icon: 'warp', cli: 'warp', mac: 'Warp' },
|
|
27
|
+
];
|
|
28
|
+
const FILE_MANAGER_LABEL = process.platform === 'darwin' ? 'Finder' : process.platform === 'win32' || isWsl() ? 'Explorer' : 'Files';
|
|
29
|
+
/** Is `bin` (with a directly-spawnable Windows suffix under win32/WSL interop) on PATH?
|
|
30
|
+
* Returns the exact resolved name (which may carry the suffix) — pure filesystem probe, no
|
|
31
|
+
* child process — or null. `.cmd`/`.bat` are intentionally excluded: modern Node refuses to
|
|
32
|
+
* spawn them directly, while launching them through a shell would reintroduce the BatBadBut
|
|
33
|
+
* command-injection surface fixed in #459. An unavailable target is safer than one the menu
|
|
34
|
+
* offers and then silently fails to open (#469 review).
|
|
35
|
+
*
|
|
36
|
+
* The optional environment arguments keep Windows/WSL suffix behavior testable on any host. */
|
|
37
|
+
export function resolveOnPath(bin, platform = process.platform, wsl = isWsl(), searchPath = process.env.PATH ?? '') {
|
|
38
|
+
const dirs = searchPath.split(platform === 'win32' ? ';' : ':');
|
|
39
|
+
const suffixed = platform === 'win32' || wsl;
|
|
40
|
+
const names = suffixed ? [bin, `${bin}.com`, `${bin}.exe`] : [bin];
|
|
41
|
+
for (const dir of dirs) {
|
|
42
|
+
if (!dir)
|
|
43
|
+
continue;
|
|
44
|
+
for (const name of names) {
|
|
45
|
+
try {
|
|
46
|
+
accessSync(join(dir, name), constants.X_OK);
|
|
47
|
+
return name;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// keep looking
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function onPath(bin) {
|
|
57
|
+
return resolveOnPath(bin) !== null;
|
|
58
|
+
}
|
|
59
|
+
/** macOS: is any of `names` (`<name>.app`) installed in a standard Applications dir? */
|
|
60
|
+
function macAppExists(names) {
|
|
61
|
+
if (process.platform !== 'darwin')
|
|
62
|
+
return false;
|
|
63
|
+
const candidates = Array.isArray(names) ? names : [names];
|
|
64
|
+
return candidates.some((name) => [
|
|
65
|
+
`/Applications/${name}.app`,
|
|
66
|
+
join(homedir(), 'Applications', `${name}.app`),
|
|
67
|
+
`/System/Applications/${name}.app`,
|
|
68
|
+
].some((p) => existsSync(p)));
|
|
69
|
+
}
|
|
70
|
+
function editorAvailable(editor) {
|
|
71
|
+
if (editor.cli && onPath(editor.cli))
|
|
72
|
+
return true;
|
|
73
|
+
if (editor.mac && macAppExists(editor.mac))
|
|
74
|
+
return true;
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
/** Coding-agent CLIs a session can be handed off to (#cli-handoff). Selecting one opens a
|
|
78
|
+
* terminal that resumes THIS run's session when the runner matches, or launches a fresh CLI in
|
|
79
|
+
* the worktree otherwise. The actual command is built server-side (needs the run's session). */
|
|
80
|
+
const AGENT_CLIS = [
|
|
81
|
+
{ runner: 'claude', label: 'Claude CLI', icon: 'claude', bin: 'claude', envBin: process.env.CEZ_CLAUDE_BIN },
|
|
82
|
+
{ runner: 'codex', label: 'Codex CLI', icon: 'codex', bin: 'codex', envBin: process.env.CEZ_CODEX_BIN },
|
|
83
|
+
{ runner: 'opencode', label: 'OpenCode', icon: 'opencode', bin: 'opencode', envBin: process.env.CEZ_OPENCODE_BIN },
|
|
84
|
+
];
|
|
85
|
+
/** The runner behind a `cli:<runner>` open target, or null when the id isn't a CLI handoff. */
|
|
86
|
+
export function agentCliRunner(targetId) {
|
|
87
|
+
const match = AGENT_CLIS.find((c) => `cli:${c.runner}` === targetId);
|
|
88
|
+
return match ? match.runner : null;
|
|
89
|
+
}
|
|
90
|
+
/** The open targets available on this machine: the file manager, a terminal, every detected
|
|
91
|
+
* editor, and every installed coding-agent CLI. Order is stable so the menu never reshuffles. */
|
|
92
|
+
export function detectOpenTargets() {
|
|
93
|
+
const targets = [
|
|
94
|
+
{ id: 'finder', label: FILE_MANAGER_LABEL, icon: 'folder' },
|
|
95
|
+
{ id: 'terminal', label: 'Terminal', icon: 'terminal' },
|
|
96
|
+
];
|
|
97
|
+
for (const editor of EDITORS) {
|
|
98
|
+
if (editorAvailable(editor))
|
|
99
|
+
targets.push({ id: editor.id, label: editor.label, icon: editor.icon });
|
|
100
|
+
}
|
|
101
|
+
for (const cli of AGENT_CLIS) {
|
|
102
|
+
if ((cli.envBin && existsSync(cli.envBin)) || onPath(cli.bin)) {
|
|
103
|
+
targets.push({ id: `cli:${cli.runner}`, label: cli.label, icon: cli.icon });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return targets;
|
|
107
|
+
}
|
|
108
|
+
/** The (bin, args) a file-manager launch resolves to — pure so the per-platform routing
|
|
109
|
+
* (including the WSL→Explorer interop branch) is unit-testable without spawning anything.
|
|
110
|
+
* `platform`/`wsl` default to the real environment; tests pass them explicitly. */
|
|
111
|
+
export function fileManagerLaunch(dir, platform = process.platform, wsl = isWsl()) {
|
|
112
|
+
if (platform === 'darwin')
|
|
113
|
+
return { bin: 'open', args: [dir] };
|
|
114
|
+
if (platform === 'win32')
|
|
115
|
+
return { bin: 'explorer', args: [dir] };
|
|
116
|
+
if (wsl)
|
|
117
|
+
return { bin: 'explorer.exe', args: [translateToWindowsPath(dir)] };
|
|
118
|
+
return { bin: 'xdg-open', args: [dir] };
|
|
119
|
+
}
|
|
120
|
+
/** Open `dir` in the file manager, natively per platform. Under WSL there is no Linux desktop to
|
|
121
|
+
* hand `xdg-open` to — go through interop to Windows Explorer instead, translating the path. */
|
|
122
|
+
async function openFileManager(dir) {
|
|
123
|
+
const { bin, args } = fileManagerLaunch(dir);
|
|
124
|
+
return runDetached(bin, args);
|
|
125
|
+
}
|
|
126
|
+
/** Open `dir` in the given target. Unknown/unavailable target → false (the caller 409s). */
|
|
127
|
+
export async function openInApp(targetId, dir) {
|
|
128
|
+
if (targetId === 'finder')
|
|
129
|
+
return openFileManager(dir);
|
|
130
|
+
// A bare interactive shell at the worktree — `:` is a no-op so no command actually runs.
|
|
131
|
+
if (targetId === 'terminal')
|
|
132
|
+
return openInTerminal(dir, ':');
|
|
133
|
+
const editor = EDITORS.find((e) => e.id === targetId);
|
|
134
|
+
if (!editor)
|
|
135
|
+
return false;
|
|
136
|
+
if (editor.cli) {
|
|
137
|
+
const resolved = resolveOnPath(editor.cli);
|
|
138
|
+
if (resolved)
|
|
139
|
+
return runDetached(resolved, [launchPathFor(resolved, dir)]);
|
|
140
|
+
}
|
|
141
|
+
if (editor.mac && macAppExists(editor.mac))
|
|
142
|
+
return runDetached('open', ['-a', pickInstalledMacApp(editor.mac), dir]);
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
/** The path argument to hand a resolved binary: a Windows-suffixed name found through WSL
|
|
146
|
+
* interop needs the Windows-side path; a bare-name binary (native Linux, or a WSL-aware shim
|
|
147
|
+
* like VS Code's Remote-WSL `code`) takes the POSIX path unchanged. `wsl` defaults to the real
|
|
148
|
+
* environment; tests pass it explicitly so this needs no global platform stubbing. */
|
|
149
|
+
export function launchPathFor(resolvedBin, dir, wsl = isWsl()) {
|
|
150
|
+
if (wsl && /\.(com|exe)$/i.test(resolvedBin))
|
|
151
|
+
return translateToWindowsPath(dir);
|
|
152
|
+
return dir;
|
|
153
|
+
}
|
|
154
|
+
/** Which of an editor's candidate .app names is actually installed — `macAppExists` already
|
|
155
|
+
* confirmed at least one is, this just picks it for the `open -a` argument. */
|
|
156
|
+
function pickInstalledMacApp(names) {
|
|
157
|
+
const candidates = Array.isArray(names) ? names : [names];
|
|
158
|
+
return (candidates.find((name) => [
|
|
159
|
+
`/Applications/${name}.app`,
|
|
160
|
+
join(homedir(), 'Applications', `${name}.app`),
|
|
161
|
+
`/System/Applications/${name}.app`,
|
|
162
|
+
].some((p) => existsSync(p))) ?? candidates[0]);
|
|
163
|
+
}
|
|
164
|
+
/** Spawn detached; success = no error within a short settle window (mirrors open-in-terminal). */
|
|
165
|
+
function runDetached(bin, args) {
|
|
166
|
+
return new Promise((resolve) => {
|
|
167
|
+
let child;
|
|
168
|
+
try {
|
|
169
|
+
child = spawn(bin, args, { stdio: 'ignore', detached: true });
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
resolve(false);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
let settled = false;
|
|
176
|
+
const settle = (ok) => {
|
|
177
|
+
if (settled)
|
|
178
|
+
return;
|
|
179
|
+
settled = true;
|
|
180
|
+
resolve(ok);
|
|
181
|
+
};
|
|
182
|
+
child.once('error', () => settle(false));
|
|
183
|
+
setTimeout(() => {
|
|
184
|
+
child.unref();
|
|
185
|
+
settle(true);
|
|
186
|
+
}, 250);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=open-in-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-in-app.js","sourceRoot":"","sources":["../../src/server/open-in-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAuCzD,MAAM,OAAO,GAAgB;IAC3B,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,oBAAoB,EAAE;IAC1F,EAAE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,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,MAAM,GAAG,CAAC,EAAW,EAAE,EAAE;YAC7B,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,OAAO,CAAC,EAAE,CAAC,CAAC;QACd,CAAC,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACzC,UAAU,CAAC,GAAG,EAAE;YACd,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,MAAM,CAAC,IAAI,CAAC,CAAC;QACf,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open a real terminal window at `cwd` running `command` — the "take over the
|
|
3
|
+
* agent session locally" handoff. Cross-platform strategy ported from
|
|
4
|
+
* github-janitor's `openInTerminal.ts`: macOS via osascript, Windows via
|
|
5
|
+
* cmd/start, Linux by probing common emulators with a temp launch script
|
|
6
|
+
* (which sidesteps per-emulator quoting rules). WSL (#361) reuses the Linux
|
|
7
|
+
* script but hands it to a Windows-side terminal through interop, re-entering
|
|
8
|
+
* the distro with `wsl.exe` — there is no Linux desktop of its own to open
|
|
9
|
+
* `x-terminal-emulator` etc. on.
|
|
10
|
+
*
|
|
11
|
+
* Returns true when a launcher was started without an immediate error; the
|
|
12
|
+
* caller shows a copy-the-command fallback otherwise.
|
|
13
|
+
*/
|
|
14
|
+
export declare function openInTerminal(cwd: string, command: string): Promise<boolean>;
|
|
15
|
+
/** The Windows-side (bin, args) candidates for launching `scriptPath` inside `distro` through
|
|
16
|
+
* WSL interop, in try-order — Windows Terminal first, a classic console window as fallback. Pure
|
|
17
|
+
* (no spawning) so the exact command line is unit-testable without a real WSL host.
|
|
18
|
+
*
|
|
19
|
+
* Every launcher here is shell-free by construction, and must stay that way: routing through
|
|
20
|
+
* `cmd.exe` (`/c start …`) would reintroduce BatBadBut (CVE-2024-27980, see #459). Passing an
|
|
21
|
+
* argument array is NOT protection when the binary is a shell — libuv only quotes arguments
|
|
22
|
+
* containing space, tab or quote, so a space-free `distro` like `a&calc&` would reach `cmd`
|
|
23
|
+
* live and be interpreted. `wt.exe` and `conhost.exe` parse no metacharacters, so the same
|
|
24
|
+
* input is inert. `distro` is additionally validated at the source (`wslDistroName`). */
|
|
25
|
+
export declare function wslTerminalLaunchers(scriptPath: string, distro: string): Array<[string, string[]]>;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { chmodSync, mkdtempSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { isWsl, wslDistroName } from './wsl.js';
|
|
6
|
+
/**
|
|
7
|
+
* Open a real terminal window at `cwd` running `command` — the "take over the
|
|
8
|
+
* agent session locally" handoff. Cross-platform strategy ported from
|
|
9
|
+
* github-janitor's `openInTerminal.ts`: macOS via osascript, Windows via
|
|
10
|
+
* cmd/start, Linux by probing common emulators with a temp launch script
|
|
11
|
+
* (which sidesteps per-emulator quoting rules). WSL (#361) reuses the Linux
|
|
12
|
+
* script but hands it to a Windows-side terminal through interop, re-entering
|
|
13
|
+
* the distro with `wsl.exe` — there is no Linux desktop of its own to open
|
|
14
|
+
* `x-terminal-emulator` etc. on.
|
|
15
|
+
*
|
|
16
|
+
* Returns true when a launcher was started without an immediate error; the
|
|
17
|
+
* caller shows a copy-the-command fallback otherwise.
|
|
18
|
+
*/
|
|
19
|
+
export async function openInTerminal(cwd, command) {
|
|
20
|
+
if (process.platform === 'darwin') {
|
|
21
|
+
const script = `cd ${shellQuote(cwd)} && ${command}`;
|
|
22
|
+
return runDetached('osascript', [
|
|
23
|
+
'-e',
|
|
24
|
+
'tell application "Terminal" to activate',
|
|
25
|
+
'-e',
|
|
26
|
+
`tell application "Terminal" to do script ${appleScriptQuote(script)}`,
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
if (process.platform === 'win32') {
|
|
30
|
+
const inner = `cd /d "${cwd}" && ${command}`;
|
|
31
|
+
// Windows Terminal first, classic cmd window as fallback.
|
|
32
|
+
if (await runDetached('cmd', ['/c', 'start', '', 'wt', '-d', cwd, 'cmd', '/K', command])) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return runDetached('cmd', ['/c', 'start', '', 'cmd', '/K', inner]);
|
|
36
|
+
}
|
|
37
|
+
// Linux/other: a temp script avoids each emulator's own quoting rules.
|
|
38
|
+
const scriptPath = writeLaunchScript(cwd, command);
|
|
39
|
+
if (isWsl()) {
|
|
40
|
+
// No Linux GUI here — go through interop to a Windows terminal, which re-enters this same
|
|
41
|
+
// distro (`wsl.exe -d <distro>`) to run the script we just wrote. `scriptPath`/`cwd` stay
|
|
42
|
+
// POSIX: `wsl.exe` interprets its command line inside the distro, not on the Windows side.
|
|
43
|
+
for (const [bin, args] of wslTerminalLaunchers(scriptPath, wslDistroName())) {
|
|
44
|
+
if (await runDetached(bin, args))
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const candidates = [
|
|
50
|
+
['x-terminal-emulator', ['-e', scriptPath]],
|
|
51
|
+
['gnome-terminal', ['--', scriptPath]],
|
|
52
|
+
['konsole', ['-e', scriptPath]],
|
|
53
|
+
['wezterm', ['start', '--', scriptPath]],
|
|
54
|
+
['kitty', [scriptPath]],
|
|
55
|
+
['alacritty', ['-e', scriptPath]],
|
|
56
|
+
['xterm', ['-e', scriptPath]],
|
|
57
|
+
];
|
|
58
|
+
for (const [bin, args] of candidates) {
|
|
59
|
+
if (await runDetached(bin, args))
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
/** The Windows-side (bin, args) candidates for launching `scriptPath` inside `distro` through
|
|
65
|
+
* WSL interop, in try-order — Windows Terminal first, a classic console window as fallback. Pure
|
|
66
|
+
* (no spawning) so the exact command line is unit-testable without a real WSL host.
|
|
67
|
+
*
|
|
68
|
+
* Every launcher here is shell-free by construction, and must stay that way: routing through
|
|
69
|
+
* `cmd.exe` (`/c start …`) would reintroduce BatBadBut (CVE-2024-27980, see #459). Passing an
|
|
70
|
+
* argument array is NOT protection when the binary is a shell — libuv only quotes arguments
|
|
71
|
+
* containing space, tab or quote, so a space-free `distro` like `a&calc&` would reach `cmd`
|
|
72
|
+
* live and be interpreted. `wt.exe` and `conhost.exe` parse no metacharacters, so the same
|
|
73
|
+
* input is inert. `distro` is additionally validated at the source (`wslDistroName`). */
|
|
74
|
+
export function wslTerminalLaunchers(scriptPath, distro) {
|
|
75
|
+
return [
|
|
76
|
+
['wt.exe', ['wsl.exe', '-d', distro, '--', scriptPath]],
|
|
77
|
+
['conhost.exe', ['wsl.exe', '-d', distro, '--', scriptPath]],
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
/** Writes the temp launch script shared by the plain-Linux and WSL branches: `cd` into the
|
|
81
|
+
* worktree, run `command`, then drop into an interactive shell so the window stays open. */
|
|
82
|
+
function writeLaunchScript(cwd, command) {
|
|
83
|
+
const dir = mkdtempSync(join(tmpdir(), 'cez-term-'));
|
|
84
|
+
const scriptPath = join(dir, 'launch.sh');
|
|
85
|
+
writeFileSync(scriptPath, `#!/usr/bin/env bash\ncd ${shellQuote(cwd)}\n${command}\nexec bash\n`, 'utf8');
|
|
86
|
+
chmodSync(scriptPath, 0o755);
|
|
87
|
+
return scriptPath;
|
|
88
|
+
}
|
|
89
|
+
/** Spawn detached; success = no error within a short settle window. */
|
|
90
|
+
function runDetached(bin, args) {
|
|
91
|
+
return new Promise((resolve) => {
|
|
92
|
+
let child;
|
|
93
|
+
try {
|
|
94
|
+
child = spawn(bin, args, { stdio: 'ignore', detached: true });
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
resolve(false);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
let settled = false;
|
|
101
|
+
const settle = (ok) => {
|
|
102
|
+
if (settled)
|
|
103
|
+
return;
|
|
104
|
+
settled = true;
|
|
105
|
+
resolve(ok);
|
|
106
|
+
};
|
|
107
|
+
child.once('error', () => settle(false));
|
|
108
|
+
setTimeout(() => {
|
|
109
|
+
child.unref();
|
|
110
|
+
settle(true);
|
|
111
|
+
}, 250);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function shellQuote(s) {
|
|
115
|
+
return `'${s.replaceAll("'", `'\\''`)}'`;
|
|
116
|
+
}
|
|
117
|
+
function appleScriptQuote(s) {
|
|
118
|
+
return `"${s.replaceAll('\\', '\\\\').replaceAll('"', '\\"')}"`;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=open-in-terminal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-in-terminal.js","sourceRoot":"","sources":["../../src/server/open-in-terminal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAW,EAAE,OAAe;IAC/D,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,OAAO,OAAO,EAAE,CAAC;QACrD,OAAO,WAAW,CAAC,WAAW,EAAE;YAC9B,IAAI;YACJ,yCAAyC;YACzC,IAAI;YACJ,4CAA4C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,CAAC;YACH,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,KAAK,CAAC,CAAC;YACf,OAAO;QACT,CAAC;QACD,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,MAAM,GAAG,CAAC,EAAW,EAAE,EAAE;YAC7B,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,OAAO,CAAC,EAAE,CAAC,CAAC;QACd,CAAC,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACzC,UAAU,CAAC,GAAG,EAAE;YACd,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,MAAM,CAAC,IAAI,CAAC,CAAC;QACf,CAAC,EAAE,GAAG,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC;AAC3C,CAAC;AAED,SAAS,gBAAgB,CAAC,CAAS;IACjC,OAAO,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin delegate — draft-PR creation (review gate, spec 009) moved behind the
|
|
3
|
+
* forge-driver seam (`src/server/forge/github.ts`, cockpit-ui redesign spec
|
|
4
|
+
* §"Forge-driver seam"). Kept so existing imports keep working.
|
|
5
|
+
*/
|
|
6
|
+
export { buildPrBody, createDraftPr } from './forge/github.js';
|
|
7
|
+
export type { DraftPrInput, DraftPrOutcome } from './forge/types.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin delegate — draft-PR creation (review gate, spec 009) moved behind the
|
|
3
|
+
* forge-driver seam (`src/server/forge/github.ts`, cockpit-ui redesign spec
|
|
4
|
+
* §"Forge-driver seam"). Kept so existing imports keep working.
|
|
5
|
+
*/
|
|
6
|
+
export { buildPrBody, createDraftPr } from './forge/github.js';
|
|
7
|
+
//# sourceMappingURL=pr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr.js","sourceRoot":"","sources":["../../src/server/pr.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import { type ServerType } from '@hono/node-server';
|
|
3
|
+
import type { RunRecord, RunStatus, RunStore } from '../runs/store.js';
|
|
4
|
+
import type { RunManager } from '../workflows/run.js';
|
|
5
|
+
export interface ServerDeps {
|
|
6
|
+
repoRoot: string;
|
|
7
|
+
store: RunStore;
|
|
8
|
+
manager: RunManager;
|
|
9
|
+
version: string;
|
|
10
|
+
/** Mutable holder for the async npm-registry update check (#368) —
|
|
11
|
+
* `latest` appears once the registry answers with a newer version. */
|
|
12
|
+
update?: {
|
|
13
|
+
latest?: string;
|
|
14
|
+
};
|
|
15
|
+
/** Host the HTTP server binds (default 127.0.0.1). A non-loopback host
|
|
16
|
+
* implies hosted mode — `capabilities.localHandoff:false`. */
|
|
17
|
+
bindHost?: string;
|
|
18
|
+
}
|
|
19
|
+
/** One column of `GET /api/groups/:groupId`. NOTE: `diffStat` here is the raw
|
|
20
|
+
* `git diff --stat` text (worktreeDiffStat), NOT the numeric `RunRecord.diffStat`. */
|
|
21
|
+
export interface GroupVariant {
|
|
22
|
+
id: string;
|
|
23
|
+
variant: string;
|
|
24
|
+
title: string;
|
|
25
|
+
status: RunStatus;
|
|
26
|
+
archived: boolean;
|
|
27
|
+
tokensUsed: number;
|
|
28
|
+
costUsd?: number;
|
|
29
|
+
diffStat: string;
|
|
30
|
+
handoffExcerpt: string;
|
|
31
|
+
}
|
|
32
|
+
export interface GroupResponse {
|
|
33
|
+
groupId: string;
|
|
34
|
+
runs: GroupVariant[];
|
|
35
|
+
}
|
|
36
|
+
/** `POST /api/groups/:groupId/pick` — the winner, parked at `review` when it has a diff. */
|
|
37
|
+
export interface PickVariantResponse {
|
|
38
|
+
winner?: RunRecord;
|
|
39
|
+
}
|
|
40
|
+
export declare function createApp(deps: ServerDeps): Hono;
|
|
41
|
+
export declare function startServer(deps: ServerDeps, port: number): ServerType;
|