@krapht/ork 1.0.0-alpha.17 → 1.0.0-alpha.19

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.
Files changed (48) hide show
  1. package/dist/{__build_info__-C1Nm0hlJ.mjs → __build_info__-dPf4cEGL.mjs} +3 -134
  2. package/dist/{attach-EP374oMP.mjs → attach-BQl8nQz2.mjs} +5 -5
  3. package/dist/{attach-RQx__RzH.mjs → attach-DhZQ87Nz.mjs} +49 -224
  4. package/dist/bin.mjs +204 -154
  5. package/dist/{brief-Bs3cMQU0.mjs → brief-BQbeoPMc.mjs} +19 -9
  6. package/dist/{builtin-files-yYaNTQRU.mjs → builtin-files-CWL3JEo-.mjs} +1 -1
  7. package/dist/{command-tree-BkSYWmYJ.mjs → command-tree-B6uvMJq1.mjs} +1 -1
  8. package/dist/{completion-DIXWlnAl.mjs → completion-DKPuD_Rw.mjs} +47 -14
  9. package/dist/{context-Dq-VM_sq.mjs → context-Bw6R_EYq.mjs} +3 -3
  10. package/dist/detached-BQlbmqR0.mjs +38 -0
  11. package/dist/{find-k489laBa.mjs → find-B30-rd-u.mjs} +1 -1
  12. package/dist/flags-ByYBx-Xb.mjs +170 -0
  13. package/dist/{follow-ups-DD8NTPe6.mjs → follow-ups-Cxca1Jgg.mjs} +24 -18
  14. package/dist/{format-DQc9A_ei.mjs → format-C-nEZv-P.mjs} +27 -11
  15. package/dist/{help-groups-hB6kY34d.mjs → help-groups-BpRgBSTh.mjs} +13 -7
  16. package/dist/{in-a-run-D_9GlAlS.mjs → in-a-run-CZFzoT3R.mjs} +2 -2
  17. package/dist/{install-PVlV2QPq.mjs → install-CsqK1avz.mjs} +2 -183
  18. package/dist/{limits-CHqBO7wb.mjs → limits-CXh052II.mjs} +1 -1
  19. package/dist/{mcp-D38Ajb0b.mjs → mcp-B4wME9C4.mjs} +6 -6
  20. package/dist/{once-DuUzpzL2.mjs → once-BKn3pOtg.mjs} +3 -3
  21. package/dist/outputs-text-CNTJ7Qq_.mjs +19 -0
  22. package/dist/{pause-Bx3ePGrn.mjs → pause-B1grR1cl.mjs} +3 -3
  23. package/dist/{print-n2qetUHc.mjs → print-Bd8MWVJk.mjs} +1 -1
  24. package/dist/{project-records-Cune1l6I.mjs → project-records-BOEVs69i.mjs} +1 -1
  25. package/dist/{parse-BzWpMN-a.mjs → refusals-DQQX3AIb.mjs} +10 -1
  26. package/dist/{relay-D7RN4m68.mjs → relay-CeNiq3GT.mjs} +1 -1
  27. package/dist/{run-OOWQIKMJ.mjs → run-C0C54UiU.mjs} +116 -137
  28. package/dist/{run-BfxdsQJk.mjs → run-D6yU2rLf.mjs} +1 -1
  29. package/dist/{send-CKth_vgn.mjs → send-DqgF58hb.mjs} +2 -2
  30. package/dist/{src-DLsFsmOD.mjs → src-Ciy7i3se.mjs} +882 -71
  31. package/dist/{src-BHod38UQ.mjs → src-D2qpd-G7.mjs} +394 -247
  32. package/dist/{src-DmmrX2_C.mjs → src-DP02RP9O.mjs} +227 -180
  33. package/dist/{src-DOjTY2ET.mjs → src-n-u4TGev.mjs} +186 -43
  34. package/dist/{store-DACH768X.mjs → store-2KXzMCEN.mjs} +1 -1
  35. package/dist/ui/assets/app-C5vO1M-l.css +1 -0
  36. package/dist/ui/assets/{app-CN3acQ-1.js → app-ICEKpy_C.js} +21 -20
  37. package/dist/ui/assets/{index-B2uGxA4W.js → index-BGaix5wh.js} +2 -2
  38. package/dist/ui/index.html +1 -1
  39. package/dist/{ui-CJ-BX12n.mjs → ui-CAvygxTb.mjs} +53 -24
  40. package/dist/{usage-DxZ6JGd4.mjs → usage-BFBco5OS.mjs} +7 -7
  41. package/dist/{validate-BS0nCccW.mjs → validate-UrmC5AG1.mjs} +5 -5
  42. package/dist/{watch-Dp7IB4FR.mjs → watch-DTxkgB8R.mjs} +5 -5
  43. package/dist/{workflows-Djo1edlK.mjs → workflows-8GV-SeRm.mjs} +28 -4
  44. package/dist/{worktrees-Drof_Nyx.mjs → worktrees-CUdUvZlO.mjs} +9 -6
  45. package/package.json +1 -1
  46. package/dist/flags-B4ZZWspN.mjs +0 -125
  47. package/dist/post-2CaJz_mV.mjs +0 -46
  48. package/dist/ui/assets/app-9Q-62Ywz.css +0 -1
