@cogitator-ai/cli 0.5.20 → 0.6.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.
- package/README.md +98 -40
- package/dist/commands/add.d.ts +11 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +79 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/assistant.d.ts.map +1 -1
- package/dist/commands/assistant.js +14 -12
- package/dist/commands/assistant.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +12 -10
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +17 -13
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/deploy.d.ts +35 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +134 -76
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +14 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +84 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/doctor.d.ts +5 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +52 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/eval.d.ts +12 -0
- package/dist/commands/eval.d.ts.map +1 -0
- package/dist/commands/eval.js +90 -0
- package/dist/commands/eval.js.map +1 -0
- package/dist/commands/init.d.ts +9 -51
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +87 -400
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +9 -6
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/mcp.d.ts +18 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +155 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +43 -15
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +16 -11
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/skill.d.ts.map +1 -1
- package/dist/commands/skill.js +23 -23
- package/dist/commands/skill.js.map +1 -1
- package/dist/commands/status.d.ts +21 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +64 -39
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +26 -24
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/wizard.d.ts.map +1 -1
- package/dist/commands/wizard.js +5 -0
- package/dist/commands/wizard.js.map +1 -1
- package/dist/index.js +9 -42
- package/dist/index.js.map +1 -1
- package/dist/program.d.ts +4 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +61 -0
- package/dist/program.js.map +1 -0
- package/dist/utils/add.d.ts +81 -0
- package/dist/utils/add.d.ts.map +1 -0
- package/dist/utils/add.js +151 -0
- package/dist/utils/add.js.map +1 -0
- package/dist/utils/cli.d.ts +49 -0
- package/dist/utils/cli.d.ts.map +1 -0
- package/dist/utils/cli.js +106 -0
- package/dist/utils/cli.js.map +1 -0
- package/dist/utils/docs.d.ts +39 -0
- package/dist/utils/docs.d.ts.map +1 -0
- package/dist/utils/docs.js +198 -0
- package/dist/utils/docs.js.map +1 -0
- package/dist/utils/doctor.d.ts +41 -0
- package/dist/utils/doctor.d.ts.map +1 -0
- package/dist/utils/doctor.js +378 -0
- package/dist/utils/doctor.js.map +1 -0
- package/dist/utils/evals.d.ts +50 -0
- package/dist/utils/evals.d.ts.map +1 -0
- package/dist/utils/evals.js +78 -0
- package/dist/utils/evals.js.map +1 -0
- package/dist/utils/provider-models.d.ts +8 -2
- package/dist/utils/provider-models.d.ts.map +1 -1
- package/dist/utils/provider-models.js +32 -52
- package/dist/utils/provider-models.js.map +1 -1
- package/dist/utils/registry-worker.d.ts +2 -0
- package/dist/utils/registry-worker.d.ts.map +1 -0
- package/dist/utils/registry-worker.js +35 -0
- package/dist/utils/registry-worker.js.map +1 -0
- package/dist/utils/registry.d.ts +19 -0
- package/dist/utils/registry.d.ts.map +1 -0
- package/dist/utils/registry.js +58 -0
- package/dist/utils/registry.js.map +1 -0
- package/package.json +12 -8
package/dist/index.js
CHANGED
|
@@ -2,47 +2,14 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Cogitator CLI
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import { modelsCommand } from './commands/models.js';
|
|
15
|
-
import { deployCommand } from './commands/deploy.js';
|
|
16
|
-
import { assistantCommand } from './commands/assistant.js';
|
|
17
|
-
import { buildCommand } from './commands/build.js';
|
|
18
|
-
import { daemonCommand } from './commands/daemon.js';
|
|
19
|
-
import { skillCommand } from './commands/skill.js';
|
|
20
|
-
import { wizardCommand } from './commands/wizard.js';
|
|
21
|
-
import { log } from './utils/logger.js';
|
|
22
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
23
|
-
const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
|
|
24
|
-
const program = new Command()
|
|
25
|
-
.name('cogitator')
|
|
26
|
-
.description('Cogitator AI Agent Runtime CLI')
|
|
27
|
-
.version(pkg.version);
|
|
28
|
-
program.addCommand(initCommand);
|
|
29
|
-
program.addCommand(upCommand);
|
|
30
|
-
program.addCommand(downCommand);
|
|
31
|
-
program.addCommand(runCommand);
|
|
32
|
-
program.addCommand(statusCommand);
|
|
33
|
-
program.addCommand(logsCommand);
|
|
34
|
-
program.addCommand(modelsCommand);
|
|
35
|
-
program.addCommand(deployCommand);
|
|
36
|
-
program.addCommand(assistantCommand);
|
|
37
|
-
program.addCommand(buildCommand);
|
|
38
|
-
program.addCommand(daemonCommand);
|
|
39
|
-
program.addCommand(skillCommand);
|
|
40
|
-
program.addCommand(wizardCommand);
|
|
41
|
-
program.parseAsync().catch((error) => {
|
|
42
|
-
log.error(error instanceof Error ? error.message : String(error));
|
|
43
|
-
if (process.env.COGITATOR_DEBUG && error instanceof Error && error.stack) {
|
|
44
|
-
console.error(error.stack);
|
|
45
|
-
}
|
|
46
|
-
process.exit(1);
|
|
5
|
+
import { CommanderError } from 'commander';
|
|
6
|
+
import { createProgram } from './program.js';
|
|
7
|
+
import { exitCodeOf, reportFailure } from './utils/cli.js';
|
|
8
|
+
createProgram()
|
|
9
|
+
.parseAsync()
|
|
10
|
+
.catch((error) => {
|
|
11
|
+
if (error instanceof CommanderError)
|
|
12
|
+
process.exit(exitCodeOf(error));
|
|
13
|
+
process.exit(reportFailure(error, { json: process.argv.includes('--json') }));
|
|
47
14
|
});
|
|
48
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;GAEG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE3D,aAAa,EAAE;KACZ,UAAU,EAAE;KACZ,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxB,IAAI,KAAK,YAAY,cAAc;QAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiCpC,qDAAqD;AACrD,wBAAgB,aAAa,IAAI,OAAO,CA6BvC"}
|
package/dist/program.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { initCommand } from './commands/init.js';
|
|
6
|
+
import { addCommand } from './commands/add.js';
|
|
7
|
+
import { mcpCommand } from './commands/mcp.js';
|
|
8
|
+
import { devCommand } from './commands/dev.js';
|
|
9
|
+
import { doctorCommand } from './commands/doctor.js';
|
|
10
|
+
import { evalCommand } from './commands/eval.js';
|
|
11
|
+
import { upCommand, downCommand } from './commands/up.js';
|
|
12
|
+
import { runCommand } from './commands/run.js';
|
|
13
|
+
import { statusCommand } from './commands/status.js';
|
|
14
|
+
import { logsCommand } from './commands/logs.js';
|
|
15
|
+
import { modelsCommand } from './commands/models.js';
|
|
16
|
+
import { deployCommand } from './commands/deploy.js';
|
|
17
|
+
import { assistantCommand } from './commands/assistant.js';
|
|
18
|
+
import { buildCommand } from './commands/build.js';
|
|
19
|
+
import { daemonCommand } from './commands/daemon.js';
|
|
20
|
+
import { skillCommand } from './commands/skill.js';
|
|
21
|
+
import { wizardCommand } from './commands/wizard.js';
|
|
22
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
|
|
24
|
+
/** Commander errors reach the entry point from every command, so they exit with the same codes. */
|
|
25
|
+
function configure(command) {
|
|
26
|
+
command.showSuggestionAfterError().exitOverride();
|
|
27
|
+
for (const sub of command.commands)
|
|
28
|
+
configure(sub);
|
|
29
|
+
}
|
|
30
|
+
/** The `cogitator` command with every subcommand. */
|
|
31
|
+
export function createProgram() {
|
|
32
|
+
const program = new Command()
|
|
33
|
+
.name('cogitator')
|
|
34
|
+
.description('Cogitator AI Agent Runtime CLI')
|
|
35
|
+
.version(pkg.version);
|
|
36
|
+
for (const command of [
|
|
37
|
+
initCommand,
|
|
38
|
+
addCommand,
|
|
39
|
+
devCommand,
|
|
40
|
+
doctorCommand,
|
|
41
|
+
evalCommand,
|
|
42
|
+
mcpCommand,
|
|
43
|
+
upCommand,
|
|
44
|
+
downCommand,
|
|
45
|
+
runCommand,
|
|
46
|
+
statusCommand,
|
|
47
|
+
logsCommand,
|
|
48
|
+
modelsCommand,
|
|
49
|
+
deployCommand,
|
|
50
|
+
assistantCommand,
|
|
51
|
+
buildCommand,
|
|
52
|
+
daemonCommand,
|
|
53
|
+
skillCommand,
|
|
54
|
+
wizardCommand,
|
|
55
|
+
]) {
|
|
56
|
+
program.addCommand(command);
|
|
57
|
+
}
|
|
58
|
+
configure(program);
|
|
59
|
+
return program;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=program.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAA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AC,gCAAgC,CAAC;SAC7C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACxB,KAAK,MAAM,OAAO,IAAI;QACpB,WAAW;QACX,UAAU;QACV,UAAU;QACV,aAAa;QACb,WAAW;QACX,UAAU;QACV,SAAS;QACT,WAAW;QACX,UAAU;QACV,aAAa;QACb,WAAW;QACX,aAAa;QACb,aAAa;QACb,gBAAgB;QAChB,YAAY;QACZ,aAAa;QACb,YAAY;QACZ,aAAa;KACd,EAAE,CAAC;QACF,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IACD,SAAS,CAAC,OAAO,CAAC,CAAC;IACnB,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type AddChanges, type AddPlan, type AddResult } from 'create-cogitator-app';
|
|
2
|
+
export interface AddFlags {
|
|
3
|
+
memory?: string;
|
|
4
|
+
vectorStore?: string;
|
|
5
|
+
deploy?: string;
|
|
6
|
+
channel?: string[];
|
|
7
|
+
agent?: string[];
|
|
8
|
+
}
|
|
9
|
+
/** The addition the command line asks for, validated against the scaffolder's catalogs. */
|
|
10
|
+
export declare function addChangesFrom(features: readonly string[], flags: AddFlags): AddChanges;
|
|
11
|
+
/** A unified diff with additions in green, removals in red and hunk headers dimmed. */
|
|
12
|
+
export declare function colorDiff(diff: string): string;
|
|
13
|
+
/** What the addition does, for the terminal; with `diffs`, every file change in full. */
|
|
14
|
+
export declare function formatAddPlan(plan: AddPlan, options: {
|
|
15
|
+
diffs: boolean;
|
|
16
|
+
}): string;
|
|
17
|
+
/** Why the addition was refused, with the change each conflicting file needs. */
|
|
18
|
+
export declare function formatConflicts(plan: AddPlan): string;
|
|
19
|
+
/** The plan as `--json` prints it: no file contents, diffs included. */
|
|
20
|
+
export declare function addPlanJson(plan: AddPlan, result?: Pick<AddResult, 'written' | 'deleted' | 'install' | 'format'>): {
|
|
21
|
+
written?: string[] | undefined;
|
|
22
|
+
deleted?: string[] | undefined;
|
|
23
|
+
install?: {
|
|
24
|
+
status: "done";
|
|
25
|
+
} | {
|
|
26
|
+
status: "skipped";
|
|
27
|
+
reason: string;
|
|
28
|
+
} | {
|
|
29
|
+
status: string;
|
|
30
|
+
error: string;
|
|
31
|
+
} | undefined;
|
|
32
|
+
format?: {
|
|
33
|
+
status: "done";
|
|
34
|
+
} | {
|
|
35
|
+
status: "skipped";
|
|
36
|
+
reason: string;
|
|
37
|
+
} | {
|
|
38
|
+
status: string;
|
|
39
|
+
error: string;
|
|
40
|
+
} | undefined;
|
|
41
|
+
ok: boolean;
|
|
42
|
+
upToDate: boolean;
|
|
43
|
+
added: string[];
|
|
44
|
+
spec: {
|
|
45
|
+
name: string;
|
|
46
|
+
app: "server" | "channels" | "script" | "next" | "worker";
|
|
47
|
+
channels: ("telegram" | "discord" | "slack" | "webchat")[];
|
|
48
|
+
memory: "memory" | "sqlite" | "postgres" | "none" | "redis" | "mongodb";
|
|
49
|
+
vectorStore: "memory" | "postgres" | "qdrant";
|
|
50
|
+
features: ("harness" | "mcp" | "rag" | "workflows" | "durable" | "swarms" | "evals" | "otel" | "langfuse" | "voice" | "sandbox" | "a2a")[];
|
|
51
|
+
provider: "anthropic" | "openai" | "google" | "ollama";
|
|
52
|
+
model: string;
|
|
53
|
+
deploy: "none" | "docker" | "fly";
|
|
54
|
+
compose: boolean;
|
|
55
|
+
packageManager: "pnpm" | "npm" | "yarn" | "bun";
|
|
56
|
+
codingAgents: ("claude" | "cursor" | "codex")[];
|
|
57
|
+
preset?: string | undefined;
|
|
58
|
+
server?: "express" | "fastify" | "hono" | "koa" | "tetsu" | undefined;
|
|
59
|
+
};
|
|
60
|
+
command: string;
|
|
61
|
+
changes: {
|
|
62
|
+
path: string;
|
|
63
|
+
kind: "create" | "update" | "delete";
|
|
64
|
+
source: "generated" | "merged";
|
|
65
|
+
diff: string;
|
|
66
|
+
}[];
|
|
67
|
+
conflicts: import("create-cogitator-app").AddConflict[];
|
|
68
|
+
notes: import("create-cogitator-app").AddNote[];
|
|
69
|
+
dependencies: Record<string, string>;
|
|
70
|
+
devDependencies: Record<string, string>;
|
|
71
|
+
removedDependencies: string[];
|
|
72
|
+
env: {
|
|
73
|
+
name: string;
|
|
74
|
+
required: boolean;
|
|
75
|
+
secret: boolean;
|
|
76
|
+
description: string;
|
|
77
|
+
}[];
|
|
78
|
+
services: string[];
|
|
79
|
+
warnings: string[];
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/utils/add.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,SAAS,EAEf,MAAM,sBAAsB,CAAC;AAG9B,MAAM,WAAW,QAAQ;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAmBD,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,GAAG,UAAU,CAwBvF;AAED,uFAAuF;AACvF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAW9C;AAYD,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAkDhF;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAarD;AAED,wEAAwE;AACxE,wBAAgB,WAAW,CACzB,IAAI,EAAE,OAAO,EACb,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BvE"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { CHANNELS, CODING_AGENTS, closest, DEPLOY_TARGETS, FEATURES, MEMORIES, VECTOR_STORES, } from 'create-cogitator-app';
|
|
3
|
+
import { UsageError } from './cli.js';
|
|
4
|
+
function oneOf(what, value, allowed) {
|
|
5
|
+
const found = allowed.find((candidate) => candidate === value);
|
|
6
|
+
if (found)
|
|
7
|
+
return found;
|
|
8
|
+
const match = closest(value, allowed);
|
|
9
|
+
throw new UsageError(`Unknown ${what} "${value}".${match ? ` Did you mean "${match}"?` : ''} Use one of: ${allowed.join(', ')}.`);
|
|
10
|
+
}
|
|
11
|
+
/** Values of a repeatable flag, which also takes comma-separated lists. */
|
|
12
|
+
function listOf(values) {
|
|
13
|
+
return (values ?? [])
|
|
14
|
+
.flatMap((value) => value.split(','))
|
|
15
|
+
.map((value) => value.trim())
|
|
16
|
+
.filter(Boolean);
|
|
17
|
+
}
|
|
18
|
+
/** The addition the command line asks for, validated against the scaffolder's catalogs. */
|
|
19
|
+
export function addChangesFrom(features, flags) {
|
|
20
|
+
const changes = {
|
|
21
|
+
features: listOf(features).map((feature) => oneOf('feature', feature, FEATURES)),
|
|
22
|
+
channels: listOf(flags.channel).map((channel) => oneOf('channel', channel, CHANNELS)),
|
|
23
|
+
codingAgents: listOf(flags.agent).map((agent) => oneOf('coding agent', agent, CODING_AGENTS)),
|
|
24
|
+
...(flags.memory && { memory: oneOf('memory', flags.memory, MEMORIES) }),
|
|
25
|
+
...(flags.vectorStore && {
|
|
26
|
+
vectorStore: oneOf('vector store', flags.vectorStore, VECTOR_STORES),
|
|
27
|
+
}),
|
|
28
|
+
...(flags.deploy && { deploy: oneOf('deploy target', flags.deploy, DEPLOY_TARGETS) }),
|
|
29
|
+
};
|
|
30
|
+
const empty = !changes.features?.length &&
|
|
31
|
+
!changes.channels?.length &&
|
|
32
|
+
!changes.codingAgents?.length &&
|
|
33
|
+
!changes.memory &&
|
|
34
|
+
!changes.vectorStore &&
|
|
35
|
+
!changes.deploy;
|
|
36
|
+
if (empty) {
|
|
37
|
+
throw new UsageError(`Name what to add: a feature (${FEATURES.join(', ')}), or --memory, --vector-store, --deploy, --channel, --agent`);
|
|
38
|
+
}
|
|
39
|
+
return changes;
|
|
40
|
+
}
|
|
41
|
+
/** A unified diff with additions in green, removals in red and hunk headers dimmed. */
|
|
42
|
+
export function colorDiff(diff) {
|
|
43
|
+
return diff
|
|
44
|
+
.split('\n')
|
|
45
|
+
.map((line) => {
|
|
46
|
+
if (line.startsWith('+++') || line.startsWith('---'))
|
|
47
|
+
return chalk.bold(line);
|
|
48
|
+
if (line.startsWith('@@'))
|
|
49
|
+
return chalk.cyan(line);
|
|
50
|
+
if (line.startsWith('+'))
|
|
51
|
+
return chalk.green(line);
|
|
52
|
+
if (line.startsWith('-'))
|
|
53
|
+
return chalk.red(line);
|
|
54
|
+
return line;
|
|
55
|
+
})
|
|
56
|
+
.join('\n');
|
|
57
|
+
}
|
|
58
|
+
const MARKS = {
|
|
59
|
+
create: chalk.green('+'),
|
|
60
|
+
update: chalk.yellow('~'),
|
|
61
|
+
delete: chalk.red('-'),
|
|
62
|
+
};
|
|
63
|
+
function indentList(items) {
|
|
64
|
+
return items.map((item) => ` ${item}`);
|
|
65
|
+
}
|
|
66
|
+
/** What the addition does, for the terminal; with `diffs`, every file change in full. */
|
|
67
|
+
export function formatAddPlan(plan, options) {
|
|
68
|
+
const out = [];
|
|
69
|
+
if (plan.upToDate)
|
|
70
|
+
return chalk.green('The project already has everything asked for, nothing to do.');
|
|
71
|
+
out.push(chalk.bold(`Adding ${plan.summary.join(', ')}`), '');
|
|
72
|
+
if (plan.changes.length > 0) {
|
|
73
|
+
out.push(chalk.bold('Files'));
|
|
74
|
+
for (const change of plan.changes) {
|
|
75
|
+
const how = change.source === 'merged' ? chalk.dim(' (merged with your edits)') : '';
|
|
76
|
+
out.push(` ${MARKS[change.kind]} ${change.path}${how}`);
|
|
77
|
+
}
|
|
78
|
+
out.push('');
|
|
79
|
+
}
|
|
80
|
+
const deps = Object.entries({ ...plan.dependencies, ...plan.devDependencies });
|
|
81
|
+
if (deps.length > 0 || plan.removedDependencies.length > 0) {
|
|
82
|
+
out.push(chalk.bold('Dependencies'), ...indentList([
|
|
83
|
+
...deps.map(([name, range]) => `${chalk.green('+')} ${name} ${chalk.dim(range)}`),
|
|
84
|
+
...plan.removedDependencies.map((name) => `${chalk.red('-')} ${name}`),
|
|
85
|
+
]), '');
|
|
86
|
+
}
|
|
87
|
+
if (plan.env.length > 0) {
|
|
88
|
+
out.push(chalk.bold('Environment'), ...indentList(plan.env.map((variable) => `${variable.name}${variable.required ? chalk.yellow(' (required)') : ''} ${chalk.dim(variable.description)}`)), '');
|
|
89
|
+
}
|
|
90
|
+
if (plan.services.length > 0) {
|
|
91
|
+
out.push(chalk.bold('Services'), ...indentList(plan.services), '');
|
|
92
|
+
}
|
|
93
|
+
for (const note of plan.notes) {
|
|
94
|
+
out.push(chalk.dim(`note: ${note.path ? `${note.path} ` : ''}${note.message}`));
|
|
95
|
+
if (options.diffs && note.diff)
|
|
96
|
+
out.push(colorDiff(note.diff));
|
|
97
|
+
}
|
|
98
|
+
for (const warning of plan.warnings)
|
|
99
|
+
out.push(chalk.yellow(`warning: ${warning}`));
|
|
100
|
+
if (options.diffs) {
|
|
101
|
+
for (const change of plan.changes)
|
|
102
|
+
if (change.diff)
|
|
103
|
+
out.push('', colorDiff(change.diff.trimEnd()));
|
|
104
|
+
}
|
|
105
|
+
return out.join('\n').trimEnd();
|
|
106
|
+
}
|
|
107
|
+
/** Why the addition was refused, with the change each conflicting file needs. */
|
|
108
|
+
export function formatConflicts(plan) {
|
|
109
|
+
return [
|
|
110
|
+
chalk.red(`cogitator add would overwrite your changes to ${plan.conflicts.length} file${plan.conflicts.length === 1 ? '' : 's'}, so nothing was written:`),
|
|
111
|
+
...plan.conflicts.flatMap((conflict) => [
|
|
112
|
+
'',
|
|
113
|
+
`${chalk.bold(conflict.path)}: ${conflict.reason}`,
|
|
114
|
+
colorDiff(conflict.diff.trimEnd()),
|
|
115
|
+
]),
|
|
116
|
+
'',
|
|
117
|
+
'Apply these changes by hand, or set your edits aside and restore the generated files, then run cogitator add again.',
|
|
118
|
+
].join('\n');
|
|
119
|
+
}
|
|
120
|
+
/** The plan as `--json` prints it: no file contents, diffs included. */
|
|
121
|
+
export function addPlanJson(plan, result) {
|
|
122
|
+
const step = (value) => value && (value.status === 'failed' ? { status: 'failed', error: value.error.message } : value);
|
|
123
|
+
return {
|
|
124
|
+
ok: plan.conflicts.length === 0,
|
|
125
|
+
upToDate: plan.upToDate,
|
|
126
|
+
added: plan.summary,
|
|
127
|
+
spec: plan.to,
|
|
128
|
+
command: plan.command,
|
|
129
|
+
changes: plan.changes.map(({ path, kind, source, diff }) => ({ path, kind, source, diff })),
|
|
130
|
+
conflicts: plan.conflicts,
|
|
131
|
+
notes: plan.notes,
|
|
132
|
+
dependencies: plan.dependencies,
|
|
133
|
+
devDependencies: plan.devDependencies,
|
|
134
|
+
removedDependencies: plan.removedDependencies,
|
|
135
|
+
env: plan.env.map(({ name, required, secret, description }) => ({
|
|
136
|
+
name,
|
|
137
|
+
required,
|
|
138
|
+
secret,
|
|
139
|
+
description,
|
|
140
|
+
})),
|
|
141
|
+
services: plan.services,
|
|
142
|
+
warnings: plan.warnings,
|
|
143
|
+
...(result && {
|
|
144
|
+
written: result.written,
|
|
145
|
+
deleted: result.deleted,
|
|
146
|
+
install: step(result.install),
|
|
147
|
+
format: step(result.format),
|
|
148
|
+
}),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js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|
2
|
+
* Exit codes every command uses: 0 when it did what was asked, 1 when it
|
|
3
|
+
* could not (a failed check, a failed deploy, a missing service), 2 when
|
|
4
|
+
* the command line itself is wrong.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EXIT: {
|
|
7
|
+
readonly ok: 0;
|
|
8
|
+
readonly failed: 1;
|
|
9
|
+
readonly usage: 2;
|
|
10
|
+
};
|
|
11
|
+
export type ExitCode = (typeof EXIT)[keyof typeof EXIT];
|
|
12
|
+
/** A failure a command reports to the user, with what to do about it. */
|
|
13
|
+
export declare class CommandError extends Error {
|
|
14
|
+
readonly exitCode: ExitCode;
|
|
15
|
+
readonly hints: string[];
|
|
16
|
+
constructor(message: string, options?: {
|
|
17
|
+
hints?: string[];
|
|
18
|
+
exitCode?: ExitCode;
|
|
19
|
+
cause?: unknown;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/** A command line that cannot work: an unknown value, a missing argument. Exits 2. */
|
|
23
|
+
export declare class UsageError extends CommandError {
|
|
24
|
+
constructor(message: string, hints?: string[]);
|
|
25
|
+
}
|
|
26
|
+
export declare function errorMessage(error: unknown): string;
|
|
27
|
+
/** Whether `COGITATOR_DEBUG` asks for stack traces. */
|
|
28
|
+
export declare function debugEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
29
|
+
/** The exit code of any error a command ends with. */
|
|
30
|
+
export declare function exitCodeOf(error: unknown): ExitCode;
|
|
31
|
+
/**
|
|
32
|
+
* Prints how a command failed: as `{ ok: false, error }` on stdout with
|
|
33
|
+
* `--json`, otherwise as a message with its hints on stderr, with the stack
|
|
34
|
+
* when COGITATOR_DEBUG is set. Returns the exit code.
|
|
35
|
+
*/
|
|
36
|
+
export declare function reportFailure(error: unknown, options: {
|
|
37
|
+
json: boolean;
|
|
38
|
+
env?: NodeJS.ProcessEnv;
|
|
39
|
+
}): ExitCode;
|
|
40
|
+
/** The `Examples:` block of a command's help: each command with what it does. */
|
|
41
|
+
export declare function examplesHelp(examples: ReadonlyArray<readonly [command: string, description: string]>): string;
|
|
42
|
+
/** Prints `value` as the JSON a `--json` command answers with. */
|
|
43
|
+
export declare function printJson(value: unknown): void;
|
|
44
|
+
/**
|
|
45
|
+
* Ends the process with the failure, for code that cannot throw to the
|
|
46
|
+
* command: event handlers of child processes and signal handlers.
|
|
47
|
+
*/
|
|
48
|
+
export declare function exitWithFailure(error: unknown): never;
|
|
49
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/utils/cli.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,IAAI;;;;CAA0C,CAAC;AAC5D,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,OAAO,IAAI,CAAC,CAAC;AAExD,yEAAyE;AACzE,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;gBAGvB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO;CAO3E;AAED,sFAAsF;AACtF,qBAAa,UAAW,SAAQ,YAAY;gBAC9B,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,EAAO;CAIlD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD;AAED,uDAAuD;AACvD,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAG1E;AAaD,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAOnD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CAAE,GAClD,QAAQ,CA4BV;AAED,iFAAiF;AACjF,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,GACvE,MAAM,CASR;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE9C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAErD"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { CommanderError } from 'commander';
|
|
3
|
+
/**
|
|
4
|
+
* Exit codes every command uses: 0 when it did what was asked, 1 when it
|
|
5
|
+
* could not (a failed check, a failed deploy, a missing service), 2 when
|
|
6
|
+
* the command line itself is wrong.
|
|
7
|
+
*/
|
|
8
|
+
export const EXIT = { ok: 0, failed: 1, usage: 2 };
|
|
9
|
+
/** A failure a command reports to the user, with what to do about it. */
|
|
10
|
+
export class CommandError extends Error {
|
|
11
|
+
exitCode;
|
|
12
|
+
hints;
|
|
13
|
+
constructor(message, options = {}) {
|
|
14
|
+
super(message, options.cause !== undefined ? { cause: options.cause } : undefined);
|
|
15
|
+
this.name = 'CommandError';
|
|
16
|
+
this.exitCode = options.exitCode ?? EXIT.failed;
|
|
17
|
+
this.hints = options.hints ?? [];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** A command line that cannot work: an unknown value, a missing argument. Exits 2. */
|
|
21
|
+
export class UsageError extends CommandError {
|
|
22
|
+
constructor(message, hints = []) {
|
|
23
|
+
super(message, { hints, exitCode: EXIT.usage });
|
|
24
|
+
this.name = 'UsageError';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function errorMessage(error) {
|
|
28
|
+
return error instanceof Error ? error.message : String(error);
|
|
29
|
+
}
|
|
30
|
+
/** Whether `COGITATOR_DEBUG` asks for stack traces. */
|
|
31
|
+
export function debugEnabled(env = process.env) {
|
|
32
|
+
const value = env.COGITATOR_DEBUG?.trim().toLowerCase();
|
|
33
|
+
return value !== undefined && value !== '' && value !== '0' && value !== 'false';
|
|
34
|
+
}
|
|
35
|
+
const USAGE_CODES = new Set([
|
|
36
|
+
'commander.unknownOption',
|
|
37
|
+
'commander.unknownCommand',
|
|
38
|
+
'commander.missingArgument',
|
|
39
|
+
'commander.missingMandatoryOptionValue',
|
|
40
|
+
'commander.optionMissingArgument',
|
|
41
|
+
'commander.invalidArgument',
|
|
42
|
+
'commander.excessArguments',
|
|
43
|
+
'commander.conflictingOption',
|
|
44
|
+
]);
|
|
45
|
+
/** The exit code of any error a command ends with. */
|
|
46
|
+
export function exitCodeOf(error) {
|
|
47
|
+
if (error instanceof CommandError)
|
|
48
|
+
return error.exitCode;
|
|
49
|
+
if (error instanceof CommanderError) {
|
|
50
|
+
if (error.exitCode === 0)
|
|
51
|
+
return EXIT.ok;
|
|
52
|
+
return USAGE_CODES.has(error.code) ? EXIT.usage : EXIT.failed;
|
|
53
|
+
}
|
|
54
|
+
return EXIT.failed;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Prints how a command failed: as `{ ok: false, error }` on stdout with
|
|
58
|
+
* `--json`, otherwise as a message with its hints on stderr, with the stack
|
|
59
|
+
* when COGITATOR_DEBUG is set. Returns the exit code.
|
|
60
|
+
*/
|
|
61
|
+
export function reportFailure(error, options) {
|
|
62
|
+
const code = exitCodeOf(error);
|
|
63
|
+
const hints = error instanceof CommandError ? error.hints : [];
|
|
64
|
+
if (options.json) {
|
|
65
|
+
console.log(JSON.stringify({
|
|
66
|
+
ok: false,
|
|
67
|
+
error: {
|
|
68
|
+
message: errorMessage(error),
|
|
69
|
+
exitCode: code,
|
|
70
|
+
...(hints.length > 0 && { hints }),
|
|
71
|
+
},
|
|
72
|
+
}, null, 2));
|
|
73
|
+
return code;
|
|
74
|
+
}
|
|
75
|
+
console.error(chalk.red('✗'), errorMessage(error));
|
|
76
|
+
for (const hint of hints)
|
|
77
|
+
console.error(chalk.dim(` ${hint}`));
|
|
78
|
+
if (debugEnabled(options.env) && error instanceof Error && error.stack) {
|
|
79
|
+
console.error(chalk.dim(error.stack));
|
|
80
|
+
}
|
|
81
|
+
else if (!(error instanceof CommandError)) {
|
|
82
|
+
console.error(chalk.dim(' Set COGITATOR_DEBUG=1 for the stack trace.'));
|
|
83
|
+
}
|
|
84
|
+
return code;
|
|
85
|
+
}
|
|
86
|
+
/** The `Examples:` block of a command's help: each command with what it does. */
|
|
87
|
+
export function examplesHelp(examples) {
|
|
88
|
+
const width = Math.max(...examples.map(([command]) => command.length));
|
|
89
|
+
return [
|
|
90
|
+
'',
|
|
91
|
+
'Examples:',
|
|
92
|
+
...examples.map(([command, description]) => ` $ ${command.padEnd(width)} ${chalk.dim(description)}`),
|
|
93
|
+
].join('\n');
|
|
94
|
+
}
|
|
95
|
+
/** Prints `value` as the JSON a `--json` command answers with. */
|
|
96
|
+
export function printJson(value) {
|
|
97
|
+
console.log(JSON.stringify(value, null, 2));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Ends the process with the failure, for code that cannot throw to the
|
|
101
|
+
* command: event handlers of child processes and signal handlers.
|
|
102
|
+
*/
|
|
103
|
+
export function exitWithFailure(error) {
|
|
104
|
+
process.exit(reportFailure(error, { json: false }));
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/utils/cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,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AC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface DocsLocation {
|
|
2
|
+
dir: string;
|
|
3
|
+
version: string;
|
|
4
|
+
}
|
|
5
|
+
export interface DocEntry {
|
|
6
|
+
/** Path inside the docs, such as `core/agents.md`. */
|
|
7
|
+
path: string;
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
section: string;
|
|
11
|
+
}
|
|
12
|
+
export interface DocsIndex extends DocsLocation {
|
|
13
|
+
entries: DocEntry[];
|
|
14
|
+
}
|
|
15
|
+
export interface DocHit extends DocEntry {
|
|
16
|
+
/** The heading of the part of the page that matched best. */
|
|
17
|
+
heading?: string;
|
|
18
|
+
snippet: string;
|
|
19
|
+
score: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The docs bundled with the @cogitator-ai/core a project installed, falling
|
|
23
|
+
* back to the one the CLI itself depends on.
|
|
24
|
+
*/
|
|
25
|
+
export declare function locateDocs(projectDir: string): DocsLocation;
|
|
26
|
+
/** The catalog of pages, read from the `index.md` the docs ship with. */
|
|
27
|
+
export declare function loadDocsIndex(location: DocsLocation): DocsIndex;
|
|
28
|
+
/** Reads a page; `path#heading` returns only that part of the page. */
|
|
29
|
+
export declare function readDoc(index: DocsIndex, reference: string): string;
|
|
30
|
+
/** The anchor GitHub and Fumadocs give a heading. */
|
|
31
|
+
export declare function slugOf(heading: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Pages that answer `query`, best first. Titles weigh most, then the page
|
|
34
|
+
* descriptions, headings and body text; every term has to appear somewhere on
|
|
35
|
+
* a page for it to count, so `approval tool` finds the approvals guide rather
|
|
36
|
+
* than every page that mentions tools.
|
|
37
|
+
*/
|
|
38
|
+
export declare function searchDocs(index: DocsIndex, query: string, limit?: number): DocHit[];
|
|
39
|
+
//# sourceMappingURL=docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/utils/docs.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,OAAO,EAAE,QAAQ,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,MAAO,SAAQ,QAAQ;IACtC,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAuBD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,CAkB3D;AAKD,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAe/D;AAED,uEAAuE;AACvE,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAWnE;AAED,qDAAqD;AACrD,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAO9C;AA2ED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,MAAM,EAAE,CA0C/E"}
|