@brainervirus/workit-pi 8.19.0 → 8.19.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/workit.js CHANGED
@@ -23095,7 +23095,7 @@ var canonical2 = (file) => {
23095
23095
  let rest = "";
23096
23096
  for (let dir = path30.resolve(file);; dir = path30.dirname(dir)) {
23097
23097
  try {
23098
- return path30.join(realpathSync6(dir), rest);
23098
+ return path30.join(realpathSync6.native(dir), rest);
23099
23099
  } catch {
23100
23100
  if (path30.dirname(dir) === dir)
23101
23101
  return path30.resolve(file);
@@ -23315,18 +23315,26 @@ var CD2 = new Set(["cd", "chdir", "set-location", "sl"]);
23315
23315
  var PUSHD2 = new Set(["pushd", "push-location"]);
23316
23316
  var POPD2 = new Set(["popd", "pop-location"]);
23317
23317
  var cdInto = (dir, words) => {
23318
- const target = words.slice(1).find((word) => !word.startsWith("-") || word === "-");
23318
+ const named = words.slice(1).find((word) => !word.startsWith("-") || word === "-");
23319
+ const target = named === undefined ? undefined : homeExpanded(named);
23319
23320
  if (dir === undefined || target === "-" || target && /^~|[$`*?]/.test(target))
23320
23321
  return;
23321
23322
  return target === undefined ? os10.homedir() : path30.resolve(dir, target);
23322
23323
  };
23323
23324
  var quoteWord2 = (word) => /^[\w@%+=:,./-]+$/.test(word) ? word : `'${word.replaceAll("'", "'\\''")}'`;
23325
+ var homeExpanded = (file) => {
23326
+ const match = /^(?:~|\$HOME|\$\{HOME\})(?=\/|$)/.exec(file);
23327
+ return match ? (process.env.HOME || os10.homedir()) + file.slice(match[0].length) : file;
23328
+ };
23324
23329
  var segmentTargets = (cwd, command, dialect, depth = 0) => {
23325
23330
  const targets = [];
23326
23331
  let dir = cwd;
23327
23332
  let stack = [];
23328
23333
  const groups = [];
23329
- const at = (file) => path30.isAbsolute(file) ? file : dir === undefined ? null : path30.resolve(dir, file);
23334
+ const at = (file) => {
23335
+ const home = homeExpanded(file);
23336
+ return path30.isAbsolute(home) ? home : dir === undefined ? null : path30.resolve(dir, home);
23337
+ };
23330
23338
  for (const segment of segmentsOf(command, dialect)) {
23331
23339
  if (segment.group === "open") {
23332
23340
  groups.push({ dir, stack: [...stack] });
@@ -23431,7 +23439,39 @@ var claimAll = (owner, targets, deps) => {
23431
23439
  claimLiveSession(target, owner, deps);
23432
23440
  };
23433
23441
  var liveTargets = (cwd, paths) => paths?.length ? paths.map((file) => path30.resolve(cwd, file)) : [path30.join(cwd, DIR_TARGET)];
23442
+ var issuedTarget = (cwd, targets) => {
23443
+ const state = resolveStateDir();
23444
+ const found = targets.find((target) => underIssued(state, cwd, homeExpanded(target), process.platform, canonical2));
23445
+ return found ?? null;
23446
+ };
23447
+ var underIssued = (state, cwd, target, platform = process.platform, real = (file) => file) => {
23448
+ const win = platform === "win32";
23449
+ const p = win ? path30.win32 : path30.posix;
23450
+ const fold = (value) => win || platform === "darwin" ? value.toLowerCase() : value;
23451
+ const named = win ? target.replace(/^\/([a-zA-Z])(?=\/|$)/, "$1:") : target;
23452
+ const relative = p.relative(fold(real(p.resolve(state))), fold(real(p.resolve(cwd, named))));
23453
+ if (relative.startsWith("..") || p.isAbsolute(relative))
23454
+ return false;
23455
+ return relative.split(p.sep)[0].startsWith("issued");
23456
+ };
23457
+ var unquotedWindowsIssued = (command) => {
23458
+ if (process.platform !== "win32" || !command.includes("\\"))
23459
+ return false;
23460
+ const flat = (value) => value.replaceAll("\\", "/").toLowerCase();
23461
+ return flat(command).includes(`${flat(resolveStateDir())}/issued`) && shellWrites(command).writes;
23462
+ };
23463
+ var issuedDeny = (file) => {
23464
+ const unblock = "Issued ids and tokens are written only by Workit's SubagentStart hook. Run the verifier or reviewer agent so the host issues its own session; never edit the issued registries by hand.";
23465
+ return {
23466
+ kind: "deny",
23467
+ reason: `workit issued-registry guard: ${file} is under Workit's issued-session state. ${unblock}`,
23468
+ unblock
23469
+ };
23470
+ };
23434
23471
  function writeGate(cwd, paths, owner, deps) {
23472
+ const forged = paths?.length ? issuedTarget(cwd, paths) : null;
23473
+ if (forged)
23474
+ return issuedDeny(forged);
23435
23475
  if (!owner)
23436
23476
  return beforeWriteGate(cwd, paths);
23437
23477
  const targets = liveTargets(cwd, paths);
@@ -23444,6 +23484,11 @@ function writeGate(cwd, paths, owner, deps) {
23444
23484
  return decision;
23445
23485
  }
23446
23486
  function shellGate(cwd, command, owner, dialect = "posix", deps) {
23487
+ try {
23488
+ const forged = issuedTarget(cwd, segmentTargets(cwd, command, dialect)) ?? (unquotedWindowsIssued(command) ? "the issued registry" : null);
23489
+ if (forged)
23490
+ return issuedDeny(forged);
23491
+ } catch {}
23447
23492
  const writes = shellWrites(command);
23448
23493
  let targets = [];
23449
23494
  if (owner) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-pi",
3
- "version": "8.19.0",
3
+ "version": "8.19.2",
4
4
  "description": "Workit native extension for Pi — tools, method skills, and session continuity",
5
5
  "keywords": [
6
6
  "agentic-coding",
@@ -24,7 +24,10 @@ description: Build a requested change in small verified steps - follow local pat
24
24
  lease waits and names its holder (`workit lock status`).
25
25
  5. Prove the feature on its real surface with the project's `verify-<app>`
26
26
  skill; none yet? Write one (read the `workit-verify-app` skill's SKILL.md and follow it). Tests show branch behavior,
27
- not that the feature works.
27
+ not that the feature works. The report carries what you observed: a UI
28
+ change a screenshot or console/network check (chrome devtools or
29
+ agent-browser), an API a quoted real response. App not runnable? Say so
30
+ plainly, never claim success.
28
31
  6. Commit: `workit git commit -m "<type>: <what>" -- <paths>` (or `--all`).
29
32
  No endpoint named? Stop here and state the next command. Hand delivery to
30
33
  ship, which pushes and opens the PR with its body shape (read the `workit-ship` skill's SKILL.md and follow it), only
@@ -55,8 +58,7 @@ flag was never invoked)
55
58
 
56
59
  Good: "Added `--since`. measured: `workit check test` exit 0;
57
60
  `mytool log --since 2d` printed 3 entries against the fixture repo. inferred:
58
- the GitLab path behaves the same (shared parser, not run). Verification handed
59
- to the verifier agent."
61
+ the GitLab path behaves the same (not run). Handed to the verifier agent."
60
62
 
61
63
  ## Check
62
64
 
@@ -27,7 +27,10 @@ way a user would.
27
27
  - **Drive:** how to exercise it: CLI invocations, `curl` against routes, a
28
28
  browser tool for UI, with fixture data.
29
29
  - **Evidence:** what to capture (exit code, response body, screenshot path)
30
- and the command that records it.
30
+ and the command that records it. A UI is driven with chrome devtools or
31
+ agent-browser, with a screenshot or console/network observation; an API
32
+ with a real call, response quoted. The report carries the observation.
33
+ App not runnable? Say so plainly, never claim success.
31
34
  - **Cleanup:** stop processes, remove temp data.
32
35
  - **Feature map:** feature, how to drive it, expected observation.
33
36
  3. **Prove it end-to-end once:** launch, drive one feature, capture evidence,
@@ -54,7 +57,8 @@ report `clean`, `changed` (what) or `blocked` (why).
54
57
  Bad: "Verify by running the tests." (that is not the real surface)
55
58
 
56
59
  Good: "Launch `bun run dev` (ready: `listening on :5173`, 30 s). Drive:
57
- `curl -s localhost:5173/api/health` returns `{"ok":true}`. Evidence:
60
+ `curl -s localhost:5173/api/health` returned `{"ok":true}`; screenshot of
61
+ /settings at .workit-scratch/settings.png. Evidence:
58
62
  `workit check --name verify-web -- bun scripts/smoke.ts` exit 0."
59
63
 
60
64
  ## Check
@@ -30,6 +30,8 @@ description: Launch, drive and observe <app> on its real surface (<cli|web|api>)
30
30
  ## Evidence
31
31
  `workit check --name verify-<app> -- <driver command>` records exit code and log.
32
32
  Screenshots go to `<tmp dir>/verify-<app>/<feature>.png`; cite the path.
33
+ UI: also report a console or network observation. API: quote the real response.
34
+ If the app cannot be run, say so plainly instead of claiming success.
33
35
 
34
36
  ## Cleanup
35
37
  `<command>` (stop servers, remove `<tmp dir>`).