@rotorsoft/act-diagram 1.4.0 → 1.4.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.
@@ -5,8 +5,8 @@
5
5
  * symbol (events, actions, slices, projections, states, reactions),
6
6
  * and exposes a fuzzy lookup over them.
7
7
  *
8
- * Event status is derived from the `_v<digits>` convention documented
9
- * in CLAUDE.md and ACT-403: an event `Foo` is deprecated when any
8
+ * Event status is derived from the `_v<digits>` convention (see
9
+ * event-schema-evolution.md): an event `Foo` is deprecated when any
10
10
  * `Foo_v<n>` with a higher version exists.
11
11
  */
12
12
  import type { ActionNode, DomainModel } from "../client/types/index.js";
@@ -27,9 +27,9 @@ export type ContractIndex = {
27
27
  /**
28
28
  * Event names declared by each state, keyed by state name. Deprecation
29
29
  * is a per-state property — event names are per-state-namespaced, so two
30
- * unrelated states may legally share a base name — and classifying over
31
- * the global set reported one state's event as superseded by another's
32
- * (#1393, the CLI twin of #1310).
30
+ * unrelated states may legally share a base name — so classifying over
31
+ * the global set would report one state's event as superseded by
32
+ * another's.
33
33
  */
34
34
  events_by_state: Map<string, Set<string>>;
35
35
  };
@@ -44,9 +44,8 @@ export declare function event_names_for(idx: ContractIndex, state?: string): Set
44
44
  *
45
45
  * Only `v >= 2` counts as a version, mirroring the framework
46
46
  * (`event-versions.ts`): `Foo_v1` is a literal event name, since the base
