@yorz/cli 0.5.2 → 0.6.0
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/dist/cli/index.js +104 -14
- package/dist/gui/assets/{abnfDiagram-VRR7QNED-DhLcjtGN.js → abnfDiagram-VRR7QNED-CpQSXKD3.js} +1 -1
- package/dist/gui/assets/{arc-BL0qZm8w.js → arc-BFSj3oux.js} +1 -1
- package/dist/gui/assets/{architectureDiagram-ZJ3FMSHR-CWjMvcMF.js → architectureDiagram-ZJ3FMSHR-DUUbTneR.js} +1 -1
- package/dist/gui/assets/{blockDiagram-677ZJIJ3-Uz7zEOKL.js → blockDiagram-677ZJIJ3-b_cB7_jE.js} +1 -1
- package/dist/gui/assets/{c4Diagram-LMCZKHZV-BvZ1lBzh.js → c4Diagram-LMCZKHZV-BW2WDVS6.js} +1 -1
- package/dist/gui/assets/channel-ChMv_4IC.js +1 -0
- package/dist/gui/assets/{chunk-2Q5K7J3B-BbQyCdmr.js → chunk-2Q5K7J3B-DBPdFkwf.js} +1 -1
- package/dist/gui/assets/{chunk-32BRIVSS-Ds1IHaZm.js → chunk-32BRIVSS-DIbss3Mf.js} +1 -1
- package/dist/gui/assets/{chunk-5VM5RSS4-D9JdEyHt.js → chunk-5VM5RSS4-iGPM2FiL.js} +1 -1
- package/dist/gui/assets/{chunk-EX3LRPZG-oX3EhQot.js → chunk-EX3LRPZG-CFO6icXh.js} +1 -1
- package/dist/gui/assets/{chunk-JWPE2WC7-BbYRospG.js → chunk-JWPE2WC7-BoSzxOe1.js} +1 -1
- package/dist/gui/assets/{chunk-MOJQB5TN-_7tOgu0t.js → chunk-MOJQB5TN-DenA9g0A.js} +1 -1
- package/dist/gui/assets/{chunk-RYQCIY6F-BFRq_dy8.js → chunk-RYQCIY6F-6OVqI5Jh.js} +1 -1
- package/dist/gui/assets/{chunk-V7JOEXUC-DaT-HFaL.js → chunk-V7JOEXUC-CwTJoQCL.js} +1 -1
- package/dist/gui/assets/{chunk-VR4S4FIN-B-e98k7C.js → chunk-VR4S4FIN-D1Hv1RW-.js} +1 -1
- package/dist/gui/assets/{chunk-XXDRQBXY-RIATjTXU.js → chunk-XXDRQBXY-5jwTXqEl.js} +1 -1
- package/dist/gui/assets/classDiagram-OUVF2IWQ-YMNyCLvX.js +1 -0
- package/dist/gui/assets/classDiagram-v2-EOCWNBFH-YMNyCLvX.js +1 -0
- package/dist/gui/assets/{cose-bilkent-JH36ORCC-DNBPTk-r.js → cose-bilkent-JH36ORCC-Cc8VWY9x.js} +1 -1
- package/dist/gui/assets/{cynefin-VYW2F7L2-BQXFmXSG.js → cynefin-VYW2F7L2-BXFPytZ_.js} +1 -1
- package/dist/gui/assets/{cynefinDiagram-TSTJHNR4-BjRZryO9.js → cynefinDiagram-TSTJHNR4-WZDfGA2i.js} +1 -1
- package/dist/gui/assets/{dagre-VKFMJZFB-iYsJkVs4.js → dagre-VKFMJZFB-Dip6iJOF.js} +1 -1
- package/dist/gui/assets/{diagram-FQU43EPY-BhNypTaO.js → diagram-FQU43EPY-CFLYoHwF.js} +1 -1
- package/dist/gui/assets/{diagram-G47NLZAW-Cf0W_-2H.js → diagram-G47NLZAW-BswWoT3h.js} +1 -1
- package/dist/gui/assets/{diagram-NH7WQ7WH-B_FprRMM.js → diagram-NH7WQ7WH-BizhF8Pc.js} +1 -1
- package/dist/gui/assets/{diagram-OA4YK3LP-CumfdhaI.js → diagram-OA4YK3LP-BckN9mPI.js} +1 -1
- package/dist/gui/assets/{diagram-WEI45ONY-LqS6bbEJ.js → diagram-WEI45ONY-ht6wkF4x.js} +1 -1
- package/dist/gui/assets/{ebnfDiagram-CCIWWBDH-C0VU_mlO.js → ebnfDiagram-CCIWWBDH-DyVIzHp5.js} +1 -1
- package/dist/gui/assets/{erDiagram-Q63AITRT-Dv5O47LN.js → erDiagram-Q63AITRT-DRFWvAAm.js} +1 -1
- package/dist/gui/assets/{flowDiagram-23GEKE2U-DtKrQdQs.js → flowDiagram-23GEKE2U-CiBwda7G.js} +1 -1
- package/dist/gui/assets/{ganttDiagram-NO4QXBWP-DriDYXqA.js → ganttDiagram-NO4QXBWP-vRQNKo6Y.js} +1 -1
- package/dist/gui/assets/{gitGraphDiagram-IHSO6WYX-BdKJo-ZF.js → gitGraphDiagram-IHSO6WYX-BYCaD1Fo.js} +1 -1
- package/dist/gui/assets/index-Dwx7eFhj.css +1 -0
- package/dist/gui/assets/index-DzV2HQw-.js +36 -0
- package/dist/gui/assets/{infoDiagram-FWYZ7A6U-CIiOkocS.js → infoDiagram-FWYZ7A6U-1Y32iWPH.js} +1 -1
- package/dist/gui/assets/{ishikawaDiagram-FXEZZL3T-DPIQoqmt.js → ishikawaDiagram-FXEZZL3T-BQDQ7prq.js} +1 -1
- package/dist/gui/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/gui/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/gui/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dist/gui/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/dist/gui/assets/jetbrains-mono-latin-700-normal-BYuf6tUa.woff2 +0 -0
- package/dist/gui/assets/jetbrains-mono-latin-700-normal-D3wTyLJW.woff +0 -0
- package/dist/gui/assets/{journeyDiagram-5HDEW3XC-U4jmPfY2.js → journeyDiagram-5HDEW3XC-DSWI24Bt.js} +1 -1
- package/dist/gui/assets/{kanban-definition-HUTT4EX6-IyRTaw34.js → kanban-definition-HUTT4EX6-fiE0W_uC.js} +1 -1
- package/dist/gui/assets/{linear-CBAHw7_a.js → linear-DqWevqMh.js} +1 -1
- package/dist/gui/assets/{mermaid.core-DZkDfFY_.js → mermaid.core-bsNbTKFB.js} +4 -4
- package/dist/gui/assets/{mindmap-definition-LN4V7U3C-bL7Ll4F2.js → mindmap-definition-LN4V7U3C-DnUeh13j.js} +1 -1
- package/dist/gui/assets/{pegDiagram-2B236MQR-BpsIcyGU.js → pegDiagram-2B236MQR-DE_8gOxy.js} +1 -1
- package/dist/gui/assets/{pieDiagram-ENE6RG2P-CCmNCxks.js → pieDiagram-ENE6RG2P-Wf_jl50X.js} +1 -1
- package/dist/gui/assets/{quadrantDiagram-ABIIQ3AL-Bob4IJnj.js → quadrantDiagram-ABIIQ3AL-Dt-Yn4ZI.js} +1 -1
- package/dist/gui/assets/{railroadDiagram-RFXS5EU6-HuVPehU_.js → railroadDiagram-RFXS5EU6-0I6kqmlH.js} +1 -1
- package/dist/gui/assets/{requirementDiagram-TGXJPOKE-DEfnUjAp.js → requirementDiagram-TGXJPOKE-Dozq39w_.js} +1 -1
- package/dist/gui/assets/{sankeyDiagram-HTMAVEWB-DrFCyp3y.js → sankeyDiagram-HTMAVEWB-Cs7yO0KJ.js} +1 -1
- package/dist/gui/assets/{sequenceDiagram-DBY2YBRQ-DpdcL9St.js → sequenceDiagram-DBY2YBRQ-EQLpVCpV.js} +1 -1
- package/dist/gui/assets/{sizeCapture-X5ZJPWSS-C_Jr0rzu.js → sizeCapture-X5ZJPWSS-BXUb6X9N.js} +1 -1
- package/dist/gui/assets/{stateDiagram-2N3HPSRC-BMvSL0gZ.js → stateDiagram-2N3HPSRC-CYHgCnOc.js} +1 -1
- package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-CqWHqtRs.js +1 -0
- package/dist/gui/assets/{swimlanes-5IMT3BWC-B8vajQdN.js → swimlanes-5IMT3BWC-BgsUQUHx.js} +2 -2
- package/dist/gui/assets/swimlanesDiagram-G3AALYLV-CoZVjlW6.js +8 -0
- package/dist/gui/assets/{timeline-definition-FHXFAJF6-BYPr5oRM.js → timeline-definition-FHXFAJF6-CQJufImP.js} +1 -1
- package/dist/gui/assets/{vennDiagram-L72KCM5P-Zxsd6OOL.js → vennDiagram-L72KCM5P-L-2iYmD5.js} +1 -1
- package/dist/gui/assets/{wardleyDiagram-EHGQE667-5hM1OnjP.js → wardleyDiagram-EHGQE667-BamRRrE7.js} +1 -1
- package/dist/gui/assets/{xychartDiagram-FW5EYKEG-pkI7p278.js → xychartDiagram-FW5EYKEG-itKwurP4.js} +1 -1
- package/dist/gui/index.html +26 -3
- package/package.json +3 -2
- package/dist/gui/assets/channel-DXW7D-GH.js +0 -1
- package/dist/gui/assets/classDiagram-OUVF2IWQ-CemKJkww.js +0 -1
- package/dist/gui/assets/classDiagram-v2-EOCWNBFH-CemKJkww.js +0 -1
- package/dist/gui/assets/index-BhiRKuE5.js +0 -36
- package/dist/gui/assets/index-CWpwy2sQ.css +0 -1
- package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-Ce8AqLzK.js +0 -1
- package/dist/gui/assets/swimlanesDiagram-G3AALYLV-XWsxZefl.js +0 -8
package/dist/cli/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import { join, isAbsolute, resolve, basename as basename$1, dirname, extname, se
|
|
|
6
6
|
import { createHash, randomUUID, randomBytes } from "node:crypto";
|
|
7
7
|
import { existsSync, openSync, closeSync, statSync, readSync, mkdirSync, watch, createReadStream } from "node:fs";
|
|
8
8
|
import { spawn, execFile } from "node:child_process";
|
|
9
|
+
import { promisify } from "node:util";
|
|
9
10
|
import { serve } from "@hono/node-server";
|
|
10
11
|
import { Hono } from "hono";
|
|
11
|
-
import { promisify } from "node:util";
|
|
12
12
|
import { streamSSE } from "hono/streaming";
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
14
|
import trash from "trash";
|
|
@@ -22,7 +22,7 @@ import { createOpencode } from "@opencode-ai/sdk";
|
|
|
22
22
|
import { createInterface as createInterface$1 } from "node:readline/promises";
|
|
23
23
|
import MarkdownIt from "markdown-it";
|
|
24
24
|
const name = "@yorz/cli";
|
|
25
|
-
const version = "0.
|
|
25
|
+
const version = "0.6.0";
|
|
26
26
|
const type = "module";
|
|
27
27
|
const description = "";
|
|
28
28
|
const bin = { "yorz": "./dist/cli/index.js" };
|
|
@@ -33,9 +33,9 @@ const license = "LGPL-3.0-or-later";
|
|
|
33
33
|
const repository = { "type": "git", "url": "git+https://github.com/hughfenghen/YorZ.git" };
|
|
34
34
|
const homepage = "https://github.com/hughfenghen/YorZ#readme";
|
|
35
35
|
const publishConfig = { "access": "public" };
|
|
36
|
-
const scripts = { "build": "pnpm run build:cli && pnpm run build:gui", "build:cli": "vite build", "build:gui": "vite build --config vite.gui.config.ts", "dev:cli": "pnpm run build:cli && node dist/cli/index.js serve --port 7424 --foreground", "dev:gui": "vite --config vite.gui.config.ts", "typecheck": "tsc -b", "test": "vitest run", "test:agent": "node scripts/test-agent.mjs", "test:e2e": "playwright test", "format": 'prettier --write "src/**/*.{ts,tsx,md,css}"', "prepublishOnly": "pnpm run build" };
|
|
36
|
+
const scripts = { "build": "pnpm run build:cli && pnpm run build:gui", "build:cli": "vite build", "build:gui": "vite build --config vite.gui.config.ts", "dev:cli": "pnpm run build:cli && node dist/cli/index.js serve --port 7424 --foreground", "dev:gui": "vite --config vite.gui.config.ts", "typecheck": "tsc -b", "test": "vitest run", "test:agent": "node scripts/test-agent.mjs", "test:e2e": "pnpm run build && playwright test", "format": 'prettier --write "src/**/*.{ts,tsx,md,css}"', "prepublishOnly": "pnpm run build" };
|
|
37
37
|
const dependencies = { "@anthropic-ai/claude-agent-sdk": "^0.3.207", "@hono/node-server": "^2.0.4", "@openai/codex-sdk": "^0.144.1", "@opencode-ai/sdk": "^1.17.18", "chokidar": "^5.0.0", "commander": "^12.1.0", "gray-matter": "^4.0.3", "hono": "^4.12.25", "jsdom": "^25.0.1", "markdown-it": "^14.2.0", "mermaid": "^11.0.0", "morphdom": "^2.7.8", "timeago.js": "^4.0.2", "trash": "^10.1.1" };
|
|
38
|
-
const devDependencies = { "@kobalte/core": "^0.13.12", "@playwright/test": "^1.61.0", "@solidjs/router": "^0.16.1", "@types/jsdom": "^21.1.7", "@types/markdown-it": "^14.1.2", "@types/node": "^22.10.0", "autoprefixer": "^10.5.2", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "concurrently": "^9.1.0", "highlight.js": "^11.11.1", "i18next": "^26.3.6", "i18next-browser-languagedetector": "^8.2.1", "lucide-solid": "^1.24.0", "markdown-it-task-lists": "^2.1.1", "postcss": "^8.5.16", "prettier": "^3.4.0", "solid-js": "^1.9.13", "tailwind-merge": "^3.6.0", "tailwindcss": "^3.4.19", "tailwindcss-animate": "^1.0.7", "typescript": "^5.7.0", "vite": "^6.0.0", "vite-plugin-solid": "^2.11.12", "vitest": "^2.1.0" };
|
|
38
|
+
const devDependencies = { "@fontsource/jetbrains-mono": "^5.3.0", "@kobalte/core": "^0.13.12", "@playwright/test": "^1.61.0", "@solidjs/router": "^0.16.1", "@types/jsdom": "^21.1.7", "@types/markdown-it": "^14.1.2", "@types/node": "^22.10.0", "autoprefixer": "^10.5.2", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "concurrently": "^9.1.0", "highlight.js": "^11.11.1", "i18next": "^26.3.6", "i18next-browser-languagedetector": "^8.2.1", "lucide-solid": "^1.24.0", "markdown-it-task-lists": "^2.1.1", "postcss": "^8.5.16", "prettier": "^3.4.0", "solid-js": "^1.9.13", "tailwind-merge": "^3.6.0", "tailwindcss": "^3.4.19", "tailwindcss-animate": "^1.0.7", "typescript": "^5.7.0", "vite": "^6.0.0", "vite-plugin-solid": "^2.11.12", "vitest": "^2.1.0" };
|
|
39
39
|
const pkg = {
|
|
40
40
|
name,
|
|
41
41
|
version,
|
|
@@ -6603,6 +6603,7 @@ function installGlobalErrorHandlers() {
|
|
|
6603
6603
|
});
|
|
6604
6604
|
}
|
|
6605
6605
|
const log = () => getLogger().child("serve");
|
|
6606
|
+
const execFileAsync = promisify(execFile);
|
|
6606
6607
|
function silenceConsoleMirror() {
|
|
6607
6608
|
configureLogger({ mirrorConsole: false });
|
|
6608
6609
|
}
|
|
@@ -6637,11 +6638,15 @@ async function runServe(opts) {
|
|
|
6637
6638
|
noRegisterCwd: opts.noRegisterCwd
|
|
6638
6639
|
});
|
|
6639
6640
|
if (opts.recordRuntime) {
|
|
6641
|
+
const snapshot = await readProcessSnapshot(process.pid);
|
|
6640
6642
|
await upsertProcess({
|
|
6641
6643
|
pid: process.pid,
|
|
6642
6644
|
port: handle.port,
|
|
6643
6645
|
url: handle.url,
|
|
6644
|
-
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6646
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6647
|
+
execPath: process.execPath,
|
|
6648
|
+
argv: process.argv,
|
|
6649
|
+
processStartedAt: snapshot?.processStartedAt
|
|
6645
6650
|
});
|
|
6646
6651
|
console.log(`Stop with: yorz serve stop`);
|
|
6647
6652
|
} else {
|
|
@@ -6777,12 +6782,19 @@ async function runStopServe() {
|
|
|
6777
6782
|
message: "YorZ Service is not running."
|
|
6778
6783
|
};
|
|
6779
6784
|
}
|
|
6780
|
-
const
|
|
6781
|
-
|
|
6785
|
+
const checks = await Promise.all(
|
|
6786
|
+
all.map(async (proc) => ({ proc, snapshot: await readProcessSnapshot(proc.pid) }))
|
|
6787
|
+
);
|
|
6788
|
+
const alive = checks.filter(
|
|
6789
|
+
(check) => check.snapshot && isStoppableYorzProcess(check.proc, check.snapshot)
|
|
6790
|
+
);
|
|
6791
|
+
const dead = checks.filter(
|
|
6792
|
+
(check) => !check.snapshot || !isStoppableYorzProcess(check.proc, check.snapshot)
|
|
6793
|
+
);
|
|
6782
6794
|
if (alive.length === 0) {
|
|
6783
6795
|
await removeRuntime();
|
|
6784
|
-
log().warn("cleared stale runtime records", { pids: dead.map((p) => p.pid) });
|
|
6785
|
-
const deadPidList = dead.map((p) => `pid=${p.pid}`).join(", ");
|
|
6796
|
+
log().warn("cleared stale runtime records", { pids: dead.map((p) => p.proc.pid) });
|
|
6797
|
+
const deadPidList = dead.map((p) => `pid=${p.proc.pid}`).join(", ");
|
|
6786
6798
|
return {
|
|
6787
6799
|
stopped: false,
|
|
6788
6800
|
stoppedPids: [],
|
|
@@ -6793,7 +6805,7 @@ async function runStopServe() {
|
|
|
6793
6805
|
const stoppedPids = [];
|
|
6794
6806
|
const stoppedUrls = [];
|
|
6795
6807
|
const failedPids = [];
|
|
6796
|
-
for (const proc of alive) {
|
|
6808
|
+
for (const { proc } of alive) {
|
|
6797
6809
|
try {
|
|
6798
6810
|
process.kill(proc.pid, "SIGTERM");
|
|
6799
6811
|
log().info("sent SIGTERM", { pid: proc.pid, url: proc.url });
|
|
@@ -6888,8 +6900,13 @@ async function waitForRuntime(pid, timeoutMs) {
|
|
|
6888
6900
|
async function readLiveProcesses() {
|
|
6889
6901
|
const all = await readAllProcesses();
|
|
6890
6902
|
if (all.length === 0) return [];
|
|
6891
|
-
const
|
|
6892
|
-
|
|
6903
|
+
const checks = await Promise.all(
|
|
6904
|
+
all.map(async (proc) => ({ proc, snapshot: await readProcessSnapshot(proc.pid) }))
|
|
6905
|
+
);
|
|
6906
|
+
const alive = checks.filter((check) => check.snapshot && isStoppableYorzProcess(check.proc, check.snapshot)).map((check) => check.proc);
|
|
6907
|
+
const dead = checks.filter(
|
|
6908
|
+
(check) => !check.snapshot || !isStoppableYorzProcess(check.proc, check.snapshot)
|
|
6909
|
+
);
|
|
6893
6910
|
if (dead.length > 0) {
|
|
6894
6911
|
if (alive.length === 0) {
|
|
6895
6912
|
await removeRuntime();
|
|
@@ -6927,7 +6944,10 @@ function toProcessEntry(obj) {
|
|
|
6927
6944
|
pid: obj.pid,
|
|
6928
6945
|
port: obj.port,
|
|
6929
6946
|
url: obj.url,
|
|
6930
|
-
startedAt: obj.startedAt
|
|
6947
|
+
startedAt: obj.startedAt,
|
|
6948
|
+
execPath: typeof obj.execPath === "string" ? obj.execPath : void 0,
|
|
6949
|
+
argv: Array.isArray(obj.argv) && obj.argv.every((v) => typeof v === "string") ? obj.argv : void 0,
|
|
6950
|
+
processStartedAt: typeof obj.processStartedAt === "string" ? obj.processStartedAt : void 0
|
|
6931
6951
|
};
|
|
6932
6952
|
}
|
|
6933
6953
|
function tryV1Entry(parsed) {
|
|
@@ -6938,7 +6958,10 @@ function tryV1Entry(parsed) {
|
|
|
6938
6958
|
pid: parsed.pid,
|
|
6939
6959
|
port: parsed.port,
|
|
6940
6960
|
url: parsed.url,
|
|
6941
|
-
startedAt: parsed.startedAt
|
|
6961
|
+
startedAt: parsed.startedAt,
|
|
6962
|
+
execPath: typeof parsed.execPath === "string" ? parsed.execPath : void 0,
|
|
6963
|
+
argv: Array.isArray(parsed.argv) && parsed.argv.every((v) => typeof v === "string") ? parsed.argv : void 0,
|
|
6964
|
+
processStartedAt: typeof parsed.processStartedAt === "string" ? parsed.processStartedAt : void 0
|
|
6942
6965
|
};
|
|
6943
6966
|
}
|
|
6944
6967
|
async function upsertProcess(entry) {
|
|
@@ -6975,6 +6998,73 @@ function isProcessAlive(pid) {
|
|
|
6975
6998
|
return false;
|
|
6976
6999
|
}
|
|
6977
7000
|
}
|
|
7001
|
+
function isStoppableYorzProcess(entry, snapshot) {
|
|
7002
|
+
if (!hasRuntimeIdentity(entry)) return true;
|
|
7003
|
+
return isTrustedYorzProcess(entry, snapshot);
|
|
7004
|
+
}
|
|
7005
|
+
function hasRuntimeIdentity(entry) {
|
|
7006
|
+
return Boolean(entry.execPath || entry.argv || entry.processStartedAt);
|
|
7007
|
+
}
|
|
7008
|
+
function isTrustedYorzProcess(entry, snapshot) {
|
|
7009
|
+
if (!entry.processStartedAt || snapshot.processStartedAt !== entry.processStartedAt) return false;
|
|
7010
|
+
if (!entry.execPath || !entry.argv) return false;
|
|
7011
|
+
const required = [
|
|
7012
|
+
entry.execPath,
|
|
7013
|
+
entry.argv[1],
|
|
7014
|
+
"serve",
|
|
7015
|
+
"--foreground",
|
|
7016
|
+
"--record-runtime"
|
|
7017
|
+
].filter((arg) => typeof arg === "string" && arg.length > 0);
|
|
7018
|
+
const commandMatches = required.every((arg) => snapshot.commandLine.includes(arg));
|
|
7019
|
+
return commandMatches;
|
|
7020
|
+
}
|
|
7021
|
+
async function readProcessSnapshot(pid) {
|
|
7022
|
+
if (!isProcessAlive(pid)) return null;
|
|
7023
|
+
if (process.platform === "win32") return readWindowsProcessSnapshot(pid);
|
|
7024
|
+
return readPosixProcessSnapshot(pid);
|
|
7025
|
+
}
|
|
7026
|
+
async function readPosixProcessSnapshot(pid) {
|
|
7027
|
+
try {
|
|
7028
|
+
const { stdout } = await execFileAsync("ps", [
|
|
7029
|
+
"-ww",
|
|
7030
|
+
"-p",
|
|
7031
|
+
String(pid),
|
|
7032
|
+
"-o",
|
|
7033
|
+
"lstart=",
|
|
7034
|
+
"-o",
|
|
7035
|
+
"command="
|
|
7036
|
+
]);
|
|
7037
|
+
const line = stdout.trim();
|
|
7038
|
+
if (!line) return null;
|
|
7039
|
+
const parts = line.match(/^(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)\s+([\s\S]+)$/);
|
|
7040
|
+
if (!parts) return { commandLine: line };
|
|
7041
|
+
return { processStartedAt: parts[1], commandLine: parts[2] };
|
|
7042
|
+
} catch {
|
|
7043
|
+
return null;
|
|
7044
|
+
}
|
|
7045
|
+
}
|
|
7046
|
+
async function readWindowsProcessSnapshot(pid) {
|
|
7047
|
+
try {
|
|
7048
|
+
const script = [
|
|
7049
|
+
`$p = Get-CimInstance Win32_Process -Filter "ProcessId = ${pid}"`,
|
|
7050
|
+
"if ($null -eq $p) { exit 1 }",
|
|
7051
|
+
"$p | Select-Object CommandLine,CreationDate | ConvertTo-Json -Compress"
|
|
7052
|
+
].join("; ");
|
|
7053
|
+
const { stdout } = await execFileAsync("powershell.exe", [
|
|
7054
|
+
"-NoProfile",
|
|
7055
|
+
"-NonInteractive",
|
|
7056
|
+
"-Command",
|
|
7057
|
+
script
|
|
7058
|
+
]);
|
|
7059
|
+
const parsed = JSON.parse(stdout.trim());
|
|
7060
|
+
const commandLine = typeof parsed.CommandLine === "string" ? parsed.CommandLine : "";
|
|
7061
|
+
const processStartedAt = typeof parsed.CreationDate === "string" ? parsed.CreationDate : void 0;
|
|
7062
|
+
if (!commandLine) return null;
|
|
7063
|
+
return { commandLine, processStartedAt };
|
|
7064
|
+
} catch {
|
|
7065
|
+
return null;
|
|
7066
|
+
}
|
|
7067
|
+
}
|
|
6978
7068
|
async function waitForProcessExit(pid, timeoutMs) {
|
|
6979
7069
|
const until = Date.now() + timeoutMs;
|
|
6980
7070
|
while (Date.now() < until) {
|
package/dist/gui/assets/{abnfDiagram-VRR7QNED-DhLcjtGN.js → abnfDiagram-VRR7QNED-CpQSXKD3.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-DenA9g0A.js";import{p as f}from"./chunk-JWPE2WC7-BoSzxOe1.js";import{_ as n,l as o}from"./mermaid.core-bsNbTKFB.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-BXFPytZ_.js";import"./index-DzV2HQw-.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Y as ln,$ as an,a0 as F,a1 as q,a2 as j,a3 as un,a4 as y,a5 as tn,a6 as J,a7 as _,a8 as rn,a9 as o,aa as on,ab as sn,ac as fn}from"./mermaid.core-
|
|
1
|
+
import{Y as ln,$ as an,a0 as F,a1 as q,a2 as j,a3 as un,a4 as y,a5 as tn,a6 as J,a7 as _,a8 as rn,a9 as o,aa as on,ab as sn,ac as fn}from"./mermaid.core-bsNbTKFB.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,z,a){var O=I-l,i=D-h,n=z-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function U(l,h,I,D,v,A,z){var a=l-I,O=h-D,i=(z?A:-A)/J(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,B=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*J(on(0,T*T*R-P*P)),Y=(P*g-m*S)/R,$=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=Y-B,e=$-t,r=w-B,C=p-t;return x*x+e*e>r*r+C*C&&(Y=w,$=p),{cx:Y,cy:$,x01:-n,y01:-d,x11:Y*(v/T-1),y11:$*(v/T-1)}}function hn(){var l=cn,h=yn,I=j(0),D=null,v=gn,A=dn,z=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,B=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(B>tn-y)a.moveTo(s*F(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*F(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=B,S=B,Y=z.apply(this,arguments)/2,$=Y>y&&(D?+D.apply(this,arguments):J(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if($>y){var C=sn($/u*q(Y)),K=sn($/s*q(Y));(P-=C*2)>y?(C*=t?1:-1,R+=C,T-=C):(P=0,R=T=(f+c)/2),(S-=K*2)>y?(K*=t?1:-1,m+=K,g-=K):(S=0,m=g=(f+c)/2)}var G=s*F(m),H=s*q(m),L=u*F(T),M=u*q(T);if(w>y){var N=s*F(g),Q=s*q(g),V=u*F(R),W=u*q(R),E;if(B<an)if(E=pn(G,H,V,W,N,Q,L,M)){var X=G-E[0],Z=H-E[1],b=N-E[0],k=Q-E[1],nn=1/q(fn((X*b+Z*k)/(J(X*X+Z*Z)*J(b*b+k*k)))/2),en=J(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=U(V,W,G,H,s,x,t),r=U(N,Q,L,M,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(G,H),a.arc(0,0,s,m,g,!t)):a.moveTo(G,H),!(u>y)||!(P>y)?a.lineTo(L,M):p>y?(e=U(L,M,N,Q,u,-p,t),r=U(G,H,V,W,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[F(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:j(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:j(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:j(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:j(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:j(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:j(+n),i):A},i.padAngle=function(n){return arguments.length?(z=typeof n=="function"?n:j(+n),i):z},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|