@pmelab/gtd 64.1.0 → 64.1.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.
@@ -1,5 +1,5 @@
1
1
  import { createHash, randomUUID } from "node:crypto";
2
- //#region src/wire/constants.ts
2
+ // src/wire/constants.ts
3
3
  /**
4
4
  * The top-level `schema` of every JSON document a driver reads. Bumped only
5
5
  * when a field is removed or renamed — never for an added one — and never tied
@@ -17,8 +17,7 @@ const renderFormat = (fmt, ...args) => {
17
17
  const ACCESS_REFUSAL = "gtd land: this turn wrote outside its write access — revert these paths, then run `gtd land` again:";
18
18
  /** Where a process keeps its pin: the engine and workflow it runs on, as `gtd bundle` prints them. */
19
19
  const PIN_PATH = ".gtd/process.gtdpin";
20
- //#endregion
21
- //#region src/wire/ExitCodes.ts
20
+ // src/wire/ExitCodes.ts
22
21
  const EXIT_OK = 0;
23
22
  /** Something failed that was never a matter of how gtd was invoked — a refusal or an unexpected error. */
24
23
  const EXIT_RUNTIME_ERROR = 1;
@@ -37,8 +36,7 @@ const EXIT_CODES = /* @__PURE__ */ new Set([
37
36
  130,
38
37
  143
39
38
  ]);
40
- //#endregion
41
- //#region src/wire/Demand.ts
39
+ // src/wire/Demand.ts
42
40
  /**
43
41
  * `BeatKind`'s own member list, as a value — the ONE place the five kinds are
44
42
  * enumerated. Every test that needs to loop "every kind" (the JSON document,
@@ -109,8 +107,7 @@ const demandOf = (input) => {
109
107
  content
110
108
  };
111
109
  };
112
- //#endregion
113
- //#region src/wire/BeatStatus.ts
110
+ // src/wire/BeatStatus.ts
114
111
  /**
115
112
  * Assemble one `BeatStatus`. `system` is omitted (not just falsy) when its
116
113
  * rendered value is the empty string, unlike `model`: an empty
@@ -140,8 +137,7 @@ const statusOf = (input) => {
140
137
  approvals
141
138
  };
142
139
  };
143
- //#endregion
144
- //#region src/wire/BeatDocument.ts
140
+ // src/wire/BeatDocument.ts
145
141
  /** `gtd next --json`'s `next` key — `null` when landing would commit nothing. */
146
142
  const nextField = (next) => next === null ? null : { target: next.target };
147
143
  /** Unreachable in a well-typed call — used as the `default` arm of an exhaustive switch over `Demand["kind"]`, so a future `BeatKind` member that isn't handled fails `tsc`, not just review. */
@@ -221,8 +217,7 @@ const beatDocument = (demand, status) => {
221
217
  };
222
218
  };
223
219
  const renderBeatJson = (document) => JSON.stringify(document) + "\n";
224
- //#endregion
225
- //#region src/wire/BeatPlain.ts
220
+ // src/wire/BeatPlain.ts
226
221
  /**
227
222
  * True when the per-model breakdown adds information beyond the `Cost:`
228
223
  * total: more than one model, or a single model that carries an actual
@@ -323,8 +318,7 @@ const renderBeatPlain = (document, selfValidateCommand) => {
323
318
  const body = beatHeaderLines(document).join("\n") + "\n\n" + content;
324
319
  return briefing.instructionLine !== void 0 ? `${briefing.instructionLine}\n` + body : body;
325
320
  };
326
- //#endregion
327
- //#region src/wire/Land.ts
321
+ // src/wire/Land.ts
328
322
  /** Assembles one `gtd land` result's fields in `LandFields`' declared order — the ONLY place `gtd land --json`'s wire shape is built. */
