litedbmodel-gen 0.7.0 → 0.7.1
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 +3 -3
- package/cli-contract.yaml +6 -6
- package/dist/cli.js +31 -31
- package/dist/cli.js.map +1 -1
- package/dist/litedbmodel-gen.bundle.mjs +182 -182
- package/dist/litedbmodel-gen.bundle.mjs.map +2 -2
- package/docs/cli-reference.md +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ npx litedbmodel-gen implement \
|
|
|
77
77
|
|
|
78
78
|
# Preview the full prompt without calling the LLM
|
|
79
79
|
npx litedbmodel-gen implement "Add bulk user import" \
|
|
80
|
-
--target src/services/user.service.ts --
|
|
80
|
+
--target src/services/user.service.ts --show-prompt
|
|
81
81
|
|
|
82
82
|
# Write result to a file
|
|
83
83
|
npx litedbmodel-gen implement "..." --target src/services/foo.ts --adapter claude -o result.json
|
|
@@ -89,7 +89,7 @@ npx litedbmodel-gen implement "..." --target src/services/foo.ts --adapter claud
|
|
|
89
89
|
| `--models <glob>` | `models/**/*.ts` | Glob pattern for model definition files |
|
|
90
90
|
| `--adapter <name>` | `mock` | LLM adapter: `claude`, `openai`, `gemini`, `cursor`, `mock` |
|
|
91
91
|
| `--model <name>` | — | Model name override for the adapter |
|
|
92
|
-
| `--
|
|
92
|
+
| `--show-prompt` | `false` | Output the prompt without calling the LLM |
|
|
93
93
|
| `--report-format` | `json` | Output format: `json`, `text`, `yaml` |
|
|
94
94
|
| `--output <path>` | — | Write result to file instead of stdout |
|
|
95
95
|
| `--fail-on` | `error` | Minimum severity that causes exit code 10 |
|
|
@@ -115,7 +115,7 @@ npx litedbmodel-gen audit src/ --adapter claude --report-format text
|
|
|
115
115
|
|--------|---------|-------------|
|
|
116
116
|
| `--adapter <name>` | `mock` | LLM adapter: `claude`, `openai`, `gemini`, `cursor`, `mock` |
|
|
117
117
|
| `--model <name>` | — | Model name override for the adapter |
|
|
118
|
-
| `--
|
|
118
|
+
| `--show-prompt` | `false` | Output the prompt without calling the LLM |
|
|
119
119
|
| `--report-format` | `json` | Output format: `json`, `text`, `yaml` |
|
|
120
120
|
| `--output <path>` | — | Write result to file instead of stdout |
|
|
121
121
|
| `--fail-on` | `error` | Minimum severity that causes exit code 10 |
|
package/cli-contract.yaml
CHANGED
|
@@ -150,8 +150,8 @@ command_sets:
|
|
|
150
150
|
schema:
|
|
151
151
|
type: string
|
|
152
152
|
|
|
153
|
-
- name:
|
|
154
|
-
description: Output the constructed prompt without calling the LLM.
|
|
153
|
+
- name: show-prompt
|
|
154
|
+
description: Output the constructed prompt without calling the LLM API.
|
|
155
155
|
schema:
|
|
156
156
|
type: boolean
|
|
157
157
|
default: false
|
|
@@ -197,7 +197,7 @@ command_sets:
|
|
|
197
197
|
sideEffectNote: >-
|
|
198
198
|
Makes network calls to the configured LLM provider when adapter is
|
|
199
199
|
not "mock". Writes to the filesystem only when --output is specified.
|
|
200
|
-
safeDryRunOption:
|
|
200
|
+
safeDryRunOption: show-prompt
|
|
201
201
|
expectedDurationMs: 120000
|
|
202
202
|
retryableExitCodes: [1, 12]
|
|
203
203
|
|
|
@@ -302,8 +302,8 @@ command_sets:
|
|
|
302
302
|
schema:
|
|
303
303
|
type: string
|
|
304
304
|
|
|
305
|
-
- name:
|
|
306
|
-
description: Output the constructed prompt without calling the LLM.
|
|
305
|
+
- name: show-prompt
|
|
306
|
+
description: Output the constructed prompt without calling the LLM API.
|
|
307
307
|
schema:
|
|
308
308
|
type: boolean
|
|
309
309
|
default: false
|
|
@@ -350,7 +350,7 @@ command_sets:
|
|
|
350
350
|
The agent reads project files and writes implementation code
|
|
351
351
|
directly to the target source file(s). Uses an agentic adapter
|
|
352
352
|
(claude/cursor) with file read/write tools.
|
|
353
|
-
safeDryRunOption:
|
|
353
|
+
safeDryRunOption: show-prompt
|
|
354
354
|
expectedDurationMs: 120000
|
|
355
355
|
retryableExitCodes: [1, 12]
|
|
356
356
|
|
package/dist/cli.js
CHANGED
|
@@ -6239,8 +6239,8 @@ command_sets:
|
|
|
6239
6239
|
schema:
|
|
6240
6240
|
type: string
|
|
6241
6241
|
|
|
6242
|
-
- name:
|
|
6243
|
-
description: Output the constructed prompt without calling the LLM.
|
|
6242
|
+
- name: show-prompt
|
|
6243
|
+
description: Output the constructed prompt without calling the LLM API.
|
|
6244
6244
|
schema:
|
|
6245
6245
|
type: boolean
|
|
6246
6246
|
default: false
|
|
@@ -6286,7 +6286,7 @@ command_sets:
|
|
|
6286
6286
|
sideEffectNote: >-
|
|
6287
6287
|
Makes network calls to the configured LLM provider when adapter is
|
|
6288
6288
|
not "mock". Writes to the filesystem only when --output is specified.
|
|
6289
|
-
safeDryRunOption:
|
|
6289
|
+
safeDryRunOption: show-prompt
|
|
6290
6290
|
expectedDurationMs: 120000
|
|
6291
6291
|
retryableExitCodes: [1, 12]
|
|
6292
6292
|
|
|
@@ -6391,8 +6391,8 @@ command_sets:
|
|
|
6391
6391
|
schema:
|
|
6392
6392
|
type: string
|
|
6393
6393
|
|
|
6394
|
-
- name:
|
|
6395
|
-
description: Output the constructed prompt without calling the LLM.
|
|
6394
|
+
- name: show-prompt
|
|
6395
|
+
description: Output the constructed prompt without calling the LLM API.
|
|
6396
6396
|
schema:
|
|
6397
6397
|
type: boolean
|
|
6398
6398
|
default: false
|
|
@@ -6439,7 +6439,7 @@ command_sets:
|
|
|
6439
6439
|
The agent reads project files and writes implementation code
|
|
6440
6440
|
directly to the target source file(s). Uses an agentic adapter
|
|
6441
6441
|
(claude/cursor) with file read/write tools.
|
|
6442
|
-
safeDryRunOption:
|
|
6442
|
+
safeDryRunOption: show-prompt
|
|
6443
6443
|
expectedDurationMs: 120000
|
|
6444
6444
|
retryableExitCodes: [1, 12]
|
|
6445
6445
|
|
|
@@ -6823,8 +6823,8 @@ var CONTRACT_JSON_STR = `{
|
|
|
6823
6823
|
}
|
|
6824
6824
|
},
|
|
6825
6825
|
{
|
|
6826
|
-
"name": "
|
|
6827
|
-
"description": "Output the constructed prompt without calling the LLM.",
|
|
6826
|
+
"name": "show-prompt",
|
|
6827
|
+
"description": "Output the constructed prompt without calling the LLM API.",
|
|
6828
6828
|
"schema": {
|
|
6829
6829
|
"type": "boolean",
|
|
6830
6830
|
"default": false
|
|
@@ -6892,7 +6892,7 @@ var CONTRACT_JSON_STR = `{
|
|
|
6892
6892
|
"network"
|
|
6893
6893
|
],
|
|
6894
6894
|
"sideEffectNote": "Makes network calls to the configured LLM provider when adapter is not \\"mock\\". Writes to the filesystem only when --output is specified.",
|
|
6895
|
-
"safeDryRunOption": "
|
|
6895
|
+
"safeDryRunOption": "show-prompt",
|
|
6896
6896
|
"expectedDurationMs": 120000,
|
|
6897
6897
|
"retryableExitCodes": [
|
|
6898
6898
|
1,
|
|
@@ -7004,8 +7004,8 @@ var CONTRACT_JSON_STR = `{
|
|
|
7004
7004
|
}
|
|
7005
7005
|
},
|
|
7006
7006
|
{
|
|
7007
|
-
"name": "
|
|
7008
|
-
"description": "Output the constructed prompt without calling the LLM.",
|
|
7007
|
+
"name": "show-prompt",
|
|
7008
|
+
"description": "Output the constructed prompt without calling the LLM API.",
|
|
7009
7009
|
"schema": {
|
|
7010
7010
|
"type": "boolean",
|
|
7011
7011
|
"default": false
|
|
@@ -7074,7 +7074,7 @@ var CONTRACT_JSON_STR = `{
|
|
|
7074
7074
|
"filesystem_write"
|
|
7075
7075
|
],
|
|
7076
7076
|
"sideEffectNote": "The agent reads project files and writes implementation code directly to the target source file(s). Uses an agentic adapter (claude/cursor) with file read/write tools.",
|
|
7077
|
-
"safeDryRunOption": "
|
|
7077
|
+
"safeDryRunOption": "show-prompt",
|
|
7078
7078
|
"expectedDurationMs": 120000,
|
|
7079
7079
|
"retryableExitCodes": [
|
|
7080
7080
|
1,
|
|
@@ -7416,7 +7416,7 @@ function createProgram(handlers2, version2) {
|
|
|
7416
7416
|
program2.command("init").description("Set up litedbmodel-gen in an embedoc project.").argument("[config]", "Path to embedoc.config.yaml. Defaults to embedoc.config.yaml in the current directory.").action(async (config2, opts, cmd) => {
|
|
7417
7417
|
await handlers2.init(config2, {}, cmd.optsWithGlobals());
|
|
7418
7418
|
});
|
|
7419
|
-
program2.command("audit").description("Audit litedbmodel usage code for common anti-patterns.").argument("[target]", "File or directory path to audit. Defaults to the current working directory.").option("--adapter <value>", "LLM adapter to use for the audit.", "mock").option("--model <value>", "Model name override for the selected adapter.").option("--
|
|
7419
|
+
program2.command("audit").description("Audit litedbmodel usage code for common anti-patterns.").argument("[target]", "File or directory path to audit. Defaults to the current working directory.").option("--adapter <value>", "LLM adapter to use for the audit.", "mock").option("--model <value>", "Model name override for the selected adapter.").option("--show-prompt", "Output the constructed prompt without calling the LLM API.", false).option("--fail-on <value>", "Minimum finding severity that causes exit code 10. Findings below this threshold are still reported.", "error").option("-o, --output <value>", "Write the report to a file instead of stdout.").option("--report-format <value>", "Output format for the audit report.", "json").option("-l, --log-file <value>", "File path to write structured progress logs.").action(async (target, opts, cmd) => {
|
|
7420
7420
|
if (opts.showPrompt) {
|
|
7421
7421
|
const prompt = await handlers2.audit(target, opts, cmd.optsWithGlobals());
|
|
7422
7422
|
if (typeof prompt === "string") process.stdout.write(prompt + "\n");
|
|
@@ -7424,7 +7424,7 @@ function createProgram(handlers2, version2) {
|
|
|
7424
7424
|
}
|
|
7425
7425
|
await handlers2.audit(target, opts, cmd.optsWithGlobals());
|
|
7426
7426
|
});
|
|
7427
|
-
program2.command("implement").description("Implement a feature using litedbmodel best practices.").argument("<description>", "Natural-language description of the feature to implement. Should specify the function name, target file, and business logic.").option("-t, --target <value>", "Target source file(s) to create or edit. The agent reads these files to understand existing code and writes the implementation to them.").option("--models <value>", "Glob pattern for model definition files. The agent reads these to understand available models, columns, and relations.", "models/**/*.ts").option("--adapter <value>", "LLM adapter to use for code generation.", "mock").option("--model <value>", "Model name override for the selected adapter.").option("--
|
|
7427
|
+
program2.command("implement").description("Implement a feature using litedbmodel best practices.").argument("<description>", "Natural-language description of the feature to implement. Should specify the function name, target file, and business logic.").option("-t, --target <value>", "Target source file(s) to create or edit. The agent reads these files to understand existing code and writes the implementation to them.").option("--models <value>", "Glob pattern for model definition files. The agent reads these to understand available models, columns, and relations.", "models/**/*.ts").option("--adapter <value>", "LLM adapter to use for code generation.", "mock").option("--model <value>", "Model name override for the selected adapter.").option("--show-prompt", "Output the constructed prompt without calling the LLM API.", false).option("--fail-on <value>", "Minimum finding severity that causes exit code 10. Design concerns (info/warning) are still reported at exit 0.", "error").option("-o, --output <value>", "Write the report to a file instead of stdout.").option("--report-format <value>", "Output format for the implementation report.", "json").option("-l, --log-file <value>", "File path to write structured progress logs.").action(async (description, opts, cmd) => {
|
|
7428
7428
|
if (opts.showPrompt) {
|
|
7429
7429
|
const prompt = await handlers2.implement(description, opts, cmd.optsWithGlobals());
|
|
7430
7430
|
if (typeof prompt === "string") process.stdout.write(prompt + "\n");
|
|
@@ -8268,7 +8268,7 @@ async function runAgentTask(userRequest, taskId, config2, options) {
|
|
|
8268
8268
|
}
|
|
8269
8269
|
});
|
|
8270
8270
|
const registries = ctx.registries;
|
|
8271
|
-
if (options.
|
|
8271
|
+
if (options.showPrompt) {
|
|
8272
8272
|
const task = registries.taskRegistry[taskId];
|
|
8273
8273
|
const targetAgent = task?.target_agent;
|
|
8274
8274
|
const agent = targetAgent ? registries.agentRegistry[targetAgent] : void 0;
|
|
@@ -8291,7 +8291,7 @@ async function runAgentTask(userRequest, taskId, config2, options) {
|
|
|
8291
8291
|
data: null,
|
|
8292
8292
|
raw: "",
|
|
8293
8293
|
prompt: fullPrompt,
|
|
8294
|
-
|
|
8294
|
+
showPrompt: true,
|
|
8295
8295
|
status: "success",
|
|
8296
8296
|
followUpsUsed: 0,
|
|
8297
8297
|
retriesUsed: 0
|
|
@@ -8322,7 +8322,7 @@ async function runAgentTask(userRequest, taskId, config2, options) {
|
|
|
8322
8322
|
data: outcome.data,
|
|
8323
8323
|
raw: outcome.raw ?? "",
|
|
8324
8324
|
prompt: userRequest,
|
|
8325
|
-
|
|
8325
|
+
showPrompt: false,
|
|
8326
8326
|
status: "success",
|
|
8327
8327
|
followUpsUsed: follow_ups_used,
|
|
8328
8328
|
retriesUsed: retries_used
|
|
@@ -8334,7 +8334,7 @@ async function runAgentTask(userRequest, taskId, config2, options) {
|
|
|
8334
8334
|
data: null,
|
|
8335
8335
|
raw: outcome.raw ?? "",
|
|
8336
8336
|
prompt: userRequest,
|
|
8337
|
-
|
|
8337
|
+
showPrompt: false,
|
|
8338
8338
|
status: "validation_error",
|
|
8339
8339
|
errorMessage: outcome.errors.join("; "),
|
|
8340
8340
|
followUpsUsed: follow_ups_used,
|
|
@@ -8347,7 +8347,7 @@ async function runAgentTask(userRequest, taskId, config2, options) {
|
|
|
8347
8347
|
data: null,
|
|
8348
8348
|
raw: outcome.raw ?? "",
|
|
8349
8349
|
prompt: userRequest,
|
|
8350
|
-
|
|
8350
|
+
showPrompt: false,
|
|
8351
8351
|
status: "escalation",
|
|
8352
8352
|
errorMessage: outcome.reason,
|
|
8353
8353
|
followUpsUsed: follow_ups_used,
|
|
@@ -8359,7 +8359,7 @@ async function runAgentTask(userRequest, taskId, config2, options) {
|
|
|
8359
8359
|
data: null,
|
|
8360
8360
|
raw: "",
|
|
8361
8361
|
prompt: userRequest,
|
|
8362
|
-
|
|
8362
|
+
showPrompt: false,
|
|
8363
8363
|
status: "error",
|
|
8364
8364
|
errorMessage: typeof outcome.message === "string" ? outcome.message : "Unknown agent error",
|
|
8365
8365
|
followUpsUsed: follow_ups_used,
|
|
@@ -8374,7 +8374,7 @@ function severityIndex(s) {
|
|
|
8374
8374
|
return idx === -1 ? 0 : idx;
|
|
8375
8375
|
}
|
|
8376
8376
|
function computeExitCode(result, options) {
|
|
8377
|
-
if (result.
|
|
8377
|
+
if (result.showPrompt) return 0;
|
|
8378
8378
|
if (result.status === "error" || result.status === "escalation" || result.status === "validation_error") {
|
|
8379
8379
|
return 1;
|
|
8380
8380
|
}
|
|
@@ -8400,8 +8400,8 @@ function severityIcon(severity) {
|
|
|
8400
8400
|
}
|
|
8401
8401
|
}
|
|
8402
8402
|
function formatResultText(result) {
|
|
8403
|
-
if (result.
|
|
8404
|
-
return `[
|
|
8403
|
+
if (result.showPrompt) {
|
|
8404
|
+
return `[SHOW PROMPT \u2014 prompt only, LLM was not called]
|
|
8405
8405
|
|
|
8406
8406
|
${result.prompt}`;
|
|
8407
8407
|
}
|
|
@@ -8474,14 +8474,14 @@ Generated at ${m.generatedAt ?? "\u2014"} by ${m.tool ?? "litedbmodel-gen"} (ada
|
|
|
8474
8474
|
return lines.join("\n");
|
|
8475
8475
|
}
|
|
8476
8476
|
function formatResultJson(result) {
|
|
8477
|
-
if (result.
|
|
8478
|
-
return JSON.stringify({
|
|
8477
|
+
if (result.showPrompt) {
|
|
8478
|
+
return JSON.stringify({ showPrompt: true, prompt: result.prompt }, null, 2);
|
|
8479
8479
|
}
|
|
8480
8480
|
return JSON.stringify(result.data, null, 2);
|
|
8481
8481
|
}
|
|
8482
8482
|
function formatResultYaml(result) {
|
|
8483
|
-
if (result.
|
|
8484
|
-
return jsYaml.dump({
|
|
8483
|
+
if (result.showPrompt) {
|
|
8484
|
+
return jsYaml.dump({ showPrompt: true, prompt: result.prompt });
|
|
8485
8485
|
}
|
|
8486
8486
|
return jsYaml.dump(result.data, { lineWidth: 120 });
|
|
8487
8487
|
}
|
|
@@ -8524,7 +8524,7 @@ async function commandAudit(target, opts) {
|
|
|
8524
8524
|
} : {}
|
|
8525
8525
|
};
|
|
8526
8526
|
const agentOpts = {
|
|
8527
|
-
|
|
8527
|
+
showPrompt: opts.showPrompt ?? false,
|
|
8528
8528
|
failOn: opts.failOn ?? "error",
|
|
8529
8529
|
logFile: opts.logFile
|
|
8530
8530
|
};
|
|
@@ -8600,7 +8600,7 @@ async function commandImplement(description, opts) {
|
|
|
8600
8600
|
} : {}
|
|
8601
8601
|
};
|
|
8602
8602
|
const agentOpts = {
|
|
8603
|
-
|
|
8603
|
+
showPrompt: opts.showPrompt ?? false,
|
|
8604
8604
|
failOn: opts.failOn ?? "error",
|
|
8605
8605
|
logFile: opts.logFile
|
|
8606
8606
|
};
|
|
@@ -23272,7 +23272,7 @@ var handlers = {
|
|
|
23272
23272
|
await commandAudit(target, {
|
|
23273
23273
|
adapter: opts.adapter,
|
|
23274
23274
|
model: opts.model,
|
|
23275
|
-
|
|
23275
|
+
showPrompt: opts.showPrompt,
|
|
23276
23276
|
failOn: opts.failOn,
|
|
23277
23277
|
output: opts.output,
|
|
23278
23278
|
reportFormat: opts.reportFormat
|
|
@@ -23285,7 +23285,7 @@ var handlers = {
|
|
|
23285
23285
|
models: opts.models,
|
|
23286
23286
|
adapter: opts.adapter,
|
|
23287
23287
|
model: opts.model,
|
|
23288
|
-
|
|
23288
|
+
showPrompt: opts.showPrompt,
|
|
23289
23289
|
failOn: opts.failOn,
|
|
23290
23290
|
output: opts.output,
|
|
23291
23291
|
reportFormat: opts.reportFormat
|