@@ -1,61 +1,7 @@
1
- import { Br as inside, Fr as placeFor, Gr as plainPathInside, Hr as LESSON_CAP_TOKENS, Kr as writePlainFile, Pr as placeFiles, Qn as FEEDBACK_SEVERITIES, Ur as estimateTokens, Wr as guardedBase, Zn as FEEDBACK_KINDS, ir as publishPost, lr as targetOf, sr as fingerprint, yr as maskSecrets } from "./src-DLsFsmOD.mjs";
1
+ import { $r as guardedBase, Qr as estimateTokens, Ur as placeFiles, Wr as placeFor, Yr as inside, Zr as LESSON_CAP_TOKENS, _r as feedbackActions, ei as plainPathInside, ti as writePlainFile } from "./src-Ciy7i3se.mjs";
2
2
  import path from "node:path";
3
3
  import { existsSync, readFileSync, realpathSync } from "node:fs";
4
4
  import { spawn } from "node:child_process";
5
- // ../core/src/feedback/actions.ts
6
- const ALLOWED = { ok: true };
7
- const no = (why, error) => ({
8
- ok: false,
9
- why,
10
- error
11
- });
12
- /** A dismissed item allows nothing until it's restored. */
13
- const dismissed = (short) => no("dismissed; restore it first", `${short} is dismissed; restore it first.`);
14
- const already = (short, status) => no(`${status} already`, `${short} is ${status} already.`);
15
- /**
16
- * `fixRun` is a running `ork:feedback-apply` run for the item ({@link
17
- * openFixRun}): a second fix isn't started beside it.
18
- */
19
- const feedbackActions = (item, fixRun) => {
20
- const short = item.id.slice(0, 12);
21
- const isOrk = item.target === "ork";
22
- if (item.status === "dismissed") {
23
- const check = dismissed(short);
24
- return {
25
- accept: check,
26
- lesson: check,
27
- apply: check,
28
- publish: check
29
- };
30
- }
31
- const settled = item.status === "resolved" || item.status === "published";
32
- const accept = item.status === "accepted" || settled ? already(short, item.status) : ALLOWED;
33
- let lesson = ALLOWED;
34
- if (isOrk) lesson = no("about Ork itself", `${short} is about Ork itself, so it isn't a lesson for a workflow; share it with Ork's maintainers instead.`);
35
- else if (item.workflows.length === 0) lesson = no("no workflow recorded, so no lessons file", `No workflow is recorded for ${short}, so it has no lessons file.`);
36
- let apply = ALLOWED;
37
- if (isOrk) apply = no("about Ork itself", `${short} is about Ork itself, so its fix isn't in this project; share it with Ork's maintainers instead.`);
38
- else if (settled) apply = already(short, item.status);
39
- else if (fixRun !== void 0) apply = no(`run ${fixRun} is proposing a fix`, `Run ${fixRun} is proposing a fix for ${short} already: answer its question in \`ork decide\` or the UI, or stop it first.`);
40
- let publish = ALLOWED;
41
- if (!isOrk) publish = no("only feedback about Ork is shared", `${short} is about this ${item.target}, not Ork itself: only feedback about Ork is shared, and the rest stays on your machine.`);
42
- else if (item.status === "published") publish = already(short, item.status);
43
- return {
44
- accept,
45
- lesson,
46
- apply,
47
- publish
48
- };
49
- };
50
- /** The running `ork:feedback-apply` run proposing a fix for `item`, if any. */
51
- const openFixRun = (store, item) => {
52
- const short = item.id.slice(0, 12);
53
- return store.runs().filter((run) => run.workflow === "ork-feedback-apply" && run.status === "running").find((run) => {
54
- const [first] = store.events(run.id);
55
- const event = first?.event;
56
- return event?.type === "run.started" && event.inputs?.["item"] === short;
57
- })?.id;
58
- };
59
5
  // ../core/src/feedback/lessons.ts
