@tjalve/cube-cli 0.1.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 (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -0
  3. package/dist/errors/index.d.ts +28 -0
  4. package/dist/errors/index.d.ts.map +1 -0
  5. package/dist/errors/index.js +58 -0
  6. package/dist/errors/index.js.map +1 -0
  7. package/dist/fixtures/cli.d.ts +4 -0
  8. package/dist/fixtures/cli.d.ts.map +1 -0
  9. package/dist/fixtures/cli.js +195 -0
  10. package/dist/fixtures/cli.js.map +1 -0
  11. package/dist/fixtures/metadata.d.ts +347 -0
  12. package/dist/fixtures/metadata.d.ts.map +1 -0
  13. package/dist/fixtures/metadata.js +372 -0
  14. package/dist/fixtures/metadata.js.map +1 -0
  15. package/dist/help/index.d.ts +24 -0
  16. package/dist/help/index.d.ts.map +1 -0
  17. package/dist/help/index.js +254 -0
  18. package/dist/help/index.js.map +1 -0
  19. package/dist/index.d.ts +20 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +21 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/metadata/define.d.ts +11 -0
  24. package/dist/metadata/define.d.ts.map +1 -0
  25. package/dist/metadata/define.js +125 -0
  26. package/dist/metadata/define.js.map +1 -0
  27. package/dist/metadata/index.d.ts +3 -0
  28. package/dist/metadata/index.d.ts.map +1 -0
  29. package/dist/metadata/index.js +2 -0
  30. package/dist/metadata/index.js.map +1 -0
  31. package/dist/metadata/types.d.ts +109 -0
  32. package/dist/metadata/types.d.ts.map +1 -0
  33. package/dist/metadata/types.js +2 -0
  34. package/dist/metadata/types.js.map +1 -0
  35. package/dist/mutation/index.d.ts +55 -0
  36. package/dist/mutation/index.d.ts.map +1 -0
  37. package/dist/mutation/index.js +162 -0
  38. package/dist/mutation/index.js.map +1 -0
  39. package/dist/output/index.d.ts +32 -0
  40. package/dist/output/index.d.ts.map +1 -0
  41. package/dist/output/index.js +94 -0
  42. package/dist/output/index.js.map +1 -0
  43. package/dist/prompts/index.d.ts +37 -0
  44. package/dist/prompts/index.d.ts.map +1 -0
  45. package/dist/prompts/index.js +78 -0
  46. package/dist/prompts/index.js.map +1 -0
  47. package/dist/redaction/index.d.ts +10 -0
  48. package/dist/redaction/index.d.ts.map +1 -0
  49. package/dist/redaction/index.js +83 -0
  50. package/dist/redaction/index.js.map +1 -0
  51. package/dist/registry/index.d.ts +25 -0
  52. package/dist/registry/index.d.ts.map +1 -0
  53. package/dist/registry/index.js +286 -0
  54. package/dist/registry/index.js.map +1 -0
  55. package/dist/runtime/index.d.ts +69 -0
  56. package/dist/runtime/index.d.ts.map +1 -0
  57. package/dist/runtime/index.js +581 -0
  58. package/dist/runtime/index.js.map +1 -0
  59. package/dist/schema/index.d.ts +122 -0
  60. package/dist/schema/index.d.ts.map +1 -0
  61. package/dist/schema/index.js +208 -0
  62. package/dist/schema/index.js.map +1 -0
  63. package/dist/terminal/index.d.ts +31 -0
  64. package/dist/terminal/index.d.ts.map +1 -0
  65. package/dist/terminal/index.js +118 -0
  66. package/dist/terminal/index.js.map +1 -0
  67. package/dist/testing/index.d.ts +85 -0
  68. package/dist/testing/index.d.ts.map +1 -0
  69. package/dist/testing/index.js +293 -0
  70. package/dist/testing/index.js.map +1 -0
  71. package/package.json +107 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ai-qube-cli contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # @tjalve/cube-cli
2
+
3
+ Reusable TypeScript CLI infrastructure for command-line packages.
4
+
5
+ This package is a library foundation for CLI metadata, runtime wiring, help, schema, structured output, safety helpers, and tests. It is not a product-specific CLI, and it does not own the behavior or side effects of consuming commands.
6
+
7
+ ## Installation
8
+
9
+ Use exact versions and keep lifecycle scripts disabled during dependency installation where supported:
10
+
11
+ ```sh
12
+ pnpm add @tjalve/cube-cli@0.1.0 --save-exact --ignore-scripts
13
+ ```
14
+
15
+ ## Development baseline
16
+
17
+ - Node.js 24 or newer
18
+ - pnpm 11 or newer
19
+ - ESM-first TypeScript source
20
+ - Compiled JavaScript and declaration files in `dist/`
21
+
22
+ ## Package boundary
23
+
24
+ Consuming packages own their command behavior, validation rules, product logic, state management, service integrations, policy decisions, and side effects. This package provides reusable infrastructure only; it does not mutate user projects, configure shells, install hooks, contact external services, or run background processes during normal installation.
25
+
26
+ ## Adoption
27
+
28
+ - [Adoption guide](docs/adoption-guide.md): add command metadata, registry-backed runtime wiring, schema output, JSON trigger metadata, human/JSON output, and CLI contract tests.
29
+ - [Compatibility checklist](docs/compatibility-checklist.md): migrate existing commands command-by-command while preserving help, JSON, schema, exit-code, dry-run, and ownership boundaries.
30
+
31
+ ## Verification
32
+
33
+ ```sh
34
+ pnpm install --frozen-lockfile --ignore-scripts
35
+ pnpm run build
36
+ pnpm run typecheck
37
+ pnpm test
38
+ pnpm run package-dry-run
39
+ ```
@@ -0,0 +1,28 @@
1
+ import type { ExitCodeCategory } from "../metadata/index.js";
2
+ export interface CliErrorDetails {
3
+ readonly command?: string;
4
+ readonly kind: string;
5
+ readonly operation: string;
6
+ readonly likelyCause: string;
7
+ readonly suggestedNextAction: string;
8
+ readonly category: ExitCodeCategory;
9
+ readonly exitCode?: number;
10
+ }
11
+ export interface CliErrorShape extends CliErrorDetails {
12
+ readonly exitCode: number;
13
+ }
14
+ export declare class CliError extends Error implements CliErrorShape {
15
+ readonly command?: string;
16
+ readonly kind: string;
17
+ readonly operation: string;
18
+ readonly likelyCause: string;
19
+ readonly suggestedNextAction: string;
20
+ readonly category: ExitCodeCategory;
21
+ readonly exitCode: number;
22
+ constructor(details: CliErrorDetails);
23
+ }
24
+ export declare function createCliError(details: CliErrorDetails): CliError;
25
+ export declare function isCliError(error: unknown): error is CliError;
26
+ export declare function exitCodeForCategory(category: ExitCodeCategory): number;
27
+ export declare function renderCliErrorText(error: CliErrorShape): string;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,QAAS,SAAQ,KAAM,YAAW,aAAa;IAC1D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,OAAO,EAAE,eAAe;CAarC;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAEjE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAiBtE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAS/D"}
@@ -0,0 +1,58 @@
1
+ import { redactText } from "../redaction/index.js";
2
+ export class CliError extends Error {
3
+ command;
4
+ kind;
5
+ operation;
6
+ likelyCause;
7
+ suggestedNextAction;
8
+ category;
9
+ exitCode;
10
+ constructor(details) {
11
+ super(`${redactText(details.operation)}: ${redactText(details.likelyCause)}`);
12
+ this.name = "CliError";
13
+ if (details.command !== undefined) {
14
+ this.command = details.command;
15
+ }
16
+ this.kind = details.kind;
17
+ this.operation = redactText(details.operation);
18
+ this.likelyCause = redactText(details.likelyCause);
19
+ this.suggestedNextAction = redactText(details.suggestedNextAction);
20
+ this.category = details.category;
21
+ this.exitCode = details.exitCode ?? exitCodeForCategory(details.category);
22
+ }
23
+ }
24
+ export function createCliError(details) {
25
+ return new CliError(details);
26
+ }
27
+ export function isCliError(error) {
28
+ return error instanceof CliError;
29
+ }
30
+ export function exitCodeForCategory(category) {
31
+ switch (category) {
32
+ case "success":
33
+ return 0;
34
+ case "usage":
35
+ return 2;
36
+ case "validation":
37
+ return 3;
38
+ case "external":
39
+ return 4;
40
+ case "safety":
41
+ return 5;
42
+ case "unexpected":
43
+ return 70;
44
+ default:
45
+ return 1;
46
+ }
47
+ }
48
+ export function renderCliErrorText(error) {
49
+ return [
50
+ `Error: ${error.kind}`,
51
+ `Operation: ${redactText(error.operation)}`,
52
+ `Likely cause: ${redactText(error.likelyCause)}`,
53
+ `Suggested next action: ${redactText(error.suggestedNextAction)}`,
54
+ `Exit code category: ${error.category}`,
55
+ ""
56
+ ].join("\n");
57
+ }
58
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAgBnD,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,OAAO,CAAU;IACjB,IAAI,CAAS;IACb,SAAS,CAAS;IAClB,WAAW,CAAS;IACpB,mBAAmB,CAAS;IAC5B,QAAQ,CAAmB;IAC3B,QAAQ,CAAS;IAE1B,YAAY,OAAwB;QAClC,KAAK,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC9E,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAClC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,WA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Cli: import("../runtime/index.js").CliRuntime;
3
+ export declare function runFixtureCli(argv?: readonly string[]): Promise<number>;
4
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/fixtures/cli.ts"],"names":[],"mappings":";AAkBA,eAAO,MAAM,UAAU,0CAuJrB,CAAC;AAIH,wBAAsB,aAAa,CAAC,IAAI,GAAE,SAAS,MAAM,EAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CASpG"}
@@ -0,0 +1,195 @@
1
+ #!/usr/bin/env node
2
+ import { readFileSync } from "node:fs";
3
+ import { pathToFileURL } from "node:url";
4
+ import { createCliError } from "../errors/index.js";
5
+ import { defineExtensions } from "../metadata/index.js";
6
+ import { createDryRunPlan, createDryRunPlanFields, createSupplyChainBlock, renderDryRunPlan, renderMutationWarning, renderSupplyChainBlock } from "../mutation/index.js";
7
+ import { resolvePromptValue } from "../prompts/index.js";
8
+ import { createCli, createCommand, createSchemaCommand, createTopicCommand, runCli } from "../runtime/index.js";
9
+ import { cacheClearCommand, cacheExplodeCommand, cacheInspectCommand, cacheInstallCommand, cachePromptCommand, cacheTopic, cacheValidateCommand, fixtureMetadata } from "./metadata.js";
10
+ let currentRegistry = fixtureMetadata;
11
+ const packageMetadata = readPackageMetadata();
12
+ const packageIdentity = {
13
+ packageName: packageMetadata.name,
14
+ packageVersion: packageMetadata.version
15
+ };
16
+ export const fixtureCli = createCli({
17
+ bin: "fixture",
18
+ ...packageIdentity,
19
+ description: "Product-neutral fixture CLI for @tjalve/cube-cli runtime tests.",
20
+ registry: fixtureMetadata,
21
+ topics: [createTopicCommand(cacheTopic)],
22
+ commands: [
23
+ createCommand(cacheInspectCommand, ({ args }) => {
24
+ const key = typeof args.key === "string" ? args.key : "all";
25
+ return {
26
+ json: { key },
27
+ human: `EXECUTED cache inspect\nInspected cache key: ${key}\n`
28
+ };
29
+ }),
30
+ createCommand(cacheClearCommand, ({ flags }) => {
31
+ if (flags["dry-run"] === true) {
32
+ const plan = createDryRunPlan({
33
+ command: "cache clear",
34
+ summary: "Remove fixture cache entries without touching external systems.",
35
+ mutationCategories: ["local-files"],
36
+ steps: [
37
+ {
38
+ action: "delete",
39
+ target: "fixture-cache/*",
40
+ category: "local-files",
41
+ description: "Remove local fixture cache entries."
42
+ }
43
+ ],
44
+ rerunCommand: "fixture cache clear --yes"
45
+ });
46
+ return { json: createDryRunPlanFields(plan), human: renderDryRunPlan(plan) };
47
+ }
48
+ return {
49
+ human: `${renderMutationWarning({
50
+ command: "cache clear",
51
+ categories: ["local-files"],
52
+ dryRun: cacheClearCommand.interactions?.dryRun,
53
+ message: "Use --dry-run before removing fixture cache entries."
54
+ })}EXECUTED cache clear\nRemoved fixture cache entries.\n`
55
+ };
56
+ }),
57
+ createCommand(cacheInstallCommand, ({ flags }) => {
58
+ const plan = createDryRunPlan({
59
+ command: "cache install",
60
+ summary: "Prepare dependency cache metadata without running package-manager commands.",
61
+ mutationCategories: ["dependency", "local-files"],
62
+ steps: [
63
+ {
64
+ action: "review",
65
+ target: "fixture-lockfile metadata",
66
+ category: "dependency",
67
+ description: "Inspect consumer-provided dependency metadata."
68
+ },
69
+ {
70
+ action: "write",
71
+ target: "fixture dependency cache",
72
+ category: "local-files",
73
+ description: "Record cache entries after policy approval."
74
+ }
75
+ ],
76
+ rerunCommand: "fixture cache install"
77
+ });
78
+ if (flags["dry-run"] === true) {
79
+ return { json: createDryRunPlanFields(plan), human: `${renderDryRunPlan(plan)}No external commands executed.\n` };
80
+ }
81
+ const block = createSupplyChainBlock({
82
+ command: "cache install",
83
+ reason: "Dependency cache preparation requires consuming-package supply-chain approval.",
84
+ sensitiveKinds: ["dependency", "package-manager"],
85
+ checks: [
86
+ {
87
+ name: "package-age-gate",
88
+ status: "needs-review",
89
+ description: "Consumer policy must verify package age before execution."
90
+ },
91
+ {
92
+ name: "lifecycle-scripts",
93
+ status: "blocked",
94
+ description: "Lifecycle scripts remain blocked unless the consuming package approves them."
95
+ }
96
+ ],
97
+ suggestedNextAction: "Run --dry-run and apply the consuming package approval policy before retrying."
98
+ });
99
+ if (flags.json === true) {
100
+ throw createCliError({
101
+ command: "cache install",
102
+ kind: "supply-chain-blocked",
103
+ operation: "prepare dependency cache",
104
+ likelyCause: "Dependency cache preparation requires consuming-package supply-chain approval.",
105
+ suggestedNextAction: "Run --dry-run and apply the consuming package approval policy before retrying.",
106
+ category: "safety",
107
+ exitCode: 5
108
+ });
109
+ }
110
+ return { exitCode: 5, human: `${renderSupplyChainBlock(block)}No external commands executed.\n` };
111
+ }),
112
+ createCommand(cacheValidateCommand, () => {
113
+ throw createCliError({
114
+ kind: "cache-config-invalid",
115
+ operation: "validate cache configuration",
116
+ likelyCause: "The fixture cache configuration is missing a required directory.",
117
+ suggestedNextAction: "Create the cache directory or update the cache configuration path.",
118
+ category: "validation"
119
+ });
120
+ }),
121
+ createCommand(cachePromptCommand, async ({ flags }) => {
122
+ const valueFlag = typeof flags.value === "string" ? flags.value : undefined;
123
+ const useDefault = flags.defaults === true || flags.yes === true;
124
+ const promptValue = await resolvePromptValue({
125
+ command: cachePromptCommand,
126
+ promptName: "cache value",
127
+ value: valueFlag,
128
+ defaultValue: useDefault ? "fixture-default" : undefined,
129
+ defaults: flags.defaults === true,
130
+ yes: flags.yes === true,
131
+ jsonMode: flags.json === true,
132
+ prompt: () => "interactive-value"
133
+ });
134
+ return {
135
+ json: { promptValue },
136
+ human: `Resolved prompt value: ${promptValue}\n`
137
+ };
138
+ }),
139
+ createCommand(cacheExplodeCommand, () => {
140
+ throw new Error("Fixture exploded unexpectedly.");
141
+ }),
142
+ createSchemaCommand({
143
+ registry: () => currentRegistry,
144
+ bin: "fixture",
145
+ ...packageIdentity,
146
+ sections: {
147
+ config: {
148
+ defaults: {
149
+ output: "human",
150
+ cacheDirectory: ".fixture-cache"
151
+ },
152
+ token: "fixture-token-value-1234567890"
153
+ },
154
+ providers: {
155
+ local: {
156
+ available: true,
157
+ capabilities: ["read", "dry-run"]
158
+ }
159
+ }
160
+ },
161
+ extensions: defineExtensions({
162
+ fixture: true,
163
+ purpose: "schema-integration"
164
+ })
165
+ })
166
+ ]
167
+ });
168
+ currentRegistry = fixtureCli.registry;
169
+ export async function runFixtureCli(argv = process.argv.slice(2)) {
170
+ const result = await runCli(fixtureCli, argv);
171
+ if (result.stdout.length > 0) {
172
+ process.stdout.write(result.stdout);
173
+ }
174
+ if (result.stderr.length > 0) {
175
+ process.stderr.write(result.stderr);
176
+ }
177
+ return result.exitCode;
178
+ }
179
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
180
+ process.exitCode = await runFixtureCli();
181
+ }
182
+ function readPackageMetadata() {
183
+ const parsed = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8"));
184
+ if (!isPackageMetadata(parsed)) {
185
+ throw new TypeError("package.json must include string name and version fields.");
186
+ }
187
+ return { name: parsed.name, version: parsed.version };
188
+ }
189
+ function isPackageMetadata(value) {
190
+ return isRecord(value) && typeof value.name === "string" && typeof value.version === "string";
191
+ }
192
+ function isRecord(value) {
193
+ return typeof value === "object" && value !== null && !Array.isArray(value);
194
+ }
195
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/fixtures/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACzK,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EA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