code-ollama 0.19.1 → 0.20.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.
- package/dist/cli.js +11 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -38,7 +38,7 @@ var LIST$1 = [
|
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region package.json
|
|
40
40
|
var name = "code-ollama";
|
|
41
|
-
var version = "0.
|
|
41
|
+
var version = "0.20.0";
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/constants/package.ts
|
|
44
44
|
var NAME = name;
|
|
@@ -604,7 +604,8 @@ function createSession(model) {
|
|
|
604
604
|
createdAt: now,
|
|
605
605
|
updatedAt: now,
|
|
606
606
|
title: DEFAULT_TITLE,
|
|
607
|
-
model
|
|
607
|
+
model,
|
|
608
|
+
directory: process.cwd()
|
|
608
609
|
};
|
|
609
610
|
ensureSessionDirectory(id);
|
|
610
611
|
writeMetadata(metadata);
|
|
@@ -614,7 +615,7 @@ function createSession(model) {
|
|
|
614
615
|
messages: []
|
|
615
616
|
};
|
|
616
617
|
}
|
|
617
|
-
function listSessions() {
|
|
618
|
+
function listSessions(directory = process.cwd()) {
|
|
618
619
|
if (!existsSync(SESSIONS_DIRECTORY)) return [];
|
|
619
620
|
return readdirSync(SESSIONS_DIRECTORY, { withFileTypes: true }).filter((entry) => entry.isDirectory()).flatMap((entry) => {
|
|
620
621
|
try {
|
|
@@ -622,7 +623,7 @@ function listSessions() {
|
|
|
622
623
|
} catch {
|
|
623
624
|
return [];
|
|
624
625
|
}
|
|
625
|
-
}).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
626
|
+
}).filter((metadata) => metadata.directory === directory).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
626
627
|
}
|
|
627
628
|
function loadSession(id) {
|
|
628
629
|
return {
|
|
@@ -1219,7 +1220,12 @@ cli.command("run <model> <prompt>", "Run a one-off prompt").action(async (model,
|
|
|
1219
1220
|
});
|
|
1220
1221
|
cli.command("resume <sessionId>", "Resume a saved session").action(async (sessionId) => {
|
|
1221
1222
|
try {
|
|
1222
|
-
loadSession(sessionId);
|
|
1223
|
+
const loaded = loadSession(sessionId);
|
|
1224
|
+
if (loaded.metadata.directory && loaded.metadata.directory !== process.cwd()) {
|
|
1225
|
+
writeError(color(`${WARNING} Cannot resume: session belongs to ${loaded.metadata.directory}\n`, "yellow"));
|
|
1226
|
+
process.exitCode = 1;
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1223
1229
|
await launchTui(sessionId);
|
|
1224
1230
|
} catch (error) {
|
|
1225
1231
|
writeError(`Error: ${error instanceof Error ? error.message : "Unknown error"}\n`);
|