@flowdevcli/flowdev 1.0.3 → 1.0.5
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/.env.example +1 -0
- package/Dockerfile +3 -3
- package/README.md +157 -0
- package/package.json +4 -3
- package/src/commands/ai/ask.js +35 -149
- package/src/commands/ai/audit.js +29 -19
- package/src/commands/ai/explain.js +31 -14
- package/src/commands/ai/readme.js +70 -0
- package/src/commands/ai/test.js +41 -19
- package/src/commands/config.js +64 -0
- package/src/commands/devops/dockerize.js +19 -0
- package/src/commands/devops/env.js +19 -0
- package/src/commands/devops/kube.js +19 -0
- package/src/commands/scaffold/find.js +19 -0
- package/src/commands/scaffold/generate.js +105 -76
- package/src/commands/system/update.js +45 -13
- package/src/commands/utils/stats.js +19 -0
- package/src/commands/utils/tree.js +19 -0
- package/src/core/cli.js +39 -0
- package/src/services/analyzer.js +19 -0
- package/src/services/file-system.js +19 -0
- package/src/templates/docker/templates.js +18 -0
- package/src/utils/engine-check.js +125 -17
- package/src/utils/logger.js +19 -0
- package/src/commands/devops/ci.js +0 -0
- package/src/commands/scaffold/readme.js +0 -54
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview FlowDev - Intelligent CLI tool
|
|
3
|
+
* @module flowdev
|
|
4
|
+
* @version 1.0.5
|
|
5
|
+
* * @license MIT
|
|
6
|
+
* Copyright (c) 2026 FlowDev Technologies.
|
|
7
|
+
* * Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
* * The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
import chalk from 'chalk';
|
|
2
21
|
import { generateTree } from '../../services/file-system.js';
|
|
3
22
|
|
package/src/core/cli.js
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview FlowDev - Intelligent CLI tool
|
|
5
|
+
* @module flowdev
|
|
6
|
+
* @version 1.0.5
|
|
7
|
+
* * @license MIT
|
|
8
|
+
* Copyright (c) 2026 FlowDev Technologies.
|
|
9
|
+
* * Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
* * The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
20
|
+
*/
|
|
21
|
+
|
|
1
22
|
import { program } from 'commander';
|
|
2
23
|
import { createRequire } from 'node:module';
|
|
3
24
|
import chalk from 'chalk';
|
|
@@ -7,11 +28,14 @@ import { dockerizeCommand } from '../commands/devops/dockerize.js';
|
|
|
7
28
|
import {findCommand} from '../commands/scaffold/find.js'
|
|
8
29
|
import { askCommand } from '../commands/ai/ask.js';
|
|
9
30
|
import { explainCommand } from '../commands/ai/explain.js';
|
|
31
|
+
import { askCommand } from '../commands/ai/readme.js'
|
|
10
32
|
import { envCommand } from '../commands/devops/env.js';
|
|
11
33
|
import { kubeCommand } from '../commands/devops/kube.js';
|
|
12
34
|
import { generateCommand } from '../commands/scaffold/generate.js';
|
|
13
35
|
import { auditCommand } from '../commands/ai/audit.js';
|
|
14
36
|
import { testCommand } from '../commands/ai/test.js';
|
|
37
|
+
import { updateCommand } from '../commands/system/update.js';
|
|
38
|
+
import { configCommand } from './commands/config.js'
|
|
15
39
|
|
|
16
40
|
|
|
17
41
|
const require = createRequire(import.meta.url);
|
|
@@ -109,5 +133,20 @@ export function setupCLI() {
|
|
|
109
133
|
await testCommand(file);
|
|
110
134
|
});
|
|
111
135
|
|
|
136
|
+
program
|
|
137
|
+
.command('readme')
|
|
138
|
+
.description('Automatically generate a README.md for the project')
|
|
139
|
+
.action(readmeCommand);
|
|
140
|
+
|
|
141
|
+
program
|
|
142
|
+
.command('config')
|
|
143
|
+
.description('Configure AI models (API keys, settings)')
|
|
144
|
+
.action(configCommand);
|
|
145
|
+
|
|
146
|
+
program
|
|
147
|
+
.command('update')
|
|
148
|
+
.description('Update FlowDev to the latest version')
|
|
149
|
+
.action(updateCommand);
|
|
150
|
+
|
|
112
151
|
return program;
|
|
113
152
|
}
|
package/src/services/analyzer.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview FlowDev - Intelligent CLI tool
|
|
3
|
+
* @module flowdev
|
|
4
|
+
* @version 1.0.5
|
|
5
|
+
* * @license MIT
|
|
6
|
+
* Copyright (c) 2026 FlowDev Technologies.
|
|
7
|
+
* * Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
* * The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
import fs from 'node:fs/promises';
|
|
2
21
|
import { createReadStream } from 'node:fs';
|
|
3
22
|
import path from 'node:path';
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview FlowDev - Intelligent CLI tool
|
|
3
|
+
* @module flowdev
|
|
4
|
+
* @version 1.0.5
|
|
5
|
+
* * @license MIT
|
|
6
|
+
* Copyright (c) 2026 FlowDev Technologies.
|
|
7
|
+
* * Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
* * The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
import fs from 'node:fs/promises';
|
|
2
21
|
import path from 'node:path';
|
|
3
22
|
import chalk from 'chalk';
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview FlowDev - Intelligent CLI tool
|
|
3
|
+
* @module flowdev
|
|
4
|
+
* @version 1.0.5
|
|
5
|
+
* * @license MIT
|
|
6
|
+
* Copyright (c) 2026 FlowDev Technologies.
|
|
7
|
+
* * Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
* * The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18
|
+
*/
|
|
1
19
|
|
|
2
20
|
export const nodeDockerfile = (version, port, command) => `
|
|
3
21
|
# Stage 1: Build
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import ollama from 'ollama';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import
|
|
3
|
+
import inquirer from 'inquirer';
|
|
4
4
|
import { exec, spawn } from 'node:child_process';
|
|
5
5
|
import { promisify } from 'util';
|
|
6
6
|
import { logger } from './logger.js';
|
|
7
|
+
import { getDeepSeekKey } from './config-manager.js';
|
|
7
8
|
|
|
8
9
|
const execAsync = promisify(exec);
|
|
9
10
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
10
11
|
|
|
12
|
+
|
|
11
13
|
async function waitForOllamaServer({ retries = 15, delayMs = 1000 } = {}) {
|
|
12
14
|
for (let i = 0; i < retries; i++) {
|
|
13
15
|
try {
|
|
@@ -26,46 +28,152 @@ async function installOllamaEngine(spinner) {
|
|
|
26
28
|
? 'winget install Ollama.Ollama --silent --accept-source-agreements'
|
|
27
29
|
: 'curl -fsSL https://ollama.com/install.sh | sh';
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
spinner.text = chalk.yellow("Installing FlowDev's engine package to run the command... (This may take a while)");
|
|
31
|
+
spinner.text = chalk.yellow("Installing local neural components... (Please wait)");
|
|
31
32
|
|
|
32
33
|
try {
|
|
33
34
|
await execAsync(installCmd, { maxBuffer: 10 * 1024 * 1024 });
|
|
34
|
-
spinner.succeed(chalk.green('
|
|
35
|
+
spinner.succeed(chalk.green('Local engine installed.'));
|
|
35
36
|
await sleep(1500);
|
|
36
37
|
} catch (error) {
|
|
37
|
-
spinner.fail(chalk.red(
|
|
38
|
-
logger.error(`Please install
|
|
38
|
+
spinner.fail(chalk.red("Automatic installation failed."));
|
|
39
|
+
logger.error(`Please install Ollama manually.`);
|
|
39
40
|
throw error;
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
async function ensureOllamaReady(spinner, modelName) {
|
|
45
45
|
try {
|
|
46
|
-
await execAsync('ollama --version');
|
|
46
|
+
await execAsync('ollama --version');
|
|
47
47
|
} catch (e) {
|
|
48
48
|
await installOllamaEngine(spinner);
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
if (!(await waitForOllamaServer({ retries: 3, delayMs: 1000 }))) {
|
|
52
|
-
spinner.text = chalk.blue('Starting
|
|
52
|
+
spinner.text = chalk.blue('Starting local inference service...');
|
|
53
53
|
const child = spawn('ollama', ['serve'], { detached: true, stdio: 'ignore' });
|
|
54
54
|
child.unref();
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
const ready = await waitForOllamaServer({ retries: 30, delayMs: 1000 });
|
|
57
|
-
if (!ready) throw new Error(
|
|
57
|
+
if (!ready) throw new Error("The local server is not responding.");
|
|
58
58
|
}
|
|
59
|
+
|
|
59
60
|
let hasModel = false;
|
|
60
61
|
try {
|
|
61
62
|
const models = await ollama.list();
|
|
62
63
|
hasModel = Array.isArray(models?.models) && models.models.some((m) => m.name?.startsWith(modelName));
|
|
63
|
-
} catch (err) {
|
|
64
|
+
} catch (err) {}
|
|
64
65
|
|
|
65
66
|
if (!hasModel) {
|
|
66
|
-
spinner.text = chalk.magenta(`
|
|
67
|
+
spinner.text = chalk.magenta(`Acquiring the model ${modelName} (size: ~4GB)...`);
|
|
67
68
|
await ollama.pull({ model: modelName });
|
|
68
|
-
spinner.succeed(chalk.green('
|
|
69
|
+
spinner.succeed(chalk.green('Local engine ready.'));
|
|
69
70
|
spinner.start();
|
|
70
71
|
}
|
|
71
|
-
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
async function* streamDeepSeek(messages) {
|
|
76
|
+
const apiKey = getDeepSeekKey();
|
|
77
|
+
|
|
78
|
+
const response = await fetch('https://api.deepseek.com/chat/completions', {
|
|
79
|
+
method: 'POST',
|
|
80
|
+
headers: {
|
|
81
|
+
'Content-Type': 'application/json',
|
|
82
|
+
'Authorization': `Bearer ${apiKey}`
|
|
83
|
+
},
|
|
84
|
+
body: JSON.stringify({
|
|
85
|
+
model: 'deepseek-chat',
|
|
86
|
+
messages: messages,
|
|
87
|
+
stream: true
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
if (!response.ok) {
|
|
92
|
+
const err = await response.text();
|
|
93
|
+
throw new Error(`DeepSeek API Error: ${response.status} - ${err}`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const reader = response.body.getReader();
|
|
97
|
+
const decoder = new TextDecoder("utf-8");
|
|
98
|
+
let buffer = "";
|
|
99
|
+
|
|
100
|
+
while (true) {
|
|
101
|
+
const { done, value } = await reader.read();
|
|
102
|
+
if (done) break;
|
|
103
|
+
buffer += decoder.decode(value, { stream: true });
|
|
104
|
+
const lines = buffer.split("\n");
|
|
105
|
+
buffer = lines.pop();
|
|
106
|
+
|
|
107
|
+
for (const line of lines) {
|
|
108
|
+
const trimmed = line.trim();
|
|
109
|
+
if (!trimmed || trimmed === "data: [DONE]") continue;
|
|
110
|
+
if (trimmed.startsWith("data: ")) {
|
|
111
|
+
try {
|
|
112
|
+
const json = JSON.parse(trimmed.replace("data: ", ""));
|
|
113
|
+
const content = json.choices[0]?.delta?.content;
|
|
114
|
+
if (content) yield { message: { content: content } };
|
|
115
|
+
} catch (e) {}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
export async function getAIResponse(messages, spinner, forceModel = null) {
|
|
123
|
+
if (spinner) spinner.stop();
|
|
124
|
+
|
|
125
|
+
let provider = forceModel;
|
|
126
|
+
|
|
127
|
+
if (!provider) {
|
|
128
|
+
const hasKey = !!getDeepSeekKey();
|
|
129
|
+
|
|
130
|
+
const answer = await inquirer.prompt([
|
|
131
|
+
{
|
|
132
|
+
type: 'list',
|
|
133
|
+
name: 'provider',
|
|
134
|
+
message: 'Select AI Model:',
|
|
135
|
+
choices: [
|
|
136
|
+
{
|
|
137
|
+
name: ' Llama 3 (Local - Private, Free, requires download)',
|
|
138
|
+
value: 'llama3',
|
|
139
|
+
short: 'Llama 3 (Local)'
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: `DeepSeek V3 (Cloud - Fast)`,
|
|
143
|
+
value: 'deepseek',
|
|
144
|
+
disabled: !hasKey ? 'run "flowdev config" first' : false,
|
|
145
|
+
short: 'DeepSeek (Cloud)'
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
]);
|
|
150
|
+
provider = answer.provider;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (spinner) spinner.start();
|
|
154
|
+
|
|
155
|
+
if (provider === 'llama3') {
|
|
156
|
+
if (spinner) spinner.text = chalk.cyan('Local environment check...');
|
|
157
|
+
await ensureOllamaReady(spinner, 'llama3');
|
|
158
|
+
|
|
159
|
+
if (spinner) spinner.text = chalk.magenta('Thinking...');
|
|
160
|
+
return await ollama.chat({
|
|
161
|
+
model: 'llama3',
|
|
162
|
+
messages: messages,
|
|
163
|
+
stream: true,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
else if (provider === 'deepseek') {
|
|
167
|
+
if (spinner) spinner.text = chalk.cyan('Connecting to the DeepSeek remote server...');
|
|
168
|
+
try {
|
|
169
|
+
await fetch('https://www.google.com', { method: 'HEAD' });
|
|
170
|
+
} catch (e) {
|
|
171
|
+
throw new Error("An active internet connection is required to use DeepSeek.");
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (spinner) spinner.text = chalk.magenta('Analyzing...');
|
|
175
|
+
return streamDeepSeek(messages);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export { ensureOllamaReady as ensureEngineReady };
|
package/src/utils/logger.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview FlowDev - Intelligent CLI tool
|
|
3
|
+
* @module flowdev
|
|
4
|
+
* @version 1.0.5
|
|
5
|
+
* * @license MIT
|
|
6
|
+
* Copyright (c) 2026 FlowDev Technologies.
|
|
7
|
+
* * Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
* * The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18
|
+
*/
|
|
19
|
+
|
|
1
20
|
import chalk from 'chalk';
|
|
2
21
|
|
|
3
22
|
export const logger = {
|
|
File without changes
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import ollama from 'ollama';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import ora from 'ora';
|
|
4
|
-
import fs from 'fs-extra';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import { ensureEngineReady } from '../../utils/engine-check.js';
|
|
7
|
-
import { logger } from '../../utils/logger.js';
|
|
8
|
-
|
|
9
|
-
export async function readmeCommand() {
|
|
10
|
-
const spinner = ora(chalk.cyan('Reading project structure...')).start();
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
const rootDir = process.cwd();
|
|
14
|
-
let projectInfo = "";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (await fs.pathExists(path.join(rootDir, 'package.json'))) {
|
|
18
|
-
const pkg = await fs.readJson(path.join(rootDir, 'package.json'));
|
|
19
|
-
projectInfo += `Type: Node.js/Web, Name: ${pkg.name}, Deps: ${Object.keys(pkg.dependencies || {}).join(', ')}`;
|
|
20
|
-
} else if (await fs.pathExists(path.join(rootDir, 'manage.py'))) {
|
|
21
|
-
projectInfo += `Type: Django/Python project`;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
await ensureEngineReady(spinner, 'llama3');
|
|
25
|
-
|
|
26
|
-
spinner.text = chalk.magenta('Drafting your documentation...');
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const prompt = `
|
|
30
|
-
You are a technical writer. Generate a professional README.md for a project with these details: ${projectInfo}.
|
|
31
|
-
The README should include:
|
|
32
|
-
- A catchy title with an emoji.
|
|
33
|
-
- A brief description.
|
|
34
|
-
- Installation steps.
|
|
35
|
-
- How to run the project.
|
|
36
|
-
- Tech stack used.
|
|
37
|
-
|
|
38
|
-
Return ONLY the markdown content.
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
const response = await ollama.chat({
|
|
42
|
-
model: 'llama3.2',
|
|
43
|
-
messages: [{ role: 'user', content: prompt }],
|
|
44
|
-
});
|
|
45
|
-
const readmePath = path.join(rootDir, 'README.md');
|
|
46
|
-
await fs.writeFile(readmePath, response.message.content);
|
|
47
|
-
|
|
48
|
-
spinner.succeed(chalk.green('README.md generated successfully! '));
|
|
49
|
-
|
|
50
|
-
} catch (error) {
|
|
51
|
-
spinner.fail(chalk.red('Failed to generate README.'));
|
|
52
|
-
logger.error(error.message);
|
|
53
|
-
}
|
|
54
|
-
}
|