agents-reverse-engineer 0.3.2 → 0.3.4
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/generation/budget/counter.d.ts +0 -8
- package/dist/generation/budget/counter.d.ts.map +1 -1
- package/dist/generation/budget/counter.js +0 -21
- package/dist/generation/budget/counter.js.map +1 -1
- package/dist/generation/budget/index.d.ts +1 -1
- package/dist/generation/budget/index.d.ts.map +1 -1
- package/dist/generation/budget/index.js +1 -1
- package/dist/generation/budget/index.js.map +1 -1
- package/dist/generation/writers/index.d.ts +0 -3
- package/dist/generation/writers/index.d.ts.map +1 -1
- package/dist/generation/writers/index.js +0 -3
- package/dist/generation/writers/index.js.map +1 -1
- package/dist/installer/operations.d.ts +3 -2
- package/dist/installer/operations.d.ts.map +1 -1
- package/dist/installer/operations.js +118 -50
- package/dist/installer/operations.js.map +1 -1
- package/dist/installer/uninstall.d.ts +3 -3
- package/dist/installer/uninstall.d.ts.map +1 -1
- package/dist/installer/uninstall.js +83 -53
- package/dist/installer/uninstall.js.map +1 -1
- package/dist/integration/generate.d.ts.map +1 -1
- package/dist/integration/generate.js +32 -4
- package/dist/integration/generate.js.map +1 -1
- package/dist/integration/templates.d.ts +0 -4
- package/dist/integration/templates.d.ts.map +1 -1
- package/dist/integration/templates.js +284 -73
- package/dist/integration/templates.js.map +1 -1
- package/hooks/dist/are-check-update.js +68 -0
- package/hooks/dist/are-session-end.js +47 -0
- package/package.json +4 -3
- package/dist/generation/writers/claude-md.d.ts +0 -17
- package/dist/generation/writers/claude-md.d.ts.map +0 -1
- package/dist/generation/writers/claude-md.js +0 -96
- package/dist/generation/writers/claude-md.js.map +0 -1
- package/dist/generation/writers/gemini-md.d.ts +0 -17
- package/dist/generation/writers/gemini-md.d.ts.map +0 -1
- package/dist/generation/writers/gemini-md.js +0 -96
- package/dist/generation/writers/gemini-md.js.map +0 -1
- package/dist/generation/writers/opencode-md.d.ts +0 -17
- package/dist/generation/writers/opencode-md.d.ts.map +0 -1
- package/dist/generation/writers/opencode-md.js +0 -96
- package/dist/generation/writers/opencode-md.js.map +0 -1
- package/dist/state/database.d.ts +0 -9
- package/dist/state/database.d.ts.map +0 -1
- package/dist/state/database.js +0 -66
- package/dist/state/database.js.map +0 -1
- package/dist/state/index.d.ts +0 -8
- package/dist/state/index.d.ts.map +0 -1
- package/dist/state/index.js +0 -7
- package/dist/state/index.js.map +0 -1
- package/dist/state/migrations.d.ts +0 -12
- package/dist/state/migrations.d.ts.map +0 -1
- package/dist/state/migrations.js +0 -39
- package/dist/state/migrations.js.map +0 -1
- package/dist/state/types.d.ts +0 -54
- package/dist/state/types.d.ts.map +0 -1
- package/dist/state/types.js +0 -2
- package/dist/state/types.js.map +0 -1
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Write GEMINI.md at the project root.
|
|
3
|
-
*
|
|
4
|
-
* Only writes if Gemini CLI is installed locally (`.gemini` directory exists).
|
|
5
|
-
* If a user-defined GEMINI.md exists (not generated by us), it will be
|
|
6
|
-
* preserved as GEMINI.local.md and referenced in the generated file.
|
|
7
|
-
*
|
|
8
|
-
* @param projectRoot - Project root directory
|
|
9
|
-
* @returns Path to written GEMINI.md, or null if Gemini CLI is not installed
|
|
10
|
-
*/
|
|
11
|
-
export declare function writeGeminiMd(projectRoot: string): Promise<string | null>;
|
|
12
|
-
/**
|
|
13
|
-
* Get the content that would be written to GEMINI.md.
|
|
14
|
-
* Useful for previewing without writing.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getGeminiMdContent(): string;
|
|
17
|
-
//# sourceMappingURL=gemini-md.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-md.d.ts","sourceRoot":"","sources":["../../../src/generation/writers/gemini-md.ts"],"names":[],"mappings":"AA4DA;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4B/E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { writeFile, readFile, stat, rename } from 'node:fs/promises';
|
|
2
|
-
import * as path from 'node:path';
|
|
3
|
-
import { isRuntimeInstalledLocally } from '../../installer/paths.js';
|
|
4
|
-
/** Marker comment to identify generated GEMINI.md files */
|
|
5
|
-
const GENERATED_MARKER = '<!-- Generated by agents-reverse-engineer -->';
|
|
6
|
-
/**
|
|
7
|
-
* Standard GEMINI.md content - simple pointer to AGENTS.md.
|
|
8
|
-
*
|
|
9
|
-
* For Google Gemini CLI compatibility.
|
|
10
|
-
*/
|
|
11
|
-
function buildGeminiMdContent(hasLocalFile) {
|
|
12
|
-
const sections = [];
|
|
13
|
-
// Generated marker (first line)
|
|
14
|
-
sections.push(GENERATED_MARKER);
|
|
15
|
-
sections.push('');
|
|
16
|
-
// Reference to user-defined local file if it exists
|
|
17
|
-
if (hasLocalFile) {
|
|
18
|
-
sections.push('> **Note:** This project has additional documentation in [GEMINI.local.md](./GEMINI.local.md)');
|
|
19
|
-
sections.push('');
|
|
20
|
-
}
|
|
21
|
-
sections.push('# GEMINI.md');
|
|
22
|
-
sections.push('');
|
|
23
|
-
sections.push('See [AGENTS.md](./AGENTS.md) for codebase documentation.');
|
|
24
|
-
sections.push('');
|
|
25
|
-
sections.push('This file exists for Google Gemini CLI compatibility. The actual documentation');
|
|
26
|
-
sections.push('is maintained in AGENTS.md files throughout the codebase.');
|
|
27
|
-
sections.push('');
|
|
28
|
-
return sections.join('\n');
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Check if a file was generated by us (contains marker).
|
|
32
|
-
*/
|
|
33
|
-
async function isGeneratedFile(filePath) {
|
|
34
|
-
try {
|
|
35
|
-
const content = await readFile(filePath, 'utf-8');
|
|
36
|
-
return content.includes(GENERATED_MARKER);
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Check if a local file exists.
|
|
44
|
-
*/
|
|
45
|
-
async function hasLocalFile(localPath) {
|
|
46
|
-
try {
|
|
47
|
-
await stat(localPath);
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Write GEMINI.md at the project root.
|
|
56
|
-
*
|
|
57
|
-
* Only writes if Gemini CLI is installed locally (`.gemini` directory exists).
|
|
58
|
-
* If a user-defined GEMINI.md exists (not generated by us), it will be
|
|
59
|
-
* preserved as GEMINI.local.md and referenced in the generated file.
|
|
60
|
-
*
|
|
61
|
-
* @param projectRoot - Project root directory
|
|
62
|
-
* @returns Path to written GEMINI.md, or null if Gemini CLI is not installed
|
|
63
|
-
*/
|
|
64
|
-
export async function writeGeminiMd(projectRoot) {
|
|
65
|
-
// Only generate if Gemini CLI is installed locally
|
|
66
|
-
const isInstalled = await isRuntimeInstalledLocally('gemini', projectRoot);
|
|
67
|
-
if (!isInstalled) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
const geminiPath = path.join(projectRoot, 'GEMINI.md');
|
|
71
|
-
const localPath = path.join(projectRoot, 'GEMINI.local.md');
|
|
72
|
-
// Check if existing GEMINI.md is user-defined (not generated by us)
|
|
73
|
-
let hasLocal = await hasLocalFile(localPath);
|
|
74
|
-
try {
|
|
75
|
-
const existingIsGenerated = await isGeneratedFile(geminiPath);
|
|
76
|
-
if (!existingIsGenerated) {
|
|
77
|
-
// User-defined GEMINI.md exists - preserve it
|
|
78
|
-
await rename(geminiPath, localPath);
|
|
79
|
-
hasLocal = true;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
// No existing GEMINI.md - that's fine
|
|
84
|
-
}
|
|
85
|
-
const content = buildGeminiMdContent(hasLocal);
|
|
86
|
-
await writeFile(geminiPath, content, 'utf-8');
|
|
87
|
-
return geminiPath;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Get the content that would be written to GEMINI.md.
|
|
91
|
-
* Useful for previewing without writing.
|
|
92
|
-
*/
|
|
93
|
-
export function getGeminiMdContent() {
|
|
94
|
-
return buildGeminiMdContent(false);
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=gemini-md.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-md.js","sourceRoot":"","sources":["../../../src/generation/writers/gemini-md.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,2DAA2D;AAC3D,MAAM,gBAAgB,GAAG,+CAA+C,CAAC;AAEzE;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,YAAqB;IACjD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,gCAAgC;IAChC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAElB,oDAAoD;IACpD,IAAI,YAAY,EAAE,CAAC;QACjB,QAAQ,CAAC,IAAI,CAAC,+FAA+F,CAAC,CAAC;QAC/G,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpB,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;IAC1E,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,IAAI,CAAC,gFAAgF,CAAC,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AE,CAAC;YACzB,8CAA8C;YAC9C,MAAM,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YACpC,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,sCAAsC;IACxC,CAAC;IAED,MAAM,OAAO,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,SAAS,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAE9C,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Write OPENCODE.md at the project root.
|
|
3
|
-
*
|
|
4
|
-
* Only writes if OpenCode is installed locally (`.opencode` directory exists).
|
|
5
|
-
* If a user-defined OPENCODE.md exists (not generated by us), it will be
|
|
6
|
-
* preserved as OPENCODE.local.md and referenced in the generated file.
|
|
7
|
-
*
|
|
8
|
-
* @param projectRoot - Project root directory
|
|
9
|
-
* @returns Path to written OPENCODE.md, or null if OpenCode is not installed
|
|
10
|
-
*/
|
|
11
|
-
export declare function writeOpencodeMd(projectRoot: string): Promise<string | null>;
|
|
12
|
-
/**
|
|
13
|
-
* Get the content that would be written to OPENCODE.md.
|
|
14
|
-
* Useful for previewing without writing.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getOpencodeMdContent(): string;
|
|
17
|
-
//# sourceMappingURL=opencode-md.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opencode-md.d.ts","sourceRoot":"","sources":["../../../src/generation/writers/opencode-md.ts"],"names":[],"mappings":"AA4DA;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4BjF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { writeFile, readFile, stat, rename } from 'node:fs/promises';
|
|
2
|
-
import * as path from 'node:path';
|
|
3
|
-
import { isRuntimeInstalledLocally } from '../../installer/paths.js';
|
|
4
|
-
/** Marker comment to identify generated OPENCODE.md files */
|
|
5
|
-
const GENERATED_MARKER = '<!-- Generated by agents-reverse-engineer -->';
|
|
6
|
-
/**
|
|
7
|
-
* Standard OPENCODE.md content - simple pointer to AGENTS.md.
|
|
8
|
-
*
|
|
9
|
-
* For OpenCode compatibility.
|
|
10
|
-
*/
|
|
11
|
-
function buildOpencodeMdContent(hasLocalFile) {
|
|
12
|
-
const sections = [];
|
|
13
|
-
// Generated marker (first line)
|
|
14
|
-
sections.push(GENERATED_MARKER);
|
|
15
|
-
sections.push('');
|
|
16
|
-
// Reference to user-defined local file if it exists
|
|
17
|
-
if (hasLocalFile) {
|
|
18
|
-
sections.push('> **Note:** This project has additional documentation in [OPENCODE.local.md](./OPENCODE.local.md)');
|
|
19
|
-
sections.push('');
|
|
20
|
-
}
|
|
21
|
-
sections.push('# OPENCODE.md');
|
|
22
|
-
sections.push('');
|
|
23
|
-
sections.push('See [AGENTS.md](./AGENTS.md) for codebase documentation.');
|
|
24
|
-
sections.push('');
|
|
25
|
-
sections.push('This file exists for OpenCode compatibility. The actual documentation');
|
|
26
|
-
sections.push('is maintained in AGENTS.md files throughout the codebase.');
|
|
27
|
-
sections.push('');
|
|
28
|
-
return sections.join('\n');
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Check if a file was generated by us (contains marker).
|
|
32
|
-
*/
|
|
33
|
-
async function isGeneratedFile(filePath) {
|
|
34
|
-
try {
|
|
35
|
-
const content = await readFile(filePath, 'utf-8');
|
|
36
|
-
return content.includes(GENERATED_MARKER);
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Check if a local file exists.
|
|
44
|
-
*/
|
|
45
|
-
async function hasLocalFile(localPath) {
|
|
46
|
-
try {
|
|
47
|
-
await stat(localPath);
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Write OPENCODE.md at the project root.
|
|
56
|
-
*
|
|
57
|
-
* Only writes if OpenCode is installed locally (`.opencode` directory exists).
|
|
58
|
-
* If a user-defined OPENCODE.md exists (not generated by us), it will be
|
|
59
|
-
* preserved as OPENCODE.local.md and referenced in the generated file.
|
|
60
|
-
*
|
|
61
|
-
* @param projectRoot - Project root directory
|
|
62
|
-
* @returns Path to written OPENCODE.md, or null if OpenCode is not installed
|
|
63
|
-
*/
|
|
64
|
-
export async function writeOpencodeMd(projectRoot) {
|
|
65
|
-
// Only generate if OpenCode is installed locally
|
|
66
|
-
const isInstalled = await isRuntimeInstalledLocally('opencode', projectRoot);
|
|
67
|
-
if (!isInstalled) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
const opencodePath = path.join(projectRoot, 'OPENCODE.md');
|
|
71
|
-
const localPath = path.join(projectRoot, 'OPENCODE.local.md');
|
|
72
|
-
// Check if existing OPENCODE.md is user-defined (not generated by us)
|
|
73
|
-
let hasLocal = await hasLocalFile(localPath);
|
|
74
|
-
try {
|
|
75
|
-
const existingIsGenerated = await isGeneratedFile(opencodePath);
|
|
76
|
-
if (!existingIsGenerated) {
|
|
77
|
-
// User-defined OPENCODE.md exists - preserve it
|
|
78
|
-
await rename(opencodePath, localPath);
|
|
79
|
-
hasLocal = true;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
// No existing OPENCODE.md - that's fine
|
|
84
|
-
}
|
|
85
|
-
const content = buildOpencodeMdContent(hasLocal);
|
|
86
|
-
await writeFile(opencodePath, content, 'utf-8');
|
|
87
|
-
return opencodePath;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Get the content that would be written to OPENCODE.md.
|
|
91
|
-
* Useful for previewing without writing.
|
|
92
|
-
*/
|
|
93
|
-
export function getOpencodeMdContent() {
|
|
94
|
-
return buildOpencodeMdContent(false);
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=opencode-md.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opencode-md.js","sourceRoot":"","sources":["../../../src/generation/writers/opencode-md.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,6DAA6D;AAC7D,MAAM,gBAAgB,GAAG,+CAA+C,CAAC;AAEzE;;;;GAIG;AACH,SAAS,sBAAsB,CAAC,YAAqB;IACnD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,gCAAgC;IAChC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAElB,oDAAoD;IACpD,IAAI,YAAY,EAAE,CAAC;QACjB,QAAQ,CAAC,IAAI,CAAC,mGAAmG,CAAC,CAAC;QACnH,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpB,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;IAC1E,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,IAAI,CAAC,uEAAuE,CAAC,CAAC;IACvF,QAAQ,CA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;YAChD,MAAM,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;YACtC,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,wCAAwC;IAC1C,CAAC;IAED,MAAM,OAAO,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,SAAS,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAEhD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/state/database.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { StateDatabase } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Opens the state database, applying migrations if needed.
|
|
4
|
-
* Uses WAL mode for performance.
|
|
5
|
-
*
|
|
6
|
-
* @param dbPath - Path to the SQLite database file
|
|
7
|
-
*/
|
|
8
|
-
export declare function openDatabase(dbPath: string): StateDatabase;
|
|
9
|
-
//# sourceMappingURL=database.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/state/database.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAyB,aAAa,EAAE,MAAM,YAAY,CAAC;AAGvE;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAuF1D"}
|
package/dist/state/database.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SQLite state database with prepared statements
|
|
3
|
-
*/
|
|
4
|
-
import Database from 'better-sqlite3';
|
|
5
|
-
import { CURRENT_SCHEMA_VERSION, migrateSchema } from './migrations.js';
|
|
6
|
-
/**
|
|
7
|
-
* Opens the state database, applying migrations if needed.
|
|
8
|
-
* Uses WAL mode for performance.
|
|
9
|
-
*
|
|
10
|
-
* @param dbPath - Path to the SQLite database file
|
|
11
|
-
*/
|
|
12
|
-
export function openDatabase(dbPath) {
|
|
13
|
-
const db = new Database(dbPath);
|
|
14
|
-
// Enable WAL mode for better concurrent read performance
|
|
15
|
-
db.pragma('journal_mode = WAL');
|
|
16
|
-
// Check and apply migrations
|
|
17
|
-
const version = db.pragma('user_version', { simple: true });
|
|
18
|
-
if (version < CURRENT_SCHEMA_VERSION) {
|
|
19
|
-
migrateSchema(db, version, CURRENT_SCHEMA_VERSION);
|
|
20
|
-
}
|
|
21
|
-
// Prepared statements for performance
|
|
22
|
-
const getFileStmt = db.prepare('SELECT path, content_hash, sum_generated_at, last_analyzed_commit FROM files WHERE path = ?');
|
|
23
|
-
const upsertFileStmt = db.prepare(`
|
|
24
|
-
INSERT INTO files (path, content_hash, sum_generated_at, last_analyzed_commit)
|
|
25
|
-
VALUES (?, ?, ?, ?)
|
|
26
|
-
ON CONFLICT(path) DO UPDATE SET
|
|
27
|
-
content_hash = excluded.content_hash,
|
|
28
|
-
sum_generated_at = excluded.sum_generated_at,
|
|
29
|
-
last_analyzed_commit = excluded.last_analyzed_commit
|
|
30
|
-
`);
|
|
31
|
-
const deleteFileStmt = db.prepare('DELETE FROM files WHERE path = ?');
|
|
32
|
-
const getAllFilesStmt = db.prepare('SELECT path, content_hash, sum_generated_at, last_analyzed_commit FROM files');
|
|
33
|
-
const getLastRunStmt = db.prepare('SELECT id, commit_hash, completed_at, files_analyzed, files_skipped FROM runs ORDER BY id DESC LIMIT 1');
|
|
34
|
-
const insertRunStmt = db.prepare(`
|
|
35
|
-
INSERT INTO runs (commit_hash, completed_at, files_analyzed, files_skipped)
|
|
36
|
-
VALUES (?, ?, ?, ?)
|
|
37
|
-
`);
|
|
38
|
-
return {
|
|
39
|
-
getFile(path) {
|
|
40
|
-
return getFileStmt.get(path);
|
|
41
|
-
},
|
|
42
|
-
upsertFile(record) {
|
|
43
|
-
upsertFileStmt.run(record.path, record.content_hash, record.sum_generated_at, record.last_analyzed_commit);
|
|
44
|
-
},
|
|
45
|
-
deleteFile(path) {
|
|
46
|
-
deleteFileStmt.run(path);
|
|
47
|
-
},
|
|
48
|
-
getAllFiles() {
|
|
49
|
-
return getAllFilesStmt.all();
|
|
50
|
-
},
|
|
51
|
-
getLastRun() {
|
|
52
|
-
return getLastRunStmt.get();
|
|
53
|
-
},
|
|
54
|
-
insertRun(run) {
|
|
55
|
-
const result = insertRunStmt.run(run.commit_hash, run.completed_at, run.files_analyzed, run.files_skipped);
|
|
56
|
-
return Number(result.lastInsertRowid);
|
|
57
|
-
},
|
|
58
|
-
close() {
|
|
59
|
-
db.close();
|
|
60
|
-
},
|
|
61
|
-
getDb() {
|
|
62
|
-
return db;
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=database.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/state/database.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEhC,yDAAyD;IACzD,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAEhC,6BAA6B;IAC7B,MAAM,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAW,CAAC;IACtE,IAAI,OAAO,GAAG,sBAAsB,EAAE,CAAC;QACrC,aAAa,CAAC,EAAE,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC;IACrD,CAAC;IAED,sCAAsC;IACtC,MAAM,WAAW,GAAG,EAAE,CAAC,OAAO,CAC5B,6FA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|
package/dist/state/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State management module
|
|
3
|
-
*
|
|
4
|
-
* Provides SQLite-based state persistence for tracking file generation.
|
|
5
|
-
*/
|
|
6
|
-
export { openDatabase } from './database.js';
|
|
7
|
-
export type { FileRecord, RunRecord, StateDatabase } from './types.js';
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/state/index.js
DELETED
package/dist/state/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema migrations using SQLite user_version pragma
|
|
3
|
-
*/
|
|
4
|
-
import type Database from 'better-sqlite3';
|
|
5
|
-
/** Current schema version */
|
|
6
|
-
export declare const CURRENT_SCHEMA_VERSION = 1;
|
|
7
|
-
/**
|
|
8
|
-
* Apply schema migrations from `fromVersion` to `toVersion`.
|
|
9
|
-
* Uses transaction for atomicity.
|
|
10
|
-
*/
|
|
11
|
-
export declare function migrateSchema(db: Database.Database, fromVersion: number, toVersion: number): void;
|
|
12
|
-
//# sourceMappingURL=migrations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/state/migrations.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,6BAA6B;AAC7B,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,IAAI,CAoCN"}
|
package/dist/state/migrations.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/** Current schema version */
|
|
2
|
-
export const CURRENT_SCHEMA_VERSION = 1;
|
|
3
|
-
/**
|
|
4
|
-
* Apply schema migrations from `fromVersion` to `toVersion`.
|
|
5
|
-
* Uses transaction for atomicity.
|
|
6
|
-
*/
|
|
7
|
-
export function migrateSchema(db, fromVersion, toVersion) {
|
|
8
|
-
const migrate = db.transaction(() => {
|
|
9
|
-
if (fromVersion < 1) {
|
|
10
|
-
// Initial schema
|
|
11
|
-
db.exec(`
|
|
12
|
-
CREATE TABLE files (
|
|
13
|
-
path TEXT PRIMARY KEY,
|
|
14
|
-
content_hash TEXT NOT NULL,
|
|
15
|
-
sum_generated_at TEXT,
|
|
16
|
-
last_analyzed_commit TEXT
|
|
17
|
-
)
|
|
18
|
-
`);
|
|
19
|
-
db.exec(`
|
|
20
|
-
CREATE TABLE runs (
|
|
21
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
22
|
-
commit_hash TEXT NOT NULL,
|
|
23
|
-
completed_at TEXT NOT NULL,
|
|
24
|
-
files_analyzed INTEGER NOT NULL,
|
|
25
|
-
files_skipped INTEGER NOT NULL
|
|
26
|
-
)
|
|
27
|
-
`);
|
|
28
|
-
// Index for faster queries by commit
|
|
29
|
-
db.exec(`
|
|
30
|
-
CREATE INDEX idx_runs_commit ON runs(commit_hash)
|
|
31
|
-
`);
|
|
32
|
-
}
|
|
33
|
-
// Future migrations would go here:
|
|
34
|
-
// if (fromVersion < 2) { ... }
|
|
35
|
-
db.pragma(`user_version = ${toVersion}`);
|
|
36
|
-
});
|
|
37
|
-
migrate();
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=migrations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../src/state/migrations.ts"],"names":[],"mappings":"AAKA,6BAA6B;AAC7B,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,EAAqB,EACrB,WAAmB,EACnB,SAAiB;IAEjB,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE;QAClC,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;YACpB,iBAAiB;YACjB,EAAE,CAAC,IAAI,CAAC;;;;;;;OAOP,CAAC,CAAC;YAEH,EAAE,CAAC,IAAI,CAAC;;;;;;;;OAQP,CAAC,CAAC;YAEH,qCAAqC;YACrC,EAAE,CAAC,IAAI,CAAC;;OAEP,CAAC,CAAC;QACL,CAAC;QAED,mCAAmC;QACnC,+BAA+B;QAE/B,EAAE,CAAC,MAAM,CAAC,kBAAkB,SAAS,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/state/types.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State types for tracking file generation
|
|
3
|
-
*/
|
|
4
|
-
import type Database from 'better-sqlite3';
|
|
5
|
-
/**
|
|
6
|
-
* Record of a file's generation state
|
|
7
|
-
*/
|
|
8
|
-
export interface FileRecord {
|
|
9
|
-
/** Relative path from project root */
|
|
10
|
-
path: string;
|
|
11
|
-
/** SHA-256 hash of file content */
|
|
12
|
-
content_hash: string;
|
|
13
|
-
/** ISO timestamp when .sum was generated (null if not yet generated) */
|
|
14
|
-
sum_generated_at: string | null;
|
|
15
|
-
/** Commit hash when file was last analyzed */
|
|
16
|
-
last_analyzed_commit: string | null;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Record of a generation/update run
|
|
20
|
-
*/
|
|
21
|
-
export interface RunRecord {
|
|
22
|
-
/** Auto-incremented ID */
|
|
23
|
-
id: number;
|
|
24
|
-
/** Git commit hash at run time */
|
|
25
|
-
commit_hash: string;
|
|
26
|
-
/** ISO timestamp when run completed */
|
|
27
|
-
completed_at: string;
|
|
28
|
-
/** Number of files analyzed in this run */
|
|
29
|
-
files_analyzed: number;
|
|
30
|
-
/** Number of files skipped (unchanged) */
|
|
31
|
-
files_skipped: number;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Interface for state database operations
|
|
35
|
-
*/
|
|
36
|
-
export interface StateDatabase {
|
|
37
|
-
/** Get file record by path */
|
|
38
|
-
getFile(path: string): FileRecord | undefined;
|
|
39
|
-
/** Insert or update file record */
|
|
40
|
-
upsertFile(record: FileRecord): void;
|
|
41
|
-
/** Delete file record */
|
|
42
|
-
deleteFile(path: string): void;
|
|
43
|
-
/** Get all file records */
|
|
44
|
-
getAllFiles(): FileRecord[];
|
|
45
|
-
/** Get the most recent run record */
|
|
46
|
-
getLastRun(): RunRecord | undefined;
|
|
47
|
-
/** Insert a new run record */
|
|
48
|
-
insertRun(run: Omit<RunRecord, 'id'>): number;
|
|
49
|
-
/** Close the database connection */
|
|
50
|
-
close(): void;
|
|
51
|
-
/** Get the underlying database for transactions */
|
|
52
|
-
getDb(): Database.Database;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,8CAA8C;IAC9C,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,0CAA0C;IAC1C,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAC9C,mCAAmC;IACnC,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACrC,yBAAyB;IACzB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,2BAA2B;IAC3B,WAAW,IAAI,UAAU,EAAE,CAAC;IAC5B,qCAAqC;IACrC,UAAU,IAAI,SAAS,GAAG,SAAS,CAAC;IACpC,8BAA8B;IAC9B,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,MAAM,CAAC;IAC9C,oCAAoC;IACpC,KAAK,IAAI,IAAI,CAAC;IACd,mDAAmD;IACnD,KAAK,IAAI,QAAQ,CAAC,QAAQ,CAAC;CAC5B"}
|
package/dist/state/types.js
DELETED
package/dist/state/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":""}
|