legacyver 3.1.0 → 3.2.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.
Files changed (71) hide show
  1. package/bin/legacyver.js +1 -1
  2. package/legacyver-docs/SUMMARY.md +3 -3
  3. package/legacyver-docs/index.md +15 -15
  4. package/legacyver-docs/legacyver.md +49 -0
  5. package/package.json +1 -1
  6. package/src/cli/commands/init.js +34 -4
  7. package/src/cli/commands/providers.js +20 -23
  8. package/src/cli/ui.js +19 -9
  9. package/src/llm/providers/groq.js +4 -2
  10. package/src/llm/validator.js +1 -1
  11. package/src/utils/config.js +1 -1
  12. package/legacyver-docs/OrderController.md +0 -80
  13. package/legacyver-docs/bin/legacyver.md +0 -107
  14. package/legacyver-docs/src/api/auth.md +0 -47
  15. package/legacyver-docs/src/cache/hash.md +0 -24
  16. package/legacyver-docs/src/cache/index.md +0 -112
  17. package/legacyver-docs/src/cli/commands/analyze.md +0 -58
  18. package/legacyver-docs/src/cli/commands/cache.md +0 -21
  19. package/legacyver-docs/src/cli/commands/init.md +0 -42
  20. package/legacyver-docs/src/cli/commands/login.md +0 -70
  21. package/legacyver-docs/src/cli/commands/logout.md +0 -26
  22. package/legacyver-docs/src/cli/commands/providers.md +0 -23
  23. package/legacyver-docs/src/cli/commands/push.md +0 -48
  24. package/legacyver-docs/src/cli/commands/version.md +0 -26
  25. package/legacyver-docs/src/cli/ui.md +0 -112
  26. package/legacyver-docs/src/crawler/filters.md +0 -54
  27. package/legacyver-docs/src/crawler/index.md +0 -54
  28. package/legacyver-docs/src/crawler/manifest.md +0 -22
  29. package/legacyver-docs/src/crawler/walk.md +0 -29
  30. package/legacyver-docs/src/db/config.md +0 -13
  31. package/legacyver-docs/src/db/index.md +0 -86
  32. package/legacyver-docs/src/llm/chunker.md +0 -28
  33. package/legacyver-docs/src/llm/cost-estimator.md +0 -62
  34. package/legacyver-docs/src/llm/free-model.md +0 -40
  35. package/legacyver-docs/src/llm/index.md +0 -29
  36. package/legacyver-docs/src/llm/prompts.md +0 -150
  37. package/legacyver-docs/src/llm/providers/gemini.md +0 -51
  38. package/legacyver-docs/src/llm/providers/groq.md +0 -76
  39. package/legacyver-docs/src/llm/providers/kimi.md +0 -48
  40. package/legacyver-docs/src/llm/providers/ollama.md +0 -50
  41. package/legacyver-docs/src/llm/providers/openrouter.md +0 -55
  42. package/legacyver-docs/src/llm/queue.md +0 -41
  43. package/legacyver-docs/src/llm/re-prompter.md +0 -33
  44. package/legacyver-docs/src/llm/validator.md +0 -34
  45. package/legacyver-docs/src/parser/ast/generic.md +0 -34
  46. package/legacyver-docs/src/parser/ast/go.md +0 -59
  47. package/legacyver-docs/src/parser/ast/java.md +0 -58
  48. package/legacyver-docs/src/parser/ast/javascript.md +0 -71
  49. package/legacyver-docs/src/parser/ast/laravel/blade.md +0 -45
  50. package/legacyver-docs/src/parser/ast/laravel/classifier.md +0 -29
  51. package/legacyver-docs/src/parser/ast/laravel/controller.md +0 -57
  52. package/legacyver-docs/src/parser/ast/laravel/index.md +0 -27
  53. package/legacyver-docs/src/parser/ast/laravel/model.md +0 -34
  54. package/legacyver-docs/src/parser/ast/laravel/provider.md +0 -31
  55. package/legacyver-docs/src/parser/ast/laravel/routes.md +0 -31
  56. package/legacyver-docs/src/parser/ast/php.md +0 -127
  57. package/legacyver-docs/src/parser/ast/python.md +0 -62
  58. package/legacyver-docs/src/parser/ast/typescript.md +0 -22
  59. package/legacyver-docs/src/parser/body-extractor.md +0 -34
  60. package/legacyver-docs/src/parser/call-graph.md +0 -45
  61. package/legacyver-docs/src/parser/complexity-scorer.md +0 -25
  62. package/legacyver-docs/src/parser/index.md +0 -59
  63. package/legacyver-docs/src/parser/pattern-detector.md +0 -28
  64. package/legacyver-docs/src/parser/pkg-builder.md +0 -34
  65. package/legacyver-docs/src/renderer/html.md +0 -36
  66. package/legacyver-docs/src/renderer/index.md +0 -26
  67. package/legacyver-docs/src/renderer/json.md +0 -25
  68. package/legacyver-docs/src/renderer/markdown.md +0 -77
  69. package/legacyver-docs/src/utils/config.md +0 -62
  70. package/legacyver-docs/src/utils/errors.md +0 -53
  71. package/legacyver-docs/src/utils/logger.md +0 -48
