@modootoday/pmcp 0.22.4 → 0.22.6
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/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.mcp.json +1 -1
- package/dist/{apply-D2VIRMFY.js → apply-IQU3K5TB.js} +13 -13
- package/dist/{chunk-CPFJ7J4G.js → chunk-3HEYCZFZ.js} +5 -5
- package/dist/{chunk-RRPNPZ6I.js → chunk-42SO7KYX.js} +2 -2
- package/dist/chunk-4EQIZQX2.js +7 -0
- package/dist/{chunk-3IX5TBRW.js → chunk-5JWCGSZD.js} +2 -2
- package/dist/{chunk-FE7WOHZM.js → chunk-7CSUKCU7.js} +2 -2
- package/dist/{chunk-NDY3T7Z4.js → chunk-AOHHCYRF.js} +12 -12
- package/dist/{chunk-G7JONWL4.js → chunk-B3OZ4GGO.js} +13 -1
- package/dist/{chunk-PFHSFYQB.js → chunk-CLE6VHO6.js} +2 -2
- package/dist/{chunk-JONJ75SF.js → chunk-E4X6GSNI.js} +5 -5
- package/dist/{chunk-TAVFL3YB.js → chunk-G6QFWOLV.js} +2 -2
- package/dist/{chunk-W4W3EHQP.js → chunk-GSU22DYJ.js} +2 -2
- package/dist/{chunk-MIIGZRVC.js → chunk-H4Z2AIXM.js} +2 -2
- package/dist/{chunk-H45C5W2P.js → chunk-JN7TRPFB.js} +2 -2
- package/dist/{chunk-QUBU3ETR.js → chunk-JUEMDWWJ.js} +4 -4
- package/dist/{chunk-MTVRKWQI.js → chunk-KFMHTOSI.js} +3 -3
- package/dist/{chunk-F34XIDXT.js → chunk-KTANZVAJ.js} +2 -2
- package/dist/{chunk-P6LNYYYH.js → chunk-M6X6HVQK.js} +2 -2
- package/dist/{chunk-2A3F7ID4.js → chunk-PCSE36BM.js} +85 -11
- package/dist/{chunk-7XK2KWLJ.js → chunk-PX4FWUEN.js} +3 -3
- package/dist/{chunk-T7SLHAHQ.js → chunk-RZNZKI5A.js} +2 -2
- package/dist/{chunk-JJT5XRMV.js → chunk-SLL5FSDI.js} +2 -2
- package/dist/{chunk-2Q6MNGU5.js → chunk-SUDG7B6S.js} +2 -2
- package/dist/{chunk-5KA3RS5Y.js → chunk-TBVQ7SM7.js} +2 -2
- package/dist/{chunk-KR6PFEWU.js → chunk-TPTKRLI7.js} +3 -3
- package/dist/{chunk-FFCDSSKA.js → chunk-WV3YP35O.js} +7 -7
- package/dist/{cli-VCKKTXUU.js → cli-DYVNJYZ7.js} +8 -8
- package/dist/cli.js +3 -3
- package/dist/{completion-AAEBLVVB.js → completion-ORGJMKIY.js} +2 -2
- package/dist/{diagnostics-3XI6SJXF.js → diagnostics-TLKMQGMH.js} +5 -5
- package/dist/{doctor-GAJKPOKS.js → doctor-27ZFI6JY.js} +15 -15
- package/dist/{entry-GZCLQTIN.js → entry-T3HFGNC2.js} +9 -9
- package/dist/{exec-mcp-3V34UNPH.js → exec-mcp-IZYZI2KM.js} +11 -11
- package/dist/{harness-YH6U6MNV.js → harness-DSB275UL.js} +3 -3
- package/dist/harness-launch-gate.js +3 -3
- package/dist/harness-worker.js +5 -5
- package/dist/hook-body.js +139 -57
- package/dist/{hooks-JWB7D4ZB.js → hooks-UN4LMHZW.js} +3 -3
- package/dist/{host-DLBXM72V.js → host-5M4RWFKB.js} +6 -6
- package/dist/{host-LNH3TUR5.js → host-X4WU2J3Z.js} +13 -13
- package/dist/{host-run-FVO5PZK2.js → host-run-A64IXBGN.js} +4 -4
- package/dist/http.js +1 -1
- package/dist/{import-mcp-O553FGF3.js → import-mcp-PYX5OKQQ.js} +10 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -14
- package/dist/{init-A6AAIGJU.js → init-QUN7QS2K.js} +2 -2
- package/dist/{invoke-GDELKQCE.js → invoke-FGOUHWVB.js} +7 -7
- package/dist/{list-CQ4CPNWI.js → list-5YUAOTM7.js} +12 -12
- package/dist/{logout-TG32MVMB.js → logout-PAODLQ5M.js} +11 -11
- package/dist/{mainline-FMZ44NFC.js → mainline-CRL5B3X3.js} +25 -7
- package/dist/{mcp-UYQVTWEF.js → mcp-WUUKG3JV.js} +2 -2
- package/dist/{modes-COBVV7RA.js → modes-SEINLLMK.js} +3 -3
- package/dist/{project-NOTN6SMK.js → project-HY6O6DZQ.js} +4 -4
- package/dist/{run-77MDEDAX.js → run-55L6MVBR.js} +10 -10
- package/dist/{run-S5M6ZUUH.js → run-ZLIZZC2I.js} +4 -4
- package/dist/{serve-YNHUW5PQ.js → serve-HKBA6OSF.js} +3 -3
- package/dist/{setup-HYEYYVDU.js → setup-SOUBEZ3H.js} +4 -4
- package/dist/{start-login-SWQVPQG3.js → start-login-VRH4OLKM.js} +11 -11
- package/dist/{status-YPFUSE7K.js → status-6JX7PKQ3.js} +11 -11
- package/dist/{status-NGO7AC3U.js → status-CZG6ZPUG.js} +12 -12
- package/dist/stdio.js +2 -2
- package/dist/{test-2UYV4LSU.js → test-22FIZGYO.js} +11 -11
- package/dist/{tui-ZKP3D5JM.js → tui-JUEU727K.js} +4 -4
- package/dist/{worker-7OBOBMWM.js → worker-T7ERD4L7.js} +7 -7
- package/dist/{worktree-create-NO4UOOEP.js → worktree-create-KMXPQXIQ.js} +2 -2
- package/dist/{worktree-list-6CCHXXOZ.js → worktree-list-WH6OX6U7.js} +4 -4
- package/dist/{worktree-sync-5ZVA5PUC.js → worktree-sync-VWNOJD63.js} +5 -5
- package/docs/git-workflow.md +7 -0
- package/gemini-extension.json +2 -2
- package/mcp.json +1 -1
- package/package.json +5 -5
- package/plugin.json +1 -1
- package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
- package/plugins/pmcp/.mcp.json +1 -1
- package/plugins/pmcp/gemini-extension.json +2 -2
- package/plugins/pmcp/mcp.json +1 -1
- package/plugins/pmcp/plugin.json +1 -1
- package/dist/chunk-HOTGJQIV.js +0 -7
package/dist/hook-body.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/hooks/entry.ts
|
|
2
|
-
import { dirname as
|
|
2
|
+
import { dirname as dirname13, resolve as resolve20 } from "node:path";
|
|
3
3
|
|
|
4
4
|
// src/hooks/contract.ts
|
|
5
5
|
var NEUTRAL_EVENTS = [
|
|
@@ -2897,6 +2897,17 @@ function git(cwd, args, extra) {
|
|
|
2897
2897
|
const stderr = run3.stderr || run3.error?.message || "";
|
|
2898
2898
|
return { status: run3.status ?? 1, stdout: run3.stdout ?? "", stderr };
|
|
2899
2899
|
}
|
|
2900
|
+
function gitWithInput(cwd, args, input) {
|
|
2901
|
+
const run3 = spawnSync("git", args, {
|
|
2902
|
+
cwd,
|
|
2903
|
+
encoding: "utf8",
|
|
2904
|
+
env: cleanEnv(),
|
|
2905
|
+
input,
|
|
2906
|
+
maxBuffer: 256 * 1024 * 1024
|
|
2907
|
+
});
|
|
2908
|
+
const stderr = run3.stderr || run3.error?.message || "";
|
|
2909
|
+
return { status: run3.status ?? 1, stdout: run3.stdout ?? "", stderr };
|
|
2910
|
+
}
|
|
2900
2911
|
function gitText(cwd, args) {
|
|
2901
2912
|
const run3 = git(cwd, args);
|
|
2902
2913
|
if (run3.status !== 0) return "";
|
|
@@ -3296,8 +3307,75 @@ function distance(cwd, upstream) {
|
|
|
3296
3307
|
return { behind, ahead };
|
|
3297
3308
|
}
|
|
3298
3309
|
|
|
3310
|
+
// src/git/added-submodules.ts
|
|
3311
|
+
import { dirname as dirname7, join as join9 } from "node:path";
|
|
3312
|
+
var ADDED_GITLINK = /^:\d{6} 160000 [0-9a-f]{40} ([0-9a-f]{40}) [AT]\t(.+)$/u;
|
|
3313
|
+
function initAddedSubmodules(root, from, to) {
|
|
3314
|
+
const raw = gitText(root, [
|
|
3315
|
+
"diff",
|
|
3316
|
+
"--raw",
|
|
3317
|
+
"--abbrev=40",
|
|
3318
|
+
"--no-renames",
|
|
3319
|
+
from,
|
|
3320
|
+
to
|
|
3321
|
+
]);
|
|
3322
|
+
const lines = [];
|
|
3323
|
+
for (const entry of raw.split("\n")) {
|
|
3324
|
+
const added = ADDED_GITLINK.exec(entry);
|
|
3325
|
+
if (!added) continue;
|
|
3326
|
+
const [, pin = "", path = ""] = added;
|
|
3327
|
+
lines.push(`${path}: ${initOne(root, path, pin)}`);
|
|
3328
|
+
}
|
|
3329
|
+
return lines;
|
|
3330
|
+
}
|
|
3331
|
+
function initOne(root, path, pin) {
|
|
3332
|
+
const dir = join9(root, path);
|
|
3333
|
+
if (existsSync(join9(dir, ".git"))) return "already checked out";
|
|
3334
|
+
let displaced = "";
|
|
3335
|
+
if (existsSync(dir) && readdirSync(dir).length > 0) {
|
|
3336
|
+
if (unignoredFiles(root, path).length > 0)
|
|
3337
|
+
return `new submodule not checked out: ${path} holds files git does not ignore; move them aside, then git submodule update --init ${path}`;
|
|
3338
|
+
displaced = displace(root, path);
|
|
3339
|
+
}
|
|
3340
|
+
const done = git(root, ["submodule", "update", "--init", "-q", "--", path]);
|
|
3341
|
+
const aside = displaced ? `; its ignored files from before are in ${displaced}, so run the install again` : "";
|
|
3342
|
+
if (done.status !== 0)
|
|
3343
|
+
return `new submodule not checked out: ${done.stderr.trim()}${aside}`;
|
|
3344
|
+
return `new submodule checked out at ${pin.slice(0, 10)}${aside}`;
|
|
3345
|
+
}
|
|
3346
|
+
function unignoredFiles(root, path) {
|
|
3347
|
+
const kept = [];
|
|
3348
|
+
let level = [path];
|
|
3349
|
+
while (level.length > 0) {
|
|
3350
|
+
const entries = level.flatMap(
|
|
3351
|
+
(dir) => readdirSync(join9(root, dir), { withFileTypes: true }).map((entry) => ({
|
|
3352
|
+
path: `${dir}/${entry.name}`,
|
|
3353
|
+
dir: entry.isDirectory()
|
|
3354
|
+
}))
|
|
3355
|
+
);
|
|
3356
|
+
const checked = gitWithInput(
|
|
3357
|
+
root,
|
|
3358
|
+
["check-ignore", "--no-index", "--stdin", "-z"],
|
|
3359
|
+
entries.map((entry) => `${entry.path}\0`).join("")
|
|
3360
|
+
);
|
|
3361
|
+
const ignored = new Set(checked.stdout.split("\0").filter(Boolean));
|
|
3362
|
+
const open2 = entries.filter((entry) => !ignored.has(entry.path));
|
|
3363
|
+
kept.push(...open2.filter((entry) => !entry.dir).map((entry) => entry.path));
|
|
3364
|
+
level = open2.filter((entry) => entry.dir).map((entry) => entry.path);
|
|
3365
|
+
}
|
|
3366
|
+
return kept;
|
|
3367
|
+
}
|
|
3368
|
+
function displace(root, path) {
|
|
3369
|
+
const gitDir = gitText(root, ["rev-parse", "--absolute-git-dir"]);
|
|
3370
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/gu, "-");
|
|
3371
|
+
const target = join9(gitDir, "pmcp-displaced", stamp, path);
|
|
3372
|
+
mkdirSync(dirname7(target), { recursive: true });
|
|
3373
|
+
renameSync(join9(root, path), target);
|
|
3374
|
+
return target;
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3299
3377
|
// src/git/submodules.ts
|
|
3300
|
-
import { join as
|
|
3378
|
+
import { join as join10 } from "node:path";
|
|
3301
3379
|
function clean(dir) {
|
|
3302
3380
|
return git(dir, ["status", "--porcelain"]).stdout.trim() === "";
|
|
3303
3381
|
}
|
|
@@ -3307,8 +3385,8 @@ function hasCommit(dir, sha) {
|
|
|
3307
3385
|
function movableSubmodules(root) {
|
|
3308
3386
|
const listed = git(root, ["submodule", "status"]).stdout;
|
|
3309
3387
|
return listed.split("\n").filter((line) => /^[ +]/u.test(line)).map((line) => line.trim().split(/\s+/u)[1] ?? "").filter((path) => {
|
|
3310
|
-
const dir =
|
|
3311
|
-
if (!path || !existsSync(
|
|
3388
|
+
const dir = join10(root, path);
|
|
3389
|
+
if (!path || !existsSync(join10(dir, ".git"))) return false;
|
|
3312
3390
|
const local = gitText(dir, [
|
|
3313
3391
|
"rev-list",
|
|
3314
3392
|
"--count",
|
|
@@ -3323,7 +3401,7 @@ function updateToPins(root, paths) {
|
|
|
3323
3401
|
const lines = [];
|
|
3324
3402
|
for (const path of paths) {
|
|
3325
3403
|
const pin = gitText(root, ["rev-parse", `HEAD:${path}`]);
|
|
3326
|
-
const dir =
|
|
3404
|
+
const dir = join10(root, path);
|
|
3327
3405
|
if (!pin || !hasCommit(dir, pin)) {
|
|
3328
3406
|
lines.push(
|
|
3329
3407
|
`${path}: left alone, ${pin.slice(0, 10) || "its pin"} is not in its checkout`
|
|
@@ -3405,6 +3483,10 @@ function syncOnce(options2) {
|
|
|
3405
3483
|
`moved ${before2.slice(0, 10)} -> ${after.slice(0, 10)}, ${counted.behind} commit(s)`
|
|
3406
3484
|
);
|
|
3407
3485
|
for (const line of updateToPins(ctx.root, submodules)) report2.info(line);
|
|
3486
|
+
if (options2.followSubmodules) {
|
|
3487
|
+
for (const line of initAddedSubmodules(ctx.root, before2, after))
|
|
3488
|
+
report2.info(line);
|
|
3489
|
+
}
|
|
3408
3490
|
if (options2.umask !== void 0)
|
|
3409
3491
|
reportModes(report2, [
|
|
3410
3492
|
...restoreModes(ctx.root, before2, after),
|
|
@@ -5182,18 +5264,18 @@ async function dispatch(raw, compiled, deps) {
|
|
|
5182
5264
|
}
|
|
5183
5265
|
|
|
5184
5266
|
// src/hooks/entry/fail-closed.ts
|
|
5185
|
-
import { join as
|
|
5267
|
+
import { join as join13 } from "node:path";
|
|
5186
5268
|
|
|
5187
5269
|
// src/hooks/compiled.ts
|
|
5188
|
-
import { join as
|
|
5270
|
+
import { join as join12 } from "node:path";
|
|
5189
5271
|
|
|
5190
5272
|
// src/hooks/integrity-cache.ts
|
|
5191
5273
|
import { homedir as homedir2 } from "node:os";
|
|
5192
|
-
import { dirname as
|
|
5274
|
+
import { dirname as dirname8, join as join11 } from "node:path";
|
|
5193
5275
|
var LIMIT = 64;
|
|
5194
5276
|
function cacheFile() {
|
|
5195
|
-
const base = process.env["XDG_CACHE_HOME"] ||
|
|
5196
|
-
return
|
|
5277
|
+
const base = process.env["XDG_CACHE_HOME"] || join11(homedir2(), ".cache");
|
|
5278
|
+
return join11(base, "pmcp", "hook-verified.json");
|
|
5197
5279
|
}
|
|
5198
5280
|
function readCache() {
|
|
5199
5281
|
try {
|
|
@@ -5224,7 +5306,7 @@ function rememberVerified(key, stamp, sha) {
|
|
|
5224
5306
|
[key, { stamp, sha }]
|
|
5225
5307
|
]);
|
|
5226
5308
|
const file2 = cacheFile();
|
|
5227
|
-
mkdirSync(
|
|
5309
|
+
mkdirSync(dirname8(file2), { recursive: true });
|
|
5228
5310
|
const temporary = `${file2}.${process.pid}.tmp`;
|
|
5229
5311
|
writeFileSync(temporary, JSON.stringify(cache), { mode: 384 });
|
|
5230
5312
|
renameSync(temporary, file2);
|
|
@@ -5263,8 +5345,8 @@ function readLockFile(path) {
|
|
|
5263
5345
|
}
|
|
5264
5346
|
}
|
|
5265
5347
|
function readCompiled(root) {
|
|
5266
|
-
const policyPath =
|
|
5267
|
-
const files2 = [policyPath,
|
|
5348
|
+
const policyPath = join12(root, POLICY_FILE);
|
|
5349
|
+
const files2 = [policyPath, join12(root, LOCK_FILE)];
|
|
5268
5350
|
const before2 = stampOf(files2);
|
|
5269
5351
|
const text9 = readFileSync(policyPath, "utf8");
|
|
5270
5352
|
const lock = readLockFile(files2[1]);
|
|
@@ -5287,7 +5369,7 @@ function readCompiled(root) {
|
|
|
5287
5369
|
var FAILED_CLOSED = "pmcp hook could not evaluate this call and refused it";
|
|
5288
5370
|
function rawFailure(root) {
|
|
5289
5371
|
try {
|
|
5290
|
-
const raw = JSON.parse(readFileSync(
|
|
5372
|
+
const raw = JSON.parse(readFileSync(join13(root, POLICY_FILE), "utf8"))["failure"];
|
|
5291
5373
|
if (!raw || typeof raw.timeoutMs !== "number" || typeof raw.retry !== "number" || !Array.isArray(raw.pass) || !raw.pass.every(
|
|
5292
5374
|
(kind) => PASS_KINDS.includes(kind)
|
|
5293
5375
|
))
|
|
@@ -5322,7 +5404,7 @@ function failClosed(adapter, event, root, error, stated = false) {
|
|
|
5322
5404
|
}
|
|
5323
5405
|
|
|
5324
5406
|
// src/hooks/entry/lock-repair.ts
|
|
5325
|
-
import { join as
|
|
5407
|
+
import { join as join14, resolve as resolve19 } from "node:path";
|
|
5326
5408
|
var REV = String.raw`[\w./~^@{}-]+`;
|
|
5327
5409
|
var LOCK = String.raw`(?:\./)?pmcp\.lock`;
|
|
5328
5410
|
var REPAIRS = [
|
|
@@ -5341,7 +5423,7 @@ function repairsLock(input, root) {
|
|
|
5341
5423
|
if (!tool) return false;
|
|
5342
5424
|
if (tool.kind === "read") return true;
|
|
5343
5425
|
if (tool.kind === "edit") {
|
|
5344
|
-
const lock =
|
|
5426
|
+
const lock = join14(root, LOCK_FILE);
|
|
5345
5427
|
return tool.paths.length > 0 && tool.paths.every((path) => resolve19(input.cwd, path) === lock);
|
|
5346
5428
|
}
|
|
5347
5429
|
if (tool.kind === "shell") {
|
|
@@ -5362,7 +5444,7 @@ function lockRepair(adapter, event, root, input, error) {
|
|
|
5362
5444
|
}
|
|
5363
5445
|
|
|
5364
5446
|
// src/hooks/entry/logger.ts
|
|
5365
|
-
import { dirname as
|
|
5447
|
+
import { dirname as dirname9, join as join17 } from "node:path";
|
|
5366
5448
|
|
|
5367
5449
|
// src/logging/levels.ts
|
|
5368
5450
|
var LEVEL_RANK = {
|
|
@@ -5486,11 +5568,11 @@ var silentLogger = createLogger(() => {
|
|
|
5486
5568
|
});
|
|
5487
5569
|
|
|
5488
5570
|
// src/logging/sinks/file.ts
|
|
5489
|
-
import { join as
|
|
5571
|
+
import { join as join15 } from "node:path";
|
|
5490
5572
|
var FILE = /^pmcp-(\d{8})(?:\.\d+)?\.jsonl$/u;
|
|
5491
5573
|
function dailyLogFile(dir, now = /* @__PURE__ */ new Date()) {
|
|
5492
5574
|
const day = now.toISOString().slice(0, 10).replaceAll("-", "");
|
|
5493
|
-
return
|
|
5575
|
+
return join15(dir, `pmcp-${day}.jsonl`);
|
|
5494
5576
|
}
|
|
5495
5577
|
function roll(file2) {
|
|
5496
5578
|
let index = 1;
|
|
@@ -5521,7 +5603,7 @@ function logFiles(dir) {
|
|
|
5521
5603
|
const part = (name) => Number(/\.(\d+)\.jsonl$/u.exec(name)?.[1] ?? Number.MAX_SAFE_INTEGER);
|
|
5522
5604
|
return names3.sort(
|
|
5523
5605
|
(a, b) => a.slice(5, 13).localeCompare(b.slice(5, 13)) || part(a) - part(b)
|
|
5524
|
-
).map((name) =>
|
|
5606
|
+
).map((name) => join15(dir, name));
|
|
5525
5607
|
}
|
|
5526
5608
|
function pruneLogs(dir, keepDays, now = /* @__PURE__ */ new Date()) {
|
|
5527
5609
|
const cutoff = new Date(now.getTime() - keepDays * 864e5).toISOString().slice(0, 10).replaceAll("-", "");
|
|
@@ -5537,13 +5619,13 @@ function pruneLogs(dir, keepDays, now = /* @__PURE__ */ new Date()) {
|
|
|
5537
5619
|
|
|
5538
5620
|
// src/sessions/state-dir.ts
|
|
5539
5621
|
import { homedir as homedir3 } from "node:os";
|
|
5540
|
-
import { join as
|
|
5622
|
+
import { join as join16 } from "node:path";
|
|
5541
5623
|
function projectStateDir(root, override, env = process.env) {
|
|
5542
5624
|
if (override) return expandPath(root, override);
|
|
5543
5625
|
const anchor = gitCommonDir(root) ?? realpathSync(root);
|
|
5544
5626
|
const id = createHash("sha256").update(anchor).digest("hex").slice(0, 16);
|
|
5545
|
-
const base = env["XDG_STATE_HOME"] ||
|
|
5546
|
-
return
|
|
5627
|
+
const base = env["XDG_STATE_HOME"] || join16(homedir3(), ".local", "state");
|
|
5628
|
+
return join16(base, "pmcp", "projects", id);
|
|
5547
5629
|
}
|
|
5548
5630
|
|
|
5549
5631
|
// src/hooks/entry/logger.ts
|
|
@@ -5558,7 +5640,7 @@ function hookLogger(root, compiled, runtime2, event) {
|
|
|
5558
5640
|
process.env["PMCP_LOG"]
|
|
5559
5641
|
);
|
|
5560
5642
|
const file2 = compiled?.logFile ? expandPath(root, compiled.logFile) : void 0;
|
|
5561
|
-
const dir = file2 ?
|
|
5643
|
+
const dir = file2 ? dirname9(file2) : join17(projectStateDir(root, compiled?.stateDir), "logs");
|
|
5562
5644
|
const sink = fileSink({
|
|
5563
5645
|
dir,
|
|
5564
5646
|
...file2 ? { file: file2 } : {},
|
|
@@ -5574,18 +5656,18 @@ function hookLogger(root, compiled, runtime2, event) {
|
|
|
5574
5656
|
}
|
|
5575
5657
|
|
|
5576
5658
|
// src/hooks/entry/state-dir.ts
|
|
5577
|
-
import { join as
|
|
5659
|
+
import { join as join19 } from "node:path";
|
|
5578
5660
|
|
|
5579
5661
|
// src/sessions/lease-files.ts
|
|
5580
|
-
import { dirname as
|
|
5662
|
+
import { dirname as dirname10, isAbsolute as isAbsolute13, join as join18 } from "node:path";
|
|
5581
5663
|
var GATE_DIR = "${gate_dir}/";
|
|
5582
5664
|
function gateTree(root, stateDir, gate, env) {
|
|
5583
5665
|
const override = gate.treeEnv ? env[gate.treeEnv] : void 0;
|
|
5584
5666
|
if (override) return override;
|
|
5585
|
-
return gate.tree ? expandPath(root, gate.tree) :
|
|
5667
|
+
return gate.tree ? expandPath(root, gate.tree) : join18(stateDir, "gate", "tree");
|
|
5586
5668
|
}
|
|
5587
5669
|
function atGateDir(path, gateDir) {
|
|
5588
|
-
return path.startsWith(GATE_DIR) ?
|
|
5670
|
+
return path.startsWith(GATE_DIR) ? join18(gateDir, path.slice(GATE_DIR.length)) : path;
|
|
5589
5671
|
}
|
|
5590
5672
|
function resolvePauseFile(file2, gateDir) {
|
|
5591
5673
|
return file2 === void 0 ? void 0 : atGateDir(file2, gateDir);
|
|
@@ -5607,14 +5689,14 @@ function leaseFilesFor(root, stateDir, files2, gate, env) {
|
|
|
5607
5689
|
if (!files2 || Object.keys(files2).length === 0) return {};
|
|
5608
5690
|
return resolveLeaseFiles(
|
|
5609
5691
|
files2,
|
|
5610
|
-
|
|
5692
|
+
dirname10(gateTree(root, stateDir, gate ?? {}, env))
|
|
5611
5693
|
);
|
|
5612
5694
|
}
|
|
5613
5695
|
function pauseFileFor(root, stateDir, file2, gate, env) {
|
|
5614
5696
|
if (!file2) return void 0;
|
|
5615
5697
|
return resolvePauseFile(
|
|
5616
5698
|
file2,
|
|
5617
|
-
|
|
5699
|
+
dirname10(gateTree(root, stateDir, gate ?? {}, env))
|
|
5618
5700
|
);
|
|
5619
5701
|
}
|
|
5620
5702
|
|
|
@@ -5640,7 +5722,7 @@ function pauseFileAnswer(root) {
|
|
|
5640
5722
|
compiled?.sessions.gate,
|
|
5641
5723
|
process.env
|
|
5642
5724
|
);
|
|
5643
|
-
return `${file2 ??
|
|
5725
|
+
return `${file2 ?? join19(stateDir, STATE_FILES.pause)}
|
|
5644
5726
|
`;
|
|
5645
5727
|
}
|
|
5646
5728
|
|
|
@@ -5678,10 +5760,10 @@ var gitProbe = {
|
|
|
5678
5760
|
};
|
|
5679
5761
|
|
|
5680
5762
|
// src/sessions/files/broadcast.ts
|
|
5681
|
-
import { join as
|
|
5763
|
+
import { join as join20 } from "node:path";
|
|
5682
5764
|
|
|
5683
5765
|
// src/sessions/files/json.ts
|
|
5684
|
-
import { dirname as
|
|
5766
|
+
import { dirname as dirname11 } from "node:path";
|
|
5685
5767
|
function readJson3(path) {
|
|
5686
5768
|
try {
|
|
5687
5769
|
return JSON.parse(readFileSync(path, "utf8"));
|
|
@@ -5690,7 +5772,7 @@ function readJson3(path) {
|
|
|
5690
5772
|
}
|
|
5691
5773
|
}
|
|
5692
5774
|
function writeJson(path, value) {
|
|
5693
|
-
mkdirSync(
|
|
5775
|
+
mkdirSync(dirname11(path), { recursive: true, mode: 448 });
|
|
5694
5776
|
const temporary = `${path}.${process.pid}.tmp`;
|
|
5695
5777
|
writeFileSync(temporary, `${JSON.stringify(value, null, 2)}
|
|
5696
5778
|
`, {
|
|
@@ -5714,7 +5796,7 @@ function readLines(path) {
|
|
|
5714
5796
|
});
|
|
5715
5797
|
}
|
|
5716
5798
|
function writeLines(path, values) {
|
|
5717
|
-
mkdirSync(
|
|
5799
|
+
mkdirSync(dirname11(path), { recursive: true, mode: 448 });
|
|
5718
5800
|
writeFileSync(
|
|
5719
5801
|
path,
|
|
5720
5802
|
`${values.map((value) => JSON.stringify(value)).join("\n")}
|
|
@@ -5725,8 +5807,8 @@ function writeLines(path, values) {
|
|
|
5725
5807
|
|
|
5726
5808
|
// src/sessions/files/broadcast.ts
|
|
5727
5809
|
function filesBroadcast(dir, keep, registry2) {
|
|
5728
|
-
const latestPath =
|
|
5729
|
-
const historyPath =
|
|
5810
|
+
const latestPath = join20(dir, STATE_FILES.broadcast);
|
|
5811
|
+
const historyPath = join20(dir, STATE_FILES.history);
|
|
5730
5812
|
const list = () => {
|
|
5731
5813
|
const latest = asBroadcast(readJson3(latestPath));
|
|
5732
5814
|
if (!latest) return [];
|
|
@@ -5770,9 +5852,9 @@ function filesBroadcast(dir, keep, registry2) {
|
|
|
5770
5852
|
}
|
|
5771
5853
|
|
|
5772
5854
|
// src/sessions/files/leases.ts
|
|
5773
|
-
import { dirname as
|
|
5855
|
+
import { dirname as dirname12, join as join21 } from "node:path";
|
|
5774
5856
|
function filesLeases(dir, files2 = {}) {
|
|
5775
|
-
const leasePath = (name) => files2[name]?.file ??
|
|
5857
|
+
const leasePath = (name) => files2[name]?.file ?? join21(dir, leaseFile(name));
|
|
5776
5858
|
const read4 = (name) => {
|
|
5777
5859
|
const lease = asLease(readJson3(leasePath(name)));
|
|
5778
5860
|
if (!lease || !alive(lease.pid)) return null;
|
|
@@ -5792,7 +5874,7 @@ function filesLeases(dir, files2 = {}) {
|
|
|
5792
5874
|
...lease.cwd ? { cwd: lease.cwd } : {},
|
|
5793
5875
|
since: (/* @__PURE__ */ new Date()).toISOString()
|
|
5794
5876
|
};
|
|
5795
|
-
mkdirSync(
|
|
5877
|
+
mkdirSync(dirname12(path), { recursive: true });
|
|
5796
5878
|
const temp = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
5797
5879
|
writeFileSync(temp, `${JSON.stringify(record)}
|
|
5798
5880
|
`);
|
|
@@ -5822,28 +5904,28 @@ function filesLeases(dir, files2 = {}) {
|
|
|
5822
5904
|
}
|
|
5823
5905
|
|
|
5824
5906
|
// src/sessions/files/mailbox.ts
|
|
5825
|
-
import { join as
|
|
5907
|
+
import { join as join22 } from "node:path";
|
|
5826
5908
|
var ID = /^\d{13}-[0-9a-f]{8}$/u;
|
|
5827
5909
|
var SAFE_KEY = /^@?[\w.-]+$/u;
|
|
5828
5910
|
function filesMailbox(dir, settings) {
|
|
5829
|
-
const messages =
|
|
5830
|
-
const inbox =
|
|
5831
|
-
const pathOf = (id) =>
|
|
5911
|
+
const messages = join22(dir, "messages");
|
|
5912
|
+
const inbox = join22(dir, "inbox");
|
|
5913
|
+
const pathOf = (id) => join22(messages, `${id}.json`);
|
|
5832
5914
|
const marker = (key, id, kind) => {
|
|
5833
5915
|
if (!SAFE_KEY.test(key) || !ID.test(id))
|
|
5834
5916
|
throw new Error(`invalid mailbox key ${key} or id ${id}`);
|
|
5835
|
-
return
|
|
5917
|
+
return join22(inbox, key, `${id}.${kind}`);
|
|
5836
5918
|
};
|
|
5837
5919
|
const audit = (event, fields2) => {
|
|
5838
5920
|
if (!settings.audit) return;
|
|
5839
5921
|
const line = { at: (/* @__PURE__ */ new Date()).toISOString(), event, ...fields2 };
|
|
5840
|
-
appendFileSync(
|
|
5922
|
+
appendFileSync(join22(dir, "messages.jsonl"), `${JSON.stringify(line)}
|
|
5841
5923
|
`, {
|
|
5842
5924
|
mode: 384
|
|
5843
5925
|
});
|
|
5844
5926
|
};
|
|
5845
5927
|
const touch = (path) => {
|
|
5846
|
-
mkdirSync(
|
|
5928
|
+
mkdirSync(join22(path, ".."), { recursive: true, mode: 448 });
|
|
5847
5929
|
try {
|
|
5848
5930
|
writeFileSync(path, "", { flag: "wx", mode: 384 });
|
|
5849
5931
|
return true;
|
|
@@ -5860,7 +5942,7 @@ function filesMailbox(dir, settings) {
|
|
|
5860
5942
|
if (existsSync(inbox))
|
|
5861
5943
|
for (const key of readdirSync(inbox))
|
|
5862
5944
|
for (const kind of ["ack", "delivered"])
|
|
5863
|
-
rmSync(
|
|
5945
|
+
rmSync(join22(inbox, key, `${message.id}.${kind}`), { force: true });
|
|
5864
5946
|
audit(event, { id: message.id });
|
|
5865
5947
|
};
|
|
5866
5948
|
return {
|
|
@@ -5936,9 +6018,9 @@ function filesMailbox(dir, settings) {
|
|
|
5936
6018
|
}
|
|
5937
6019
|
|
|
5938
6020
|
// src/sessions/files/pause.ts
|
|
5939
|
-
import { join as
|
|
6021
|
+
import { join as join23 } from "node:path";
|
|
5940
6022
|
function filesPause(dir, file2) {
|
|
5941
|
-
const path = file2 ??
|
|
6023
|
+
const path = file2 ?? join23(dir, STATE_FILES.pause);
|
|
5942
6024
|
return {
|
|
5943
6025
|
read: () => asPause(readJson3(path)),
|
|
5944
6026
|
write(pause2) {
|
|
@@ -5956,12 +6038,12 @@ function filesPause(dir, file2) {
|
|
|
5956
6038
|
}
|
|
5957
6039
|
|
|
5958
6040
|
// src/sessions/files/registry.ts
|
|
5959
|
-
import { join as
|
|
6041
|
+
import { join as join24 } from "node:path";
|
|
5960
6042
|
var SESSION_ID = /^[A-Za-z0-9_-]{8,64}$/u;
|
|
5961
6043
|
function filesRegistry(dir, staleMs) {
|
|
5962
|
-
const records =
|
|
5963
|
-
const dirs = [records,
|
|
5964
|
-
const pathsOf = (session) => dirs.map((records2) =>
|
|
6044
|
+
const records = join24(dir, STATE_FILES.records);
|
|
6045
|
+
const dirs = [records, join24(dir, STATE_FILES.legacyRecords)];
|
|
6046
|
+
const pathsOf = (session) => dirs.map((records2) => join24(records2, `${session}.json`));
|
|
5965
6047
|
const get = (session) => {
|
|
5966
6048
|
if (!SESSION_ID.test(session)) return null;
|
|
5967
6049
|
return latestRecord(
|
|
@@ -5980,7 +6062,7 @@ function filesRegistry(dir, staleMs) {
|
|
|
5980
6062
|
for (const name of names3)
|
|
5981
6063
|
found.set(name, [
|
|
5982
6064
|
...found.get(name) ?? [],
|
|
5983
|
-
asRecord(readJson3(
|
|
6065
|
+
asRecord(readJson3(join24(folder, name)))
|
|
5984
6066
|
]);
|
|
5985
6067
|
}
|
|
5986
6068
|
return [...found.values()].map(latestRecord).filter((record) => record !== null).map((record) => ({ ...record, live: isLive(record, now, staleMs) }));
|
|
@@ -6007,7 +6089,7 @@ function filesRegistry(dir, staleMs) {
|
|
|
6007
6089
|
next["worktree"] = checkout?.root ?? "";
|
|
6008
6090
|
next["branch"] = checkout?.branch ?? "";
|
|
6009
6091
|
}
|
|
6010
|
-
writeJson(
|
|
6092
|
+
writeJson(join24(records, `${session}.json`), next);
|
|
6011
6093
|
return next;
|
|
6012
6094
|
},
|
|
6013
6095
|
sweep(now = Date.now()) {
|
|
@@ -6165,7 +6247,7 @@ var self = import.meta.filename;
|
|
|
6165
6247
|
if (process.argv[1] && resolve20(process.argv[1]) === self) {
|
|
6166
6248
|
process.exitCode = await main(
|
|
6167
6249
|
process.argv.slice(2),
|
|
6168
|
-
resolve20(
|
|
6250
|
+
resolve20(dirname13(self), "../..")
|
|
6169
6251
|
);
|
|
6170
6252
|
}
|
|
6171
6253
|
export {
|
|
@@ -11,8 +11,8 @@ async function run(context) {
|
|
|
11
11
|
const [verb = "list", ...extra] = context.args.positional;
|
|
12
12
|
const usage = "Use hooks list, hooks test or hooks report";
|
|
13
13
|
if (extra.length) throw new ArgumentError(usage);
|
|
14
|
-
if (verb === "list") return (await import("./list-
|
|
15
|
-
if (verb === "test") return (await import("./test-
|
|
14
|
+
if (verb === "list") return (await import("./list-5YUAOTM7.js")).run(context);
|
|
15
|
+
if (verb === "test") return (await import("./test-22FIZGYO.js")).run(context);
|
|
16
16
|
if (verb === "report")
|
|
17
17
|
return (await import("./report-ZHOHQ4PZ.js")).run(context);
|
|
18
18
|
throw new ArgumentError(usage);
|
|
@@ -21,4 +21,4 @@ var hooksCommand = { ...hooksSpec, run };
|
|
|
21
21
|
export {
|
|
22
22
|
hooksCommand
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=hooks-
|
|
24
|
+
//# sourceMappingURL=hooks-UN4LMHZW.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requireTerminal,
|
|
3
3
|
terminalSupport
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PX4FWUEN.js";
|
|
5
5
|
import "./chunk-5ZABTVSW.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-CLE6VHO6.js";
|
|
7
7
|
import "./chunk-LMT3PPXJ.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-GSU22DYJ.js";
|
|
9
9
|
import "./chunk-R2GPCZUX.js";
|
|
10
10
|
import "./chunk-34DECPVC.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-KTANZVAJ.js";
|
|
12
12
|
import "./chunk-NRBQK6UX.js";
|
|
13
13
|
import "./chunk-OEH47H6A.js";
|
|
14
14
|
import "./chunk-IJBSOWHK.js";
|
|
15
15
|
import "./chunk-XWLMZKH2.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-4EQIZQX2.js";
|
|
17
17
|
import "./chunk-GJXOFDJT.js";
|
|
18
18
|
import "./chunk-PMJG2CXF.js";
|
|
19
19
|
import "./chunk-J6KL3COD.js";
|
|
@@ -21,4 +21,4 @@ export {
|
|
|
21
21
|
requireTerminal,
|
|
22
22
|
terminalSupport
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=host-
|
|
24
|
+
//# sourceMappingURL=host-5M4RWFKB.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-F5XMGOOX.js";
|
|
5
5
|
import {
|
|
6
6
|
specFrom
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-G6QFWOLV.js";
|
|
8
8
|
import "./chunk-RPCIROW7.js";
|
|
9
9
|
import {
|
|
10
10
|
approvalDir,
|
|
@@ -12,24 +12,24 @@ import {
|
|
|
12
12
|
hostDigest,
|
|
13
13
|
projectedFiles,
|
|
14
14
|
writeApproval
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-5JWCGSZD.js";
|
|
16
|
+
import "./chunk-WV3YP35O.js";
|
|
17
17
|
import "./chunk-UKR64U7J.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-PCSE36BM.js";
|
|
19
|
+
import "./chunk-42SO7KYX.js";
|
|
20
20
|
import "./chunk-EATCUWGG.js";
|
|
21
21
|
import "./chunk-OFJIMBTL.js";
|
|
22
22
|
import "./chunk-LFFIQBNY.js";
|
|
23
23
|
import "./chunk-HQOB7OQS.js";
|
|
24
24
|
import "./chunk-73AKO4UL.js";
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-M6X6HVQK.js";
|
|
26
|
+
import "./chunk-7CSUKCU7.js";
|
|
27
|
+
import "./chunk-SUDG7B6S.js";
|
|
28
28
|
import "./chunk-7I7O7ZNT.js";
|
|
29
29
|
import {
|
|
30
30
|
ancestors
|
|
31
31
|
} from "./chunk-Z6WRFOFT.js";
|
|
32
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-B3OZ4GGO.js";
|
|
33
33
|
import "./chunk-Q5H3L6Y4.js";
|
|
34
34
|
import "./chunk-7DYWCQVB.js";
|
|
35
35
|
import {
|
|
@@ -38,12 +38,12 @@ import {
|
|
|
38
38
|
import "./chunk-V4NPDK6X.js";
|
|
39
39
|
import {
|
|
40
40
|
hostDoctor
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-KTANZVAJ.js";
|
|
42
42
|
import "./chunk-NRBQK6UX.js";
|
|
43
43
|
import "./chunk-OEH47H6A.js";
|
|
44
44
|
import "./chunk-IJBSOWHK.js";
|
|
45
45
|
import "./chunk-XWLMZKH2.js";
|
|
46
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-4EQIZQX2.js";
|
|
47
47
|
import "./chunk-GJXOFDJT.js";
|
|
48
48
|
import "./chunk-PMJG2CXF.js";
|
|
49
49
|
import "./chunk-J6KL3COD.js";
|
|
@@ -183,7 +183,7 @@ async function runHost(context) {
|
|
|
183
183
|
return 1;
|
|
184
184
|
}
|
|
185
185
|
if (verb === "up" || verb === "down" || verb === "unit") {
|
|
186
|
-
const { runHostVerb } = await import("./host-run-
|
|
186
|
+
const { runHostVerb } = await import("./host-run-A64IXBGN.js");
|
|
187
187
|
return runHostVerb(verb, spec, context);
|
|
188
188
|
}
|
|
189
189
|
if (verb === "status") {
|
|
@@ -211,4 +211,4 @@ async function runHost(context) {
|
|
|
211
211
|
export {
|
|
212
212
|
runHost
|
|
213
213
|
};
|
|
214
|
-
//# sourceMappingURL=host-
|
|
214
|
+
//# sourceMappingURL=host-X4WU2J3Z.js.map
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
approvalDir,
|
|
7
7
|
approvalState
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5JWCGSZD.js";
|
|
9
9
|
import {
|
|
10
10
|
ArgumentError
|
|
11
11
|
} from "./chunk-A4PKLESO.js";
|
|
12
12
|
import {
|
|
13
13
|
missingBinary,
|
|
14
14
|
ptyBinary
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-KTANZVAJ.js";
|
|
16
16
|
import "./chunk-NRBQK6UX.js";
|
|
17
17
|
import {
|
|
18
18
|
projectStateDir
|
|
@@ -21,7 +21,7 @@ import "./chunk-IJBSOWHK.js";
|
|
|
21
21
|
import "./chunk-XWLMZKH2.js";
|
|
22
22
|
import {
|
|
23
23
|
VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-4EQIZQX2.js";
|
|
25
25
|
import "./chunk-GJXOFDJT.js";
|
|
26
26
|
import "./chunk-PMJG2CXF.js";
|
|
27
27
|
import {
|
|
@@ -329,4 +329,4 @@ async function runHostVerb(verb, spec, context) {
|
|
|
329
329
|
export {
|
|
330
330
|
runHostVerb
|
|
331
331
|
};
|
|
332
|
-
//# sourceMappingURL=host-run-
|
|
332
|
+
//# sourceMappingURL=host-run-A64IXBGN.js.map
|