@veloxts/cli 0.6.59 → 0.6.61
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
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @veloxts/cli
|
|
2
2
|
|
|
3
|
+
## 0.6.61
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(mcp,cli): improve workspace support and add procedure auto-registration
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @veloxts/auth@0.6.61
|
|
10
|
+
- @veloxts/core@0.6.61
|
|
11
|
+
- @veloxts/orm@0.6.61
|
|
12
|
+
- @veloxts/router@0.6.61
|
|
13
|
+
- @veloxts/validation@0.6.61
|
|
14
|
+
|
|
15
|
+
## 0.6.60
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- feat(create): add tRPC-specific CLAUDE.md and improve AI-native features
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @veloxts/auth@0.6.60
|
|
22
|
+
- @veloxts/core@0.6.60
|
|
23
|
+
- @veloxts/orm@0.6.60
|
|
24
|
+
- @veloxts/router@0.6.60
|
|
25
|
+
- @veloxts/validation@0.6.60
|
|
26
|
+
|
|
3
27
|
## 0.6.59
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @veloxts/cli
|
|
2
2
|
|
|
3
|
-
> **Early Preview (v0.6.x)** - APIs are stabilizing but may still change.
|
|
3
|
+
> **Early Preview (v0.6.x)** - APIs are stabilizing but may still change. Do not use in production yet.
|
|
4
4
|
|
|
5
5
|
Command-line interface for VeloxTS Framework - provides development server with HMR, migration commands, and code generators. Learn more at [@veloxts/velox](https://www.npmjs.com/package/@veloxts/velox).
|
|
6
6
|
|
|
@@ -29,6 +29,10 @@ export declare class ProcedureGenerator extends BaseGenerator<ProcedureOptions>
|
|
|
29
29
|
* Generate procedure files
|
|
30
30
|
*/
|
|
31
31
|
generate(config: GeneratorConfig<ProcedureOptions>): Promise<GeneratorOutput>;
|
|
32
|
+
/**
|
|
33
|
+
* Build post-instructions based on whether auto-registration succeeded
|
|
34
|
+
*/
|
|
35
|
+
private buildPostInstructions;
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
38
|
* Create a new procedure generator instance
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { BaseGenerator } from '../base.js';
|
|
16
16
|
import { getProcedureInstructions, getProcedurePath, procedureTemplate, } from '../templates/procedure.js';
|
|
17
|
+
import { detectRouterPattern, isProcedureRegistered, registerProcedures, } from '../utils/router-integration.js';
|
|
17
18
|
// ============================================================================
|
|
18
19
|
// Generator Implementation
|
|
19
20
|
// ============================================================================
|
|
@@ -53,6 +54,13 @@ Examples:
|
|
|
53
54
|
type: 'boolean',
|
|
54
55
|
default: false,
|
|
55
56
|
},
|
|
57
|
+
{
|
|
58
|
+
name: 'skip-registration',
|
|
59
|
+
short: 'S',
|
|
60
|
+
description: 'Skip auto-registering the procedure in router.ts',
|
|
61
|
+
type: 'boolean',
|
|
62
|
+
default: false,
|
|
63
|
+
},
|
|
56
64
|
];
|
|
57
65
|
/**
|
|
58
66
|
* Validate and transform raw options
|
|
@@ -60,11 +68,12 @@ Examples:
|
|
|
60
68
|
validateOptions(raw) {
|
|
61
69
|
const crud = Boolean(raw.crud ?? false);
|
|
62
70
|
const paginated = Boolean(raw.paginated ?? false);
|
|
71
|
+
const skipRegistration = Boolean(raw['skip-registration'] ?? raw.skipRegistration ?? false);
|
|
63
72
|
// Warn if --paginated without --crud (paginated only applies to list)
|
|
64
73
|
if (paginated && !crud) {
|
|
65
74
|
// Silently enable pagination anyway - it will work when user adds list manually
|
|
66
75
|
}
|
|
67
|
-
return { crud, paginated };
|
|
76
|
+
return { crud, paginated, skipRegistration };
|
|
68
77
|
}
|
|
69
78
|
/**
|
|
70
79
|
* Generate procedure files
|
|
@@ -72,6 +81,7 @@ Examples:
|
|
|
72
81
|
async generate(config) {
|
|
73
82
|
const context = this.createContext(config);
|
|
74
83
|
const { entity } = context;
|
|
84
|
+
const { options } = config;
|
|
75
85
|
// Generate procedure content using template
|
|
76
86
|
const content = procedureTemplate(context);
|
|
77
87
|
// Create the generated file
|
|
@@ -79,13 +89,71 @@ Examples:
|
|
|
79
89
|
path: getProcedurePath(entity.plural),
|
|
80
90
|
content,
|
|
81
91
|
};
|
|
82
|
-
//
|
|
83
|
-
|
|
92
|
+
// Try auto-registration if not skipped
|
|
93
|
+
let registrationResult = null;
|
|
94
|
+
if (!options.skipRegistration && !config.dryRun) {
|
|
95
|
+
const procedureVar = `${entity.camel}Procedures`;
|
|
96
|
+
// Check if already registered
|
|
97
|
+
if (!isProcedureRegistered(config.cwd, procedureVar)) {
|
|
98
|
+
// Detect router pattern
|
|
99
|
+
const pattern = detectRouterPattern(config.cwd);
|
|
100
|
+
if (pattern.type !== 'unknown') {
|
|
101
|
+
// Perform registration
|
|
102
|
+
registrationResult = registerProcedures(config.cwd, entity.kebab, procedureVar, false // not a dry run since we're writing
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Generate post-creation instructions based on registration result
|
|
108
|
+
const postInstructions = this.buildPostInstructions(entity, options, registrationResult);
|
|
84
109
|
return {
|
|
85
110
|
files: [file],
|
|
86
111
|
postInstructions,
|
|
87
112
|
};
|
|
88
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Build post-instructions based on whether auto-registration succeeded
|
|
116
|
+
*/
|
|
117
|
+
buildPostInstructions(entity, options, registrationResult) {
|
|
118
|
+
const procedureVar = `${entity.camel}Procedures`;
|
|
119
|
+
// If registration was successful, show simpler instructions
|
|
120
|
+
if (registrationResult?.success) {
|
|
121
|
+
const modifiedFiles = registrationResult.modifiedFiles.map((f) => ` - ${f}`).join('\n');
|
|
122
|
+
let instructions = `
|
|
123
|
+
✓ Procedure ${procedureVar} auto-registered!
|
|
124
|
+
|
|
125
|
+
Modified files:
|
|
126
|
+
${modifiedFiles}`;
|
|
127
|
+
if (options.crud) {
|
|
128
|
+
instructions += `
|
|
129
|
+
|
|
130
|
+
Next: Add the ${entity.pascal} model to your Prisma schema:
|
|
131
|
+
|
|
132
|
+
// prisma/schema.prisma
|
|
133
|
+
model ${entity.pascal} {
|
|
134
|
+
id String @id @default(uuid())
|
|
135
|
+
createdAt DateTime @default(now())
|
|
136
|
+
updatedAt DateTime @updatedAt
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
Then run: pnpm db:push`;
|
|
140
|
+
}
|
|
141
|
+
return instructions;
|
|
142
|
+
}
|
|
143
|
+
// If registration was skipped or failed, show manual instructions
|
|
144
|
+
if (options.skipRegistration) {
|
|
145
|
+
return getProcedureInstructions(entity.plural, entity.pascal);
|
|
146
|
+
}
|
|
147
|
+
// If registration failed, show error and manual instructions
|
|
148
|
+
if (registrationResult?.error) {
|
|
149
|
+
return `
|
|
150
|
+
⚠ Auto-registration failed: ${registrationResult.error}
|
|
151
|
+
|
|
152
|
+
${getProcedureInstructions(entity.plural, entity.pascal)}`;
|
|
153
|
+
}
|
|
154
|
+
// Default: show manual instructions
|
|
155
|
+
return getProcedureInstructions(entity.plural, entity.pascal);
|
|
156
|
+
}
|
|
89
157
|
}
|
|
90
158
|
// ============================================================================
|
|
91
159
|
// Export
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veloxts/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.61",
|
|
4
4
|
"description": "Developer tooling and CLI commands for VeloxTS framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"picocolors": "1.1.1",
|
|
41
41
|
"pluralize": "8.0.0",
|
|
42
42
|
"tsx": "4.21.0",
|
|
43
|
-
"@veloxts/
|
|
44
|
-
"@veloxts/
|
|
45
|
-
"@veloxts/
|
|
46
|
-
"@veloxts/
|
|
47
|
-
"@veloxts/validation": "0.6.
|
|
43
|
+
"@veloxts/auth": "0.6.61",
|
|
44
|
+
"@veloxts/orm": "0.6.61",
|
|
45
|
+
"@veloxts/router": "0.6.61",
|
|
46
|
+
"@veloxts/core": "0.6.61",
|
|
47
|
+
"@veloxts/validation": "0.6.61"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@prisma/client": ">=7.0.0"
|