@lazykedar/lazydocs 1.3.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +2 -2
- package/README.md +9 -3
- package/dist/a.js +1 -1
- package/dist/cli.js +86 -3
- package/dist/o/p.js +1 -0
- package/dist/o/r.js +2 -1
- package/package.json +1 -1
|
@@ -76,7 +76,7 @@ jobs:
|
|
|
76
76
|
## Installation
|
|
77
77
|
|
|
78
78
|
```bash
|
|
79
|
-
npm install -g @
|
|
79
|
+
npm install -g @lazykedar/lazydocs@${{ steps.get_version.outputs.VERSION }}
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
## Quick Start
|
|
@@ -91,7 +91,7 @@ jobs:
|
|
|
91
91
|
|
|
92
92
|
## Links
|
|
93
93
|
|
|
94
|
-
- [NPM Package](https://www.npmjs.com/package/@
|
|
94
|
+
- [NPM Package](https://www.npmjs.com/package/@lazykedar/lazydocs)
|
|
95
95
|
- [Documentation](https://github.com/${{ github.repository }}#readme)
|
|
96
96
|
- [Changelog](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md)
|
|
97
97
|
draft: false
|
package/README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
AI-powered documentation generator using Groq. Generate READMEs, PR descriptions, and changelogs in seconds.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@lazykedar/lazydocs)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
npm install -g @
|
|
11
|
+
npm install -g @lazykedar/lazydocs
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Setup
|
|
@@ -46,6 +46,12 @@ lazydocs generate --type changelog
|
|
|
46
46
|
|
|
47
47
|
## Configuration
|
|
48
48
|
|
|
49
|
+
Interactive setup (recommended):
|
|
50
|
+
```bash
|
|
51
|
+
lazydocs config setup
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Or configure parameters individually:
|
|
49
55
|
```bash
|
|
50
56
|
lazydocs config set GROQ_API_KEY=your_key
|
|
51
57
|
lazydocs config list
|
|
@@ -144,7 +150,7 @@ Popular models:
|
|
|
144
150
|
|
|
145
151
|
## Links
|
|
146
152
|
|
|
147
|
-
- [NPM Package](https://www.npmjs.com/package/@
|
|
153
|
+
- [NPM Package](https://www.npmjs.com/package/@lazykedar/lazydocs)
|
|
148
154
|
- [GitHub](https://github.com/kedar49/lazydocs)
|
|
149
155
|
- [Issues](https://github.com/kedar49/lazydocs/issues)
|
|
150
156
|
- [Groq Console](https://console.groq.com)
|
package/dist/a.js
CHANGED
|
@@ -57,7 +57,7 @@ function analyzeCode(dir, maxTokens = 6000) {
|
|
|
57
57
|
const fileStats = [];
|
|
58
58
|
// Load project config
|
|
59
59
|
let projectConfig = {};
|
|
60
|
-
const configPath = path.join(
|
|
60
|
+
const configPath = path.join(dir, '.lazydocs.json');
|
|
61
61
|
if (fs.existsSync(configPath)) {
|
|
62
62
|
try {
|
|
63
63
|
projectConfig = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
package/dist/cli.js
CHANGED
|
@@ -43,6 +43,7 @@ const p_1 = require("./o/p");
|
|
|
43
43
|
const c_1 = require("./o/c");
|
|
44
44
|
const ai_1 = require("./ai");
|
|
45
45
|
const config_manager_1 = require("./utils/config-manager");
|
|
46
|
+
// Helper to log errors locally
|
|
46
47
|
const logError = (message) => {
|
|
47
48
|
const logDir = path.join(process.cwd(), 'logs');
|
|
48
49
|
if (!fs.existsSync(logDir))
|
|
@@ -51,10 +52,27 @@ const logError = (message) => {
|
|
|
51
52
|
fs.appendFileSync(logFile, `${new Date().toISOString()} - ${message}\n`);
|
|
52
53
|
};
|
|
53
54
|
const program = new commander.Command();
|
|
55
|
+
// Dynamically resolve version from package.json
|
|
56
|
+
let version = '2.0.1';
|
|
57
|
+
try {
|
|
58
|
+
const pkgPath = path.join(__dirname, '../package.json');
|
|
59
|
+
if (fs.existsSync(pkgPath)) {
|
|
60
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
61
|
+
version = pkg.version || version;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const devPkgPath = path.join(__dirname, 'package.json');
|
|
65
|
+
if (fs.existsSync(devPkgPath)) {
|
|
66
|
+
const pkg = JSON.parse(fs.readFileSync(devPkgPath, 'utf-8'));
|
|
67
|
+
version = pkg.version || version;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch { }
|
|
54
72
|
program
|
|
55
73
|
.name('lazydocs')
|
|
56
74
|
.description('AI-powered documentation generator using Groq')
|
|
57
|
-
.version(
|
|
75
|
+
.version(version);
|
|
58
76
|
// Config commands
|
|
59
77
|
const configCmd = program.command('config');
|
|
60
78
|
configCmd
|
|
@@ -138,6 +156,67 @@ configCmd
|
|
|
138
156
|
process.exit(1);
|
|
139
157
|
}
|
|
140
158
|
});
|
|
159
|
+
configCmd
|
|
160
|
+
.command('setup')
|
|
161
|
+
.description('Interactively setup configuration parameters')
|
|
162
|
+
.action(async () => {
|
|
163
|
+
try {
|
|
164
|
+
console.log('--- LazyDocs Configuration Setup ---\n');
|
|
165
|
+
const answers = await inquirer.default.prompt([
|
|
166
|
+
{
|
|
167
|
+
type: 'password',
|
|
168
|
+
name: 'GROQ_API_KEY',
|
|
169
|
+
message: 'Enter your Groq API key (starts with gsk_):',
|
|
170
|
+
validate: (input) => {
|
|
171
|
+
if (!input)
|
|
172
|
+
return 'API key is required!';
|
|
173
|
+
if (!input.startsWith('gsk_'))
|
|
174
|
+
return 'API key must start with "gsk_"';
|
|
175
|
+
if (input.length <= 20)
|
|
176
|
+
return 'API key format is invalid';
|
|
177
|
+
return true;
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
type: 'list',
|
|
182
|
+
name: 'DEFAULT_MODEL',
|
|
183
|
+
message: 'Select default AI model:',
|
|
184
|
+
choices: (0, ai_1.getFallbackModels)(),
|
|
185
|
+
default: 'llama-3.3-70b-versatile',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: 'input',
|
|
189
|
+
name: 'TEMPERATURE',
|
|
190
|
+
message: 'Default temperature (0.0 to 2.0):',
|
|
191
|
+
default: '0.7',
|
|
192
|
+
validate: (input) => {
|
|
193
|
+
const val = parseFloat(input);
|
|
194
|
+
return (!isNaN(val) && val >= 0 && val <= 2) ? true : 'Must be a number between 0 and 2';
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
type: 'input',
|
|
199
|
+
name: 'MAX_TOKENS',
|
|
200
|
+
message: 'Default maximum tokens (100 to 131072):',
|
|
201
|
+
default: '2048',
|
|
202
|
+
validate: (input) => {
|
|
203
|
+
const val = parseInt(input, 10);
|
|
204
|
+
return (!isNaN(val) && val >= 100 && val <= 131072) ? true : 'Must be an integer between 100 and 131072';
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
]);
|
|
208
|
+
(0, config_manager_1.setConfig)('GROQ_API_KEY', answers.GROQ_API_KEY);
|
|
209
|
+
(0, config_manager_1.setConfig)('DEFAULT_MODEL', answers.DEFAULT_MODEL);
|
|
210
|
+
(0, config_manager_1.setConfig)('TEMPERATURE', answers.TEMPERATURE);
|
|
211
|
+
(0, config_manager_1.setConfig)('MAX_TOKENS', answers.MAX_TOKENS);
|
|
212
|
+
console.log('\n✔ LazyDocs configuration successfully updated and saved in ~/.lazydocs!');
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
logError(`Config setup error: ${error.message}`);
|
|
216
|
+
console.error(`Error: ${error.message}`);
|
|
217
|
+
process.exit(1);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
141
220
|
// Generate command
|
|
142
221
|
program
|
|
143
222
|
.command('generate')
|
|
@@ -191,7 +270,7 @@ program
|
|
|
191
270
|
type: 'input',
|
|
192
271
|
name: 'input',
|
|
193
272
|
message: 'Input directory:',
|
|
194
|
-
default: './src',
|
|
273
|
+
default: fs.existsSync('./src') ? './src' : '.',
|
|
195
274
|
},
|
|
196
275
|
{
|
|
197
276
|
type: 'list',
|
|
@@ -206,6 +285,10 @@ program
|
|
|
206
285
|
]);
|
|
207
286
|
Object.assign(options, answers);
|
|
208
287
|
}
|
|
288
|
+
// Fallback to current directory if default input directory does not exist
|
|
289
|
+
if (options.input === './src' && !fs.existsSync('./src')) {
|
|
290
|
+
options.input = '.';
|
|
291
|
+
}
|
|
209
292
|
// Set default output
|
|
210
293
|
if (!options.output) {
|
|
211
294
|
const defaults = {
|
|
@@ -340,7 +423,7 @@ program
|
|
|
340
423
|
.action(async (options) => {
|
|
341
424
|
try {
|
|
342
425
|
if (options.refresh) {
|
|
343
|
-
let apiKey;
|
|
426
|
+
let apiKey = '';
|
|
344
427
|
try {
|
|
345
428
|
const config = (0, config_manager_1.getConfig)({}, true);
|
|
346
429
|
apiKey = config.GROQ_API_KEY;
|
package/dist/o/p.js
CHANGED
|
@@ -40,6 +40,7 @@ exports.generatePrDesc = generatePrDesc;
|
|
|
40
40
|
const fs = __importStar(require("fs"));
|
|
41
41
|
const simple_git_1 = __importDefault(require("simple-git"));
|
|
42
42
|
const ai_1 = require("../ai");
|
|
43
|
+
// Generate professional pull request description from git diff
|
|
43
44
|
async function generatePrDesc(inputDir, outputFile, apiKey, aiOptions, gitOptions) {
|
|
44
45
|
console.log('Analyzing git changes...');
|
|
45
46
|
const git = (0, simple_git_1.default)(inputDir);
|
package/dist/o/r.js
CHANGED
|
@@ -40,6 +40,7 @@ const path = __importStar(require("path"));
|
|
|
40
40
|
const ai_1 = require("../ai");
|
|
41
41
|
const a_1 = require("../a");
|
|
42
42
|
const merger_1 = require("../utils/merger");
|
|
43
|
+
// Generate README markdown file by analyzing the codebase
|
|
43
44
|
async function generateReadme(inputDir, outputFile, apiKey, aiOptions, customTemplatePath) {
|
|
44
45
|
console.log('Analyzing codebase...');
|
|
45
46
|
const analysis = (0, a_1.analyzeCode)(inputDir);
|
|
@@ -65,7 +66,7 @@ async function generateReadme(inputDir, outputFile, apiKey, aiOptions, customTem
|
|
|
65
66
|
}));
|
|
66
67
|
// Try to read project name from package.json
|
|
67
68
|
let projectName = 'Your Project';
|
|
68
|
-
const packageJsonPath = path.join(
|
|
69
|
+
const packageJsonPath = path.join(inputDir, 'package.json');
|
|
69
70
|
if (fs.existsSync(packageJsonPath)) {
|
|
70
71
|
try {
|
|
71
72
|
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
package/package.json
CHANGED