@autotelic/jig-cli 0.0.0-stage → 0.1.1

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 (81) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +169 -2
  3. package/bin/jig.js +23 -0
  4. package/dist/baseline.d.ts +8 -0
  5. package/dist/baseline.d.ts.map +1 -0
  6. package/dist/baseline.js +30 -0
  7. package/dist/baseline.js.map +1 -0
  8. package/dist/cli.d.ts +2 -0
  9. package/dist/cli.d.ts.map +1 -0
  10. package/dist/cli.js +342 -0
  11. package/dist/cli.js.map +1 -0
  12. package/dist/commands.d.ts +50 -0
  13. package/dist/commands.d.ts.map +1 -0
  14. package/dist/commands.js +145 -0
  15. package/dist/commands.js.map +1 -0
  16. package/dist/config.d.ts +32 -0
  17. package/dist/config.d.ts.map +1 -0
  18. package/dist/config.js +59 -0
  19. package/dist/config.js.map +1 -0
  20. package/dist/engines.d.ts +85 -0
  21. package/dist/engines.d.ts.map +1 -0
  22. package/dist/engines.js +575 -0
  23. package/dist/engines.js.map +1 -0
  24. package/dist/exec.d.ts +16 -0
  25. package/dist/exec.d.ts.map +1 -0
  26. package/dist/exec.js +13 -0
  27. package/dist/exec.js.map +1 -0
  28. package/dist/gate.d.ts +46 -0
  29. package/dist/gate.d.ts.map +1 -0
  30. package/dist/gate.js +82 -0
  31. package/dist/gate.js.map +1 -0
  32. package/dist/git.d.ts +5 -0
  33. package/dist/git.d.ts.map +1 -0
  34. package/dist/git.js +39 -0
  35. package/dist/git.js.map +1 -0
  36. package/dist/gitattributes.d.ts +27 -0
  37. package/dist/gitattributes.d.ts.map +1 -0
  38. package/dist/gitattributes.js +63 -0
  39. package/dist/gitattributes.js.map +1 -0
  40. package/dist/index.d.ts +12 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +12 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/init.d.ts +163 -0
  45. package/dist/init.d.ts.map +1 -0
  46. package/dist/init.js +1855 -0
  47. package/dist/init.js.map +1 -0
  48. package/dist/menu.d.ts +82 -0
  49. package/dist/menu.d.ts.map +1 -0
  50. package/dist/menu.js +388 -0
  51. package/dist/menu.js.map +1 -0
  52. package/dist/opencode.d.ts +66 -0
  53. package/dist/opencode.d.ts.map +1 -0
  54. package/dist/opencode.js +392 -0
  55. package/dist/opencode.js.map +1 -0
  56. package/dist/package-json.d.ts +13 -0
  57. package/dist/package-json.d.ts.map +1 -0
  58. package/dist/package-json.js +33 -0
  59. package/dist/package-json.js.map +1 -0
  60. package/dist/projections.d.ts +140 -0
  61. package/dist/projections.d.ts.map +1 -0
  62. package/dist/projections.js +186 -0
  63. package/dist/projections.js.map +1 -0
  64. package/dist/render.d.ts +21 -0
  65. package/dist/render.d.ts.map +1 -0
  66. package/dist/render.js +131 -0
  67. package/dist/render.js.map +1 -0
  68. package/dist/room.d.ts +16 -0
  69. package/dist/room.d.ts.map +1 -0
  70. package/dist/room.js +56 -0
  71. package/dist/room.js.map +1 -0
  72. package/dist/run.d.ts +10 -0
  73. package/dist/run.d.ts.map +1 -0
  74. package/dist/run.js +18 -0
  75. package/dist/run.js.map +1 -0
  76. package/extensions/jig.ts +465 -0
  77. package/package.json +78 -3
  78. package/skills/feedback-loop/SKILL.md +14 -0
  79. package/skills/intercom-setup/SKILL.md +20 -0
  80. package/skills/project-run/SKILL.md +18 -0
  81. package/skills/room/SKILL.md +17 -0
