@npm7381/agent-doc-generator 1.0.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/README.md +75 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +299 -0
- package/dist/index.js.map +1 -0
- package/dist/src/aiClient.d.ts +38 -0
- package/dist/src/aiClient.d.ts.map +1 -0
- package/dist/src/aiClient.js +180 -0
- package/dist/src/aiClient.js.map +1 -0
- package/dist/src/cache.d.ts +7 -0
- package/dist/src/cache.d.ts.map +1 -0
- package/dist/src/cache.js +50 -0
- package/dist/src/cache.js.map +1 -0
- package/dist/src/configLoader.d.ts +15 -0
- package/dist/src/configLoader.d.ts.map +1 -0
- package/dist/src/configLoader.js +26 -0
- package/dist/src/configLoader.js.map +1 -0
- package/dist/src/docGenerator.d.ts +7 -0
- package/dist/src/docGenerator.d.ts.map +1 -0
- package/dist/src/docGenerator.js +68 -0
- package/dist/src/docGenerator.js.map +1 -0
- package/dist/src/fileProcessor.d.ts +10 -0
- package/dist/src/fileProcessor.d.ts.map +1 -0
- package/dist/src/fileProcessor.js +115 -0
- package/dist/src/fileProcessor.js.map +1 -0
- package/dist/src/htmlFormatter.d.ts +2 -0
- package/dist/src/htmlFormatter.d.ts.map +1 -0
- package/dist/src/htmlFormatter.js +54 -0
- package/dist/src/htmlFormatter.js.map +1 -0
- package/dist/src/pdfFormatter.d.ts +2 -0
- package/dist/src/pdfFormatter.d.ts.map +1 -0
- package/dist/src/pdfFormatter.js +44 -0
- package/dist/src/pdfFormatter.js.map +1 -0
- package/dist/src/prompts.d.ts +3 -0
- package/dist/src/prompts.d.ts.map +1 -0
- package/dist/src/prompts.js +83 -0
- package/dist/src/prompts.js.map +1 -0
- package/dist/src/providerDetector.d.ts +20 -0
- package/dist/src/providerDetector.d.ts.map +1 -0
- package/dist/src/providerDetector.js +145 -0
- package/dist/src/providerDetector.js.map +1 -0
- package/dist/src/types.d.ts +35 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CacheStore } from './types.js';
|
|
2
|
+
export declare function loadCache(projectRoot: string): CacheStore;
|
|
3
|
+
export declare function saveCache(projectRoot: string, cache: CacheStore): void;
|
|
4
|
+
export declare function computeFileHash(filePath: string): string;
|
|
5
|
+
export declare function isFileCached(filePath: string, cache: CacheStore, currentHash: string): boolean;
|
|
6
|
+
export declare function updateCache(filePath: string, docPath: string, hash: string, cache: CacheStore, content?: string): CacheStore;
|
|
7
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/cache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQ7C,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAWzD;AAED,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAQtE;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGxD;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAIT;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,UAAU,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,UAAU,CAQZ"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import crypto from 'crypto';
|
|
4
|
+
const CACHE_FILE = '.doc-cache.json';
|
|
5
|
+
function getCachePath(projectRoot) {
|
|
6
|
+
return path.join(projectRoot, CACHE_FILE);
|
|
7
|
+
}
|
|
8
|
+
export function loadCache(projectRoot) {
|
|
9
|
+
const cachePath = getCachePath(projectRoot);
|
|
10
|
+
try {
|
|
11
|
+
if (fs.existsSync(cachePath)) {
|
|
12
|
+
const data = fs.readFileSync(cachePath, 'utf-8');
|
|
13
|
+
return JSON.parse(data);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// Corrupted cache, start fresh
|
|
18
|
+
}
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
export function saveCache(projectRoot, cache) {
|
|
22
|
+
const cachePath = getCachePath(projectRoot);
|
|
23
|
+
try {
|
|
24
|
+
fs.writeFileSync(cachePath, JSON.stringify(cache, null, 2), 'utf-8');
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
const error = err;
|
|
28
|
+
console.warn(`[WARN] Could not save cache: ${error.message}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function computeFileHash(filePath) {
|
|
32
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
33
|
+
return crypto.createHash('md5').update(content).digest('hex');
|
|
34
|
+
}
|
|
35
|
+
export function isFileCached(filePath, cache, currentHash) {
|
|
36
|
+
const entry = cache[filePath];
|
|
37
|
+
if (!entry)
|
|
38
|
+
return false;
|
|
39
|
+
return entry.hash === currentHash;
|
|
40
|
+
}
|
|
41
|
+
export function updateCache(filePath, docPath, hash, cache, content) {
|
|
42
|
+
cache[filePath] = {
|
|
43
|
+
hash,
|
|
44
|
+
docPath,
|
|
45
|
+
content,
|
|
46
|
+
timestamp: Date.now(),
|
|
47
|
+
};
|
|
48
|
+
return cache;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/cache.ts"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MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,KAAiB,EACjB,WAAmB;IAEnB,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,QAAgB,EAChB,OAAe,EACf,IAAY,EACZ,KAAiB,EACjB,OAAgB;IAEhB,KAAK,CAAC,QAAQ,CAAC,GAAG;QAChB,IAAI;QACJ,OAAO;QACP,OAAO;QACP,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RCConfig {
|
|
2
|
+
provider?: string;
|
|
3
|
+
model?: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
maxChars?: number;
|
|
6
|
+
extensions?: string[];
|
|
7
|
+
format?: string;
|
|
8
|
+
output?: string;
|
|
9
|
+
split?: boolean;
|
|
10
|
+
dryRun?: boolean;
|
|
11
|
+
verbose?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function loadConfigFile(projectRoot: string): RCConfig | null;
|
|
14
|
+
export declare function mergeConfig<T>(cliValue: T | undefined, configValue: T | undefined, defaultValue: T): T;
|
|
15
|
+
//# sourceMappingURL=configLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configLoader.d.ts","sourceRoot":"","sources":["../../src/configLoader.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAID,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAWnE;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,SAAS,EAAE,WAAW,EAAE,CAAC,GAAG,SAAS,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,CAItG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
const CONFIG_FILE = '.aiconfig.json';
|
|
4
|
+
export function loadConfigFile(projectRoot) {
|
|
5
|
+
const configPath = path.join(projectRoot, CONFIG_FILE);
|
|
6
|
+
try {
|
|
7
|
+
if (!fs.existsSync(configPath))
|
|
8
|
+
return null;
|
|
9
|
+
const raw = fs.readFileSync(configPath, 'utf-8');
|
|
10
|
+
const config = JSON.parse(raw);
|
|
11
|
+
if (typeof config !== 'object' || config === null)
|
|
12
|
+
return null;
|
|
13
|
+
return config;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function mergeConfig(cliValue, configValue, defaultValue) {
|
|
20
|
+
if (cliValue !== undefined)
|
|
21
|
+
return cliValue;
|
|
22
|
+
if (configValue !== undefined)
|
|
23
|
+
return configValue;
|
|
24
|
+
return defaultValue;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=configLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configLoader.js","sourceRoot":"","sources":["../../src/configLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAexB,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC,MAAM,UAAU,cAAc,CAAC,WAAmB;IAChD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACvD,IAAI,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;YAAE,OAAO,IAAI,CAAC;QAC5C,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAa,CAAC;QAC3C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAI,QAAuB,EAAE,WAA0B,EAAE,YAAe;IACjG,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAC5C,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,WAAW,CAAC;IAClD,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createAIClient, GeminiClient, OpenAIClient, AnthropicClient, DeepSeekClient, OllamaClient } from './aiClient.js';
|
|
2
|
+
import type { AIClient } from './aiClient.js';
|
|
3
|
+
export { createAIClient, GeminiClient, OpenAIClient, AnthropicClient, DeepSeekClient, OllamaClient };
|
|
4
|
+
export type { AIClient };
|
|
5
|
+
export declare function generateDocumentation(ai: AIClient | null, filePath: string, content: string, verbose?: boolean, model?: string, maxChars?: number): Promise<string | null>;
|
|
6
|
+
export declare function extractDocContent(rawText: string | null | undefined): string;
|
|
7
|
+
//# sourceMappingURL=docGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docGenerator.d.ts","sourceRoot":"","sources":["../../src/docGenerator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1H,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC;AACrG,YAAY,EAAE,QAAQ,EAAE,CAAC;AAOzB,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,QAAQ,GAAG,IAAI,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,OAAe,EACxB,KAAK,GAAE,MAAsB,EAC7B,QAAQ,GAAE,MAAuB,GAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAyDxB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAS5E"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { getFileTypePrompt } from './prompts.js';
|
|
2
|
+
import { createAIClient, GeminiClient, OpenAIClient, AnthropicClient, DeepSeekClient, OllamaClient } from './aiClient.js';
|
|
3
|
+
export { createAIClient, GeminiClient, OpenAIClient, AnthropicClient, DeepSeekClient, OllamaClient };
|
|
4
|
+
const MAX_RETRIES = 3;
|
|
5
|
+
const RETRY_DELAY_MS = 2000;
|
|
6
|
+
const MAX_FILE_CHARS = 15000;
|
|
7
|
+
const DEFAULT_MODEL = 'gemini-2.5-flash';
|
|
8
|
+
export async function generateDocumentation(ai, filePath, content, verbose = false, model = DEFAULT_MODEL, maxChars = MAX_FILE_CHARS) {
|
|
9
|
+
if (!ai) {
|
|
10
|
+
console.error('[ERROR] AI model not initialized. Skipping documentation generation.');
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
if (content.length > maxChars) {
|
|
14
|
+
console.warn(`[WARN] ${filePath}: ${content.length} chars truncado a ${maxChars}.`);
|
|
15
|
+
}
|
|
16
|
+
const trimmedContent = content.length > maxChars
|
|
17
|
+
? content.slice(0, maxChars) + '\n// ... [truncated]'
|
|
18
|
+
: content;
|
|
19
|
+
const promptTemplate = getFileTypePrompt(filePath, trimmedContent);
|
|
20
|
+
const prompt = promptTemplate.replace('{CODE}', trimmedContent);
|
|
21
|
+
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
22
|
+
try {
|
|
23
|
+
if (verbose) {
|
|
24
|
+
console.log(`[INFO] Generating documentation (attempt ${attempt}/${MAX_RETRIES})...`);
|
|
25
|
+
}
|
|
26
|
+
const text = await ai.generate(prompt, model);
|
|
27
|
+
if (!text || text.trim().length === 0) {
|
|
28
|
+
throw new Error('Empty response from AI provider');
|
|
29
|
+
}
|
|
30
|
+
if (verbose)
|
|
31
|
+
console.log('[INFO] Documentation generated successfully.');
|
|
32
|
+
return text;
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
const error = err;
|
|
36
|
+
const isRateLimit = error.message?.includes('429') || error.message?.includes('RESOURCE_EXHAUSTED');
|
|
37
|
+
const isQuota = error.message?.includes('quota') || error.message?.includes('quotaExceeded');
|
|
38
|
+
if (isRateLimit || isQuota) {
|
|
39
|
+
const waitMs = RETRY_DELAY_MS * attempt;
|
|
40
|
+
console.warn(`[WARN] API rate limit hit. Retrying in ${waitMs / 1000}s... (attempt ${attempt}/${MAX_RETRIES})`);
|
|
41
|
+
await sleep(waitMs);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (attempt < MAX_RETRIES) {
|
|
45
|
+
console.warn(`[WARN] Attempt ${attempt} failed: ${error.message}. Retrying...`);
|
|
46
|
+
await sleep(RETRY_DELAY_MS);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
console.error(`[ERROR] All ${MAX_RETRIES} attempts failed for ${filePath}:`);
|
|
50
|
+
console.error(` ${error.message}`);
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
export function extractDocContent(rawText) {
|
|
57
|
+
if (!rawText)
|
|
58
|
+
return '';
|
|
59
|
+
const codeBlockMatch = rawText.match(/```[\w]*\n([\s\S]*?)```/);
|
|
60
|
+
if (codeBlockMatch) {
|
|
61
|
+
return codeBlockMatch[1].trim();
|
|
62
|
+
}
|
|
63
|
+
return rawText.trim();
|
|
64
|
+
}
|
|
65
|
+
function sleep(ms) {
|
|
66
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=docGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docGenerator.js","sourceRoot":"","sources":["../../src/docGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG1H,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC;AAGrG,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,cAAc,GAAG,KAAK,CAAC;AAC7B,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAEzC,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,EAAmB,EACnB,QAAgB,EAChB,OAAe,EACf,UA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,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FileData } from './types.js';
|
|
2
|
+
export declare function collectFiles(targetPath: string, verbose?: boolean, extensions?: string[]): string[];
|
|
3
|
+
export declare function readFile(filePath: string): FileData | null;
|
|
4
|
+
export declare function writeDocFile(originalFilePath: string, content: string, outputDir?: string): string | null;
|
|
5
|
+
export declare function writeSingleDocFile(targetDir: string, entries: {
|
|
6
|
+
relativePath: string;
|
|
7
|
+
content: string;
|
|
8
|
+
}[]): string | null;
|
|
9
|
+
export declare function shouldSkipContent(content: string): boolean;
|
|
10
|
+
//# sourceMappingURL=fileProcessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileProcessor.d.ts","sourceRoot":"","sources":["../../src/fileProcessor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAS3C,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAqB1G;AAkCD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAU1D;AAED,wBAAgB,YAAY,CAC1B,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CAkBf;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,GACnD,MAAM,GAAG,IAAI,CAmBf;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAK1D"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
const DEFAULT_EXTENSIONS = new Set(['.ts', '.tsx', '.js', '.jsx', '.prisma']);
|
|
4
|
+
const IGNORED_DIRS = new Set([
|
|
5
|
+
'node_modules', '.next', 'dist', 'build', '.git',
|
|
6
|
+
'.cache', 'coverage', '.turbo', '__pycache__',
|
|
7
|
+
]);
|
|
8
|
+
export function collectFiles(targetPath, verbose = false, extensions) {
|
|
9
|
+
const resolvedPath = path.resolve(targetPath);
|
|
10
|
+
const stats = fs.statSync(resolvedPath);
|
|
11
|
+
const validExts = extensions ? new Set(extensions.map(e => e.startsWith('.') ? e : `.${e}`)) : DEFAULT_EXTENSIONS;
|
|
12
|
+
if (stats.isFile()) {
|
|
13
|
+
if (!isValidExtension(resolvedPath, validExts)) {
|
|
14
|
+
console.warn(`[WARN] Skipping unsupported file type: ${resolvedPath}`);
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
if (verbose)
|
|
18
|
+
console.log(`[INFO] Processing single file: ${resolvedPath}`);
|
|
19
|
+
return [resolvedPath];
|
|
20
|
+
}
|
|
21
|
+
if (stats.isDirectory()) {
|
|
22
|
+
if (verbose)
|
|
23
|
+
console.log(`[INFO] Scanning directory: ${resolvedPath}`);
|
|
24
|
+
return collectDirRecursive(resolvedPath, verbose, validExts);
|
|
25
|
+
}
|
|
26
|
+
console.error(`[ERROR] Path is neither file nor directory: ${resolvedPath}`);
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
function collectDirRecursive(dirPath, verbose, validExts) {
|
|
30
|
+
const files = [];
|
|
31
|
+
try {
|
|
32
|
+
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
35
|
+
if (entry.isDirectory()) {
|
|
36
|
+
if (IGNORED_DIRS.has(entry.name)) {
|
|
37
|
+
if (verbose)
|
|
38
|
+
console.log(`[INFO] Skipping directory: ${entry.name}`);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
files.push(...collectDirRecursive(fullPath, verbose, validExts));
|
|
42
|
+
}
|
|
43
|
+
else if (entry.isFile() && isValidExtension(fullPath, validExts)) {
|
|
44
|
+
files.push(fullPath);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
const error = err;
|
|
50
|
+
console.error(`[ERROR] Cannot read directory ${dirPath}: ${error.message}`);
|
|
51
|
+
}
|
|
52
|
+
return files;
|
|
53
|
+
}
|
|
54
|
+
function isValidExtension(filePath, validExts) {
|
|
55
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
56
|
+
return validExts.has(ext);
|
|
57
|
+
}
|
|
58
|
+
export function readFile(filePath) {
|
|
59
|
+
try {
|
|
60
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
61
|
+
const relativePath = path.relative(process.cwd(), filePath);
|
|
62
|
+
return { filePath, relativePath, content };
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
const error = err;
|
|
66
|
+
console.error(`[ERROR] Cannot read file ${filePath}: ${error.message}`);
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export function writeDocFile(originalFilePath, content, outputDir) {
|
|
71
|
+
try {
|
|
72
|
+
const dir = outputDir || path.dirname(originalFilePath);
|
|
73
|
+
const baseName = path.basename(originalFilePath, path.extname(originalFilePath));
|
|
74
|
+
const docFileName = `${baseName}.docs.md`;
|
|
75
|
+
const docFilePath = path.join(dir, docFileName);
|
|
76
|
+
if (outputDir) {
|
|
77
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
78
|
+
}
|
|
79
|
+
fs.writeFileSync(docFilePath, content, 'utf-8');
|
|
80
|
+
return docFilePath;
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
const error = err;
|
|
84
|
+
console.error(`[ERROR] Cannot write documentation file: ${error.message}`);
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export function writeSingleDocFile(targetDir, entries) {
|
|
89
|
+
try {
|
|
90
|
+
const docPath = path.join(targetDir, 'DOCS.md');
|
|
91
|
+
const lines = ['# Documentación del Proyecto', '', `Generado: ${new Date().toLocaleDateString('es-AR')}`, '', '---', ''];
|
|
92
|
+
for (const entry of entries) {
|
|
93
|
+
lines.push(`## ${entry.relativePath}`, '');
|
|
94
|
+
lines.push(entry.content);
|
|
95
|
+
lines.push('');
|
|
96
|
+
lines.push('---', '');
|
|
97
|
+
}
|
|
98
|
+
fs.writeFileSync(docPath, lines.join('\n'), 'utf-8');
|
|
99
|
+
return docPath;
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
const error = err;
|
|
103
|
+
console.error(`[ERROR] Cannot write documentation file: ${error.message}`);
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export function shouldSkipContent(content) {
|
|
108
|
+
const trimmed = content.trim();
|
|
109
|
+
if (!trimmed)
|
|
110
|
+
return true;
|
|
111
|
+
if (trimmed.startsWith('// @ts-nocheck') && trimmed.length < 50)
|
|
112
|
+
return true;
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=fileProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileProcessor.js","sourceRoot":"","sources":["../../src/fileProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,kBAAkB,GAAG,IAA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AAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC/B,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,IAAI,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,IAAI,CAAC;IAC7E,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"htmlFormatter.d.ts","sourceRoot":"","sources":["../../src/htmlFormatter.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CA8CjG"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export function generateHtmlFromContent(content, title, agentName) {
|
|
2
|
+
return `<!DOCTYPE html>
|
|
3
|
+
<html lang="es">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>${title}</title>
|
|
8
|
+
<style>
|
|
9
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
10
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #1a1a2e; background: #f5f6fa; padding: 2rem; }
|
|
11
|
+
.container { max-width: 900px; margin: 0 auto; }
|
|
12
|
+
header { background: linear-gradient(135deg, #1a1a2e, #16213e); color: #fff; padding: 2rem; border-radius: 12px; margin-bottom: 2rem; }
|
|
13
|
+
header h1 { font-size: 1.8rem; margin-bottom: .5rem; }
|
|
14
|
+
.content { background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.06); padding: 2rem; line-height: 1.7; }
|
|
15
|
+
.content pre { background: #1a1a2e; color: #e2e8f0; padding: 1rem; border-radius: 8px; overflow-x: auto; font-size: .85rem; }
|
|
16
|
+
.content code { font-family: 'Fira Code', 'SF Mono', Consolas, monospace; background: #edf2f7; padding: .15rem .3rem; border-radius: 4px; font-size: .9em; }
|
|
17
|
+
.content pre code { background: transparent; padding: 0; }
|
|
18
|
+
.content h1 { font-size: 1.5rem; margin: 1.5rem 0 .75rem; color: #2d3748; }
|
|
19
|
+
.content h2 { font-size: 1.25rem; margin: 1.25rem 0 .5rem; color: #2d3748; }
|
|
20
|
+
.content p { margin-bottom: .75rem; color: #4a5568; }
|
|
21
|
+
.content ul, .content ol { margin: .5rem 0 .75rem 1.5rem; color: #4a5568; }
|
|
22
|
+
.content table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
|
|
23
|
+
.content th, .content td { border: 1px solid #e2e8f0; padding: .5rem; text-align: left; }
|
|
24
|
+
.content th { background: #edf2f7; font-weight: 600; }
|
|
25
|
+
footer { text-align: center; color: #a0aec0; font-size: .8rem; margin-top: 2rem; }
|
|
26
|
+
</style>
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<div class="container">
|
|
30
|
+
<header>
|
|
31
|
+
<h1>${title}</h1>
|
|
32
|
+
<p class="meta">Generado: ${new Date().toLocaleString('es-AR')} • ${agentName}</p>
|
|
33
|
+
</header>
|
|
34
|
+
<div class="content">${content.split('\n').map(line => {
|
|
35
|
+
if (line.startsWith('# '))
|
|
36
|
+
return `<h1>${line.slice(2)}</h1>`;
|
|
37
|
+
if (line.startsWith('## '))
|
|
38
|
+
return `<h2>${line.slice(3)}</h2>`;
|
|
39
|
+
if (line.startsWith('### '))
|
|
40
|
+
return `<h3>${line.slice(4)}</h3>`;
|
|
41
|
+
if (line.startsWith('- '))
|
|
42
|
+
return `<li>${line.slice(2)}</li>`;
|
|
43
|
+
if (line.startsWith('|'))
|
|
44
|
+
return line;
|
|
45
|
+
if (line.trim() === '')
|
|
46
|
+
return '<br>';
|
|
47
|
+
return `<p>${line}</p>`;
|
|
48
|
+
}).join('\n')}</div>
|
|
49
|
+
<footer>${agentName} • AI Agent Toolkit</footer>
|
|
50
|
+
</div>
|
|
51
|
+
</body>
|
|
52
|
+
</html>`;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=htmlFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"htmlFormatter.js","sourceRoot":"","sources":["../../src/htmlFormatter.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,uBAAuB,CAAC,OAAe,EAAE,KAAa,EAAE,SAAiB;IACvF,OAAO;;;;;WAKE,KAAK;;;;;;;;;;;;;;;;;;;;;;;;YAwBJ,KAAK;kCACiB,IAAI,IAAI,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,SAAS;;2BAExD,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACpD,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;QAC9D,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;YAAE,OAAO,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/D,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,OAAO,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;QAChE,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;QAC9D,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;YAAE,OAAO,MAAM,CAAC;QACtC,OAAO,MAAM,IAAI,MAAM,CAAC;IAC1B,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;cACH,SAAS;;;QAGf,CAAC;AACT,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdfFormatter.d.ts","sourceRoot":"","sources":["../../src/pdfFormatter.ts"],"names":[],"mappings":"AAGA,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqCjI"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import PDFDocument from 'pdfkit';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
export async function generatePdfFromContent(content, outputPath, title, agentName) {
|
|
4
|
+
const doc = new PDFDocument({ margin: 50, size: 'A4' });
|
|
5
|
+
const stream = fs.createWriteStream(outputPath);
|
|
6
|
+
doc.pipe(stream);
|
|
7
|
+
doc.fontSize(20).font('Helvetica-Bold').text(title, { align: 'center' });
|
|
8
|
+
doc.fontSize(11).font('Helvetica').text(`Generado: ${new Date().toLocaleString('es-AR')} • ${agentName}`, { align: 'center' });
|
|
9
|
+
doc.moveDown(1.5);
|
|
10
|
+
const lines = content.split('\n');
|
|
11
|
+
for (const line of lines) {
|
|
12
|
+
if (doc.y > 750)
|
|
13
|
+
doc.addPage();
|
|
14
|
+
if (line.startsWith('# ')) {
|
|
15
|
+
doc.fontSize(16).font('Helvetica-Bold').text(line.slice(2), { indent: 0 });
|
|
16
|
+
}
|
|
17
|
+
else if (line.startsWith('## ')) {
|
|
18
|
+
doc.fontSize(13).font('Helvetica-Bold').text(line.slice(3), { indent: 0 });
|
|
19
|
+
}
|
|
20
|
+
else if (line.startsWith('### ')) {
|
|
21
|
+
doc.fontSize(11).font('Helvetica-Bold').text(line.slice(4), { indent: 0 });
|
|
22
|
+
}
|
|
23
|
+
else if (line.startsWith('- ')) {
|
|
24
|
+
doc.fontSize(10).font('Helvetica').text(` • ${line.slice(2)}`, { indent: 10 });
|
|
25
|
+
}
|
|
26
|
+
else if (line.startsWith('|')) {
|
|
27
|
+
// skip table formatting in PDF for simplicity
|
|
28
|
+
}
|
|
29
|
+
else if (line.trim() === '') {
|
|
30
|
+
doc.moveDown(0.3);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
doc.fontSize(10).font('Helvetica').text(line, { indent: 0 });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
doc.moveDown(1);
|
|
37
|
+
doc.fontSize(8).font('Helvetica').fillColor('#999').text(`Generado por ${agentName} • AI Agent Toolkit`, { align: 'center' });
|
|
38
|
+
doc.end();
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
stream.on('finish', resolve);
|
|
41
|
+
stream.on('error', reject);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=pdfFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdfFormatter.js","sourceRoot":"","sources":["../../src/pdfFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,OAAe,EAAE,UAAkB,EAAE,KAAa,EAAE,SAAiB;IAChH,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAChD,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEjB,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IACzE,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entation for the given source code. Follow the conventions used in the task-manager-pro project.\n\n## Conventions to follow:\n- Use JSDoc format with /** */ blocks.\n- Include @param tags with types and descriptions.\n- Include @returns tags with type and description.\n- Include @example blocks when helpful.\n- For React components, describe the component and all its props.\n- For hooks, describe what state/behavior they manage.\n- For utility functions, describe the transformation logic.\n- For API routes/controllers, describe the endpoint, auth requirements, and response shape.\n- For Zod validators, describe the validation rules.\n- For TypeScript types/interfaces, describe each field.\n- For Prisma schemas, describe models and relations.\n\n## Response format:\nReturn ONLY the documented code wrapped in a markdown code block with the appropriate language tag. Preserve every line of the original code exactly as-is, prepending JSDoc comments above each export/function/component.";
|
|
2
|
+
export declare const getFileTypePrompt: (filePath: string, content: string) => string;
|
|
3
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/prompts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,klCAgBkM,CAAC;AAE7N,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,EAAE,SAAS,MAAM,KAAG,MA2DrE,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export const SYSTEM_PROMPT = `You are an expert code documentation assistant. Your task is to generate clear, comprehensive JSDoc documentation for the given source code. Follow the conventions used in the task-manager-pro project.
|
|
2
|
+
|
|
3
|
+
## Conventions to follow:
|
|
4
|
+
- Use JSDoc format with /** */ blocks.
|
|
5
|
+
- Include @param tags with types and descriptions.
|
|
6
|
+
- Include @returns tags with type and description.
|
|
7
|
+
- Include @example blocks when helpful.
|
|
8
|
+
- For React components, describe the component and all its props.
|
|
9
|
+
- For hooks, describe what state/behavior they manage.
|
|
10
|
+
- For utility functions, describe the transformation logic.
|
|
11
|
+
- For API routes/controllers, describe the endpoint, auth requirements, and response shape.
|
|
12
|
+
- For Zod validators, describe the validation rules.
|
|
13
|
+
- For TypeScript types/interfaces, describe each field.
|
|
14
|
+
- For Prisma schemas, describe models and relations.
|
|
15
|
+
|
|
16
|
+
## Response format:
|
|
17
|
+
Return ONLY the documented code wrapped in a markdown code block with the appropriate language tag. Preserve every line of the original code exactly as-is, prepending JSDoc comments above each export/function/component.`;
|
|
18
|
+
export const getFileTypePrompt = (filePath, content) => {
|
|
19
|
+
if (content.includes('@prisma/client') || filePath.includes('schema.prisma')) {
|
|
20
|
+
return createPrompt('Prisma Schema', `
|
|
21
|
+
Document each model, field, relation, enum, and index with JSDoc-style comments above each declaration.
|
|
22
|
+
For each field include: type, purpose, and any constraints (unique, default, relation).
|
|
23
|
+
For enums: list each value and its meaning.
|
|
24
|
+
Group related models with section comments.`);
|
|
25
|
+
}
|
|
26
|
+
if (content.includes('export const') && (content.includes('z.object') || content.includes('z.string'))) {
|
|
27
|
+
return createPrompt('Zod Validation Schema', `
|
|
28
|
+
Document each schema with its validation rules, field constraints (min, max, regex), and the inferred TypeScript type.
|
|
29
|
+
For each field describe: expected format, validation rules, and default values.`);
|
|
30
|
+
}
|
|
31
|
+
if (content.includes('@tanstack/react-query') || content.includes('useQuery') || content.includes('useMutation')) {
|
|
32
|
+
return createPrompt('React Query Hook', `
|
|
33
|
+
Document the hook's purpose, what data it fetches/caches, mutation behavior, optimistic updates, error handling, and return value.
|
|
34
|
+
List all parameters with types.`);
|
|
35
|
+
}
|
|
36
|
+
if (content.includes('React.createContext') || content.includes('createContext') || content.includes('.Provider')) {
|
|
37
|
+
return createPrompt('React Context Provider', `
|
|
38
|
+
Document the context purpose, the provider component and its props, the context value shape, and how to consume it via the custom hook.
|
|
39
|
+
Include usage example.`);
|
|
40
|
+
}
|
|
41
|
+
if (content.includes('React.FC') || content.includes('(): JSX') || (content.includes('=> {') && content.includes('<') && content.includes('/>'))) {
|
|
42
|
+
return createPrompt('React Component', `
|
|
43
|
+
Document the component's purpose, all props (with types and descriptions), rendering logic, states (loading, empty, error, success), and side effects.
|
|
44
|
+
Include a usage example showing how to import and render the component with its props.`);
|
|
45
|
+
}
|
|
46
|
+
if (content.includes('Request, Response') || content.includes('express.Router') || content.includes('RequestHandler')) {
|
|
47
|
+
return createPrompt('Express Route / Controller', `
|
|
48
|
+
For each route handler document: HTTP method, path, authentication requirements, request body/params/query schema, response shape on success and error, and which services it calls.
|
|
49
|
+
Include the response envelope format.`);
|
|
50
|
+
}
|
|
51
|
+
if (content.includes('export function') || content.includes('export const') || content.includes('export async function')) {
|
|
52
|
+
return createPrompt('Utility / Service Module', `
|
|
53
|
+
Document each exported function: its purpose, parameters (with types), return value (with type), and any side effects or error conditions.
|
|
54
|
+
Include @example blocks showing typical usage.`);
|
|
55
|
+
}
|
|
56
|
+
if (content.includes('interface ') || content.includes('type ') || filePath.includes('types/')) {
|
|
57
|
+
return createPrompt('TypeScript Type Definitions', `
|
|
58
|
+
Document each interface, type alias, and enum: their purpose, each field with its type and description.
|
|
59
|
+
Note which types are used as DTOs, API responses, or domain models.`);
|
|
60
|
+
}
|
|
61
|
+
if (content.includes('socket.io') || content.includes('io(') || content.includes('Server as SocketIOServer')) {
|
|
62
|
+
return createPrompt('Socket.IO Handler', `
|
|
63
|
+
Document the socket events, authentication flow, room management, event payload shapes, and client connection lifecycle.`);
|
|
64
|
+
}
|
|
65
|
+
return createPrompt('Generic Module', `
|
|
66
|
+
Document each export: purpose, parameters, return value, and error handling.
|
|
67
|
+
Include @example for the main exports.`);
|
|
68
|
+
};
|
|
69
|
+
function createPrompt(fileType, specificInstructions) {
|
|
70
|
+
return `${SYSTEM_PROMPT}
|
|
71
|
+
|
|
72
|
+
## File Type: ${fileType}
|
|
73
|
+
|
|
74
|
+
${specificInstructions}
|
|
75
|
+
|
|
76
|
+
## Code to document:
|
|
77
|
+
\`\`\`
|
|
78
|
+
{CODE}
|
|
79
|
+
\`\`\`
|
|
80
|
+
|
|
81
|
+
Return ONLY the fully documented code in a single markdown code block. Do not include any extra text or explanations.`;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@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AoB;;;;;;;sHAOgG,CAAC;AACvH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ProviderConfig {
|
|
2
|
+
provider: string;
|
|
3
|
+
model: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
autoDetected: boolean;
|
|
6
|
+
detectedAt: string;
|
|
7
|
+
}
|
|
8
|
+
export interface DetectOptions {
|
|
9
|
+
env?: Record<string, string | undefined>;
|
|
10
|
+
ollamaBaseUrl?: string;
|
|
11
|
+
projectRoot?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function detectProvider(options?: DetectOptions): Promise<ProviderConfig | null>;
|
|
14
|
+
export declare function detectOllama(baseUrl?: string): Promise<string[] | null>;
|
|
15
|
+
export declare function loadConfig(projectRoot: string): ProviderConfig | null;
|
|
16
|
+
export declare function saveConfig(projectRoot: string, config: ProviderConfig): void;
|
|
17
|
+
export declare function getDefaultModel(provider: string): string;
|
|
18
|
+
export declare function getAvailableProviders(env?: Record<string, string | undefined>): string[];
|
|
19
|
+
export declare function printDetectionResult(config: ProviderConfig | null, verbose?: boolean): void;
|
|
20
|
+
//# sourceMappingURL=providerDetector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerDetector.d.ts","sourceRoot":"","sources":["../../src/providerDetector.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAcD,wBAAsB,cAAc,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAyDhG;AAED,wBAAsB,YAAY,CAAC,OAAO,GAAE,MAA2B,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAWjG;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAWrE;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAG5E;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,qBAAqB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,EAAE,CAYxF;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,EAAE,OAAO,GAAE,OAAe,GAAG,IAAI,CA8BlG"}
|