@hasna/mementos 0.14.2 → 0.14.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/cli/brains.d.ts.map +1 -1
- package/dist/cli/index.js +33 -22
- package/dist/db/database.d.ts.map +1 -1
- package/dist/index.js +21 -10
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/model-config.d.ts +1 -1
- package/dist/mcp/index.js +17 -6
- package/dist/server/index.js +27 -9
- package/package.json +1 -1
package/dist/cli/brains.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brains.d.ts","sourceRoot":"","sources":["../../src/cli/brains.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsCpC,wBAAgB,iBAAiB,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"brains.d.ts","sourceRoot":"","sources":["../../src/cli/brains.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsCpC,wBAAgB,iBAAiB,IAAI,OAAO,CA4Q3C"}
|
package/dist/cli/index.js
CHANGED
|
@@ -2112,7 +2112,7 @@ __export(exports_database, {
|
|
|
2112
2112
|
closeDatabase: () => closeDatabase
|
|
2113
2113
|
});
|
|
2114
2114
|
import { Database } from "bun:sqlite";
|
|
2115
|
-
import { existsSync, mkdirSync } from "fs";
|
|
2115
|
+
import { existsSync, mkdirSync, cpSync } from "fs";
|
|
2116
2116
|
import { dirname, join, resolve } from "path";
|
|
2117
2117
|
function isInMemoryDb(path) {
|
|
2118
2118
|
return path === ":memory:" || path.startsWith("file::memory:");
|
|
@@ -2142,9 +2142,19 @@ function findGitRoot(startDir) {
|
|
|
2142
2142
|
}
|
|
2143
2143
|
return null;
|
|
2144
2144
|
}
|
|
2145
|
+
function migrateGlobalDir() {
|
|
2146
|
+
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
2147
|
+
const newDir = join(home, ".hasna", "mementos");
|
|
2148
|
+
const oldDir = join(home, ".mementos");
|
|
2149
|
+
if (!existsSync(newDir) && existsSync(oldDir)) {
|
|
2150
|
+
mkdirSync(join(home, ".hasna"), { recursive: true });
|
|
2151
|
+
cpSync(oldDir, newDir, { recursive: true });
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2145
2154
|
function getDbPath() {
|
|
2146
|
-
|
|
2147
|
-
|
|
2155
|
+
const envPath = process.env["HASNA_MEMENTOS_DB_PATH"] ?? process.env["MEMENTOS_DB_PATH"];
|
|
2156
|
+
if (envPath) {
|
|
2157
|
+
return envPath;
|
|
2148
2158
|
}
|
|
2149
2159
|
const cwd = process.cwd();
|
|
2150
2160
|
const nearest = findNearestMementosDb(cwd);
|
|
@@ -2156,8 +2166,9 @@ function getDbPath() {
|
|
|
2156
2166
|
return join(gitRoot, ".mementos", "mementos.db");
|
|
2157
2167
|
}
|
|
2158
2168
|
}
|
|
2169
|
+
migrateGlobalDir();
|
|
2159
2170
|
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
2160
|
-
return join(home, ".mementos", "mementos.db");
|
|
2171
|
+
return join(home, ".hasna", "mementos", "mementos.db");
|
|
2161
2172
|
}
|
|
2162
2173
|
function ensureDir(filePath) {
|
|
2163
2174
|
if (isInMemoryDb(filePath))
|
|
@@ -8712,7 +8723,7 @@ function listProjects(db) {
|
|
|
8712
8723
|
init_search();
|
|
8713
8724
|
|
|
8714
8725
|
// src/lib/config.ts
|
|
8715
|
-
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync, readdirSync, writeFileSync, unlinkSync } from "fs";
|
|
8726
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync, readdirSync, writeFileSync, unlinkSync, cpSync as cpSync2 } from "fs";
|
|
8716
8727
|
import { homedir } from "os";
|
|
8717
8728
|
import { basename, dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
8718
8729
|
var DEFAULT_CONFIG = {
|
|
@@ -8771,7 +8782,7 @@ function isValidCategory(value) {
|
|
|
8771
8782
|
return VALID_CATEGORIES.includes(value);
|
|
8772
8783
|
}
|
|
8773
8784
|
function loadConfig() {
|
|
8774
|
-
const configPath = join2(homedir(), ".mementos", "config.json");
|
|
8785
|
+
const configPath = join2(homedir(), ".hasna", "mementos", "config.json");
|
|
8775
8786
|
let fileConfig = {};
|
|
8776
8787
|
if (existsSync2(configPath)) {
|
|
8777
8788
|
try {
|
|
@@ -8798,10 +8809,10 @@ function loadConfig() {
|
|
|
8798
8809
|
return merged;
|
|
8799
8810
|
}
|
|
8800
8811
|
function profilesDir() {
|
|
8801
|
-
return join2(homedir(), ".mementos", "profiles");
|
|
8812
|
+
return join2(homedir(), ".hasna", "mementos", "profiles");
|
|
8802
8813
|
}
|
|
8803
8814
|
function globalConfigPath() {
|
|
8804
|
-
return join2(homedir(), ".mementos", "config.json");
|
|
8815
|
+
return join2(homedir(), ".hasna", "mementos", "config.json");
|
|
8805
8816
|
}
|
|
8806
8817
|
function readGlobalConfig() {
|
|
8807
8818
|
const p = globalConfigPath();
|
|
@@ -9065,7 +9076,7 @@ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as rea
|
|
|
9065
9076
|
import { homedir as homedir2 } from "os";
|
|
9066
9077
|
import { join as join3 } from "path";
|
|
9067
9078
|
var DEFAULT_MODEL = "gpt-4o-mini";
|
|
9068
|
-
var CONFIG_DIR = join3(homedir2(), ".mementos");
|
|
9079
|
+
var CONFIG_DIR = join3(homedir2(), ".hasna", "mementos");
|
|
9069
9080
|
var CONFIG_PATH = join3(CONFIG_DIR, "config.json");
|
|
9070
9081
|
function readConfig() {
|
|
9071
9082
|
if (!existsSync3(CONFIG_PATH))
|
|
@@ -9112,7 +9123,7 @@ function printInfo(msg) {
|
|
|
9112
9123
|
function makeBrainsCommand() {
|
|
9113
9124
|
const brains = new Command("brains");
|
|
9114
9125
|
brains.description("Fine-tuned model training and management (via @hasna/brains)");
|
|
9115
|
-
brains.command("gather").description("Gather training data from memories and write to JSONL").option("--limit <n>", "Maximum number of examples to gather", parseInt).option("--since <date>", "Only include memories created since this date (ISO 8601)").option("--output <dir>", "Output directory (default: ~/.mementos/training/)").option("--json", "Output result summary as JSON").action(async (opts) => {
|
|
9126
|
+
brains.command("gather").description("Gather training data from memories and write to JSONL").option("--limit <n>", "Maximum number of examples to gather", parseInt).option("--since <date>", "Only include memories created since this date (ISO 8601)").option("--output <dir>", "Output directory (default: ~/.hasna/mementos/training/)").option("--json", "Output result summary as JSON").action(async (opts) => {
|
|
9116
9127
|
try {
|
|
9117
9128
|
const since = opts.since ? new Date(opts.since) : undefined;
|
|
9118
9129
|
if (since && isNaN(since.getTime())) {
|
|
@@ -9126,7 +9137,7 @@ function makeBrainsCommand() {
|
|
|
9126
9137
|
limit: opts.limit,
|
|
9127
9138
|
since
|
|
9128
9139
|
});
|
|
9129
|
-
const outputDir = opts.output ?? join4(homedir3(), ".mementos", "training");
|
|
9140
|
+
const outputDir = opts.output ?? join4(homedir3(), ".hasna", "mementos", "training");
|
|
9130
9141
|
if (!existsSync4(outputDir)) {
|
|
9131
9142
|
mkdirSync4(outputDir, { recursive: true });
|
|
9132
9143
|
}
|
|
@@ -9155,7 +9166,7 @@ function makeBrainsCommand() {
|
|
|
9155
9166
|
try {
|
|
9156
9167
|
let datasetPath = opts.dataset;
|
|
9157
9168
|
if (!datasetPath) {
|
|
9158
|
-
const trainingDir = join4(homedir3(), ".mementos", "training");
|
|
9169
|
+
const trainingDir = join4(homedir3(), ".hasna", "mementos", "training");
|
|
9159
9170
|
if (!existsSync4(trainingDir)) {
|
|
9160
9171
|
printError("No training data found. Run `mementos brains gather` first.");
|
|
9161
9172
|
process.exit(1);
|
|
@@ -10827,7 +10838,7 @@ program2.command("doctor").description("Diagnose common issues with the mementos
|
|
|
10827
10838
|
if (activeProfile) {
|
|
10828
10839
|
checks.push({ name: "Active profile", status: "ok", detail: `${activeProfile} (${profiles.length} total)` });
|
|
10829
10840
|
} else {
|
|
10830
|
-
checks.push({ name: "Active profile", status: "ok", detail: `default (~/.mementos/mementos.db) \u2014 ${profiles.length} profile(s) available` });
|
|
10841
|
+
checks.push({ name: "Active profile", status: "ok", detail: `default (~/.hasna/mementos/mementos.db) \u2014 ${profiles.length} profile(s) available` });
|
|
10831
10842
|
}
|
|
10832
10843
|
} catch (e) {
|
|
10833
10844
|
checks.push({ name: "Active profile", status: "warn", detail: e instanceof Error ? e.message : String(e) });
|
|
@@ -11396,11 +11407,11 @@ ${lines.join(`
|
|
|
11396
11407
|
handleError(e);
|
|
11397
11408
|
}
|
|
11398
11409
|
});
|
|
11399
|
-
program2.command("backup [path]").description("Backup the SQLite database to a file").option("--list", "List available backups in ~/.mementos/backups/").action((targetPath, opts) => {
|
|
11410
|
+
program2.command("backup [path]").description("Backup the SQLite database to a file").option("--list", "List available backups in ~/.hasna/mementos/backups/").action((targetPath, opts) => {
|
|
11400
11411
|
try {
|
|
11401
11412
|
const globalOpts = program2.opts();
|
|
11402
11413
|
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
11403
|
-
const backupsDir = join6(home, ".mementos", "backups");
|
|
11414
|
+
const backupsDir = join6(home, ".hasna", "mementos", "backups");
|
|
11404
11415
|
if (opts.list) {
|
|
11405
11416
|
if (!existsSync6(backupsDir)) {
|
|
11406
11417
|
if (globalOpts.json) {
|
|
@@ -11476,11 +11487,11 @@ program2.command("backup [path]").description("Backup the SQLite database to a f
|
|
|
11476
11487
|
handleError(e);
|
|
11477
11488
|
}
|
|
11478
11489
|
});
|
|
11479
|
-
program2.command("restore [file]").description("Restore the database from a backup file").option("--latest", "Restore the most recent backup from ~/.mementos/backups/").option("--force", "Skip confirmation and perform the restore").action((filePath, opts) => {
|
|
11490
|
+
program2.command("restore [file]").description("Restore the database from a backup file").option("--latest", "Restore the most recent backup from ~/.hasna/mementos/backups/").option("--force", "Skip confirmation and perform the restore").action((filePath, opts) => {
|
|
11480
11491
|
try {
|
|
11481
11492
|
const globalOpts = program2.opts();
|
|
11482
11493
|
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
11483
|
-
const backupsDir = join6(home, ".mementos", "backups");
|
|
11494
|
+
const backupsDir = join6(home, ".hasna", "mementos", "backups");
|
|
11484
11495
|
let source;
|
|
11485
11496
|
if (opts.latest) {
|
|
11486
11497
|
if (!existsSync6(backupsDir)) {
|
|
@@ -11901,7 +11912,7 @@ function validateConfigKeyValue(key, value) {
|
|
|
11901
11912
|
return null;
|
|
11902
11913
|
}
|
|
11903
11914
|
function getConfigPath() {
|
|
11904
|
-
return join6(homedir4(), ".mementos", "config.json");
|
|
11915
|
+
return join6(homedir4(), ".hasna", "mementos", "config.json");
|
|
11905
11916
|
}
|
|
11906
11917
|
function readFileConfig() {
|
|
11907
11918
|
const configPath = getConfigPath();
|
|
@@ -12447,12 +12458,12 @@ profileCmd.command("get").description("Show the currently active profile").actio
|
|
|
12447
12458
|
if (active) {
|
|
12448
12459
|
console.log(chalk2.green(`Active profile: ${active}`));
|
|
12449
12460
|
if (!process.env["MEMENTOS_PROFILE"]) {
|
|
12450
|
-
console.log(chalk2.dim("(persisted in ~/.mementos/config.json)"));
|
|
12461
|
+
console.log(chalk2.dim("(persisted in ~/.hasna/mementos/config.json)"));
|
|
12451
12462
|
} else {
|
|
12452
12463
|
console.log(chalk2.dim("(from MEMENTOS_PROFILE env var)"));
|
|
12453
12464
|
}
|
|
12454
12465
|
} else {
|
|
12455
|
-
console.log(chalk2.dim("No active profile \u2014 using default DB (~/.mementos/mementos.db)"));
|
|
12466
|
+
console.log(chalk2.dim("No active profile \u2014 using default DB (~/.hasna/mementos/mementos.db)"));
|
|
12456
12467
|
}
|
|
12457
12468
|
});
|
|
12458
12469
|
profileCmd.command("set <name>").description("Switch to a named profile (creates the DB on first use)").action((name) => {
|
|
@@ -12463,7 +12474,7 @@ profileCmd.command("set <name>").description("Switch to a named profile (creates
|
|
|
12463
12474
|
}
|
|
12464
12475
|
setActiveProfile(clean);
|
|
12465
12476
|
console.log(chalk2.green(`\u2713 Switched to profile: ${clean}`));
|
|
12466
|
-
console.log(chalk2.dim(` DB: ~/.mementos/profiles/${clean}.db (created on first use)`));
|
|
12477
|
+
console.log(chalk2.dim(` DB: ~/.hasna/mementos/profiles/${clean}.db (created on first use)`));
|
|
12467
12478
|
});
|
|
12468
12479
|
profileCmd.command("unset").description("Clear the active profile (revert to default DB)").action(() => {
|
|
12469
12480
|
const was = getActiveProfile();
|
|
@@ -12473,7 +12484,7 @@ profileCmd.command("unset").description("Clear the active profile (revert to def
|
|
|
12473
12484
|
} else {
|
|
12474
12485
|
console.log(chalk2.dim("No active profile was set."));
|
|
12475
12486
|
}
|
|
12476
|
-
console.log(chalk2.dim(" Now using default DB: ~/.mementos/mementos.db"));
|
|
12487
|
+
console.log(chalk2.dim(" Now using default DB: ~/.hasna/mementos/mementos.db"));
|
|
12477
12488
|
});
|
|
12478
12489
|
profileCmd.command("delete <name>").description("Delete a profile and its DB file (irreversible)").option("-y, --yes", "Skip confirmation prompt").action(async (name, opts) => {
|
|
12479
12490
|
if (!opts.yes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA8CtC,wBAAgB,SAAS,IAAI,MAAM,CAoBlC;AAs0BD,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAerD;AA+BD,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAED,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAef"}
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ __export(exports_database, {
|
|
|
28
28
|
closeDatabase: () => closeDatabase
|
|
29
29
|
});
|
|
30
30
|
import { Database } from "bun:sqlite";
|
|
31
|
-
import { existsSync, mkdirSync } from "fs";
|
|
31
|
+
import { existsSync, mkdirSync, cpSync } from "fs";
|
|
32
32
|
import { dirname, join, resolve } from "path";
|
|
33
33
|
function isInMemoryDb(path) {
|
|
34
34
|
return path === ":memory:" || path.startsWith("file::memory:");
|
|
@@ -58,9 +58,19 @@ function findGitRoot(startDir) {
|
|
|
58
58
|
}
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
|
+
function migrateGlobalDir() {
|
|
62
|
+
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
63
|
+
const newDir = join(home, ".hasna", "mementos");
|
|
64
|
+
const oldDir = join(home, ".mementos");
|
|
65
|
+
if (!existsSync(newDir) && existsSync(oldDir)) {
|
|
66
|
+
mkdirSync(join(home, ".hasna"), { recursive: true });
|
|
67
|
+
cpSync(oldDir, newDir, { recursive: true });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
61
70
|
function getDbPath() {
|
|
62
|
-
|
|
63
|
-
|
|
71
|
+
const envPath = process.env["HASNA_MEMENTOS_DB_PATH"] ?? process.env["MEMENTOS_DB_PATH"];
|
|
72
|
+
if (envPath) {
|
|
73
|
+
return envPath;
|
|
64
74
|
}
|
|
65
75
|
const cwd = process.cwd();
|
|
66
76
|
const nearest = findNearestMementosDb(cwd);
|
|
@@ -72,8 +82,9 @@ function getDbPath() {
|
|
|
72
82
|
return join(gitRoot, ".mementos", "mementos.db");
|
|
73
83
|
}
|
|
74
84
|
}
|
|
85
|
+
migrateGlobalDir();
|
|
75
86
|
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
76
|
-
return join(home, ".mementos", "mementos.db");
|
|
87
|
+
return join(home, ".hasna", "mementos", "mementos.db");
|
|
77
88
|
}
|
|
78
89
|
function ensureDir(filePath) {
|
|
79
90
|
if (isInMemoryDb(filePath))
|
|
@@ -2919,7 +2930,7 @@ function logSearchQuery(query, resultCount, agentId, projectId, db) {
|
|
|
2919
2930
|
} catch {}
|
|
2920
2931
|
}
|
|
2921
2932
|
// src/lib/config.ts
|
|
2922
|
-
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync, readdirSync, writeFileSync, unlinkSync } from "fs";
|
|
2933
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync, readdirSync, writeFileSync, unlinkSync, cpSync as cpSync2 } from "fs";
|
|
2923
2934
|
import { homedir } from "os";
|
|
2924
2935
|
import { basename, dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
2925
2936
|
var DEFAULT_CONFIG = {
|
|
@@ -2978,7 +2989,7 @@ function isValidCategory(value) {
|
|
|
2978
2989
|
return VALID_CATEGORIES.includes(value);
|
|
2979
2990
|
}
|
|
2980
2991
|
function loadConfig() {
|
|
2981
|
-
const configPath = join2(homedir(), ".mementos", "config.json");
|
|
2992
|
+
const configPath = join2(homedir(), ".hasna", "mementos", "config.json");
|
|
2982
2993
|
let fileConfig = {};
|
|
2983
2994
|
if (existsSync2(configPath)) {
|
|
2984
2995
|
try {
|
|
@@ -3005,10 +3016,10 @@ function loadConfig() {
|
|
|
3005
3016
|
return merged;
|
|
3006
3017
|
}
|
|
3007
3018
|
function profilesDir() {
|
|
3008
|
-
return join2(homedir(), ".mementos", "profiles");
|
|
3019
|
+
return join2(homedir(), ".hasna", "mementos", "profiles");
|
|
3009
3020
|
}
|
|
3010
3021
|
function globalConfigPath() {
|
|
3011
|
-
return join2(homedir(), ".mementos", "config.json");
|
|
3022
|
+
return join2(homedir(), ".hasna", "mementos", "config.json");
|
|
3012
3023
|
}
|
|
3013
3024
|
function readGlobalConfig() {
|
|
3014
3025
|
const p = globalConfigPath();
|
|
@@ -3414,7 +3425,7 @@ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as rea
|
|
|
3414
3425
|
import { homedir as homedir2 } from "os";
|
|
3415
3426
|
import { join as join3 } from "path";
|
|
3416
3427
|
function getAgentSyncDir(agentName) {
|
|
3417
|
-
const dir = join3(homedir2(), ".mementos", "agents", agentName);
|
|
3428
|
+
const dir = join3(homedir2(), ".hasna", "mementos", "agents", agentName);
|
|
3418
3429
|
if (!existsSync3(dir)) {
|
|
3419
3430
|
mkdirSync3(dir, { recursive: true });
|
|
3420
3431
|
}
|
|
@@ -4524,7 +4535,7 @@ import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as rea
|
|
|
4524
4535
|
import { homedir as homedir3 } from "os";
|
|
4525
4536
|
import { join as join4 } from "path";
|
|
4526
4537
|
var DEFAULT_MODEL = "gpt-4o-mini";
|
|
4527
|
-
var CONFIG_DIR = join4(homedir3(), ".mementos");
|
|
4538
|
+
var CONFIG_DIR = join4(homedir3(), ".hasna", "mementos");
|
|
4528
4539
|
var CONFIG_PATH = join4(CONFIG_DIR, "config.json");
|
|
4529
4540
|
function readConfig() {
|
|
4530
4541
|
if (!existsSync4(CONFIG_PATH))
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAA+B,MAAM,UAAU,CAAC;AAM5E,eAAO,MAAM,cAAc,EAAE,cA4B5B,CAAC;AA4DF,wBAAgB,UAAU,IAAI,cAAc,CAwC3C;AAwED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAMhD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAQ1D;AAED,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAOvC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED,wBAAgB,SAAS,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAA+B,MAAM,UAAU,CAAC;AAM5E,eAAO,MAAM,cAAc,EAAE,cA4B5B,CAAC;AA4DF,wBAAgB,UAAU,IAAI,cAAc,CAwC3C;AAwED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAMhD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAQ1D;AAED,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAOvC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED,wBAAgB,SAAS,IAAI,MAAM,CAgDlC"}
|
|
@@ -4,7 +4,7 @@ export declare const DEFAULT_MODEL = "gpt-4o-mini";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function getActiveModel(): string;
|
|
6
6
|
/**
|
|
7
|
-
* Sets the active fine-tuned model ID in ~/.mementos/config.json.
|
|
7
|
+
* Sets the active fine-tuned model ID in ~/.hasna/mementos/config.json.
|
|
8
8
|
*/
|
|
9
9
|
export declare function setActiveModel(modelId: string): void;
|
|
10
10
|
/**
|
package/dist/mcp/index.js
CHANGED
|
@@ -121,7 +121,7 @@ __export(exports_database, {
|
|
|
121
121
|
closeDatabase: () => closeDatabase
|
|
122
122
|
});
|
|
123
123
|
import { Database } from "bun:sqlite";
|
|
124
|
-
import { existsSync, mkdirSync } from "fs";
|
|
124
|
+
import { existsSync, mkdirSync, cpSync } from "fs";
|
|
125
125
|
import { dirname, join, resolve } from "path";
|
|
126
126
|
function isInMemoryDb(path) {
|
|
127
127
|
return path === ":memory:" || path.startsWith("file::memory:");
|
|
@@ -151,9 +151,19 @@ function findGitRoot(startDir) {
|
|
|
151
151
|
}
|
|
152
152
|
return null;
|
|
153
153
|
}
|
|
154
|
+
function migrateGlobalDir() {
|
|
155
|
+
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
156
|
+
const newDir = join(home, ".hasna", "mementos");
|
|
157
|
+
const oldDir = join(home, ".mementos");
|
|
158
|
+
if (!existsSync(newDir) && existsSync(oldDir)) {
|
|
159
|
+
mkdirSync(join(home, ".hasna"), { recursive: true });
|
|
160
|
+
cpSync(oldDir, newDir, { recursive: true });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
154
163
|
function getDbPath() {
|
|
155
|
-
|
|
156
|
-
|
|
164
|
+
const envPath = process.env["HASNA_MEMENTOS_DB_PATH"] ?? process.env["MEMENTOS_DB_PATH"];
|
|
165
|
+
if (envPath) {
|
|
166
|
+
return envPath;
|
|
157
167
|
}
|
|
158
168
|
const cwd = process.cwd();
|
|
159
169
|
const nearest = findNearestMementosDb(cwd);
|
|
@@ -165,8 +175,9 @@ function getDbPath() {
|
|
|
165
175
|
return join(gitRoot, ".mementos", "mementos.db");
|
|
166
176
|
}
|
|
167
177
|
}
|
|
178
|
+
migrateGlobalDir();
|
|
168
179
|
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
169
|
-
return join(home, ".mementos", "mementos.db");
|
|
180
|
+
return join(home, ".hasna", "mementos", "mementos.db");
|
|
170
181
|
}
|
|
171
182
|
function ensureDir(filePath) {
|
|
172
183
|
if (isInMemoryDb(filePath))
|
|
@@ -5052,7 +5063,7 @@ var init_export_v1 = __esm(() => {
|
|
|
5052
5063
|
});
|
|
5053
5064
|
|
|
5054
5065
|
// src/lib/config.ts
|
|
5055
|
-
import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync3, readdirSync as readdirSync3, writeFileSync, unlinkSync } from "fs";
|
|
5066
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync3, readdirSync as readdirSync3, writeFileSync, unlinkSync, cpSync as cpSync2 } from "fs";
|
|
5056
5067
|
import { homedir } from "os";
|
|
5057
5068
|
import { basename as basename3, dirname as dirname5, join as join6, resolve as resolve4 } from "path";
|
|
5058
5069
|
function deepMerge(target, source) {
|
|
@@ -5075,7 +5086,7 @@ function isValidCategory(value) {
|
|
|
5075
5086
|
return VALID_CATEGORIES.includes(value);
|
|
5076
5087
|
}
|
|
5077
5088
|
function loadConfig() {
|
|
5078
|
-
const configPath = join6(homedir(), ".mementos", "config.json");
|
|
5089
|
+
const configPath = join6(homedir(), ".hasna", "mementos", "config.json");
|
|
5079
5090
|
let fileConfig = {};
|
|
5080
5091
|
if (existsSync6(configPath)) {
|
|
5081
5092
|
try {
|
package/dist/server/index.js
CHANGED
|
@@ -116,7 +116,7 @@ __export(exports_database, {
|
|
|
116
116
|
closeDatabase: () => closeDatabase
|
|
117
117
|
});
|
|
118
118
|
import { Database } from "bun:sqlite";
|
|
119
|
-
import { existsSync, mkdirSync } from "fs";
|
|
119
|
+
import { existsSync, mkdirSync, cpSync } from "fs";
|
|
120
120
|
import { dirname, join, resolve } from "path";
|
|
121
121
|
function isInMemoryDb(path) {
|
|
122
122
|
return path === ":memory:" || path.startsWith("file::memory:");
|
|
@@ -146,9 +146,19 @@ function findGitRoot(startDir) {
|
|
|
146
146
|
}
|
|
147
147
|
return null;
|
|
148
148
|
}
|
|
149
|
+
function migrateGlobalDir() {
|
|
150
|
+
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
151
|
+
const newDir = join(home, ".hasna", "mementos");
|
|
152
|
+
const oldDir = join(home, ".mementos");
|
|
153
|
+
if (!existsSync(newDir) && existsSync(oldDir)) {
|
|
154
|
+
mkdirSync(join(home, ".hasna"), { recursive: true });
|
|
155
|
+
cpSync(oldDir, newDir, { recursive: true });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
149
158
|
function getDbPath() {
|
|
150
|
-
|
|
151
|
-
|
|
159
|
+
const envPath = process.env["HASNA_MEMENTOS_DB_PATH"] ?? process.env["MEMENTOS_DB_PATH"];
|
|
160
|
+
if (envPath) {
|
|
161
|
+
return envPath;
|
|
152
162
|
}
|
|
153
163
|
const cwd = process.cwd();
|
|
154
164
|
const nearest = findNearestMementosDb(cwd);
|
|
@@ -160,8 +170,9 @@ function getDbPath() {
|
|
|
160
170
|
return join(gitRoot, ".mementos", "mementos.db");
|
|
161
171
|
}
|
|
162
172
|
}
|
|
173
|
+
migrateGlobalDir();
|
|
163
174
|
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
164
|
-
return join(home, ".mementos", "mementos.db");
|
|
175
|
+
return join(home, ".hasna", "mementos", "mementos.db");
|
|
165
176
|
}
|
|
166
177
|
function ensureDir(filePath) {
|
|
167
178
|
if (isInMemoryDb(filePath))
|
|
@@ -4410,7 +4421,7 @@ function listProjects(db) {
|
|
|
4410
4421
|
}
|
|
4411
4422
|
|
|
4412
4423
|
// src/lib/config.ts
|
|
4413
|
-
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync, readdirSync, writeFileSync, unlinkSync } from "fs";
|
|
4424
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync, readdirSync, writeFileSync, unlinkSync, cpSync as cpSync2 } from "fs";
|
|
4414
4425
|
import { homedir } from "os";
|
|
4415
4426
|
import { basename, dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
4416
4427
|
function findFileWalkingUp(filename) {
|
|
@@ -4441,10 +4452,10 @@ function findGitRoot2() {
|
|
|
4441
4452
|
}
|
|
4442
4453
|
}
|
|
4443
4454
|
function profilesDir() {
|
|
4444
|
-
return join2(homedir(), ".mementos", "profiles");
|
|
4455
|
+
return join2(homedir(), ".hasna", "mementos", "profiles");
|
|
4445
4456
|
}
|
|
4446
4457
|
function globalConfigPath() {
|
|
4447
|
-
return join2(homedir(), ".mementos", "config.json");
|
|
4458
|
+
return join2(homedir(), ".hasna", "mementos", "config.json");
|
|
4448
4459
|
}
|
|
4449
4460
|
function readGlobalConfig() {
|
|
4450
4461
|
const p = globalConfigPath();
|
|
@@ -4470,7 +4481,14 @@ function listProfiles() {
|
|
|
4470
4481
|
return readdirSync(dir).filter((f) => f.endsWith(".db")).map((f) => basename(f, ".db")).sort();
|
|
4471
4482
|
}
|
|
4472
4483
|
function getDbPath2() {
|
|
4473
|
-
const
|
|
4484
|
+
const _home = homedir();
|
|
4485
|
+
const _newDir = join2(_home, ".hasna", "mementos");
|
|
4486
|
+
const _oldDir = join2(_home, ".mementos");
|
|
4487
|
+
if (!existsSync2(_newDir) && existsSync2(_oldDir)) {
|
|
4488
|
+
mkdirSync2(join2(_home, ".hasna"), { recursive: true });
|
|
4489
|
+
cpSync2(_oldDir, _newDir, { recursive: true });
|
|
4490
|
+
}
|
|
4491
|
+
const envDbPath = process.env["HASNA_MEMENTOS_DB_PATH"] ?? process.env["MEMENTOS_DB_PATH"];
|
|
4474
4492
|
if (envDbPath) {
|
|
4475
4493
|
const resolved = resolve2(envDbPath);
|
|
4476
4494
|
ensureDir2(dirname2(resolved));
|
|
@@ -4495,7 +4513,7 @@ function getDbPath2() {
|
|
|
4495
4513
|
if (found) {
|
|
4496
4514
|
return found;
|
|
4497
4515
|
}
|
|
4498
|
-
const fallback = join2(homedir(), ".mementos", "mementos.db");
|
|
4516
|
+
const fallback = join2(homedir(), ".hasna", "mementos", "mementos.db");
|
|
4499
4517
|
ensureDir2(dirname2(fallback));
|
|
4500
4518
|
return fallback;
|
|
4501
4519
|
}
|