conare 0.3.0 → 0.3.1
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/index.js +60 -27
- package/package.json +11 -2
package/dist/index.js
CHANGED
|
@@ -871,7 +871,7 @@ var init_interactive = __esm(() => {
|
|
|
871
871
|
});
|
|
872
872
|
|
|
873
873
|
// src/index.ts
|
|
874
|
-
import { existsSync as
|
|
874
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
875
875
|
import { join as join10 } from "node:path";
|
|
876
876
|
|
|
877
877
|
// src/detect.ts
|
|
@@ -1005,7 +1005,7 @@ function detect() {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
|
|
1007
1007
|
// src/ingest/claude.ts
|
|
1008
|
-
import { readdirSync as readdirSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
1008
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync2, existsSync as existsSync3 } from "node:fs";
|
|
1009
1009
|
import { join as join3, basename } from "node:path";
|
|
1010
1010
|
import { homedir as homedir3 } from "node:os";
|
|
1011
1011
|
|
|
@@ -1030,6 +1030,12 @@ function cleanText(raw) {
|
|
|
1030
1030
|
text = text.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, "");
|
|
1031
1031
|
text = text.replace(/<attached-context[\s\S]*?<\/attached-context>/g, "");
|
|
1032
1032
|
text = text.replace(/<environment_context>[\s\S]*?<\/environment_context>/g, "");
|
|
1033
|
+
text = text.replace(/^\s*Base directory for this skill:[\s\S]*/g, "");
|
|
1034
|
+
text = text.replace(/\nBase directory for this skill:[\s\S]*/g, "");
|
|
1035
|
+
text = text.replace(/<!-- vibe-rules Integration -->[\s\S]*?<!-- \/vibe-rules Integration -->/g, "");
|
|
1036
|
+
text = text.replace(/<good-behaviour>[\s\S]*?<\/good-behaviour>/g, "");
|
|
1037
|
+
text = text.replace(/<frontend-design>[\s\S]*?<\/frontend-design>/g, "");
|
|
1038
|
+
text = text.replace(/<architecture>[\s\S]*?<\/architecture>/g, "");
|
|
1033
1039
|
return text.trim();
|
|
1034
1040
|
}
|
|
1035
1041
|
function createContentHash(content) {
|
|
@@ -1075,6 +1081,33 @@ function clearIngested(source) {
|
|
|
1075
1081
|
// src/ingest/claude.ts
|
|
1076
1082
|
var MAX_CONTENT = 48000;
|
|
1077
1083
|
var MIN_TURN_LEN = 50;
|
|
1084
|
+
function resolveProjectName(dirName) {
|
|
1085
|
+
const segments = dirName.replace(/^-/, "").split("-");
|
|
1086
|
+
let resolved = "/";
|
|
1087
|
+
let i = 0;
|
|
1088
|
+
while (i < segments.length) {
|
|
1089
|
+
let found = false;
|
|
1090
|
+
for (let end = segments.length;end > i; end--) {
|
|
1091
|
+
const candidate = segments.slice(i, end).join("-");
|
|
1092
|
+
const candidatePath = join3(resolved, candidate);
|
|
1093
|
+
if (existsSync3(candidatePath)) {
|
|
1094
|
+
resolved = candidatePath;
|
|
1095
|
+
i = end;
|
|
1096
|
+
found = true;
|
|
1097
|
+
break;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
if (!found) {
|
|
1101
|
+
resolved = join3(resolved, segments[i]);
|
|
1102
|
+
i++;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
const home = homedir3();
|
|
1106
|
+
if (resolved.startsWith(home + "/")) {
|
|
1107
|
+
return resolved.slice(home.length + 1);
|
|
1108
|
+
}
|
|
1109
|
+
return resolved;
|
|
1110
|
+
}
|
|
1078
1111
|
function extractText(content) {
|
|
1079
1112
|
if (typeof content === "string")
|
|
1080
1113
|
return content;
|
|
@@ -1140,7 +1173,7 @@ function ingestClaude() {
|
|
|
1140
1173
|
}
|
|
1141
1174
|
for (const projDir of projectDirs) {
|
|
1142
1175
|
const projPath = join3(projectsDir, projDir);
|
|
1143
|
-
const project = projDir
|
|
1176
|
+
const project = resolveProjectName(projDir);
|
|
1144
1177
|
let files;
|
|
1145
1178
|
try {
|
|
1146
1179
|
files = readdirSync2(projPath).filter((f) => f.endsWith(".jsonl"));
|
|
@@ -1200,7 +1233,7 @@ ${body}`;
|
|
|
1200
1233
|
}
|
|
1201
1234
|
|
|
1202
1235
|
// src/ingest/codex.ts
|
|
1203
|
-
import { existsSync as
|
|
1236
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, readdirSync as readdirSync3 } from "node:fs";
|
|
1204
1237
|
import { join as join4, basename as basename2 } from "node:path";
|
|
1205
1238
|
import { homedir as homedir4 } from "node:os";
|
|
1206
1239
|
var MAX_CONTENT2 = 48000;
|
|
@@ -1224,7 +1257,7 @@ function ingestCodex() {
|
|
|
1224
1257
|
let filtered = 0;
|
|
1225
1258
|
let deduped = 0;
|
|
1226
1259
|
const historyPath = join4(homedir4(), ".codex", "history.jsonl");
|
|
1227
|
-
if (
|
|
1260
|
+
if (existsSync4(historyPath)) {
|
|
1228
1261
|
try {
|
|
1229
1262
|
const lines = readFileSync3(historyPath, "utf-8").split(`
|
|
1230
1263
|
`).filter(Boolean);
|
|
@@ -1298,7 +1331,7 @@ ${body}`;
|
|
|
1298
1331
|
} catch {}
|
|
1299
1332
|
}
|
|
1300
1333
|
const sessionsDir = join4(homedir4(), ".codex", "sessions");
|
|
1301
|
-
if (
|
|
1334
|
+
if (existsSync4(sessionsDir)) {
|
|
1302
1335
|
try {
|
|
1303
1336
|
const stats = { filtered: 0, deduped: 0 };
|
|
1304
1337
|
walkCodexSessions(sessionsDir, memories, sessionIds, stats);
|
|
@@ -1589,7 +1622,7 @@ ${body}`;
|
|
|
1589
1622
|
|
|
1590
1623
|
// src/ingest/codebase.ts
|
|
1591
1624
|
import { createHash as createHash2 } from "node:crypto";
|
|
1592
|
-
import { readdirSync as readdirSync4, readFileSync as readFileSync5, statSync as statSync2, existsSync as
|
|
1625
|
+
import { readdirSync as readdirSync4, readFileSync as readFileSync5, statSync as statSync2, existsSync as existsSync5 } from "node:fs";
|
|
1593
1626
|
import { join as join6, relative, extname, resolve } from "node:path";
|
|
1594
1627
|
var DEFAULT_IGNORE = new Set([
|
|
1595
1628
|
"node_modules",
|
|
@@ -1676,7 +1709,7 @@ var MAX_FILE_SIZE = 1e5;
|
|
|
1676
1709
|
function parseGitignore(rootPath) {
|
|
1677
1710
|
const patterns = new Set;
|
|
1678
1711
|
const gitignorePath = join6(rootPath, ".gitignore");
|
|
1679
|
-
if (!
|
|
1712
|
+
if (!existsSync5(gitignorePath))
|
|
1680
1713
|
return patterns;
|
|
1681
1714
|
try {
|
|
1682
1715
|
const content = readFileSync5(gitignorePath, "utf-8");
|
|
@@ -1962,7 +1995,7 @@ async function uploadBulk(apiKey, memories, onProgress) {
|
|
|
1962
1995
|
}
|
|
1963
1996
|
|
|
1964
1997
|
// src/configure.ts
|
|
1965
|
-
import { existsSync as
|
|
1998
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync2, readFileSync as readFileSync6, writeFileSync as writeFileSync2 } from "node:fs";
|
|
1966
1999
|
import { dirname, join as join7 } from "node:path";
|
|
1967
2000
|
import { homedir as homedir5 } from "node:os";
|
|
1968
2001
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
@@ -2012,7 +2045,7 @@ function configureClaude(apiKey) {
|
|
|
2012
2045
|
return "Claude Code configured via `claude mcp add-json`";
|
|
2013
2046
|
}
|
|
2014
2047
|
upsertMcpServer(claudeConfigPath, apiKey);
|
|
2015
|
-
if (
|
|
2048
|
+
if (existsSync6(join7(homedir5(), ".claude"))) {
|
|
2016
2049
|
upsertMcpServer(claudeMcpPath, apiKey);
|
|
2017
2050
|
}
|
|
2018
2051
|
return `Claude Code configured at ${claudeConfigPath}`;
|
|
@@ -2039,14 +2072,14 @@ function configureMcp(apiKey, targets = ["claude", "cursor", "codex"]) {
|
|
|
2039
2072
|
}
|
|
2040
2073
|
|
|
2041
2074
|
// src/config.ts
|
|
2042
|
-
import { existsSync as
|
|
2075
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync3 } from "node:fs";
|
|
2043
2076
|
import { join as join8 } from "node:path";
|
|
2044
2077
|
import { homedir as homedir6 } from "node:os";
|
|
2045
2078
|
var CONFIG_DIR = join8(homedir6(), ".conare");
|
|
2046
2079
|
var CONFIG_PATH = join8(CONFIG_DIR, "config.json");
|
|
2047
2080
|
function readConfig() {
|
|
2048
2081
|
try {
|
|
2049
|
-
if (!
|
|
2082
|
+
if (!existsSync7(CONFIG_PATH))
|
|
2050
2083
|
return {};
|
|
2051
2084
|
return JSON.parse(readFileSync7(CONFIG_PATH, "utf-8"));
|
|
2052
2085
|
} catch {
|
|
@@ -2063,7 +2096,7 @@ function getSavedApiKey() {
|
|
|
2063
2096
|
}
|
|
2064
2097
|
|
|
2065
2098
|
// src/sync.ts
|
|
2066
|
-
import { existsSync as
|
|
2099
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync4, writeFileSync as writeFileSync4, unlinkSync, readFileSync as readFileSync8, chmodSync, cpSync, rmSync, symlinkSync, readlinkSync, appendFileSync } from "node:fs";
|
|
2067
2100
|
import { join as join9, dirname as dirname2 } from "node:path";
|
|
2068
2101
|
import { homedir as homedir7, platform as platform2 } from "node:os";
|
|
2069
2102
|
import { execSync } from "node:child_process";
|
|
@@ -2223,14 +2256,14 @@ function persistBinary(apiKey) {
|
|
|
2223
2256
|
}
|
|
2224
2257
|
function findCliBundle() {
|
|
2225
2258
|
const entry = process.argv[1];
|
|
2226
|
-
if (entry &&
|
|
2259
|
+
if (entry && existsSync8(entry))
|
|
2227
2260
|
return entry;
|
|
2228
2261
|
const candidates = [
|
|
2229
2262
|
join9(dirname2(new URL(import.meta.url).pathname), "index.js"),
|
|
2230
2263
|
join9(dirname2(new URL(import.meta.url).pathname), "..", "dist", "index.js")
|
|
2231
2264
|
];
|
|
2232
2265
|
for (const c of candidates) {
|
|
2233
|
-
if (
|
|
2266
|
+
if (existsSync8(c))
|
|
2234
2267
|
return c;
|
|
2235
2268
|
}
|
|
2236
2269
|
return null;
|
|
@@ -2242,7 +2275,7 @@ function findSqlJs() {
|
|
|
2242
2275
|
join9(dirname2(new URL(import.meta.url).pathname), "..", "..", "node_modules", "sql.js")
|
|
2243
2276
|
];
|
|
2244
2277
|
for (const c of candidates) {
|
|
2245
|
-
if (
|
|
2278
|
+
if (existsSync8(c))
|
|
2246
2279
|
return c;
|
|
2247
2280
|
}
|
|
2248
2281
|
return null;
|
|
@@ -2311,7 +2344,7 @@ exec "$NODE" "$CONARE_DIR/bin/conare-ingest.mjs" "$@"
|
|
|
2311
2344
|
chmodSync(wrapper, 493);
|
|
2312
2345
|
const symlinkTarget = "/usr/local/bin/conare";
|
|
2313
2346
|
try {
|
|
2314
|
-
if (
|
|
2347
|
+
if (existsSync8(symlinkTarget)) {
|
|
2315
2348
|
try {
|
|
2316
2349
|
const existing = readlinkSync(symlinkTarget);
|
|
2317
2350
|
if (existing === wrapper)
|
|
@@ -2329,7 +2362,7 @@ exec "$NODE" "$CONARE_DIR/bin/conare-ingest.mjs" "$@"
|
|
|
2329
2362
|
const shellProfile = getShellProfile();
|
|
2330
2363
|
if (shellProfile) {
|
|
2331
2364
|
try {
|
|
2332
|
-
const profileContent =
|
|
2365
|
+
const profileContent = existsSync8(shellProfile) ? readFileSync8(shellProfile, "utf-8") : "";
|
|
2333
2366
|
const exportLine = `export PATH="$HOME/.conare/bin:$PATH"`;
|
|
2334
2367
|
if (!profileContent.includes(".conare/bin")) {
|
|
2335
2368
|
appendFileSync(shellProfile, `
|
|
@@ -2353,13 +2386,13 @@ function getShellProfile() {
|
|
|
2353
2386
|
return join9(home, ".zshrc");
|
|
2354
2387
|
if (shell.includes("bash")) {
|
|
2355
2388
|
const profile = join9(home, ".bash_profile");
|
|
2356
|
-
if (platform2() === "darwin" &&
|
|
2389
|
+
if (platform2() === "darwin" && existsSync8(profile))
|
|
2357
2390
|
return profile;
|
|
2358
2391
|
return join9(home, ".bashrc");
|
|
2359
2392
|
}
|
|
2360
|
-
if (
|
|
2393
|
+
if (existsSync8(join9(home, ".zshrc")))
|
|
2361
2394
|
return join9(home, ".zshrc");
|
|
2362
|
-
if (
|
|
2395
|
+
if (existsSync8(join9(home, ".bashrc")))
|
|
2363
2396
|
return join9(home, ".bashrc");
|
|
2364
2397
|
return null;
|
|
2365
2398
|
}
|
|
@@ -2396,7 +2429,7 @@ function uninstallSync() {
|
|
|
2396
2429
|
try {
|
|
2397
2430
|
execSync(`launchctl bootout gui/${uid()} "${PLIST_PATH}" 2>/dev/null`, { stdio: "ignore" });
|
|
2398
2431
|
} catch {}
|
|
2399
|
-
if (
|
|
2432
|
+
if (existsSync8(PLIST_PATH)) {
|
|
2400
2433
|
unlinkSync(PLIST_PATH);
|
|
2401
2434
|
messages.push("Removed launchd agent");
|
|
2402
2435
|
}
|
|
@@ -2405,9 +2438,9 @@ function uninstallSync() {
|
|
|
2405
2438
|
try {
|
|
2406
2439
|
execSync("systemctl --user disable --now conare-sync.timer 2>/dev/null", { stdio: "ignore" });
|
|
2407
2440
|
} catch {}
|
|
2408
|
-
if (
|
|
2441
|
+
if (existsSync8(SYSTEMD_SERVICE))
|
|
2409
2442
|
unlinkSync(SYSTEMD_SERVICE);
|
|
2410
|
-
if (
|
|
2443
|
+
if (existsSync8(SYSTEMD_TIMER))
|
|
2411
2444
|
unlinkSync(SYSTEMD_TIMER);
|
|
2412
2445
|
try {
|
|
2413
2446
|
execSync("systemctl --user daemon-reload", { stdio: "ignore" });
|
|
@@ -2430,10 +2463,10 @@ function uninstallSync() {
|
|
|
2430
2463
|
join9(CONARE_DIR, "sync.lock")
|
|
2431
2464
|
];
|
|
2432
2465
|
for (const f of filesToRemove) {
|
|
2433
|
-
if (
|
|
2466
|
+
if (existsSync8(f))
|
|
2434
2467
|
unlinkSync(f);
|
|
2435
2468
|
}
|
|
2436
|
-
if (
|
|
2469
|
+
if (existsSync8(BIN_DIR)) {
|
|
2437
2470
|
rmSync(BIN_DIR, { recursive: true, force: true });
|
|
2438
2471
|
messages.push("Removed ~/.conare/bin/");
|
|
2439
2472
|
}
|
|
@@ -2718,7 +2751,7 @@ async function main() {
|
|
|
2718
2751
|
log("");
|
|
2719
2752
|
}
|
|
2720
2753
|
}
|
|
2721
|
-
if (!opts.wasmDir &&
|
|
2754
|
+
if (!opts.wasmDir && existsSync9(join10(process.cwd(), "node_modules", "sql.js"))) {
|
|
2722
2755
|
opts.wasmDir = join10(process.cwd(), "node_modules");
|
|
2723
2756
|
}
|
|
2724
2757
|
if (effectiveConfigOnly) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "conare",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Conare CLI for ingesting AI chat history and configuring memory at conare.ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,7 +13,16 @@
|
|
|
13
13
|
"files": [
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
|
-
"keywords": [
|
|
16
|
+
"keywords": [
|
|
17
|
+
"conare",
|
|
18
|
+
"ai",
|
|
19
|
+
"memory",
|
|
20
|
+
"mcp",
|
|
21
|
+
"claude",
|
|
22
|
+
"cursor",
|
|
23
|
+
"codex",
|
|
24
|
+
"context"
|
|
25
|
+
],
|
|
17
26
|
"homepage": "https://conare.ai",
|
|
18
27
|
"license": "MIT",
|
|
19
28
|
"dependencies": {
|