@vreko/cli 3.1.0 → 3.1.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/{InitApp-FB2RDCNO.js → InitApp-QW4UK2DB.js} +3 -3
- package/dist/{InitApp-FB2RDCNO.js.map → InitApp-QW4UK2DB.js.map} +1 -1
- package/dist/{chunk-LU5BYFBR.js → chunk-AYVUSU6J.js} +3 -3
- package/dist/{chunk-LU5BYFBR.js.map → chunk-AYVUSU6J.js.map} +1 -1
- package/dist/{chunk-OW6DEZEQ.js → chunk-FEYKLUNK.js} +4 -4
- package/dist/{chunk-OW6DEZEQ.js.map → chunk-FEYKLUNK.js.map} +1 -1
- package/dist/{chunk-YESW4MP7.js → chunk-UMJEOIQX.js} +4 -4
- package/dist/{chunk-YESW4MP7.js.map → chunk-UMJEOIQX.js.map} +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/init-command-5VBNMIMD.js +7 -0
- package/dist/{init-command-7MV3TXKO.js.map → init-command-5VBNMIMD.js.map} +1 -1
- package/dist/{init-core-LUZ4YEPI.js → init-core-HDHFYD5I.js} +4 -4
- package/dist/{init-core-LUZ4YEPI.js.map → init-core-HDHFYD5I.js.map} +1 -1
- package/node_modules/@vreko/local-service/package.json +1 -0
- package/node_modules/@vreko/local-service/scripts/install-seed-db.mjs +46 -0
- package/node_modules/@vreko/local-service/scripts/seed-db.mjs +151 -0
- package/package.json +4 -4
- package/dist/init-command-7MV3TXKO.js +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export { createInitCommand } from './chunk-FEYKLUNK.js';
|
|
3
|
+
import './chunk-EWOJGXRX.js';
|
|
4
|
+
|
|
5
|
+
process.env.VREKO_CLI='true';process.env.NODE_NO_WARNINGS='1';
|
|
6
|
+
//# sourceMappingURL=init-command-5VBNMIMD.js.map
|
|
7
|
+
//# sourceMappingURL=init-command-5VBNMIMD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"init-command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"init-command-5VBNMIMD.js"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { createInitCommand } from './chunk-
|
|
2
|
+
export { createInitCommand } from './chunk-UMJEOIQX.js';
|
|
3
3
|
import './chunk-GRMRYWYS.js';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-AYVUSU6J.js';
|
|
5
5
|
import './chunk-GSUGROXB.js';
|
|
6
6
|
import './chunk-VTSNRV3V.js';
|
|
7
7
|
import './chunk-MJVY2XUN.js';
|
|
8
8
|
import './chunk-EWOJGXRX.js';
|
|
9
9
|
|
|
10
10
|
process.env.VREKO_CLI='true';process.env.NODE_NO_WARNINGS='1';
|
|
11
|
-
//# sourceMappingURL=init-core-
|
|
12
|
-
//# sourceMappingURL=init-core-
|
|
11
|
+
//# sourceMappingURL=init-core-HDHFYD5I.js.map
|
|
12
|
+
//# sourceMappingURL=init-core-HDHFYD5I.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"init-core-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"init-core-HDHFYD5I.js"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Postinstall: Install bundled seed knowledge DB to global location.
|
|
4
|
+
*
|
|
5
|
+
* Copies apps/local-service/assets/seed-knowledge.db → ~/.snapback/knowledge.db
|
|
6
|
+
* only when no global DB exists yet. Never overwrites an existing global DB
|
|
7
|
+
* (which may contain workspace-learned intelligence).
|
|
8
|
+
*
|
|
9
|
+
* Silently exits if the asset DB has not been built yet (e.g., first `pnpm install`
|
|
10
|
+
* before `pnpm build` has run the seed-db task).
|
|
11
|
+
*
|
|
12
|
+
* Flags:
|
|
13
|
+
* --force Overwrite the existing global DB (useful for re-seeding after a
|
|
14
|
+
* major knowledge-base update). WARNING: any local learn_* entries
|
|
15
|
+
* not yet committed to the workspace DB will be lost.
|
|
16
|
+
*
|
|
17
|
+
* Invoked automatically via package.json "postinstall" lifecycle hook.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
|
|
21
|
+
import { homedir } from "node:os";
|
|
22
|
+
import { dirname, resolve } from "node:path";
|
|
23
|
+
import { fileURLToPath } from "node:url";
|
|
24
|
+
|
|
25
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const ASSET_DB = resolve(__dirname, "..", "assets", "seed-knowledge.db");
|
|
27
|
+
const GLOBAL_DIR = resolve(homedir(), ".vreko");
|
|
28
|
+
const GLOBAL_DB = resolve(GLOBAL_DIR, "knowledge.db");
|
|
29
|
+
const FORCE = process.argv.includes("--force");
|
|
30
|
+
|
|
31
|
+
// Asset not built yet - happens on first install before build. Skip silently.
|
|
32
|
+
if (!existsSync(ASSET_DB)) {
|
|
33
|
+
process.exit(0);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Global DB already exists - skip unless --force was passed.
|
|
37
|
+
if (existsSync(GLOBAL_DB) && !FORCE) {
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (FORCE && existsSync(GLOBAL_DB)) {
|
|
42
|
+
// intentionally empty
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
mkdirSync(GLOBAL_DIR, { recursive: true });
|
|
46
|
+
copyFileSync(ASSET_DB, GLOBAL_DB);
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build script: apps/local-service/assets/seed-knowledge.db
|
|
5
|
+
*
|
|
6
|
+
* Creates a fresh SQLite DB with the knowledge schema, then runs all
|
|
7
|
+
* seed-knowledge-base batch scripts against it. The resulting DB ships
|
|
8
|
+
* with the local-service package and is copied to ~/.snapback/knowledge.db
|
|
9
|
+
* on first install (see install-seed-db.mjs).
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* node scripts/seed-db.mjs
|
|
13
|
+
* SNAPBACK_DB_PATH=/custom/path.db node scripts/seed-db.mjs
|
|
14
|
+
*
|
|
15
|
+
* Turbo task: "seed-db" in turbo.json
|
|
16
|
+
* Output: apps/local-service/assets/seed-knowledge.db
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { spawnSync } from "node:child_process";
|
|
20
|
+
import { existsSync, mkdirSync, rmSync } from "node:fs";
|
|
21
|
+
import { dirname, resolve } from "node:path";
|
|
22
|
+
import { DatabaseSync } from "node:sqlite";
|
|
23
|
+
import { fileURLToPath } from "node:url";
|
|
24
|
+
|
|
25
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const REPO_ROOT = resolve(__dirname, "..", "..", "..");
|
|
27
|
+
const SCRIPTS_DIR = resolve(REPO_ROOT, "scripts");
|
|
28
|
+
const ASSETS_DIR = resolve(__dirname, "..", "assets");
|
|
29
|
+
const SEED_DB = resolve(ASSETS_DIR, "seed-knowledge.db");
|
|
30
|
+
|
|
31
|
+
// =============================================================================
|
|
32
|
+
// Schema - base tables + v2 provenance columns in a single CREATE TABLE
|
|
33
|
+
// (avoids migration dance; this is a fresh build each time)
|
|
34
|
+
// =============================================================================
|
|
35
|
+
|
|
36
|
+
const SCHEMA = `
|
|
37
|
+
CREATE TABLE IF NOT EXISTS chunks (
|
|
38
|
+
id TEXT PRIMARY KEY,
|
|
39
|
+
source_type TEXT NOT NULL CHECK (source_type IN ('learning', 'adr', 'pattern', 'violation')),
|
|
40
|
+
source_id TEXT NOT NULL,
|
|
41
|
+
chunk_text TEXT NOT NULL,
|
|
42
|
+
context_text TEXT,
|
|
43
|
+
authority REAL DEFAULT 1.0 CHECK (authority >= 0 AND authority <= 1),
|
|
44
|
+
status TEXT DEFAULT 'active' CHECK (status IN ('active', 'deprecated', 'superseded')),
|
|
45
|
+
created_at TEXT DEFAULT (datetime('now')),
|
|
46
|
+
updated_at TEXT DEFAULT (datetime('now')),
|
|
47
|
+
metadata TEXT,
|
|
48
|
+
file_path TEXT,
|
|
49
|
+
session_id TEXT,
|
|
50
|
+
ai_tool TEXT CHECK (ai_tool IN ('cursor', 'copilot', 'claude', 'windsurf', 'unknown', NULL)),
|
|
51
|
+
signal_ids TEXT,
|
|
52
|
+
confidence REAL DEFAULT 0.5 CHECK (confidence >= 0 AND confidence <= 1),
|
|
53
|
+
enforcement_level TEXT DEFAULT 'exploratory'
|
|
54
|
+
CHECK (enforcement_level IN ('exploratory', 'established', 'high', 'enforced')),
|
|
55
|
+
is_global_seed INTEGER NOT NULL DEFAULT 0
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS chunks_fts USING fts5(
|
|
59
|
+
chunk_text, context_text,
|
|
60
|
+
content='chunks', content_rowid='rowid'
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
CREATE TRIGGER IF NOT EXISTS chunks_ai AFTER INSERT ON chunks BEGIN
|
|
64
|
+
INSERT INTO chunks_fts(rowid, chunk_text, context_text)
|
|
65
|
+
VALUES (new.rowid, new.chunk_text, new.context_text);
|
|
66
|
+
END;
|
|
67
|
+
|
|
68
|
+
CREATE TRIGGER IF NOT EXISTS chunks_ad AFTER DELETE ON chunks BEGIN
|
|
69
|
+
INSERT INTO chunks_fts(chunks_fts, rowid, chunk_text, context_text)
|
|
70
|
+
VALUES('delete', old.rowid, old.chunk_text, old.context_text);
|
|
71
|
+
END;
|
|
72
|
+
|
|
73
|
+
CREATE TRIGGER IF NOT EXISTS chunks_au AFTER UPDATE ON chunks BEGIN
|
|
74
|
+
INSERT INTO chunks_fts(chunks_fts, rowid, chunk_text, context_text)
|
|
75
|
+
VALUES('delete', old.rowid, old.chunk_text, old.context_text);
|
|
76
|
+
INSERT INTO chunks_fts(rowid, chunk_text, context_text)
|
|
77
|
+
VALUES (new.rowid, new.chunk_text, new.context_text);
|
|
78
|
+
END;
|
|
79
|
+
|
|
80
|
+
CREATE TABLE IF NOT EXISTS knowledge_edges (
|
|
81
|
+
id TEXT PRIMARY KEY,
|
|
82
|
+
source_id TEXT NOT NULL REFERENCES chunks(id),
|
|
83
|
+
target_id TEXT NOT NULL REFERENCES chunks(id),
|
|
84
|
+
edge_type TEXT NOT NULL CHECK (edge_type IN ('supersedes', 'prevents', 'requires', 'related')),
|
|
85
|
+
confidence REAL DEFAULT 1.0,
|
|
86
|
+
metadata TEXT,
|
|
87
|
+
created_at TEXT DEFAULT (datetime('now'))
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
CREATE INDEX IF NOT EXISTS idx_chunks_source ON chunks(source_type, source_id);
|
|
91
|
+
CREATE INDEX IF NOT EXISTS idx_chunks_status ON chunks(status);
|
|
92
|
+
CREATE INDEX IF NOT EXISTS idx_edges_source ON knowledge_edges(source_id);
|
|
93
|
+
CREATE INDEX IF NOT EXISTS idx_edges_target ON knowledge_edges(target_id);
|
|
94
|
+
CREATE INDEX IF NOT EXISTS idx_edges_type ON knowledge_edges(edge_type);
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
// =============================================================================
|
|
98
|
+
// Batch scripts to run (in order)
|
|
99
|
+
// =============================================================================
|
|
100
|
+
|
|
101
|
+
const BATCHES = [
|
|
102
|
+
"seed-knowledge-base.mjs", // original batch (batch 1)
|
|
103
|
+
"seed-knowledge-base-batch2.mjs",
|
|
104
|
+
"seed-knowledge-base-batch3.mjs",
|
|
105
|
+
"seed-knowledge-base-batch4.mjs",
|
|
106
|
+
"seed-knowledge-base-batch5.mjs",
|
|
107
|
+
"seed-knowledge-base-batch6.mjs",
|
|
108
|
+
"seed-knowledge-base-batch7.mjs",
|
|
109
|
+
"seed-knowledge-base-failure-modes.mjs", // curated failure mode patterns
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
// Ensure output directory exists and start from a clean slate
|
|
113
|
+
mkdirSync(ASSETS_DIR, { recursive: true });
|
|
114
|
+
if (existsSync(SEED_DB)) {
|
|
115
|
+
rmSync(SEED_DB);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Create DB and apply schema
|
|
119
|
+
const db = new DatabaseSync(SEED_DB);
|
|
120
|
+
db.exec("PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL; PRAGMA foreign_keys=ON;");
|
|
121
|
+
db.exec(SCHEMA);
|
|
122
|
+
db.close();
|
|
123
|
+
|
|
124
|
+
// Run each batch script with SNAPBACK_DB_PATH pointing to the asset DB
|
|
125
|
+
let _totalInserted = 0;
|
|
126
|
+
|
|
127
|
+
for (const batch of BATCHES) {
|
|
128
|
+
const scriptPath = resolve(SCRIPTS_DIR, batch);
|
|
129
|
+
|
|
130
|
+
if (!existsSync(scriptPath)) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const result = spawnSync("node", [scriptPath], {
|
|
135
|
+
env: { ...process.env, SNAPBACK_DB_PATH: SEED_DB },
|
|
136
|
+
encoding: "utf8",
|
|
137
|
+
stdio: "pipe",
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
if (result.status !== 0) {
|
|
141
|
+
if (result.stderr) {
|
|
142
|
+
// intentionally empty
|
|
143
|
+
}
|
|
144
|
+
process.exit(1);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Parse inserted count from batch script stdout ("Inserted: N")
|
|
148
|
+
const match = result.stdout.match(/Inserted:\s*(\d+)/i);
|
|
149
|
+
const inserted = match ? Number.parseInt(match[1], 10) : 0;
|
|
150
|
+
_totalInserted += inserted;
|
|
151
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vreko/cli",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Vreko CLI — AI-aware developer intelligence for the command line",
|
|
5
5
|
"homepage": "https://vreko.dev",
|
|
6
6
|
"repository": {
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
"ora": "5.4.1",
|
|
70
70
|
"react": "19.1.2",
|
|
71
71
|
"zod": "3.25.76",
|
|
72
|
-
"@vreko/auth": "0.1.1",
|
|
73
72
|
"@vreko/contracts": "1.0.1",
|
|
74
|
-
"@vreko/
|
|
73
|
+
"@vreko/auth": "0.1.1",
|
|
75
74
|
"@vreko/claims-ledger": "0.1.1",
|
|
76
75
|
"@vreko/local-service": "3.1.0",
|
|
77
|
-
"@vreko/mcp": "0.1.1",
|
|
78
76
|
"@vreko/local-service-client": "1.0.0",
|
|
77
|
+
"@vreko/mcp": "0.1.1",
|
|
78
|
+
"@vreko/intelligence": "0.1.1",
|
|
79
79
|
"@vreko/mcp-client": "0.1.1",
|
|
80
80
|
"@vreko/mcp-config": "1.0.0",
|
|
81
81
|
"@vreko/sentry-privacy": "0.0.1"
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
export { createInitCommand } from './chunk-OW6DEZEQ.js';
|
|
3
|
-
import './chunk-EWOJGXRX.js';
|
|
4
|
-
|
|
5
|
-
process.env.VREKO_CLI='true';process.env.NODE_NO_WARNINGS='1';
|
|
6
|
-
//# sourceMappingURL=init-command-7MV3TXKO.js.map
|
|
7
|
-
//# sourceMappingURL=init-command-7MV3TXKO.js.map
|