47
- * `Foo` is implicitly v1. Treating it as a version made the CLI report a
48
- * current, emittable event as deprecated and tell operators to migrate
49
- * off it (#1395).
47
+ * `Foo` is implicitly v1. Treating it as a version would report a
48
+ * current, emittable event as deprecated.
50
49
  */
51
50
  export declare function decompose_event_name(name: string): {
52
51
  base: string;
@@ -68,12 +67,12 @@ export declare function build_contract_index(model: DomainModel): ContractIndex;
68
67
  * Accepts singular and plural forms.
69
68
  */
70
69
  export declare const CATEGORY_KEYWORDS: Record<string, Kind>;
71
- /** Return every entry of a given kind, sorted by name. */
72
70
  /** The action named `name`, on the state named `qualifier` when given. */
73
71
  export declare function find_action(model: DomainModel, name: string, qualifier?: string): {
74
72
  action?: ActionNode;
75
73
  state_file?: string;
76
74
  };
75
+ /** Return every entry of a given kind, sorted by name. */
77
76
  export declare function list_by_kind(idx: ContractIndex, kind: Kind): IndexEntry[];
78
77
  /**
79
78
  * Fuzzy substring search across the index. Case-insensitive. Ranks
@@ -1 +1 @@
1
- {"version":3,"file":"contract-index.d.ts","sourceRoot":"","sources":["../../../src/cli/contract-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAExE,MAAM,MAAM,IAAI,GACZ,OAAO,GACP,QAAQ,GACR,OAAO,GACP,YAAY,GACZ,OAAO,GACP,UAAU,CAAC;AAEf,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,KAAK,EAAE,WAAW,CAAC;IACnB,yDAAyD;IACzD,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B;;;;;;OAMG;IACH,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,aAAa,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,GAAG,CAAC,MAAM,CAAC,CAIb;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,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,CAAA;CAAE,CAO9C;AAED,0DAA0D;AAC1D,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,UAAU,EAAE,CAIzE;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CACpB,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,MAAM,EACb,KAAK,SAAK,GACT,UAAU,EAAE,CAoBd"}
@@ -5,9 +5,28 @@
5
5
  * unconditionally — picocolors no-ops when stdout doesn't support color,
6
6
  * so test snapshots can drop ANSI escapes if needed.
7
7
  */
8
+ import type { DomainModel } from "../client/types/index.js";
8
9
  import { type ContractIndex, type IndexEntry } from "./contract-index.js";
10
+ export declare const loc: (file?: string, line?: number) => string;
9
11
  /** Format a "matches" list view (multiple search results). */
10
12
  export declare function format_matches(query: string, matches: IndexEntry[]): string;
13
+ export declare const find_actions_emitting: (model: DomainModel, event_name: string) => Array<{
14
+ state: string;
15
+ action: string;
16
+ file?: string;
17
+ line?: number;
18
+ }>;
19
+ export declare const find_reactions_for: (model: DomainModel, event_name: string) => Array<{
20
+ slice?: string;
21
+ handler: string;
22
+ dispatches: string[];
23
+ file?: string;
24
+ line?: number;
25
+ }>;
26
+ export declare const find_projections_for: (model: DomainModel, event_name: string) => Array<{
27
+ name: string;
28
+ file?: string;
29
+ }>;
11
30
  /** Detailed event view: schema, producers, consumers, deprecation. */
12
31
  export declare function format_event(idx: ContractIndex, entry: IndexEntry): string;
13
32
  export declare function format_action(idx: ContractIndex, entry: IndexEntry): string;
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/cli/format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgBH,OAAO,EACL,KAAK,aAAa,EAIlB,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAiB7B,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CAY3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pB,CAAC;AAEF,wBAAsB,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CA4FzD"}
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Render the full contract index as a Markdown registry. One section
3
+ * per kind, one subsection per entity. Used by `act --markdown` for
4
+ * pipe-friendly output that diffs cleanly between branches.
5
+ *
6
+ * Output is plain ASCII (no ANSI escapes) regardless of `picocolors`
7
+ * settings — readers expect Markdown to be paste-able into a PR body
8
+ * or a static doc file.
9
+ */
1
10
  import { type ContractIndex } from "./contract-index.js";
2
11
  export declare function format_markdown(idx: ContractIndex): string;
3
12
  //# sourceMappingURL=markdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/cli/markdown.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,qBAAqB,CAAC;AAoG7B,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CA4M1D"}
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/cli/markdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,qBAAqB,CAAC;AAyB7B,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CA4M1D"}
@@ -3,14 +3,13 @@ import type { DomainModel, FileTab } from "../types/index.js";
3
3
  * `level: "full"` strips comments + strings + template literals (for scanning).
4
4
  * `level: "nav"` strips comments + template literals only (for navigation).
5
5
  *
6
- * Single left-to-right pass rather than sequential regex replaces. The
7
- * passes used to run comments-first, so a `//` inside a string literal
8
- * ("https://host/path") was treated as a comment start: blanking to
9
- * end-of-line truncated the literal, and the dangling quote then paired
10
- * with the next quote in the file, blanking every line between. One URL
11
- * could erase a whole slice declaration (#1391). Scanning once with the
12
- * cursor's context tracked makes that structurally impossible, and it
13
- * handles the mirror case (a quote inside a comment) for free. */
6
+ * Single left-to-right pass rather than sequential regex replaces.
7
+ * Stripping comments first would take a `//` inside a string literal
8
+ * ("https://host/path") for a comment start: blanking to end-of-line
9
+ * truncates the literal, and the dangling quote then pairs with the next
10
+ * quote in the file, blanking every line between. Scanning once with the
11
+ * cursor's context tracked makes that impossible, and it handles the
12
+ * mirror case (a quote inside a comment) for free. */
14
13
  export declare const strip_non_code: (src: string, level?: "full" | "nav") => string;
15
14
  export declare function extract_model(files: FileTab[]): {
16
15
  model: DomainModel;
@@ -1 +1 @@
1
- {"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../../../src/client/lib/evaluate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAK9D;;;;;;;;;;;mEAWmE;AACnE,eAAO,MAAM,cAAc,QAAS,MAAM,UAAS,MAAM,GAAG,KAAK,WA+ChE,CAAC;AA+NF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG;IAC/C,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAGA"}
1
+ {"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../../../src/client/lib/evaluate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAK9D;;;;;;;;;;uDAUuD;AACvD,eAAO,MAAM,cAAc,QAAS,MAAM,UAAS,MAAM,GAAG,KAAK,WA+ChE,CAAC;AA+NF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG;IAC/C,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAGA"}
package/dist/cli/act.js CHANGED
@@ -831,7 +831,7 @@ function mock_state(entry, on_build) {
831
831
  archives: () => action_builder(_currentAction),
832
832
  // Disclosure predicate for `sensitive()` fields. Same reasoning as
833
833
  // the close-policy methods above: the diagram doesn't render it, but
834
- // the chain must survive or the whole state is dropped (#1394).
834
+ // the chain must survive or the whole state is dropped.
835
835
  discloses: () => action_builder(_currentAction),
836
836
  build: () => {
837
837
  on_build?.(info);
@@ -906,7 +906,7 @@ function mock_slice(on_build) {
906
906
  return builder;
907
907
  },
908
908
  // Lane declaration — the diagram doesn't render lanes, but the chain
909
- // must survive or the slice is dropped (#1394).
909
+ // must survive or the slice is dropped.
910
910
  withLane() {
911
911
  return builder;
912
912
  },
@@ -952,7 +952,7 @@ function mock_projection(target, on_build) {
952
952
  // State-projection (fold) form: `projection(n).of(State, ...).flush(fn)`.
953
953
  // The folded state's own events are what the projection handles, so
954
954
  // record them from each passed state — that is what makes the
955
- // projection show up as a consumer of those events (#1394).
955
+ // projection show up as a consumer of those events.
956
956
  of(...states) {
957
957
  for (const st of states) {
958
958
  const events = st?.events;
@@ -1014,7 +1014,7 @@ function mock_act(on_build) {
1014
1014
  },
1015
1015
  withActor: () => builder,
1016
1016
  // Lane declaration — not rendered, but the chain must survive or the
1017
- // whole orchestrator is dropped from the model (#1394).
1017
+ // whole orchestrator is dropped from the model.
1018
1018
  withLane: () => builder,
1019
1019
  on(event_name) {
1020
1020
  return {
@@ -2011,56 +2011,8 @@ async function load_project(root_dir, opts = {}) {
2011
2011
  }
2012
2012
 
2013
2013
  // src/cli/markdown.ts
2014
- var loc2 = (file, line) => {
2015
- if (!file) return "";
2016
- return line ? `${file}:${line}` : file;
2017
- };
2018
- var find_actions_emitting2 = (model, event_name) => {
2019
- const out = [];
2020
- for (const st of model.states) {
2021
- for (const act of st.actions) {
2022
- if (act.emits.includes(event_name)) {
2023
- out.push({
2024
- state: st.name,
2025
- action: act.name,
2026
- file: st.file,
2027
- line: act.line
2028
- });
2029
- }
2030
- }
2031
- }
2032
- return out;
2033
- };
2034
- var find_reactions_for2 = (model, event_name) => {
2035
- const out = [];
2036
- for (const sl of model.slices) {
2037
- for (const r2 of sl.reactions) {
2038
- if (r2.event === event_name) {
2039
- out.push({
2040
- slice: sl.name,
2041
- handler: r2.handlerName,
2042
- dispatches: r2.dispatches,
2043
- file: r2.file ?? sl.file,
2044
- line: r2.line
2045
- });
2046
- }
2047
- }
2048
- }
2049
- for (const r2 of model.reactions) {
2050
- if (r2.event === event_name) {
2051
- out.push({
2052
- handler: r2.handlerName,
2053
- dispatches: r2.dispatches,
2054
- file: r2.file,
2055
- line: r2.line
2056
- });
2057
- }
2058
- }
2059
- return out;
2060
- };
2061
- var find_projections_for2 = (model, event_name) => model.projections.filter((p) => p.handles.includes(event_name)).map((p) => ({ name: p.name, file: p.file }));
2062
2014
  var file_suffix = (file, line) => {
2063
- const l2 = loc2(file, line);
2015
+ const l2 = loc(file, line);
2064
2016
  return l2 ? ` *(${l2})*` : "";
2065
2017
  };
2066
2018
  var render_schema = (s) => {
@@ -2100,12 +2052,12 @@ function format_markdown(idx) {
2100
2052
  const status = event_status(e.name, event_names_for(idx, owning_state));
2101
2053
  const status_label = status.status === "active" ? "active" : `deprecated \u2014 superseded by **${status.superseded_by}**`;
2102
2054
  lines.push(`### \`${e.name}\``);
2103
- if (e.file) lines.push(`- **defined in:** \`${loc2(e.file, e.line)}\``);
2055
+ if (e.file) lines.push(`- **defined in:** \`${loc(e.file, e.line)}\``);
2104
2056
  if (owning_state && owning_state !== e.name)
2105
2057
  lines.push(`- **on state:** \`${owning_state}\``);
2106
2058
  lines.push(`- **schema:** ${render_schema(schema)}`);
2107
2059
  lines.push(`- **status:** ${status_label}`);
2108
- const producers = find_actions_emitting2(m, e.name);
2060
+ const producers = find_actions_emitting(m, e.name);
2109
2061
  if (producers.length > 0) {
2110
2062
  lines.push("- **producers:**");
2111
2063
  for (const p of producers)
@@ -2115,8 +2067,8 @@ function format_markdown(idx) {
2115
2067
  } else {
2116
2068
  lines.push("- **producers:** _(none)_");
2117
2069
  }
2118
- const reactions2 = find_reactions_for2(m, e.name);
2119
- const projections2 = find_projections_for2(m, e.name);
2070
+ const reactions2 = find_reactions_for(m, e.name);
2071
+ const projections2 = find_projections_for(m, e.name);
2120
2072
  if (reactions2.length === 0 && projections2.length === 0) {
2121
2073
  lines.push("- **consumers:** _(none)_");
2122
2074
  } else {
@@ -2143,7 +2095,7 @@ function format_markdown(idx) {
2143
2095
  if (a2.qualifier) lines.push(`- **on state:** \`${a2.qualifier}\``);
2144
2096
  if (state_file)
2145
2097
  lines.push(
2146
- `- **defined in:** \`${loc2(state_file, action?.line ?? a2.line)}\``
2098
+ `- **defined in:** \`${loc(state_file, action?.line ?? a2.line)}\``
2147
2099
  );
2148
2100
  if (action) {
2149
2101
  const preconditions = action.preconditions ?? action.invariants;
@@ -2167,7 +2119,7 @@ function format_markdown(idx) {
2167
2119
  for (const s of states) {
2168
2120
  const st = m.states.find((x) => x.name === s.name);
2169
2121
  lines.push(`### \`${s.name}\``);
2170
- if (s.file) lines.push(`- **defined in:** \`${loc2(s.file, s.line)}\``);
2122
+ if (s.file) lines.push(`- **defined in:** \`${loc(s.file, s.line)}\``);
2171
2123
  if (st) {
2172
2124
  if (st.actions.length > 0)
2173
2125
  lines.push(
@@ -2187,7 +2139,7 @@ function format_markdown(idx) {
2187
2139
  for (const s of slices) {
2188
2140
  const sl = m.slices.find((x) => x.name === s.name);
2189
2141
  lines.push(`### \`${s.name}\``);
2190
- if (s.file) lines.push(`- **defined in:** \`${loc2(s.file, s.line)}\``);
2142
+ if (s.file) lines.push(`- **defined in:** \`${loc(s.file, s.line)}\``);
2191
2143
  if (sl) {
2192
2144
  if (sl.error) lines.push(`- **error:** ${sl.error}`);
2193
2145
  if (sl.states.length > 0)
@@ -2217,7 +2169,7 @@ function format_markdown(idx) {
2217
2169
  for (const p of projections) {
2218
2170
  const pr = m.projections.find((x) => x.name === p.name);
2219
2171
  lines.push(`### \`${p.name}\``);
2220
- if (pr?.file) lines.push(`- **defined in:** \`${loc2(pr.file, pr.line)}\``);
2172
+ if (pr?.file) lines.push(`- **defined in:** \`${loc(pr.file, pr.line)}\``);
2221
2173
  if (pr && pr.handles.length > 0)
2222
2174
  lines.push(
2223
2175
  `- **handles:** ${pr.handles.map((x) => `\`${x}\``).join(", ")}`
@@ -2234,7 +2186,7 @@ function format_markdown(idx) {
2234
2186
  if (slice_name && slice_name !== "*")
2235
2187
  lines.push(`- **in slice:** \`${slice_name}\``);
2236
2188
  if (event_name) lines.push(`- **on event:** \`${event_name}\``);
2237
- if (r2.file) lines.push(`- **defined in:** \`${loc2(r2.file, r2.line)}\``);
2189
+ if (r2.file) lines.push(`- **defined in:** \`${loc(r2.file, r2.line)}\``);
2238
2190
  const slice_reaction = m.slices.find((x) => x.name === slice_name)?.reactions.find(
2239
2191
  (rr) => rr.handlerName === r2.name && rr.event === event_name
2240
2192
  );
@@ -3274,7 +3226,7 @@ function position_at(content, index) {
3274
3226
  const before = content.slice(0, index);
3275
3227
  const line = before.split("\n").length;
3276
3228
  const last_nl = before.lastIndexOf("\n");
3277
- const col = index - (last_nl >= 0 ? last_nl : 0);
3229
+ const col = index - Math.max(last_nl, 0);
3278
3230
  return { line, col };
3279
3231
  }
3280
3232
  function build_patterns(esc, type) {
@@ -3594,8 +3546,8 @@ var count_by_kind = (idx, kind) => {
3594
3546
  return idx.entries.filter((e) => e.kind === kind).length;
3595
3547
  };
3596
3548
  var label_entry = (e) => {
3597
- const loc3 = e.file ? `${e.file}${e.line ? `:${e.line}` : ""}` : "";
3598
- const where = loc3 ? ` ${dim(loc3)}` : "";
3549
+ const loc2 = e.file ? `${e.file}${e.line ? `:${e.line}` : ""}` : "";
3550
+ const where = loc2 ? ` ${dim(loc2)}` : "";
3599
3551
  const qual = e.qualifier ? dim(` (${e.qualifier})`) : "";
3600
3552
  const colored = kind_color[e.kind](e.name);
3601
3553
  return `${colored}${qual}${where}`;