imprnt 0.1.1 → 0.1.3-edge.11
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 +55 -15
- package/dist/imp.js +55 -15
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2031,8 +2031,18 @@ all plugin checks passed.`);
|
|
|
2031
2031
|
// scripts/cli.ts
|
|
2032
2032
|
var exports_cli = {};
|
|
2033
2033
|
import { cpSync as cpSync2, mkdirSync as mkdirSync4, existsSync as existsSync12, readFileSync as readFileSync13 } from "node:fs";
|
|
2034
|
-
import { join as join14, dirname as dirname4 } from "node:path";
|
|
2034
|
+
import { join as join14, dirname as dirname4, resolve as resolve6 } from "node:path";
|
|
2035
|
+
import { homedir as homedir3 } from "node:os";
|
|
2035
2036
|
import { fileURLToPath } from "node:url";
|
|
2037
|
+
import { createInterface } from "node:readline/promises";
|
|
2038
|
+
function pluginRoot() {
|
|
2039
|
+
const local = projectRoot();
|
|
2040
|
+
if (process.env.IMPRNT_ROOT || process.env.IMPRINT_ROOT)
|
|
2041
|
+
return local;
|
|
2042
|
+
if (existsSync12(join14(local, "vault")) || existsSync12(join14(local, "CLAUDE.local.md")))
|
|
2043
|
+
return local;
|
|
2044
|
+
return registeredRoot() ?? local;
|
|
2045
|
+
}
|
|
2036
2046
|
function vaultArg() {
|
|
2037
2047
|
const i = rest.indexOf("--vault");
|
|
2038
2048
|
if (i >= 0) {
|
|
@@ -2053,6 +2063,17 @@ function requireVaultHome() {
|
|
|
2053
2063
|
}
|
|
2054
2064
|
return home;
|
|
2055
2065
|
}
|
|
2066
|
+
function resolvePath(input, base = process.cwd(), home = homedir3()) {
|
|
2067
|
+
let p = input;
|
|
2068
|
+
if (p === "~")
|
|
2069
|
+
p = home;
|
|
2070
|
+
else if (p.startsWith("~/"))
|
|
2071
|
+
p = join14(home, p.slice(2));
|
|
2072
|
+
return resolve6(base, p);
|
|
2073
|
+
}
|
|
2074
|
+
function initPositional(args5) {
|
|
2075
|
+
return args5.find((a) => !a.startsWith("-"));
|
|
2076
|
+
}
|
|
2056
2077
|
var here, pkgRoot, cmd, rest, asImp;
|
|
2057
2078
|
var init_cli = __esm(async () => {
|
|
2058
2079
|
init_resolve();
|
|
@@ -2113,7 +2134,9 @@ var init_cli = __esm(async () => {
|
|
|
2113
2134
|
break;
|
|
2114
2135
|
}
|
|
2115
2136
|
case "plugin": {
|
|
2116
|
-
const proj =
|
|
2137
|
+
const proj = pluginRoot();
|
|
2138
|
+
if (proj !== process.cwd())
|
|
2139
|
+
console.error(`(targeting vault project: ${proj})`);
|
|
2117
2140
|
const [sub, ...specs] = rest;
|
|
2118
2141
|
if (sub === "list") {
|
|
2119
2142
|
const dirs = listPluginDirs(proj);
|
|
@@ -2234,26 +2257,43 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
2234
2257
|
process.exit(1);
|
|
2235
2258
|
}
|
|
2236
2259
|
case "init": {
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2260
|
+
let target;
|
|
2261
|
+
const positional4 = initPositional(rest);
|
|
2262
|
+
if (positional4 !== undefined) {
|
|
2263
|
+
target = resolvePath(positional4);
|
|
2264
|
+
} else if (process.stdin.isTTY && process.stdout.isTTY) {
|
|
2265
|
+
const inPlace = isVaultProject(process.cwd());
|
|
2266
|
+
const display = inPlace ? process.cwd() : "~/imprnt";
|
|
2267
|
+
const fallback = inPlace ? process.cwd() : join14(homedir3(), "imprnt");
|
|
2268
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
2269
|
+
const answer = (await rl.question(`vault location [${display}]: `)).trim();
|
|
2270
|
+
rl.close();
|
|
2271
|
+
target = answer ? resolvePath(answer) : fallback;
|
|
2272
|
+
} else {
|
|
2273
|
+
target = process.cwd();
|
|
2274
|
+
}
|
|
2275
|
+
const toCwd = target === process.cwd();
|
|
2276
|
+
const rel = (sub) => toCwd ? `./${sub}` : join14(target, sub);
|
|
2277
|
+
const enclosing = projectRoot(target);
|
|
2278
|
+
if (enclosing !== target && isVaultProject(enclosing)) {
|
|
2279
|
+
console.error(`refusing to init: ${toCwd ? "this directory" : target} is inside the vault project at ${enclosing} - run \`imprnt init\` there instead`);
|
|
2240
2280
|
process.exit(1);
|
|
2241
2281
|
}
|
|
2242
2282
|
const entities = ["people", "orgs", "holdings"];
|
|
2243
2283
|
const domains = ["identity", "health", "finances", "work", "life", "projects"];
|
|
2244
2284
|
const forms = ["events", "mistakes"];
|
|
2245
2285
|
const vaultDirs = [...entities, ...domains, ...forms];
|
|
2246
|
-
const vaultPath = join14(
|
|
2286
|
+
const vaultPath = join14(target, "vault");
|
|
2247
2287
|
const vaultExisted = existsSync12(vaultPath);
|
|
2248
2288
|
let createdDirs = 0;
|
|
2249
|
-
for (const d of ["vault", ...vaultDirs.map((t) => `vault/${t}`), "raw"]) {
|
|
2250
|
-
const abs = join14(
|
|
2289
|
+
for (const d of ["", "vault", ...vaultDirs.map((t) => `vault/${t}`), "raw"]) {
|
|
2290
|
+
const abs = d ? join14(target, d) : target;
|
|
2251
2291
|
if (!existsSync12(abs))
|
|
2252
2292
|
createdDirs++;
|
|
2253
2293
|
try {
|
|
2254
2294
|
mkdirSync4(abs, { recursive: true });
|
|
2255
2295
|
} catch (e) {
|
|
2256
|
-
console.error(`cannot create
|
|
2296
|
+
console.error(`cannot create ${d ? rel(d) : target}: ${e instanceof Error ? e.message : String(e)}`);
|
|
2257
2297
|
process.exit(1);
|
|
2258
2298
|
}
|
|
2259
2299
|
}
|
|
@@ -2265,12 +2305,12 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
2265
2305
|
added.push(`vault/${f}`);
|
|
2266
2306
|
}
|
|
2267
2307
|
}
|
|
2268
|
-
const claudeMd = join14(
|
|
2308
|
+
const claudeMd = join14(target, "CLAUDE.md");
|
|
2269
2309
|
if (!existsSync12(claudeMd) && existsSync12(join14(pkgRoot, "CLAUDE.md"))) {
|
|
2270
2310
|
cpSync2(join14(pkgRoot, "CLAUDE.md"), claudeMd);
|
|
2271
2311
|
added.push("CLAUDE.md");
|
|
2272
2312
|
}
|
|
2273
|
-
const reg = registerVault(
|
|
2313
|
+
const reg = registerVault(target, { force: rest.includes("--register") });
|
|
2274
2314
|
if (reg.status === "registered")
|
|
2275
2315
|
console.log(`registered as imp's default vault project (${configPath()})`);
|
|
2276
2316
|
else if (reg.status === "kept")
|
|
@@ -2278,15 +2318,15 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
2278
2318
|
else if (reg.status === "error")
|
|
2279
2319
|
console.error(`could not register as imp's default vault project (${configPath()}): ${reg.error} — the vault still works via ./vault or IMPRNT_VAULT`);
|
|
2280
2320
|
if (!vaultExisted) {
|
|
2281
|
-
console.log(
|
|
2321
|
+
console.log(`initialized vault at ${rel("vault")}`);
|
|
2282
2322
|
console.log(` entities: ${entities.join(", ")}`);
|
|
2283
2323
|
console.log(` domains: ${domains.join(", ")}`);
|
|
2284
2324
|
console.log(` forms: ${forms.join(", ")}`);
|
|
2285
|
-
console.log(
|
|
2325
|
+
console.log(` + ${rel("raw")} for immutable by-source snapshots`);
|
|
2286
2326
|
console.log("next: type `imp` to talk, or ingest a source (`imprnt ingest <file>`), then `imprnt check`.");
|
|
2287
2327
|
} else {
|
|
2288
2328
|
const noteCount = collectNotes(vaultPath).length;
|
|
2289
|
-
console.log(`found existing vault at
|
|
2329
|
+
console.log(`found existing vault at ${rel("vault")} — ${noteCount} note${noteCount === 1 ? "" : "s"}, left untouched`);
|
|
2290
2330
|
if (added.length)
|
|
2291
2331
|
console.log(` added missing control file${added.length === 1 ? "" : "s"}: ${added.join(", ")}`);
|
|
2292
2332
|
else if (createdDirs)
|
|
@@ -2317,7 +2357,7 @@ the front door (the \`imp\` bin):
|
|
|
2317
2357
|
imp -c | --resume | <claude flags> flags pass through to claude
|
|
2318
2358
|
|
|
2319
2359
|
engine (same subcommands under \`imp\` or \`imprnt\`):
|
|
2320
|
-
imprnt init [--register]
|
|
2360
|
+
imprnt init [path] [--register] scaffold vault (entities/domains/forms) + raw, register as imp's default; prompts for a location when run interactively with no path (default ~/imprnt)
|
|
2321
2361
|
imprnt snapshot <src> --dest <relpath> mirror a file/dir into raw/<relpath> (immutable, hashed) — the migration's deterministic half
|
|
2322
2362
|
imprnt ingest <file|text> [--vault D] snapshot a source -> raw/; a transcript file also gets an event skeleton (no LLM)
|
|
2323
2363
|
imprnt recall "<query>" [--vault D] synonym-aware BM25 ranking over the vault
|
package/dist/imp.js
CHANGED
|
@@ -2031,8 +2031,18 @@ all plugin checks passed.`);
|
|
|
2031
2031
|
// scripts/cli.ts
|
|
2032
2032
|
var exports_cli = {};
|
|
2033
2033
|
import { cpSync as cpSync2, mkdirSync as mkdirSync4, existsSync as existsSync12, readFileSync as readFileSync13 } from "node:fs";
|
|
2034
|
-
import { join as join14, dirname as dirname4 } from "node:path";
|
|
2034
|
+
import { join as join14, dirname as dirname4, resolve as resolve6 } from "node:path";
|
|
2035
|
+
import { homedir as homedir3 } from "node:os";
|
|
2035
2036
|
import { fileURLToPath } from "node:url";
|
|
2037
|
+
import { createInterface } from "node:readline/promises";
|
|
2038
|
+
function pluginRoot() {
|
|
2039
|
+
const local = projectRoot();
|
|
2040
|
+
if (process.env.IMPRNT_ROOT || process.env.IMPRINT_ROOT)
|
|
2041
|
+
return local;
|
|
2042
|
+
if (existsSync12(join14(local, "vault")) || existsSync12(join14(local, "CLAUDE.local.md")))
|
|
2043
|
+
return local;
|
|
2044
|
+
return registeredRoot() ?? local;
|
|
2045
|
+
}
|
|
2036
2046
|
function vaultArg() {
|
|
2037
2047
|
const i = rest.indexOf("--vault");
|
|
2038
2048
|
if (i >= 0) {
|
|
@@ -2053,6 +2063,17 @@ function requireVaultHome() {
|
|
|
2053
2063
|
}
|
|
2054
2064
|
return home;
|
|
2055
2065
|
}
|
|
2066
|
+
function resolvePath(input, base = process.cwd(), home = homedir3()) {
|
|
2067
|
+
let p = input;
|
|
2068
|
+
if (p === "~")
|
|
2069
|
+
p = home;
|
|
2070
|
+
else if (p.startsWith("~/"))
|
|
2071
|
+
p = join14(home, p.slice(2));
|
|
2072
|
+
return resolve6(base, p);
|
|
2073
|
+
}
|
|
2074
|
+
function initPositional(args5) {
|
|
2075
|
+
return args5.find((a) => !a.startsWith("-"));
|
|
2076
|
+
}
|
|
2056
2077
|
var here, pkgRoot, cmd, rest, asImp;
|
|
2057
2078
|
var init_cli = __esm(async () => {
|
|
2058
2079
|
init_resolve();
|
|
@@ -2113,7 +2134,9 @@ var init_cli = __esm(async () => {
|
|
|
2113
2134
|
break;
|
|
2114
2135
|
}
|
|
2115
2136
|
case "plugin": {
|
|
2116
|
-
const proj =
|
|
2137
|
+
const proj = pluginRoot();
|
|
2138
|
+
if (proj !== process.cwd())
|
|
2139
|
+
console.error(`(targeting vault project: ${proj})`);
|
|
2117
2140
|
const [sub, ...specs] = rest;
|
|
2118
2141
|
if (sub === "list") {
|
|
2119
2142
|
const dirs = listPluginDirs(proj);
|
|
@@ -2234,26 +2257,43 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
2234
2257
|
process.exit(1);
|
|
2235
2258
|
}
|
|
2236
2259
|
case "init": {
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2260
|
+
let target;
|
|
2261
|
+
const positional4 = initPositional(rest);
|
|
2262
|
+
if (positional4 !== undefined) {
|
|
2263
|
+
target = resolvePath(positional4);
|
|
2264
|
+
} else if (process.stdin.isTTY && process.stdout.isTTY) {
|
|
2265
|
+
const inPlace = isVaultProject(process.cwd());
|
|
2266
|
+
const display = inPlace ? process.cwd() : "~/imprnt";
|
|
2267
|
+
const fallback = inPlace ? process.cwd() : join14(homedir3(), "imprnt");
|
|
2268
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
2269
|
+
const answer = (await rl.question(`vault location [${display}]: `)).trim();
|
|
2270
|
+
rl.close();
|
|
2271
|
+
target = answer ? resolvePath(answer) : fallback;
|
|
2272
|
+
} else {
|
|
2273
|
+
target = process.cwd();
|
|
2274
|
+
}
|
|
2275
|
+
const toCwd = target === process.cwd();
|
|
2276
|
+
const rel = (sub) => toCwd ? `./${sub}` : join14(target, sub);
|
|
2277
|
+
const enclosing = projectRoot(target);
|
|
2278
|
+
if (enclosing !== target && isVaultProject(enclosing)) {
|
|
2279
|
+
console.error(`refusing to init: ${toCwd ? "this directory" : target} is inside the vault project at ${enclosing} - run \`imprnt init\` there instead`);
|
|
2240
2280
|
process.exit(1);
|
|
2241
2281
|
}
|
|
2242
2282
|
const entities = ["people", "orgs", "holdings"];
|
|
2243
2283
|
const domains = ["identity", "health", "finances", "work", "life", "projects"];
|
|
2244
2284
|
const forms = ["events", "mistakes"];
|
|
2245
2285
|
const vaultDirs = [...entities, ...domains, ...forms];
|
|
2246
|
-
const vaultPath = join14(
|
|
2286
|
+
const vaultPath = join14(target, "vault");
|
|
2247
2287
|
const vaultExisted = existsSync12(vaultPath);
|
|
2248
2288
|
let createdDirs = 0;
|
|
2249
|
-
for (const d of ["vault", ...vaultDirs.map((t) => `vault/${t}`), "raw"]) {
|
|
2250
|
-
const abs = join14(
|
|
2289
|
+
for (const d of ["", "vault", ...vaultDirs.map((t) => `vault/${t}`), "raw"]) {
|
|
2290
|
+
const abs = d ? join14(target, d) : target;
|
|
2251
2291
|
if (!existsSync12(abs))
|
|
2252
2292
|
createdDirs++;
|
|
2253
2293
|
try {
|
|
2254
2294
|
mkdirSync4(abs, { recursive: true });
|
|
2255
2295
|
} catch (e) {
|
|
2256
|
-
console.error(`cannot create
|
|
2296
|
+
console.error(`cannot create ${d ? rel(d) : target}: ${e instanceof Error ? e.message : String(e)}`);
|
|
2257
2297
|
process.exit(1);
|
|
2258
2298
|
}
|
|
2259
2299
|
}
|
|
@@ -2265,12 +2305,12 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
2265
2305
|
added.push(`vault/${f}`);
|
|
2266
2306
|
}
|
|
2267
2307
|
}
|
|
2268
|
-
const claudeMd = join14(
|
|
2308
|
+
const claudeMd = join14(target, "CLAUDE.md");
|
|
2269
2309
|
if (!existsSync12(claudeMd) && existsSync12(join14(pkgRoot, "CLAUDE.md"))) {
|
|
2270
2310
|
cpSync2(join14(pkgRoot, "CLAUDE.md"), claudeMd);
|
|
2271
2311
|
added.push("CLAUDE.md");
|
|
2272
2312
|
}
|
|
2273
|
-
const reg = registerVault(
|
|
2313
|
+
const reg = registerVault(target, { force: rest.includes("--register") });
|
|
2274
2314
|
if (reg.status === "registered")
|
|
2275
2315
|
console.log(`registered as imp's default vault project (${configPath()})`);
|
|
2276
2316
|
else if (reg.status === "kept")
|
|
@@ -2278,15 +2318,15 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
2278
2318
|
else if (reg.status === "error")
|
|
2279
2319
|
console.error(`could not register as imp's default vault project (${configPath()}): ${reg.error} — the vault still works via ./vault or IMPRNT_VAULT`);
|
|
2280
2320
|
if (!vaultExisted) {
|
|
2281
|
-
console.log(
|
|
2321
|
+
console.log(`initialized vault at ${rel("vault")}`);
|
|
2282
2322
|
console.log(` entities: ${entities.join(", ")}`);
|
|
2283
2323
|
console.log(` domains: ${domains.join(", ")}`);
|
|
2284
2324
|
console.log(` forms: ${forms.join(", ")}`);
|
|
2285
|
-
console.log(
|
|
2325
|
+
console.log(` + ${rel("raw")} for immutable by-source snapshots`);
|
|
2286
2326
|
console.log("next: type `imp` to talk, or ingest a source (`imprnt ingest <file>`), then `imprnt check`.");
|
|
2287
2327
|
} else {
|
|
2288
2328
|
const noteCount = collectNotes(vaultPath).length;
|
|
2289
|
-
console.log(`found existing vault at
|
|
2329
|
+
console.log(`found existing vault at ${rel("vault")} — ${noteCount} note${noteCount === 1 ? "" : "s"}, left untouched`);
|
|
2290
2330
|
if (added.length)
|
|
2291
2331
|
console.log(` added missing control file${added.length === 1 ? "" : "s"}: ${added.join(", ")}`);
|
|
2292
2332
|
else if (createdDirs)
|
|
@@ -2317,7 +2357,7 @@ the front door (the \`imp\` bin):
|
|
|
2317
2357
|
imp -c | --resume | <claude flags> flags pass through to claude
|
|
2318
2358
|
|
|
2319
2359
|
engine (same subcommands under \`imp\` or \`imprnt\`):
|
|
2320
|
-
imprnt init [--register]
|
|
2360
|
+
imprnt init [path] [--register] scaffold vault (entities/domains/forms) + raw, register as imp's default; prompts for a location when run interactively with no path (default ~/imprnt)
|
|
2321
2361
|
imprnt snapshot <src> --dest <relpath> mirror a file/dir into raw/<relpath> (immutable, hashed) — the migration's deterministic half
|
|
2322
2362
|
imprnt ingest <file|text> [--vault D] snapshot a source -> raw/; a transcript file also gets an event skeleton (no LLM)
|
|
2323
2363
|
imprnt recall "<query>" [--vault D] synonym-aware BM25 ranking over the vault
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imprnt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3-edge.11",
|
|
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": {
|