@rolepod/uiproof 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -6,11 +6,18 @@ import { Page } from 'playwright';
6
6
  * Writes run artifacts. In **standalone** mode (default) — and in v0.4 and
7
7
  * earlier — runs live under `./.rolepod-uiproof/artifacts/{prefix}_{ts}_{uuid}/`.
8
8
  *
9
- * In **with-parent** mode — activated automatically when the env var
10
- * `ROLEPOD_PARENT=1` is set by the parent `rolepod` plugin's SessionStart
11
- * hook — runs live under `./.rolepod/evidence/{ts}-rolepod-uiproof-{skill}/`,
12
- * per the Extension Protocol v1 evidence-path convention. Parent's
13
- * `check-work` skill aggregates manifest.json files from this directory.
9
+ * In **with-parent** mode — activated automatically when the marker file
10
+ * `<git-root>/.rolepod/parent-active` exists (written by the parent
11
+ * `rolepod` plugin's v2.7+ SessionStart hook) — runs live under
12
+ * `<git-root>/.rolepod/evidence/{ts}-rolepod-uiproof-{skill}/`, per the
13
+ * Extension Protocol v1 evidence-path convention. Parent's `check-work`
14
+ * skill aggregates manifest.json files from this directory.
15
+ *
16
+ * Note: with-parent runs anchor at the git root (resolved via
17
+ * `git rev-parse --show-toplevel`), so a uiproof skill invoked from a
18
+ * subdirectory still lands under the worktree root where `check-work`
19
+ * looks. Standalone runs stay anchored at `process.cwd()` — same as
20
+ * pre-v0.6 behavior.
14
21
  *
15
22
  * Baselines for `visual_diff` always live in `./.rolepod-uiproof/baselines/`
16
23
  * regardless of mode — they are user-curated configuration, not per-run
@@ -56,7 +63,7 @@ declare class ArtifactStore {
56
63
  * Allocate a fresh run dir and ensure it exists.
57
64
  *
58
65
  * - standalone: `./.rolepod-uiproof/artifacts/{prefix}_{ts}_{uuid}/`
59
- * - with-parent: `./.rolepod/evidence/{ts}-rolepod-uiproof-{skill}/`
66
+ * - with-parent: `<git-root>/.rolepod/evidence/{ts}-rolepod-uiproof-{skill}/`
60
67
  *
61
68
  * `prefix` is preserved for back-compat with v0.5 callers; new callers
62
69
  * should also pass `opts.skill` so the with-parent path can be derived
@@ -1295,7 +1302,7 @@ declare class SessionRegistry {
1295
1302
  }
1296
1303
 
1297
1304
  declare const SERVER_NAME = "rolepod-uiproof";
1298
- declare const SERVER_VERSION = "0.6.0";
1305
+ declare const SERVER_VERSION = "0.6.2";
1299
1306
  type ServerHandle = {
1300
1307
  mcp: McpServer;
1301
1308
  registry: SessionRegistry;
package/dist/index.js CHANGED
@@ -25,18 +25,40 @@ var log = {
25
25
  }
26
26
  };
27
27
 
28
+ // src/util/rolepodProtocol.ts
29
+ import { execSync } from "child_process";
30
+ import { existsSync, readFileSync } from "fs";
31
+ import { join } from "path";
32
+ function detectRolepodParent(cwd = process.cwd()) {
33
+ let gitRoot = cwd;
34
+ try {
35
+ gitRoot = execSync("git rev-parse --show-toplevel", {
36
+ cwd,
37
+ encoding: "utf8",
38
+ stdio: ["ignore", "pipe", "ignore"]
39
+ }).trim();
40
+ } catch {
41
+ }
42
+ const file = join(gitRoot, ".rolepod", "parent-active");
43
+ if (!existsSync(file)) {
44
+ return { active: false, protocol: null, gitRoot };
45
+ }
46
+ const protocol = readFileSync(file, "utf8").trim().split(/\r?\n/)[0] ?? null;
47
+ return { active: true, protocol, gitRoot };
48
+ }
49
+
28
50
  // src/artifact/ArtifactStore.ts
29
51
  var ArtifactStore = class {
30
52
  rootDir;
31
53
  mode;
32
54
  baselineRoot;
33
55
  constructor(opts = {}) {
34
- const detectedParent = process.env.ROLEPOD_PARENT === "1";
35
- this.mode = opts.mode ?? (detectedParent ? "with-parent" : "standalone");
56
+ const parent = detectRolepodParent();
57
+ this.mode = opts.mode ?? (parent.active ? "with-parent" : "standalone");
36
58
  if (opts.rootDir !== void 0) {
37
59
  this.rootDir = opts.rootDir;
38
60
  } else if (this.mode === "with-parent") {
39
- this.rootDir = resolve(process.cwd(), ".rolepod", "evidence");
61
+ this.rootDir = resolve(parent.gitRoot, ".rolepod", "evidence");
40
62
  } else {
41
63
  this.rootDir = resolve(process.cwd(), ".rolepod-uiproof", "artifacts");
42
64
  }
@@ -46,7 +68,7 @@ var ArtifactStore = class {
46
68
  * Allocate a fresh run dir and ensure it exists.
47
69
  *
48
70
  * - standalone: `./.rolepod-uiproof/artifacts/{prefix}_{ts}_{uuid}/`
49
- * - with-parent: `./.rolepod/evidence/{ts}-rolepod-uiproof-{skill}/`
71
+ * - with-parent: `<git-root>/.rolepod/evidence/{ts}-rolepod-uiproof-{skill}/`
50
72
  *
51
73
  * `prefix` is preserved for back-compat with v0.5 callers; new callers
52
74
  * should also pass `opts.skill` so the with-parent path can be derived
@@ -3538,7 +3560,7 @@ function treeHasText(tree, text) {
3538
3560
  }
3539
3561
 
3540
3562
  // src/tools/composite/visual_diff.ts
3541
- import { existsSync } from "fs";
3563
+ import { existsSync as existsSync2 } from "fs";
3542
3564
  import { readFile as readFile2 } from "fs/promises";
3543
3565
  import { resolve as resolve4 } from "path";
3544
3566
  import pixelmatch from "pixelmatch";
@@ -3576,7 +3598,7 @@ var visualDiffTool = {
3576
3598
  ctx.store.baselineDir,
3577
3599
  `${args.baseline_id}.png`
3578
3600
  );
3579
- if (!existsSync(baselinePath)) {
3601
+ if (!existsSync2(baselinePath)) {
3580
3602
  await ctx.store.writeBytes(
3581
3603
  ctx.store.baselineDir,
3582
3604
  `${args.baseline_id}.png`,
@@ -3941,14 +3963,14 @@ var toolMetadata = {
3941
3963
 
3942
3964
  // src/server.ts
3943
3965
  var SERVER_NAME = "rolepod-uiproof";
3944
- var SERVER_VERSION = "0.6.0";
3966
+ var SERVER_VERSION = "0.6.2";
3945
3967
  var SUPPORTED_PROTOCOL = "v1";
3946
3968
  function checkProtocolCompat() {
3947
- const requested = process.env.ROLEPOD_PROTOCOL;
3948
- if (!requested) return;
3949
- if (requested !== SUPPORTED_PROTOCOL) {
3969
+ const parent = detectRolepodParent();
3970
+ if (!parent.active || !parent.protocol) return;
3971
+ if (parent.protocol !== SUPPORTED_PROTOCOL) {
3950
3972
  console.warn(
3951
- `rolepod protocol mismatch: expected ${SUPPORTED_PROTOCOL}, got ${requested}. Manifest will still be written in ${SUPPORTED_PROTOCOL} shape \u2014 parent may not parse it correctly.`
3973
+ `rolepod protocol mismatch: expected ${SUPPORTED_PROTOCOL}, got ${parent.protocol}. Manifest will still be written in ${SUPPORTED_PROTOCOL} shape \u2014 parent may not parse it correctly.`
3952
3974
  );
3953
3975
  }
3954
3976
  }