@cortexmemory/cli 0.1.1 → 0.22.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 +8 -0
- package/dist/commands/conversations.d.ts +1 -1
- package/dist/commands/conversations.d.ts.map +1 -1
- package/dist/commands/conversations.js +57 -27
- package/dist/commands/conversations.js.map +1 -1
- package/dist/commands/convex.d.ts +1 -1
- package/dist/commands/convex.d.ts.map +1 -1
- package/dist/commands/convex.js +237 -64
- package/dist/commands/convex.js.map +1 -1
- package/dist/commands/db.d.ts +1 -1
- package/dist/commands/db.d.ts.map +1 -1
- package/dist/commands/db.js +59 -109
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/dev.d.ts +8 -8
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +734 -513
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/facts.d.ts +1 -1
- package/dist/commands/facts.d.ts.map +1 -1
- package/dist/commands/facts.js +50 -21
- package/dist/commands/facts.js.map +1 -1
- package/dist/commands/init.d.ts +28 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +895 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/memory.d.ts +1 -1
- package/dist/commands/memory.d.ts.map +1 -1
- package/dist/commands/memory.js +64 -27
- package/dist/commands/memory.js.map +1 -1
- package/dist/commands/setup.d.ts +4 -5
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +428 -250
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/spaces.d.ts +1 -1
- package/dist/commands/spaces.d.ts.map +1 -1
- package/dist/commands/spaces.js +100 -43
- package/dist/commands/spaces.js.map +1 -1
- package/dist/commands/status.d.ts +17 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +314 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/users.d.ts +1 -1
- package/dist/commands/users.d.ts.map +1 -1
- package/dist/commands/users.js +80 -42
- package/dist/commands/users.js.map +1 -1
- package/dist/index.js +42 -14
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/__tests__/client.test.d.ts +5 -0
- package/dist/utils/__tests__/client.test.d.ts.map +1 -0
- package/dist/utils/__tests__/client.test.js +88 -0
- package/dist/utils/__tests__/client.test.js.map +1 -0
- package/dist/utils/__tests__/env-file.test.d.ts +7 -0
- package/dist/utils/__tests__/env-file.test.d.ts.map +1 -0
- package/dist/utils/__tests__/env-file.test.js +196 -0
- package/dist/utils/__tests__/env-file.test.js.map +1 -0
- package/dist/utils/__tests__/shell.test.d.ts +7 -0
- package/dist/utils/__tests__/shell.test.d.ts.map +1 -0
- package/dist/utils/__tests__/shell.test.js +89 -0
- package/dist/utils/__tests__/shell.test.js.map +1 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +12 -39
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/deployment-selector.d.ts +50 -0
- package/dist/utils/deployment-selector.d.ts.map +1 -0
- package/dist/utils/deployment-selector.js +129 -0
- package/dist/utils/deployment-selector.js.map +1 -0
- package/dist/utils/init/convex-setup.d.ts +30 -0
- package/dist/utils/init/convex-setup.d.ts.map +1 -0
- package/dist/utils/init/convex-setup.js +225 -0
- package/dist/utils/init/convex-setup.js.map +1 -0
- package/dist/utils/init/env-generator.d.ts +32 -0
- package/dist/utils/init/env-generator.d.ts.map +1 -0
- package/dist/utils/init/env-generator.js +210 -0
- package/dist/utils/init/env-generator.js.map +1 -0
- package/dist/utils/init/file-operations.d.ts +22 -0
- package/dist/utils/init/file-operations.d.ts.map +1 -0
- package/dist/utils/init/file-operations.js +211 -0
- package/dist/utils/init/file-operations.js.map +1 -0
- package/dist/utils/init/graph-setup.d.ts +35 -0
- package/dist/utils/init/graph-setup.d.ts.map +1 -0
- package/dist/utils/init/graph-setup.js +413 -0
- package/dist/utils/init/graph-setup.js.map +1 -0
- package/dist/utils/init/index.d.ts +11 -0
- package/dist/utils/init/index.d.ts.map +1 -0
- package/dist/utils/init/index.js +11 -0
- package/dist/utils/init/index.js.map +1 -0
- package/dist/utils/init/types.d.ts +73 -0
- package/dist/utils/init/types.d.ts.map +1 -0
- package/dist/utils/init/types.js +5 -0
- package/dist/utils/init/types.js.map +1 -0
- package/dist/utils/shell.d.ts +60 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +188 -0
- package/dist/utils/shell.js.map +1 -0
- package/package.json +25 -20
- package/templates/basic/README.md +105 -0
- package/templates/basic/dev-runner.mjs +215 -0
- package/templates/basic/package-lock.json +1263 -0
- package/templates/basic/package.json +22 -0
- package/templates/basic/src/index.ts +85 -0
- package/templates/basic/tsconfig.json +17 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployment Selection Utility
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent deployment selection across all CLI commands.
|
|
5
|
+
* Priority order: -d flag > cortex use > interactive/single
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync } from "fs";
|
|
8
|
+
import { readFile, writeFile, unlink } from "fs/promises";
|
|
9
|
+
import { homedir } from "os";
|
|
10
|
+
import { join } from "path";
|
|
11
|
+
import prompts from "prompts";
|
|
12
|
+
import pc from "picocolors";
|
|
13
|
+
/**
|
|
14
|
+
* Path to the current deployment file
|
|
15
|
+
*/
|
|
16
|
+
const CURRENT_DEPLOYMENT_PATH = join(homedir(), ".cortex-current");
|
|
17
|
+
/**
|
|
18
|
+
* Get the current deployment set via `cortex use`
|
|
19
|
+
*/
|
|
20
|
+
export async function getCurrentDeployment() {
|
|
21
|
+
if (!existsSync(CURRENT_DEPLOYMENT_PATH)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const content = await readFile(CURRENT_DEPLOYMENT_PATH, "utf-8");
|
|
26
|
+
return content.trim() || null;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Set the current deployment via `cortex use`
|
|
34
|
+
*/
|
|
35
|
+
export async function setCurrentDeployment(name) {
|
|
36
|
+
await writeFile(CURRENT_DEPLOYMENT_PATH, name, "utf-8");
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Clear the current deployment
|
|
40
|
+
*/
|
|
41
|
+
export async function clearCurrentDeployment() {
|
|
42
|
+
if (existsSync(CURRENT_DEPLOYMENT_PATH)) {
|
|
43
|
+
await unlink(CURRENT_DEPLOYMENT_PATH);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Select a deployment for an operation.
|
|
48
|
+
*
|
|
49
|
+
* Priority order:
|
|
50
|
+
* 1. -d flag (options.deployment)
|
|
51
|
+
* 2. cortex use (~/.cortex-current)
|
|
52
|
+
* 3. Single deployment → use it
|
|
53
|
+
* 4. Multiple deployments → interactive prompt
|
|
54
|
+
*
|
|
55
|
+
* Always prints "Using: <name>" hint.
|
|
56
|
+
*
|
|
57
|
+
* @param config - CLI configuration
|
|
58
|
+
* @param options - Command options (may contain deployment)
|
|
59
|
+
* @param actionDescription - Optional description for the prompt (e.g., "list memories")
|
|
60
|
+
* @returns Selected deployment or null if cancelled
|
|
61
|
+
*/
|
|
62
|
+
export async function selectDeployment(config, options, actionDescription) {
|
|
63
|
+
const deployments = Object.entries(config.deployments);
|
|
64
|
+
if (deployments.length === 0) {
|
|
65
|
+
console.log(pc.red("\n No deployments configured"));
|
|
66
|
+
console.log(pc.dim(" Run 'cortex init' or 'cortex config add-deployment' to add one\n"));
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
let selectedName = null;
|
|
70
|
+
// Priority 1: -d flag
|
|
71
|
+
if (options.deployment) {
|
|
72
|
+
if (!config.deployments[options.deployment]) {
|
|
73
|
+
console.log(pc.red(`\n Deployment "${options.deployment}" not found`));
|
|
74
|
+
const names = Object.keys(config.deployments);
|
|
75
|
+
console.log(pc.dim(` Available: ${names.join(", ")}\n`));
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
selectedName = options.deployment;
|
|
79
|
+
}
|
|
80
|
+
// Priority 2: cortex use
|
|
81
|
+
if (!selectedName) {
|
|
82
|
+
const current = await getCurrentDeployment();
|
|
83
|
+
if (current) {
|
|
84
|
+
if (config.deployments[current]) {
|
|
85
|
+
selectedName = current;
|
|
86
|
+
}
|
|
87
|
+
// If current deployment no longer exists, ignore it silently
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Priority 3: Single deployment
|
|
91
|
+
if (!selectedName && deployments.length === 1) {
|
|
92
|
+
selectedName = deployments[0][0];
|
|
93
|
+
}
|
|
94
|
+
// Priority 4: Interactive prompt for multiple deployments
|
|
95
|
+
if (!selectedName) {
|
|
96
|
+
const action = actionDescription ? ` to ${actionDescription}` : "";
|
|
97
|
+
const response = await prompts({
|
|
98
|
+
type: "select",
|
|
99
|
+
name: "deployment",
|
|
100
|
+
message: `Select deployment${action}:`,
|
|
101
|
+
choices: deployments.map(([name, dep]) => ({
|
|
102
|
+
title: name === config.default ? `${name} (default)` : name,
|
|
103
|
+
description: dep.url,
|
|
104
|
+
value: name,
|
|
105
|
+
})),
|
|
106
|
+
initial: deployments.findIndex(([name]) => name === config.default),
|
|
107
|
+
});
|
|
108
|
+
if (!response.deployment) {
|
|
109
|
+
console.log(pc.yellow("\n Operation cancelled\n"));
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
selectedName = response.deployment;
|
|
113
|
+
}
|
|
114
|
+
// Get the deployment config
|
|
115
|
+
const deployment = config.deployments[selectedName];
|
|
116
|
+
// Always show "Using: X" hint
|
|
117
|
+
console.log(pc.dim(` Using: ${selectedName}`));
|
|
118
|
+
return {
|
|
119
|
+
name: selectedName,
|
|
120
|
+
deployment,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Get the path to the current deployment file (for display purposes)
|
|
125
|
+
*/
|
|
126
|
+
export function getCurrentDeploymentPath() {
|
|
127
|
+
return CURRENT_DEPLOYMENT_PATH;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=deployment-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-selector.js","sourceRoot":"","sources":["../../src/utils/deployment-selector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B;;GAEG;AACH,MAAM,uBAAuB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;QACjE,OAAO,OAAO,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAY;IACrD,MAAM,SAAS,CAAC,uBAAuB,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,IA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UAAU,CAAC;IACrC,CAAC;IAED,4BAA4B;IAC5B,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,YAAa,CAAC,CAAC;IAErD,8BAA8B;IAC9B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,aAAa,YAAY,EAAE,CAAC,CAAC,CAAC;IAEjD,OAAO;QACL,IAAI,EAAE,YAAa;QACnB,UAAU;KACX,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO,uBAAuB,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convex setup handlers
|
|
3
|
+
*
|
|
4
|
+
* Handles setting up Convex for the init wizard.
|
|
5
|
+
*/
|
|
6
|
+
import type { ConvexConfig } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Setup new Convex database (cloud)
|
|
9
|
+
*/
|
|
10
|
+
export declare function setupNewConvex(projectPath: string): Promise<ConvexConfig>;
|
|
11
|
+
/**
|
|
12
|
+
* Setup with existing Convex database
|
|
13
|
+
*/
|
|
14
|
+
export declare function setupExistingConvex(): Promise<ConvexConfig>;
|
|
15
|
+
/**
|
|
16
|
+
* Setup local Convex for development
|
|
17
|
+
*
|
|
18
|
+
* Note: Convex's --local flag requires a cloud project to be set up first.
|
|
19
|
+
* So we create the cloud project during init, then the user can run
|
|
20
|
+
* `cortex start --local` or `convex dev --local` for local development.
|
|
21
|
+
*/
|
|
22
|
+
export declare function setupLocalConvex(): Promise<ConvexConfig>;
|
|
23
|
+
/**
|
|
24
|
+
* Deploy Cortex backend functions to Convex
|
|
25
|
+
*
|
|
26
|
+
* Note: We don't use --local flag during init because Convex requires
|
|
27
|
+
* a cloud project to exist first. Users can run --local after setup.
|
|
28
|
+
*/
|
|
29
|
+
export declare function deployToConvex(projectPath: string, config: ConvexConfig, _isLocal?: boolean): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=convex-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex-setup.d.ts","sourceRoot":"","sources":["../../../src/utils/init/convex-setup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAM/C;;GAEG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,YAAY,CAAC,CA6GvB;AAED;;GAEG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,YAAY,CAAC,CAkDjE;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,YAAY,CAAC,CAgB9D;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,YAAY,EACpB,QAAQ,GAAE,OAAe,GACxB,OAAO,CAAC,IAAI,CAAC,CAuDf"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convex setup handlers
|
|
3
|
+
*
|
|
4
|
+
* Handles setting up Convex for the init wizard.
|
|
5
|
+
*/
|
|
6
|
+
import fs from "fs-extra";
|
|
7
|
+
import path from "path";
|
|
8
|
+
import prompts from "prompts";
|
|
9
|
+
import { execCommandLive, commandExists } from "../shell.js";
|
|
10
|
+
import pc from "picocolors";
|
|
11
|
+
import ora from "ora";
|
|
12
|
+
// Note: execCommand is not used in this file anymore but keeping ora for setupNewConvex/setupExistingConvex
|
|
13
|
+
/**
|
|
14
|
+
* Setup new Convex database (cloud)
|
|
15
|
+
*/
|
|
16
|
+
export async function setupNewConvex(projectPath) {
|
|
17
|
+
console.log(pc.cyan("\n Setting up new Convex database..."));
|
|
18
|
+
// Clean up any existing Convex state that might interfere
|
|
19
|
+
// This prevents "DeploymentNotFound" errors from old cached state
|
|
20
|
+
const convexStatePath = path.join(projectPath, ".convex");
|
|
21
|
+
if (await fs.pathExists(convexStatePath)) {
|
|
22
|
+
console.log(pc.dim(" Cleaning up old Convex state..."));
|
|
23
|
+
await fs.remove(convexStatePath);
|
|
24
|
+
}
|
|
25
|
+
// Also clean up .env.local which may have old CONVEX_DEPLOYMENT reference
|
|
26
|
+
const envLocalPath = path.join(projectPath, ".env.local");
|
|
27
|
+
if (await fs.pathExists(envLocalPath)) {
|
|
28
|
+
console.log(pc.dim(" Removing old .env.local (will be recreated)..."));
|
|
29
|
+
await fs.remove(envLocalPath);
|
|
30
|
+
}
|
|
31
|
+
// Check if convex CLI is available
|
|
32
|
+
const hasConvex = await commandExists("convex");
|
|
33
|
+
if (!hasConvex) {
|
|
34
|
+
console.log(pc.yellow(" Convex CLI not found globally, will use npx"));
|
|
35
|
+
}
|
|
36
|
+
const spinner = ora("Initializing Convex...").start();
|
|
37
|
+
try {
|
|
38
|
+
// Run convex dev --once --until-success
|
|
39
|
+
spinner.stop();
|
|
40
|
+
console.log(pc.dim(" Running Convex setup (this may prompt for login)..."));
|
|
41
|
+
console.log(pc.dim(" Follow the prompts to create your Convex project\n"));
|
|
42
|
+
const command = hasConvex ? "convex" : "npx";
|
|
43
|
+
const args = hasConvex
|
|
44
|
+
? ["dev", "--once", "--until-success"]
|
|
45
|
+
: ["convex", "dev", "--once", "--until-success"];
|
|
46
|
+
// Override any inherited Convex env vars that might interfere with fresh setup
|
|
47
|
+
// (e.g., from parent directory's .env.local being injected by dotenv)
|
|
48
|
+
// Setting to empty string effectively clears them for the child process
|
|
49
|
+
const cleanConvexEnv = {
|
|
50
|
+
CONVEX_URL: "",
|
|
51
|
+
CONVEX_DEPLOYMENT: "",
|
|
52
|
+
CONVEX_DEPLOY_KEY: "",
|
|
53
|
+
};
|
|
54
|
+
const exitCode = await execCommandLive(command, args, {
|
|
55
|
+
cwd: projectPath,
|
|
56
|
+
env: cleanConvexEnv,
|
|
57
|
+
});
|
|
58
|
+
if (exitCode !== 0) {
|
|
59
|
+
throw new Error(`Convex setup failed with exit code ${exitCode}`);
|
|
60
|
+
}
|
|
61
|
+
// Read the generated .env.local to get CONVEX_URL
|
|
62
|
+
const envLocalPath = path.join(projectPath, ".env.local");
|
|
63
|
+
let convexUrl = "";
|
|
64
|
+
let deployKey = "";
|
|
65
|
+
try {
|
|
66
|
+
const envContent = await fs.readFile(envLocalPath, "utf-8");
|
|
67
|
+
const urlMatch = envContent.match(/CONVEX_URL=(.+)/);
|
|
68
|
+
const keyMatch = envContent.match(/CONVEX_DEPLOY_KEY=(.+)/);
|
|
69
|
+
if (urlMatch) {
|
|
70
|
+
convexUrl = urlMatch[1].trim();
|
|
71
|
+
}
|
|
72
|
+
if (keyMatch) {
|
|
73
|
+
deployKey = keyMatch[1].trim();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
const err = error;
|
|
78
|
+
if (err.code !== "ENOENT") {
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!convexUrl) {
|
|
83
|
+
// Fallback: prompt user for URL
|
|
84
|
+
const response = await prompts({
|
|
85
|
+
type: "text",
|
|
86
|
+
name: "url",
|
|
87
|
+
message: "Enter your Convex deployment URL:",
|
|
88
|
+
validate: (value) => value.includes("convex.cloud") || value.includes("convex.site")
|
|
89
|
+
? true
|
|
90
|
+
: "Please enter a valid Convex URL",
|
|
91
|
+
});
|
|
92
|
+
convexUrl = response.url;
|
|
93
|
+
}
|
|
94
|
+
console.log(pc.green("\n Convex database configured"));
|
|
95
|
+
console.log(pc.dim(` URL: ${convexUrl}`));
|
|
96
|
+
return {
|
|
97
|
+
convexUrl,
|
|
98
|
+
deployKey: deployKey || undefined,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
spinner.stop();
|
|
103
|
+
throw new Error(`Failed to setup Convex: ${error}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Setup with existing Convex database
|
|
108
|
+
*/
|
|
109
|
+
export async function setupExistingConvex() {
|
|
110
|
+
console.log(pc.cyan("\n Configuring existing Convex database..."));
|
|
111
|
+
const response = await prompts([
|
|
112
|
+
{
|
|
113
|
+
type: "text",
|
|
114
|
+
name: "convexUrl",
|
|
115
|
+
message: "Enter your Convex deployment URL:",
|
|
116
|
+
validate: (value) => {
|
|
117
|
+
if (!value)
|
|
118
|
+
return "URL is required";
|
|
119
|
+
if (!value.startsWith("http"))
|
|
120
|
+
return "Please enter a valid URL";
|
|
121
|
+
return true;
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
type: "text",
|
|
126
|
+
name: "deployKey",
|
|
127
|
+
message: "Enter your Convex deploy key (optional, press Enter to skip):",
|
|
128
|
+
},
|
|
129
|
+
]);
|
|
130
|
+
if (!response.convexUrl) {
|
|
131
|
+
throw new Error("Convex URL is required");
|
|
132
|
+
}
|
|
133
|
+
// Validate connection
|
|
134
|
+
const spinner = ora("Validating Convex connection...").start();
|
|
135
|
+
try {
|
|
136
|
+
const isValid = response.convexUrl.includes("convex.cloud") ||
|
|
137
|
+
response.convexUrl.includes("convex.site") ||
|
|
138
|
+
response.convexUrl.includes("localhost");
|
|
139
|
+
if (!isValid) {
|
|
140
|
+
spinner.fail("Invalid Convex URL format");
|
|
141
|
+
throw new Error("Invalid Convex URL");
|
|
142
|
+
}
|
|
143
|
+
spinner.succeed("Convex connection validated");
|
|
144
|
+
console.log(pc.dim(` URL: ${response.convexUrl}`));
|
|
145
|
+
return {
|
|
146
|
+
convexUrl: response.convexUrl,
|
|
147
|
+
deployKey: response.deployKey || undefined,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
spinner.fail("Failed to validate Convex connection");
|
|
152
|
+
throw error;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Setup local Convex for development
|
|
157
|
+
*
|
|
158
|
+
* Note: Convex's --local flag requires a cloud project to be set up first.
|
|
159
|
+
* So we create the cloud project during init, then the user can run
|
|
160
|
+
* `cortex start --local` or `convex dev --local` for local development.
|
|
161
|
+
*/
|
|
162
|
+
export async function setupLocalConvex() {
|
|
163
|
+
console.log(pc.cyan("\n Setting up Convex for local development..."));
|
|
164
|
+
console.log(pc.yellow(" Note: A Convex cloud project will be created first"));
|
|
165
|
+
console.log(pc.dim(" After setup, run 'cortex start --local' for local development"));
|
|
166
|
+
console.log(pc.dim(" Local mode: faster iteration, but no vector search\n"));
|
|
167
|
+
// Return empty config - the actual URL will come from convex dev
|
|
168
|
+
return {
|
|
169
|
+
convexUrl: "", // Will be filled in after convex dev runs
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Deploy Cortex backend functions to Convex
|
|
174
|
+
*
|
|
175
|
+
* Note: We don't use --local flag during init because Convex requires
|
|
176
|
+
* a cloud project to exist first. Users can run --local after setup.
|
|
177
|
+
*/
|
|
178
|
+
export async function deployToConvex(projectPath, config, _isLocal = false) {
|
|
179
|
+
console.log(pc.cyan("\n Deploying Cortex backend to Convex..."));
|
|
180
|
+
console.log(pc.dim(" This may prompt for configuration on first run\n"));
|
|
181
|
+
try {
|
|
182
|
+
// Check if convex CLI is available
|
|
183
|
+
const hasConvex = await commandExists("convex");
|
|
184
|
+
// Build command and args based on whether convex is installed globally
|
|
185
|
+
let command;
|
|
186
|
+
let args;
|
|
187
|
+
if (hasConvex) {
|
|
188
|
+
command = "convex";
|
|
189
|
+
args = ["dev", "--once", "--until-success"];
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
command = "npx";
|
|
193
|
+
args = ["convex", "dev", "--once", "--until-success"];
|
|
194
|
+
}
|
|
195
|
+
// Note: We don't add --local here because:
|
|
196
|
+
// 1. Convex requires a cloud project to exist first
|
|
197
|
+
// 2. --local on a fresh project causes "DeploymentNotFound" errors
|
|
198
|
+
// Users can run `cortex start --local` after setup completes
|
|
199
|
+
// Set environment for deployment (only if URL is provided)
|
|
200
|
+
const env = {
|
|
201
|
+
...process.env,
|
|
202
|
+
};
|
|
203
|
+
if (config.convexUrl) {
|
|
204
|
+
env.CONVEX_URL = config.convexUrl;
|
|
205
|
+
}
|
|
206
|
+
if (config.deployKey) {
|
|
207
|
+
env.CONVEX_DEPLOY_KEY = config.deployKey;
|
|
208
|
+
}
|
|
209
|
+
// Run convex dev --once with live output (allows interactive prompts)
|
|
210
|
+
const exitCode = await execCommandLive(command, args, {
|
|
211
|
+
cwd: projectPath,
|
|
212
|
+
env,
|
|
213
|
+
});
|
|
214
|
+
if (exitCode !== 0) {
|
|
215
|
+
throw new Error("Failed to deploy Cortex backend");
|
|
216
|
+
}
|
|
217
|
+
console.log(pc.green("\n Backend deployed to Convex"));
|
|
218
|
+
console.log(pc.dim(" All functions and schema are deployed"));
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
console.error(pc.red("\n Deployment failed"));
|
|
222
|
+
throw error;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=convex-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex-setup.js","sourceRoot":"","sources":["../../../src/utils/init/convex-setup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,4GAA4G;AAE5G;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,WAAmB;IAEnB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC,CAAC;IAE/D,0DAA0D;IAC1D,kEAAkE;IAClE,MAAM,eAAe,GAAG,IAAI,CAAC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AC3D,MAAM,GAAG,GAAuC;YAC9C,GAAG,OAAO,CAAC,GAAG;SACf,CAAC;QAEF,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC;QACpC,CAAC;QACD,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,GAAG,CAAC,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC;QAC3C,CAAC;QAED,sEAAsE;QACtE,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE;YACpD,GAAG,EAAE,WAAW;YAChB,GAAG;SACJ,CAAC,CAAC;QAEH,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC,CAAC;IAClE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC;QAChD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment file generator
|
|
3
|
+
*
|
|
4
|
+
* Generates .env.local and docker-compose files for init wizard.
|
|
5
|
+
*/
|
|
6
|
+
import type { WizardConfig } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Generate .env.local file content based on wizard configuration
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateEnvFile(config: WizardConfig): string;
|
|
11
|
+
/**
|
|
12
|
+
* Write .env.local file to project
|
|
13
|
+
*
|
|
14
|
+
* IMPORTANT: If Convex CLI has already created .env.local (with CONVEX_URL,
|
|
15
|
+
* CONVEX_DEPLOYMENT, etc.), we preserve those lines and only add our
|
|
16
|
+
* additional configuration (graph DB, OpenAI, etc.)
|
|
17
|
+
*/
|
|
18
|
+
export declare function createEnvFile(projectPath: string, config: WizardConfig): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Append graph database configuration to existing .env.local
|
|
21
|
+
* Called after Convex deployment which may have modified .env.local
|
|
22
|
+
*/
|
|
23
|
+
export declare function appendGraphEnvVars(projectPath: string, config: {
|
|
24
|
+
graphUri: string;
|
|
25
|
+
graphUsername: string;
|
|
26
|
+
graphPassword: string;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Create docker-compose.yml for local graph database
|
|
30
|
+
*/
|
|
31
|
+
export declare function createGraphDockerCompose(projectPath: string, graphType: "neo4j" | "memgraph"): Promise<void>;
|
|
32
|
+
//# sourceMappingURL=env-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-generator.d.ts","sourceRoot":"","sources":["../../../src/utils/init/env-generator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CA+C5D;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CAgEf;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB,GACA,OAAO,CAAC,IAAI,CAAC,CAkCf;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,OAAO,GAAG,UAAU,GAC9B,OAAO,CAAC,IAAI,CAAC,CAkDf"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment file generator
|
|
3
|
+
*
|
|
4
|
+
* Generates .env.local and docker-compose files for init wizard.
|
|
5
|
+
*/
|
|
6
|
+
import fs from "fs-extra";
|
|
7
|
+
import path from "path";
|
|
8
|
+
import pc from "picocolors";
|
|
9
|
+
/**
|
|
10
|
+
* Generate .env.local file content based on wizard configuration
|
|
11
|
+
*/
|
|
12
|
+
export function generateEnvFile(config) {
|
|
13
|
+
let env = `# Cortex Memory SDK Configuration
|
|
14
|
+
# Generated by cortex init on ${new Date().toISOString()}
|
|
15
|
+
|
|
16
|
+
# =============================================================================
|
|
17
|
+
# Convex Configuration
|
|
18
|
+
# =============================================================================
|
|
19
|
+
`;
|
|
20
|
+
// Add Convex configuration based on setup type
|
|
21
|
+
if (config.convexSetupType === "local") {
|
|
22
|
+
env += `# Local Development
|
|
23
|
+
LOCAL_CONVEX_URL=http://127.0.0.1:3210
|
|
24
|
+
LOCAL_CONVEX_DEPLOYMENT=anonymous:anonymous-${config.projectName}
|
|
25
|
+
CONVEX_URL=http://127.0.0.1:3210
|
|
26
|
+
`;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
env += `# Convex Cloud
|
|
30
|
+
CONVEX_URL=${config.convexUrl || ""}
|
|
31
|
+
`;
|
|
32
|
+
if (config.deployKey) {
|
|
33
|
+
env += `CONVEX_DEPLOY_KEY=${config.deployKey}
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Add graph database configuration if enabled
|
|
38
|
+
if (config.graphEnabled && config.graphType !== "skip") {
|
|
39
|
+
env += `
|
|
40
|
+
# =============================================================================
|
|
41
|
+
# Graph Database Configuration (Optional)
|
|
42
|
+
# =============================================================================
|
|
43
|
+
NEO4J_URI=${config.graphUri || "bolt://localhost:7687"}
|
|
44
|
+
NEO4J_USERNAME=${config.graphUsername || "neo4j"}
|
|
45
|
+
NEO4J_PASSWORD=${config.graphPassword || "cortex-password"}
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
env += `
|
|
49
|
+
# =============================================================================
|
|
50
|
+
# OpenAI API Key (Optional - for embeddings)
|
|
51
|
+
# =============================================================================
|
|
52
|
+
# OPENAI_API_KEY=sk-...
|
|
53
|
+
|
|
54
|
+
`;
|
|
55
|
+
return env;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Write .env.local file to project
|
|
59
|
+
*
|
|
60
|
+
* IMPORTANT: If Convex CLI has already created .env.local (with CONVEX_URL,
|
|
61
|
+
* CONVEX_DEPLOYMENT, etc.), we preserve those lines and only add our
|
|
62
|
+
* additional configuration (graph DB, OpenAI, etc.)
|
|
63
|
+
*/
|
|
64
|
+
export async function createEnvFile(projectPath, config) {
|
|
65
|
+
const envPath = path.join(projectPath, ".env.local");
|
|
66
|
+
// Check if .env.local already exists (likely created by convex dev)
|
|
67
|
+
let existingContent = "";
|
|
68
|
+
let hasExistingConvexConfig = false;
|
|
69
|
+
try {
|
|
70
|
+
existingContent = await fs.readFile(envPath, "utf-8");
|
|
71
|
+
// Check if Convex has already configured this file
|
|
72
|
+
hasExistingConvexConfig = existingContent.includes("CONVEX_URL=") ||
|
|
73
|
+
existingContent.includes("CONVEX_DEPLOYMENT=");
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// File doesn't exist, will create new
|
|
77
|
+
}
|
|
78
|
+
if (hasExistingConvexConfig) {
|
|
79
|
+
// Preserve the Convex-generated content, just add our header and optional extras
|
|
80
|
+
console.log(pc.dim(" Preserving Convex configuration in .env.local"));
|
|
81
|
+
// Add header if not present
|
|
82
|
+
let finalContent = existingContent;
|
|
83
|
+
if (!existingContent.includes("# Cortex Memory SDK Configuration")) {
|
|
84
|
+
finalContent = `# Cortex Memory SDK Configuration
|
|
85
|
+
# Generated by cortex init on ${new Date().toISOString()}
|
|
86
|
+
|
|
87
|
+
${existingContent}`;
|
|
88
|
+
}
|
|
89
|
+
// Add OpenAI placeholder if not present
|
|
90
|
+
if (!existingContent.includes("OPENAI_API_KEY")) {
|
|
91
|
+
finalContent += `
|
|
92
|
+
# =============================================================================
|
|
93
|
+
# OpenAI API Key (Optional - for embeddings)
|
|
94
|
+
# =============================================================================
|
|
95
|
+
# OPENAI_API_KEY=sk-...
|
|
96
|
+
`;
|
|
97
|
+
}
|
|
98
|
+
await fs.writeFile(envPath, finalContent);
|
|
99
|
+
console.log(pc.green(" Updated .env.local"));
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// No existing Convex config, create fresh file
|
|
103
|
+
const envContent = generateEnvFile(config);
|
|
104
|
+
// Backup any existing file first
|
|
105
|
+
try {
|
|
106
|
+
const backupPath = path.join(projectPath, `.env.local.backup.${Date.now()}`);
|
|
107
|
+
await fs.move(envPath, backupPath);
|
|
108
|
+
console.log(pc.yellow(" Existing .env.local backed up"));
|
|
109
|
+
console.log(pc.dim(` Backed up to ${path.basename(backupPath)}`));
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
const err = error;
|
|
113
|
+
if (err.code !== "ENOENT") {
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
await fs.writeFile(envPath, envContent);
|
|
118
|
+
console.log(pc.green(" Created .env.local"));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Append graph database configuration to existing .env.local
|
|
123
|
+
* Called after Convex deployment which may have modified .env.local
|
|
124
|
+
*/
|
|
125
|
+
export async function appendGraphEnvVars(projectPath, config) {
|
|
126
|
+
const envPath = path.join(projectPath, ".env.local");
|
|
127
|
+
const graphEnvVars = `
|
|
128
|
+
# =============================================================================
|
|
129
|
+
# Graph Database Configuration
|
|
130
|
+
# =============================================================================
|
|
131
|
+
NEO4J_URI=${config.graphUri}
|
|
132
|
+
NEO4J_USERNAME=${config.graphUsername}
|
|
133
|
+
NEO4J_PASSWORD=${config.graphPassword}
|
|
134
|
+
`;
|
|
135
|
+
try {
|
|
136
|
+
// Read existing content
|
|
137
|
+
let existingContent = "";
|
|
138
|
+
try {
|
|
139
|
+
existingContent = await fs.readFile(envPath, "utf-8");
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// File doesn't exist, will create new
|
|
143
|
+
}
|
|
144
|
+
// Check if graph vars already exist
|
|
145
|
+
if (existingContent.includes("NEO4J_URI=")) {
|
|
146
|
+
console.log(pc.dim(" Graph env vars already present in .env.local"));
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
// Append graph vars
|
|
150
|
+
await fs.writeFile(envPath, existingContent + graphEnvVars);
|
|
151
|
+
console.log(pc.green(" Added graph database env vars to .env.local"));
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
console.warn(pc.yellow(" Warning: Could not update .env.local with graph config"));
|
|
155
|
+
console.log(pc.dim(` Please add manually:\n${graphEnvVars}`));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Create docker-compose.yml for local graph database
|
|
160
|
+
*/
|
|
161
|
+
export async function createGraphDockerCompose(projectPath, graphType) {
|
|
162
|
+
const dockerComposePath = path.join(projectPath, "docker-compose.graph.yml");
|
|
163
|
+
let dockerCompose = "";
|
|
164
|
+
if (graphType === "neo4j") {
|
|
165
|
+
dockerCompose = `services:
|
|
166
|
+
neo4j:
|
|
167
|
+
image: neo4j:5-community
|
|
168
|
+
container_name: cortex-neo4j
|
|
169
|
+
ports:
|
|
170
|
+
- "7474:7474" # HTTP
|
|
171
|
+
- "7687:7687" # Bolt
|
|
172
|
+
environment:
|
|
173
|
+
- NEO4J_AUTH=neo4j/cortex-password
|
|
174
|
+
- NEO4J_PLUGINS=["apoc"]
|
|
175
|
+
- NEO4J_dbms_security_procedures_unrestricted=apoc.*
|
|
176
|
+
volumes:
|
|
177
|
+
- neo4j_data:/data
|
|
178
|
+
- neo4j_logs:/logs
|
|
179
|
+
restart: unless-stopped
|
|
180
|
+
|
|
181
|
+
volumes:
|
|
182
|
+
neo4j_data:
|
|
183
|
+
neo4j_logs:
|
|
184
|
+
`;
|
|
185
|
+
}
|
|
186
|
+
else if (graphType === "memgraph") {
|
|
187
|
+
dockerCompose = `services:
|
|
188
|
+
memgraph:
|
|
189
|
+
image: memgraph/memgraph-platform:latest
|
|
190
|
+
container_name: cortex-memgraph
|
|
191
|
+
ports:
|
|
192
|
+
- "7687:7687" # Bolt
|
|
193
|
+
- "3000:3000" # Memgraph Lab
|
|
194
|
+
- "7444:7444" # Memgraph Lab secure
|
|
195
|
+
environment:
|
|
196
|
+
- MEMGRAPH="--log-level=TRACE"
|
|
197
|
+
volumes:
|
|
198
|
+
- memgraph_data:/var/lib/memgraph
|
|
199
|
+
- memgraph_logs:/var/log/memgraph
|
|
200
|
+
restart: unless-stopped
|
|
201
|
+
|
|
202
|
+
volumes:
|
|
203
|
+
memgraph_data:
|
|
204
|
+
memgraph_logs:
|
|
205
|
+
`;
|
|
206
|
+
}
|
|
207
|
+
await fs.writeFile(dockerComposePath, dockerCompose);
|
|
208
|
+
console.log(pc.dim(` Created docker-compose.graph.yml for ${graphType}`));
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=env-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-generator.js","sourceRoot":"","sources":["../../../src/utils/init/env-generator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAoB;IAClD,IAAI,GAAG,GAAG;gCACoB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;;;;;CAKvD,CAAC;IAEA,+CAA+C;IAC/C,IAAI,MAAM,CAA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