@veedubin/neuralgentics 0.12.5 → 0.13.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.
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Cross-platform path detection for the neuralgentics two-init installer.
3
+ *
4
+ * Detects the user's global opencode config directory based on platform:
5
+ * - Linux/WSL: ~/.config/opencode/
6
+ * - Mac: ~/Library/Application Support/opencode/
7
+ * - Windows: Out of scope (user uses WSL = Linux path).
8
+ *
9
+ * Exports:
10
+ * - getHomedirConfigPath() — global config dir
11
+ * - getProjectConfigPath() — {cwd}/.opencode/
12
+ * - getBackupDir(basePath) — {basePath}/opencode-bak/
13
+ * - getBackupFilePath(backupDir, originalName) — timestamped backup file path
14
+ */
15
+ /**
16
+ * Returns the global opencode config directory for the current platform.
17
+ *
18
+ * - Linux/WSL (and any non-darwin unix): `~/.config/opencode/`
19
+ * - Mac (darwin): `~/Library/Application Support/opencode/`
20
+ *
21
+ * Windows is out of scope — the user runs WSL which presents as Linux.
22
+ */
23
+ export declare function getHomedirConfigPath(): string;
24
+ /**
25
+ * Returns the project-level opencode config directory.
26
+ *
27
+ * @param cwd — working directory (defaults to `process.cwd()`)
28
+ */
29
+ export declare function getProjectConfigPath(cwd?: string): string;
30
+ /**
31
+ * Returns the backup directory path for a given base config directory.
32
+ *
33
+ * @param basePath — the config directory (homedir or project) that may hold
34
+ * files to back up
35
+ */
36
+ export declare function getBackupDir(basePath: string): string;
37
+ /**
38
+ * Returns a timestamped backup file path inside `backupDir`.
39
+ *
40
+ * Filename format: `{originalName}-{ISO-timestamp-with-ms}.json`
41
+ * Example: `opencode-2026-07-17T19-45-32-123Z.json`
42
+ *
43
+ * Files changed in the same update run share the same timestamp (down to ms),
44
+ * so you can see which files were moved together.
45
+ *
46
+ * @param backupDir — the backup directory
47
+ * @param originalName — the original file's basename (without extension is
48
+ * fine; we always append `.json`)
49
+ */
50
+ export declare function getBackupFilePath(backupDir: string, originalName: string): string;
51
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/neuralgentics/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAM7C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAOjF"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Cross-platform path detection for the neuralgentics two-init installer.
3
+ *
4
+ * Detects the user's global opencode config directory based on platform:
5
+ * - Linux/WSL: ~/.config/opencode/
6
+ * - Mac: ~/Library/Application Support/opencode/
7
+ * - Windows: Out of scope (user uses WSL = Linux path).
8
+ *
9
+ * Exports:
10
+ * - getHomedirConfigPath() — global config dir
11
+ * - getProjectConfigPath() — {cwd}/.opencode/
12
+ * - getBackupDir(basePath) — {basePath}/opencode-bak/
13
+ * - getBackupFilePath(backupDir, originalName) — timestamped backup file path
14
+ */
15
+ import * as path from "node:path";
16
+ import * as os from "node:os";
17
+ /**
18
+ * Returns the global opencode config directory for the current platform.
19
+ *
20
+ * - Linux/WSL (and any non-darwin unix): `~/.config/opencode/`
21
+ * - Mac (darwin): `~/Library/Application Support/opencode/`
22
+ *
23
+ * Windows is out of scope — the user runs WSL which presents as Linux.
24
+ */
25
+ export function getHomedirConfigPath() {
26
+ if (process.platform === "darwin") {
27
+ return path.join(os.homedir(), "Library", "Application Support", "opencode");
28
+ }
29
+ // Linux / WSL / other unix-like — assume XDG-ish ~/.config/opencode/
30
+ return path.join(os.homedir(), ".config", "opencode");
31
+ }
32
+ /**
33
+ * Returns the project-level opencode config directory.
34
+ *
35
+ * @param cwd — working directory (defaults to `process.cwd()`)
36
+ */
37
+ export function getProjectConfigPath(cwd) {
38
+ return path.join(cwd ?? process.cwd(), ".opencode");
39
+ }
40
+ /**
41
+ * Returns the backup directory path for a given base config directory.
42
+ *
43
+ * @param basePath — the config directory (homedir or project) that may hold
44
+ * files to back up
45
+ */
46
+ export function getBackupDir(basePath) {
47
+ return path.join(basePath, "opencode-bak");
48
+ }
49
+ /**
50
+ * Returns a timestamped backup file path inside `backupDir`.
51
+ *
52
+ * Filename format: `{originalName}-{ISO-timestamp-with-ms}.json`
53
+ * Example: `opencode-2026-07-17T19-45-32-123Z.json`
54
+ *
55
+ * Files changed in the same update run share the same timestamp (down to ms),
56
+ * so you can see which files were moved together.
57
+ *
58
+ * @param backupDir — the backup directory
59
+ * @param originalName — the original file's basename (without extension is
60
+ * fine; we always append `.json`)
61
+ */
62
+ export function getBackupFilePath(backupDir, originalName) {
63
+ const ts = new Date().toISOString().replace(/[:.]/g, "-");
64
+ // originalName may already end with .json; strip it so we don't double up
65
+ const base = originalName.endsWith(".json")
66
+ ? originalName.slice(0, -".json".length)
67
+ : originalName;
68
+ return path.join(backupDir, `${base}-${ts}.json`);
69
+ }
70
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/neuralgentics/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB;IAClC,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;IAC/E,CAAC;IACD,qEAAqE;IACrE,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAY;IAC/C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC;AACtD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB,EAAE,YAAoB;IACvE,MAAM,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC1D,0EAA0E;IAC1E,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC;QACzC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;QACxC,CAAC,CAAC,YAAY,CAAC;IACjB,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Interactive prompts for the neuralgentics two-init installer.
3
+ *
4
+ * Uses Node's `readline` for all prompts. All prompts have a default shown in
5
+ * brackets. If a skip flag is set (e.g. `--yes`, `--embedded`), the prompt is
6
+ * skipped and the default is used.
7
+ *
8
+ * Prompt types:
9
+ * 1. Backend mode — pgembed (recommended) vs team server
10
+ * 2. Embedding mode — CPU / Auto (recommended) / GPU
11
+ * 3. Ollama API key — written into provider block + .env file
12
+ */
13
+ /** The backend mode chosen by the user. */
14
+ export type BackendMode = "pgembed" | "team";
15
+ /** The embedding mode chosen by the user. */
16
+ export type EmbeddingMode = "cpu" | "auto" | "gpu";
17
+ /** Configuration collected from interactive prompts. */
18
+ export interface PromptConfig {
19
+ backend: BackendMode;
20
+ /** Only set when backend === "team" */
21
+ teamHost?: string;
22
+ teamPort?: string;
23
+ teamDatabase?: string;
24
+ embedding: EmbeddingMode;
25
+ ollamaApiKey?: string;
26
+ }
27
+ /** Flags that control which prompts to skip. */
28
+ export interface PromptFlags {
29
+ /** `--yes` — skip ALL prompts (use defaults) */
30
+ yes: boolean;
31
+ /** `--embedded` — skip backend prompt, use pgembed */
32
+ embedded: boolean;
33
+ /** `--team` — skip backend prompt, use team server */
34
+ team: boolean;
35
+ /** `--CPU-Embed` — skip embedding prompt, use cpu */
36
+ cpuEmbed: boolean;
37
+ /** `--Auto-Embed` — skip embedding prompt, use auto */
38
+ autoEmbed: boolean;
39
+ /** `--GPU-Embed` — skip embedding prompt, use gpu */
40
+ gpuEmbed: boolean;
41
+ }
42
+ /** Default config when all prompts are skipped. */
43
+ export declare const DEFAULT_PROMPT_CONFIG: PromptConfig;
44
+ /**
45
+ * Prompt for the memini-ai backend mode.
46
+ *
47
+ * Skipped if `--embedded` or `--team` is set.
48
+ */
49
+ export declare function promptBackendMode(flags: PromptFlags): Promise<BackendMode>;
50
+ /**
51
+ * Prompt for team server connection details.
52
+ *
53
+ * Only called when backend === "team".
54
+ */
55
+ export declare function promptTeamConnection(): Promise<{
56
+ host: string;
57
+ port: string;
58
+ database: string;
59
+ }>;
60
+ /**
61
+ * Prompt for the embedding mode.
62
+ *
63
+ * Skipped if `--CPU-Embed`, `--Auto-Embed`, or `--GPU-Embed` is set.
64
+ */
65
+ export declare function promptEmbeddingMode(flags: PromptFlags): Promise<EmbeddingMode>;
66
+ /**
67
+ * Prompt for the Ollama Cloud API key.
68
+ *
69
+ * Skipped if `--yes` or the `OLLAMA_API_KEY` env var is already set.
70
+ *
71
+ * Writes the key to:
72
+ * 1. The provider block of opencode.json as `{env:OLLAMA_API_KEY}`
73
+ * 2. A `.env` file in the config dir with `OLLAMA_API_KEY=<key>`
74
+ *
75
+ * Warns the user: "Do NOT commit the .env file to git. Add .env to your .gitignore."
76
+ */
77
+ export declare function promptOllamaApiKey(configDir: string, flags: PromptFlags): Promise<string | undefined>;
78
+ /**
79
+ * Run all interactive prompts and return a unified config.
80
+ */
81
+ export declare function runAllPrompts(configDir: string, flags: PromptFlags): Promise<PromptConfig>;
82
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/neuralgentics/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;AAE7C,6CAA6C;AAC7C,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAEnD,wDAAwD;AACxD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,aAAa,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,gDAAgD;AAChD,MAAM,WAAW,WAAW;IAC1B,gDAAgD;IAChD,GAAG,EAAE,OAAO,CAAC;IACb,sDAAsD;IACtD,QAAQ,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,IAAI,EAAE,OAAO,CAAC;IACd,qDAAqD;IACrD,QAAQ,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,mDAAmD;AACnD,eAAO,MAAM,qBAAqB,EAAE,YAGnC,CAAC;AAeF;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAYhF;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAKD;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAepF;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA+C7B;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,YAAY,CAAC,CAmBvB"}
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Interactive prompts for the neuralgentics two-init installer.
3
+ *
4
+ * Uses Node's `readline` for all prompts. All prompts have a default shown in
5
+ * brackets. If a skip flag is set (e.g. `--yes`, `--embedded`), the prompt is
6
+ * skipped and the default is used.
7
+ *
8
+ * Prompt types:
9
+ * 1. Backend mode — pgembed (recommended) vs team server
10
+ * 2. Embedding mode — CPU / Auto (recommended) / GPU
11
+ * 3. Ollama API key — written into provider block + .env file
12
+ */
13
+ import * as readline from "node:readline";
14
+ import * as path from "node:path";
15
+ import { promises as fs, existsSync } from "node:fs";
16
+ /** Default config when all prompts are skipped. */
17
+ export const DEFAULT_PROMPT_CONFIG = {
18
+ backend: "pgembed",
19
+ embedding: "auto",
20
+ };
21
+ function askQuestion(prompt) {
22
+ return new Promise((resolve) => {
23
+ const rl = readline.createInterface({
24
+ input: process.stdin,
25
+ output: process.stdout,
26
+ });
27
+ rl.question(prompt, (answer) => {
28
+ rl.close();
29
+ resolve(answer);
30
+ });
31
+ });
32
+ }
33
+ /**
34
+ * Prompt for the memini-ai backend mode.
35
+ *
36
+ * Skipped if `--embedded` or `--team` is set.
37
+ */
38
+ export async function promptBackendMode(flags) {
39
+ if (flags.embedded)
40
+ return "pgembed";
41
+ if (flags.team)
42
+ return "team";
43
+ if (flags.yes)
44
+ return "pgembed";
45
+ process.stdout.write("\n? memini-ai backend:\n");
46
+ process.stdout.write(" > pgembed (recommended — zero Docker, just works)\n");
47
+ process.stdout.write(" team server (connect to shared PostgreSQL)\n");
48
+ const answer = await askQuestion("\nChoose [pgembed]: ");
49
+ const trimmed = answer.trim().toLowerCase();
50
+ if (trimmed.startsWith("t"))
51
+ return "team";
52
+ return "pgembed";
53
+ }
54
+ /**
55
+ * Prompt for team server connection details.
56
+ *
57
+ * Only called when backend === "team".
58
+ */
59
+ export async function promptTeamConnection() {
60
+ const host = (await askQuestion("? Team server IP [localhost]: ")).trim() || "localhost";
61
+ const port = (await askQuestion("? Team server port [5432]: ")).trim() || "5432";
62
+ const database = (await askQuestion("? Database name [neuralgentics]: ")).trim() || "neuralgentics";
63
+ return { host, port, database };
64
+ }
65
+ /**
66
+ * Prompt for the embedding mode.
67
+ *
68
+ * Skipped if `--CPU-Embed`, `--Auto-Embed`, or `--GPU-Embed` is set.
69
+ */
70
+ export async function promptEmbeddingMode(flags) {
71
+ if (flags.cpuEmbed)
72
+ return "cpu";
73
+ if (flags.autoEmbed)
74
+ return "auto";
75
+ if (flags.gpuEmbed)
76
+ return "gpu";
77
+ if (flags.yes)
78
+ return "auto";
79
+ process.stdout.write("\n? Embedding mode:\n");
80
+ process.stdout.write(" > CPU (384-dim, fast, runs anywhere)\n");
81
+ process.stdout.write(" Auto (384-dim default + optional 1024-dim elevation) [recommended]\n");
82
+ process.stdout.write(" GPU (1024-dim only, requires CUDA/MPS)\n");
83
+ const answer = await askQuestion("\nChoose [auto]: ");
84
+ const trimmed = answer.trim().toLowerCase();
85
+ if (trimmed.startsWith("cpu"))
86
+ return "cpu";
87
+ if (trimmed.startsWith("gpu"))
88
+ return "gpu";
89
+ return "auto";
90
+ }
91
+ /**
92
+ * Prompt for the Ollama Cloud API key.
93
+ *
94
+ * Skipped if `--yes` or the `OLLAMA_API_KEY` env var is already set.
95
+ *
96
+ * Writes the key to:
97
+ * 1. The provider block of opencode.json as `{env:OLLAMA_API_KEY}`
98
+ * 2. A `.env` file in the config dir with `OLLAMA_API_KEY=<key>`
99
+ *
100
+ * Warns the user: "Do NOT commit the .env file to git. Add .env to your .gitignore."
101
+ */
102
+ export async function promptOllamaApiKey(configDir, flags) {
103
+ // Skip if env var is already set.
104
+ if (process.env.OLLAMA_API_KEY) {
105
+ return process.env.OLLAMA_API_KEY;
106
+ }
107
+ // Skip if --yes.
108
+ if (flags.yes)
109
+ return undefined;
110
+ process.stdout.write("\n? Enter your Ollama Cloud API key (get one at https://ollama.com):\n");
111
+ process.stdout.write(" > ");
112
+ const key = (await askQuestion("")).trim();
113
+ if (!key)
114
+ return undefined;
115
+ // Write to .env file in config dir.
116
+ const envPath = path.join(configDir, ".env");
117
+ const envLine = `OLLAMA_API_KEY=${key}\n`;
118
+ if (existsSync(envPath)) {
119
+ // Append/update the key in existing .env
120
+ const existing = await fs.readFile(envPath, "utf-8");
121
+ const lines = existing.split("\n");
122
+ const updated = new Set();
123
+ const result = [];
124
+ for (const line of lines) {
125
+ const trimmed = line.trim();
126
+ if (trimmed.startsWith("#") || trimmed === "") {
127
+ result.push(line);
128
+ continue;
129
+ }
130
+ const eqIdx = trimmed.indexOf("=");
131
+ const k = eqIdx > 0 ? trimmed.slice(0, eqIdx).trim() : "";
132
+ if (k === "OLLAMA_API_KEY") {
133
+ result.push(envLine.trimEnd());
134
+ updated.add("OLLAMA_API_KEY");
135
+ }
136
+ else {
137
+ result.push(line);
138
+ }
139
+ }
140
+ if (!updated.has("OLLAMA_API_KEY"))
141
+ result.push(envLine.trimEnd());
142
+ await fs.writeFile(envPath, result.join("\n") + "\n", "utf-8");
143
+ }
144
+ else {
145
+ await fs.writeFile(envPath, envLine, "utf-8");
146
+ }
147
+ process.stdout.write("\n WARNING: Do NOT commit the .env file to git. Add .env to your .gitignore.\n\n");
148
+ return key;
149
+ }
150
+ /**
151
+ * Run all interactive prompts and return a unified config.
152
+ */
153
+ export async function runAllPrompts(configDir, flags) {
154
+ const config = { ...DEFAULT_PROMPT_CONFIG };
155
+ // 1. Backend mode
156
+ config.backend = await promptBackendMode(flags);
157
+ if (config.backend === "team") {
158
+ const conn = await promptTeamConnection();
159
+ config.teamHost = conn.host;
160
+ config.teamPort = conn.port;
161
+ config.teamDatabase = conn.database;
162
+ }
163
+ // 2. Embedding mode
164
+ config.embedding = await promptEmbeddingMode(flags);
165
+ // 3. Ollama API key
166
+ config.ollamaApiKey = await promptOllamaApiKey(configDir, flags);
167
+ return config;
168
+ }
169
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/neuralgentics/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAmCrD,mDAAmD;AACnD,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,MAAM;CAClB,CAAC;AAEF,SAAS,WAAW,CAAC,MAAc;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;YAClC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;QACH,EAAE,CAAC,QAAQ,CAAC,MAAM,EA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AAC,YAAY,GAAG,MAAM,kBAAkB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAEjE,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Update logic for the neuralgentics two-init installer.
3
+ *
4
+ * Three update modes:
5
+ * - updateAll() — find all .neuralgentics-state.json files under
6
+ * ~/.config/opencode/ AND under all project
7
+ * directories the user has initialized
8
+ * - updateProject() — only update {CWD}/.opencode/
9
+ * - updateHomedir() — only update the homedir config
10
+ *
11
+ * For each update:
12
+ * 1. Read .neuralgentics-state.json for installed version + file manifest
13
+ * 2. Download latest tarball (reuse download.ts)
14
+ * 3. For each file in new tarball:
15
+ * - Compute SHA-256
16
+ * - Compare against state file manifest
17
+ * - If changed: call backupFile() then write new file
18
+ * - If same: skip
19
+ * - If new: create
20
+ * 4. Update state file with new version + manifest
21
+ * 5. Print summary
22
+ * 6. Print final prompt to user
23
+ */
24
+ import { type BackupRecord } from "./backup.js";
25
+ /** Result of a single update operation. */
26
+ export interface UpdateResult {
27
+ configDir: string;
28
+ installType: "homedir" | "project" | "unknown";
29
+ updated: number;
30
+ skipped: number;
31
+ created: number;
32
+ backups: BackupRecord[];
33
+ fromVersion: string | null;
34
+ toVersion: string;
35
+ }
36
+ /** Options for update operations. */
37
+ export interface UpdateOptions {
38
+ repo: string;
39
+ version: string;
40
+ force: boolean;
41
+ dryRun: boolean;
42
+ }
43
+ /**
44
+ * Update ALL installs under the user's home (projects + homedir).
45
+ */
46
+ export declare function updateAll(opts: UpdateOptions): Promise<UpdateResult[]>;
47
+ /**
48
+ * Update just THIS project (CWD).
49
+ */
50
+ export declare function updateProject(opts: UpdateOptions): Promise<UpdateResult[]>;
51
+ /**
52
+ * Update just the home dir.
53
+ */
54
+ export declare function updateHomedir(opts: UpdateOptions): Promise<UpdateResult[]>;
55
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/neuralgentics/update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAcH,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAgC5D,2CAA2C;AAC3C,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qCAAqC;AACrC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB;AAiPD;;GAEG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAgB5E;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAMhF;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAMhF"}