codemem 0.22.1 → 0.22.3
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/dist/commands/serve.d.ts +1 -0
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/commands/serve.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare function extractViewerPid(payload: unknown): number | null;
|
|
|
4
4
|
export declare function isLocalHost(host: string): boolean;
|
|
5
5
|
export declare function isLoopbackOnlyHost(host: string): boolean;
|
|
6
6
|
export declare function isLikelyViewerCommand(command: string): boolean;
|
|
7
|
+
export declare function prepareViewerDatabase(dbPath?: string | null): string;
|
|
7
8
|
export declare function pickViewerPidCandidate(statsPid: number | null, listenerPid: number | null): number | null;
|
|
8
9
|
export declare function buildForegroundRunnerArgs(scriptPath: string, invocation: ResolvedServeInvocation, execArgv?: string[]): string[];
|
|
9
10
|
export declare function isSqliteVecLoadFailure(error: unknown): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAEN,KAAK,uBAAuB,EAG5B,MAAM,uBAAuB,CAAC;AAQ/B,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAKhE;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CASjD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQxD;AASD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAQ9D;AAED,wBAAgB,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEpE;AAED,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,WAAW,EAAE,MAAM,GAAG,IAAI,GACxB,MAAM,GAAG,IAAI,CAGf;AAqLD,wBAAgB,yBAAyB,CACxC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,uBAAuB,EACnC,QAAQ,GAAE,MAAM,EAAqB,GACnC,MAAM,EAAE,CAgBV;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAS9D;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAUpF;AA8SD,eAAO,MAAM,YAAY,SAuBtB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -210,7 +210,7 @@ function estimateReplicationOpsBytes(db) {
|
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
var dbCommand = new Command("db").configureHelp(helpStyle).description("Database maintenance");
|
|
213
|
-
dbCommand.addCommand(new Command("init").configureHelp(helpStyle).description("
|
|
213
|
+
dbCommand.addCommand(new Command("init").configureHelp(helpStyle).description("Create or verify the SQLite database and schema").option("--db <path>", "database path (default: $CODEMEM_DB or ~/.codemem/mem.sqlite)").option("--db-path <path>", "database path (default: $CODEMEM_DB or ~/.codemem/mem.sqlite)").action((opts) => {
|
|
214
214
|
const result = initDatabase(opts.db ?? opts.dbPath);
|
|
215
215
|
p.intro("codemem db init");
|
|
216
216
|
p.log.success(`Database ready: ${result.path}`);
|
|
@@ -966,6 +966,9 @@ function isLikelyViewerCommand(command) {
|
|
|
966
966
|
if (!/\bserve\s+start\b/.test(lowered)) return false;
|
|
967
967
|
return lowered.includes("codemem") || lowered.includes("packages/cli/dist/index.js") || lowered.includes("/cli/dist/index.js");
|
|
968
968
|
}
|
|
969
|
+
function prepareViewerDatabase(dbPath) {
|
|
970
|
+
return initDatabase(dbPath ?? void 0).path;
|
|
971
|
+
}
|
|
969
972
|
function pickViewerPidCandidate(statsPid, listenerPid) {
|
|
970
973
|
if (statsPid && listenerPid && statsPid !== listenerPid) return null;
|
|
971
974
|
return statsPid ?? listenerPid ?? null;
|
|
@@ -1208,6 +1211,7 @@ async function startForegroundViewer(invocation) {
|
|
|
1208
1211
|
process.exitCode = 1;
|
|
1209
1212
|
return;
|
|
1210
1213
|
}
|
|
1214
|
+
const preparedDb = prepareViewerDatabase(invocation.dbPath);
|
|
1211
1215
|
const observer = new ObserverClient();
|
|
1212
1216
|
let store;
|
|
1213
1217
|
try {
|
|
@@ -1242,8 +1246,7 @@ async function startForegroundViewer(invocation) {
|
|
|
1242
1246
|
getSyncRuntimeStatus: () => syncRuntimeStatus
|
|
1243
1247
|
};
|
|
1244
1248
|
const app = createApp(appOpts);
|
|
1245
|
-
const
|
|
1246
|
-
const pidPath = pidFilePath(dbPath);
|
|
1249
|
+
const pidPath = pidFilePath(resolveDbPath(invocation.dbPath ?? void 0));
|
|
1247
1250
|
let syncServer = null;
|
|
1248
1251
|
let syncListenerReady = false;
|
|
1249
1252
|
if (syncEnabled) {
|
|
@@ -1272,7 +1275,7 @@ async function startForegroundViewer(invocation) {
|
|
|
1272
1275
|
}), "utf-8");
|
|
1273
1276
|
p.intro("codemem viewer");
|
|
1274
1277
|
p.log.success(`Listening on http://${info.address}:${info.port}`);
|
|
1275
|
-
p.log.info(`Database: ${
|
|
1278
|
+
p.log.info(`Database: ${preparedDb}`);
|
|
1276
1279
|
p.log.step("Raw event sweeper started");
|
|
1277
1280
|
if (syncConfig.syncRetentionEnabled) {
|
|
1278
1281
|
retentionRunner.start();
|