@veloxts/cli 0.7.0 → 0.7.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/CHANGELOG.md +24 -0
- package/dist/commands/introspect.js +19 -30
- package/dist/commands/mcp.js +2 -3
- package/dist/commands/openapi.js +1 -10
- package/dist/commands/procedures.js +1 -12
- package/dist/dev/error-parser.js +0 -3
- package/dist/utils/paths.d.ts +4 -0
- package/dist/utils/paths.js +12 -4
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @veloxts/cli
|
|
2
2
|
|
|
3
|
+
## 0.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- chore(auth,core,create,cli,client,orm,mcp,router,validation,web): simplify code for clarity and maintainability
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @veloxts/auth@0.7.2
|
|
10
|
+
- @veloxts/core@0.7.2
|
|
11
|
+
- @veloxts/orm@0.7.2
|
|
12
|
+
- @veloxts/router@0.7.2
|
|
13
|
+
- @veloxts/validation@0.7.2
|
|
14
|
+
|
|
15
|
+
## 0.7.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- security audit, bumps dependency packages
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @veloxts/auth@0.7.1
|
|
22
|
+
- @veloxts/core@0.7.1
|
|
23
|
+
- @veloxts/orm@0.7.1
|
|
24
|
+
- @veloxts/router@0.7.1
|
|
25
|
+
- @veloxts/validation@0.7.1
|
|
26
|
+
|
|
3
27
|
## 0.7.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
|
@@ -10,28 +10,33 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { existsSync } from 'node:fs';
|
|
12
12
|
import { readdir, readFile } from 'node:fs/promises';
|
|
13
|
-
import { join
|
|
13
|
+
import { join } from 'node:path';
|
|
14
14
|
import { discoverProceduresVerbose, getRouteSummary, isDiscoveryError, } from '@veloxts/router';
|
|
15
15
|
import { Command } from 'commander';
|
|
16
|
-
import { config as loadEnv } from 'dotenv';
|
|
17
16
|
import pc from 'picocolors';
|
|
18
17
|
import { getErrorsByCategory } from '../errors/index.js';
|
|
18
|
+
import { loadEnvironment } from '../utils/paths.js';
|
|
19
19
|
import { extractSchemaNames, extractSchemaTypes } from '../utils/schema-patterns.js';
|
|
20
20
|
// ============================================================================
|
|
21
21
|
// Constants
|
|
22
22
|
// ============================================================================
|
|
23
23
|
/** Default API prefix for REST routes */
|
|
24
24
|
const DEFAULT_API_PREFIX = '/api';
|
|
25
|
-
// ============================================================================
|
|
26
|
-
// Helper Functions
|
|
27
|
-
// ============================================================================
|
|
28
25
|
/**
|
|
29
|
-
*
|
|
26
|
+
* Get picocolors color function for an HTTP method
|
|
30
27
|
*/
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
function getMethodColor(method) {
|
|
29
|
+
switch (method) {
|
|
30
|
+
case 'GET':
|
|
31
|
+
return pc.green;
|
|
32
|
+
case 'POST':
|
|
33
|
+
return pc.yellow;
|
|
34
|
+
case 'PUT':
|
|
35
|
+
return pc.blue;
|
|
36
|
+
case 'PATCH':
|
|
37
|
+
return pc.cyan;
|
|
38
|
+
default:
|
|
39
|
+
return pc.red;
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
/**
|
|
@@ -139,9 +144,9 @@ function getErrorIntrospection() {
|
|
|
139
144
|
for (const prefix of categories) {
|
|
140
145
|
const categoryErrors = getErrorsByCategory(prefix);
|
|
141
146
|
const categoryName = categoryNames[prefix] ?? 'Unknown';
|
|
142
|
-
for (const
|
|
147
|
+
for (const def of categoryErrors) {
|
|
143
148
|
errors.push({
|
|
144
|
-
code,
|
|
149
|
+
code: def.code,
|
|
145
150
|
name: def.name,
|
|
146
151
|
message: def.message,
|
|
147
152
|
fix: def.fix,
|
|
@@ -172,15 +177,7 @@ function printProcedures(procedures) {
|
|
|
172
177
|
console.log(pc.bold(pc.cyan(`/${currentNs}`)));
|
|
173
178
|
}
|
|
174
179
|
const method = proc.route?.method ?? (proc.type === 'query' ? 'GET' : 'POST');
|
|
175
|
-
const methodColor = method
|
|
176
|
-
? pc.green
|
|
177
|
-
: method === 'POST'
|
|
178
|
-
? pc.yellow
|
|
179
|
-
: method === 'PUT'
|
|
180
|
-
? pc.blue
|
|
181
|
-
: method === 'PATCH'
|
|
182
|
-
? pc.cyan
|
|
183
|
-
: pc.red;
|
|
180
|
+
const methodColor = getMethodColor(method);
|
|
184
181
|
const schemas = [];
|
|
185
182
|
if (proc.hasInput)
|
|
186
183
|
schemas.push('in');
|
|
@@ -226,15 +223,7 @@ function printRoutes(routes) {
|
|
|
226
223
|
console.log(pc.bold('REST Routes'));
|
|
227
224
|
console.log(pc.dim('─'.repeat(60)));
|
|
228
225
|
for (const route of routes) {
|
|
229
|
-
const methodColor = route.method
|
|
230
|
-
? pc.green
|
|
231
|
-
: route.method === 'POST'
|
|
232
|
-
? pc.yellow
|
|
233
|
-
: route.method === 'PUT'
|
|
234
|
-
? pc.blue
|
|
235
|
-
: route.method === 'PATCH'
|
|
236
|
-
? pc.cyan
|
|
237
|
-
: pc.red;
|
|
226
|
+
const methodColor = getMethodColor(route.method);
|
|
238
227
|
console.log(` ${methodColor(route.method.padEnd(7))} ${route.path}`);
|
|
239
228
|
console.log(pc.dim(` → ${route.namespace}.${route.procedure}`));
|
|
240
229
|
}
|
package/dist/commands/mcp.js
CHANGED
|
@@ -95,8 +95,7 @@ async function readClaudeConfig(configPath) {
|
|
|
95
95
|
return null;
|
|
96
96
|
}
|
|
97
97
|
try {
|
|
98
|
-
|
|
99
|
-
return config;
|
|
98
|
+
return await readJsonFile(configPath);
|
|
100
99
|
}
|
|
101
100
|
catch (err) {
|
|
102
101
|
throw new Error(`Failed to parse Claude Desktop configuration: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -301,7 +300,7 @@ async function runMcpInit(options) {
|
|
|
301
300
|
process.exit(1);
|
|
302
301
|
}
|
|
303
302
|
// Success!
|
|
304
|
-
const action =
|
|
303
|
+
const action = configExists ? 'updated' : 'created';
|
|
305
304
|
const result = {
|
|
306
305
|
success: true,
|
|
307
306
|
action,
|
package/dist/commands/openapi.js
CHANGED
|
@@ -11,18 +11,9 @@ import { createServer } from 'node:http';
|
|
|
11
11
|
import { dirname, extname, resolve } from 'node:path';
|
|
12
12
|
import { discoverProceduresVerbose, generateOpenApiSpec, generateSwaggerUIHtml, isDiscoveryError, validateOpenApiSpec, } from '@veloxts/router';
|
|
13
13
|
import { Command } from 'commander';
|
|
14
|
-
import { config as loadEnv } from 'dotenv';
|
|
15
14
|
import pc from 'picocolors';
|
|
16
15
|
import YAML from 'yaml';
|
|
17
|
-
|
|
18
|
-
* Load environment variables from .env file if present
|
|
19
|
-
*/
|
|
20
|
-
function loadEnvironment() {
|
|
21
|
-
const envPath = resolve(process.cwd(), '.env');
|
|
22
|
-
if (existsSync(envPath)) {
|
|
23
|
-
loadEnv({ path: envPath });
|
|
24
|
-
}
|
|
25
|
-
}
|
|
16
|
+
import { loadEnvironment } from '../utils/paths.js';
|
|
26
17
|
// ============================================================================
|
|
27
18
|
// Helper Functions
|
|
28
19
|
// ============================================================================
|
|
@@ -4,21 +4,10 @@
|
|
|
4
4
|
* Provides subcommands for managing procedures:
|
|
5
5
|
* - procedures:list - List all discovered procedures
|
|
6
6
|
*/
|
|
7
|
-
import { existsSync } from 'node:fs';
|
|
8
|
-
import { resolve } from 'node:path';
|
|
9
7
|
import { discoverProceduresVerbose, isDiscoveryError, } from '@veloxts/router';
|
|
10
8
|
import { Command } from 'commander';
|
|
11
|
-
import { config as loadEnv } from 'dotenv';
|
|
12
9
|
import pc from 'picocolors';
|
|
13
|
-
|
|
14
|
-
* Load environment variables from .env file if present
|
|
15
|
-
*/
|
|
16
|
-
function loadEnvironment() {
|
|
17
|
-
const envPath = resolve(process.cwd(), '.env');
|
|
18
|
-
if (existsSync(envPath)) {
|
|
19
|
-
loadEnv({ path: envPath });
|
|
20
|
-
}
|
|
21
|
-
}
|
|
10
|
+
import { loadEnvironment } from '../utils/paths.js';
|
|
22
11
|
// ============================================================================
|
|
23
12
|
// Helper Functions
|
|
24
13
|
// ============================================================================
|
package/dist/dev/error-parser.js
CHANGED
|
@@ -264,9 +264,6 @@ function generateSuggestion(type, errorText) {
|
|
|
264
264
|
if (moduleName.startsWith('.') || moduleName.startsWith('/')) {
|
|
265
265
|
suggestion = `Check that the file '${moduleName}' exists and the path is correct relative to the importing file.`;
|
|
266
266
|
}
|
|
267
|
-
else if (moduleName.startsWith('@')) {
|
|
268
|
-
suggestion = `Install the package: pnpm add ${moduleName}`;
|
|
269
|
-
}
|
|
270
267
|
else {
|
|
271
268
|
suggestion = `Install the package: pnpm add ${moduleName}`;
|
|
272
269
|
}
|
package/dist/utils/paths.d.ts
CHANGED
|
@@ -101,3 +101,7 @@ export declare function writeJsonFile(filePath: string, data: unknown): Promise<
|
|
|
101
101
|
* Create a directory recursively
|
|
102
102
|
*/
|
|
103
103
|
export declare function createDirectory(dirPath: string): void;
|
|
104
|
+
/**
|
|
105
|
+
* Load environment variables from .env file if present
|
|
106
|
+
*/
|
|
107
|
+
export declare function loadEnvironment(cwd?: string): void;
|
package/dist/utils/paths.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { existsSync, mkdirSync, readdirSync, readFileSync } from 'node:fs';
|
|
5
5
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
6
6
|
import path from 'node:path';
|
|
7
|
+
import { config as loadEnv } from 'dotenv';
|
|
7
8
|
/** Common entry point file names, ordered by preference */
|
|
8
9
|
const ENTRY_POINT_PATTERNS = [
|
|
9
10
|
'src/index.ts',
|
|
@@ -252,8 +253,7 @@ export async function isVeloxProject(cwd = process.cwd()) {
|
|
|
252
253
|
return false;
|
|
253
254
|
}
|
|
254
255
|
try {
|
|
255
|
-
const
|
|
256
|
-
const content = await fs.readFile(packageJsonPath, 'utf-8');
|
|
256
|
+
const content = await readFile(packageJsonPath, 'utf-8');
|
|
257
257
|
const pkg = JSON.parse(content);
|
|
258
258
|
// Check if any @veloxts packages are in dependencies
|
|
259
259
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
@@ -289,8 +289,7 @@ export async function detectProjectType(cwd = process.cwd()) {
|
|
|
289
289
|
return result;
|
|
290
290
|
}
|
|
291
291
|
try {
|
|
292
|
-
const
|
|
293
|
-
const content = await fs.readFile(packageJsonPath, 'utf-8');
|
|
292
|
+
const content = await readFile(packageJsonPath, 'utf-8');
|
|
294
293
|
const pkg = JSON.parse(content);
|
|
295
294
|
// Collect all dependencies
|
|
296
295
|
result.dependencies = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
@@ -328,3 +327,12 @@ export async function writeJsonFile(filePath, data) {
|
|
|
328
327
|
export function createDirectory(dirPath) {
|
|
329
328
|
mkdirSync(dirPath, { recursive: true });
|
|
330
329
|
}
|
|
330
|
+
/**
|
|
331
|
+
* Load environment variables from .env file if present
|
|
332
|
+
*/
|
|
333
|
+
export function loadEnvironment(cwd = process.cwd()) {
|
|
334
|
+
const envPath = path.resolve(cwd, '.env');
|
|
335
|
+
if (existsSync(envPath)) {
|
|
336
|
+
loadEnv({ path: envPath });
|
|
337
|
+
}
|
|
338
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veloxts/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Developer tooling and CLI commands for VeloxTS framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,27 +32,27 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@clack/prompts": "1.0.
|
|
35
|
+
"@clack/prompts": "1.0.1",
|
|
36
36
|
"commander": "14.0.3",
|
|
37
|
-
"dotenv": "17.
|
|
37
|
+
"dotenv": "17.3.1",
|
|
38
38
|
"hot-hook": "0.4.0",
|
|
39
39
|
"pg": "8.18.0",
|
|
40
40
|
"picocolors": "1.1.1",
|
|
41
41
|
"pluralize": "8.0.0",
|
|
42
42
|
"tsx": "4.21.0",
|
|
43
43
|
"yaml": "2.8.2",
|
|
44
|
-
"@veloxts/core": "0.7.
|
|
45
|
-
"@veloxts/
|
|
46
|
-
"@veloxts/
|
|
47
|
-
"@veloxts/router": "0.7.
|
|
48
|
-
"@veloxts/validation": "0.7.
|
|
44
|
+
"@veloxts/core": "0.7.2",
|
|
45
|
+
"@veloxts/auth": "0.7.2",
|
|
46
|
+
"@veloxts/orm": "0.7.2",
|
|
47
|
+
"@veloxts/router": "0.7.2",
|
|
48
|
+
"@veloxts/validation": "0.7.2"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@prisma/client": ">=7.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@prisma/client": "7.4.0",
|
|
55
|
-
"@types/node": "25.
|
|
55
|
+
"@types/node": "25.2.3",
|
|
56
56
|
"@types/pg": "8.16.0",
|
|
57
57
|
"@types/pluralize": "0.0.33",
|
|
58
58
|
"@vitest/coverage-v8": "4.0.18",
|