imprnt 0.1.3-edge.59 → 0.1.3-edge.60
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 +68 -2
- package/dist/imp.js +68 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1062,6 +1062,15 @@ function geminiRenderArgs(spec) {
|
|
|
1062
1062
|
const flags = includes.length ? ["--include-directories", includes.join(",")] : [];
|
|
1063
1063
|
return [...lead, ...flags, ...pass];
|
|
1064
1064
|
}
|
|
1065
|
+
function parseGeminiSessions(stdout) {
|
|
1066
|
+
const out = [];
|
|
1067
|
+
for (const raw of stdout.split(/\r?\n/)) {
|
|
1068
|
+
const m = raw.match(/^\s*(\d+)\.\s+(.+?)\s+\(([^()]+)\)\s+\[([0-9a-fA-F-]{8,})\]\s*$/);
|
|
1069
|
+
if (m)
|
|
1070
|
+
out.push({ index: Number(m[1]), name: m[2].trim(), age: m[3].trim(), id: m[4] });
|
|
1071
|
+
}
|
|
1072
|
+
return out;
|
|
1073
|
+
}
|
|
1065
1074
|
function resolveLaunch(passthrough, config = {}) {
|
|
1066
1075
|
let agentFlag;
|
|
1067
1076
|
let yoloFlag;
|
|
@@ -2598,6 +2607,61 @@ function controlSlot(dst) {
|
|
|
2598
2607
|
return "keep";
|
|
2599
2608
|
return "blocked-non-regular-file";
|
|
2600
2609
|
}
|
|
2610
|
+
function listGeminiSessions(cwd) {
|
|
2611
|
+
const r = spawnSync4("gemini", ["--list-sessions", "--skip-trust"], { cwd, encoding: "utf8" });
|
|
2612
|
+
return parseGeminiSessions(r.stdout || "");
|
|
2613
|
+
}
|
|
2614
|
+
async function pickGeminiSession(sessions, label) {
|
|
2615
|
+
const cols = process.stdout.columns || 80;
|
|
2616
|
+
const nameW = Math.max(20, Math.min(64, cols - 16));
|
|
2617
|
+
const trunc = (s) => s.length > nameW ? s.slice(0, nameW - 1) + "…" : s;
|
|
2618
|
+
process.stderr.write(`
|
|
2619
|
+
resume a chat — gemini · ${label}
|
|
2620
|
+
|
|
2621
|
+
`);
|
|
2622
|
+
sessions.forEach((s, i) => {
|
|
2623
|
+
process.stderr.write(` ${String(i + 1).padStart(2)} ${trunc(s.name).padEnd(nameW)} ${s.age.replace(/\s*ago$/, "")}
|
|
2624
|
+
`);
|
|
2625
|
+
});
|
|
2626
|
+
process.stderr.write(`
|
|
2627
|
+
`);
|
|
2628
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
2629
|
+
const answer = (await rl.question(" number to resume · enter for newest · q to cancel › ")).trim();
|
|
2630
|
+
rl.close();
|
|
2631
|
+
if (answer === "")
|
|
2632
|
+
return "latest";
|
|
2633
|
+
if (answer.toLowerCase() === "q")
|
|
2634
|
+
return null;
|
|
2635
|
+
const n = Number(answer);
|
|
2636
|
+
if (Number.isInteger(n) && n >= 1 && n <= sessions.length)
|
|
2637
|
+
return sessions[n - 1].id;
|
|
2638
|
+
process.stderr.write(` not a valid choice — starting a fresh session
|
|
2639
|
+
`);
|
|
2640
|
+
return null;
|
|
2641
|
+
}
|
|
2642
|
+
async function resolveGeminiResume(backendName, passthrough, cwd) {
|
|
2643
|
+
if (backendName !== "gemini")
|
|
2644
|
+
return passthrough;
|
|
2645
|
+
const rIdx = passthrough.findIndex((a) => a === "-r" || a === "--resume");
|
|
2646
|
+
if (rIdx < 0)
|
|
2647
|
+
return passthrough;
|
|
2648
|
+
const next = passthrough[rIdx + 1];
|
|
2649
|
+
if (next !== undefined && !next.startsWith("-"))
|
|
2650
|
+
return passthrough;
|
|
2651
|
+
if (!(process.stdin.isTTY && process.stdout.isTTY))
|
|
2652
|
+
return passthrough;
|
|
2653
|
+
const sessions = listGeminiSessions(cwd);
|
|
2654
|
+
if (!sessions.length) {
|
|
2655
|
+
console.error("imp: no saved gemini chats for this project yet — starting fresh");
|
|
2656
|
+
return passthrough.filter((_, i) => i !== rIdx);
|
|
2657
|
+
}
|
|
2658
|
+
const chosen = await pickGeminiSession(sessions, basename5(cwd));
|
|
2659
|
+
if (chosen === null)
|
|
2660
|
+
return passthrough.filter((_, i) => i !== rIdx);
|
|
2661
|
+
const out = [...passthrough];
|
|
2662
|
+
out.splice(rIdx + 1, 0, chosen);
|
|
2663
|
+
return out;
|
|
2664
|
+
}
|
|
2601
2665
|
var here, pkgRoot, cmd, rest, asImp;
|
|
2602
2666
|
var init_cli = __esm(async () => {
|
|
2603
2667
|
init_resolve();
|
|
@@ -2647,7 +2711,8 @@ var init_cli = __esm(async () => {
|
|
|
2647
2711
|
case "lair": {
|
|
2648
2712
|
const home = requireVaultHome();
|
|
2649
2713
|
const { backend, skipPermissions, passthrough } = resolveLaunch(rest, { agent: readDefaultAgent(), yolo: readSkipPermissions() });
|
|
2650
|
-
const
|
|
2714
|
+
const resumed = await resolveGeminiResume(backend.name, passthrough, home);
|
|
2715
|
+
const spec = assembleSession({ cwd: home, vaultProject: home, pkgRoot, passthrough: resumed, skipPermissions, model: readDefaultModel() });
|
|
2651
2716
|
process.exit(launchBackend(backend, home, backend.renderArgs(spec), spec.env));
|
|
2652
2717
|
}
|
|
2653
2718
|
case "context": {
|
|
@@ -3046,7 +3111,8 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
3046
3111
|
}
|
|
3047
3112
|
const raw = bare ? [] : [cmd, ...rest];
|
|
3048
3113
|
const { backend, skipPermissions, passthrough } = resolveLaunch(raw, { agent: readDefaultAgent(), yolo: readSkipPermissions() });
|
|
3049
|
-
const
|
|
3114
|
+
const resumed = await resolveGeminiResume(backend.name, passthrough, process.cwd());
|
|
3115
|
+
const spec = assembleSession({ cwd: process.cwd(), vaultProject: home, pkgRoot, passthrough: resumed, skipPermissions, model: readDefaultModel() });
|
|
3050
3116
|
process.exit(launchBackend(backend, process.cwd(), backend.renderArgs(spec), spec.env));
|
|
3051
3117
|
}
|
|
3052
3118
|
console.log(`imprnt — deterministic-first markdown knowledge vault
|
package/dist/imp.js
CHANGED
|
@@ -1062,6 +1062,15 @@ function geminiRenderArgs(spec) {
|
|
|
1062
1062
|
const flags = includes.length ? ["--include-directories", includes.join(",")] : [];
|
|
1063
1063
|
return [...lead, ...flags, ...pass];
|
|
1064
1064
|
}
|
|
1065
|
+
function parseGeminiSessions(stdout) {
|
|
1066
|
+
const out = [];
|
|
1067
|
+
for (const raw of stdout.split(/\r?\n/)) {
|
|
1068
|
+
const m = raw.match(/^\s*(\d+)\.\s+(.+?)\s+\(([^()]+)\)\s+\[([0-9a-fA-F-]{8,})\]\s*$/);
|
|
1069
|
+
if (m)
|
|
1070
|
+
out.push({ index: Number(m[1]), name: m[2].trim(), age: m[3].trim(), id: m[4] });
|
|
1071
|
+
}
|
|
1072
|
+
return out;
|
|
1073
|
+
}
|
|
1065
1074
|
function resolveLaunch(passthrough, config = {}) {
|
|
1066
1075
|
let agentFlag;
|
|
1067
1076
|
let yoloFlag;
|
|
@@ -2598,6 +2607,61 @@ function controlSlot(dst) {
|
|
|
2598
2607
|
return "keep";
|
|
2599
2608
|
return "blocked-non-regular-file";
|
|
2600
2609
|
}
|
|
2610
|
+
function listGeminiSessions(cwd) {
|
|
2611
|
+
const r = spawnSync4("gemini", ["--list-sessions", "--skip-trust"], { cwd, encoding: "utf8" });
|
|
2612
|
+
return parseGeminiSessions(r.stdout || "");
|
|
2613
|
+
}
|
|
2614
|
+
async function pickGeminiSession(sessions, label) {
|
|
2615
|
+
const cols = process.stdout.columns || 80;
|
|
2616
|
+
const nameW = Math.max(20, Math.min(64, cols - 16));
|
|
2617
|
+
const trunc = (s) => s.length > nameW ? s.slice(0, nameW - 1) + "…" : s;
|
|
2618
|
+
process.stderr.write(`
|
|
2619
|
+
resume a chat — gemini · ${label}
|
|
2620
|
+
|
|
2621
|
+
`);
|
|
2622
|
+
sessions.forEach((s, i) => {
|
|
2623
|
+
process.stderr.write(` ${String(i + 1).padStart(2)} ${trunc(s.name).padEnd(nameW)} ${s.age.replace(/\s*ago$/, "")}
|
|
2624
|
+
`);
|
|
2625
|
+
});
|
|
2626
|
+
process.stderr.write(`
|
|
2627
|
+
`);
|
|
2628
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
2629
|
+
const answer = (await rl.question(" number to resume · enter for newest · q to cancel › ")).trim();
|
|
2630
|
+
rl.close();
|
|
2631
|
+
if (answer === "")
|
|
2632
|
+
return "latest";
|
|
2633
|
+
if (answer.toLowerCase() === "q")
|
|
2634
|
+
return null;
|
|
2635
|
+
const n = Number(answer);
|
|
2636
|
+
if (Number.isInteger(n) && n >= 1 && n <= sessions.length)
|
|
2637
|
+
return sessions[n - 1].id;
|
|
2638
|
+
process.stderr.write(` not a valid choice — starting a fresh session
|
|
2639
|
+
`);
|
|
2640
|
+
return null;
|
|
2641
|
+
}
|
|
2642
|
+
async function resolveGeminiResume(backendName, passthrough, cwd) {
|
|
2643
|
+
if (backendName !== "gemini")
|
|
2644
|
+
return passthrough;
|
|
2645
|
+
const rIdx = passthrough.findIndex((a) => a === "-r" || a === "--resume");
|
|
2646
|
+
if (rIdx < 0)
|
|
2647
|
+
return passthrough;
|
|
2648
|
+
const next = passthrough[rIdx + 1];
|
|
2649
|
+
if (next !== undefined && !next.startsWith("-"))
|
|
2650
|
+
return passthrough;
|
|
2651
|
+
if (!(process.stdin.isTTY && process.stdout.isTTY))
|
|
2652
|
+
return passthrough;
|
|
2653
|
+
const sessions = listGeminiSessions(cwd);
|
|
2654
|
+
if (!sessions.length) {
|
|
2655
|
+
console.error("imp: no saved gemini chats for this project yet — starting fresh");
|
|
2656
|
+
return passthrough.filter((_, i) => i !== rIdx);
|
|
2657
|
+
}
|
|
2658
|
+
const chosen = await pickGeminiSession(sessions, basename5(cwd));
|
|
2659
|
+
if (chosen === null)
|
|
2660
|
+
return passthrough.filter((_, i) => i !== rIdx);
|
|
2661
|
+
const out = [...passthrough];
|
|
2662
|
+
out.splice(rIdx + 1, 0, chosen);
|
|
2663
|
+
return out;
|
|
2664
|
+
}
|
|
2601
2665
|
var here, pkgRoot, cmd, rest, asImp;
|
|
2602
2666
|
var init_cli = __esm(async () => {
|
|
2603
2667
|
init_resolve();
|
|
@@ -2647,7 +2711,8 @@ var init_cli = __esm(async () => {
|
|
|
2647
2711
|
case "lair": {
|
|
2648
2712
|
const home = requireVaultHome();
|
|
2649
2713
|
const { backend, skipPermissions, passthrough } = resolveLaunch(rest, { agent: readDefaultAgent(), yolo: readSkipPermissions() });
|
|
2650
|
-
const
|
|
2714
|
+
const resumed = await resolveGeminiResume(backend.name, passthrough, home);
|
|
2715
|
+
const spec = assembleSession({ cwd: home, vaultProject: home, pkgRoot, passthrough: resumed, skipPermissions, model: readDefaultModel() });
|
|
2651
2716
|
process.exit(launchBackend(backend, home, backend.renderArgs(spec), spec.env));
|
|
2652
2717
|
}
|
|
2653
2718
|
case "context": {
|
|
@@ -3046,7 +3111,8 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
3046
3111
|
}
|
|
3047
3112
|
const raw = bare ? [] : [cmd, ...rest];
|
|
3048
3113
|
const { backend, skipPermissions, passthrough } = resolveLaunch(raw, { agent: readDefaultAgent(), yolo: readSkipPermissions() });
|
|
3049
|
-
const
|
|
3114
|
+
const resumed = await resolveGeminiResume(backend.name, passthrough, process.cwd());
|
|
3115
|
+
const spec = assembleSession({ cwd: process.cwd(), vaultProject: home, pkgRoot, passthrough: resumed, skipPermissions, model: readDefaultModel() });
|
|
3050
3116
|
process.exit(launchBackend(backend, process.cwd(), backend.renderArgs(spec), spec.env));
|
|
3051
3117
|
}
|
|
3052
3118
|
console.log(`imprnt — deterministic-first markdown knowledge vault
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imprnt",
|
|
3
|
-
"version": "0.1.3-edge.
|
|
3
|
+
"version": "0.1.3-edge.60",
|
|
4
4
|
"description": "Deterministic-first, plain-markdown knowledge vault. Code does the bulk transform. The LLM only touches the irreducibly-semantic 20%. Native grep plus BM25 retrieval, zero MCP on the vault.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|