package/bin/legacyver.js CHANGED
@@ -21,7 +21,7 @@ program
21
21
  .option('--out <dir>', 'Output directory (default: ./legacyver-docs)')
22
22
  .option('--format <fmt>', 'Output format: markdown | html | json (default: markdown)')
23
23
  .option('--model <model>', 'LLM model to use')
24
- .option('--provider <provider>', 'LLM provider: openrouter | groq | gemini | kimi | ollama (default: openrouter)')
24
+ .option('--provider <provider>', 'LLM provider: groq | openrouter | gemini | kimi | ollama (default: groq)')
25
25
  .option('--concurrency <n>', 'Concurrent LLM requests 1-10 (default: 3)')
26
26
  .option('--dry-run', 'Run AST parsing only, no LLM calls')
27
27
  .option('--incremental', 'Only re-analyze changed files')
@@ -1,3 +1,3 @@
1
- # Summary
2
-
3
- * [OrderController.php](OrderController.md)
1
+ # Summary
2
+
3
+ * [legacyver.js](legacyver.md)
@@ -1,15 +1,15 @@
1
- # Controllers — Documentation
2
-
3
- **Primary language:** php
4
- **Total files:** 1
5
- **Analyzed at:** 2026-02-22T03:45:37.186Z
6
-
7
- ## Files
8
-
9
- - [OrderController.php](OrderController.md)
10
-
11
- ## Dependency Graph
12
-
13
- ```mermaid
14
- graph TD
15
- ```
1
+ # bin — Documentation
2
+
3
+ **Primary language:** javascript
4
+ **Total files:** 1
5
+ **Analyzed at:** 2026-03-21T11:31:12.941Z
6
+
7
+ ## Files
8
+
9
+ - [legacyver.js](legacyver.md)
10
+
11
+ ## Dependency Graph
12
+
13
+ ```mermaid
14
+ graph TD
15
+ ```
@@ -0,0 +1,49 @@
1
+ ## Overview
2
+ `legacyver.js` is the entry point for the **legacyver** command‑line interface. It configures the `commander` program, loads the package version, registers all supported sub‑commands (analyze, init, providers, cache, login, logout, push) and parses the command‑line arguments.
3
+
4
+ ## Functions
5
+ The file does not declare any JavaScript functions of its own. It only wires together imported command‑handler functions (e.g., `analyzeCmd`, `initCmd`, …) with the `commander` program.
6
+
7
+ ## Dependencies
8
+ - **commander** – `program` is used to define the CLI, its options, and sub‑commands.
9
+ - **fs** – `readFileSync` reads `package.json` to obtain the current version.
10
+ - **path** – `join` builds the path to `package.json`.
11
+ - **../src/cli/commands/analyze** – handler for the `analyze` command (`analyzeCmd`).
12
+ - **../src/cli/commands/init** – handler for the `init` command (`initCmd`).
13
+ - **../src/cli/commands/providers** – handler for the `providers` command (`providersCmd`).
14
+ - **../src/cli/commands/cache** – handler for the `cache clear` sub‑command (`cacheCmd`).
15
+ - **../src/cli/commands/login** – handler for the `login` command (`loginCmd`).
16
+ - **../src/cli/commands/logout** – handler for the `logout` command (`logoutCmd`).
17
+ - **../src/cli/commands/push** – handler for the `push` command (`pushCmd`).
18
+
19
+ ## Usage Example
20
+ ```bash
21
+ # Show version and help
22
+ legacyver -V
23
+ legacyver --help
24
+
25
+ # Analyze a codebase and write markdown docs to the default output folder
26
+ legacyver analyze ./src \
27
+ --out ./legacyver-docs \
28
+ --format markdown \
29
+ --provider groq \
30
+ --concurrency 3
31
+
32
+ # Run the interactive setup wizard
33
+ legacyver init
34
+
35
+ # List available LLM providers and models
36
+ legacyver providers
37
+
38
+ # Clear the incremental analysis cache
39
+ legacyver cache clear
40
+
41
+ # Log in to the cloud sync service
42
+ legacyver login
43
+
44
+ # Log out of the cloud sync service
45
+ legacyver logout
46
+
47
+ # Push already‑generated documentation to the cloud
48
+ legacyver push ./legacyver-docs --out ./legacyver-docs
49
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "legacyver",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "AI-powered CLI tool to auto-generate technical documentation from legacy/undocumented codebases",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -24,8 +24,8 @@ module.exports = async function initCommand() {
24
24
  }
25
25
  }
26
26
 
27
- const providerRaw = await ask(rl, `LLM provider [openrouter/groq/gemini/kimi/ollama] (default: openrouter): `);
28
- const providerChoice = providerRaw.trim() || 'openrouter';
27
+ const providerRaw = await ask(rl, `LLM provider [groq/openrouter/gemini/kimi/ollama] (default: groq): `);
28
+ const providerChoice = providerRaw.trim() || 'groq';
29
29
  const isOllama = providerChoice === 'ollama';
30
30
  const isGroq = providerChoice === 'groq';
31
31
  const isGemini = providerChoice === 'gemini';
@@ -34,7 +34,7 @@ module.exports = async function initCommand() {
34
34
  const defaultModel = isOllama
35
35
  ? 'llama3.2'
36
36
  : isGroq
37
- ? 'llama-3.3-70b-versatile'
37
+ ? 'openai/gpt-oss-120b'
38
38
  : isGemini
39
39
  ? 'gemini-2.0-flash'
40
40
  : isKimi
@@ -75,6 +75,35 @@ module.exports = async function initCommand() {
75
75
  writeFileSync(rcPath, JSON.stringify(config, null, 2), 'utf8');
76
76
  console.log(pc.green('\n✓ Created .legacyverrc'));
77
77
 
78
+ // If user left key blank, show how to set env var (cross-platform)
79
+ if (!isOllama && !apiKey.trim()) {
80
+ const isWin = process.platform === 'win32';
81
+ const envVarMap = {
82
+ groq: { varName: 'GROQ_API_KEY', url: 'https://console.groq.com/keys' },
83
+ openrouter: { varName: 'OPENROUTER_API_KEY', url: 'https://openrouter.ai/keys' },
84
+ gemini: { varName: 'GEMINI_API_KEY', url: 'https://aistudio.google.com/apikey' },
85
+ kimi: { varName: 'MOONSHOT_API_KEY', url: 'https://platform.moonshot.cn/console/api-keys' },
86
+ };
87
+ const envInfo = envVarMap[providerChoice] || envVarMap['openrouter'];
88
+
89
+ console.log('');
90
+ if (isGroq) {
91
+ console.log(pc.dim('i No key entered — using built-in Groq key (openai/gpt-oss-120b).'));
92
+ console.log(pc.dim(' For higher rate limits, set your own key:'));
93
+ } else {
94
+ console.log(pc.yellow(`! No API key saved. Set ${envInfo.varName} before running analyze.`));
95
+ console.log(pc.dim(` Get a key: ${envInfo.url}`));
96
+ }
97
+ console.log('');
98
+ if (isWin) {
99
+ console.log(pc.dim(` PowerShell: $env:${envInfo.varName} = "your_key"`));
100
+ console.log(pc.dim(` CMD: set ${envInfo.varName}=your_key`));
101
+ } else {
102
+ console.log(pc.dim(` Mac/Linux: export ${envInfo.varName}=your_key`));
103
+ }
104
+ console.log(pc.dim(' Or re-run: legacyver init (enter the key when prompted)'));
105
+ }
106
+
78
107
  const exampleCmd = isOllama
79
108
  ? 'legacyver analyze --provider ollama'
80
109
  : isGroq
@@ -83,6 +112,7 @@ module.exports = async function initCommand() {
83
112
  ? 'legacyver analyze --provider gemini'
84
113
  : isKimi
85
114
  ? 'legacyver analyze --provider kimi'
86
- : 'legacyver analyze'; // openrouter is the default, no flag needed
115
+ : 'legacyver analyze';
87
116
  console.log(pc.cyan(`\nRun \`${exampleCmd}\` to generate documentation.`));