@@ -0,0 +1,140 @@
1
+ import { type Move, type Report, type Severity } from "@autotelic/protocol";
2
+ /** SARIF's levels, one per protocol severity. */
3
+ export declare const severity01: (severity: Severity) => "error" | "warning" | "note";
4
+ /** LSP's numeric severity: 1 error, 2 warning, 3 information. */
5
+ export declare const severityNumeric: (severity: Severity) => 1 | 2 | 3;
6
+ /** Code Climate's three buckets, one per protocol severity. */
7
+ export declare const severityCodeClimate: (severity: Severity) => "major" | "minor" | "info";
8
+ /** A SARIF text blob; the schema wraps every string in one. */
9
+ interface SarifText {
10
+ readonly text: string;
11
+ }
12
+ /** One rule descriptor. The optional fields are absent (not `undefined`) when unknown. */
13
+ interface SarifRule {
14
+ readonly id: string;
15
+ readonly name: string;
16
+ readonly shortDescription: SarifText;
17
+ help?: SarifText;
18
+ helpUri?: string;
19
+ }
20
+ /** A source span. `endLine`/`endColumn` are absent when the engine measured no span. */
21
+ interface SarifRegion {
22
+ readonly startLine: number;
23
+ readonly startColumn: number;
24
+ endLine?: number;
25
+ endColumn?: number;
26
+ }
27
+ /** The extension point SARIF gives a tool; where the report's own facts ride out. */
28
+ interface SarifResultProperties {
29
+ fixable?: boolean;
30
+ judged?: boolean;
31
+ move?: Move;
32
+ score?: number;
33
+ baseline?: "known" | "novel";
34
+ }
35
+ interface SarifSuppression {
36
+ readonly kind: string;
37
+ readonly status: string;
38
+ readonly justification: string;
39
+ }
40
+ interface SarifLocation {
41
+ readonly physicalLocation: {
42
+ readonly artifactLocation: {
43
+ readonly uri: string;
44
+ };
45
+ readonly region: SarifRegion;
46
+ };
47
+ }
48
+ interface SarifResult {
49
+ readonly ruleId: string;
50
+ readonly level: "error" | "warning" | "note";
51
+ readonly message: SarifText;
52
+ properties?: SarifResultProperties;
53
+ suppressions?: ReadonlyArray<SarifSuppression>;
54
+ readonly locations: ReadonlyArray<SarifLocation>;
55
+ }
56
+ interface SarifDocument {
57
+ readonly $schema: string;
58
+ readonly version: string;
59
+ readonly runs: ReadonlyArray<{
60
+ readonly tool: {
61
+ readonly driver: {
62
+ readonly name: string;
63
+ readonly version: string;
64
+ readonly informationUri: string;
65
+ readonly rules: ReadonlyArray<SarifRule>;
66
+ };
67
+ };
68
+ readonly results: ReadonlyArray<SarifResult>;
69
+ }>;
70
+ }
71
+ /**
72
+ * Map a report to a SARIF 2.1.0 document.
73
+ *
74
+ * `known` is the accepted baseline, as a set of identities. When it is given, every result
75
+ * carries `properties.baseline` and a known result is marked suppressed rather than hidden:
76
+ * the reviewer sees accepted debt grayed out, not deleted.
77
+ *
78
+ * `properties` also carries the judged provenance (`judged`, `move`, `score`) when the
79
+ * finding has it — the extension point SARIF gives for exactly this, and the difference
80
+ * between an outward report that says "judged" and one that quietly says "determined".
81
+ */
82
+ export declare const projectSarif: (report: Report, known?: ReadonlySet<string>) => SarifDocument;
83
+ interface LspPosition {
84
+ readonly line: number;
85
+ readonly character: number;
86
+ }
87
+ interface LspDiagnostic {
88
+ readonly range: {
89
+ readonly start: LspPosition;
90
+ readonly end: LspPosition;
91
+ };
92
+ readonly severity: 1 | 2 | 3;
93
+ readonly code: string;
94
+ readonly source: string;
95
+ readonly message: string;
96
+ codeDescription?: {
97
+ readonly href: string;
98
+ };
99
+ }
100
+ /**
101
+ * Map a report to LSP diagnostics.
102
+ *
103
+ * The shift is the trap: the report is 1-based and LSP is 0-based, so a projection that
104
+ * ships without it puts every squiggle one line and one column off. `end` falls back to
105
+ * `start` when the engine measured no span, because LSP requires both ends.
106
+ */
107
+ export declare const projectLsp: (report: Report) => ReadonlyArray<LspDiagnostic>;
108
+ interface CodeClimateLines {
109
+ readonly begin: number;
110
+ end?: number;
111
+ }
112
+ interface CodeClimateIssue {
113
+ readonly type: "issue";
114
+ readonly check_name: string;
115
+ readonly description: string;
116
+ readonly categories: ReadonlyArray<string>;
117
+ readonly location: {
118
+ readonly path: string;
119
+ readonly lines: CodeClimateLines;
120
+ };
121
+ readonly severity: "major" | "minor" | "info";
122
+ readonly fingerprint: string;
123
+ }
124
+ /**
125
+ * Map a report to Code Climate issues.
126
+ *
127
+ * No taxonomy in the report, so the category is the one a finding always is; a real mapping
128
+ * belongs to the host that has one.
129
+ */
130
+ export declare const projectCodeClimate: (report: Report) => ReadonlyArray<CodeClimateIssue>;
131
+ /** Render a report as SARIF 2.1.0. */
132
+ export declare const renderSarif: (report: Report, known?: ReadonlySet<string>) => string;
133
+ /** Render a report as LSP 3.17 diagnostics. */
134
+ export declare const renderLsp: (report: Report) => string;
135
+ /** Render a report as Code Climate issues. */
136
+ export declare const renderCodeClimate: (report: Report) => string;
137
+ /** JSONL: one finding per line, the streaming form a runner writes. */
138
+ export declare const renderJsonl: (report: Report) => string;
139
+ export {};
140
+ //# sourceMappingURL=projections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projections.d.ts","sourceRoot":"","sources":["../src/projections.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,IAAI,EACT,KAAK,MAAM,EACX,KAAK,QAAQ,EACd,MAAM,qBAAqB,CAAA;AA0D5B,iDAAiD;AACjD,eAAO,MAAM,UAAU,aAAc,QAAQ,KAAG,OAAO,GAAG,SAAS,GAAG,MAA2B,CAAA;AAEjG,iEAAiE;AACjE,eAAO,MAAM,eAAe,aAAc,QAAQ,KAAG,CAAC,GAAG,CAAC,GAAG,CAA2B,CAAA;AAExF,+DAA+D;AAC/D,eAAO,MAAM,mBAAmB,aAAc,QAAQ,KAAG,OAAO,GAAG,OAAO,GAAG,MACjD,CAAA;AAI5B,+DAA+D;AAC/D,UAAU,SAAS;IACjB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,0FAA0F;AAC1F,UAAU,SAAS;IACjB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,gBAAgB,EAAE,SAAS,CAAA;IACpC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wFAAwF;AACxF,UAAU,WAAW;IACnB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,qFAAqF;AACrF,UAAU,qBAAqB;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,IAAI,CAA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E,gBAAgB,CAAA;KAAE,CAAA;IAC9E,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;IAC7C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,WAAY,MAAM,KAAG,aAAa,CAAC,gBAAgB,CAa9E,CAAA;AAOJ,sCAAsC;AACtC,eAAO,MAAM,WAAW,WAAY,MAAM,UAAU,WAAW,CAAC,MAAM,CAAC,KAAG,MACrC,CAAA;AAErC,+CAA+C;AAC/C,eAAO,MAAM,SAAS,WAAY,MAAM,KAAG,MAAoC,CAAA;AAE/E,8CAA8C;AAC9C,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,MAA4C,CAAA;AAE/F,uEAAuE;AACvE,eAAO,MAAM,WAAW,WAAY,MAAM,KAAG,MAA4C,CAAA"}
@@ -0,0 +1,186 @@
1
+ import { Match } from "effect";
2
+ import { identityOf, ruleNameOf, toJsonl, } from "@autotelic/protocol";
3
+ /*
4
+ * The outward projections.
5
+ *
6
+ * `protocol/docs/projections.md` SPECIFIES these; a rendering host implements them, and
7
+ * that host is `jig` — so a finding leaves the workspace without a second finding shape
8
+ * being invented. The report is the truth; a projection drops, never bends.
9
+ *
10
+ * They are checked against `protocol`'s worked examples
11
+ * (`fixtures/projections/*.golden.json`) in `projections.test.ts`. That is the outside
12
+ * judge: if this file and the spec drift, the fixtures go red, not a reader's eyes.
13
+ *
14
+ * The external shapes are named types, not open dictionaries: a projection's whole job is
15
+ * to produce one exact target contract, so `Record<string, unknown>` would discard the very
16
+ * evidence the projection exists to pin down.
17
+ */
18
+ /** The published SARIF 2.1.0 schema the worked example names. */
19
+ const SARIF_SCHEMA = "https://json.schemastore.org/sarif-2.1.0.json";
20
+ /** How the host names itself in a projection's driver metadata. */
21
+ const DRIVER_NAME = "tackle";
22
+ const INFORMATION_URI = "https://github.com/autotelic/tackle";
23
+ /*
24
+ * The severity vocabularies, mapped once. Each is total over the protocol's three, which
25
+ * is what makes the mapping a projection and not a policy: no target value is invented,
26
+ * and none is dropped. `Match` is how `joggle` maps the same three, so the two hosts read
27
+ * alike.
28
+ */
29
+ /*
30
+ * Each mapping is a `Match` over the three, exactly as `joggle` maps them. `Match.type` over
31
+ * the whole union keeps the compiler checking coverage: add a fourth severity and every
32
+ * `exhaustive` here stops compiling, rather than silently falling through a `default`.
33
+ */
34
+ const level01 = Match.type().pipe(Match.when("error", () => "error"), Match.when("warn", () => "warning"), Match.when("info", () => "note"), Match.exhaustive);
35
+ const levelNumeric = Match.type().pipe(Match.when("error", () => 1), Match.when("warn", () => 2), Match.when("info", () => 3), Match.exhaustive);
36
+ const levelCodeClimate = Match.type().pipe(Match.when("error", () => "major"), Match.when("warn", () => "minor"), Match.when("info", () => "info"), Match.exhaustive);
37
+ /** SARIF's levels, one per protocol severity. */
38
+ export const severity01 = (severity) => level01(severity);
39
+ /** LSP's numeric severity: 1 error, 2 warning, 3 information. */
40
+ export const severityNumeric = (severity) => levelNumeric(severity);
41
+ /** Code Climate's three buckets, one per protocol severity. */
42
+ export const severityCodeClimate = (severity) => levelCodeClimate(severity);
43
+ /**
44
+ * Map a report to a SARIF 2.1.0 document.
45
+ *
46
+ * `known` is the accepted baseline, as a set of identities. When it is given, every result
47
+ * carries `properties.baseline` and a known result is marked suppressed rather than hidden:
48
+ * the reviewer sees accepted debt grayed out, not deleted.
49
+ *
50
+ * `properties` also carries the judged provenance (`judged`, `move`, `score`) when the
51
+ * finding has it — the extension point SARIF gives for exactly this, and the difference
52
+ * between an outward report that says "judged" and one that quietly says "determined".
53
+ */
54
+ export const projectSarif = (report, known) => {
55
+ const rules = new Map();
56
+ for (const diagnostic of report.diagnostics) {
57
+ const name = ruleNameOf(diagnostic);
58
+ if (rules.has(name))
59
+ continue;
60
+ const rule = {
61
+ id: name,
62
+ name,
63
+ shortDescription: { text: diagnostic.message },
64
+ };
65
+ if (diagnostic.help !== undefined)
66
+ rule.help = { text: diagnostic.help };
67
+ if (diagnostic.docsUrl !== undefined)
68
+ rule.helpUri = diagnostic.docsUrl;
69
+ rules.set(name, rule);
70
+ }
71
+ const results = report.diagnostics.map((diagnostic) => {
72
+ const isKnown = known !== undefined && known.has(identityOf(diagnostic));
73
+ const properties = {};
74
+ if (diagnostic.fixable === true)
75
+ properties.fixable = true;
76
+ if (diagnostic.judged !== undefined)
77
+ properties.judged = diagnostic.judged;
78
+ if (diagnostic.move !== undefined)
79
+ properties.move = diagnostic.move;
80
+ if (diagnostic.score !== undefined)
81
+ properties.score = diagnostic.score;
82
+ if (known !== undefined)
83
+ properties.baseline = isKnown ? "known" : "novel";
84
+ const region = {
85
+ startLine: diagnostic.location.line,
86
+ startColumn: diagnostic.location.column,
87
+ };
88
+ if (diagnostic.location.endLine !== undefined)
89
+ region.endLine = diagnostic.location.endLine;
90
+ if (diagnostic.location.endColumn !== undefined)
91
+ region.endColumn = diagnostic.location.endColumn;
92
+ const result = {
93
+ ruleId: ruleNameOf(diagnostic),
94
+ level: severity01(diagnostic.severity),
95
+ message: { text: diagnostic.message },
96
+ locations: [
97
+ {
98
+ physicalLocation: {
99
+ artifactLocation: { uri: diagnostic.location.file },
100
+ region,
101
+ },
102
+ },
103
+ ],
104
+ };
105
+ if (Object.keys(properties).length > 0)
106
+ result.properties = properties;
107
+ if (isKnown) {
108
+ result.suppressions = [
109
+ { kind: "external", status: "accepted", justification: "accepted in the baseline" },
110
+ ];
111
+ }
112
+ return result;
113
+ });
114
+ return {
115
+ $schema: SARIF_SCHEMA,
116
+ version: "2.1.0",
117
+ runs: [
118
+ {
119
+ tool: {
120
+ driver: {
121
+ name: DRIVER_NAME,
122
+ version: String(report.lexicon.version),
123
+ informationUri: INFORMATION_URI,
124
+ rules: [...rules.values()],
125
+ },
126
+ },
127
+ results,
128
+ },
129
+ ],
130
+ };
131
+ };
132
+ /**
133
+ * Map a report to LSP diagnostics.
134
+ *
135
+ * The shift is the trap: the report is 1-based and LSP is 0-based, so a projection that
136
+ * ships without it puts every squiggle one line and one column off. `end` falls back to
137
+ * `start` when the engine measured no span, because LSP requires both ends.
138
+ */
139
+ export const projectLsp = (report) => report.diagnostics.map((diagnostic) => {
140
+ const { line, column, endLine, endColumn } = diagnostic.location;
141
+ const result = {
142
+ range: {
143
+ start: { line: line - 1, character: column - 1 },
144
+ end: { line: (endLine ?? line) - 1, character: (endColumn ?? column) - 1 },
145
+ },
146
+ severity: severityNumeric(diagnostic.severity),
147
+ code: ruleNameOf(diagnostic),
148
+ source: diagnostic.engine,
149
+ message: diagnostic.message,
150
+ };
151
+ if (diagnostic.docsUrl !== undefined)
152
+ result.codeDescription = { href: diagnostic.docsUrl };
153
+ return result;
154
+ });
155
+ /**
156
+ * Map a report to Code Climate issues.
157
+ *
158
+ * No taxonomy in the report, so the category is the one a finding always is; a real mapping
159
+ * belongs to the host that has one.
160
+ */
161
+ export const projectCodeClimate = (report) => report.diagnostics.map((diagnostic) => {
162
+ const lines = { begin: diagnostic.location.line };
163
+ if (diagnostic.location.endLine !== undefined)
164
+ lines.end = diagnostic.location.endLine;
165
+ return {
166
+ type: "issue",
167
+ check_name: ruleNameOf(diagnostic),
168
+ description: diagnostic.message,
169
+ categories: ["Style"],
170
+ location: { path: diagnostic.location.file, lines },
171
+ severity: severityCodeClimate(diagnostic.severity),
172
+ fingerprint: identityOf(diagnostic),
173
+ };
174
+ });
175
+ /* Text serializers. Each projection is one shape written once; a host reads the string. */
176
+ /** Render any projection value as the canonical pretty-JSON the fixtures pin. */
177
+ const pretty = (value) => `${JSON.stringify(value, null, 2)}\n`;
178
+ /** Render a report as SARIF 2.1.0. */
179
+ export const renderSarif = (report, known) => pretty(projectSarif(report, known));
180
+ /** Render a report as LSP 3.17 diagnostics. */
181
+ export const renderLsp = (report) => pretty(projectLsp(report));
182
+ /** Render a report as Code Climate issues. */
183
+ export const renderCodeClimate = (report) => pretty(projectCodeClimate(report));
184
+ /** JSONL: one finding per line, the streaming form a runner writes. */
185
+ export const renderJsonl = (report) => `${toJsonl(report.diagnostics)}\n`;
186
+ //# sourceMappingURL=projections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projections.js","sourceRoot":"","sources":["../src/projections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EACL,UAAU,EACV,UAAU,EACV,OAAO,GAIR,MAAM,qBAAqB,CAAA;AAE5B;;;;;;;;;;;;;;GAcG;AAEH,iEAAiE;AACjE,MAAM,YAAY,GAAG,+CAA+C,CAAA;AAEpE,mEAAmE;AACnE,MAAM,WAAW,GAAG,QAAQ,CAAA;AAC5B,MAAM,eAAe,GAAG,qCAAqC,CAAA;AAE7D;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAY,CAAC,IAAI,CACzC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAiC,EAAE,CAAC,OAAO,CAAC,EAChE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAiC,EAAE,CAAC,SAAS,CAAC,EACjE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAiC,EAAE,CAAC,MAAM,CAAC,EAC9D,KAAK,CAAC,UAAU,CACjB,CAAA;AAED,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAY,CAAC,IAAI,CAC9C,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAc,EAAE,CAAC,CAAC,CAAC,EACvC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAc,EAAE,CAAC,CAAC,CAAC,EACtC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAc,EAAE,CAAC,CAAC,CAAC,EACtC,KAAK,CAAC,UAAU,CACjB,CAAA;AAED,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,EAAY,CAAC,IAAI,CAClD,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAA+B,EAAE,CAAC,OAA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D,QAAQ,EAAE,mBAAmB,CAAC,UAAU,CAAC,QAAQ,CAAC;QAClD,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC;KACpC,CAAA;AACH,CAAC,CAAC,CAAA;AAEJ,2FAA2F;AAE3F,iFAAiF;AACjF,MAAM,MAAM,GAAG,CAAQ,KAAY,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAA;AAErF,sCAAsC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,KAA2B,EAAU,EAAE,CACjF,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;AAErC,+CAA+C;AAC/C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;AAE/E,8CAA8C;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAA;AAE/F,uEAAuE;AACvE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { type Report } from "@autotelic/protocol";
2
+ import { type GateVerdict } from "./gate.ts";
3
+ import type { HarnessRun } from "./run.ts";
4
+ /** How much of the finding list to print. Zero means all of it. */
5
+ export interface TextOptions {
6
+ readonly limit?: number;
7
+ /** The gate's verdict, so the text and the exit code can never disagree. */
8
+ readonly gate?: GateVerdict;
9
+ }
10
+ /**
11
+ * The census first — whose silence is whose — then the findings, then the ratchet.
12
+ *
13
+ * The census and the ratchet are never truncated; only the finding list is bounded by
14
+ * `limit`. Truncating a verdict ("did the ratchet hold?") would be a preview that lies.
15
+ */
16
+ export declare const renderText: (run: HarnessRun, options?: TextOptions) => string;
17
+ /** GitHub Actions workflow commands, one per finding. */
18
+ export declare const renderGithub: (report: Report) => string;
19
+ /** The report as JSON — the machine form a host or a test reads. */
20
+ export declare const renderJson: (report: Report) => string;
21
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmD,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAClG,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAc1C,mEAAmE;AACnE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAC5B;AAkDD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,QAAS,UAAU,YAAW,WAAW,KAAQ,MA8EvE,CAAA;AAOD,yDAAyD;AACzD,eAAO,MAAM,YAAY,WAAY,MAAM,KAAG,MAO/B,CAAA;AAEf,oEAAoE;AACpE,eAAO,MAAM,UAAU,WAAY,MAAM,KAAG,MAAgD,CAAA"}
package/dist/render.js ADDED
@@ -0,0 +1,131 @@
1
+ import { ruleNameOf } from "@autotelic/protocol";
2
+ import { EXIT } from "./gate.js";
3
+ /** One line per rule the gate holds against the run, so a reader sees what failed, not why. */
4
+ const gateLines = (failing) => {
5
+ const byRule = new Map();
6
+ for (const diagnostic of failing) {
7
+ const key = ruleNameOf(diagnostic);
8
+ byRule.set(key, (byRule.get(key) ?? 0) + 1);
9
+ }
10
+ return [...byRule.entries()]
11
+ .sort(([left], [right]) => left.localeCompare(right))
12
+ .map(([rule, count]) => ` ${rule}: ${count} failing finding${count === 1 ? "" : "s"}`);
13
+ };
14
+ /** One engine's census line: what it found, and what it did instead of looking. */
15
+ const engineLine = (generator) => {
16
+ const annotations = [];
17
+ // `ran` is the unremarkable case and stays silent; anything else is news.
18
+ if (generator.status !== undefined && generator.status !== "ran")
19
+ annotations.push(generator.status);
20
+ if (generator.unjudged !== undefined && generator.unjudged > 0) {
21
+ annotations.push(`${generator.unjudged} candidate(s) not judged`);
22
+ }
23
+ if (generator.note !== undefined)
24
+ annotations.push(generator.note);
25
+ const suffix = annotations.length === 0 ? "" : ` — ${annotations.join("; ")}`;
26
+ return ` ${generator.id}: ${generator.diagnostics} finding(s)${suffix}`;
27
+ };
28
+ /** One finding, as a numbered block a person reads and an agent can act on. */
29
+ const findingLines = (diagnostic, index) => {
30
+ const { file, line, column } = diagnostic.location;
31
+ const score = diagnostic.score === undefined ? "" : ` (${diagnostic.score.toFixed(2)})`;
32
+ const move = diagnostic.move === undefined ? "" : ` [${diagnostic.move}]`;
33
+ // `judged: false` is an engine saying it did not verify this one; absent means the
34
+ // engine does not judge at all, and marking every static lint finding "(unverified)"
35
+ // would be noise about the wrong thing.
36
+ const unverified = diagnostic.judged === false ? " (unverified)" : "";
37
+ const lines = [
38
+ ` ${index}. [${diagnostic.severity}] ${diagnostic.engine}/${diagnostic.ruleId}${move} ${file}:${line}:${column}${score}${unverified}`,
39
+ ` ${diagnostic.message}`,
40
+ ];
41
+ if (diagnostic.help !== undefined)
42
+ lines.push(` help: ${diagnostic.help}`);
43
+ if (diagnostic.repair !== undefined) {
44
+ const edits = diagnostic.repair.cascade.length;
45
+ const partial = diagnostic.repair.complete ? "" : " (partial)";
46
+ lines.push(` -> ${diagnostic.repair.operation}, ${edits} edit(s)${partial}`);
47
+ }
48
+ return lines;
49
+ };
50
+ /**
51
+ * The census first — whose silence is whose — then the findings, then the ratchet.
52
+ *
53
+ * The census and the ratchet are never truncated; only the finding list is bounded by
54
+ * `limit`. Truncating a verdict ("did the ratchet hold?") would be a preview that lies.
55
+ */
56
+ export const renderText = (run, options = {}) => {
57
+ const { report, diff } = run;
58
+ const limit = options.limit ?? 0;
59
+ const total = report.diagnostics.length;
60
+ const shown = limit > 0 ? report.diagnostics.slice(0, limit) : report.diagnostics;
61
+ const lines = [
62
+ report.generators.length === 0
63
+ ? "no engines ran — this is not a clean run"
64
+ : total === 0
65
+ ? `nothing new — 0 finding(s) in ${report.files} file(s)`
66
+ : `${report.counts.error} error(s), ${report.counts.warn} warning(s), ${report.counts.info} notice(s) in ${report.files} file(s)`,
67
+ "",
68
+ "engines",
69
+ ];
70
+ for (const generator of report.generators)
71
+ lines.push(engineLine(generator));
72
+ if (report.generators.length === 0) {
73
+ lines.push(" none configured — add an engine to jig.config.json, then run `jig engines`");
74
+ }
75
+ if (total > 0) {
76
+ lines.push("", "findings");
77
+ shown.forEach((diagnostic, index) => {
78
+ lines.push(...findingLines(diagnostic, index + 1));
79
+ });
80
+ if (shown.length < total) {
81
+ lines.push(` … showing ${shown.length} of ${total} finding(s); raise --limit to see the rest`);
82
+ }
83
+ }
84
+ // The gate's own section: the findings it holds, and the engines whose silence it cannot
85
+ // rule on. The census above never folds into this — a replayed engine is not a passing one.
86
+ const gate = options.gate;
87
+ if (gate !== undefined && gate.infrastructure.length > 0) {
88
+ lines.push("", report.generators.length === 0
89
+ ? `gate — no engines configured; nothing was looked at (exit ${EXIT.infrastructure})`
90
+ : `gate — engine(s) could not run: ${gate.infrastructure.join(", ")} (exit ${EXIT.infrastructure})`);
91
+ }
92
+ if (gate !== undefined &&
93
+ gate.scope === "touched-files" &&
94
+ gate.failing.length === 0 &&
95
+ total > 0) {
96
+ lines.push("", `gate — touched-files: no finding in this change; ${total} existing finding(s) are reported, not enforced`);
97
+ }
98
+ if (gate !== undefined && gate.failing.length > 0) {
99
+ lines.push("", `gate — failOn: ${gate.failOn}, scope: ${gate.scope}`);
100
+ lines.push(...gateLines(gate.failing));
101
+ }
102
+ if (gate !== undefined && gate.advisory.length > 0) {
103
+ const byEngine = new Map();
104
+ for (const diagnostic of gate.advisory) {
105
+ byEngine.set(diagnostic.engine, (byEngine.get(diagnostic.engine) ?? 0) + 1);
106
+ }
107
+ // Advisory is a decision about the exit code, not about the report: say so, or a reader
108
+ // takes a green run over 1,167 findings for a clean tree.
109
+ lines.push("", `gate — advisory (reported, not gating): ${[...byEngine]
110
+ .map(([engine, count]) => `${engine} ${count} finding(s)`)
111
+ .join(", ")}`);
112
+ }
113
+ if (diff.stale.length > 0) {
114
+ lines.push("", `${diff.stale.length} baselined finding(s) no longer fire; \`jig baseline\` shrinks the ledger`);
115
+ }
116
+ return lines.join("\n");
117
+ };
118
+ /** GitHub counts three severities; the protocol's three map onto them by name. */
119
+ const ANNOTATION_LEVEL = { error: "error", warn: "warning", info: "notice" };
120
+ const annotationLevel = (diagnostic) => ANNOTATION_LEVEL[diagnostic.severity];
121
+ /** GitHub Actions workflow commands, one per finding. */
122
+ export const renderGithub = (report) => report.diagnostics
123
+ .map((diagnostic) => {
124
+ const { file, line, column } = diagnostic.location;
125
+ const title = `${diagnostic.engine}/${diagnostic.ruleId}`;
126
+ return `::${annotationLevel(diagnostic)} file=${file},line=${line},col=${column},title=${title}::${diagnostic.message}`;
127
+ })
128
+ .join("\n");
129
+ /** The report as JSON — the machine form a host or a test reads. */
130
+ export const renderJson = (report) => `${JSON.stringify(report, null, 2)}\n`;
131
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoD,MAAM,qBAAqB,CAAA;AAClG,OAAO,EAAE,IAAI,EAAoB,MAAM,WAAW,CAAA;AAsBlD,+FAA+F;AAC/F,MAAM,SAAS,GAAG,CAAC,OAAkC,EAAyB,EAAE;IAC9E,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAA;IACxC,KAAK,MAAM,UAAU,IAAI,OAAO,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,UAAU,CAAC,UAAU,CAAC,CAAA;QAClC,MAAM,C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AA;AAErF,MAAM,eAAe,GAAG,CAAC,UAAsB,EAAU,EAAE,CAAC,gBAAgB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;AAEjG,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,EAAU,EAAE,CACrD,MAAM,CAAC,WAAW;KACf,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;IAClB,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,QAAQ,CAAA;IAClD,MAAM,KAAK,GAAG,GAAG,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,EAAE,CAAA;IACzD,OAAO,KAAK,eAAe,CAAC,UAAU,CAAC,SAAS,IAAI,SAAS,IAAI,QAAQ,MAAM,UAAU,KAAK,KAAK,UAAU,CAAC,OAAO,EAAE,CAAA;AACzH,CAAC,CAAC;KACD,IAAI,CAAC,IAAI,CAAC,CAAA;AAEf,oEAAoE;AACpE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAA"}
package/dist/room.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { Predicate } from "effect";
2
+ /**
3
+ * Whether this invocation is `jig room ...`.
4
+ *
5
+ * @param argv - The process arguments, including node and the script.
6
+ * @returns True when the first word is `room`.
7
+ */
8
+ export declare const isRoomInvocation: Predicate.Predicate<ReadonlyArray<string>>;
9
+ /**
10
+ * Run the room CLI with the remaining arguments.
11
+ *
12
+ * @param argv - The process arguments, including node and the script.
13
+ * @returns The room CLI's exit code.
14
+ */
15
+ export declare const runRoom: (argv: ReadonlyArray<string>) => number;
16
+ //# sourceMappingURL=room.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room.d.ts","sourceRoot":"","sources":["../src/room.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,SAAS,EAAE,MAAM,QAAQ,CAAA;AAyB1C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,CAAC,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,CACpD,CAAA;AAEpB;;;;;GAKG;AACH,eAAO,MAAM,OAAO,SAAU,aAAa,CAAC,MAAM,CAAC,KAAG,MAYrD,CAAA"}
package/dist/room.js ADDED
@@ -0,0 +1,56 @@
1
+ import { Option, Predicate } from "effect";
2
+ import { spawnSync } from "node:child_process";
3
+ import { existsSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ /*
7
+ * `jig room` forwards to the room CLI.
8
+ *
9
+ * jig never links the tools it drives — it shells out, and the seam is the command line.
10
+ * `room` is the same shape: a binary, found on PATH, then this checkout's build, then its
11
+ * source under the development condition.
12
+ */
13
+ const packageRoot = () => fileURLToPath(new URL("..", import.meta.url));
14
+ const onPath = (name) => {
15
+ for (const dir of (process.env.PATH ?? "").split(":")) {
16
+ if (dir === "")
17
+ continue;
18
+ const candidate = join(dir, name);
19
+ if (existsSync(candidate))
20
+ return Option.some(candidate);
21
+ }
22
+ return Option.none();
23
+ };
24
+ /**
25
+ * Whether this invocation is `jig room ...`.
26
+ *
27
+ * @param argv - The process arguments, including node and the script.
28
+ * @returns True when the first word is `room`.
29
+ */
30
+ export const isRoomInvocation = (argv) => argv[2] === "room";
31
+ /**
32
+ * Run the room CLI with the remaining arguments.
33
+ *
34
+ * @param argv - The process arguments, including node and the script.
35
+ * @returns The room CLI's exit code.
36
+ */
37
+ export const runRoom = (argv) => {
38
+ const rest = argv.slice(3);
39
+ const override = process.env.ROOM_BIN;
40
+ if (override !== undefined && override !== "") {
41
+ return spawn(override, rest);
42
+ }
43
+ const global = Option.getOrUndefined(onPath("room"));
44
+ if (global !== undefined)
45
+ return spawn(global, rest);
46
+ const built = join(packageRoot(), "..", "room", "dist", "cli.js");
47
+ if (existsSync(built))
48
+ return spawn(process.execPath, [built, ...rest]);
49
+ const source = join(packageRoot(), "..", "room", "src", "cli.ts");
50
+ return spawn(process.execPath, ["--conditions=development", source, ...rest]);
51
+ };
52
+ const spawn = (command, args) => {
53
+ const result = spawnSync(command, [...args], { stdio: "inherit" });
54
+ return result.status ?? (result.error === undefined ? 1 : 127);
55
+ };
56
+ //# sourceMappingURL=room.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room.js","sourceRoot":"","sources":["../src/room.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC;;;;;;GAMG;AAEH,MAAM,WAAW,GAAG,GAAW,EAAE,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAE/E,MAAM,MAAM,GAAG,CAAC,IAAY,EAAyB,EAAE;IACrD,KAAK,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACtD,IAAI,GAAG,KAAK,EAAE;YAAE,SAAQ;QACxB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QACjC,IAAI,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC1D,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;AACtB,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA+C,CAAC,IAAI,EAAE,EAAE,CACn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AO,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAChE,CAAC,CAAA"}
package/dist/run.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { Effect } from "effect";
2
+ import { type Baseline, type BaselineDiff, type HarnessConfig, type Report } from "@autotelic/protocol";
3
+ import type { Spawner } from "./exec.ts";
4
+ export interface HarnessRun {
5
+ readonly report: Report;
6
+ readonly diff: BaselineDiff;
7
+ }
8
+ /** Run every configured engine and compare the result to what was accepted. */
9
+ export declare const harnessRun: (root: string, config: HarnessConfig, baseline: Baseline) => Effect.Effect<HarnessRun, never, Spawner>;
10
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,MAAM,EACZ,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAWxC,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAC5B;AAED,+EAA+E;AAC/E,eAAO,MAAM,UAAU,SACf,MAAM,UACJ,aAAa,YACX,QAAQ,KACjB,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAavC,CAAA"}
package/dist/run.js ADDED
@@ -0,0 +1,18 @@
1
+ import { Effect } from "effect";
2
+ import { diffBaseline, makeReport, } from "@autotelic/protocol";
3
+ import { runEngines } from "./engines.js";
4
+ /** Run every configured engine and compare the result to what was accepted. */
5
+ export const harnessRun = (root, config, baseline) => Effect.gen(function* () {
6
+ const started = Date.now();
7
+ const outcomes = yield* runEngines(root, config.engines);
8
+ const diagnostics = outcomes.flatMap((outcome) => outcome.diagnostics);
9
+ const report = makeReport({
10
+ diagnostics,
11
+ files: new Set(diagnostics.map((diagnostic) => diagnostic.location.file)).size,
12
+ generators: outcomes.map((outcome) => outcome.summary),
13
+ elapsedMs: Date.now() - started,
14
+ });
15
+ const diff = diffBaseline(baseline, report.diagnostics);
16
+ return { report, diff };
17
+ });
18
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EACL,YAAY,EACZ,UAAU,GAKX,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAezC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAY,EACZ,MAAqB,EACrB,QAAkB,EACyB,EAAE,CAC7C,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;IACxD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IACtE,MAAM,MAAM,GAAG,UAAU,CAAC;QACxB,WAAW;QACX,KAAK,EAAE,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;QAC9E,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;QACtD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO;KAChC,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,CAAA;IACvD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AACzB,CAAC,CAAC,CAAA"}