@hawkeyexl/manni 4.18.0 → 4.19.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/README.md +1 -1
- package/dist/{batch-5TPNK5BQ.js → batch-R7A22ANE.js} +13 -13
- package/dist/{build-GGKCRWKH.js → build-EUPWPNJJ.js} +14 -14
- package/dist/{calibrate-OGOLLGXY.js → calibrate-3JTVKYSQ.js} +14 -14
- package/dist/{capture-CNHRHTA7.js → capture-WT4O77PA.js} +13 -13
- package/dist/{check-XLIS5A7G.js → check-5HPK2S57.js} +12 -12
- package/dist/{check-BAMOJMOJ.js → check-KQ3KUXQT.js} +13 -13
- package/dist/{check-ZFI7H7LS.js → check-POQHLDLN.js} +14 -14
- package/dist/check-URJURAED.js +47 -0
- package/dist/{chunk-JFPCDIES.js → chunk-23C7Q3Z5.js} +2 -2
- package/dist/{chunk-RVSUMNCR.js → chunk-2BY4C2WU.js} +2 -2
- package/dist/{chunk-3COYAAR7.js → chunk-2MRYDECM.js} +2 -2
- package/dist/{chunk-3LZ6AYB4.js → chunk-3EQR6QAZ.js} +2 -2
- package/dist/{chunk-F7GYY373.js → chunk-5R4BXMGC.js} +5 -5
- package/dist/{chunk-JHUEACRT.js → chunk-5SL2QOCH.js} +4 -4
- package/dist/{chunk-E76WPNYO.js → chunk-5YOZIXTG.js} +2 -2
- package/dist/{chunk-4KY2RUXQ.js → chunk-6MVYXXRG.js} +3 -3
- package/dist/{chunk-JS5NCZYC.js → chunk-6Q7JZZVG.js} +37 -14
- package/dist/chunk-6Q7JZZVG.js.map +1 -0
- package/dist/{chunk-V5QTIP2M.js → chunk-7FDYCTXS.js} +7 -7
- package/dist/{chunk-VV4YM6VM.js → chunk-BAH6O5PN.js} +8 -8
- package/dist/{chunk-XKZZRG3Z.js → chunk-BJ4T6QRD.js} +3 -3
- package/dist/{chunk-JFB45L7D.js → chunk-BKWXY474.js} +2 -2
- package/dist/{chunk-EU5QLSNN.js → chunk-BMFT6SBM.js} +3 -3
- package/dist/{chunk-EITEHOSX.js → chunk-CEIJV5QG.js} +5 -5
- package/dist/{chunk-KRQTN5KE.js → chunk-DJM67CFP.js} +4 -4
- package/dist/{chunk-7RZQAMA2.js → chunk-EWNWPYMQ.js} +4 -4
- package/dist/{chunk-PLN2LJDM.js → chunk-G4RTYFFR.js} +3 -3
- package/dist/{chunk-T3VFO2LO.js → chunk-HCUHASZN.js} +6 -6
- package/dist/{chunk-327CWO33.js → chunk-IBNI5CRF.js} +3 -3
- package/dist/{chunk-XTQTA262.js → chunk-IM2K47B7.js} +5 -5
- package/dist/{chunk-TFTGMYDR.js → chunk-IX5YIY5O.js} +2 -2
- package/dist/{chunk-MH5MX4B3.js → chunk-JA25DZIV.js} +77 -75
- package/dist/{chunk-MH5MX4B3.js.map → chunk-JA25DZIV.js.map} +1 -1
- package/dist/{chunk-FE3US7FR.js → chunk-JBJGBEBU.js} +3 -3
- package/dist/{chunk-QXTL5MGT.js → chunk-K2FE4B6R.js} +4 -4
- package/dist/{chunk-6ZYXK3JT.js → chunk-K5Q766TX.js} +3 -3
- package/dist/{chunk-RCWP63XT.js → chunk-KMZF77L6.js} +2 -2
- package/dist/{chunk-OVQDZOMU.js → chunk-NNAE7NF2.js} +2 -2
- package/dist/{chunk-NUAVQQMC.js → chunk-NZYXMTNI.js} +2 -2
- package/dist/{chunk-SVB45M54.js → chunk-OABOOM6D.js} +17 -5
- package/dist/chunk-OABOOM6D.js.map +1 -0
- package/dist/{chunk-5VA3ZOB7.js → chunk-P3DDYDJW.js} +3 -3
- package/dist/{chunk-33FIOHJ4.js → chunk-PF6BTJ4N.js} +10 -10
- package/dist/{chunk-IIBVQCCR.js → chunk-PGMHGOLD.js} +4 -4
- package/dist/{chunk-27FP4KKD.js → chunk-QYFPJY7F.js} +44 -23
- package/dist/chunk-QYFPJY7F.js.map +1 -0
- package/dist/{chunk-RMKMJ43W.js → chunk-S243N72D.js} +2 -2
- package/dist/{chunk-FNQE3RAW.js → chunk-S2PXTHDM.js} +2 -2
- package/dist/{chunk-YLU4H2H3.js → chunk-S3WWQTJC.js} +6 -6
- package/dist/{chunk-PCTJ7P6U.js → chunk-SGUSZTUB.js} +5 -7
- package/dist/{chunk-PCTJ7P6U.js.map → chunk-SGUSZTUB.js.map} +1 -1
- package/dist/{chunk-OZWV27SE.js → chunk-T3DDFC2B.js} +2 -2
- package/dist/{chunk-FO6MNXOF.js → chunk-T63LOFB2.js} +5 -5
- package/dist/{chunk-E3YXGLEU.js → chunk-TC76MTNC.js} +2 -2
- package/dist/{chunk-ZLOLC6WD.js → chunk-TMPCYEGS.js} +4 -4
- package/dist/{chunk-O2TE5X25.js → chunk-U2PJNL3R.js} +5 -5
- package/dist/{chunk-6E6Z6UQL.js → chunk-VBEFPLAN.js} +7 -7
- package/dist/{chunk-CWVL7XZR.js → chunk-WQVXJMJM.js} +4 -4
- package/dist/{chunk-4A445ALG.js → chunk-X4ZANRWU.js} +3 -3
- package/dist/{chunk-V2IP2ZMD.js → chunk-X7RPFR6B.js} +2 -2
- package/dist/{chunk-GNZKLUZW.js → chunk-XGL4TSEA.js} +8 -8
- package/dist/{chunk-QGJA43DX.js → chunk-XH3NRZFD.js} +3 -3
- package/dist/{chunk-2QZCPPVE.js → chunk-YKOB2LDR.js} +8 -8
- package/dist/{chunk-QWYE3S3U.js → chunk-YL7EATZ7.js} +5 -5
- package/dist/{chunk-ICRYIYMJ.js → chunk-YM2DGL3T.js} +24 -12
- package/dist/chunk-YM2DGL3T.js.map +1 -0
- package/dist/{cli-GND6TVRG.js → cli-2Q2OFLOI.js} +14 -14
- package/dist/{cli-NWU77YRZ.js → cli-4OHXIGOF.js} +14 -14
- package/dist/{cli-JHULEOH2.js → cli-4QKOQEWV.js} +2 -2
- package/dist/{cli-PUO75R3L.js → cli-534K765K.js} +20 -20
- package/dist/{cli-6UQ3QV2G.js → cli-5CUZEROV.js} +9 -9
- package/dist/{cli-T7UJF3BF.js → cli-II4EPPDK.js} +353 -121
- package/dist/cli-II4EPPDK.js.map +1 -0
- package/dist/{cli-WUFQGIUG.js → cli-R3CS7V3H.js} +9 -9
- package/dist/{cli-Q2RJMCVE.js → cli-TMMOVK3R.js} +18 -18
- package/dist/{cli-LVHZCC2O.js → cli-WAXGGWNW.js} +14 -14
- package/dist/{cli-GH42HLFK.js → cli-WRNKMNEM.js} +17 -17
- package/dist/{cli-RUNYBUIV.js → cli-ZEOR6LL5.js} +34 -34
- package/dist/cli.js +14 -14
- package/dist/docmeta.js +8 -8
- package/dist/{github-XZ7OLATY.js → github-K2A4TNDE.js} +14 -14
- package/dist/{github-BV42LSW2.js → github-PXXYARFQ.js} +12 -12
- package/dist/index.d.ts +38 -8
- package/dist/index.js +40 -40
- package/dist/{json-LEEXKSGP.js → json-ELJ5D3VR.js} +12 -12
- package/dist/{labels-E256WRAI.js → labels-CHN33A4X.js} +11 -11
- package/dist/{lint-W4CM3EIO.js → lint-PYDL7IT7.js} +12 -12
- package/dist/{list-TB4R6AP4.js → list-EIFNJKE5.js} +12 -12
- package/dist/{list-UDDGL2OI.js → list-T2NPRQCA.js} +12 -12
- package/dist/{page-L64NO57W.js → page-C4P4KFUL.js} +11 -11
- package/dist/{prepare-GFTAYDTP.js → prepare-Q6Y4NCXU.js} +12 -12
- package/dist/{pretty-HYCYKYHB.js → pretty-B52EGTKL.js} +13 -13
- package/dist/{pretty-Q43TCD6D.js → pretty-XXMCA3SX.js} +12 -12
- package/dist/{reporters-4HRBSMUF.js → reporters-3MDFUPKQ.js} +4 -4
- package/dist/{reporters-E3FUVBQ6.js → reporters-6VOPV7L6.js} +11 -11
- package/dist/{run-UDX2C54M.js → run-YFH7RPUR.js} +12 -12
- package/dist/{sarif-WL353VTA.js → sarif-NXSMEW2M.js} +10 -10
- package/dist/{sarif-XZFJ5VIJ.js → sarif-RBLPUGPH.js} +15 -15
- package/dist/{term-OZ7ZR5KB.js → term-QIG4USZM.js} +17 -17
- package/dist/{validate-CR3TI7GP.js → validate-W2XQYBSW.js} +5 -5
- package/package.json +4 -6
- package/plugin/manni/.claude-plugin/plugin.json +2 -2
- package/plugin/manni/.mcp.json +12 -0
- package/plugin/manni/hooks/graph-server.mjs +95 -0
- package/plugin/manni/hooks/hooks.json +26 -0
- package/plugin/manni/hooks/manni.mjs +51 -25
- package/plugin/manni/hooks/page-metadata.mjs +144 -0
- package/dist/check-XYGABPXI.js +0 -47
- package/dist/chunk-27FP4KKD.js.map +0 -1
- package/dist/chunk-ICRYIYMJ.js.map +0 -1
- package/dist/chunk-JS5NCZYC.js.map +0 -1
- package/dist/chunk-SVB45M54.js.map +0 -1
- package/dist/cli-T7UJF3BF.js.map +0 -1
- /package/dist/{batch-5TPNK5BQ.js.map → batch-R7A22ANE.js.map} +0 -0
- /package/dist/{build-GGKCRWKH.js.map → build-EUPWPNJJ.js.map} +0 -0
- /package/dist/{calibrate-OGOLLGXY.js.map → calibrate-3JTVKYSQ.js.map} +0 -0
- /package/dist/{capture-CNHRHTA7.js.map → capture-WT4O77PA.js.map} +0 -0
- /package/dist/{check-BAMOJMOJ.js.map → check-5HPK2S57.js.map} +0 -0
- /package/dist/{check-XLIS5A7G.js.map → check-KQ3KUXQT.js.map} +0 -0
- /package/dist/{check-ZFI7H7LS.js.map → check-POQHLDLN.js.map} +0 -0
- /package/dist/{check-XYGABPXI.js.map → check-URJURAED.js.map} +0 -0
- /package/dist/{chunk-JFPCDIES.js.map → chunk-23C7Q3Z5.js.map} +0 -0
- /package/dist/{chunk-RVSUMNCR.js.map → chunk-2BY4C2WU.js.map} +0 -0
- /package/dist/{chunk-3COYAAR7.js.map → chunk-2MRYDECM.js.map} +0 -0
- /package/dist/{chunk-3LZ6AYB4.js.map → chunk-3EQR6QAZ.js.map} +0 -0
- /package/dist/{chunk-F7GYY373.js.map → chunk-5R4BXMGC.js.map} +0 -0
- /package/dist/{chunk-JHUEACRT.js.map → chunk-5SL2QOCH.js.map} +0 -0
- /package/dist/{chunk-E76WPNYO.js.map → chunk-5YOZIXTG.js.map} +0 -0
- /package/dist/{chunk-4KY2RUXQ.js.map → chunk-6MVYXXRG.js.map} +0 -0
- /package/dist/{chunk-V5QTIP2M.js.map → chunk-7FDYCTXS.js.map} +0 -0
- /package/dist/{chunk-VV4YM6VM.js.map → chunk-BAH6O5PN.js.map} +0 -0
- /package/dist/{chunk-XKZZRG3Z.js.map → chunk-BJ4T6QRD.js.map} +0 -0
- /package/dist/{chunk-JFB45L7D.js.map → chunk-BKWXY474.js.map} +0 -0
- /package/dist/{chunk-EU5QLSNN.js.map → chunk-BMFT6SBM.js.map} +0 -0
- /package/dist/{chunk-EITEHOSX.js.map → chunk-CEIJV5QG.js.map} +0 -0
- /package/dist/{chunk-KRQTN5KE.js.map → chunk-DJM67CFP.js.map} +0 -0
- /package/dist/{chunk-7RZQAMA2.js.map → chunk-EWNWPYMQ.js.map} +0 -0
- /package/dist/{chunk-PLN2LJDM.js.map → chunk-G4RTYFFR.js.map} +0 -0
- /package/dist/{chunk-T3VFO2LO.js.map → chunk-HCUHASZN.js.map} +0 -0
- /package/dist/{chunk-327CWO33.js.map → chunk-IBNI5CRF.js.map} +0 -0
- /package/dist/{chunk-XTQTA262.js.map → chunk-IM2K47B7.js.map} +0 -0
- /package/dist/{chunk-TFTGMYDR.js.map → chunk-IX5YIY5O.js.map} +0 -0
- /package/dist/{chunk-FE3US7FR.js.map → chunk-JBJGBEBU.js.map} +0 -0
- /package/dist/{chunk-QXTL5MGT.js.map → chunk-K2FE4B6R.js.map} +0 -0
- /package/dist/{chunk-6ZYXK3JT.js.map → chunk-K5Q766TX.js.map} +0 -0
- /package/dist/{chunk-RCWP63XT.js.map → chunk-KMZF77L6.js.map} +0 -0
- /package/dist/{chunk-OVQDZOMU.js.map → chunk-NNAE7NF2.js.map} +0 -0
- /package/dist/{chunk-NUAVQQMC.js.map → chunk-NZYXMTNI.js.map} +0 -0
- /package/dist/{chunk-5VA3ZOB7.js.map → chunk-P3DDYDJW.js.map} +0 -0
- /package/dist/{chunk-33FIOHJ4.js.map → chunk-PF6BTJ4N.js.map} +0 -0
- /package/dist/{chunk-IIBVQCCR.js.map → chunk-PGMHGOLD.js.map} +0 -0
- /package/dist/{chunk-RMKMJ43W.js.map → chunk-S243N72D.js.map} +0 -0
- /package/dist/{chunk-FNQE3RAW.js.map → chunk-S2PXTHDM.js.map} +0 -0
- /package/dist/{chunk-YLU4H2H3.js.map → chunk-S3WWQTJC.js.map} +0 -0
- /package/dist/{chunk-OZWV27SE.js.map → chunk-T3DDFC2B.js.map} +0 -0
- /package/dist/{chunk-FO6MNXOF.js.map → chunk-T63LOFB2.js.map} +0 -0
- /package/dist/{chunk-E3YXGLEU.js.map → chunk-TC76MTNC.js.map} +0 -0
- /package/dist/{chunk-ZLOLC6WD.js.map → chunk-TMPCYEGS.js.map} +0 -0
- /package/dist/{chunk-O2TE5X25.js.map → chunk-U2PJNL3R.js.map} +0 -0
- /package/dist/{chunk-6E6Z6UQL.js.map → chunk-VBEFPLAN.js.map} +0 -0
- /package/dist/{chunk-CWVL7XZR.js.map → chunk-WQVXJMJM.js.map} +0 -0
- /package/dist/{chunk-4A445ALG.js.map → chunk-X4ZANRWU.js.map} +0 -0
- /package/dist/{chunk-V2IP2ZMD.js.map → chunk-X7RPFR6B.js.map} +0 -0
- /package/dist/{chunk-GNZKLUZW.js.map → chunk-XGL4TSEA.js.map} +0 -0
- /package/dist/{chunk-QGJA43DX.js.map → chunk-XH3NRZFD.js.map} +0 -0
- /package/dist/{chunk-2QZCPPVE.js.map → chunk-YKOB2LDR.js.map} +0 -0
- /package/dist/{chunk-QWYE3S3U.js.map → chunk-YL7EATZ7.js.map} +0 -0
- /package/dist/{cli-GND6TVRG.js.map → cli-2Q2OFLOI.js.map} +0 -0
- /package/dist/{cli-NWU77YRZ.js.map → cli-4OHXIGOF.js.map} +0 -0
- /package/dist/{cli-JHULEOH2.js.map → cli-4QKOQEWV.js.map} +0 -0
- /package/dist/{cli-PUO75R3L.js.map → cli-534K765K.js.map} +0 -0
- /package/dist/{cli-6UQ3QV2G.js.map → cli-5CUZEROV.js.map} +0 -0
- /package/dist/{cli-WUFQGIUG.js.map → cli-R3CS7V3H.js.map} +0 -0
- /package/dist/{cli-Q2RJMCVE.js.map → cli-TMMOVK3R.js.map} +0 -0
- /package/dist/{cli-LVHZCC2O.js.map → cli-WAXGGWNW.js.map} +0 -0
- /package/dist/{cli-GH42HLFK.js.map → cli-WRNKMNEM.js.map} +0 -0
- /package/dist/{cli-RUNYBUIV.js.map → cli-ZEOR6LL5.js.map} +0 -0
- /package/dist/{github-BV42LSW2.js.map → github-K2A4TNDE.js.map} +0 -0
- /package/dist/{github-XZ7OLATY.js.map → github-PXXYARFQ.js.map} +0 -0
- /package/dist/{json-LEEXKSGP.js.map → json-ELJ5D3VR.js.map} +0 -0
- /package/dist/{labels-E256WRAI.js.map → labels-CHN33A4X.js.map} +0 -0
- /package/dist/{lint-W4CM3EIO.js.map → lint-PYDL7IT7.js.map} +0 -0
- /package/dist/{list-TB4R6AP4.js.map → list-EIFNJKE5.js.map} +0 -0
- /package/dist/{list-UDDGL2OI.js.map → list-T2NPRQCA.js.map} +0 -0
- /package/dist/{page-L64NO57W.js.map → page-C4P4KFUL.js.map} +0 -0
- /package/dist/{prepare-GFTAYDTP.js.map → prepare-Q6Y4NCXU.js.map} +0 -0
- /package/dist/{pretty-HYCYKYHB.js.map → pretty-B52EGTKL.js.map} +0 -0
- /package/dist/{pretty-Q43TCD6D.js.map → pretty-XXMCA3SX.js.map} +0 -0
- /package/dist/{reporters-4HRBSMUF.js.map → reporters-3MDFUPKQ.js.map} +0 -0
- /package/dist/{reporters-E3FUVBQ6.js.map → reporters-6VOPV7L6.js.map} +0 -0
- /package/dist/{run-UDX2C54M.js.map → run-YFH7RPUR.js.map} +0 -0
- /package/dist/{sarif-WL353VTA.js.map → sarif-NXSMEW2M.js.map} +0 -0
- /package/dist/{sarif-XZFJ5VIJ.js.map → sarif-RBLPUGPH.js.map} +0 -0
- /package/dist/{term-OZ7ZR5KB.js.map → term-QIG4USZM.js.map} +0 -0
- /package/dist/{validate-CR3TI7GP.js.map → validate-W2XQYBSW.js.map} +0 -0
|
@@ -15,14 +15,18 @@
|
|
|
15
15
|
// `npx --no` would ask the registry on every hook in every repository
|
|
16
16
|
// without manni. Running node on a found bin also skips npx's start-up.
|
|
17
17
|
//
|
|
18
|
+
// The plugin's other scripts import `project`, `configFile`, `launch` and
|
|
19
|
+
// `pluginVersion` from here. Run as a script, it launches manni with its own
|
|
20
|
+
// arguments.
|
|
21
|
+
//
|
|
18
22
|
// Plain ESM with no dependencies: the plugin ships as files, not a package.
|
|
19
23
|
import { spawn, spawnSync } from "node:child_process";
|
|
20
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
24
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
21
25
|
import { dirname, join, resolve } from "node:path";
|
|
22
26
|
import { fileURLToPath } from "node:url";
|
|
23
27
|
|
|
24
28
|
const PACKAGE = "@hawkeyexl/manni";
|
|
25
|
-
const project = resolve(process.env.CLAUDE_PROJECT_DIR ?? process.cwd());
|
|
29
|
+
export const project = resolve(process.env.CLAUDE_PROJECT_DIR ?? process.cwd());
|
|
26
30
|
const windows = process.platform === "win32";
|
|
27
31
|
|
|
28
32
|
function readJson(file) {
|
|
@@ -102,22 +106,24 @@ function npmGlobalRoot() {
|
|
|
102
106
|
* agent's paths, which may hold a space or a cmd metacharacter. On Windows
|
|
103
107
|
* npx is a .cmd shim, so its own script runs under node instead.
|
|
104
108
|
*/
|
|
105
|
-
function npx(words) {
|
|
109
|
+
function npx(words, options) {
|
|
106
110
|
const script = join(dirname(process.execPath), "node_modules", "npm", "bin", "npx-cli.js");
|
|
107
|
-
if (windows && existsSync(script)) return spawn(process.execPath, [script, ...words],
|
|
108
|
-
if (!windows) return spawn("npx", words,
|
|
111
|
+
if (windows && existsSync(script)) return spawn(process.execPath, [script, ...words], options);
|
|
112
|
+
if (!windows) return spawn("npx", words, options);
|
|
109
113
|
// Last resort on an unusual Windows layout: each word quoted for cmd.
|
|
110
114
|
const quoted = words.map((w) => `"${w.replaceAll('"', '""')}"`).join(" ");
|
|
111
|
-
return spawn(`npx ${quoted}`, {
|
|
115
|
+
return spawn(`npx ${quoted}`, { ...options, shell: true });
|
|
112
116
|
}
|
|
113
117
|
|
|
114
|
-
/**
|
|
115
|
-
function
|
|
118
|
+
/** The project's manni config, found as manni finds one: up to the repository root. */
|
|
119
|
+
export function configFile() {
|
|
116
120
|
for (const d of upward(project)) {
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
for (const name of ["manni.config.yaml", "manni.config.yml"]) {
|
|
122
|
+
if (existsSync(join(d, name))) return join(d, name);
|
|
123
|
+
}
|
|
124
|
+
if (existsSync(join(d, ".git"))) return undefined;
|
|
119
125
|
}
|
|
120
|
-
return
|
|
126
|
+
return undefined;
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
/**
|
|
@@ -125,33 +131,53 @@ function configured() {
|
|
|
125
131
|
* installed plugin carries its plugin.json; were it missing, the caller asks
|
|
126
132
|
* for the bare package, so npx fetches the latest release, not a match.
|
|
127
133
|
*/
|
|
128
|
-
function pluginVersion() {
|
|
134
|
+
export function pluginVersion() {
|
|
129
135
|
const manifest = join(dirname(fileURLToPath(import.meta.url)), "..", ".claude-plugin", "plugin.json");
|
|
130
136
|
const version = readJson(manifest)?.version;
|
|
131
137
|
return typeof version === "string" ? version : undefined;
|
|
132
138
|
}
|
|
133
139
|
|
|
134
|
-
|
|
135
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Starts manni with `args` and returns the child, or `undefined` where no
|
|
142
|
+
* manni runs. `options` go to `spawn`, so a caller can set `stdio` and `cwd`.
|
|
143
|
+
*/
|
|
144
|
+
export function launch(args, options = { stdio: "inherit" }) {
|
|
136
145
|
const own = ownBuild();
|
|
137
146
|
if (own === false) return undefined;
|
|
138
|
-
const run = (cli) => spawn(process.execPath, [cli, ...args],
|
|
147
|
+
const run = (cli) => spawn(process.execPath, [cli, ...args], options);
|
|
139
148
|
const found = own ?? installed() ?? globalIn(defaultGlobalRoot());
|
|
140
149
|
if (found !== undefined) return run(found);
|
|
141
150
|
// Without a config manni has nothing to do here, so neither an npm
|
|
142
151
|
// start-up nor a download is worth paying for.
|
|
143
|
-
if (
|
|
152
|
+
if (configFile() === undefined) return undefined;
|
|
144
153
|
const configuredGlobal = globalIn(npmGlobalRoot());
|
|
145
154
|
if (configuredGlobal !== undefined) return run(configuredGlobal);
|
|
146
155
|
const version = pluginVersion();
|
|
147
|
-
return npx(["--yes", version === undefined ? PACKAGE : `${PACKAGE}@${version}`, ...args]);
|
|
156
|
+
return npx(["--yes", version === undefined ? PACKAGE : `${PACKAGE}@${version}`, ...args], options);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Whether `url`, a module's `import.meta.url`, is the script node was asked to run. */
|
|
160
|
+
export function isMain(url) {
|
|
161
|
+
if (process.argv[1] === undefined) return false;
|
|
162
|
+
const real = (path) => {
|
|
163
|
+
const r = realpathSync(path);
|
|
164
|
+
// Windows paths compare case-insensitively, drive letter included.
|
|
165
|
+
return windows ? r.toLowerCase() : r;
|
|
166
|
+
};
|
|
167
|
+
try {
|
|
168
|
+
return real(fileURLToPath(url)) === real(process.argv[1]);
|
|
169
|
+
} catch {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
148
172
|
}
|
|
149
173
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
child.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
174
|
+
if (isMain(import.meta.url)) {
|
|
175
|
+
const child = launch(process.argv.slice(2));
|
|
176
|
+
if (child === undefined) process.exit(0);
|
|
177
|
+
child.on("error", () => {
|
|
178
|
+
process.exitCode = 1;
|
|
179
|
+
});
|
|
180
|
+
child.on("exit", (code) => {
|
|
181
|
+
process.exitCode = code ?? 1;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Hands the agent a page's metadata when it reads the page: the fields kept
|
|
2
|
+
// in the page and in its sidecars, which a Read of the page alone does not
|
|
3
|
+
// show. Each session (and each subagent) is given a page's metadata once, and
|
|
4
|
+
// again only when it changes.
|
|
5
|
+
//
|
|
6
|
+
// PostToolUse on Read: looks the file up with `manni meta get`, and replies
|
|
7
|
+
// with additionalContext when the page belongs to a collection and has
|
|
8
|
+
// fields. SessionStart after a compaction: forgets what this session was
|
|
9
|
+
// given, so the next Read of each page carries its metadata again.
|
|
10
|
+
//
|
|
11
|
+
// Every other case is silent. It never blocks a Read and never writes to
|
|
12
|
+
// stderr, and it exits 0 whatever happens.
|
|
13
|
+
//
|
|
14
|
+
// Plain ESM with no dependencies: the plugin ships as files, not a package.
|
|
15
|
+
import { createHash } from "node:crypto";
|
|
16
|
+
import { mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
17
|
+
import { tmpdir } from "node:os";
|
|
18
|
+
import { extname, isAbsolute, join, relative, sep } from "node:path";
|
|
19
|
+
import { isMain, launch, project } from "./manni.mjs";
|
|
20
|
+
|
|
21
|
+
/** The extensions `manni meta` reads, lower case. */
|
|
22
|
+
export const EXTENSIONS = [
|
|
23
|
+
".md", ".markdown", ".mdx", ".adoc", ".asciidoc", ".rst",
|
|
24
|
+
".xml", ".dita", ".ditamap", ".html", ".htm",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
/** Whether meta reads a file with this path's extension. */
|
|
28
|
+
export function isDocument(path) {
|
|
29
|
+
return EXTENSIONS.includes(extname(path).toLowerCase());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const sha = (text) => createHash("sha256").update(text).digest("hex");
|
|
33
|
+
|
|
34
|
+
/** Where one session's hashes live. */
|
|
35
|
+
const sessionDir = (sessionId) => join(tmpdir(), "manni", "reads", sha(sessionId));
|
|
36
|
+
|
|
37
|
+
/** The path with Windows short names and links resolved, or as given. */
|
|
38
|
+
function real(path) {
|
|
39
|
+
try {
|
|
40
|
+
return realpathSync.native(path);
|
|
41
|
+
} catch {
|
|
42
|
+
return path;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function readStdin() {
|
|
47
|
+
try {
|
|
48
|
+
return JSON.parse(readFileSync(0, "utf8"));
|
|
49
|
+
} catch {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** The stored hash, or undefined. */
|
|
55
|
+
function readMarker(file) {
|
|
56
|
+
try {
|
|
57
|
+
return readFileSync(file, "utf8");
|
|
58
|
+
} catch {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function writeMarker(file, hash) {
|
|
64
|
+
mkdirSync(join(file, ".."), { recursive: true });
|
|
65
|
+
const temp = `${file}.${process.pid}.tmp`;
|
|
66
|
+
writeFileSync(temp, hash);
|
|
67
|
+
renameSync(temp, file);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** meta get's JSON for `rel`, or undefined on any failure. */
|
|
71
|
+
function lookUp(rel) {
|
|
72
|
+
return new Promise((done) => {
|
|
73
|
+
const child = launch(["meta", "get", "--all-fields", "--no-derived", "-f", "json", rel], {
|
|
74
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
75
|
+
cwd: project,
|
|
76
|
+
windowsHide: true,
|
|
77
|
+
});
|
|
78
|
+
if (child === undefined) return done(undefined);
|
|
79
|
+
let out = "";
|
|
80
|
+
child.stdout.setEncoding("utf8");
|
|
81
|
+
child.stdout.on("data", (chunk) => {
|
|
82
|
+
out += chunk;
|
|
83
|
+
});
|
|
84
|
+
child.on("error", () => done(undefined));
|
|
85
|
+
child.on("close", (code) => {
|
|
86
|
+
if (code !== 0) return done(undefined);
|
|
87
|
+
try {
|
|
88
|
+
done(JSON.parse(out));
|
|
89
|
+
} catch {
|
|
90
|
+
done(undefined);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async function onRead(envelope) {
|
|
97
|
+
const path = envelope.tool_input?.file_path;
|
|
98
|
+
if (typeof path !== "string" || typeof envelope.session_id !== "string" || !isDocument(path)) return;
|
|
99
|
+
const abs = real(path);
|
|
100
|
+
const rel = relative(real(project), abs);
|
|
101
|
+
if (rel === "" || rel.startsWith("..") || isAbsolute(rel)) return;
|
|
102
|
+
|
|
103
|
+
const entry = (await lookUp(rel.split(sep).join("/")))?.[0];
|
|
104
|
+
const { file, collections, values } = entry ?? {};
|
|
105
|
+
if (typeof file !== "string" || !Array.isArray(collections) || collections.length === 0) return;
|
|
106
|
+
if (typeof values !== "object" || values === null || Object.keys(values).length === 0) return;
|
|
107
|
+
|
|
108
|
+
const json = JSON.stringify(values);
|
|
109
|
+
const hash = sha(json);
|
|
110
|
+
// Claude Code sets `agent_id` on a hook fired inside a subagent, which has a
|
|
111
|
+
// context of its own. The outermost session carries none, so it is "main".
|
|
112
|
+
const marker = join(sessionDir(envelope.session_id), `${sha(envelope.agent_id ?? "main")}-${sha(abs)}`);
|
|
113
|
+
const stored = readMarker(marker);
|
|
114
|
+
if (stored === hash) return;
|
|
115
|
+
writeMarker(marker, hash);
|
|
116
|
+
const lead =
|
|
117
|
+
stored === undefined
|
|
118
|
+
? `Metadata for ${file}, from the page and its sidecars:`
|
|
119
|
+
: `Metadata for ${file} changed since it was last given here. This replaces it:`;
|
|
120
|
+
process.stdout.write(
|
|
121
|
+
JSON.stringify({ hookSpecificOutput: { hookEventName: "PostToolUse", additionalContext: `${lead}\n${json}` } }),
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function main() {
|
|
126
|
+
const envelope = readStdin();
|
|
127
|
+
if (typeof envelope !== "object" || envelope === null) return;
|
|
128
|
+
if (envelope.hook_event_name === "SessionStart") {
|
|
129
|
+
if (envelope.source === "compact" && typeof envelope.session_id === "string") {
|
|
130
|
+
rmSync(sessionDir(envelope.session_id), { recursive: true, force: true });
|
|
131
|
+
}
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (envelope.hook_event_name === "PostToolUse" && envelope.tool_name === "Read") await onRead(envelope);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (isMain(import.meta.url)) {
|
|
138
|
+
// exitCode rather than exit(), so a reply still in a pipe's buffer is not cut off.
|
|
139
|
+
main()
|
|
140
|
+
.catch(() => undefined)
|
|
141
|
+
.finally(() => {
|
|
142
|
+
process.exitCode = 0;
|
|
143
|
+
});
|
|
144
|
+
}
|
package/dist/check-XYGABPXI.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
renderCheck,
|
|
4
|
-
runCheck
|
|
5
|
-
} from "./chunk-YLU4H2H3.js";
|
|
6
|
-
import "./chunk-VV4YM6VM.js";
|
|
7
|
-
import "./chunk-GNZKLUZW.js";
|
|
8
|
-
import "./chunk-JFPCDIES.js";
|
|
9
|
-
import "./chunk-7RZQAMA2.js";
|
|
10
|
-
import "./chunk-SVB45M54.js";
|
|
11
|
-
import "./chunk-GLP5PSXB.js";
|
|
12
|
-
import "./chunk-V5QTIP2M.js";
|
|
13
|
-
import "./chunk-XTQTA262.js";
|
|
14
|
-
import "./chunk-GMOAW2EG.js";
|
|
15
|
-
import "./chunk-327CWO33.js";
|
|
16
|
-
import "./chunk-5VA3ZOB7.js";
|
|
17
|
-
import "./chunk-JHUEACRT.js";
|
|
18
|
-
import "./chunk-XKZZRG3Z.js";
|
|
19
|
-
import "./chunk-TIUTIOFB.js";
|
|
20
|
-
import "./chunk-3LZ6AYB4.js";
|
|
21
|
-
import "./chunk-TKINOTVS.js";
|
|
22
|
-
import "./chunk-UP6NBQ62.js";
|
|
23
|
-
import "./chunk-4KY2RUXQ.js";
|
|
24
|
-
import "./chunk-PLN2LJDM.js";
|
|
25
|
-
import "./chunk-27FP4KKD.js";
|
|
26
|
-
import "./chunk-JFB45L7D.js";
|
|
27
|
-
import "./chunk-FE3US7FR.js";
|
|
28
|
-
import "./chunk-QGJA43DX.js";
|
|
29
|
-
import "./chunk-MH5MX4B3.js";
|
|
30
|
-
import "./chunk-DSWKBZWW.js";
|
|
31
|
-
import "./chunk-OZWV27SE.js";
|
|
32
|
-
import "./chunk-77AINBYM.js";
|
|
33
|
-
import "./chunk-QK6VYJHV.js";
|
|
34
|
-
import "./chunk-RNVYGWIC.js";
|
|
35
|
-
import "./chunk-YEUYKR62.js";
|
|
36
|
-
import "./chunk-B2242FYO.js";
|
|
37
|
-
import "./chunk-HX44GB4Z.js";
|
|
38
|
-
import "./chunk-VM7VAFJW.js";
|
|
39
|
-
import "./chunk-PCTJ7P6U.js";
|
|
40
|
-
import "./chunk-OWBRDNRZ.js";
|
|
41
|
-
import "./chunk-G3T47CFV.js";
|
|
42
|
-
import "./chunk-2H7UOFLK.js";
|
|
43
|
-
export {
|
|
44
|
-
renderCheck,
|
|
45
|
-
runCheck
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=check-XYGABPXI.js.map
|