60
6
  /**
61
7
  * @file Accepting a feedback item as a lesson (specs/feedback.md, ADR-059): one
@@ -235,133 +181,6 @@ const lessonPlaceOf = (store, item, workflow, registered) => {
235
181
  exists
236
182
  };
237
183
  };
238
- // ../core/src/feedback/human.ts
239
- const RATINGS = ["good", "bad"];
240
- const MAX_TITLE = 120;
241
- /** The run event a note becomes; its title is the note's first line. */
242
- const humanNoteEvent = (note) => {
243
- const text = maskSecrets(note.text.trim());
244
- const [first = ""] = text.split("\n");
245
- const title = first.slice(0, MAX_TITLE);
246
- const kind = note.kind ?? "friction";
247
- const target = targetOf({
248
- kind,
249
- title,
250
- ...note.target === void 0 ? {} : { target: note.target }
251
- });
252
- const feedback = {
253
- source: "human",
254
- kind,
255
- target,
256
- severity: note.severity ?? (note.rating === "bad" ? "high" : "medium"),
257
- title,
258
- body: text,
259
- evidence: note.rating === void 0 ? [] : [`rating: ${note.rating}`],
260
- fingerprint: fingerprint({
261
- target,
262
- kind,
263
- title
264
- }),
265
- origin: { workflow: note.workflow }
266
- };
267
- return {
268
- type: "feedback.recorded",
269
- ...note.node === void 0 ? {} : { node: note.node },
270
- feedback
271
- };
272
- };
273
- /** `value` when it's one of `allowed`, or why not. */
274
- const checked = (name, value, allowed) => {
275
- if (value === void 0) return { ok: true };
276
- const found = allowed.find((a) => a === value);
277
- return found === void 0 ? {
278
- ok: false,
279
- error: `${name} is one of ${allowed.join(", ")}`
280
- } : {
281
- ok: true,
282
- value: found
283
- };
284
- };
285
- /**
286
- * Whether a note can be recorded, before anything else is done: its words,
287
- * kind, severity and rating. `flag` names the options as the caller does (`--`
288
- * for the CLI).
289
- */
290
- const checkNote = (ask, flag = "") => {
291
- if (ask.text.trim() === "") return {
292
- ok: false,
293
- error: "The note is empty."
294
- };
295
- const kind = checked(`${flag}kind`, ask.kind, FEEDBACK_KINDS);
296
- const severity = checked(`${flag}severity`, ask.severity, FEEDBACK_SEVERITIES);
297
- const rating = checked(`${flag}rating`, ask.rating, RATINGS);
298
- if (!kind.ok) return kind;
299
- if (!severity.ok) return severity;
300
- if (!rating.ok) return rating;
301
- return {
302
- ok: true,
303
- ...kind.value === void 0 ? {} : { kind: kind.value },
304
- ...severity.value === void 0 ? {} : { severity: severity.value },
305
- ...rating.value === void 0 ? {} : { rating: rating.value }
306
- };
307
- };
308
- /**
309
- * Records a person's note on `run`, or one node that ran in it, as that run's
310
- * feedback (a run that ended takes it too); returns the item it joins (the one
311
- * it was merged into, when triage merged it), or why it can't. `ork feedback
312
- * note`, `ork decide --note` and the UI write it.
313
- */
314
- const recordNote = (store, run, ask, flag = "") => {
315
- const note = checkNote(ask, flag);
316
- if (!note.ok) return note;
317
- const ran = store.events(run.id).some(({ event }) => "id" in event && event.id === ask.node);
318
- if (ask.node !== void 0 && !ran) return {
319
- ok: false,
320
- error: `No node ${ask.node} ran in run ${run.id}.`
321
- };
322
- const event = humanNoteEvent({
323
- text: ask.text,
324
- workflow: run.workflow,
325
- ...ask.node === void 0 ? {} : { node: ask.node },
326
- ...note.kind === void 0 ? {} : { kind: note.kind },
327
- ...note.severity === void 0 ? {} : { severity: note.severity },
328
- ...note.rating === void 0 ? {} : { rating: note.rating }
329
- });
330
- store.append(run.id, event);
331
- const recorded = event.type === "feedback.recorded" ? event.feedback.fingerprint : "";
332
- return {
333
- ok: true,
334
- item: store.findFeedback(recorded)[0]?.id ?? recorded
335
- };
336
- };
337
- // ../core/src/feedback/preview.ts
338
- /**
339
- * @file The preview of an `ork` item as a post to Ork's Discussions (ADR-059),
340
- * for `ork feedback publish` and the Feedback panel. The projects its records
341
- * came from and every registered one are rewritten to `<project>`, and when
342
- * names are hidden their folders' and the workflows' names go too. What the
343
- * person confirms is what is sent.
344
- */
345
- /** The item as a post, or why it isn't shared. */
346
- const previewPost = (store, item, ask) => {
347
- const allowed = feedbackActions(item).publish;
348
- if (!allowed.ok) return {
349
- ok: false,
350
- error: allowed.error
351
- };
352
- const records = store.feedbackRecords(item.id);
353
- const runRoots = records.flatMap((r) => store.lookup(r.runId).find((run) => run.id === r.runId)?.project ?? []);
354
- const roots = [.../* @__PURE__ */ new Set([...runRoots, ...ask.registered.map((p) => p.root)])];
355
- const names = ask.hideNames ? [...item.workflows, ...roots.map((root) => path.basename(root))] : [];
356
- return {
357
- ok: true,
358
- post: publishPost(item, records, {
359
- roots,
360
- home: ask.home,
361
- names
362
- })
363
- };
364
- };
365
184
  /**
366
185
  * Runs the command; resolves its exit code. Without `onOutput` it writes on the
367
186
  * terminal.
@@ -389,4 +208,4 @@ const runInstall = (argv, onOutput) => new Promise((resolve) => {
389
208
  resolve(code ?? 1);
390
209
  });
391
210
  });
392
- export { acceptItem as a, feedbackActions as c, recordNote as i, openFixRun as l, previewPost as n, lessonPlaceOf as o, checkNote as r, placeOf as s, runInstall as t };
211
+ export { placeOf as i, acceptItem as n, lessonPlaceOf as r, runInstall as t };
@@ -1,4 +1,4 @@
1
- import { _ as capsHere, dt as NOT_STARTED, ft as limitsNow, pt as limitsReport } from "./src-DLsFsmOD.mjs";
1
+ import { gt as limitsReport, ht as limitsNow, mt as NOT_STARTED, v as capsHere } from "./src-Ciy7i3se.mjs";
2
2
  // src/run/limits.ts
3
3
  /**
4
4
  * @file The limits across runs that apply here (RFC-007): the user's settings
@@ -1,8 +1,8 @@
1
- import { w as isNewer } from "./src-DLsFsmOD.mjs";
2
- import { n as ORK_VERSION } from "./__build_info__-C1Nm0hlJ.mjs";
3
- import { h as runMarkerIn } from "./src-DmmrX2_C.mjs";
4
- import { n as explainNode } from "./context-Dq-VM_sq.mjs";
5
- import { a as openMcp, c as refused, o as tool, s as answer } from "./src-DOjTY2ET.mjs";
1
+ import { T as isNewer } from "./src-Ciy7i3se.mjs";
2
+ import { h as runMarkerIn } from "./src-DP02RP9O.mjs";
3
+ import { n as ORK_VERSION } from "./__build_info__-dPf4cEGL.mjs";
4
+ import { n as explainNode } from "./context-Bw6R_EYq.mjs";
5
+ import { a as openMcp, c as refused, o as tool, s as answer } from "./src-n-u4TGev.mjs";
6
6
  import { z } from "zod";
7
7
  import { defineCommand } from "citty";
8
8
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -43,7 +43,7 @@ const orkMcpServer = (options = {}) => {
43
43
  ...options.script === void 0 ? {} : { script: options.script }
44
44
  });
45
45
  const all = [...opened.tools, explainTool(opened, options.home)];
46
- const tools = options.expects !== void 0 && isNewer(options.expects, "1.0.0-alpha.17") ? tooOld(all, options.expects) : all;
46
+ const tools = options.expects !== void 0 && isNewer(options.expects, "1.0.0-alpha.19") ? tooOld(all, options.expects) : all;
47
47
  const server = new McpServer({
48
48
  name: "ork",
49
49
  version: ORK_VERSION
@@ -1,7 +1,7 @@
1
- import "./src-DLsFsmOD.mjs";
2
- import { t as runOnce } from "./run-BfxdsQJk.mjs";
1
+ import "./src-Ciy7i3se.mjs";
2
+ import { t as runOnce } from "./run-D6yU2rLf.mjs";
3
3
  import { c as write, l as writeErr, s as style } from "./output-B1kwo0YU.mjs";
4
- import { t as ago } from "./format-DQc9A_ei.mjs";
4
+ import { t as ago } from "./format-C-nEZv-P.mjs";
5
5
  import { spawn } from "node:child_process";
6
6
  import { defineCommand, parseArgs } from "citty";
7
7
  // src/commands/once.ts
@@ -0,0 +1,19 @@
1
+ import { stripVTControlCharacters } from "node:util";
2
+ const OUTPUT_MAX_CHARS = 2e3;
3
+ /** Escapes stripped, other control characters (not line breaks, tabs) blanked. */
4
+ const scrub = (value) => stripVTControlCharacters(value).replaceAll(/[^\P{Cc}\n\t]|\p{Bidi_Control}/gu, " ");
5
+ /**
6
+ * The declared outputs in key order, each scrubbed and cut to
7
+ * {@link OUTPUT_MAX_LINES} lines and {@link OUTPUT_MAX_CHARS} characters; empty
8
+ * when there are none.
9
+ */
10
+ const outputsText = (outputs) => Object.entries(outputs ?? {}).map(([name, value]) => {
11
+ const clean = scrub(value.replaceAll("\r\n", "\n")).trimEnd();
12
+ const text = clean.split("\n").slice(0, 20).join("\n").slice(0, OUTPUT_MAX_CHARS);
13
+ return {
14
+ name,
15
+ text,
16
+ cut: text.length < clean.length
17
+ };
18
+ });
19
+ export { outputsText as t };
@@ -1,7 +1,7 @@
1
- import { Dn as requestPause, En as requestContinue, L as openStore } from "./src-DLsFsmOD.mjs";
2
- import { t as findRun } from "./find-k489laBa.mjs";
1
+ import { An as requestPause, R as openStore, kn as requestContinue } from "./src-Ciy7i3se.mjs";
2
+ import { t as findRun } from "./find-B30-rd-u.mjs";
3
3
  import { c as write, l as writeErr, s as style } from "./output-B1kwo0YU.mjs";