88
117
  };
118
+
@@ -3,14 +3,13 @@
3
3
  const pc = require('picocolors');
4
4
  const logger = require('../../utils/logger');
5
5
 
6
- const RECOMMENDED_MODELS = [
7
- { id: 'meta-llama/llama-3.1-8b-instruct', context: '16k', inputCost: 0.02, outputCost: 0.05, free: false },
8
- { id: 'anthropic/claude-haiku-3-5', context: '200k', inputCost: 0.80, outputCost: 4.00, free: false },
9
- { id: 'anthropic/claude-sonnet-4-5', context: '200k', inputCost: 3.00, outputCost: 15.00, free: false },
10
- { id: 'openai/gpt-4o-mini', context: '128k', inputCost: 0.15, outputCost: 0.60, free: false },
11
- { id: 'openai/gpt-4o', context: '128k', inputCost: 5.00, outputCost: 15.00, free: false },
12
- { id: 'google/gemini-flash-1.5', context: '1M', inputCost: 0.075, outputCost: 0.30, free: false },
13
- { id: 'mistralai/mistral-7b-instruct:free', context: '32k', inputCost: 0, outputCost: 0, free: true },
6
+ const GROQ_MODELS = [
7
+ { id: 'openai/gpt-oss-120b', context: '128k', isDefault: true },
8
+ { id: 'llama-3.3-70b-versatile', context: '128k', isDefault: false },
9
+ { id: 'llama-3.1-8b-instant', context: '128k', isDefault: false },
10
+ { id: 'meta-llama/llama-4-scout-17b-16e-instruct', context: '128k', isDefault: false },
11
+ { id: 'meta-llama/llama-4-maverick-17b-128e-instruct', context: '128k', isDefault: false },
12
+ { id: 'gemma2-9b-it', context: '8k', isDefault: false },
14
13
  ];
15
14
 
16
15
  module.exports = async function providersCommand() {
@@ -30,9 +29,10 @@ module.exports = async function providersCommand() {
30
29
 
31
30
  console.log(pc.bold('Legacyver — Supported LLM Providers\n'));
32
31
 
33
- console.log(pc.bold('Groq') + ' (https://groq.com)');
34
- console.log(' Fastest free LLM inference. 30 req/min, 14,400 req/day. Set GROQ_API_KEY env variable.');
35
- console.log(' Status: ' + (process.env.GROQ_API_KEY ? pc.green('API key detected') : pc.yellow('No API key found')));
32
+ console.log(pc.bold('Groq') + pc.green(' [DEFAULT]') + ' (https://groq.com)');
33
+ console.log(' Fastest free LLM inference. 30 req/min, 14,400 req/day.');
34
+ console.log(' Default model: ' + pc.cyan('openai/gpt-oss-120b') + ' override with your own GROQ_API_KEY for higher limits.');
35
+ console.log(' Status: ' + (process.env.GROQ_API_KEY ? pc.green('Own API key detected ✓') : pc.dim('Using built-in shared key (set GROQ_API_KEY for higher rate limits)')));
36
36
  console.log(' Get a free key at: https://console.groq.com/keys');
37
37
  console.log('');
38
38
  console.log(pc.bold('Google Gemini') + ' (https://ai.google.dev)');
@@ -45,7 +45,7 @@ module.exports = async function providersCommand() {
45
45
  console.log(' Status: ' + (process.env.MOONSHOT_API_KEY ? pc.green('API key detected') : pc.yellow('No API key found')));
46
46
  console.log(' Get a key at: https://platform.moonshot.cn/console/api-keys');
47
47
  console.log('');
48
- console.log(pc.bold('OpenRouter') + pc.green(' [DEFAULT]') + ' (https://openrouter.ai)');
48
+ console.log(pc.bold('OpenRouter') + ' (https://openrouter.ai)');
49
49
  console.log(' Unified gateway to 200+ models (Claude, GPT-4o, Llama, etc). Set OPENROUTER_API_KEY env variable.');
50
50
  console.log(' Status: ' + (process.env.OPENROUTER_API_KEY ? pc.green('API key detected') : pc.yellow('No API key found')));
51
51
  console.log(' Get a key at: https://openrouter.ai/keys');
@@ -54,23 +54,20 @@ module.exports = async function providersCommand() {
54
54
  console.log(' Local offline LLM. No API key required. Run `ollama serve` first.');
55
55
  console.log('');
56
56
 
57
- console.log(pc.bold('Recommended Models (via OpenRouter):'));
57
+ console.log(pc.bold('Available Groq Models (free, no key required):'));
58
58
  console.log('');
59
- const header = ` ${'Model ID'.padEnd(48)} ${'Context'.padEnd(8)} ${'Input $/1M'.padEnd(12)} ${'Output $/1M'.padEnd(12)}`;
59
+ const header = ` ${'Model ID'.padEnd(52)} ${'Context'.padEnd(8)}`;
60
60
  console.log(pc.dim(header));
61
- console.log(pc.dim(' ' + '-'.repeat(84)));
61
+ console.log(pc.dim(' ' + '-'.repeat(62)));
62
62
 
63
- for (const m of RECOMMENDED_MODELS) {
64
- const badge = m.free ? pc.green(' [FREE]') : '';
63
+ for (const m of GROQ_MODELS) {
64
+ const defaultBadge = m.isDefault ? pc.green(' [DEFAULT]') : '';
65
65
  const selected = m.id === config.model ? pc.cyan(' ◀ selected') : '';
66
- const inputCostStr = m.free ? 'FREE' : `$${m.inputCost.toFixed(3)}`;
67
- const outputCostStr = m.free ? 'FREE' : `$${m.outputCost.toFixed(3)}`;
68
- console.log(
69
- ` ${m.id.padEnd(48)} ${m.context.padEnd(8)} ${inputCostStr.padEnd(12)} ${outputCostStr.padEnd(12)}${badge}${selected}`
70
- );
66
+ console.log(` ${m.id.padEnd(52)} ${m.context.padEnd(8)}${defaultBadge}${selected}`);
71
67
  }
72
68
 
73
69
  console.log('');
74
- console.log(pc.dim('Fetch live model list from OpenRouter: https://openrouter.ai/api/v1/models'));
70
+ console.log(pc.dim('Full Groq model list: https://console.groq.com/docs/models'));
71
+ console.log(pc.dim('For premium models (Claude, GPT-4o, etc.) use --provider openrouter'));
75
72
  console.log('');
76
73
  };
package/src/cli/ui.js CHANGED
@@ -102,18 +102,28 @@ function printSummary(stats) {
102
102
  process.env.OPENROUTER_API_KEY
103
103
  );
104
104
  if (!usingOwnKey) {
105
+ const isWin = process.platform === 'win32';
105
106
  console.log(pc.dim('─────────────────────────────────────────────────'));
106
- console.log(pc.cyan(' Bring your own API key for better results:'));
107
+ console.log(pc.cyan(' Running on built-in Groq key') + pc.dim(' (openai/gpt-oss-120b)'));
107
108
  console.log('');
108
- console.log(` ${pc.bold('Free tiers')} more quota, same zero cost`);
109
- console.log(pc.dim(' Groq: https://console.groq.com/keys'));
110
- console.log(pc.dim(' Gemini: https://aistudio.google.com/apikey'));
109
+ console.log(' To get higher rate limits, set your own free Groq key:');
110
+ console.log(pc.dim(' Get key: https://console.groq.com/keys'));
111
+ if (isWin) {
112
+ console.log(pc.dim(' PowerShell: $env:GROQ_API_KEY = "your_key"'));
113
+ console.log(pc.dim(' CMD: set GROQ_API_KEY=your_key'));
114
+ } else {
115
+ console.log(pc.dim(' Mac/Linux: export GROQ_API_KEY=your_key'));
116
+ }
117
+ console.log(pc.dim(' Or run: legacyver init'));
111
118
  console.log('');
112
- console.log(` ${pc.bold('Premium')} smarter models (Claude, GPT-4o, etc.)`);
113
- console.log(pc.dim(' OpenRouter: https://openrouter.ai/keys'));
114
- console.log(pc.dim(' Access 200+ models, pay only for what you use.'));
115
- console.log('');
116
- console.log(pc.dim(' Run `legacyver init` to set your key, then:'));
119
+ console.log(` ${pc.bold('Want premium models?')} (Claude, GPT-4o, etc.)`);
120
+ console.log(pc.dim(' Get key: https://openrouter.ai/keys'));
121
+ if (isWin) {
122
+ console.log(pc.dim(' PowerShell: $env:OPENROUTER_API_KEY = "your_key"'));
123
+ console.log(pc.dim(' CMD: set OPENROUTER_API_KEY=your_key'));
124
+ } else {
125
+ console.log(pc.dim(' Mac/Linux: export OPENROUTER_API_KEY=your_key'));
126
+ }
117
127
  console.log(pc.dim(' legacyver analyze --provider openrouter --model anthropic/claude-haiku-3-5'));
118
128
  console.log(pc.dim('─────────────────────────────────────────────────'));
119
129
  console.log('');
@@ -3,10 +3,12 @@
3
3
  const { NoApiKeyError } = require('../../utils/errors');
4
4
 
5
5
  const GROQ_BASE = 'https://api.groq.com/openai/v1';
6
- const DEFAULT_MODEL = 'llama-3.3-70b-versatile';
6
+ const DEFAULT_MODEL = 'openai/gpt-oss-120b';
7
7
  // Built-in shared key — lets users run legacyver out of the box without setup.
8
8
  // Users can override with their own GROQ_API_KEY env var for higher rate limits.
9
- const BUILT_IN_KEY = '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';
9
+ // Groq does NOT auto-revoke keys found in public packages (unlike OpenRouter).
10
+ const BUILT_IN_KEY = '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';
11
+
10
12
  class GroqProvider {
11
13
  constructor(config) {
12
14
  this.apiKey = process.env.GROQ_API_KEY || config.groqApiKey || BUILT_IN_KEY;
@@ -47,7 +47,7 @@ function validateFragment(fragment, fileFacts) {
47
47
  'Dependencies', 'Dependency', 'Async', 'Static', 'Public', 'Private', 'Protected',
48
48
  'Boolean', 'String', 'Number', 'Object', 'Array', 'Void', 'Null', 'Undefined',
49
49
  'True', 'False', 'Error', 'Promise', 'Request', 'Response',
50
- 'Node', 'JavaScript', 'TypeScript', 'PHP', 'Python',
50
+ 'Node', 'JavaScript', 'TypeScript', 'PHP', 'Python', 'PostgreSQL',
51
51
  'Laravel', 'Express', 'Route', 'Controller', 'Model', 'Service', 'Repository',
52
52
  'Middleware', 'Provider', 'Summary', 'None', 'Name', 'Description', 'Value', 'Type',
53
53
  'Map', 'Set', 'Date',
@@ -59,7 +59,7 @@ function loadConfig(cliFlags = {}) {
59
59
  }
60
60
 
61
61
  const defaults = {
62
- provider: 'openrouter',
62
+ provider: 'groq',
63
63
  model: undefined,
64
64
  format: 'markdown',
65
65
  out: './legacyver-docs',
@@ -1,80 +0,0 @@
1
- ## Overview
2
- This is the `OrderController` class, responsible for handling CRUD (Create, Read, Update, Delete) operations on orders. It provides a RESTful API interface to interact with the order data.
3
-
4
- ## Functions
5
-
6
- ### index
7
- #### Description
8
- Returns a paginated list of orders.
9
- #### Parameters
10
- | Parameter | Type | Required |
11
- | --- | --- | --- |
12
- | `paginate` | int | - |
13
- | `response` | object | - |
14
- | `json` | function | - |
15
-
16
- #### Return Value
17
- A `JsonResponse` containing the paginated list of orders.
18
-
19
- ### store
20
- #### Description
21
- Creates a new order and returns its details.
22
- #### Parameters
23
- | Parameter | Type | Required |
24
- | --- | --- | --- |
25
- | `$request:StoreOrderRequest` | object | Yes |
26
-
27
- #### Return Value
28
- A `JsonResponse` with the created order data and HTTP status code 201.
29
-
30
- ### show
31
- #### Description
32
- Returns a single order by its ID.
33
- #### Parameters
34
- | Parameter | Type | Required |
35
- | --- | --- | --- |
36
- | `$id:int` | int | Yes |
37
-
38
- #### Return Value
39
- A `JsonResponse` containing the order details.
40
-
41
- ### update
42
- #### Description
43
- Updates an existing order.
44
- #### Parameters
45
- | Parameter | Type | Required |
46
- | --- | --- | --- |
47
- | `$request:UpdateOrderRequest` | object | Yes |
48
- | `$id:int` | int | Yes |
49
-
50
- #### Return Value
51
- A `JsonResponse` with the updated order data.
52
-
53
- ### destroy
54
- #### Description
55
- Deletes an existing order.
56
- #### Parameters
57
- | Parameter | Type | Required |
58
- | --- | --- | --- |
59
- | `$id:int` | int | Yes |
60
-
61
- #### Return Value
62
- A `JsonResponse` with HTTP status code 204.
63
-
64
- ## Dependencies
65
-
66
- * `App\Models\Order`
67
- * `App\Models\User`
68
- * `App\Http\Requests\StoreOrderRequest`
69
- * `App\Http\Requests\UpdateOrderRequest`
70
- * `App\Services\OrderService`
71
- * `Illuminate\Http\JsonResponse`
72
-
73
- ## Usage Example
74
- ```php
75
- $orderController = new OrderController();
76
- $orders = $orderController->index(); // returns paginated list of orders
77
-
78
- $order = $orderController->store(new StoreOrderRequest(['name' => 'New Order'])); // creates and returns order details
79
- ```
80
- Note: The usage example is just a demonstration and should be replaced with actual usage scenarios.
@@ -1,107 +0,0 @@
1
- ## Overview
2
- The `legacyver` CLI tool is an AI-powered tool for auto-generating technical documentation from legacy/undocumented codebases. It provides various commands for analysis, initialization, provider management, caching, login, logout, and pushing documentation to the cloud.
3
-
4
- ## Functions
5
- ### `analyzeCmd`
6
- #### Description
7
- Analyze a directory and generate documentation.
8
-
9
- #### Parameters
10
- | Name | Type | Description |
11
- | --- | --- | --- |
12
- | `target` | string | The directory to analyze. |
13
- | `--out <dir>` | string | Output directory (default: `./legacyver-docs`). |
14
- | `--format <fmt>` | string | Output format: `markdown`, `html`, or `json` (default: `markdown`). |
15
- | `--model <model>` | string | LLM model to use. |
16
- | `--provider <provider>` | string | LLM provider: `groq` or `ollama` (default: `groq`). |
17
- | `--concurrency <n>` | number | Concurrent LLM requests (1-10) (default: `3`). |
18
- | `--dry-run` | boolean | Run AST parsing only, no LLM calls. |
19
- | `--incremental` | boolean | Only re-analyze changed files. |
20
- | `--no-confirm` | boolean | Skip cost confirmation prompt. |
21
- | `--json-summary` | boolean | Output machine-readable JSON summary. |
22
- | `--max-file-size <kb>` | number | Skip files larger than this size in KB (default: `500`). |
23
-
24
- #### Return Value
25
- None
26
-
27
- ### `initCmd`
28
- #### Description
29
- Interactive setup wizard — saves API key and creates `.legacyverrc`.
30
-
31
- #### Parameters
32
- None
33
-
34
- #### Return Value
35
- None
36
-
37
- ### `providersCmd`
38
- #### Description
39
- List supported LLM providers and available models.
40
-
41
- #### Parameters
42
- None
43
-
44
- #### Return Value
45
- None
46
-
47
- ### `cacheCmd`
48
- #### Description
49
- Manage the incremental analysis cache.
50
-
51
- #### Parameters
52
- None
53
-
54
- #### Return Value
55
- None
56
-
57
- ### `loginCmd`
58
- #### Description
59
- Log in to sync generated docs to the cloud.
60
-
61
- #### Parameters
62
- None
63
-
64
- #### Return Value
65
- None
66
-
67
- ### `logoutCmd`
68
- #### Description
69
- Log out and stop syncing docs to the cloud.
70
-
71
- #### Parameters
72
- None
73
-
74
- #### Return Value
75
- None
76
-
77
- ### `pushCmd`
78
- #### Description
79
- Manually push generated docs to the cloud database.
80
-
81
- #### Parameters
82
- | Name | Type | Description |
83
- | --- | --- | --- |
84
- | `target` | string | The directory to push from. |
85
- | `--out <dir>` | string | Docs output directory to read from (default: `./legacyver-docs`). |
86
-
87
- #### Return Value
88
- None
89
-
90
- ## Dependencies
91
- * `commander`
92
- * `fs`
93
- * `path`
94
- * `dotenv`
95
- * `../src/cli/commands/analyze`
96
- * `../src/cli/commands/init`
97
- * `../src/cli/commands/providers`
98
- * `../src/cli/commands/cache`
99
- * `../src/cli/commands/login`
100
- * `../src/cli/commands/logout`
101
- * `../src/cli/commands/push`
102
-
103
- ## Usage Example
104
- ```bash
105
- legacyver analyze my-project --out docs --format markdown
106
- ```
107
- This command analyzes the `my-project` directory, generates documentation in Markdown format, and outputs it to the `docs` directory.
@@ -1,47 +0,0 @@
1
- ## Overview
2
- This module provides two functions for managing CLI session tokens: `validateToken` and `revokeToken`. These functions interact with a PostgreSQL database to validate and revoke tokens.
3
-
4
- ## Functions
5
-
6
- ### validateToken
7
- Validates a CLI session token against app.user_sessions.
8
-
9
- * **Description**: Returns user info if valid, null if expired/revoked/not found.
10
- * **Params**:
11
- + `token`: raw token from ~/.legacyver/session.json (string)
12
- + `opts`: optional overrides for testing (object)
13
- - `pool`: pg Pool instance (object)
14
- * **Return Value**: Promise<{userId: string, username: string, email: string} | null>
15
-
16
- ### revokeToken
17
- Revoke a CLI session token (logout).
18
-
19
- * **Description**: Revoke a CLI session token.
20
- * **Params**:
21
- + `token`: raw token (string)
22
- + `opts`: optional overrides for testing (object)
23
- - `pool`: pg Pool instance (object)
24
- * **Return Value**: None
25
-
26
- ## Dependencies
27
- * `crypto`: crypto module
28
- * `pg`: pg module
29
- * `../db/config`: dbConfig module
30
-
31
- ## Usage Example
32
- ```javascript
33
- const { validateToken, revokeToken } = require('./auth');
34
-
35
- // Validate a token
36
- const token = 'your_token_here';
37
- const opts = { pool: your_pool_instance };
38
- validateToken(token, opts).then((userInfo) => {
39
- console.log(userInfo);
40
- });
41
-
42
- // Revoke a token
43
- const token = 'your_token_here';
44
- revokeToken(token, opts).then(() => {
45
- console.log('Token revoked');
46
- });
47
- ```
@@ -1,24 +0,0 @@
1
- ## Overview
2
- This module provides a function to compute the SHA-256 hash of a file.
3
-
4
- ## Functions
5
- ### computeHash
6
- Computes the SHA-256 hash of a file.
7
-
8
- | Parameter | Type | Description |
9
- | --- | --- | --- |
10
- | filePath | string | Path to the file to compute the hash for |
11
-
12
- | Return Value | Type | Description |
13
- | --- | --- | --- |
14
- | string | The SHA-256 hash as a hex string prefixed with 'sha256:' |
15
-
16
- ## Dependencies
17
- * crypto: createHash
18
- * fs: readFileSync
19
-
20
- ## Usage Example
21
- ```javascript
22
- const { computeHash } = require('./hash');
23
- console.log(computeHash('path/to/file.txt'));
24
- ```