logicstamp-context 0.1.0
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/LICENSE +21 -0
- package/LLM_CONTEXT.md +260 -0
- package/README.md +949 -0
- package/dist/cli/commands/clean.d.ts +15 -0
- package/dist/cli/commands/clean.d.ts.map +1 -0
- package/dist/cli/commands/clean.js +142 -0
- package/dist/cli/commands/clean.js.map +1 -0
- package/dist/cli/commands/compare.d.ts +88 -0
- package/dist/cli/commands/compare.d.ts.map +1 -0
- package/dist/cli/commands/compare.js +519 -0
- package/dist/cli/commands/compare.js.map +1 -0
- package/dist/cli/commands/context.d.ts +24 -0
- package/dist/cli/commands/context.d.ts.map +1 -0
- package/dist/cli/commands/context.js +576 -0
- package/dist/cli/commands/context.js.map +1 -0
- package/dist/cli/commands/init.d.ts +14 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +71 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +52 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +368 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +223 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/stamp.d.ts +7 -0
- package/dist/cli/stamp.d.ts.map +1 -0
- package/dist/cli/stamp.js +961 -0
- package/dist/cli/stamp.js.map +1 -0
- package/dist/cli/validate-index.d.ts +7 -0
- package/dist/cli/validate-index.d.ts.map +1 -0
- package/dist/cli/validate-index.js +55 -0
- package/dist/cli/validate-index.js.map +1 -0
- package/dist/core/astParser.d.ts +47 -0
- package/dist/core/astParser.d.ts.map +1 -0
- package/dist/core/astParser.js +417 -0
- package/dist/core/astParser.js.map +1 -0
- package/dist/core/contractBuilder.d.ts +48 -0
- package/dist/core/contractBuilder.d.ts.map +1 -0
- package/dist/core/contractBuilder.js +120 -0
- package/dist/core/contractBuilder.js.map +1 -0
- package/dist/core/manifest.d.ts +75 -0
- package/dist/core/manifest.d.ts.map +1 -0
- package/dist/core/manifest.js +173 -0
- package/dist/core/manifest.js.map +1 -0
- package/dist/core/pack.d.ts +190 -0
- package/dist/core/pack.d.ts.map +1 -0
- package/dist/core/pack.js +438 -0
- package/dist/core/pack.js.map +1 -0
- package/dist/core/signature.d.ts +47 -0
- package/dist/core/signature.d.ts.map +1 -0
- package/dist/core/signature.js +208 -0
- package/dist/core/signature.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/types/UIFContract.d.ts +112 -0
- package/dist/types/UIFContract.d.ts.map +1 -0
- package/dist/types/UIFContract.js +36 -0
- package/dist/types/UIFContract.js.map +1 -0
- package/dist/utils/config.d.ts +34 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +62 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/fsx.d.ts +85 -0
- package/dist/utils/fsx.d.ts.map +1 -0
- package/dist/utils/fsx.js +181 -0
- package/dist/utils/fsx.js.map +1 -0
- package/dist/utils/gitignore.d.ts +62 -0
- package/dist/utils/gitignore.d.ts.map +1 -0
- package/dist/utils/gitignore.js +183 -0
- package/dist/utils/gitignore.js.map +1 -0
- package/dist/utils/hash.d.ts +73 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +159 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/llmContext.d.ts +34 -0
- package/dist/utils/llmContext.d.ts.map +1 -0
- package/dist/utils/llmContext.js +136 -0
- package/dist/utils/llmContext.js.map +1 -0
- package/dist/utils/tokens.d.ts +23 -0
- package/dist/utils/tokens.d.ts.map +1 -0
- package/dist/utils/tokens.js +29 -0
- package/dist/utils/tokens.js.map +1 -0
- package/package.json +69 -0
- package/schema/logicstamp.context.schema.json +430 -0
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,EAAE,CAAC;YACrB,4BAA4B;YAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAS,UAAU,CAAoC,GAAM;IAC3D,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;SAC5B,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACnB,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACpB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAA6B,CAAC,CAAC;IAEpC,OAAO,MAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,SAAS,CAAC,KAAa;IAC9B,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtE,OAAO,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,KAAa;IACtD,OAAO,KAAK,KAAK,KAAK,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for managing LLM_CONTEXT.md file
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Read LLM_CONTEXT.md from the package
|
|
6
|
+
* Tries multiple possible locations to handle both development and installed package scenarios
|
|
7
|
+
*/
|
|
8
|
+
export declare function readPackageLLMContext(): Promise<string | null>;
|
|
9
|
+
/**
|
|
10
|
+
* Check if LLM_CONTEXT.md exists in the target directory
|
|
11
|
+
*/
|
|
12
|
+
export declare function llmContextExists(targetDir: string): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Write LLM_CONTEXT.md to target directory
|
|
15
|
+
*/
|
|
16
|
+
export declare function writeLLMContext(targetDir: string, content: string): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Smart LLM_CONTEXT.md management with user prompt and config persistence
|
|
19
|
+
*
|
|
20
|
+
* Behavior:
|
|
21
|
+
* 1. If file already exists: do nothing
|
|
22
|
+
* 2. If config has preference: respect it
|
|
23
|
+
* 3. If TTY (interactive): prompt user once, save preference
|
|
24
|
+
* 4. If non-TTY (CI): do nothing (don't auto-add)
|
|
25
|
+
*
|
|
26
|
+
* @param targetDir - Project root directory
|
|
27
|
+
* @returns Result of the operation
|
|
28
|
+
*/
|
|
29
|
+
export declare function smartLLMContextSetup(targetDir: string): Promise<{
|
|
30
|
+
added: boolean;
|
|
31
|
+
prompted: boolean;
|
|
32
|
+
skipped: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
//# sourceMappingURL=llmContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmContext.d.ts","sourceRoot":"","sources":["../../src/utils/llmContext.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH;;;GAGG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAyBpE;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO1E;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvF;AA2BD;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAkDlE"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for managing LLM_CONTEXT.md file
|
|
3
|
+
*/
|
|
4
|
+
import { readFile, writeFile, access } from 'node:fs/promises';
|
|
5
|
+
import { join, dirname } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { readConfig, updateConfig } from './config.js';
|
|
8
|
+
/**
|
|
9
|
+
* Read LLM_CONTEXT.md from the package
|
|
10
|
+
* Tries multiple possible locations to handle both development and installed package scenarios
|
|
11
|
+
*/
|
|
12
|
+
export async function readPackageLLMContext() {
|
|
13
|
+
const currentFile = fileURLToPath(import.meta.url);
|
|
14
|
+
const currentDir = dirname(currentFile);
|
|
15
|
+
// Try multiple possible paths:
|
|
16
|
+
// 1. Development: src/utils/llmContext.ts -> ../../LLM_CONTEXT.md
|
|
17
|
+
// 2. Installed: node_modules/logicstamp-context/dist/utils/llmContext.js -> ../../../LLM_CONTEXT.md
|
|
18
|
+
// 3. Alternative installed: node_modules/logicstamp-context/dist/utils/llmContext.js -> ../../../../LLM_CONTEXT.md
|
|
19
|
+
const possiblePaths = [
|
|
20
|
+
join(currentDir, '..', '..', 'LLM_CONTEXT.md'), // Development: src/utils/ -> ../../
|
|
21
|
+
join(currentDir, '..', '..', '..', 'LLM_CONTEXT.md'), // Installed: dist/utils/ -> ../../../
|
|
22
|
+
join(currentDir, '..', '..', '..', '..', 'LLM_CONTEXT.md'), // Alternative installed path
|
|
23
|
+
];
|
|
24
|
+
for (const path of possiblePaths) {
|
|
25
|
+
try {
|
|
26
|
+
await access(path);
|
|
27
|
+
return await readFile(path, 'utf-8');
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// Try next path
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Check if LLM_CONTEXT.md exists in the target directory
|
|
38
|
+
*/
|
|
39
|
+
export async function llmContextExists(targetDir) {
|
|
40
|
+
try {
|
|
41
|
+
await access(join(targetDir, 'LLM_CONTEXT.md'));
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Write LLM_CONTEXT.md to target directory
|
|
50
|
+
*/
|
|
51
|
+
export async function writeLLMContext(targetDir, content) {
|
|
52
|
+
const llmContextPath = join(targetDir, 'LLM_CONTEXT.md');
|
|
53
|
+
await writeFile(llmContextPath, content, 'utf-8');
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Check if running in interactive TTY
|
|
57
|
+
*/
|
|
58
|
+
function isTTY() {
|
|
59
|
+
return process.stdout.isTTY === true && process.stdin.isTTY === true;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Prompt user for Y/N input (only in TTY mode)
|
|
63
|
+
*/
|
|
64
|
+
async function promptYesNo(question) {
|
|
65
|
+
const { createInterface } = await import('node:readline');
|
|
66
|
+
const readline = createInterface({
|
|
67
|
+
input: process.stdin,
|
|
68
|
+
output: process.stdout,
|
|
69
|
+
});
|
|
70
|
+
return new Promise((resolve) => {
|
|
71
|
+
readline.question(question, (answer) => {
|
|
72
|
+
readline.close();
|
|
73
|
+
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes' || answer === '');
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Smart LLM_CONTEXT.md management with user prompt and config persistence
|
|
79
|
+
*
|
|
80
|
+
* Behavior:
|
|
81
|
+
* 1. If file already exists: do nothing
|
|
82
|
+
* 2. If config has preference: respect it
|
|
83
|
+
* 3. If TTY (interactive): prompt user once, save preference
|
|
84
|
+
* 4. If non-TTY (CI): do nothing (don't auto-add)
|
|
85
|
+
*
|
|
86
|
+
* @param targetDir - Project root directory
|
|
87
|
+
* @returns Result of the operation
|
|
88
|
+
*/
|
|
89
|
+
export async function smartLLMContextSetup(targetDir) {
|
|
90
|
+
// Check if file already exists
|
|
91
|
+
if (await llmContextExists(targetDir)) {
|
|
92
|
+
return { added: false, prompted: false, skipped: false };
|
|
93
|
+
}
|
|
94
|
+
// Check config for saved preference
|
|
95
|
+
const config = await readConfig(targetDir);
|
|
96
|
+
// If user previously chose to skip, respect that
|
|
97
|
+
if (config.llmContextPreference === 'skipped') {
|
|
98
|
+
return { added: false, prompted: false, skipped: true };
|
|
99
|
+
}
|
|
100
|
+
// If user previously chose to add, do it without prompting
|
|
101
|
+
if (config.llmContextPreference === 'added') {
|
|
102
|
+
const content = await readPackageLLMContext();
|
|
103
|
+
if (content) {
|
|
104
|
+
await writeLLMContext(targetDir, content);
|
|
105
|
+
return { added: true, prompted: false, skipped: false };
|
|
106
|
+
}
|
|
107
|
+
return { added: false, prompted: false, skipped: true };
|
|
108
|
+
}
|
|
109
|
+
// No preference saved yet - prompt if interactive
|
|
110
|
+
if (isTTY()) {
|
|
111
|
+
console.log('\n💡 LogicStamp can generate LLM_CONTEXT.md to help AI assistants understand your project structure.\n');
|
|
112
|
+
const shouldAdd = await promptYesNo('Generate LLM_CONTEXT.md in project root? [Y/n] ');
|
|
113
|
+
if (shouldAdd) {
|
|
114
|
+
// User said yes - write file and save preference
|
|
115
|
+
const content = await readPackageLLMContext();
|
|
116
|
+
if (content) {
|
|
117
|
+
await writeLLMContext(targetDir, content);
|
|
118
|
+
await updateConfig(targetDir, { llmContextPreference: 'added' });
|
|
119
|
+
return { added: true, prompted: true, skipped: false };
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
console.warn('⚠️ Could not find LLM_CONTEXT.md template in package');
|
|
123
|
+
await updateConfig(targetDir, { llmContextPreference: 'skipped' });
|
|
124
|
+
return { added: false, prompted: true, skipped: true };
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// User said no - save preference to never ask again
|
|
129
|
+
await updateConfig(targetDir, { llmContextPreference: 'skipped' });
|
|
130
|
+
return { added: false, prompted: true, skipped: true };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Non-interactive (CI) - don't auto-add, don't prompt
|
|
134
|
+
return { added: false, prompted: false, skipped: true };
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=llmContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmContext.js","sourceRoot":"","sources":["../../src/utils/llmContext.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnD,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAExC,+BAA+B;IAC/B,kEAAkE;IAClE,oGAAoG;IACpG,mHAAmH;IACnH,MAAM,aAAa,GAAG;QACpB,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,CAAC,EAAE,oCAAoC;QACpF,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,CAAC,EAAE,sCAAsC;QAC5F,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,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estimation utilities for GPT and Claude models
|
|
3
|
+
* Uses character-based approximations
|
|
4
|
+
*
|
|
5
|
+
* For production use, consider installing:
|
|
6
|
+
* - @dqbd/tiktoken for GPT models
|
|
7
|
+
* - @anthropic-ai/tokenizer for Claude
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Estimate GPT-4 tokens using character-based approximation
|
|
11
|
+
* GPT-4 typically uses ~4 characters per token for code/JSON
|
|
12
|
+
*/
|
|
13
|
+
export declare function estimateGPT4Tokens(text: string): number;
|
|
14
|
+
/**
|
|
15
|
+
* Estimate Claude tokens using character-based approximation
|
|
16
|
+
* Claude typically uses ~4.5 characters per token for code/JSON
|
|
17
|
+
*/
|
|
18
|
+
export declare function estimateClaudeTokens(text: string): number;
|
|
19
|
+
/**
|
|
20
|
+
* Format token count with commas for readability
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatTokenCount(count: number): string;
|
|
23
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/utils/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token estimation utilities for GPT and Claude models
|
|
3
|
+
* Uses character-based approximations
|
|
4
|
+
*
|
|
5
|
+
* For production use, consider installing:
|
|
6
|
+
* - @dqbd/tiktoken for GPT models
|
|
7
|
+
* - @anthropic-ai/tokenizer for Claude
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Estimate GPT-4 tokens using character-based approximation
|
|
11
|
+
* GPT-4 typically uses ~4 characters per token for code/JSON
|
|
12
|
+
*/
|
|
13
|
+
export function estimateGPT4Tokens(text) {
|
|
14
|
+
return Math.ceil(text.length / 4);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Estimate Claude tokens using character-based approximation
|
|
18
|
+
* Claude typically uses ~4.5 characters per token for code/JSON
|
|
19
|
+
*/
|
|
20
|
+
export function estimateClaudeTokens(text) {
|
|
21
|
+
return Math.ceil(text.length / 4.5);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Format token count with commas for readability
|
|
25
|
+
*/
|
|
26
|
+
export function formatTokenCount(count) {
|
|
27
|
+
return count.toLocaleString();
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/utils/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,KAAK,CAAC,cAAc,EAAE,CAAC;AAChC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "logicstamp-context",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Generate AI-friendly context bundles from React codebases with LogicStamp contracts",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"stamp": "dist/cli/stamp.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"schema",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
"LLM_CONTEXT.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"prepublishOnly": "npm run build",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:watch": "vitest",
|
|
25
|
+
"test:ui": "vitest --ui",
|
|
26
|
+
"test:coverage": "vitest run --coverage"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"react",
|
|
30
|
+
"typescript",
|
|
31
|
+
"ai",
|
|
32
|
+
"llm",
|
|
33
|
+
"context",
|
|
34
|
+
"documentation",
|
|
35
|
+
"logicstamp",
|
|
36
|
+
"claude",
|
|
37
|
+
"chatgpt",
|
|
38
|
+
"codebase-analysis",
|
|
39
|
+
"ast",
|
|
40
|
+
"static-analysis"
|
|
41
|
+
],
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/LogicStamp/logicstamp-context.git"
|
|
45
|
+
},
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/LogicStamp/logicstamp-context/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/LogicStamp/logicstamp-context#readme",
|
|
50
|
+
"author": "LogicStamp Contributors",
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"glob": "^10.3.10",
|
|
57
|
+
"ts-morph": "^21.0.1"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/node": "^20.11.5",
|
|
61
|
+
"@vitest/coverage-v8": "^4.0.8",
|
|
62
|
+
"@vitest/ui": "^4.0.8",
|
|
63
|
+
"typescript": "^5.3.3",
|
|
64
|
+
"vitest": "^4.0.8"
|
|
65
|
+
},
|
|
66
|
+
"engines": {
|
|
67
|
+
"node": ">=18.0.0"
|
|
68
|
+
}
|
|
69
|
+
}
|