imprnt 0.1.1 → 0.1.2
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 +44 -14
- package/dist/imp.js +44 -14
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2031,8 +2031,10 @@ 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";
|
|
2036
2038
|
function vaultArg() {
|
|
2037
2039
|
const i = rest.indexOf("--vault");
|
|
2038
2040
|
if (i >= 0) {
|
|
@@ -2053,6 +2055,17 @@ function requireVaultHome() {
|
|
|
2053
2055
|
}
|
|
2054
2056
|
return home;
|
|
2055
2057
|
}
|
|
2058
|
+
function resolvePath(input, base = process.cwd(), home = homedir3()) {
|
|
2059
|
+
let p = input;
|
|
2060
|
+
if (p === "~")
|
|
2061
|
+
p = home;
|
|
2062
|
+
else if (p.startsWith("~/"))
|
|
2063
|
+
p = join14(home, p.slice(2));
|
|
2064
|
+
return resolve6(base, p);
|
|
2065
|
+
}
|
|
2066
|
+
function initPositional(args5) {
|
|
2067
|
+
return args5.find((a) => !a.startsWith("-"));
|
|
2068
|
+
}
|
|
2056
2069
|
var here, pkgRoot, cmd, rest, asImp;
|
|
2057
2070
|
var init_cli = __esm(async () => {
|
|
2058
2071
|
init_resolve();
|
|
@@ -2234,26 +2247,43 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
2234
2247
|
process.exit(1);
|
|
2235
2248
|
}
|
|
2236
2249
|
case "init": {
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2250
|
+
let target;
|
|
2251
|
+
const positional4 = initPositional(rest);
|
|
2252
|
+
if (positional4 !== undefined) {
|
|
2253
|
+
target = resolvePath(positional4);
|
|
2254
|
+
} else if (process.stdin.isTTY && process.stdout.isTTY) {
|
|
2255
|
+
const inPlace = isVaultProject(process.cwd());
|
|
2256
|
+
const display = inPlace ? process.cwd() : "~/imprnt";
|
|
2257
|
+
const fallback = inPlace ? process.cwd() : join14(homedir3(), "imprnt");
|
|
2258
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
2259
|
+
const answer = (await rl.question(`vault location [${display}]: `)).trim();
|
|
2260
|
+
rl.close();
|
|
2261
|
+
target = answer ? resolvePath(answer) : fallback;
|
|
2262
|
+
} else {
|
|
2263
|
+
target = process.cwd();
|
|
2264
|
+
}
|
|
2265
|
+
const toCwd = target === process.cwd();
|
|
2266
|
+
const rel = (sub) => toCwd ? `./${sub}` : join14(target, sub);
|
|
2267
|
+
const enclosing = projectRoot(target);
|
|
2268
|
+
if (enclosing !== target && isVaultProject(enclosing)) {
|
|
2269
|
+
console.error(`refusing to init: ${toCwd ? "this directory" : target} is inside the vault project at ${enclosing} - run \`imprnt init\` there instead`);
|
|
2240
2270
|
process.exit(1);
|
|
2241
2271
|
}
|
|
2242
2272
|
const entities = ["people", "orgs", "holdings"];
|
|
2243
2273
|
const domains = ["identity", "health", "finances", "work", "life", "projects"];
|
|
2244
2274
|
const forms = ["events", "mistakes"];
|
|
2245
2275
|
const vaultDirs = [...entities, ...domains, ...forms];
|
|
2246
|
-
const vaultPath = join14(
|
|
2276
|
+
const vaultPath = join14(target, "vault");
|
|
2247
2277
|
const vaultExisted = existsSync12(vaultPath);
|
|
2248
2278
|
let createdDirs = 0;
|
|
2249
|
-
for (const d of ["vault", ...vaultDirs.map((t) => `vault/${t}`), "raw"]) {
|
|
2250
|
-
const abs = join14(
|
|
2279
|
+
for (const d of ["", "vault", ...vaultDirs.map((t) => `vault/${t}`), "raw"]) {
|
|
2280
|
+
const abs = d ? join14(target, d) : target;
|
|
2251
2281
|
if (!existsSync12(abs))
|
|
2252
2282
|
createdDirs++;
|
|
2253
2283
|
try {
|
|
2254
2284
|
mkdirSync4(abs, { recursive: true });
|
|
2255
2285
|
} catch (e) {
|
|
2256
|
-
console.error(`cannot create
|
|
2286
|
+
console.error(`cannot create ${d ? rel(d) : target}: ${e instanceof Error ? e.message : String(e)}`);
|
|
2257
2287
|
process.exit(1);
|
|
2258
2288
|
}
|
|
2259
2289
|
}
|
|
@@ -2265,12 +2295,12 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
2265
2295
|
added.push(`vault/${f}`);
|
|
2266
2296
|
}
|
|
2267
2297
|
}
|
|
2268
|
-
const claudeMd = join14(
|
|
2298
|
+
const claudeMd = join14(target, "CLAUDE.md");
|
|
2269
2299
|
if (!existsSync12(claudeMd) && existsSync12(join14(pkgRoot, "CLAUDE.md"))) {
|
|
2270
2300
|
cpSync2(join14(pkgRoot, "CLAUDE.md"), claudeMd);
|
|
2271
2301
|
added.push("CLAUDE.md");
|
|
2272
2302
|
}
|
|
2273
|
-
const reg = registerVault(
|
|
2303
|
+
const reg = registerVault(target, { force: rest.includes("--register") });
|
|
2274
2304
|
if (reg.status === "registered")
|
|
2275
2305
|
console.log(`registered as imp's default vault project (${configPath()})`);
|
|
2276
2306
|
else if (reg.status === "kept")
|
|
@@ -2278,15 +2308,15 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
2278
2308
|
else if (reg.status === "error")
|
|
2279
2309
|
console.error(`could not register as imp's default vault project (${configPath()}): ${reg.error} — the vault still works via ./vault or IMPRNT_VAULT`);
|
|
2280
2310
|
if (!vaultExisted) {
|
|
2281
|
-
console.log(
|
|
2311
|
+
console.log(`initialized vault at ${rel("vault")}`);
|
|
2282
2312
|
console.log(` entities: ${entities.join(", ")}`);
|
|
2283
2313
|
console.log(` domains: ${domains.join(", ")}`);
|
|
2284
2314
|
console.log(` forms: ${forms.join(", ")}`);
|
|
2285
|
-
console.log(
|
|
2315
|
+
console.log(` + ${rel("raw")} for immutable by-source snapshots`);
|
|
2286
2316
|
console.log("next: type `imp` to talk, or ingest a source (`imprnt ingest <file>`), then `imprnt check`.");
|
|
2287
2317
|
} else {
|
|
2288
2318
|
const noteCount = collectNotes(vaultPath).length;
|
|
2289
|
-
console.log(`found existing vault at
|
|
2319
|
+
console.log(`found existing vault at ${rel("vault")} — ${noteCount} note${noteCount === 1 ? "" : "s"}, left untouched`);
|
|
2290
2320
|
if (added.length)
|
|
2291
2321
|
console.log(` added missing control file${added.length === 1 ? "" : "s"}: ${added.join(", ")}`);
|
|
2292
2322
|
else if (createdDirs)
|
|
@@ -2317,7 +2347,7 @@ the front door (the \`imp\` bin):
|
|
|
2317
2347
|
imp -c | --resume | <claude flags> flags pass through to claude
|
|
2318
2348
|
|
|
2319
2349
|
engine (same subcommands under \`imp\` or \`imprnt\`):
|
|
2320
|
-
imprnt init [--register]
|
|
2350
|
+
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
2351
|
imprnt snapshot <src> --dest <relpath> mirror a file/dir into raw/<relpath> (immutable, hashed) — the migration's deterministic half
|
|
2322
2352
|
imprnt ingest <file|text> [--vault D] snapshot a source -> raw/; a transcript file also gets an event skeleton (no LLM)
|
|
2323
2353
|
imprnt recall "<query>" [--vault D] synonym-aware BM25 ranking over the vault
|
package/dist/imp.js
CHANGED
|
@@ -2031,8 +2031,10 @@ 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";
|
|
2036
2038
|
function vaultArg() {
|
|
2037
2039
|
const i = rest.indexOf("--vault");
|
|
2038
2040
|
if (i >= 0) {
|
|
@@ -2053,6 +2055,17 @@ function requireVaultHome() {
|
|
|
2053
2055
|
}
|
|
2054
2056
|
return home;
|
|
2055
2057
|
}
|
|
2058
|
+
function resolvePath(input, base = process.cwd(), home = homedir3()) {
|
|
2059
|
+
let p = input;
|
|
2060
|
+
if (p === "~")
|
|
2061
|
+
p = home;
|
|
2062
|
+
else if (p.startsWith("~/"))
|
|
2063
|
+
p = join14(home, p.slice(2));
|
|
2064
|
+
return resolve6(base, p);
|
|
2065
|
+
}
|
|
2066
|
+
function initPositional(args5) {
|
|
2067
|
+
return args5.find((a) => !a.startsWith("-"));
|
|
2068
|
+
}
|
|
2056
2069
|
var here, pkgRoot, cmd, rest, asImp;
|
|
2057
2070
|
var init_cli = __esm(async () => {
|
|
2058
2071
|
init_resolve();
|
|
@@ -2234,26 +2247,43 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
2234
2247
|
process.exit(1);
|
|
2235
2248
|
}
|
|
2236
2249
|
case "init": {
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2250
|
+
let target;
|
|
2251
|
+
const positional4 = initPositional(rest);
|
|
2252
|
+
if (positional4 !== undefined) {
|
|
2253
|
+
target = resolvePath(positional4);
|
|
2254
|
+
} else if (process.stdin.isTTY && process.stdout.isTTY) {
|
|
2255
|
+
const inPlace = isVaultProject(process.cwd());
|
|
2256
|
+
const display = inPlace ? process.cwd() : "~/imprnt";
|
|
2257
|
+
const fallback = inPlace ? process.cwd() : join14(homedir3(), "imprnt");
|
|
2258
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
2259
|
+
const answer = (await rl.question(`vault location [${display}]: `)).trim();
|
|
2260
|
+
rl.close();
|
|
2261
|
+
target = answer ? resolvePath(answer) : fallback;
|
|
2262
|
+
} else {
|
|
2263
|
+
target = process.cwd();
|
|
2264
|
+
}
|
|
2265
|
+
const toCwd = target === process.cwd();
|
|
2266
|
+
const rel = (sub) => toCwd ? `./${sub}` : join14(target, sub);
|
|
2267
|
+
const enclosing = projectRoot(target);
|
|
2268
|
+
if (enclosing !== target && isVaultProject(enclosing)) {
|
|
2269
|
+
console.error(`refusing to init: ${toCwd ? "this directory" : target} is inside the vault project at ${enclosing} - run \`imprnt init\` there instead`);
|
|
2240
2270
|
process.exit(1);
|
|
2241
2271
|
}
|
|
2242
2272
|
const entities = ["people", "orgs", "holdings"];
|
|
2243
2273
|
const domains = ["identity", "health", "finances", "work", "life", "projects"];
|
|
2244
2274
|
const forms = ["events", "mistakes"];
|
|
2245
2275
|
const vaultDirs = [...entities, ...domains, ...forms];
|
|
2246
|
-
const vaultPath = join14(
|
|
2276
|
+
const vaultPath = join14(target, "vault");
|
|
2247
2277
|
const vaultExisted = existsSync12(vaultPath);
|
|
2248
2278
|
let createdDirs = 0;
|
|
2249
|
-
for (const d of ["vault", ...vaultDirs.map((t) => `vault/${t}`), "raw"]) {
|
|
2250
|
-
const abs = join14(
|
|
2279
|
+
for (const d of ["", "vault", ...vaultDirs.map((t) => `vault/${t}`), "raw"]) {
|
|
2280
|
+
const abs = d ? join14(target, d) : target;
|
|
2251
2281
|
if (!existsSync12(abs))
|
|
2252
2282
|
createdDirs++;
|
|
2253
2283
|
try {
|
|
2254
2284
|
mkdirSync4(abs, { recursive: true });
|
|
2255
2285
|
} catch (e) {
|
|
2256
|
-
console.error(`cannot create
|
|
2286
|
+
console.error(`cannot create ${d ? rel(d) : target}: ${e instanceof Error ? e.message : String(e)}`);
|
|
2257
2287
|
process.exit(1);
|
|
2258
2288
|
}
|
|
2259
2289
|
}
|
|
@@ -2265,12 +2295,12 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
2265
2295
|
added.push(`vault/${f}`);
|
|
2266
2296
|
}
|
|
2267
2297
|
}
|
|
2268
|
-
const claudeMd = join14(
|
|
2298
|
+
const claudeMd = join14(target, "CLAUDE.md");
|
|
2269
2299
|
if (!existsSync12(claudeMd) && existsSync12(join14(pkgRoot, "CLAUDE.md"))) {
|
|
2270
2300
|
cpSync2(join14(pkgRoot, "CLAUDE.md"), claudeMd);
|
|
2271
2301
|
added.push("CLAUDE.md");
|
|
2272
2302
|
}
|
|
2273
|
-
const reg = registerVault(
|
|
2303
|
+
const reg = registerVault(target, { force: rest.includes("--register") });
|
|
2274
2304
|
if (reg.status === "registered")
|
|
2275
2305
|
console.log(`registered as imp's default vault project (${configPath()})`);
|
|
2276
2306
|
else if (reg.status === "kept")
|
|
@@ -2278,15 +2308,15 @@ enable: imprnt plugin add <name> disable: imprnt plugin rm <name> [--purge]`);
|
|
|
2278
2308
|
else if (reg.status === "error")
|
|
2279
2309
|
console.error(`could not register as imp's default vault project (${configPath()}): ${reg.error} — the vault still works via ./vault or IMPRNT_VAULT`);
|
|
2280
2310
|
if (!vaultExisted) {
|
|
2281
|
-
console.log(
|
|
2311
|
+
console.log(`initialized vault at ${rel("vault")}`);
|
|
2282
2312
|
console.log(` entities: ${entities.join(", ")}`);
|
|
2283
2313
|
console.log(` domains: ${domains.join(", ")}`);
|
|
2284
2314
|
console.log(` forms: ${forms.join(", ")}`);
|
|
2285
|
-
console.log(
|
|
2315
|
+
console.log(` + ${rel("raw")} for immutable by-source snapshots`);
|
|
2286
2316
|
console.log("next: type `imp` to talk, or ingest a source (`imprnt ingest <file>`), then `imprnt check`.");
|
|
2287
2317
|
} else {
|
|
2288
2318
|
const noteCount = collectNotes(vaultPath).length;
|
|
2289
|
-
console.log(`found existing vault at
|
|
2319
|
+
console.log(`found existing vault at ${rel("vault")} — ${noteCount} note${noteCount === 1 ? "" : "s"}, left untouched`);
|
|
2290
2320
|
if (added.length)
|
|
2291
2321
|
console.log(` added missing control file${added.length === 1 ? "" : "s"}: ${added.join(", ")}`);
|
|
2292
2322
|
else if (createdDirs)
|
|
@@ -2317,7 +2347,7 @@ the front door (the \`imp\` bin):
|
|
|
2317
2347
|
imp -c | --resume | <claude flags> flags pass through to claude
|
|
2318
2348
|
|
|
2319
2349
|
engine (same subcommands under \`imp\` or \`imprnt\`):
|
|
2320
|
-
imprnt init [--register]
|
|
2350
|
+
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
2351
|
imprnt snapshot <src> --dest <relpath> mirror a file/dir into raw/<relpath> (immutable, hashed) — the migration's deterministic half
|
|
2322
2352
|
imprnt ingest <file|text> [--vault D] snapshot a source -> raw/; a transcript file also gets an event skeleton (no LLM)
|
|
2323
2353
|
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.2",
|
|
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": {
|