kodingo-cli 1.3.0 → 1.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.
|
@@ -119,6 +119,8 @@ function mapApiRecord(r) {
|
|
|
119
119
|
record.fingerprint = r.fingerprint;
|
|
120
120
|
if (r.deniedAt)
|
|
121
121
|
record.deniedAt = new Date(r.deniedAt);
|
|
122
|
+
if (r.contentAsOf)
|
|
123
|
+
record.contentAsOf = new Date(r.contentAsOf);
|
|
122
124
|
return record;
|
|
123
125
|
}
|
|
124
126
|
// ── Public API (mirrors memory-persistence.ts) ────────────────────────────────
|
|
@@ -161,6 +163,8 @@ async function saveMemory(input) {
|
|
|
161
163
|
body.correctsId = input.correctsId;
|
|
162
164
|
if (input.correctedById)
|
|
163
165
|
body.correctedById = input.correctedById;
|
|
166
|
+
if (input.contentAsOf)
|
|
167
|
+
body.contentAsOf = input.contentAsOf.toISOString();
|
|
164
168
|
// Attribution
|
|
165
169
|
try {
|
|
166
170
|
const config = (0, persistence_config_1.readConfig)();
|
|
@@ -61,6 +61,11 @@ async function initDb() {
|
|
|
61
61
|
END IF;
|
|
62
62
|
END $$;
|
|
63
63
|
|
|
64
|
+
-- Real, best-known age of the underlying decision/code, separate from
|
|
65
|
+
-- created_at (mirrors kodingo-api's schema.ts). NULL when genuinely
|
|
66
|
+
-- unknown — never defaulted to created_at.
|
|
67
|
+
ALTER TABLE kodingo_memory ADD COLUMN IF NOT EXISTS content_as_of timestamptz NULL;
|
|
68
|
+
|
|
64
69
|
-- Indexes
|
|
65
70
|
CREATE INDEX IF NOT EXISTS kodingo_memory_created_at_idx
|
|
66
71
|
ON kodingo_memory (created_at);
|
|
@@ -128,7 +133,7 @@ async function saveMemory(input) {
|
|
|
128
133
|
WITH inserted AS (
|
|
129
134
|
INSERT INTO kodingo_memory (
|
|
130
135
|
id, type, title, content, tags, repo_path,
|
|
131
|
-
status, confidence, symbol, external_id, evidence_kind,
|
|
136
|
+
status, confidence, symbol, external_id, evidence_kind, content_as_of,
|
|
132
137
|
corrects_id, corrected_by_id
|
|
133
138
|
)
|
|
134
139
|
VALUES (
|
|
@@ -143,12 +148,13 @@ async function saveMemory(input) {
|
|
|
143
148
|
${sqlNullableLiteral(input.symbol)},
|
|
144
149
|
${sqlNullableLiteral(externalId)},
|
|
145
150
|
${sqlLiteral(input.evidenceKind)},
|
|
151
|
+
${sqlNullableTimestampLiteral(input.contentAsOf)},
|
|
146
152
|
${sqlNullableUuidLiteral(input.correctsId)},
|
|
147
153
|
${sqlNullableUuidLiteral(input.correctedById)}
|
|
148
154
|
)
|
|
149
155
|
RETURNING
|
|
150
156
|
id, type, title, content, tags, repo_path,
|
|
151
|
-
status, confidence, symbol, external_id, evidence_kind,
|
|
157
|
+
status, confidence, symbol, external_id, evidence_kind, content_as_of,
|
|
152
158
|
corrects_id, corrected_by_id,
|
|
153
159
|
created_at
|
|
154
160
|
)
|
|
@@ -165,7 +171,7 @@ async function getMemoryById(id) {
|
|
|
165
171
|
SELECT row_to_json(result) FROM (
|
|
166
172
|
SELECT
|
|
167
173
|
id, type, title, content, tags, repo_path,
|
|
168
|
-
status, confidence, symbol, external_id, evidence_kind,
|
|
174
|
+
status, confidence, symbol, external_id, evidence_kind, content_as_of,
|
|
169
175
|
corrects_id, corrected_by_id,
|
|
170
176
|
created_at
|
|
171
177
|
FROM kodingo_memory
|
|
@@ -193,7 +199,7 @@ async function updateMemoryLifecycle(params) {
|
|
|
193
199
|
WHERE id = ${sqlLiteral(params.id)}
|
|
194
200
|
RETURNING
|
|
195
201
|
id, type, title, content, tags, repo_path,
|
|
196
|
-
status, confidence, symbol, external_id, evidence_kind,
|
|
202
|
+
status, confidence, symbol, external_id, evidence_kind, content_as_of,
|
|
197
203
|
corrects_id, corrected_by_id,
|
|
198
204
|
created_at
|
|
199
205
|
)
|
|
@@ -246,7 +252,7 @@ async function getMemoryByExternalId(externalId, repoPath) {
|
|
|
246
252
|
SELECT row_to_json(result) FROM (
|
|
247
253
|
SELECT
|
|
248
254
|
id, type, title, content, tags, repo_path,
|
|
249
|
-
status, confidence, symbol, external_id, evidence_kind,
|
|
255
|
+
status, confidence, symbol, external_id, evidence_kind, content_as_of,
|
|
250
256
|
corrects_id, corrected_by_id,
|
|
251
257
|
created_at
|
|
252
258
|
FROM kodingo_memory
|
|
@@ -271,7 +277,7 @@ async function getProposedOrIgnoredRecordBySymbol(params) {
|
|
|
271
277
|
SELECT row_to_json(result) FROM (
|
|
272
278
|
SELECT
|
|
273
279
|
id, type, title, content, tags, repo_path,
|
|
274
|
-
status, confidence, symbol, external_id, evidence_kind,
|
|
280
|
+
status, confidence, symbol, external_id, evidence_kind, content_as_of,
|
|
275
281
|
corrects_id, corrected_by_id,
|
|
276
282
|
created_at
|
|
277
283
|
FROM kodingo_memory
|
|
@@ -303,7 +309,7 @@ async function updateMemoryConfidence(params) {
|
|
|
303
309
|
WHERE id = ${sqlLiteral(params.id)}
|
|
304
310
|
RETURNING
|
|
305
311
|
id, type, title, content, tags, repo_path,
|
|
306
|
-
status, confidence, symbol, external_id, evidence_kind,
|
|
312
|
+
status, confidence, symbol, external_id, evidence_kind, content_as_of,
|
|
307
313
|
corrects_id, corrected_by_id,
|
|
308
314
|
created_at
|
|
309
315
|
)
|
|
@@ -346,7 +352,7 @@ async function queryMemory(text, limit = 10, repoPath, opts = {}) {
|
|
|
346
352
|
SELECT row_to_json(result) FROM (
|
|
347
353
|
SELECT DISTINCT ON (coalesce(symbol, id::text))
|
|
348
354
|
id, type, title, content, tags, repo_path,
|
|
349
|
-
status, confidence, symbol, external_id, evidence_kind,
|
|
355
|
+
status, confidence, symbol, external_id, evidence_kind, content_as_of,
|
|
350
356
|
corrects_id, corrected_by_id,
|
|
351
357
|
created_at
|
|
352
358
|
FROM kodingo_memory
|
|
@@ -377,7 +383,7 @@ async function queryMemory(text, limit = 10, repoPath, opts = {}) {
|
|
|
377
383
|
SELECT row_to_json(result) FROM (
|
|
378
384
|
SELECT
|
|
379
385
|
id, type, title, content, tags, repo_path,
|
|
380
|
-
status, confidence, symbol, external_id, evidence_kind,
|
|
386
|
+
status, confidence, symbol, external_id, evidence_kind, content_as_of,
|
|
381
387
|
corrects_id, corrected_by_id,
|
|
382
388
|
created_at,
|
|
383
389
|
CASE
|
|
@@ -441,7 +447,7 @@ async function queryMemoryBySymbol(params) {
|
|
|
441
447
|
SELECT row_to_json(result) FROM (
|
|
442
448
|
SELECT
|
|
443
449
|
id, type, title, content, tags, repo_path,
|
|
444
|
-
status, confidence, symbol, external_id, evidence_kind,
|
|
450
|
+
status, confidence, symbol, external_id, evidence_kind, content_as_of,
|
|
445
451
|
corrects_id, corrected_by_id,
|
|
446
452
|
created_at
|
|
447
453
|
FROM kodingo_memory
|
|
@@ -473,6 +479,7 @@ function mapRow(row) {
|
|
|
473
479
|
symbol: row.symbol ?? null,
|
|
474
480
|
externalId: row.external_id ?? null,
|
|
475
481
|
evidenceKind: row.evidence_kind ?? "sourced",
|
|
482
|
+
contentAsOf: row.content_as_of ? new Date(row.content_as_of) : null,
|
|
476
483
|
correctsId: row.corrects_id ?? null,
|
|
477
484
|
correctedById: row.corrected_by_id ?? null,
|
|
478
485
|
createdAt: new Date(row.created_at),
|
|
@@ -538,6 +545,11 @@ function sqlNullableUuidLiteral(value) {
|
|
|
538
545
|
return "NULL";
|
|
539
546
|
return `${sqlLiteral(value)}::uuid`;
|
|
540
547
|
}
|
|
548
|
+
function sqlNullableTimestampLiteral(value) {
|
|
549
|
+
if (!value)
|
|
550
|
+
return "NULL";
|
|
551
|
+
return `${sqlLiteral(value.toISOString())}::timestamptz`;
|
|
552
|
+
}
|
|
541
553
|
function sqlArrayLiteral(values) {
|
|
542
554
|
if (!values || values.length === 0)
|
|
543
555
|
return "NULL";
|
|
@@ -112,6 +112,8 @@ async function extractSymbols(filePath) {
|
|
|
112
112
|
code: n.body.slice(0, 2000), // cap to avoid huge payloads
|
|
113
113
|
file: filePath,
|
|
114
114
|
fingerprint: n.fingerprint,
|
|
115
|
+
startLine: n.startLine,
|
|
116
|
+
endLine: n.endLine,
|
|
115
117
|
}));
|
|
116
118
|
}
|
|
117
119
|
catch {
|
|
@@ -201,6 +203,14 @@ async function inferAndCapture(token, symbol, repo, graph, repoRoot) {
|
|
|
201
203
|
// — Kortex's own conclusion, not traceable to one real external
|
|
202
204
|
// event, same class as kodingo-api's githubScanner.ts.
|
|
203
205
|
evidenceKind: "derived",
|
|
206
|
+
// Real line range + repo-relative file path (Problem B) — lets
|
|
207
|
+
// kodingo-api resolve this symbol's real content age via git blame
|
|
208
|
+
// asynchronously after capture (it has the GitHub App token this
|
|
209
|
+
// CLI doesn't). Without these, content_as_of stays null — never
|
|
210
|
+
// guessed from scan timing.
|
|
211
|
+
startLine: symbol.startLine ?? undefined,
|
|
212
|
+
endLine: symbol.endLine ?? undefined,
|
|
213
|
+
filePath: path_1.default.relative(repoRoot, symbol.file).split(path_1.default.sep).join("/"),
|
|
204
214
|
}),
|
|
205
215
|
});
|
|
206
216
|
return saveRes.ok;
|
|
@@ -77,7 +77,10 @@ class DbEventPort {
|
|
|
77
77
|
}
|
|
78
78
|
// No existing proposed/ignored record — insert new record as usual.
|
|
79
79
|
// Git-signal-derived captures are genuinely sourced — externalId here is
|
|
80
|
-
// a real git:<commitHash> reference (see the caller).
|
|
80
|
+
// a real git:<commitHash> reference (see the caller). contentAsOf is the
|
|
81
|
+
// real commit's own author date (decision.proposedAt) — trivially in
|
|
82
|
+
// hand here, unlike bulk/autonomous scans which have no equivalent
|
|
83
|
+
// single real event to anchor to (see contentAge.ts, kodingo-api).
|
|
81
84
|
const input = {
|
|
82
85
|
type: "decision",
|
|
83
86
|
content,
|
|
@@ -86,6 +89,7 @@ class DbEventPort {
|
|
|
86
89
|
confidence: 0.3,
|
|
87
90
|
evidenceKind: "sourced",
|
|
88
91
|
externalId,
|
|
92
|
+
contentAsOf: decision.proposedAt,
|
|
89
93
|
};
|
|
90
94
|
if (title)
|
|
91
95
|
input.title = title;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kodingo-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Kodingo CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@typescript-eslint/typescript-estree": "^8.61.1",
|
|
27
27
|
"commander": "^12.1.0",
|
|
28
28
|
"kodingo-agent": "^0.2.0",
|
|
29
|
-
"kodingo-core": "^0.3.
|
|
29
|
+
"kodingo-core": "^0.3.1",
|
|
30
30
|
"open": "^11.0.0",
|
|
31
31
|
"simple-git": "^3.30.0",
|
|
32
32
|
"tree-sitter-wasms": "^0.1.13",
|