@modootoday/pmcp 0.22.4 → 0.22.7
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-UYCLP5AL.js} +13 -13
- package/dist/{chunk-F34XIDXT.js → chunk-2R3FVI6M.js} +2 -2
- package/dist/{chunk-RRPNPZ6I.js → chunk-42SO7KYX.js} +2 -2
- package/dist/{chunk-JJT5XRMV.js → chunk-4GBK5M5C.js} +2 -2
- package/dist/{chunk-MIIGZRVC.js → chunk-565QGUAV.js} +2 -2
- package/dist/{chunk-W4W3EHQP.js → chunk-5EZKGPWY.js} +2 -2
- package/dist/{chunk-CPFJ7J4G.js → chunk-5NPDVKX5.js} +5 -5
- package/dist/{chunk-T7SLHAHQ.js → chunk-667C72QC.js} +2 -2
- package/dist/{chunk-QUBU3ETR.js → chunk-6FFGGATI.js} +4 -4
- package/dist/{chunk-FE7WOHZM.js → chunk-7CSUKCU7.js} +2 -2
- package/dist/chunk-7GL2BXSP.js +7 -0
- package/dist/{chunk-JONJ75SF.js → chunk-AOWWLVFL.js} +5 -5
- package/dist/{chunk-G7JONWL4.js → chunk-B3OZ4GGO.js} +13 -1
- package/dist/{chunk-H45C5W2P.js → chunk-CBGY3ELI.js} +2 -2
- package/dist/{chunk-2A3F7ID4.js → chunk-CFSYEB4U.js} +125 -11
- package/dist/{chunk-FFCDSSKA.js → chunk-DYAOLBWZ.js} +7 -7
- package/dist/{chunk-3IX5TBRW.js → chunk-EKW2TQA3.js} +2 -2
- package/dist/{chunk-PFHSFYQB.js → chunk-GTZ5R2ER.js} +2 -2
- package/dist/{chunk-5KA3RS5Y.js → chunk-HABVHASY.js} +2 -2
- package/dist/{chunk-KR6PFEWU.js → chunk-JX5G2USM.js} +3 -3
- package/dist/{chunk-P6LNYYYH.js → chunk-M6X6HVQK.js} +2 -2
- package/dist/{chunk-TAVFL3YB.js → chunk-NK5CAYET.js} +2 -2
- package/dist/{chunk-MTVRKWQI.js → chunk-NVNC3JY5.js} +3 -3
- package/dist/{chunk-7XK2KWLJ.js → chunk-QRTA5NGD.js} +3 -3
- package/dist/{chunk-2Q6MNGU5.js → chunk-SUDG7B6S.js} +2 -2
- package/dist/{chunk-NDY3T7Z4.js → chunk-XERIEIQ3.js} +12 -12
- package/dist/{cli-VCKKTXUU.js → cli-DKVUBOMX.js} +8 -8
- package/dist/cli.js +3 -3
- package/dist/{completion-AAEBLVVB.js → completion-5WIKJUXU.js} +2 -2
- package/dist/{diagnostics-3XI6SJXF.js → diagnostics-6EKKP4FS.js} +5 -5
- package/dist/{doctor-GAJKPOKS.js → doctor-XOUT6HJU.js} +15 -15
- package/dist/{entry-GZCLQTIN.js → entry-7THS4LUN.js} +9 -9
- package/dist/{exec-mcp-3V34UNPH.js → exec-mcp-V4VMYZBN.js} +11 -11
- package/dist/{harness-YH6U6MNV.js → harness-3DFGRL57.js} +3 -3
- package/dist/harness-launch-gate.js +3 -3
- package/dist/harness-worker.js +5 -5
- package/dist/hook-body.js +172 -57
- package/dist/{hooks-JWB7D4ZB.js → hooks-QGH3RRZH.js} +3 -3
- package/dist/{host-DLBXM72V.js → host-64MTQRJZ.js} +6 -6
- package/dist/{host-LNH3TUR5.js → host-AWCM6O5R.js} +13 -13
- package/dist/{host-run-FVO5PZK2.js → host-run-NCHMUCWE.js} +4 -4
- package/dist/http.js +1 -1
- package/dist/{import-mcp-O553FGF3.js → import-mcp-WFDAOCTO.js} +10 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -14
- package/dist/{init-A6AAIGJU.js → init-GXSUWZC7.js} +2 -2
- package/dist/{invoke-GDELKQCE.js → invoke-5FOYWZKY.js} +7 -7
- package/dist/{list-CQ4CPNWI.js → list-FOVH6DDM.js} +12 -12
- package/dist/{logout-TG32MVMB.js → logout-BV4Z36EL.js} +11 -11
- package/dist/{mainline-FMZ44NFC.js → mainline-VOEDBDZE.js} +25 -7
- package/dist/{mcp-UYQVTWEF.js → mcp-VQGNYSEO.js} +2 -2
- package/dist/{modes-COBVV7RA.js → modes-SEINLLMK.js} +3 -3
- package/dist/{project-NOTN6SMK.js → project-4YGFV3OU.js} +4 -4
- package/dist/{run-77MDEDAX.js → run-JLZ5SCX6.js} +10 -10
- package/dist/{run-S5M6ZUUH.js → run-JP4CIL5Z.js} +4 -4
- package/dist/{serve-YNHUW5PQ.js → serve-RYHXWUTT.js} +3 -3
- package/dist/{setup-HYEYYVDU.js → setup-SOUBEZ3H.js} +4 -4
- package/dist/{start-login-SWQVPQG3.js → start-login-LXP4FVGX.js} +11 -11
- package/dist/{status-YPFUSE7K.js → status-6TXNV2GA.js} +11 -11
- package/dist/{status-NGO7AC3U.js → status-EBD7PGZZ.js} +12 -12
- package/dist/stdio.js +2 -2
- package/dist/{test-2UYV4LSU.js → test-56CNS2LD.js} +11 -11
- package/dist/{tui-ZKP3D5JM.js → tui-6JJOARKG.js} +4 -4
- package/dist/{worker-7OBOBMWM.js → worker-A3ZT5TTF.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-JS7ZSCKX.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,108 @@ 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, from)}`);
|
|
3328
|
+
}
|
|
3329
|
+
return lines;
|
|
3330
|
+
}
|
|
3331
|
+
function initOne(root, path, pin, from) {
|
|
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, from).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, from) {
|
|
3347
|
+
const restored = restoreIgnoreFiles(root, path, from);
|
|
3348
|
+
const own = new Set(restored);
|
|
3349
|
+
const kept = [];
|
|
3350
|
+
try {
|
|
3351
|
+
let level = [path];
|
|
3352
|
+
while (level.length > 0) {
|
|
3353
|
+
const entries = level.flatMap(
|
|
3354
|
+
(dir) => readdirSync(join9(root, dir), { withFileTypes: true }).map((entry) => ({
|
|
3355
|
+
path: `${dir}/${entry.name}`,
|
|
3356
|
+
dir: entry.isDirectory()
|
|
3357
|
+
}))
|
|
3358
|
+
);
|
|
3359
|
+
const checked = gitWithInput(
|
|
3360
|
+
root,
|
|
3361
|
+
["check-ignore", "--no-index", "--stdin", "-z"],
|
|
3362
|
+
entries.map((entry) => `${entry.path}\0`).join("")
|
|
3363
|
+
);
|
|
3364
|
+
const ignored = new Set(checked.stdout.split("\0").filter(Boolean));
|
|
3365
|
+
const open2 = entries.filter(
|
|
3366
|
+
(entry) => !ignored.has(entry.path) && !own.has(entry.path)
|
|
3367
|
+
);
|
|
3368
|
+
kept.push(
|
|
3369
|
+
...open2.filter((entry) => !entry.dir).map((entry) => entry.path)
|
|
3370
|
+
);
|
|
3371
|
+
level = open2.filter((entry) => entry.dir).map((entry) => entry.path);
|
|
3372
|
+
}
|
|
3373
|
+
} finally {
|
|
3374
|
+
for (const file2 of restored) rmSync(join9(root, file2));
|
|
3375
|
+
}
|
|
3376
|
+
return kept;
|
|
3377
|
+
}
|
|
3378
|
+
function restoreIgnoreFiles(root, path, from) {
|
|
3379
|
+
const listed = git(root, [
|
|
3380
|
+
"ls-tree",
|
|
3381
|
+
"-r",
|
|
3382
|
+
"-z",
|
|
3383
|
+
"--name-only",
|
|
3384
|
+
from,
|
|
3385
|
+
"--",
|
|
3386
|
+
path
|
|
3387
|
+
]);
|
|
3388
|
+
if (listed.status !== 0) return [];
|
|
3389
|
+
const restored = [];
|
|
3390
|
+
for (const file2 of listed.stdout.split("\0")) {
|
|
3391
|
+
if (!file2.endsWith("/.gitignore")) continue;
|
|
3392
|
+
const target = join9(root, file2);
|
|
3393
|
+
if (existsSync(target) || !existsSync(dirname7(target))) continue;
|
|
3394
|
+
const body = git(root, ["show", `${from}:${file2}`]);
|
|
3395
|
+
if (body.status !== 0) continue;
|
|
3396
|
+
writeFileSync(target, body.stdout);
|
|
3397
|
+
restored.push(file2);
|
|
3398
|
+
}
|
|
3399
|
+
return restored;
|
|
3400
|
+
}
|
|
3401
|
+
function displace(root, path) {
|
|
3402
|
+
const gitDir = gitText(root, ["rev-parse", "--absolute-git-dir"]);
|
|
3403
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/gu, "-");
|
|
3404
|
+
const target = join9(gitDir, "pmcp-displaced", stamp, path);
|
|
3405
|
+
mkdirSync(dirname7(target), { recursive: true });
|
|
3406
|
+
renameSync(join9(root, path), target);
|
|
3407
|
+
return target;
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3299
3410
|
// src/git/submodules.ts
|
|
3300
|
-
import { join as
|
|
3411
|
+
import { join as join10 } from "node:path";
|
|
3301
3412
|
function clean(dir) {
|
|
3302
3413
|
return git(dir, ["status", "--porcelain"]).stdout.trim() === "";
|
|
3303
3414
|
}
|
|
@@ -3307,8 +3418,8 @@ function hasCommit(dir, sha) {
|
|
|
3307
3418
|
function movableSubmodules(root) {
|
|
3308
3419
|
const listed = git(root, ["submodule", "status"]).stdout;
|
|
3309
3420
|
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(
|
|
3421
|
+
const dir = join10(root, path);
|
|
3422
|
+
if (!path || !existsSync(join10(dir, ".git"))) return false;
|
|
3312
3423
|
const local = gitText(dir, [
|
|
3313
3424
|
"rev-list",
|
|
3314
3425
|
"--count",
|
|
@@ -3323,7 +3434,7 @@ function updateToPins(root, paths) {
|
|
|
3323
3434
|
const lines = [];
|
|
3324
3435
|
for (const path of paths) {
|
|
3325
3436
|
const pin = gitText(root, ["rev-parse", `HEAD:${path}`]);
|
|
3326
|
-
const dir =
|
|
3437
|
+
const dir = join10(root, path);
|
|
3327
3438
|
if (!pin || !hasCommit(dir, pin)) {
|
|
3328
3439
|
lines.push(
|
|
3329
3440
|
`${path}: left alone, ${pin.slice(0, 10) || "its pin"} is not in its checkout`
|
|
@@ -3405,6 +3516,10 @@ function syncOnce(options2) {
|
|
|
3405
3516
|
`moved ${before2.slice(0, 10)} -> ${after.slice(0, 10)}, ${counted.behind} commit(s)`
|
|
3406
3517
|
);
|
|
3407
3518
|
for (const line of updateToPins(ctx.root, submodules)) report2.info(line);
|
|
3519
|
+
if (options2.followSubmodules) {
|
|
3520
|
+
for (const line of initAddedSubmodules(ctx.root, before2, after))
|
|
3521
|
+
report2.info(line);
|
|
3522
|
+
}
|
|
3408
3523
|
if (options2.umask !== void 0)
|
|
3409
3524
|
reportModes(report2, [
|
|
3410
3525
|
...restoreModes(ctx.root, before2, after),
|
|
@@ -5182,18 +5297,18 @@ async function dispatch(raw, compiled, deps) {
|
|
|
5182
5297
|
}
|
|
5183
5298
|
|
|
5184
5299
|
// src/hooks/entry/fail-closed.ts
|
|
5185
|
-
import { join as
|
|
5300
|
+
import { join as join13 } from "node:path";
|
|
5186
5301
|
|
|
5187
5302
|
// src/hooks/compiled.ts
|
|
5188
|
-
import { join as
|
|
5303
|
+
import { join as join12 } from "node:path";
|
|
5189
5304
|
|
|
5190
5305
|
// src/hooks/integrity-cache.ts
|
|
5191
5306
|
import { homedir as homedir2 } from "node:os";
|
|
5192
|
-
import { dirname as
|
|
5307
|
+
import { dirname as dirname8, join as join11 } from "node:path";
|
|
5193
5308
|
var LIMIT = 64;
|
|
5194
5309
|
function cacheFile() {
|
|
5195
|
-
const base = process.env["XDG_CACHE_HOME"] ||
|
|
5196
|
-
return
|
|
5310
|
+
const base = process.env["XDG_CACHE_HOME"] || join11(homedir2(), ".cache");
|
|
5311
|
+
return join11(base, "pmcp", "hook-verified.json");
|
|
5197
5312
|
}
|
|
5198
5313
|
function readCache() {
|
|
5199
5314
|
try {
|
|
@@ -5224,7 +5339,7 @@ function rememberVerified(key, stamp, sha) {
|
|
|
5224
5339
|
[key, { stamp, sha }]
|
|
5225
5340
|
]);
|
|
5226
5341
|
const file2 = cacheFile();
|
|
5227
|
-
mkdirSync(
|
|
5342
|
+
mkdirSync(dirname8(file2), { recursive: true });
|
|
5228
5343
|
const temporary = `${file2}.${process.pid}.tmp`;
|
|
5229
5344
|
writeFileSync(temporary, JSON.stringify(cache), { mode: 384 });
|
|
5230
5345
|
renameSync(temporary, file2);
|
|
@@ -5263,8 +5378,8 @@ function readLockFile(path) {
|
|
|
5263
5378
|
}
|
|
5264
5379
|
}
|
|
5265
5380
|
function readCompiled(root) {
|
|
5266
|
-
const policyPath =
|
|
5267
|
-
const files2 = [policyPath,
|
|
5381
|
+
const policyPath = join12(root, POLICY_FILE);
|
|
5382
|
+
const files2 = [policyPath, join12(root, LOCK_FILE)];
|
|
5268
5383
|
const before2 = stampOf(files2);
|
|
5269
5384
|
const text9 = readFileSync(policyPath, "utf8");
|
|
5270
5385
|
const lock = readLockFile(files2[1]);
|
|
@@ -5287,7 +5402,7 @@ function readCompiled(root) {
|
|
|
5287
5402
|
var FAILED_CLOSED = "pmcp hook could not evaluate this call and refused it";
|
|
5288
5403
|
function rawFailure(root) {
|
|
5289
5404
|
try {
|
|
5290
|
-
const raw = JSON.parse(readFileSync(
|
|
5405
|
+
const raw = JSON.parse(readFileSync(join13(root, POLICY_FILE), "utf8"))["failure"];
|
|
5291
5406
|
if (!raw || typeof raw.timeoutMs !== "number" || typeof raw.retry !== "number" || !Array.isArray(raw.pass) || !raw.pass.every(
|
|
5292
5407
|
(kind) => PASS_KINDS.includes(kind)
|
|
5293
5408
|
))
|
|
@@ -5322,7 +5437,7 @@ function failClosed(adapter, event, root, error, stated = false) {
|
|
|
5322
5437
|
}
|
|
5323
5438
|
|
|
5324
5439
|
// src/hooks/entry/lock-repair.ts
|
|
5325
|
-
import { join as
|
|
5440
|
+
import { join as join14, resolve as resolve19 } from "node:path";
|
|
5326
5441
|
var REV = String.raw`[\w./~^@{}-]+`;
|
|
5327
5442
|
var LOCK = String.raw`(?:\./)?pmcp\.lock`;
|
|
5328
5443
|
var REPAIRS = [
|
|
@@ -5341,7 +5456,7 @@ function repairsLock(input, root) {
|
|
|
5341
5456
|
if (!tool) return false;
|
|
5342
5457
|
if (tool.kind === "read") return true;
|
|
5343
5458
|
if (tool.kind === "edit") {
|
|
5344
|
-
const lock =
|
|
5459
|
+
const lock = join14(root, LOCK_FILE);
|
|
5345
5460
|
return tool.paths.length > 0 && tool.paths.every((path) => resolve19(input.cwd, path) === lock);
|
|
5346
5461
|
}
|
|
5347
5462
|
if (tool.kind === "shell") {
|
|
@@ -5362,7 +5477,7 @@ function lockRepair(adapter, event, root, input, error) {
|
|
|
5362
5477
|
}
|
|
5363
5478
|
|
|
5364
5479
|
// src/hooks/entry/logger.ts
|
|
5365
|
-
import { dirname as
|
|
5480
|
+
import { dirname as dirname9, join as join17 } from "node:path";
|
|
5366
5481
|
|
|
5367
5482
|
// src/logging/levels.ts
|
|
5368
5483
|
var LEVEL_RANK = {
|
|
@@ -5486,11 +5601,11 @@ var silentLogger = createLogger(() => {
|
|
|
5486
5601
|
});
|
|
5487
5602
|
|
|
5488
5603
|
// src/logging/sinks/file.ts
|
|
5489
|
-
import { join as
|
|
5604
|
+
import { join as join15 } from "node:path";
|
|
5490
5605
|
var FILE = /^pmcp-(\d{8})(?:\.\d+)?\.jsonl$/u;
|
|
5491
5606
|
function dailyLogFile(dir, now = /* @__PURE__ */ new Date()) {
|
|
5492
5607
|
const day = now.toISOString().slice(0, 10).replaceAll("-", "");
|
|
5493
|
-
return
|
|
5608
|
+
return join15(dir, `pmcp-${day}.jsonl`);
|
|
5494
5609
|
}
|
|
5495
5610
|
function roll(file2) {
|
|
5496
5611
|
let index = 1;
|
|
@@ -5521,7 +5636,7 @@ function logFiles(dir) {
|
|
|
5521
5636
|
const part = (name) => Number(/\.(\d+)\.jsonl$/u.exec(name)?.[1] ?? Number.MAX_SAFE_INTEGER);
|
|
5522
5637
|
return names3.sort(
|
|
5523
5638
|
(a, b) => a.slice(5, 13).localeCompare(b.slice(5, 13)) || part(a) - part(b)
|
|
5524
|
-
).map((name) =>
|
|
5639
|
+
).map((name) => join15(dir, name));
|
|
5525
5640
|
}
|
|
5526
5641
|
function pruneLogs(dir, keepDays, now = /* @__PURE__ */ new Date()) {
|
|
5527
5642
|
const cutoff = new Date(now.getTime() - keepDays * 864e5).toISOString().slice(0, 10).replaceAll("-", "");
|
|
@@ -5537,13 +5652,13 @@ function pruneLogs(dir, keepDays, now = /* @__PURE__ */ new Date()) {
|
|
|
5537
5652
|
|
|
5538
5653
|
// src/sessions/state-dir.ts
|
|
5539
5654
|
import { homedir as homedir3 } from "node:os";
|
|
5540
|
-
import { join as
|
|
5655
|
+
import { join as join16 } from "node:path";
|
|
5541
5656
|
function projectStateDir(root, override, env = process.env) {
|
|
5542
5657
|
if (override) return expandPath(root, override);
|
|
5543
5658
|
const anchor = gitCommonDir(root) ?? realpathSync(root);
|
|
5544
5659
|
const id = createHash("sha256").update(anchor).digest("hex").slice(0, 16);
|
|
5545
|
-
const base = env["XDG_STATE_HOME"] ||
|
|
5546
|
-
return
|
|
5660
|
+
const base = env["XDG_STATE_HOME"] || join16(homedir3(), ".local", "state");
|
|
5661
|
+
return join16(base, "pmcp", "projects", id);
|
|
5547
5662
|
}
|
|
5548
5663
|
|
|
5549
5664
|
// src/hooks/entry/logger.ts
|
|
@@ -5558,7 +5673,7 @@ function hookLogger(root, compiled, runtime2, event) {
|
|
|
5558
5673
|
process.env["PMCP_LOG"]
|
|
5559
5674
|
);
|
|
5560
5675
|
const file2 = compiled?.logFile ? expandPath(root, compiled.logFile) : void 0;
|
|
5561
|
-
const dir = file2 ?
|
|
5676
|
+
const dir = file2 ? dirname9(file2) : join17(projectStateDir(root, compiled?.stateDir), "logs");
|
|
5562
5677
|
const sink = fileSink({
|
|
5563
5678
|
dir,
|
|
5564
5679
|
...file2 ? { file: file2 } : {},
|
|
@@ -5574,18 +5689,18 @@ function hookLogger(root, compiled, runtime2, event) {
|
|
|
5574
5689
|
}
|
|
5575
5690
|
|
|
5576
5691
|
// src/hooks/entry/state-dir.ts
|
|
5577
|
-
import { join as
|
|
5692
|
+
import { join as join19 } from "node:path";
|
|
5578
5693
|
|
|
5579
5694
|
// src/sessions/lease-files.ts
|
|
5580
|
-
import { dirname as
|
|
5695
|
+
import { dirname as dirname10, isAbsolute as isAbsolute13, join as join18 } from "node:path";
|
|
5581
5696
|
var GATE_DIR = "${gate_dir}/";
|
|
5582
5697
|
function gateTree(root, stateDir, gate, env) {
|
|
5583
5698
|
const override = gate.treeEnv ? env[gate.treeEnv] : void 0;
|
|
5584
5699
|
if (override) return override;
|
|
5585
|
-
return gate.tree ? expandPath(root, gate.tree) :
|
|
5700
|
+
return gate.tree ? expandPath(root, gate.tree) : join18(stateDir, "gate", "tree");
|
|
5586
5701
|
}
|
|
5587
5702
|
function atGateDir(path, gateDir) {
|
|
5588
|
-
return path.startsWith(GATE_DIR) ?
|
|
5703
|
+
return path.startsWith(GATE_DIR) ? join18(gateDir, path.slice(GATE_DIR.length)) : path;
|
|
5589
5704
|
}
|
|
5590
5705
|
function resolvePauseFile(file2, gateDir) {
|
|
5591
5706
|
return file2 === void 0 ? void 0 : atGateDir(file2, gateDir);
|
|
@@ -5607,14 +5722,14 @@ function leaseFilesFor(root, stateDir, files2, gate, env) {
|
|
|
5607
5722
|
if (!files2 || Object.keys(files2).length === 0) return {};
|
|
5608
5723
|
return resolveLeaseFiles(
|
|
5609
5724
|
files2,
|
|
5610
|
-
|
|
5725
|
+
dirname10(gateTree(root, stateDir, gate ?? {}, env))
|
|
5611
5726
|
);
|
|
5612
5727
|
}
|
|
5613
5728
|
function pauseFileFor(root, stateDir, file2, gate, env) {
|
|
5614
5729
|
if (!file2) return void 0;
|
|
5615
5730
|
return resolvePauseFile(
|
|
5616
5731
|
file2,
|
|
5617
|
-
|
|
5732
|
+
dirname10(gateTree(root, stateDir, gate ?? {}, env))
|
|
5618
5733
|
);
|
|
5619
5734
|
}
|
|
5620
5735
|
|
|
@@ -5640,7 +5755,7 @@ function pauseFileAnswer(root) {
|
|
|
5640
5755
|
compiled?.sessions.gate,
|
|
5641
5756
|
process.env
|
|
5642
5757
|
);
|
|
5643
|
-
return `${file2 ??
|
|
5758
|
+
return `${file2 ?? join19(stateDir, STATE_FILES.pause)}
|
|
5644
5759
|
`;
|
|
5645
5760
|
}
|
|
5646
5761
|
|
|
@@ -5678,10 +5793,10 @@ var gitProbe = {
|
|
|
5678
5793
|
};
|
|
5679
5794
|
|
|
5680
5795
|
// src/sessions/files/broadcast.ts
|
|
5681
|
-
import { join as
|
|
5796
|
+
import { join as join20 } from "node:path";
|
|
5682
5797
|
|
|
5683
5798
|
// src/sessions/files/json.ts
|
|
5684
|
-
import { dirname as
|
|
5799
|
+
import { dirname as dirname11 } from "node:path";
|
|
5685
5800
|
function readJson3(path) {
|
|
5686
5801
|
try {
|
|
5687
5802
|
return JSON.parse(readFileSync(path, "utf8"));
|
|
@@ -5690,7 +5805,7 @@ function readJson3(path) {
|
|
|
5690
5805
|
}
|
|
5691
5806
|
}
|
|
5692
5807
|
function writeJson(path, value) {
|
|
5693
|
-
mkdirSync(
|
|
5808
|
+
mkdirSync(dirname11(path), { recursive: true, mode: 448 });
|
|
5694
5809
|
const temporary = `${path}.${process.pid}.tmp`;
|
|
5695
5810
|
writeFileSync(temporary, `${JSON.stringify(value, null, 2)}
|
|
5696
5811
|
`, {
|
|
@@ -5714,7 +5829,7 @@ function readLines(path) {
|
|
|
5714
5829
|
});
|
|
5715
5830
|
}
|
|
5716
5831
|
function writeLines(path, values) {
|
|
5717
|
-
mkdirSync(
|
|
5832
|
+
mkdirSync(dirname11(path), { recursive: true, mode: 448 });
|
|
5718
5833
|
writeFileSync(
|
|
5719
5834
|
path,
|
|
5720
5835
|
`${values.map((value) => JSON.stringify(value)).join("\n")}
|
|
@@ -5725,8 +5840,8 @@ function writeLines(path, values) {
|
|
|
5725
5840
|
|
|
5726
5841
|
// src/sessions/files/broadcast.ts
|
|
5727
5842
|
function filesBroadcast(dir, keep, registry2) {
|
|
5728
|
-
const latestPath =
|
|
5729
|
-
const historyPath =
|
|
5843
|
+
const latestPath = join20(dir, STATE_FILES.broadcast);
|
|
5844
|
+
const historyPath = join20(dir, STATE_FILES.history);
|
|
5730
5845
|
const list = () => {
|
|
5731
5846
|
const latest = asBroadcast(readJson3(latestPath));
|
|
5732
5847
|
if (!latest) return [];
|
|
@@ -5770,9 +5885,9 @@ function filesBroadcast(dir, keep, registry2) {
|
|
|
5770
5885
|
}
|
|
5771
5886
|
|
|
5772
5887
|
// src/sessions/files/leases.ts
|
|
5773
|
-
import { dirname as
|
|
5888
|
+
import { dirname as dirname12, join as join21 } from "node:path";
|
|
5774
5889
|
function filesLeases(dir, files2 = {}) {
|
|
5775
|
-
const leasePath = (name) => files2[name]?.file ??
|
|
5890
|
+
const leasePath = (name) => files2[name]?.file ?? join21(dir, leaseFile(name));
|
|
5776
5891
|
const read4 = (name) => {
|
|
5777
5892
|
const lease = asLease(readJson3(leasePath(name)));
|
|
5778
5893
|
if (!lease || !alive(lease.pid)) return null;
|
|
@@ -5792,7 +5907,7 @@ function filesLeases(dir, files2 = {}) {
|
|
|
5792
5907
|
...lease.cwd ? { cwd: lease.cwd } : {},
|
|
5793
5908
|
since: (/* @__PURE__ */ new Date()).toISOString()
|
|
5794
5909
|
};
|
|
5795
|
-
mkdirSync(
|
|
5910
|
+
mkdirSync(dirname12(path), { recursive: true });
|
|
5796
5911
|
const temp = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
5797
5912
|
writeFileSync(temp, `${JSON.stringify(record)}
|
|
5798
5913
|
`);
|
|
@@ -5822,28 +5937,28 @@ function filesLeases(dir, files2 = {}) {
|
|
|
5822
5937
|
}
|
|
5823
5938
|
|
|
5824
5939
|
// src/sessions/files/mailbox.ts
|
|
5825
|
-
import { join as
|
|
5940
|
+
import { join as join22 } from "node:path";
|
|
5826
5941
|
var ID = /^\d{13}-[0-9a-f]{8}$/u;
|
|
5827
5942
|
var SAFE_KEY = /^@?[\w.-]+$/u;
|
|
5828
5943
|
function filesMailbox(dir, settings) {
|
|
5829
|
-
const messages =
|
|
5830
|
-
const inbox =
|
|
5831
|
-
const pathOf = (id) =>
|
|
5944
|
+
const messages = join22(dir, "messages");
|
|
5945
|
+
const inbox = join22(dir, "inbox");
|
|
5946
|
+
const pathOf = (id) => join22(messages, `${id}.json`);
|
|
5832
5947
|
const marker = (key, id, kind) => {
|
|
5833
5948
|
if (!SAFE_KEY.test(key) || !ID.test(id))
|
|
5834
5949
|
throw new Error(`invalid mailbox key ${key} or id ${id}`);
|
|
5835
|
-
return
|
|
5950
|
+
return join22(inbox, key, `${id}.${kind}`);
|
|
5836
5951
|
};
|
|
5837
5952
|
const audit = (event, fields2) => {
|
|
5838
5953
|
if (!settings.audit) return;
|
|
5839
5954
|
const line = { at: (/* @__PURE__ */ new Date()).toISOString(), event, ...fields2 };
|
|
5840
|
-
appendFileSync(
|
|
5955
|
+
appendFileSync(join22(dir, "messages.jsonl"), `${JSON.stringify(line)}
|
|
5841
5956
|
`, {
|
|
5842
5957
|
mode: 384
|
|
5843
5958
|
});
|
|
5844
5959
|
};
|
|
5845
5960
|
const touch = (path) => {
|
|
5846
|
-
mkdirSync(
|
|
5961
|
+
mkdirSync(join22(path, ".."), { recursive: true, mode: 448 });
|
|
5847
5962
|
try {
|
|
5848
5963
|
writeFileSync(path, "", { flag: "wx", mode: 384 });
|
|
5849
5964
|
return true;
|
|
@@ -5860,7 +5975,7 @@ function filesMailbox(dir, settings) {
|
|
|
5860
5975
|
if (existsSync(inbox))
|
|
5861
5976
|
for (const key of readdirSync(inbox))
|
|
5862
5977
|
for (const kind of ["ack", "delivered"])
|
|
5863
|
-
rmSync(
|
|
5978
|
+
rmSync(join22(inbox, key, `${message.id}.${kind}`), { force: true });
|
|
5864
5979
|
audit(event, { id: message.id });
|
|
5865
5980
|
};
|
|
5866
5981
|
return {
|
|
@@ -5936,9 +6051,9 @@ function filesMailbox(dir, settings) {
|
|
|
5936
6051
|
}
|
|
5937
6052
|
|
|
5938
6053
|
// src/sessions/files/pause.ts
|
|
5939
|
-
import { join as
|
|
6054
|
+
import { join as join23 } from "node:path";
|
|
5940
6055
|
function filesPause(dir, file2) {
|
|
5941
|
-
const path = file2 ??
|
|
6056
|
+
const path = file2 ?? join23(dir, STATE_FILES.pause);
|
|
5942
6057
|
return {
|
|
5943
6058
|
read: () => asPause(readJson3(path)),
|
|
5944
6059
|
write(pause2) {
|
|
@@ -5956,12 +6071,12 @@ function filesPause(dir, file2) {
|
|
|
5956
6071
|
}
|
|
5957
6072
|
|
|
5958
6073
|
// src/sessions/files/registry.ts
|
|
5959
|
-
import { join as
|
|
6074
|
+
import { join as join24 } from "node:path";
|
|
5960
6075
|
var SESSION_ID = /^[A-Za-z0-9_-]{8,64}$/u;
|
|
5961
6076
|
function filesRegistry(dir, staleMs) {
|
|
5962
|
-
const records =
|
|
5963
|
-
const dirs = [records,
|
|
5964
|
-
const pathsOf = (session) => dirs.map((records2) =>
|
|
6077
|
+
const records = join24(dir, STATE_FILES.records);
|
|
6078
|
+
const dirs = [records, join24(dir, STATE_FILES.legacyRecords)];
|
|
6079
|
+
const pathsOf = (session) => dirs.map((records2) => join24(records2, `${session}.json`));
|
|
5965
6080
|
const get = (session) => {
|
|
5966
6081
|
if (!SESSION_ID.test(session)) return null;
|
|
5967
6082
|
return latestRecord(
|
|
@@ -5980,7 +6095,7 @@ function filesRegistry(dir, staleMs) {
|
|
|
5980
6095
|
for (const name of names3)
|
|
5981
6096
|
found.set(name, [
|
|
5982
6097
|
...found.get(name) ?? [],
|
|
5983
|
-
asRecord(readJson3(
|
|
6098
|
+
asRecord(readJson3(join24(folder, name)))
|
|
5984
6099
|
]);
|
|
5985
6100
|
}
|
|
5986
6101
|
return [...found.values()].map(latestRecord).filter((record) => record !== null).map((record) => ({ ...record, live: isLive(record, now, staleMs) }));
|
|
@@ -6007,7 +6122,7 @@ function filesRegistry(dir, staleMs) {
|
|
|
6007
6122
|
next["worktree"] = checkout?.root ?? "";
|
|
6008
6123
|
next["branch"] = checkout?.branch ?? "";
|
|
6009
6124
|
}
|
|
6010
|
-
writeJson(
|
|
6125
|
+
writeJson(join24(records, `${session}.json`), next);
|
|
6011
6126
|
return next;
|
|
6012
6127
|
},
|
|
6013
6128
|
sweep(now = Date.now()) {
|
|
@@ -6165,7 +6280,7 @@ var self = import.meta.filename;
|
|
|
6165
6280
|
if (process.argv[1] && resolve20(process.argv[1]) === self) {
|
|
6166
6281
|
process.exitCode = await main(
|
|
6167
6282
|
process.argv.slice(2),
|
|
6168
|
-
resolve20(
|
|
6283
|
+
resolve20(dirname13(self), "../..")
|
|
6169
6284
|
);
|
|
6170
6285
|
}
|
|
6171
6286
|
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-FOVH6DDM.js")).run(context);
|
|
15
|
+
if (verb === "test") return (await import("./test-56CNS2LD.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-QGH3RRZH.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requireTerminal,
|
|
3
3
|
terminalSupport
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QRTA5NGD.js";
|
|
5
5
|
import "./chunk-5ZABTVSW.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-GTZ5R2ER.js";
|
|
7
7
|
import "./chunk-LMT3PPXJ.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-5EZKGPWY.js";
|
|
9
9
|
import "./chunk-R2GPCZUX.js";
|
|
10
10
|
import "./chunk-34DECPVC.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-2R3FVI6M.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-7GL2BXSP.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-64MTQRJZ.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-NK5CAYET.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-EKW2TQA3.js";
|
|
16
|
+
import "./chunk-DYAOLBWZ.js";
|
|
17
17
|
import "./chunk-UKR64U7J.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-CFSYEB4U.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-2R3FVI6M.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-7GL2BXSP.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-NCHMUCWE.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-AWCM6O5R.js.map
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
approvalDir,
|
|
7
7
|
approvalState
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EKW2TQA3.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-2R3FVI6M.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-7GL2BXSP.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-NCHMUCWE.js.map
|