@demlik/tea 0.7.0 → 0.9.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.
Files changed (98) hide show
  1. package/dist/chart/index.d.ts +72 -789
  2. package/dist/chart/index.js +4 -232
  3. package/dist/chart/index.js.map +1 -1
  4. package/dist/chart/inspect/index.d.ts +85 -0
  5. package/dist/chart/inspect/index.js +5 -0
  6. package/dist/chart/inspect/index.js.map +1 -0
  7. package/dist/chart/inspect/react.d.ts +112 -0
  8. package/dist/chart/inspect/react.js +11 -0
  9. package/dist/chart/inspect/react.js.map +1 -0
  10. package/dist/chart/inspect/styles.css +286 -0
  11. package/dist/chart/lane/index.d.ts +361 -0
  12. package/dist/chart/lane/index.js +9 -0
  13. package/dist/chart/lane/index.js.map +1 -0
  14. package/dist/chart/lane/react.d.ts +83 -0
  15. package/dist/chart/lane/react.js +559 -0
  16. package/dist/chart/lane/react.js.map +1 -0
  17. package/dist/chart/lane/server.d.ts +79 -0
  18. package/dist/chart/lane/server.js +118 -0
  19. package/dist/chart/lane/server.js.map +1 -0
  20. package/dist/chart/lane/styles.css +498 -0
  21. package/dist/chart/lane/viewer/assets/abnfDiagram-N423BO3Z-C729LI31.js +1 -0
  22. package/dist/chart/lane/viewer/assets/architectureDiagram-T3A2C74G-C729LI31.js +1 -0
  23. package/dist/chart/lane/viewer/assets/blockDiagram-VBNYF7ZC-C729LI31.js +1 -0
  24. package/dist/chart/lane/viewer/assets/c4Diagram-5PPSVZJV-C729LI31.js +1 -0
  25. package/dist/chart/lane/viewer/assets/chunk-2GRJ4B5K-HdDf8SI3.js +1 -0
  26. package/dist/chart/lane/viewer/assets/chunk-5RXB4S5H-IPzIfiJ6.js +231 -0
  27. package/dist/chart/lane/viewer/assets/chunk-5VM5RSS4-BP4fRS_5.js +15 -0
  28. package/dist/chart/lane/viewer/assets/chunk-KBJHAD2P-DZOw7xU6.js +1 -0
  29. package/dist/chart/lane/viewer/assets/chunk-NSK5VX7P-CBCyTZMs.js +128 -0
  30. package/dist/chart/lane/viewer/assets/classDiagram-JCYQIIEL-C729LI31.js +1 -0
  31. package/dist/chart/lane/viewer/assets/classDiagram-v2-OCEON4UE-DnUXz1Pv.js +206 -0
  32. package/dist/chart/lane/viewer/assets/cose-bilkent-JH36ORCC-DOwCrGXH.js +1 -0
  33. package/dist/chart/lane/viewer/assets/cynefinDiagram-MW4NZA55-C729LI31.js +1 -0
  34. package/dist/chart/lane/viewer/assets/dagre-K_PewWfS.js +1 -0
  35. package/dist/chart/lane/viewer/assets/dagre-VZM6K2ZE-Og2UIoWg.js +4 -0
  36. package/dist/chart/lane/viewer/assets/diagram-7IWD3JNH-C729LI31.js +1 -0
  37. package/dist/chart/lane/viewer/assets/diagram-B4RE2ZJO-C729LI31.js +1 -0
  38. package/dist/chart/lane/viewer/assets/diagram-LBJQPF4R-C729LI31.js +1 -0
  39. package/dist/chart/lane/viewer/assets/diagram-Q27KOJAE-C729LI31.js +1 -0
  40. package/dist/chart/lane/viewer/assets/diagram-UB23O5K3-C729LI31.js +1 -0
  41. package/dist/chart/lane/viewer/assets/ebnfDiagram-BXEA7PRR-C729LI31.js +1 -0
  42. package/dist/chart/lane/viewer/assets/erDiagram-JOGREHBK-C729LI31.js +1 -0
  43. package/dist/chart/lane/viewer/assets/flowDiagram-UKHOOZJN-C729LI31.js +1 -0
  44. package/dist/chart/lane/viewer/assets/ganttDiagram-PKOTCBZU-C729LI31.js +1 -0
  45. package/dist/chart/lane/viewer/assets/gitGraphDiagram-DS77QQ5N-C729LI31.js +1 -0
  46. package/dist/chart/lane/viewer/assets/index-Obj05Jex.js +195 -0
  47. package/dist/chart/lane/viewer/assets/index-sP-6AD57.css +1 -0
  48. package/dist/chart/lane/viewer/assets/infoDiagram-6WML65LV-C729LI31.js +1 -0
  49. package/dist/chart/lane/viewer/assets/ishikawaDiagram-WSZJBQD7-C729LI31.js +1 -0
  50. package/dist/chart/lane/viewer/assets/journeyDiagram-NVQOT4AX-C729LI31.js +1 -0
  51. package/dist/chart/lane/viewer/assets/kanban-definition-27J2QSJJ-CxkCxJUN.js +89 -0
  52. package/dist/chart/lane/viewer/assets/katex-DOwCrGXH.js +1 -0
  53. package/dist/chart/lane/viewer/assets/mindmap-definition-FAOFIHXS-DvgvXZhp.js +96 -0
  54. package/dist/chart/lane/viewer/assets/path-fybaL0A-.js +1 -0
  55. package/dist/chart/lane/viewer/assets/pegDiagram-VL7TDLO6-C729LI31.js +1 -0
  56. package/dist/chart/lane/viewer/assets/pieDiagram-7S7Q4E2Y-C729LI31.js +1 -0
  57. package/dist/chart/lane/viewer/assets/quadrantDiagram-CIZ2JOQS-C729LI31.js +1 -0
  58. package/dist/chart/lane/viewer/assets/railroadDiagram-AXF67PYL-C729LI31.js +1 -0
  59. package/dist/chart/lane/viewer/assets/requirementDiagram-LRYGKXZP-C729LI31.js +1 -0
  60. package/dist/chart/lane/viewer/assets/sankeyDiagram-W5VNT64P-C729LI31.js +1 -0
  61. package/dist/chart/lane/viewer/assets/sequenceDiagram-SI44F4Z6-C729LI31.js +1 -0
  62. package/dist/chart/lane/viewer/assets/stateDiagram-OKZ733FA-CIZQWK5X.js +1 -0
  63. package/dist/chart/lane/viewer/assets/stateDiagram-v2-UEYNNEHI-Sm6p0NoR.js +1 -0
  64. package/dist/chart/lane/viewer/assets/swimlanes-SLNWSIFB-B4xK-rwg.js +1 -0
  65. package/dist/chart/lane/viewer/assets/swimlanesDiagram-ULZ7WXOC-C729LI31.js +1 -0
  66. package/dist/chart/lane/viewer/assets/timeline-definition-Z64GVDOM-CV3KwSb-.js +120 -0
  67. package/dist/chart/lane/viewer/assets/vennDiagram-T6HMQDX7-C729LI31.js +1 -0
  68. package/dist/chart/lane/viewer/assets/wardleyDiagram-T6FBY63Y-C729LI31.js +1 -0
  69. package/dist/chart/lane/viewer/assets/xychartDiagram-ELKLHX3M-C729LI31.js +1 -0
  70. package/dist/chart/lane/viewer/index.html +15 -0
  71. package/dist/chart/report/index.d.ts +116 -0
  72. package/dist/chart/report/index.js +32 -0
  73. package/dist/chart/report/index.js.map +1 -0
  74. package/dist/chunk-5KJKJOFC.js +758 -0
  75. package/dist/chunk-5KJKJOFC.js.map +1 -0
  76. package/dist/chunk-E6GEDSF4.js +307 -0
  77. package/dist/chunk-E6GEDSF4.js.map +1 -0
  78. package/dist/chunk-JER5O7PQ.js +416 -0
  79. package/dist/chunk-JER5O7PQ.js.map +1 -0
  80. package/dist/chunk-UOC2PL46.js +13 -0
  81. package/dist/chunk-UOC2PL46.js.map +1 -0
  82. package/dist/chunk-WRAA7GVZ.js +209 -0
  83. package/dist/chunk-WRAA7GVZ.js.map +1 -0
  84. package/dist/chunk-ZCL7SCBK.js +685 -0
  85. package/dist/chunk-ZCL7SCBK.js.map +1 -0
  86. package/dist/chunk-ZD6PNZBK.js +457 -0
  87. package/dist/chunk-ZD6PNZBK.js.map +1 -0
  88. package/dist/devtools/index.js +2 -207
  89. package/dist/devtools/index.js.map +1 -1
  90. package/dist/fold-Blbhru48.d.ts +435 -0
  91. package/dist/graph-CcjWZVrd.d.ts +923 -0
  92. package/dist/machine-viz/index.d.ts +18 -1
  93. package/dist/machine-viz/index.js +2 -8
  94. package/dist/machine-viz/index.js.map +1 -1
  95. package/dist/reducer-BqyoVyBG.d.ts +447 -0
  96. package/dist/run-BVeqJDBF.d.ts +713 -0
  97. package/dist/samples-DCt6nF8H.d.ts +59 -0
  98. package/package.json +35 -3