4
- import { i as continueRefusal } from "./in-a-run-D_9GlAlS.mjs";
4
+ import { i as continueRefusal } from "./in-a-run-CZFzoT3R.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  // src/commands/pause.ts
7
7
  /**
@@ -1,5 +1,5 @@
1
1
  import { c as write } from "./output-B1kwo0YU.mjs";
2
- import { a as refuseIdsWithJson } from "./flags-B4ZZWspN.mjs";
2
+ import { a as refuseIdsWithJson } from "./flags-ByYBx-Xb.mjs";
3
3
  // src/list/print.ts
4
4
  /**
5
5
  * Prints `rows`: `--ids` their ids (`table.id`) comma-separated; `--json` the
@@ -1,4 +1,4 @@
1
- import { Ir as projectsHome, L as openStore, Mr as inRepoPlace, Nr as newProjectId, Pr as placeFiles, Rr as shownPath, Vr as projectRootOf, jr as hasInRepoFiles } from "./src-DLsFsmOD.mjs";
1
+ import { Br as hasInRepoFiles, Gr as projectsHome, Hr as newProjectId, R as openStore, Ur as placeFiles, Vr as inRepoPlace, Xr as projectRootOf, qr as shownPath } from "./src-Ciy7i3se.mjs";
2
2
  import { C as termOf, c as write, l as writeErr, s as style, w as cut } from "./output-B1kwo0YU.mjs";
3
3
  import { n as chip } from "./chips-BqcT58qr.mjs";
4
4
  import path from "node:path";
@@ -104,4 +104,13 @@ const parseLimit = (text) => {
104
104
  const limit = Number(text);
105
105
  return Number.isSafeInteger(limit) ? limit : null;
106
106
  };
107
- export { parseLimit as n, agoTime as r, parseFilters as t };
107
+ // ../core/src/list-filters/refusals.ts
108
+ /**
109
+ * @file The sentences a list refuses with, shared so `ork` and `ork mcp` say
110
+ * the same words (the server cannot import the CLI).
111
+ */
112
+ /** The refusal for a `--limit` that is not a positive whole number in digits. */
113
+ const limitRefusal = (text) => `--limit takes a positive whole number written in digits, not \`${text}\`.`;
114
+ /** The refusal for a `--project` that names no registered project. */
115
+ const unknownProjectRefusal = (key, ids) => `No registered project \`${key}\`; registered: ${ids.length === 0 ? "none" : ids.join(", ")}.`;
116
+ export { agoTime as a, parseLimit as i, unknownProjectRefusal as n, parseFilters as r, limitRefusal as t };
@@ -1,4 +1,4 @@
1
- import { L as openStore, Sn as addressOf, Tn as unlinkNodes, wn as linkNodes } from "./src-DLsFsmOD.mjs";
1
+ import { Dn as linkNodes, On as unlinkNodes, R as openStore, Tn as addressOf } from "./src-Ciy7i3se.mjs";
2
2
  import { c as write, l as writeErr, s as style } from "./output-B1kwo0YU.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  // src/commands/relay.ts