@travetto/llm-support 8.0.0-alpha.20
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/README.md +101 -0
- package/__index__.ts +11 -0
- package/llm/consumer/INSTRUCTIONS.md +44 -0
- package/llm/maintainer/INSTRUCTIONS.md +37 -0
- package/package.json +56 -0
- package/resources/snippets/autograph-cli-orchestration.md +21 -0
- package/resources/snippets/code/aws-lambda-package-and-deploy.yml.tpl +36 -0
- package/resources/snippets/code/cache-enhancements.config.ts.tpl +6 -0
- package/resources/snippets/code/cache-enhancements.service.ts.tpl +16 -0
- package/resources/snippets/code/create-web-interceptor.ts.tpl +15 -0
- package/resources/snippets/code/create-web-route.controller.ts.tpl +15 -0
- package/resources/snippets/code/create-web-route.service.ts.tpl +8 -0
- package/resources/snippets/code/email-config.ts.tpl +6 -0
- package/resources/snippets/code/email-context-schema.ts.tpl +7 -0
- package/resources/snippets/code/email-create-template.mustache.tpl +2 -0
- package/resources/snippets/code/email-fixture.json.tpl +6 -0
- package/resources/snippets/code/email-preview-test.ts.tpl +14 -0
- package/resources/snippets/code/email-render-pipeline.ts.tpl +12 -0
- package/resources/snippets/code/email-send-controller.ts.tpl +18 -0
- package/resources/snippets/code/email-transport-provider.ts.tpl +8 -0
- package/resources/snippets/code/enable-auth-session.config.ts.tpl +34 -0
- package/resources/snippets/code/enable-auth-session.controller.ts.tpl +30 -0
- package/resources/snippets/code/enable-file-upload.config.ts.tpl +6 -0
- package/resources/snippets/code/enable-file-upload.controller.ts.tpl +16 -0
- package/resources/snippets/code/enable-linting.package.json.tpl +13 -0
- package/resources/snippets/code/generate-config.app-config.ts.tpl +7 -0
- package/resources/snippets/code/generate-config.application.yml.tpl +3 -0
- package/resources/snippets/code/generate-config.local.yml.tpl +2 -0
- package/resources/snippets/code/generate-test-suite.fixture.json.tpl +4 -0
- package/resources/snippets/code/generate-test-suite.unit.ts.tpl +11 -0
- package/resources/snippets/code/model-indexed.indexes.ts.tpl +14 -0
- package/resources/snippets/code/model-indexed.model.ts.tpl +8 -0
- package/resources/snippets/code/model-indexed.service.ts.tpl +15 -0
- package/resources/snippets/code/model-query.service.ts.tpl +18 -0
- package/resources/snippets/code/openapi-client-generation.readme.tpl +13 -0
- package/resources/snippets/code/openapi-client-generation.yml.tpl +20 -0
- package/resources/snippets/code/openapi-spec-pipeline.yml.tpl +21 -0
- package/resources/snippets/code/pack-docker-release.yml.tpl +21 -0
- package/resources/snippets/code/project-bootstrap.application.yml.tpl +2 -0
- package/resources/snippets/code/project-bootstrap.home-controller.ts.tpl +15 -0
- package/resources/snippets/code/project-bootstrap.home-service.ts.tpl +8 -0
- package/resources/snippets/code/project-bootstrap.monorepo.package.json.tpl +12 -0
- package/resources/snippets/code/project-bootstrap.package.json.tpl +18 -0
- package/resources/snippets/code/repo-version-release.yml.tpl +25 -0
- package/resources/snippets/code/rest-rpc-client.client.ts.tpl +8 -0
- package/resources/snippets/code/rest-rpc-client.index.ts.tpl +1 -0
- package/resources/snippets/code/workflow-cloudfront-deploy.yml.tpl +18 -0
- package/resources/snippets/code/workflow-gcp-deploy.yml.tpl +18 -0
- package/resources/snippets/core-aws-lambda-package-and-deploy.md +21 -0
- package/resources/snippets/core-email-compiler-pattern.md +21 -0
- package/resources/snippets/core-email-module-contract.md +21 -0
- package/resources/snippets/core-email-nodemailer-provider.md +21 -0
- package/resources/snippets/core-eslint-ruleset.md +21 -0
- package/resources/snippets/core-openapi-client-generation.md +21 -0
- package/resources/snippets/core-openapi-spec-pipeline.md +21 -0
- package/resources/snippets/core-pack-docker-release.md +21 -0
- package/resources/snippets/core-repo-version-release.md +21 -0
- package/resources/snippets/core-upload-pattern.md +21 -0
- package/resources/snippets/core-web-controller-pattern.md +23 -0
- package/resources/snippets/core-work-pool-pattern.md +23 -0
- package/resources/snippets/embracinglife-cloudfront-deploy.md +21 -0
- package/resources/snippets/embracinglife-gcp-deploy.md +21 -0
- package/resources/snippets/recipe-auth-google-oauth.md +21 -0
- package/resources/snippets/recipe-indexed-model-pattern.md +21 -0
- package/resources/snippets/recipe-upload-presigned.md +21 -0
- package/resources/snippets/todo-app-test-pattern.md +21 -0
- package/src/consumer-docs.ts +23 -0
- package/src/execute.ts +624 -0
- package/src/install-guidance.ts +187 -0
- package/src/mcp.ts +170 -0
- package/src/plan.ts +110 -0
- package/src/recommendation.ts +306 -0
- package/src/snippet-catalog.ts +80 -0
- package/src/snippet-shapes.ts +14 -0
- package/src/template-shapes.ts +13 -0
- package/src/tooling.ts +197 -0
- package/src/types.ts +215 -0
- package/src/workflow-guidance.ts +220 -0
- package/support/base-command.ts +57 -0
- package/support/cli.llm_support_execute.ts +80 -0
- package/support/cli.llm_support_mcp.ts +62 -0
- package/support/cli.llm_support_plan.ts +30 -0
- package/support/cli.llm_support_recommend.ts +34 -0
- package/support/cli.llm_support_status.ts +30 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { MinLength, Required, Schema } from '@travetto/schema';
|
|
2
|
+
|
|
3
|
+
export type AdapterNeed = 'blob' | 'query' | 'indexed' | 'expiry';
|
|
4
|
+
|
|
5
|
+
export type LlmOperationCategory =
|
|
6
|
+
| 'project'
|
|
7
|
+
| 'web'
|
|
8
|
+
| 'auth'
|
|
9
|
+
| 'model'
|
|
10
|
+
| 'upload'
|
|
11
|
+
| 'workflow'
|
|
12
|
+
| 'quality'
|
|
13
|
+
| 'email'
|
|
14
|
+
| 'test'
|
|
15
|
+
| 'config'
|
|
16
|
+
| 'cache';
|
|
17
|
+
|
|
18
|
+
export type ExecutionArtifactStatus = 'planned' | 'created' | 'skipped';
|
|
19
|
+
export type PlanStepId = 'validate-assumptions' | 'generate-artifacts' | 'verify-output';
|
|
20
|
+
|
|
21
|
+
@Schema()
|
|
22
|
+
export class DependencyGraphNodeSchema {
|
|
23
|
+
package = '';
|
|
24
|
+
requires: string[] = [];
|
|
25
|
+
optionalAdapters: string[] = [];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@Schema()
|
|
29
|
+
export class RecommendationQuerySchema {
|
|
30
|
+
@Required(false)
|
|
31
|
+
bundles?: string[];
|
|
32
|
+
|
|
33
|
+
@Required(false)
|
|
34
|
+
workflows?: string[];
|
|
35
|
+
|
|
36
|
+
@Required(false)
|
|
37
|
+
operations?: string[];
|
|
38
|
+
|
|
39
|
+
@Required(false)
|
|
40
|
+
categories?: LlmOperationCategory[];
|
|
41
|
+
|
|
42
|
+
@Required(false)
|
|
43
|
+
snippetTags?: string[];
|
|
44
|
+
|
|
45
|
+
@Required(false)
|
|
46
|
+
includeExcluded?: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Schema()
|
|
50
|
+
export class LlmSupportRecommendToolInput extends RecommendationQuerySchema { }
|
|
51
|
+
|
|
52
|
+
@Schema()
|
|
53
|
+
export class LlmSupportPlanToolInput extends RecommendationQuerySchema { }
|
|
54
|
+
|
|
55
|
+
@Schema()
|
|
56
|
+
export class LlmSupportExecuteToolInput {
|
|
57
|
+
@MinLength(1)
|
|
58
|
+
operations: string[] = [];
|
|
59
|
+
|
|
60
|
+
@MinLength(1)
|
|
61
|
+
targetDir = '.';
|
|
62
|
+
|
|
63
|
+
@Required(false)
|
|
64
|
+
apply?: boolean;
|
|
65
|
+
|
|
66
|
+
@Required(false)
|
|
67
|
+
overwrite?: boolean;
|
|
68
|
+
|
|
69
|
+
@Required(false)
|
|
70
|
+
monorepo?: boolean;
|
|
71
|
+
|
|
72
|
+
@Required(false)
|
|
73
|
+
workspacePath?: string;
|
|
74
|
+
|
|
75
|
+
@Required(false)
|
|
76
|
+
workspaceName?: string;
|
|
77
|
+
|
|
78
|
+
@Required(false)
|
|
79
|
+
routePath?: string;
|
|
80
|
+
|
|
81
|
+
@Required(false)
|
|
82
|
+
controllerName?: string;
|
|
83
|
+
|
|
84
|
+
@Required(false)
|
|
85
|
+
serviceName?: string;
|
|
86
|
+
|
|
87
|
+
@Required(false)
|
|
88
|
+
modelName?: string;
|
|
89
|
+
|
|
90
|
+
@Required(false)
|
|
91
|
+
projectName?: string;
|
|
92
|
+
|
|
93
|
+
@Required(false)
|
|
94
|
+
emailName?: string;
|
|
95
|
+
|
|
96
|
+
@Required(false)
|
|
97
|
+
sendRoutePath?: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@Schema()
|
|
101
|
+
export class InstallGuidanceSchema {
|
|
102
|
+
id = '';
|
|
103
|
+
title = '';
|
|
104
|
+
required: string[] = [];
|
|
105
|
+
optional: string[] = [];
|
|
106
|
+
notes: string[] = [];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@Schema()
|
|
110
|
+
export class WorkflowGuidanceSchema {
|
|
111
|
+
id = '';
|
|
112
|
+
title = '';
|
|
113
|
+
intent = '';
|
|
114
|
+
recommendedModules: string[] = [];
|
|
115
|
+
optionalModules: string[] = [];
|
|
116
|
+
commandDiscoveryRule = '';
|
|
117
|
+
verification: string[] = [];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@Schema()
|
|
121
|
+
export class LlmOperationSchema {
|
|
122
|
+
id = '';
|
|
123
|
+
category: LlmOperationCategory = 'project';
|
|
124
|
+
title = '';
|
|
125
|
+
summary = '';
|
|
126
|
+
requiredModules: string[] = [];
|
|
127
|
+
optionalModules: string[] = [];
|
|
128
|
+
|
|
129
|
+
@Required(false)
|
|
130
|
+
excluded?: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@Schema()
|
|
134
|
+
export class SnippetSourceSchema {
|
|
135
|
+
sourceId = '';
|
|
136
|
+
repositoryId = '';
|
|
137
|
+
filePath = '';
|
|
138
|
+
capabilityTags: string[] = [];
|
|
139
|
+
|
|
140
|
+
@Required(false)
|
|
141
|
+
operationIds?: string[];
|
|
142
|
+
|
|
143
|
+
@Required(false)
|
|
144
|
+
applicability?: string[];
|
|
145
|
+
|
|
146
|
+
notes: string[] = [];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@Schema()
|
|
150
|
+
export class PlannedChangeSchema {
|
|
151
|
+
stepId: PlanStepId = 'generate-artifacts';
|
|
152
|
+
step = '';
|
|
153
|
+
files: string[] = [];
|
|
154
|
+
rationale = '';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@Schema()
|
|
158
|
+
export class OperationPlanSchema {
|
|
159
|
+
operationId = '';
|
|
160
|
+
title = '';
|
|
161
|
+
requiredModules: string[] = [];
|
|
162
|
+
optionalModules: string[] = [];
|
|
163
|
+
changes: PlannedChangeSchema[] = [];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@Schema()
|
|
167
|
+
export class ExecutionArtifactSchema {
|
|
168
|
+
operationId = '';
|
|
169
|
+
file = '';
|
|
170
|
+
status: ExecutionArtifactStatus = 'planned';
|
|
171
|
+
|
|
172
|
+
@Required(false)
|
|
173
|
+
stepId?: PlanStepId;
|
|
174
|
+
|
|
175
|
+
@Required(false)
|
|
176
|
+
reason?: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@Schema()
|
|
180
|
+
export class RecommendationResponseSchema {
|
|
181
|
+
bundles: InstallGuidanceSchema[] = [];
|
|
182
|
+
workflows: WorkflowGuidanceSchema[] = [];
|
|
183
|
+
operations: LlmOperationSchema[] = [];
|
|
184
|
+
snippets: SnippetSourceSchema[] = [];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@Schema()
|
|
188
|
+
export class PlanResponseSchema {
|
|
189
|
+
plans: OperationPlanSchema[] = [];
|
|
190
|
+
snippets: SnippetSourceSchema[] = [];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@Schema()
|
|
194
|
+
export class ExecutionResponseSchema {
|
|
195
|
+
dryRun = true;
|
|
196
|
+
targetDir = '';
|
|
197
|
+
artifacts: ExecutionArtifactSchema[] = [];
|
|
198
|
+
warnings: string[] = [];
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export type DependencyGraphNode = InstanceType<typeof DependencyGraphNodeSchema>;
|
|
202
|
+
export type RecommendationQuery = InstanceType<typeof RecommendationQuerySchema>;
|
|
203
|
+
export type InstallGuidance = InstanceType<typeof InstallGuidanceSchema>;
|
|
204
|
+
export type WorkflowGuidance = InstanceType<typeof WorkflowGuidanceSchema>;
|
|
205
|
+
export type LlmOperation = InstanceType<typeof LlmOperationSchema>;
|
|
206
|
+
export type SnippetSource = InstanceType<typeof SnippetSourceSchema>;
|
|
207
|
+
export type PlannedChange = InstanceType<typeof PlannedChangeSchema>;
|
|
208
|
+
export type OperationPlan = InstanceType<typeof OperationPlanSchema>;
|
|
209
|
+
export type RecommendationResponse = InstanceType<typeof RecommendationResponseSchema>;
|
|
210
|
+
export type PlanResponse = InstanceType<typeof PlanResponseSchema>;
|
|
211
|
+
export type ExecutionArtifact = InstanceType<typeof ExecutionArtifactSchema>;
|
|
212
|
+
export type ExecutionResponse = InstanceType<typeof ExecutionResponseSchema>;
|
|
213
|
+
export type ExecutionRequest = Omit<InstanceType<typeof LlmSupportExecuteToolInput>, 'apply'> & {
|
|
214
|
+
dryRun?: boolean;
|
|
215
|
+
};
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { type WorkflowGuidance } from './types.ts';
|
|
2
|
+
|
|
3
|
+
export const WORKFLOWS: WorkflowGuidance[] = [
|
|
4
|
+
{
|
|
5
|
+
id: 'build-api-service',
|
|
6
|
+
title: 'Build a REST API service',
|
|
7
|
+
intent: 'Expose schema-backed endpoints with DI-managed services.',
|
|
8
|
+
recommendedModules: ['@travetto/web', '@travetto/schema', '@travetto/di', '@travetto/config'],
|
|
9
|
+
optionalModules: ['@travetto/openapi', '@travetto/auth', '@travetto/auth-web'],
|
|
10
|
+
commandDiscoveryRule: 'If CLI command shape is uncertain, validate with npx trv cli:schema before recommending command arguments.',
|
|
11
|
+
verification: [
|
|
12
|
+
'Confirm endpoint decorators and schema decorators are documented in module LLM consumer docs.',
|
|
13
|
+
'Confirm generated guidance is consistent with current CLI schema output.'
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'enable-persistence',
|
|
18
|
+
title: 'Enable persistent model storage',
|
|
19
|
+
intent: 'Provide model contracts and adapter-backed persistence with one adapter family choice (SQL or non-SQL).',
|
|
20
|
+
recommendedModules: ['@travetto/model'],
|
|
21
|
+
optionalModules: [
|
|
22
|
+
'@travetto/model-query',
|
|
23
|
+
'@travetto/model-indexed',
|
|
24
|
+
'@travetto/model-sql',
|
|
25
|
+
'@travetto/model-postgres',
|
|
26
|
+
'@travetto/model-mysql',
|
|
27
|
+
'@travetto/model-sqlite',
|
|
28
|
+
'@travetto/model-memory',
|
|
29
|
+
'@travetto/model-mongo',
|
|
30
|
+
'@travetto/model-dynamodb',
|
|
31
|
+
'@travetto/model-file',
|
|
32
|
+
'@travetto/model-firestore',
|
|
33
|
+
'@travetto/model-redis',
|
|
34
|
+
'@travetto/model-s3',
|
|
35
|
+
'@travetto/model-elasticsearch'
|
|
36
|
+
],
|
|
37
|
+
commandDiscoveryRule: 'Use npx trv cli:schema before proposing model:install or model:export argument forms.',
|
|
38
|
+
verification: [
|
|
39
|
+
'Ensure selected adapter family and module match datastore target and install bundle guidance.',
|
|
40
|
+
'Ensure required capability needs (blob/query/indexed/expiry) align with selected adapter support.'
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'run-background-jobs',
|
|
45
|
+
title: 'Run worker-based background jobs',
|
|
46
|
+
intent: 'Process asynchronous or scheduled work safely across shutdown boundaries.',
|
|
47
|
+
recommendedModules: ['@travetto/worker', '@travetto/runtime', '@travetto/config'],
|
|
48
|
+
optionalModules: ['@travetto/model', '@travetto/context', '@travetto/log'],
|
|
49
|
+
commandDiscoveryRule: 'Validate worker command patterns with npx trv cli:schema whenever command signatures are referenced.',
|
|
50
|
+
verification: [
|
|
51
|
+
'Ensure shutdown behavior and lifecycle guidance references runtime abstractions.',
|
|
52
|
+
'Confirm job storage guidance aligns with selected model adapter.'
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 'enable-google-oauth-passport',
|
|
57
|
+
title: 'Enable Google OAuth with Passport',
|
|
58
|
+
intent: 'Configure auth-web-passport with Google OAuth strategy and map provider profile to application principal.',
|
|
59
|
+
recommendedModules: ['@travetto/web', '@travetto/auth', '@travetto/auth-web', '@travetto/auth-web-passport', '@travetto/config'],
|
|
60
|
+
optionalModules: ['@travetto/model', '@travetto/model-indexed', '@travetto/model-firestore', '@travetto/auth-model'],
|
|
61
|
+
commandDiscoveryRule: 'Validate auth and web command signatures with npx trv cli:schema before recommending CLI invocations.',
|
|
62
|
+
verification: [
|
|
63
|
+
'Ensure google.auth config includes clientID, clientSecret, and callbackUrl.',
|
|
64
|
+
'Ensure a PassportAuthenticator is registered with Google OAuth strategy and stable principal mapping.',
|
|
65
|
+
'If user persistence is required, ensure external-id lookup/index and one model adapter are configured.'
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'project-bootstrap',
|
|
70
|
+
title: 'Bootstrap a new project',
|
|
71
|
+
intent: 'Create a project baseline using guided prompts for model backend, quality, and initial web stack.',
|
|
72
|
+
recommendedModules: ['@travetto/web', '@travetto/web-http', '@travetto/openapi', '@travetto/runtime', '@travetto/config'],
|
|
73
|
+
optionalModules: ['@travetto/schema', '@travetto/di', '@travetto/model', '@travetto/test', '@travetto/eslint'],
|
|
74
|
+
commandDiscoveryRule: 'Validate command signatures with npx trv cli:schema before suggesting starter commands.',
|
|
75
|
+
verification: [
|
|
76
|
+
'Ensure generated project includes selected web and model modules from prompt answers.',
|
|
77
|
+
'Ensure generated package scripts include startup, test, and lint commands when selected.'
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'create-web-route',
|
|
82
|
+
title: 'Create route/controller/service',
|
|
83
|
+
intent: 'Generate web route handlers with controller and service separation, aligned with schema and DI conventions.',
|
|
84
|
+
recommendedModules: ['@travetto/web', '@travetto/schema', '@travetto/di'],
|
|
85
|
+
optionalModules: ['@travetto/auth', '@travetto/auth-web', '@travetto/model-query'],
|
|
86
|
+
commandDiscoveryRule: 'Validate web and schema command references with npx trv cli:schema before publishing examples.',
|
|
87
|
+
verification: [
|
|
88
|
+
'Ensure route methods use controller decorators and typed parameter bindings.',
|
|
89
|
+
'Ensure service wiring uses @Injectable and @Inject patterns.'
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'enable-auth-session',
|
|
94
|
+
title: 'Enable auth with sessions',
|
|
95
|
+
intent: 'Configure login/self/logout with session-backed identity in local memory.',
|
|
96
|
+
recommendedModules: ['@travetto/auth', '@travetto/auth-web', '@travetto/auth-session', '@travetto/auth-web-session', '@travetto/model-memory'],
|
|
97
|
+
optionalModules: ['@travetto/model', '@travetto/model-indexed', '@travetto/web'],
|
|
98
|
+
commandDiscoveryRule: 'Validate auth-web decorators and auth command references with npx trv cli:schema before publishing examples.',
|
|
99
|
+
verification: [
|
|
100
|
+
'Ensure auth config exposes authenticator, authorizer, and session store factories.',
|
|
101
|
+
'Ensure /auth/login, /auth/self, and /auth/logout routes are registered and session-aware.'
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'generate-web-model-crud',
|
|
106
|
+
title: 'Generate web-model CRUD API',
|
|
107
|
+
intent: 'Generate web + model CRUD patterns from curated templates and adapt to domain classes.',
|
|
108
|
+
recommendedModules: ['@travetto/web', '@travetto/model', '@travetto/model-query', '@travetto/schema', '@travetto/di'],
|
|
109
|
+
optionalModules: ['@travetto/auth', '@travetto/auth-web', '@travetto/model-indexed'],
|
|
110
|
+
commandDiscoveryRule: 'Validate web/controller command references and generated route assumptions with npx trv cli:schema.',
|
|
111
|
+
verification: [
|
|
112
|
+
'Ensure controller CRUD methods bind to a model-query capable source.',
|
|
113
|
+
'Ensure principal-scoped filtering is applied when auth-web integration is enabled.'
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'model-backend-selection',
|
|
118
|
+
title: 'Model backend selection',
|
|
119
|
+
intent: 'Choose one supported datastore adapter and align model service/config classes.',
|
|
120
|
+
recommendedModules: ['@travetto/model'],
|
|
121
|
+
optionalModules: [
|
|
122
|
+
'@travetto/model-elasticsearch',
|
|
123
|
+
'@travetto/model-mongo',
|
|
124
|
+
'@travetto/model-sql',
|
|
125
|
+
'@travetto/model-mysql',
|
|
126
|
+
'@travetto/model-postgres',
|
|
127
|
+
'@travetto/model-sqlite'
|
|
128
|
+
],
|
|
129
|
+
commandDiscoveryRule: 'Validate model command signatures and adapter setup commands with npx trv cli:schema before recommendation output.',
|
|
130
|
+
verification: [
|
|
131
|
+
'Ensure selected adapter is supported and matches deployment datastore target.',
|
|
132
|
+
'Ensure SQL-family selections include shared SQL runtime package requirements.'
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: 'quality-lint-and-test',
|
|
137
|
+
title: 'Enable lint and test quality checks',
|
|
138
|
+
intent: 'Enable quality features so generated projects have immediate test and lint feedback loops.',
|
|
139
|
+
recommendedModules: ['@travetto/test', '@travetto/eslint'],
|
|
140
|
+
optionalModules: [],
|
|
141
|
+
commandDiscoveryRule: 'Validate test and lint command examples with npx trv cli:schema or generated package scripts before suggesting execution.',
|
|
142
|
+
verification: [
|
|
143
|
+
'Ensure generated package scripts include test and lint commands when selected.',
|
|
144
|
+
'Run test and lint once after generation to catch template/config drift early.'
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: 'add-email-generation',
|
|
149
|
+
title: 'Add email generation and delivery',
|
|
150
|
+
intent: 'Generate template, schema contract, compiler pipeline, provider wiring, and send integration for email flows.',
|
|
151
|
+
recommendedModules: ['@travetto/email'],
|
|
152
|
+
optionalModules: ['@travetto/email-compiler', '@travetto/email-inky', '@travetto/email-nodemailer', '@travetto/worker'],
|
|
153
|
+
commandDiscoveryRule: 'Validate command signatures with npx trv cli:schema before recommending email generation commands.',
|
|
154
|
+
verification: [
|
|
155
|
+
'Ensure generated template context has a typed schema contract.',
|
|
156
|
+
'Ensure renderer and transport wiring are both validated by tests or snapshots.',
|
|
157
|
+
'Ensure send integration supports direct and worker-based execution paths.'
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: 'openapi-spec-pipeline',
|
|
162
|
+
title: 'Add OpenAPI spec pipeline',
|
|
163
|
+
intent: 'Generate and persist OpenAPI specs as build artifacts and optionally commit outputs.',
|
|
164
|
+
recommendedModules: ['@travetto/openapi', '@travetto/web', '@travetto/schema'],
|
|
165
|
+
optionalModules: ['@travetto/cli'],
|
|
166
|
+
commandDiscoveryRule: 'Validate OpenAPI command signatures with npx trv cli:schema before recommending command invocations.',
|
|
167
|
+
verification: [
|
|
168
|
+
'Ensure openapi:spec output path and format match repository conventions.',
|
|
169
|
+
'Ensure generated spec is available as CI artifact for downstream use.'
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
id: 'openapi-client-generation',
|
|
174
|
+
title: 'Add OpenAPI client generation workflow',
|
|
175
|
+
intent: 'Generate API clients from OpenAPI artifacts and keep them synchronized with endpoint changes.',
|
|
176
|
+
recommendedModules: ['@travetto/openapi'],
|
|
177
|
+
optionalModules: ['@travetto/web-rpc', '@travetto/web'],
|
|
178
|
+
commandDiscoveryRule: 'Validate openapi:client command signatures with npx trv cli:schema before recommending formats or arguments.',
|
|
179
|
+
verification: [
|
|
180
|
+
'Ensure generated client output location is stable and committed when required.',
|
|
181
|
+
'Ensure workflow runs after spec generation and fails fast on generator errors.'
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
id: 'aws-lambda-package-and-deploy',
|
|
186
|
+
title: 'Add AWS Lambda package and deploy workflow',
|
|
187
|
+
intent: 'Package web entrypoint for AWS Lambda and deploy artifacts through CI.',
|
|
188
|
+
recommendedModules: ['@travetto/web-aws-lambda', '@travetto/pack'],
|
|
189
|
+
optionalModules: ['@travetto/web', '@travetto/config'],
|
|
190
|
+
commandDiscoveryRule: 'Validate pack:lambda command signatures with npx trv cli:schema before recommending packaging flags.',
|
|
191
|
+
verification: [
|
|
192
|
+
'Ensure lambda package artifact is produced and published by CI.',
|
|
193
|
+
'Ensure workflow includes environment-specific deploy step stubs.'
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: 'pack-docker-release',
|
|
198
|
+
title: 'Add Docker pack release workflow',
|
|
199
|
+
intent: 'Build and publish container images from Travetto pack:docker in CI.',
|
|
200
|
+
recommendedModules: ['@travetto/pack'],
|
|
201
|
+
optionalModules: ['@travetto/runtime', '@travetto/config'],
|
|
202
|
+
commandDiscoveryRule: 'Validate pack:docker command signatures with npx trv cli:schema before recommending image/tag flags.',
|
|
203
|
+
verification: [
|
|
204
|
+
'Ensure image tags, registry targets, and build platform inputs are explicit.',
|
|
205
|
+
'Ensure workflow supports dry runs or stage-only builds for PR validation.'
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: 'repo-version-release',
|
|
210
|
+
title: 'Add repo version release flow',
|
|
211
|
+
intent: 'Automate monorepo versioning with change-aware release mode and optional tagging.',
|
|
212
|
+
recommendedModules: ['@travetto/repo'],
|
|
213
|
+
optionalModules: ['@travetto/registry', '@travetto/pack'],
|
|
214
|
+
commandDiscoveryRule: 'Validate repo:version and repo:publish command signatures with npx trv cli:schema before suggesting release automation.',
|
|
215
|
+
verification: [
|
|
216
|
+
'Ensure release mode and semver level are explicit and reviewed in CI inputs.',
|
|
217
|
+
'Ensure release commits and tags align with repository policy.'
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { CliFlag, CliModuleFlag, type CliCommandShape } from '@travetto/cli';
|
|
2
|
+
import { Required } from '@travetto/schema';
|
|
3
|
+
import { JSONUtil } from '@travetto/runtime';
|
|
4
|
+
|
|
5
|
+
import { getValidOperationIds, LLM_OPERATION_CATEGORIES } from '../src/recommendation.ts';
|
|
6
|
+
import { getValidSnippetTags } from '../src/snippet-catalog.ts';
|
|
7
|
+
import type { LlmOperationCategory } from '../src/types.ts';
|
|
8
|
+
|
|
9
|
+
interface LlmSupportValidValues {
|
|
10
|
+
categories: readonly LlmOperationCategory[];
|
|
11
|
+
operations: string[];
|
|
12
|
+
snippetTags: string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export abstract class LlmSupportCommandBase implements CliCommandShape {
|
|
16
|
+
|
|
17
|
+
@CliModuleFlag(({ scope: 'command' }))
|
|
18
|
+
module: string = '';
|
|
19
|
+
|
|
20
|
+
async getValidValues(includeExcluded: boolean): Promise<LlmSupportValidValues> {
|
|
21
|
+
return {
|
|
22
|
+
categories: LLM_OPERATION_CATEGORIES,
|
|
23
|
+
operations: getValidOperationIds(includeExcluded),
|
|
24
|
+
snippetTags: await getValidSnippetTags()
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async writeOutput(payload: object, includeExcluded: boolean): Promise<void> {
|
|
29
|
+
const valid = await this.getValidValues(includeExcluded);
|
|
30
|
+
process.stdout.write(`${JSONUtil.toUTF8({ ...payload, valid }, { indent: 2 })}\n`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
abstract main(): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export abstract class LlmSupportScopedCommandBase extends LlmSupportCommandBase {
|
|
37
|
+
|
|
38
|
+
@CliFlag({ short: 'c', full: 'categories' })
|
|
39
|
+
@Required(false)
|
|
40
|
+
categories?: LlmOperationCategory[];
|
|
41
|
+
|
|
42
|
+
@CliFlag({ full: 'include-excluded' })
|
|
43
|
+
includeExcluded = false;
|
|
44
|
+
|
|
45
|
+
getScopedCategories(): LlmOperationCategory[] {
|
|
46
|
+
return this.categories?.filter(item =>
|
|
47
|
+
LLM_OPERATION_CATEGORIES.some(allowed => allowed === item)
|
|
48
|
+
) ?? [];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export abstract class LlmSupportScopedSnippetCommandBase extends LlmSupportScopedCommandBase {
|
|
53
|
+
|
|
54
|
+
@CliFlag({ short: 't', full: 'snippet-tags' })
|
|
55
|
+
@Required(false)
|
|
56
|
+
snippetTags?: string[];
|
|
57
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
import { CliCommand, CliFlag } from '@travetto/cli';
|
|
4
|
+
import { MinLength } from '@travetto/schema';
|
|
5
|
+
|
|
6
|
+
import { executeOperations } from '../src/execute.ts';
|
|
7
|
+
import { LlmSupportCommandBase } from './base-command.ts';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Execute llm-support operations with dry-run by default.
|
|
11
|
+
*/
|
|
12
|
+
@CliCommand()
|
|
13
|
+
export class LlmSupportExecuteCommand extends LlmSupportCommandBase {
|
|
14
|
+
|
|
15
|
+
@CliFlag({ short: 'o', full: 'operations' })
|
|
16
|
+
@MinLength(1)
|
|
17
|
+
operations?: string[];
|
|
18
|
+
|
|
19
|
+
@CliFlag({ short: 'd', full: 'dir' })
|
|
20
|
+
targetDir = process.cwd();
|
|
21
|
+
|
|
22
|
+
@CliFlag({ full: 'apply' })
|
|
23
|
+
apply = false;
|
|
24
|
+
|
|
25
|
+
@CliFlag({ full: 'overwrite' })
|
|
26
|
+
overwrite = false;
|
|
27
|
+
|
|
28
|
+
@CliFlag({ full: 'monorepo' })
|
|
29
|
+
monorepo = false;
|
|
30
|
+
|
|
31
|
+
@CliFlag({ full: 'workspace-path' })
|
|
32
|
+
workspacePath?: string;
|
|
33
|
+
|
|
34
|
+
@CliFlag({ full: 'workspace-name' })
|
|
35
|
+
workspaceName?: string;
|
|
36
|
+
|
|
37
|
+
@CliFlag({ full: 'route-path' })
|
|
38
|
+
routePath?: string;
|
|
39
|
+
|
|
40
|
+
@CliFlag({ full: 'controller-name' })
|
|
41
|
+
controllerName?: string;
|
|
42
|
+
|
|
43
|
+
@CliFlag({ full: 'service-name' })
|
|
44
|
+
serviceName?: string;
|
|
45
|
+
|
|
46
|
+
@CliFlag({ full: 'model-name' })
|
|
47
|
+
modelName?: string;
|
|
48
|
+
|
|
49
|
+
@CliFlag({ full: 'project-name' })
|
|
50
|
+
projectName?: string;
|
|
51
|
+
|
|
52
|
+
@CliFlag({ full: 'email-name' })
|
|
53
|
+
emailName?: string;
|
|
54
|
+
|
|
55
|
+
@CliFlag({ full: 'send-route-path' })
|
|
56
|
+
sendRoutePath?: string;
|
|
57
|
+
|
|
58
|
+
async main(): Promise<void> {
|
|
59
|
+
const operations = this.operations ?? [];
|
|
60
|
+
|
|
61
|
+
const payload = await executeOperations({
|
|
62
|
+
operations,
|
|
63
|
+
targetDir: path.resolve(this.targetDir),
|
|
64
|
+
dryRun: !this.apply,
|
|
65
|
+
overwrite: this.overwrite,
|
|
66
|
+
monorepo: this.monorepo,
|
|
67
|
+
workspacePath: this.workspacePath,
|
|
68
|
+
workspaceName: this.workspaceName,
|
|
69
|
+
routePath: this.routePath,
|
|
70
|
+
controllerName: this.controllerName,
|
|
71
|
+
serviceName: this.serviceName,
|
|
72
|
+
modelName: this.modelName,
|
|
73
|
+
projectName: this.projectName,
|
|
74
|
+
emailName: this.emailName,
|
|
75
|
+
sendRoutePath: this.sendRoutePath
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
await this.writeOutput(payload, true);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createInterface } from 'node:readline';
|
|
2
|
+
|
|
3
|
+
import { CliCommand, type CliCommandShape } from '@travetto/cli';
|
|
4
|
+
import { JSONUtil } from '@travetto/runtime';
|
|
5
|
+
|
|
6
|
+
import { handleMcpRequest, type JsonRpcRequest } from '../src/mcp.ts';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Minimal MCP stdio server for llm-support tools.
|
|
10
|
+
*/
|
|
11
|
+
@CliCommand()
|
|
12
|
+
export class LlmSupportMcpCommand implements CliCommandShape {
|
|
13
|
+
async main(): Promise<void> {
|
|
14
|
+
const rl = createInterface({
|
|
15
|
+
input: process.stdin,
|
|
16
|
+
crlfDelay: Infinity
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const active: Promise<void>[] = [];
|
|
20
|
+
|
|
21
|
+
const processLine = async (line: string): Promise<void> => {
|
|
22
|
+
const trimmed = line.trim();
|
|
23
|
+
if (!trimmed) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let request: JsonRpcRequest;
|
|
28
|
+
try {
|
|
29
|
+
request = JSONUtil.fromUTF8(trimmed);
|
|
30
|
+
} catch {
|
|
31
|
+
const parseError = {
|
|
32
|
+
jsonrpc: '2.0',
|
|
33
|
+
id: null,
|
|
34
|
+
error: {
|
|
35
|
+
code: -32700,
|
|
36
|
+
message: 'Parse error'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
process.stdout.write(`${JSONUtil.toUTF8(parseError)}\n`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const response = await handleMcpRequest(request);
|
|
44
|
+
if (response) {
|
|
45
|
+
process.stdout.write(`${JSONUtil.toUTF8(response)}\n`);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
rl.on('line', line => {
|
|
50
|
+
const run = processLine(line).finally(() => {
|
|
51
|
+
const idx = active.indexOf(run);
|
|
52
|
+
if (idx >= 0) {
|
|
53
|
+
active.splice(idx, 1);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
active.push(run);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
await new Promise<void>(resolve => rl.on('close', resolve));
|
|
60
|
+
await Promise.all(active);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CliCommand, CliFlag } from '@travetto/cli';
|
|
2
|
+
import { MinLength, Required } from '@travetto/schema';
|
|
3
|
+
|
|
4
|
+
import { buildPlans } from '../src/plan.ts';
|
|
5
|
+
import { LlmSupportScopedSnippetCommandBase } from './base-command.ts';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Build plan-first execution details for llm-support operations.
|
|
9
|
+
*/
|
|
10
|
+
@CliCommand()
|
|
11
|
+
export class LlmSupportPlanCommand extends LlmSupportScopedSnippetCommandBase {
|
|
12
|
+
|
|
13
|
+
@CliFlag({ short: 'o', full: 'operations' })
|
|
14
|
+
@Required(false)
|
|
15
|
+
@MinLength(1)
|
|
16
|
+
operations?: string[];
|
|
17
|
+
|
|
18
|
+
async main(): Promise<void> {
|
|
19
|
+
const categories = this.getScopedCategories();
|
|
20
|
+
|
|
21
|
+
const payload = await buildPlans({
|
|
22
|
+
operations: this.operations?.filter(Boolean) ?? [],
|
|
23
|
+
categories,
|
|
24
|
+
snippetTags: this.snippetTags?.filter(Boolean) ?? [],
|
|
25
|
+
includeExcluded: this.includeExcluded
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
await this.writeOutput(payload, this.includeExcluded);
|
|
29
|
+
}
|
|
30
|
+
}
|