@saleem11kh/repomem 0.3.1 → 0.5.0
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/README.md +655 -212
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +230 -14
- package/dist/cli.js.map +1 -1
- package/dist/config/config.d.ts +20 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +1 -0
- package/dist/config/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/store/adr.d.ts +22 -0
- package/dist/store/adr.d.ts.map +1 -0
- package/dist/store/adr.js +201 -0
- package/dist/store/adr.js.map +1 -0
- package/dist/store/capture.d.ts +39 -0
- package/dist/store/capture.d.ts.map +1 -0
- package/dist/store/capture.js +148 -0
- package/dist/store/capture.js.map +1 -0
- package/dist/store/embeddings.d.ts +34 -0
- package/dist/store/embeddings.d.ts.map +1 -0
- package/dist/store/embeddings.js +250 -0
- package/dist/store/embeddings.js.map +1 -0
- package/dist/store/file-store.d.ts +26 -1
- package/dist/store/file-store.d.ts.map +1 -1
- package/dist/store/file-store.js +105 -16
- package/dist/store/file-store.js.map +1 -1
- package/dist/store/git.d.ts +46 -0
- package/dist/store/git.d.ts.map +1 -0
- package/dist/store/git.js +131 -0
- package/dist/store/git.js.map +1 -0
- package/dist/store/profile.d.ts +18 -0
- package/dist/store/profile.d.ts.map +1 -0
- package/dist/store/profile.js +345 -0
- package/dist/store/profile.js.map +1 -0
- package/dist/tools/mem-context.d.ts.map +1 -1
- package/dist/tools/mem-context.js +249 -33
- package/dist/tools/mem-context.js.map +1 -1
- package/dist/tools/mem-handoff.d.ts.map +1 -1
- package/dist/tools/mem-handoff.js +53 -5
- package/dist/tools/mem-handoff.js.map +1 -1
- package/dist/tools/mem-save.d.ts +5 -0
- package/dist/tools/mem-save.d.ts.map +1 -1
- package/dist/tools/mem-save.js +60 -2
- package/dist/tools/mem-save.js.map +1 -1
- package/dist/tools/mem-search.d.ts.map +1 -1
- package/dist/tools/mem-search.js +26 -14
- package/dist/tools/mem-search.js.map +1 -1
- package/dist/tools/session.d.ts +40 -0
- package/dist/tools/session.d.ts.map +1 -0
- package/dist/tools/session.js +159 -0
- package/dist/tools/session.js.map +1 -0
- package/dist/tools/util.d.ts +8 -1
- package/dist/tools/util.d.ts.map +1 -1
- package/dist/tools/util.js +7 -0
- package/dist/tools/util.js.map +1 -1
- package/package.json +1 -1
package/dist/tools/mem-search.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.memSearch = void 0;
|
|
4
4
|
const file_store_js_1 = require("../store/file-store.js");
|
|
5
|
+
const config_js_1 = require("../config/config.js");
|
|
6
|
+
const embeddings_js_1 = require("../store/embeddings.js");
|
|
5
7
|
const util_js_1 = require("./util.js");
|
|
6
8
|
exports.memSearch = {
|
|
7
9
|
name: "mem_search",
|
|
@@ -29,22 +31,32 @@ exports.memSearch = {
|
|
|
29
31
|
if (!query)
|
|
30
32
|
return "✖ A search query is required.";
|
|
31
33
|
const includeLinked = args.linked === true;
|
|
32
|
-
const
|
|
34
|
+
const lexical = includeLinked
|
|
33
35
|
? (0, file_store_js_1.searchAllRepos)(query, projectRoot)
|
|
34
36
|
: (0, file_store_js_1.searchFiles)(query, projectRoot);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
lines.push("");
|
|
45
|
-
}
|
|
46
|
-
lines.push('_Expand any entry with mem_get("type/filename")._');
|
|
47
|
-
return lines.join("\n").trimEnd();
|
|
37
|
+
const semantic = (0, config_js_1.loadConfig)(projectRoot).semantic;
|
|
38
|
+
if (!semantic)
|
|
39
|
+
return render(lexical, query);
|
|
40
|
+
// Only this branch is async, so search stays synchronous for everyone who
|
|
41
|
+
// has not turned semantic search on.
|
|
42
|
+
const blend = Math.min(1, Math.max(0, semantic.blend ?? 0.5));
|
|
43
|
+
return (0, embeddings_js_1.semanticScores)(query, projectRoot, semantic)
|
|
44
|
+
.then((scores) => render((0, file_store_js_1.blendSemantic)(lexical, scores, projectRoot, blend), query))
|
|
45
|
+
.catch(() => render(lexical, query));
|
|
48
46
|
},
|
|
49
47
|
};
|
|
48
|
+
function render(results, query) {
|
|
49
|
+
if (results.length === 0)
|
|
50
|
+
return `No memory found for "${query}".`;
|
|
51
|
+
const lines = [`Found ${results.length} match(es) for "${query}":`, ""];
|
|
52
|
+
for (const r of results) {
|
|
53
|
+
lines.push(`${r.scope} ${r.title} · ${r.file}`);
|
|
54
|
+
lines.push(` ${r.excerpt}`);
|
|
55
|
+
if (r.related.length)
|
|
56
|
+
lines.push(` → related: ${r.related.join(", ")}`);
|
|
57
|
+
lines.push("");
|
|
58
|
+
}
|
|
59
|
+
lines.push('_Expand any entry with mem_get("type/filename")._');
|
|
60
|
+
return lines.join("\n").trimEnd();
|
|
61
|
+
}
|
|
50
62
|
//# sourceMappingURL=mem-search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mem-search.js","sourceRoot":"","sources":["../../src/tools/mem-search.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"mem-search.js","sourceRoot":"","sources":["../../src/tools/mem-search.ts"],"names":[],"mappings":";;;AAAA,0DAKgC;AAChC,mDAAiD;AACjD,0DAAwD;AACxD,uCAAyC;AAE5B,QAAA,SAAS,GAAY;IAChC,IAAI,EAAE,YAAY;IAClB,WAAW,EACT,0EAA0E;QAC1E,2EAA2E;QAC3E,+EAA+E;QAC/E,6EAA6E;QAC7E,sDAAsD;IACxD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE;YACvD,MAAM,EAAE;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AC;CACF,CAAC;AAEF,SAAS,MAAM,CAAC,OAA6F,EAAE,KAAa;IAC1H,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,wBAAwB,KAAK,IAAI,CAAC;IAEnE,MAAM,KAAK,GAAG,CAAC,SAAS,OAAO,CAAC,MAAM,mBAAmB,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;IACxE,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAClD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM;YAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1E,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;IAChE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const DEFAULT_SESSION_NAME = "untitled";
|
|
2
|
+
export declare const UNKNOWN_AGENT = "unknown";
|
|
3
|
+
export interface SessionState {
|
|
4
|
+
/** YYYY-MM-DD the session started. */
|
|
5
|
+
date: string;
|
|
6
|
+
/** HHMM the session started. */
|
|
7
|
+
time: string;
|
|
8
|
+
/** Human name for the session; slugified into the filename. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** MCP client that opened the session, e.g. "claude-code". */
|
|
11
|
+
agent: string;
|
|
12
|
+
/** "YYYY-MM-DD HH:MM" for the front matter. */
|
|
13
|
+
startedAt: string;
|
|
14
|
+
/** Filename once reserved on disk — fixed for the rest of the session. */
|
|
15
|
+
filename: string | null;
|
|
16
|
+
}
|
|
17
|
+
/** The current session, started lazily on first use. */
|
|
18
|
+
export declare function sessionState(): SessionState;
|
|
19
|
+
/** Record which agent connected — taken from the MCP `initialize` clientInfo. */
|
|
20
|
+
export declare function setSessionAgent(agent: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* The file this session writes to, chosen once and then fixed. Call before any
|
|
23
|
+
* session write.
|
|
24
|
+
*/
|
|
25
|
+
export declare function reserveSessionFile(projectRoot: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Adopt a name for the running session. If the file was already created under
|
|
28
|
+
* the old name it is renamed, so one session always maps to exactly one file.
|
|
29
|
+
* Returns the current filename.
|
|
30
|
+
*/
|
|
31
|
+
export declare function nameSession(name: string, projectRoot: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* The YAML front matter for a session file. Written once, when the file is
|
|
34
|
+
* created — sessions previously had none, which is why they were the only type
|
|
35
|
+
* mem_context could not summarise.
|
|
36
|
+
*/
|
|
37
|
+
export declare function sessionFrontMatter(summary: string, s?: SessionState): string;
|
|
38
|
+
/** Reset session identity. Tests only — each test needs a clean session. */
|
|
39
|
+
export declare function resetSession(): void;
|
|
40
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/tools/session.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAC/C,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,MAAM,WAAW,YAAY;IAC3B,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAID,wDAAwD;AACxD,wBAAgB,YAAY,IAAI,YAAY,CAY3C;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAGnD;AAsBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAI9D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAmBrE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,GAAE,YAA6B,GAAG,MAAM,CAM5F;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,IAAI,IAAI,CAEnC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.UNKNOWN_AGENT = exports.DEFAULT_SESSION_NAME = void 0;
|
|
37
|
+
exports.sessionState = sessionState;
|
|
38
|
+
exports.setSessionAgent = setSessionAgent;
|
|
39
|
+
exports.reserveSessionFile = reserveSessionFile;
|
|
40
|
+
exports.nameSession = nameSession;
|
|
41
|
+
exports.sessionFrontMatter = sessionFrontMatter;
|
|
42
|
+
exports.resetSession = resetSession;
|
|
43
|
+
/**
|
|
44
|
+
* Per-session identity for the sessions/ memory type.
|
|
45
|
+
*
|
|
46
|
+
* A session used to be identified by its date alone, so everything written on
|
|
47
|
+
* one day landed in one appended file. Two agents — or two teammates — working
|
|
48
|
+
* the same day interleaved into a single unreadable narrative and conflicted on
|
|
49
|
+
* every merge. Each session now owns one file:
|
|
50
|
+
*
|
|
51
|
+
* sessions/YYYY-MM-DD-HHMM-<name>.md
|
|
52
|
+
*
|
|
53
|
+
* The timestamp is the session's *start*, so it stays put across appends, and
|
|
54
|
+
* being zero-padded it makes filename order chronological order.
|
|
55
|
+
*
|
|
56
|
+
* The MCP server is stdio-spawned per client session, so module state here lives
|
|
57
|
+
* exactly as long as the session it describes.
|
|
58
|
+
*/
|
|
59
|
+
const fs = __importStar(require("fs"));
|
|
60
|
+
const path = __importStar(require("path"));
|
|
61
|
+
const file_store_js_1 = require("../store/file-store.js");
|
|
62
|
+
const util_js_1 = require("./util.js");
|
|
63
|
+
exports.DEFAULT_SESSION_NAME = "untitled";
|
|
64
|
+
exports.UNKNOWN_AGENT = "unknown";
|
|
65
|
+
let state = null;
|
|
66
|
+
/** The current session, started lazily on first use. */
|
|
67
|
+
function sessionState() {
|
|
68
|
+
if (!state) {
|
|
69
|
+
state = {
|
|
70
|
+
date: (0, util_js_1.today)(),
|
|
71
|
+
time: (0, util_js_1.clock)(),
|
|
72
|
+
name: exports.DEFAULT_SESSION_NAME,
|
|
73
|
+
agent: exports.UNKNOWN_AGENT,
|
|
74
|
+
startedAt: (0, util_js_1.timestamp)(),
|
|
75
|
+
filename: null,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return state;
|
|
79
|
+
}
|
|
80
|
+
/** Record which agent connected — taken from the MCP `initialize` clientInfo. */
|
|
81
|
+
function setSessionAgent(agent) {
|
|
82
|
+
const trimmed = agent.trim();
|
|
83
|
+
if (trimmed)
|
|
84
|
+
sessionState().agent = trimmed;
|
|
85
|
+
}
|
|
86
|
+
function sessionsDir(projectRoot) {
|
|
87
|
+
return path.join((0, file_store_js_1.getRepomemRoot)(projectRoot), "sessions");
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Candidate filename for a name, stepping past any file another session already
|
|
91
|
+
* owns. Two sessions starting in the same minute would otherwise land on the
|
|
92
|
+
* same path and silently braid together — the exact failure this design removes.
|
|
93
|
+
*/
|
|
94
|
+
function freeFilename(name, projectRoot, ignore) {
|
|
95
|
+
const s = sessionState();
|
|
96
|
+
const base = `${s.date}-${s.time}-${(0, util_js_1.slugify)(name)}`;
|
|
97
|
+
const dir = sessionsDir(projectRoot);
|
|
98
|
+
for (let n = 1;; n++) {
|
|
99
|
+
const candidate = n === 1 ? `${base}.md` : `${base}-${n}.md`;
|
|
100
|
+
if (candidate === ignore)
|
|
101
|
+
return candidate;
|
|
102
|
+
if (!fs.existsSync(path.join(dir, candidate)))
|
|
103
|
+
return candidate;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The file this session writes to, chosen once and then fixed. Call before any
|
|
108
|
+
* session write.
|
|
109
|
+
*/
|
|
110
|
+
function reserveSessionFile(projectRoot) {
|
|
111
|
+
const s = sessionState();
|
|
112
|
+
if (!s.filename)
|
|
113
|
+
s.filename = freeFilename(s.name, projectRoot, null);
|
|
114
|
+
return s.filename;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Adopt a name for the running session. If the file was already created under
|
|
118
|
+
* the old name it is renamed, so one session always maps to exactly one file.
|
|
119
|
+
* Returns the current filename.
|
|
120
|
+
*/
|
|
121
|
+
function nameSession(name, projectRoot) {
|
|
122
|
+
const s = sessionState();
|
|
123
|
+
const wanted = name.trim();
|
|
124
|
+
if (!wanted || (0, util_js_1.slugify)(wanted) === (0, util_js_1.slugify)(s.name))
|
|
125
|
+
return reserveSessionFile(projectRoot);
|
|
126
|
+
const previous = s.filename;
|
|
127
|
+
s.name = wanted;
|
|
128
|
+
const next = freeFilename(wanted, projectRoot, previous);
|
|
129
|
+
if (previous && previous !== next) {
|
|
130
|
+
const dir = sessionsDir(projectRoot);
|
|
131
|
+
try {
|
|
132
|
+
fs.renameSync(path.join(dir, previous), path.join(dir, next));
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
/* a locked or vanished file is not worth failing a save over */
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
s.filename = next;
|
|
139
|
+
return next;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The YAML front matter for a session file. Written once, when the file is
|
|
143
|
+
* created — sessions previously had none, which is why they were the only type
|
|
144
|
+
* mem_context could not summarise.
|
|
145
|
+
*/
|
|
146
|
+
function sessionFrontMatter(summary, s = sessionState()) {
|
|
147
|
+
const lines = ["---", `date: ${s.date}`, `started: ${s.startedAt}`, `session: ${s.name}`];
|
|
148
|
+
if (s.agent !== exports.UNKNOWN_AGENT)
|
|
149
|
+
lines.push(`agent: ${s.agent}`);
|
|
150
|
+
if (summary)
|
|
151
|
+
lines.push(`summary: ${summary.replace(/\n+/g, " ").trim()}`);
|
|
152
|
+
lines.push("---", "");
|
|
153
|
+
return lines.join("\n");
|
|
154
|
+
}
|
|
155
|
+
/** Reset session identity. Tests only — each test needs a clean session. */
|
|
156
|
+
function resetSession() {
|
|
157
|
+
state = null;
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/tools/session.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,oCAYC;AAGD,0CAGC;AA0BD,gDAIC;AAOD,kCAmBC;AAOD,gDAMC;AAGD,oCAEC;AAvID;;;;;;;;;;;;;;;GAeG;AACH,uCAAyB;AACzB,2CAA6B;AAE7B,0DAAwD;AACxD,uCAA6D;AAEhD,QAAA,oBAAoB,GAAG,UAAU,CAAC;AAClC,QAAA,aAAa,GAAG,SAAS,CAAC;AAiBvC,IAAI,KAAK,GAAwB,IAAI,CAAC;AAEtC,wDAAwD;AACxD,SAAgB,YAAY;IAC1B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,KAAK,GAAG;YACN,IAAI,EAAE,IAAA,eAAK,GAAE;YACb,IAAI,EAAE,IAAA,eAAK,GAAE;YACb,IAAI,EAAE,4BAAoB;YAC1B,KAAK,EAAE,qBAAa;YACpB,SAAS,EAAE,IAAA,mBAAS,GAAE;YACtB,QAAQ,EAAE,IAAI;SACf,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,iFAAiF;AACjF,SAAgB,eAAe,CAAC,KAAa;IAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO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AO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC3E,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,4EAA4E;AAC5E,SAAgB,YAAY;IAC1B,KAAK,GAAG,IAAI,CAAC;AACf,CAAC"}
|
package/dist/tools/util.d.ts
CHANGED
|
@@ -3,12 +3,19 @@ export interface ToolDef {
|
|
|
3
3
|
name: string;
|
|
4
4
|
description: string;
|
|
5
5
|
inputSchema: Record<string, unknown>;
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Returns the tool's text, or a promise of it. Only mem_search ever goes async,
|
|
8
|
+
* and only when semantic search is switched on — every other tool, and search
|
|
9
|
+
* itself in the default configuration, stays synchronous.
|
|
10
|
+
*/
|
|
11
|
+
handler: (args: Record<string, unknown>, projectRoot: string) => string | Promise<string>;
|
|
7
12
|
}
|
|
8
13
|
/** YYYY-MM-DD in local time. */
|
|
9
14
|
export declare function today(): string;
|
|
10
15
|
/** ISO-ish local timestamp for in-file headings. */
|
|
11
16
|
export declare function timestamp(): string;
|
|
17
|
+
/** HHMM in local time — zero-padded so filenames sort chronologically. */
|
|
18
|
+
export declare function clock(): string;
|
|
12
19
|
/** Turn a title into a filesystem-safe kebab slug. */
|
|
13
20
|
export declare function slugify(title: string): string;
|
|
14
21
|
/** Coerce an unknown arg into a trimmed string (empty when absent). */
|
package/dist/tools/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/tools/util.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAE5C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/tools/util.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAE5C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC;;;;OAIG;IACH,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,WAAW,EAAE,MAAM,KAChB,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,gCAAgC;AAChC,wBAAgB,KAAK,IAAI,MAAM,CAI9B;AAED,oDAAoD;AACpD,wBAAgB,SAAS,IAAI,MAAM,CAIlC;AAED,0EAA0E;AAC1E,wBAAgB,KAAK,IAAI,MAAM,CAI9B;AAED,sDAAsD;AACtD,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM7C;AAED,uEAAuE;AACvE,wBAAgB,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAEtC;AAED,iDAAiD;AACjD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAM7C"}
|
package/dist/tools/util.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.today = today;
|
|
5
5
|
exports.timestamp = timestamp;
|
|
6
|
+
exports.clock = clock;
|
|
6
7
|
exports.slugify = slugify;
|
|
7
8
|
exports.str = str;
|
|
8
9
|
exports.strArray = strArray;
|
|
@@ -18,6 +19,12 @@ function timestamp() {
|
|
|
18
19
|
const pad = (n) => String(n).padStart(2, "0");
|
|
19
20
|
return `${today()} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
20
21
|
}
|
|
22
|
+
/** HHMM in local time — zero-padded so filenames sort chronologically. */
|
|
23
|
+
function clock() {
|
|
24
|
+
const d = new Date();
|
|
25
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
26
|
+
return `${pad(d.getHours())}${pad(d.getMinutes())}`;
|
|
27
|
+
}
|
|
21
28
|
/** Turn a title into a filesystem-safe kebab slug. */
|
|
22
29
|
function slugify(title) {
|
|
23
30
|
return title
|
package/dist/tools/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/tools/util.ts"],"names":[],"mappings":";AAAA,4CAA4C;;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/tools/util.ts"],"names":[],"mappings":";AAAA,4CAA4C;;AAkB5C,sBAIC;AAGD,8BAIC;AAGD,sBAIC;AAGD,0BAMC;AAGD,kBAEC;AAGD,4BAMC;AA1CD,gCAAgC;AAChC,SAAgB,KAAK;IACnB,MAAM,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;IACrB,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACtD,OAAO,GAAG,CAAC,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED,oDAAoD;AACpD,SAAgB,SAAS;IACvB,MAAM,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;IACrB,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACtD,OAAO,GAAG,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CA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EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saleem11kh/repomem",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Git-native memory for AI coding agents. .repomem/ commits with your code, clones with your team, works with Claude Code, Cursor, Gemini CLI and more.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|