kodingo-cli 1.0.1 → 1.0.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.js +1 -1
- package/dist/commands/scan-git.js +17 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -15,7 +15,7 @@ const scan_git_1 = require("./commands/scan-git");
|
|
|
15
15
|
const init_1 = require("./commands/init");
|
|
16
16
|
const install_hook_1 = require("./commands/install-hook");
|
|
17
17
|
const program = new commander_1.Command();
|
|
18
|
-
program.name("kodingo").description("Kodingo CLI");
|
|
18
|
+
program.name("kodingo").description("Kodingo CLI").version("1.0.1");
|
|
19
19
|
// ── init ──────────────────────────────────────────────────────────────────────
|
|
20
20
|
(0, init_1.registerInitCommand)(program);
|
|
21
21
|
// ── capture ───────────────────────────────────────────────────────────────────
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.scanGitCommand = scanGitCommand;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const os_1 = __importDefault(require("os"));
|
|
9
10
|
const simple_git_1 = __importDefault(require("simple-git"));
|
|
10
11
|
const git_listener_1 = require("../adapters/git-adapter/git-listener");
|
|
11
12
|
const db_event_port_1 = require("../ports/db-event-port");
|
|
@@ -24,19 +25,33 @@ async function scanGitCommand(options) {
|
|
|
24
25
|
}
|
|
25
26
|
const commitHash = String(latestCommit.hash);
|
|
26
27
|
const externalId = `git:${commitHash}`;
|
|
27
|
-
// Idempotency check via the active persistence adapter (local or cloud)
|
|
28
28
|
const existing = await getMemoryByExternalId(externalId, repoRoot);
|
|
29
29
|
if (existing) {
|
|
30
30
|
console.log(`Git scan skipped (already stored) for repo: ${repoRoot} commit: ${commitHash.slice(0, 8)}`);
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
// Use the appropriate event port based on configured persistence mode
|
|
34
33
|
const eventPort = (0, persistence_config_1.isCloudMode)()
|
|
35
34
|
? new cloud_event_port_1.CloudEventPort(repoRoot)
|
|
36
35
|
: new db_event_port_1.DbEventPort(repoRoot);
|
|
37
36
|
const adapter = new git_listener_1.GitListenerAdapter(repoRoot, eventPort, 5000);
|
|
38
37
|
await adapter.runOnceLatest();
|
|
39
38
|
console.log(`Git scan complete (latest commit) for repo: ${repoRoot} commit: ${commitHash.slice(0, 8)}`);
|
|
39
|
+
// Write flag file so VS Code extension knows to surface proposed memories
|
|
40
|
+
writePendingReviewFlag(repoRoot, commitHash);
|
|
41
|
+
}
|
|
42
|
+
function writePendingReviewFlag(repoRoot, commitHash) {
|
|
43
|
+
try {
|
|
44
|
+
const flagPath = path_1.default.join(os_1.default.homedir(), ".kodingo", "pending-review.json");
|
|
45
|
+
const payload = {
|
|
46
|
+
repo: repoRoot,
|
|
47
|
+
commit: commitHash.slice(0, 8),
|
|
48
|
+
timestamp: new Date().toISOString(),
|
|
49
|
+
};
|
|
50
|
+
fs_1.default.writeFileSync(flagPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// silently ignore — flag file is best-effort, never block the commit
|
|
54
|
+
}
|
|
40
55
|
}
|
|
41
56
|
function resolveRepoRoot(options) {
|
|
42
57
|
if (options.repo && options.repo.trim()) {
|