@@ -0,0 +1,116 @@
1
+ import { WalkCounts } from '../index.js';
2
+ export { edgeKey } from '../index.js';
3
+ import { a as ImportedChart, L as LogEntry, b as LaneStatus, I as ImportedLane, W as WorkflowImportOptions } from '../../fold-Blbhru48.js';
4
+ export { c as ImportedEdge, d as ImportedNode, e as ImportedPhase, f as LeafStates, g as PhaseStand, P as PhaseStanding, T as TaskState, h as TimelineStep, U as UnreplayableLogError, i as WorkflowImportError, j as bareEvent, k as chartFromWorkflow, l as chartFromWorkflowText, m as deriveLaneStatus, n as endPolarityOf, o as eventAlphabet, p as foldLane, q as initialOf, r as initialStates, s as laneTerminalReached, t as originOf, u as parseEventsJsonl, v as parseHistoryJson, w as parseStatusJson, x as phaseStandings, y as statesOf, z as stepTask, A as timeline, B as trippedTasks, C as walkedEdgeKey } from '../../fold-Blbhru48.js';
5
+ import '../../core-Bjc0bS8j.js';
6
+ import '../../graph-CcjWZVrd.js';
7
+
8
+ interface DrawOptions {
9
+ /** The state the task is in right now — lit. */
10
+ readonly current?: string;
11
+ /** Edges the log actually walked, keyed `${from}|${event}|${to}`. */
12
+ readonly walked?: WalkCounts;
13
+ }
14
+ /**
15
+ * One task's region as a mermaid `stateDiagram-v2` block, with the current node
16
+ * lit, the walked edges marked and the two endings drawn apart.
17
+ *
18
+ * `polarity` is always on: a lane's whole point is that `shipped` and `frozen`
19
+ * are not the same ending, and a report that painted them alike would be lying
20
+ * in the place a reader looks first. It is an OPTION on the renderer rather
21
+ * than a default because a chart drawing is something a reviewer approves —
22
+ * see `ChartMermaidOptions.polarity`.
23
+ */
24
+ declare function drawTask(chart: ImportedChart, opts?: DrawOptions): string;
25
+ /**
26
+ * The edges a log walked, counted — the input `drawTask` marks from.
27
+ *
28
+ * Reads each step's DECLARED `edge` rather than recomputing one from
29
+ * `from`/`event`/`to`: a resume edge is drawn to its fallback and walked to
30
+ * wherever `was` pointed, so the observed target names an edge the drawing does
31
+ * not have. `TimelineStep.edge` is the edge that actually fired.
32
+ */
33
+ declare function walkedEdges(steps: readonly {
34
+ readonly edge: string;
35
+ }[]): WalkCounts;
36
+
37
+ /** The lane the report is about. `workflow` is the PARSED document, or an import. */
38
+ interface LaneReportInput {
39
+ /** `workflow.json`, parsed — or an already-imported lane, reused as is. */
40
+ readonly workflow: unknown;
41
+ readonly entries: readonly LogEntry[];
42
+ /**
43
+ * `lane status`'s answer.
44
+ *
45
+ * OPTIONAL, and that is the whole shape of the two input paths: a caller
46
+ * shelling out to `fabrika` hands over the CLI's own derivation and the
47
+ * report never second-guesses it; a caller holding only the two files omits
48
+ * it and the same derivation runs here.
49
+ */
50
+ readonly status?: LaneStatus;
51
+ /** Heading for the block. Defaults to the document's `id`. */
52
+ readonly title?: string;
53
+ }
54
+ interface LaneReport {
55
+ readonly markdown: string;
56
+ }
57
+ /**
58
+ * What this task is waiting on — or `null` at a final.
59
+ *
60
+ * DERIVED, entirely: the events this state routes, grouped by the origin each
61
+ * one DECLARES, in declaration order. Nothing here knows a state name, an event
62
+ * name or a job title, so a consumer that renames half its states changes this
63
+ * output correctly and a consumer with a completely different cast is served by
64
+ * the same function.
65
+ *
66
+ * The degradation is the point of the second half. Provenance is not in
67
+ * `workflow.json` — it is stated at the import boundary or not at all — so a
68
+ * chart imported without it must say what it actually knows, which is WHICH
69
+ * EVENTS the state accepts. It never says who sends them.
70
+ */
71
+ declare function waitingOn(chart: ImportedChart, state: string): string | null;
72
+ /**
73
+ * A lane, as one markdown block.
74
+ *
75
+ * The diagram half is behind {@link drawTask}, which is a translation onto
76
+ * `chartMermaid` — the package's one chart renderer.
77
+ */
78
+ declare function laneReport(input: LaneReportInput): LaneReport;
79
+
80
+ /** Everything a report needs, however it was obtained. */
81
+ interface LaneSource {
82
+ readonly workflow: ImportedLane;
83
+ readonly entries: readonly LogEntry[];
84
+ /** Present only on the CLI path — the driver's own answer, not ours. */
85
+ readonly status?: LaneStatus;
86
+ }
87
+ /**
88
+ * PATH 1 — the two files.
89
+ *
90
+ * @param workflowJson the bytes of `<lane>/workflow.json`
91
+ * @param eventsJsonl the bytes of `<lane>/events.jsonl` (`""` for a fresh lane)
92
+ * @param options {@link WorkflowImportOptions} — carried straight through
93
+ * to the importer, which is the one place it is read.
94
+ */
95
+ declare function laneFromFiles(workflowJson: string, eventsJsonl: string, options?: WorkflowImportOptions): LaneSource;
96
+ /**
97
+ * PATH 2 — the CLI's stdout.
98
+ *
99
+ * const dir = ".fabrika/lanes/5842";
100
+ * const src = laneFromCli(
101
+ * readFileSync(`${dir}/workflow.json`, "utf8"),
102
+ * execFileSync("fabrika", ["lane", "status", "--lane", "5842"], { encoding: "utf8" }),
103
+ * execFileSync("fabrika", ["lane", "history", "--lane", "5842"], { encoding: "utf8" }),
104
+ * );
105
+ * console.log(laneReport(reportInput(src)).markdown);
106
+ *
107
+ * @param workflowJson the bytes of `<lane>/workflow.json`
108
+ * @param statusStdout `fabrika lane status`'s stdout — `JSON.stringify(status, null, 2)`
109
+ * @param historyStdout `fabrika lane history`'s stdout — the log as a JSON array
110
+ * @param options {@link WorkflowImportOptions} — the same seam as path 1's.
111
+ */
112
+ declare function laneFromCli(workflowJson: string, statusStdout: string, historyStdout: string, options?: WorkflowImportOptions): LaneSource;
113
+ /** A `LaneSource` as the report's input. One line, so neither path spells it. */
114
+ declare function reportInput(source: LaneSource, title?: string): LaneReportInput;
115
+
116
+ export { type DrawOptions, ImportedChart, ImportedLane, type LaneReport, type LaneReportInput, type LaneSource, LaneStatus, LogEntry, WalkCounts, WorkflowImportOptions, drawTask, laneFromCli, laneFromFiles, laneReport, reportInput, waitingOn, walkedEdges };
@@ -0,0 +1,32 @@
1
+ import { parseEventsJsonl, chartFromWorkflowText, parseStatusJson, parseHistoryJson } from '../../chunk-5KJKJOFC.js';
2
+ export { UnreplayableLogError, WorkflowImportError, bareEvent, chartFromWorkflow, chartFromWorkflowText, deriveLaneStatus, drawTask, endPolarityOf, eventAlphabet, foldLane, initialOf, initialStates, laneReport, laneTerminalReached, originOf, parseEventsJsonl, parseHistoryJson, parseStatusJson, phaseStandings, statesOf, stepTask, timeline, trippedTasks, waitingOn, walkedEdgeKey, walkedEdges } from '../../chunk-5KJKJOFC.js';
3
+ export { edgeKey } from '../../chunk-E6GEDSF4.js';
4
+ import '../../chunk-UOC2PL46.js';
5
+ import '../../chunk-B5VXOFMZ.js';
6
+
7
+ // src/chart/report/sources.ts
8
+ function laneFromFiles(workflowJson, eventsJsonl, options = {}) {
9
+ return {
10
+ workflow: chartFromWorkflowText(workflowJson, options),
11
+ entries: parseEventsJsonl(eventsJsonl)
12
+ };
13
+ }
14
+ function laneFromCli(workflowJson, statusStdout, historyStdout, options = {}) {
15
+ return {
16
+ workflow: chartFromWorkflowText(workflowJson, options),
17
+ entries: parseHistoryJson(historyStdout),
18
+ status: parseStatusJson(statusStdout)
19
+ };
20
+ }
21
+ function reportInput(source, title) {
22
+ return {
23
+ workflow: source.workflow,
24
+ entries: source.entries,
25
+ ...source.status === void 0 ? {} : { status: source.status },
26
+ ...title === void 0 ? {} : { title }
27
+ };
28
+ }
29
+
30
+ export { laneFromCli, laneFromFiles, reportInput };
31
+ //# sourceMappingURL=index.js.map
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/chart/report/sources.ts"],"names":[],"mappings":";;;;;;;AAsDO,SAAS,aAAA,CACd,YAAA,EACA,WAAA,EACA,OAAA,GAAiC,EAAC,EACtB;AACZ,EAAA,OAAO;AAAA,IACL,QAAA,EAAU,qBAAA,CAAsB,YAAA,EAAc,OAAO,CAAA;AAAA,IACrD,OAAA,EAAS,iBAAiB,WAAW;AAAA,GACvC;AACF;AAkBO,SAAS,YACd,YAAA,EACA,YAAA,EACA,aAAA,EACA,OAAA,GAAiC,EAAC,EACtB;AACZ,EAAA,OAAO;AAAA,IACL,QAAA,EAAU,qBAAA,CAAsB,YAAA,EAAc,OAAO,CAAA;AAAA,IACrD,OAAA,EAAS,iBAAiB,aAAa,CAAA;AAAA,IACvC,MAAA,EAAQ,gBAAgB,YAAY;AAAA,GACtC;AACF;AAGO,SAAS,WAAA,CACd,QACA,KAAA,EACiB;AACjB,EAAA,OAAO;AAAA,IACL,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,GAAI,OAAO,MAAA,KAAW,MAAA,GAAY,EAAC,GAAI,EAAE,MAAA,EAAQ,MAAA,CAAO,MAAA,EAAO;AAAA,IAC/D,GAAI,KAAA,KAAU,MAAA,GAAY,EAAC,GAAI,EAAE,KAAA;AAAM,GACzC;AACF","file":"index.js","sourcesContent":["// ═══════════════════════════════════════════════════════════════════════════\n// THE TWO INPUT PATHS.\n//\n// Both produce the same `LaneReportInput`, and both take TEXT rather than doing\n// their own I/O — so this module has no `node:fs` in it, runs in a worker or a\n// Durable Object, and the caller keeps the one decision that is genuinely\n// theirs (which bytes, from where).\n//\n// THE FILE PATH — `workflow.json` + `events.jsonl` off disk. What a tool\n// running inside the repo already has: the lane directory is right there.\n// Status is DERIVED, because there is nothing to be handed.\n//\n// THE CLI PATH — `fabrika lane status` + `fabrika lane history` stdout, plus\n// the `workflow.json` bytes. This is the one that matters: it means a\n// standalone inspector can shell out to `fabrika` and need ZERO phoenix\n// changes, because both verbs already print JSON on stdout and have done\n// since they were written. Status here is the CLI's OWN derivation, carried\n// verbatim — the report reads, it does not re-decide.\n//\n// `workflow.json` is read as a file on BOTH paths, deliberately. `lane print`\n// looks like the CLI answer for topology and is not: it emits, per state, the\n// event NAMES a cell exists for and never the targets, so no edge can be drawn\n// from it. The document is local, gitignored and sitting next to the log.\n// ═══════════════════════════════════════════════════════════════════════════\nimport {\n type LaneStatus,\n type LogEntry,\n parseEventsJsonl,\n parseHistoryJson,\n parseStatusJson,\n} from \"./fold\";\nimport type { LaneReportInput } from \"./report\";\nimport {\n chartFromWorkflowText,\n type ImportedLane,\n type WorkflowImportOptions,\n} from \"./workflow\";\n\n/** Everything a report needs, however it was obtained. */\nexport interface LaneSource {\n readonly workflow: ImportedLane;\n readonly entries: readonly LogEntry[];\n /** Present only on the CLI path — the driver's own answer, not ours. */\n readonly status?: LaneStatus;\n}\n\n/**\n * PATH 1 — the two files.\n *\n * @param workflowJson the bytes of `<lane>/workflow.json`\n * @param eventsJsonl the bytes of `<lane>/events.jsonl` (`\"\"` for a fresh lane)\n * @param options {@link WorkflowImportOptions} — carried straight through\n * to the importer, which is the one place it is read.\n */\nexport function laneFromFiles(\n workflowJson: string,\n eventsJsonl: string,\n options: WorkflowImportOptions = {},\n): LaneSource {\n return {\n workflow: chartFromWorkflowText(workflowJson, options),\n entries: parseEventsJsonl(eventsJsonl),\n };\n}\n\n/**\n * PATH 2 — the CLI's stdout.\n *\n * const dir = \".fabrika/lanes/5842\";\n * const src = laneFromCli(\n * readFileSync(`${dir}/workflow.json`, \"utf8\"),\n * execFileSync(\"fabrika\", [\"lane\", \"status\", \"--lane\", \"5842\"], { encoding: \"utf8\" }),\n * execFileSync(\"fabrika\", [\"lane\", \"history\", \"--lane\", \"5842\"], { encoding: \"utf8\" }),\n * );\n * console.log(laneReport(reportInput(src)).markdown);\n *\n * @param workflowJson the bytes of `<lane>/workflow.json`\n * @param statusStdout `fabrika lane status`'s stdout — `JSON.stringify(status, null, 2)`\n * @param historyStdout `fabrika lane history`'s stdout — the log as a JSON array\n * @param options {@link WorkflowImportOptions} — the same seam as path 1's.\n */\nexport function laneFromCli(\n workflowJson: string,\n statusStdout: string,\n historyStdout: string,\n options: WorkflowImportOptions = {},\n): LaneSource {\n return {\n workflow: chartFromWorkflowText(workflowJson, options),\n entries: parseHistoryJson(historyStdout),\n status: parseStatusJson(statusStdout),\n };\n}\n\n/** A `LaneSource` as the report's input. One line, so neither path spells it. */\nexport function reportInput(\n source: LaneSource,\n title?: string,\n): LaneReportInput {\n return {\n workflow: source.workflow,\n entries: source.entries,\n ...(source.status === undefined ? {} : { status: source.status }),\n ...(title === undefined ? {} : { title }),\n };\n}\n"]}