329
323
  const landFields = (input) => ({
330
324
  schema: 1,
@@ -352,22 +346,19 @@ const landProseText = (subject) => renderFormat(FMT_LAND_PROSE, subject);
352
346
  * passes its own two-word name so the hint stays runnable verbatim.
353
347
  */
354
348
  const renderLandPlain = (fields, command = "land") => fields.subject !== null ? `${landProseText(fields.subject).trimEnd()}\n(to land it: s=$(gtd ${command} --json=script) && sh -c "$s")\n` : noopText(fields.state);
355
- //#endregion
356
- //#region src/wire/Script.ts
349
+ // src/wire/Script.ts
357
350
  const scriptFields = (script) => ({
358
351
  schema: 1,
359
352
  script
360
353
  });
361
354
  const renderScriptJson = (fields) => JSON.stringify(fields) + "\n";
362
- //#endregion
363
- //#region src/wire/Judge.ts
355
+ // src/wire/Judge.ts
364
356
  const judgeJson = (state, questions) => JSON.stringify({
365
357
  schema: 1,
366
358
  state,
367
359
  questions
368
360
  });
369
- //#endregion
370
- //#region src/wire/Select.ts
361
+ // src/wire/Select.ts
371
362
  /**
372
363
  * Renders a fully-walked leaf value: scalars/booleans stringify directly,
373
364
  * arrays become one `JSON.stringify` per entry, newline-joined.
@@ -438,8 +429,7 @@ const selectPath = (fields, path) => {
438
429
  };
439
430
  }
440
431
  };
441
- //#endregion
442
- //#region src/wire/Sessions.ts
432
+ // src/wire/Sessions.ts
443
433
  /** Fixed forever — every derived session id descends from this one constant. */
444
434
  const GTD_SESSION_NAMESPACE = "ca4be249-805e-41c1-8b6a-75a11c011e25";
445
435
  const toBytes = (uuid) => Buffer.from(uuid.replace(/-/g, ""), "hex");
@@ -471,8 +461,7 @@ const resolveSession = (memoryKey, resume, mint = randomUUID) => memoryKey === v
471
461
  sessionId: uuidv5(GTD_SESSION_NAMESPACE, memoryKey),
472
462
  resume
473
463
  };
474
- //#endregion
475
- //#region src/wire/Glob.ts
464
+ // src/wire/Glob.ts
476
465
  const ESCAPE_RE = /[.+^${}()|[\]\\?]/g;
477
466
  const compile = (glob) => {
478
467
  let pattern = "^";
@@ -496,5 +485,4 @@ const compile = (glob) => {
496
485
  return new RegExp(`${pattern}$`, "s");
497
486
  };
498
487
  const globMatches = (path, glob) => compile(glob).test(path);
499
- //#endregion
500
488
  export { UNATTRIBUTED_MODEL as A, EXIT_RUNTIME_ERROR as C, EXIT_USAGE_ERROR as D, EXIT_STRAYS_FOUND as E, renderFormat as M, ACCESS_REFUSAL as O, EXIT_OK as S, EXIT_SIGTERM as T, BEAT_KINDS as _, renderScriptJson as a, stallDiagnosis as b, landProseText as c, renderLandPlain as d, DEMAND_BRIEFING as f, statusOf as g, renderBeatJson as h, judgeJson as i, WIRE_SCHEMA as j, PIN_PATH as k, noopText as l, beatDocument as m, resolveSession as n, scriptFields as o, renderBeatPlain as p, selectPath as r, landFields as s, globMatches as t, renderLandJson as u, beatKindOf as v, EXIT_SIGINT as w, EXIT_CODES as x, demandOf as y };
package/dist/flows.mjs CHANGED
@@ -1,2 +1 @@
1
- import { $ as run, A as FLOWS_PROTOCOL, B as head, C as moveScript, D as revertScript, E as restoreScript, F as changesSince, G as mark, I as codeThreads, J as openQuestions, L as envSettings, M as accessFor, N as agent, O as showScript, P as changes, Q as restart, R as envSettingsOf, S as checkScript, T as removeScript, U as judge, V as human, W as kept, X as read, Z as refuse, _ as requireRevert, a as defineWorkflow, at as skillsFor, b as wrote, c as check, ct as workflow, d as hasThreadFor, et as scope, f as judgeDiffShape, g as requireReplies, h as requireProgress, it as settingsOf, j as FlowsProtocolError, k as writeScript, l as codeChanges, m as requireAnswers, nt as sections, ot as start, p as numeric, q as matches, r as defineConfig, rt as settings, s as answered, st as threads, tt as sectionBodies, u as displayPath, v as requireThreadsClosed, w as quote, x as applyScript, y as seamGate, z as glob } from "./chunks/flows-B7ZRCe-B.mjs";
2
- export { FLOWS_PROTOCOL, FlowsProtocolError, accessFor, agent, answered, applyScript, changes, changesSince, check, checkScript, codeChanges, codeThreads, defineConfig, defineWorkflow, displayPath, envSettings, envSettingsOf, glob, hasThreadFor, head, human, judge, judgeDiffShape, kept, mark, matches, moveScript, numeric, openQuestions, quote, read, refuse, removeScript, requireAnswers, requireProgress, requireReplies, requireRevert, requireThreadsClosed, restart, restoreScript, revertScript, run, scope, seamGate, sectionBodies, sections, settings, settingsOf, showScript, skillsFor, start, threads, workflow, writeScript, wrote };
1
+ export { A as FLOWS_PROTOCOL, j as FlowsProtocolError, M as accessFor, N as agent, s as answered, x as applyScript, P as changes, F as changesSince, c as check, S as checkScript, l as codeChanges, I as codeThreads, r as defineConfig, a as defineWorkflow, u as displayPath, L as envSettings, R as envSettingsOf, z as glob, d as hasThreadFor, B as head, V as human, U as judge, f as judgeDiffShape, W as kept, G as mark, q as matches, C as moveScript, p as numeric, J as openQuestions, w as quote, X as read, Z as refuse, T as removeScript, m as requireAnswers, h as requireProgress, g as requireReplies, _ as requireRevert, v as requireThreadsClosed, Q as restart, E as restoreScript, D as revertScript, $ as run, et as scope, y as seamGate, tt as sectionBodies, nt as sections, rt as settings, it as settingsOf, O as showScript, at as skillsFor, ot as start, st as threads, ct as workflow, k as writeScript, b as wrote } from "./chunks/flows-dnIE_qbe.mjs";