vigthoria-cli 1.8.15 → 1.9.2

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.
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Vigthoria CLI — Workspace Hash Cache
3
+ *
4
+ * Persists SHA-256 hashes of workspace files in .vigthoria/file-hashes.json.
5
+ * Allows the CLI to sort files by change status before sending them to V3:
6
+ * - Changed/new files → sent first (highest budget priority)
7
+ * - Unchanged files → sent last (trimmed by budget if token limit reached)
8
+ */
9
+ export interface FileChangeset {
10
+ /** Files that are new or changed since last cache write. */
11
+ changed: string[];
12
+ /** Files whose hash matches the cached value. */
13
+ unchanged: string[];
14
+ total: number;
15
+ }
16
+ /**
17
+ * Partition file paths into changed and unchanged sets.
18
+ *
19
+ * @param workspacePath Absolute project root.
20
+ * @param relativePaths Workspace-relative (or absolute) file paths to check.
21
+ */
22
+ export declare function getChangedFiles(workspacePath: string, relativePaths: string[]): FileChangeset;
23
+ /**
24
+ * Write current hashes for the given files into the persistent cache.
25
+ * Call this after an agent run completes successfully.
26
+ */
27
+ export declare function updateWorkspaceCache(workspacePath: string, relativePaths: string[]): void;
28
+ /**
29
+ * Return a human-readable summary of changes since last cache update.
30
+ */
31
+ export declare function summarizeChanges(workspacePath: string, relativePaths: string[]): string;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ /**
3
+ * Vigthoria CLI — Workspace Hash Cache
4
+ *
5
+ * Persists SHA-256 hashes of workspace files in .vigthoria/file-hashes.json.
6
+ * Allows the CLI to sort files by change status before sending them to V3:
7
+ * - Changed/new files → sent first (highest budget priority)
8
+ * - Unchanged files → sent last (trimmed by budget if token limit reached)
9
+ */
10
+ var __importDefault = (this && this.__importDefault) || function (mod) {
11
+ return (mod && mod.__esModule) ? mod : { "default": mod };
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.getChangedFiles = getChangedFiles;
15
+ exports.updateWorkspaceCache = updateWorkspaceCache;
16
+ exports.summarizeChanges = summarizeChanges;
17
+ const node_crypto_1 = require("node:crypto");
18
+ const node_fs_1 = __importDefault(require("node:fs"));
19
+ const node_path_1 = __importDefault(require("node:path"));
20
+ const CACHE_SUBDIR = '.vigthoria';
21
+ const CACHE_FILENAME = 'file-hashes.json';
22
+ function getCachePath(workspacePath) {
23
+ return node_path_1.default.join(workspacePath, CACHE_SUBDIR, CACHE_FILENAME);
24
+ }
25
+ function hashFile(absPath) {
26
+ try {
27
+ return (0, node_crypto_1.createHash)('sha256').update(node_fs_1.default.readFileSync(absPath)).digest('hex');
28
+ }
29
+ catch {
30
+ return '';
31
+ }
32
+ }
33
+ function loadCache(workspacePath) {
34
+ try {
35
+ return JSON.parse(node_fs_1.default.readFileSync(getCachePath(workspacePath), 'utf-8'));
36
+ }
37
+ catch {
38
+ return {};
39
+ }
40
+ }
41
+ function persistCache(workspacePath, hashes) {
42
+ try {
43
+ const cacheDir = node_path_1.default.join(workspacePath, CACHE_SUBDIR);
44
+ if (!node_fs_1.default.existsSync(cacheDir))
45
+ node_fs_1.default.mkdirSync(cacheDir, { recursive: true });
46
+ node_fs_1.default.writeFileSync(getCachePath(workspacePath), JSON.stringify(hashes, null, 2), 'utf-8');
47
+ }
48
+ catch { /* non-fatal */ }
49
+ }
50
+ /**
51
+ * Partition file paths into changed and unchanged sets.
52
+ *
53
+ * @param workspacePath Absolute project root.
54
+ * @param relativePaths Workspace-relative (or absolute) file paths to check.
55
+ */
56
+ function getChangedFiles(workspacePath, relativePaths) {
57
+ const cache = loadCache(workspacePath);
58
+ const changed = [];
59
+ const unchanged = [];
60
+ for (const rel of relativePaths) {
61
+ const abs = node_path_1.default.isAbsolute(rel) ? rel : node_path_1.default.join(workspacePath, rel);
62
+ const key = node_path_1.default.relative(workspacePath, abs).replace(/\\/g, '/');
63
+ const currentHash = hashFile(abs);
64
+ if (!currentHash || cache[key] !== currentHash) {
65
+ changed.push(rel);
66
+ }
67
+ else {
68
+ unchanged.push(rel);
69
+ }
70
+ }
71
+ return { changed, unchanged, total: relativePaths.length };
72
+ }
73
+ /**
74
+ * Write current hashes for the given files into the persistent cache.
75
+ * Call this after an agent run completes successfully.
76
+ */
77
+ function updateWorkspaceCache(workspacePath, relativePaths) {
78
+ if (!workspacePath || !node_fs_1.default.existsSync(workspacePath))
79
+ return;
80
+ const cache = loadCache(workspacePath);
81
+ for (const rel of relativePaths) {
82
+ const abs = node_path_1.default.isAbsolute(rel) ? rel : node_path_1.default.join(workspacePath, rel);
83
+ const key = node_path_1.default.relative(workspacePath, abs).replace(/\\/g, '/');
84
+ const hash = hashFile(abs);
85
+ if (hash)
86
+ cache[key] = hash;
87
+ }
88
+ persistCache(workspacePath, cache);
89
+ }
90
+ /**
91
+ * Return a human-readable summary of changes since last cache update.
92
+ */
93
+ function summarizeChanges(workspacePath, relativePaths) {
94
+ const { changed, unchanged, total } = getChangedFiles(workspacePath, relativePaths);
95
+ return `${changed.length} changed, ${unchanged.length} unchanged of ${total} files tracked`;
96
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vigthoria-cli",
3
- "version": "1.8.15",
3
+ "version": "1.9.2",
4
4
  "description": "Vigthoria Coder CLI - AI-powered terminal coding assistant",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -20,7 +20,7 @@
20
20
  "start": "node dist/index.js",
21
21
  "dev": "ts-node src/index.ts",
22
22
  "test": "npm run test:cli",
23
- "test:cli": "npm run build && node scripts/test-cli-suite.js",
23
+ "test:cli": "npm run build && npm run precheck:services && node scripts/test-cli-suite.js",
24
24
  "test:regression": "npm run build && node scripts/test-regression-1.6.22.js",
25
25
  "test:agent:smoke": "npm run build && node scripts/test-agent-smoke.js",
26
26
  "test:agent:routing": "npm run build && node scripts/test-agent-routing-policy.js",
@@ -44,7 +44,11 @@
44
44
  "test:game:live": "npm run build && node scripts/test-live-game-push.js",
45
45
  "proof:agent": "npm run build && node scripts/proof-agent-mode.js",
46
46
  "test:fresh-install": "node scripts/test-fresh-install.js",
47
- "prepublishOnly": "npm run build && node scripts/verify-package-hygiene.js && node scripts/test-fresh-install.js"
47
+ "prepublishOnly": "npm run build && node scripts/verify-package-hygiene.js && node scripts/test-fresh-install.js",
48
+ "precheck:services": "node scripts/precheck-local-services.js",
49
+ "test:model:governance": "npm run build && node scripts/test-model-governance-no-agent.js",
50
+ "validate:no-go": "bash scripts/release/validate-no-go-gates.sh",
51
+ "test:legion:billing:e2e": "npm run build && node scripts/test-legion-godmode-billing-e2e.js"
48
52
  },
49
53
  "keywords": [
50
54
  "ai",