@formlm/cli 0.3.0 → 0.5.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 +326 -65
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/app.js +74 -16
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +186 -7
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/connect.js +3 -3
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/doctor.d.ts +11 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +109 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/expert.d.ts.map +1 -1
- package/dist/commands/expert.js +42 -18
- package/dist/commands/expert.js.map +1 -1
- package/dist/commands/field.d.ts.map +1 -1
- package/dist/commands/field.js +9 -11
- package/dist/commands/field.js.map +1 -1
- package/dist/commands/profile.js +1 -1
- package/dist/commands/profile.js.map +1 -1
- package/dist/commands/report.d.ts.map +1 -1
- package/dist/commands/report.js +39 -12
- package/dist/commands/report.js.map +1 -1
- package/dist/commands/scale.d.ts.map +1 -1
- package/dist/commands/scale.js +4 -1
- package/dist/commands/scale.js.map +1 -1
- package/dist/commands/share.d.ts.map +1 -1
- package/dist/commands/share.js +258 -28
- package/dist/commands/share.js.map +1 -1
- package/dist/commands/skill.d.ts.map +1 -1
- package/dist/commands/skill.js +2 -3
- package/dist/commands/skill.js.map +1 -1
- package/dist/commands/smart.d.ts.map +1 -1
- package/dist/commands/smart.js +337 -59
- package/dist/commands/smart.js.map +1 -1
- package/dist/commands/snapshot.d.ts +0 -11
- package/dist/commands/snapshot.d.ts.map +1 -1
- package/dist/commands/snapshot.js +168 -42
- package/dist/commands/snapshot.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/doctor.d.ts +51 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +202 -0
- package/dist/doctor.js.map +1 -0
- package/dist/exec.d.ts +39 -1
- package/dist/exec.d.ts.map +1 -1
- package/dist/exec.js +309 -4
- package/dist/exec.js.map +1 -1
- package/dist/index.js +55 -6
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +283 -67
- package/dist/mcp.js.map +1 -1
- package/dist/output.d.ts +23 -1
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +69 -7
- package/dist/output.js.map +1 -1
- package/dist/summary.d.ts +17 -0
- package/dist/summary.d.ts.map +1 -0
- package/dist/summary.js +64 -0
- package/dist/summary.js.map +1 -0
- package/dist/utils.d.ts +10 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +45 -6
- package/dist/utils.js.map +1 -1
- package/package.json +11 -2
package/dist/commands/smart.js
CHANGED
|
@@ -1,99 +1,377 @@
|
|
|
1
1
|
import { Option } from 'commander';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import * as os from 'node:os';
|
|
4
|
+
import * as path from 'node:path';
|
|
2
5
|
import { execCommand } from '../exec.js';
|
|
3
|
-
import { output } from '../output.js';
|
|
4
|
-
import { escapeArg } from '../utils.js';
|
|
6
|
+
import { output, guidance, localFail, isJsonMode } from '../output.js';
|
|
7
|
+
import { escapeArg, absHttpsUrl } from '../utils.js';
|
|
8
|
+
import { getBaseUrl } from '../config.js';
|
|
9
|
+
import { shareTokenFromUrl } from '../summary.js';
|
|
10
|
+
import { runDoctor, isValidLangCode } from '../doctor.js';
|
|
5
11
|
/**
|
|
6
12
|
* Smart Pipeline Commands
|
|
7
13
|
*
|
|
8
14
|
* Wraps the server-side AssessAgent intelligent pipeline:
|
|
9
15
|
* - smart plan: AssessAgent.plan() only — generate execution plan + appId
|
|
10
16
|
* - smart execute: execute a single module (form/scale/connect/report/expert/share)
|
|
17
|
+
* - smart generate: the resumable one-shot convenience over plan + execute×modules
|
|
18
|
+
* (optionally publish + run the quality doctor)
|
|
11
19
|
*
|
|
12
20
|
* This is the RECOMMENDED entry point for AI agents (works with any MCP-compatible
|
|
13
21
|
* platform: Claude / Cursor / Codex CLI / Windsurf / etc., or direct CLI usage)
|
|
14
22
|
* because it embeds the full SKILL.md domain knowledge, reference data injection,
|
|
15
23
|
* and multi-step orchestration that newapp.html uses internally.
|
|
24
|
+
*
|
|
25
|
+
* Long batches: prefer plan + execute (per-module resumability). `generate` is the
|
|
26
|
+
* sugar for "build me one app now"; it reports each module's structured status and
|
|
27
|
+
* honours FORMLM_NO_EXIT so a driver loop survives a partial run.
|
|
16
28
|
*/
|
|
17
29
|
// ── Timeouts ──────────────────────────────────────────────────────────────────
|
|
18
30
|
// Must match mcp.ts constants to ensure CLI and MCP Server have identical behavior.
|
|
19
|
-
|
|
20
|
-
const
|
|
31
|
+
// All overridable via FORMLM_TIMEOUT_PLAN / FORMLM_TIMEOUT_EXECUTE / FORMLM_TIMEOUT_STYLE (ms).
|
|
32
|
+
const TIMEOUT_PLAN = Number(process.env.FORMLM_TIMEOUT_PLAN) || 120_000; // 2min for smart plan (Phase 1 only, ~10-30s)
|
|
33
|
+
const TIMEOUT_EXECUTE = Number(process.env.FORMLM_TIMEOUT_EXECUTE) || 300_000; // 5min for smart execute (single module, ~30-120s)
|
|
34
|
+
const TIMEOUT_STYLE = Number(process.env.FORMLM_TIMEOUT_STYLE) || 600_000; // 10min for connect style apply-all
|
|
35
|
+
const FOREVER = 3650000; // server "permanent" sentinel for share day
|
|
36
|
+
const MODULE_ORDER = ['form', 'scale', 'connect', 'report', 'expert', 'share'];
|
|
37
|
+
function parseJson(data) {
|
|
38
|
+
if (data === null || data === undefined)
|
|
39
|
+
return null;
|
|
40
|
+
if (typeof data !== 'string')
|
|
41
|
+
return data;
|
|
42
|
+
try {
|
|
43
|
+
return JSON.parse(data);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Run `assess smart plan` and return the exec result plus the parsed payload.
|
|
51
|
+
* On --dry-run the created probe app is deleted again immediately: the server has no
|
|
52
|
+
* plan-without-app mode, and this is the documented way to validate a prompt/spec
|
|
53
|
+
* without leaving residue in the account.
|
|
54
|
+
*/
|
|
55
|
+
async function runPlan(args) {
|
|
56
|
+
let cmd = `assess smart plan --input "${escapeArg(args.input)}"`;
|
|
57
|
+
if (args.planType)
|
|
58
|
+
cmd += ` --plan-type ${args.planType}`;
|
|
59
|
+
if (args.style)
|
|
60
|
+
cmd += ` --style "${escapeArg(args.style)}"`;
|
|
61
|
+
if (args.questionCount)
|
|
62
|
+
cmd += ` --question-count ${args.questionCount}`;
|
|
63
|
+
if (args.lang)
|
|
64
|
+
cmd += ` --lang ${args.lang}`;
|
|
65
|
+
if (args.dimensions)
|
|
66
|
+
cmd += ` --dimensions "${escapeArg(args.dimensions)}"`;
|
|
67
|
+
if (args.appName)
|
|
68
|
+
cmd += ` --app-name "${escapeArg(args.appName)}"`;
|
|
69
|
+
cmd += ' --json';
|
|
70
|
+
const result = await execCommand(cmd, undefined, TIMEOUT_PLAN);
|
|
71
|
+
const parsed = result.code === 0 ? parseJson(result.data) : null;
|
|
72
|
+
if (result.code === 0 && parsed?.appId && args.dryRun) {
|
|
73
|
+
const removed = await execCommand(`assess app remove --app ${parsed.appId} --json`);
|
|
74
|
+
guidance(`🧪 --dry-run: probe app ${parsed.appId} was ${removed.code === 0 ? 'deleted again' : 'NOT deleted (cleanup failed: ' + removed.message + ')'}`);
|
|
75
|
+
}
|
|
76
|
+
else if (result.code === 0 && parsed?.appId && args.savePlan) {
|
|
77
|
+
writePlanFile(args.savePlan, parsed);
|
|
78
|
+
}
|
|
79
|
+
return { result, parsed };
|
|
80
|
+
}
|
|
81
|
+
/** Persist the full AssessPlan JSON (envelope carries it stringified in data.plan). */
|
|
82
|
+
function writePlanFile(file, parsed) {
|
|
83
|
+
try {
|
|
84
|
+
const fullPlan = typeof parsed?.plan === 'string' ? parsed.plan : JSON.stringify(parsed?.plan ?? parsed);
|
|
85
|
+
fs.writeFileSync(file, fullPlan);
|
|
86
|
+
guidance(`💾 Full plan JSON saved to: ${file}`);
|
|
87
|
+
return file;
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
guidance(`⚠️ Could not write the plan file "${file}": ${e?.message || e} — resume will need --plan <inline JSON> instead.`);
|
|
91
|
+
return '';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Map a requested validity to the server --form-day value.
|
|
96
|
+
* Server rule: only 1..30 stay finite; anything else is the permanent sentinel.
|
|
97
|
+
* Returns null for an unusable input (non-numeric / negative).
|
|
98
|
+
*/
|
|
99
|
+
function mapDays(raw) {
|
|
100
|
+
if (raw === undefined || raw === null || raw === '')
|
|
101
|
+
return { days: FOREVER, normalized: false };
|
|
102
|
+
const s = String(raw).trim().toLowerCase();
|
|
103
|
+
if (s === 'forever')
|
|
104
|
+
return { days: FOREVER, normalized: false };
|
|
105
|
+
const n = Number(s);
|
|
106
|
+
if (!Number.isFinite(n) || n < 0)
|
|
107
|
+
return null;
|
|
108
|
+
if (n === 0)
|
|
109
|
+
return { days: FOREVER, normalized: false }; // explicit permanent, no notice
|
|
110
|
+
if (n > 30)
|
|
111
|
+
return { days: FOREVER, normalized: true }; // server cannot express >30
|
|
112
|
+
return { days: Math.floor(n), normalized: false };
|
|
113
|
+
}
|
|
114
|
+
async function runExecute(args) {
|
|
115
|
+
if (args.clearFirst && args.module !== 'scale') {
|
|
116
|
+
localFail('--clear-first is only supported for --module scale (other modules are already idempotent or have no clear command).');
|
|
117
|
+
}
|
|
118
|
+
if (args.clearFirst) {
|
|
119
|
+
const cleared = await execCommand(`assess scale clear --app ${args.app} --json`);
|
|
120
|
+
if (cleared.code !== 0) {
|
|
121
|
+
localFail(`--clear-first could not clear scale dimensions: [${cleared.code}] ${cleared.message}`);
|
|
122
|
+
}
|
|
123
|
+
guidance('🧹 Existing scale dimensions cleared (--clear-first).');
|
|
124
|
+
}
|
|
125
|
+
let cmd = `assess smart execute --app ${args.app} --module ${args.module}`;
|
|
126
|
+
let planJson = args.plan;
|
|
127
|
+
if (args.planFile) {
|
|
128
|
+
try {
|
|
129
|
+
planJson = fs.readFileSync(args.planFile, 'utf-8');
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
localFail(`--plan-file unreadable: ${e?.message || e}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (planJson) {
|
|
136
|
+
// Transport contract: the plan travels as Base64 in ONE argv token (--plan-b64).
|
|
137
|
+
// Inline JSON is NOT safe on this channel — the server's command preprocessing
|
|
138
|
+
// (CliServiceImpl.splitBatchCommands / splitBySemicolon / quote normalisation)
|
|
139
|
+
// cuts the payload at every `, assess …` / `;` / quote inside task text, so the
|
|
140
|
+
// plan silently degenerates into unrelated sub-commands (measured live).
|
|
141
|
+
// Base64 contains no spaces, quotes, commas or semicolons, so it survives intact.
|
|
142
|
+
let encoded;
|
|
143
|
+
try {
|
|
144
|
+
encoded = Buffer.from(JSON.stringify(JSON.parse(planJson)), 'utf-8').toString('base64');
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
localFail('--plan value is not valid JSON (check the file written by smart plan --save-plan).');
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
cmd += ` --plan-b64 ${encoded}`;
|
|
151
|
+
}
|
|
152
|
+
cmd += ' --json';
|
|
153
|
+
// Style generation is the slowest module — give connect its own budget.
|
|
154
|
+
const timeout = args.module === 'connect' ? TIMEOUT_STYLE : TIMEOUT_EXECUTE;
|
|
155
|
+
return execCommand(cmd, undefined, timeout);
|
|
156
|
+
}
|
|
21
157
|
export function registerSmartCommand(parent) {
|
|
22
|
-
const smart = parent.command('smart').description('Intelligent pipeline — natural language to live app (recommended for AI agents)');
|
|
158
|
+
const smart = parent.command('smart').description('Intelligent pipeline — natural language to live app (recommended for AI agents). Steps: smart plan → smart execute per module; "smart generate" is the one-shot wrapper of those steps.');
|
|
23
159
|
// ── smart plan ───────────────────────────────────────────────
|
|
24
160
|
smart
|
|
25
161
|
.command('plan')
|
|
26
|
-
.description('Generate execution plan only (Phase 1). Returns plan JSON + appId.
|
|
162
|
+
.description('Generate execution plan only (Phase 1). Returns plan JSON + appId. Then run smart execute for each module (plan cached server-side ~10min). Tip: --save-plan keeps the plan on disk so execute can still resume after the cache expires.')
|
|
27
163
|
.requiredOption('--input <text>', 'Natural language description of the app you want to build')
|
|
28
|
-
.addOption(new Option('--plan-type <type>', 'Plan type').choices(['assessment', 'consultation', 'survey', 'exam', '
|
|
164
|
+
.addOption(new Option('--plan-type <type>', 'Plan type').choices(['assessment', 'consultation', 'survey', 'exam', 'report', 'learn']))
|
|
29
165
|
.option('--style <style>', 'Visual style preference')
|
|
30
|
-
.addOption(new Option('--question-count <count>', 'Question count range').choices(['10-15', '15-20', '20-30']))
|
|
166
|
+
.addOption(new Option('--question-count <count>', 'Question count range').choices(['5-9', '10-15', '15-20', '20-30', '30-50', '50-100']))
|
|
167
|
+
.option('--lang <lang>', 'BCP-47 language code (e.g. zh / zh-hant / zh-tw / en / ja). Injects an [OUTPUT LANGUAGE] directive that anchors AI output language for the plan AND every module execute — the only language entry point on the CLI/MCP channel (no Accept-Language header available there)')
|
|
168
|
+
.option('--dimensions <names>', 'Pin scoring dimensions (pipe/semicolon separated, e.g. "Natural Finish|Glam|Editorial"). The plan AI must keep these exact names and count — use when an external page/ledger already defines them')
|
|
169
|
+
.option('--app-name <name>', 'Pin the app display name (default: Plan AI chooses). Use when the name must match a ledger/page exactly')
|
|
170
|
+
.option('--save-plan <file>', 'Also write the full plan JSON to this file (for smart execute --plan-file after the server cache expires)')
|
|
171
|
+
.option('--dry-run', 'Validate the prompt/spec and return the would-be plan, then delete the probe app again (the server always creates an app when planning; this cleans it up so probing leaves no residue)')
|
|
31
172
|
.action(async (opts) => {
|
|
32
|
-
|
|
33
|
-
if (opts.planType)
|
|
34
|
-
cmd += ` --plan-type ${opts.planType}`;
|
|
35
|
-
if (opts.style)
|
|
36
|
-
cmd += ` --style "${escapeArg(opts.style)}"`;
|
|
37
|
-
if (opts.questionCount)
|
|
38
|
-
cmd += ` --question-count ${opts.questionCount}`;
|
|
39
|
-
cmd += ' --json';
|
|
40
|
-
const result = await execCommand(cmd, undefined, TIMEOUT_PLAN);
|
|
173
|
+
const { result, parsed } = await runPlan(opts);
|
|
41
174
|
output(result);
|
|
42
|
-
// ── Next Steps guidance ──────
|
|
43
|
-
if (result.code === 0 &&
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const modules = (parsed.tasks || []).map((t) => t.skill);
|
|
50
|
-
for (const m of modules) {
|
|
51
|
-
console.log(` formlm-cli smart execute --app ${parsed.appId} --module ${m} --plan '${parsed.plan}'`);
|
|
52
|
-
}
|
|
53
|
-
console.log(` Snapshot: formlm-cli snapshot --app ${parsed.appId}`);
|
|
54
|
-
}
|
|
175
|
+
// ── Next Steps guidance (stderr-friendly via guidance()) ──────
|
|
176
|
+
if (result.code === 0 && parsed?.appId) {
|
|
177
|
+
const modules = (parsed.tasks || []).map((t) => t.skill);
|
|
178
|
+
if (opts.dryRun) {
|
|
179
|
+
guidance('');
|
|
180
|
+
guidance('💡 --dry-run: the probe app above was deleted. Re-run without --dry-run to keep it and execute the modules.');
|
|
181
|
+
return;
|
|
55
182
|
}
|
|
56
|
-
|
|
57
|
-
|
|
183
|
+
guidance('');
|
|
184
|
+
guidance('💡 Next steps — execute modules sequentially (plan cached server-side ~10min, no --plan needed; after expiry use --plan-file):');
|
|
185
|
+
for (const m of modules) {
|
|
186
|
+
guidance(` formlm-cli smart execute --app ${parsed.appId} --module ${m}`);
|
|
187
|
+
}
|
|
188
|
+
guidance(` One-shot: formlm-cli smart generate --input "<same description>" --publish`);
|
|
189
|
+
// Plan-type coverage is not universal: only consultation plans include `expert`.
|
|
190
|
+
// Surface what is missing so callers don't ship pages promising an AI expert
|
|
191
|
+
// that the app does not have (silent exam/assessment gap seen in batch runs).
|
|
192
|
+
const missing = MODULE_ORDER.filter(m => !modules.includes(m));
|
|
193
|
+
if (missing.length > 0) {
|
|
194
|
+
guidance(` ⚠️ Plan does NOT include: ${missing.join(', ')} — smart execute for these will report "No task found".`);
|
|
195
|
+
if (missing.includes('expert')) {
|
|
196
|
+
guidance(` Add an expert deterministically: formlm-cli expert config --app ${parsed.appId} --name "..." --role "..." --kbText "..." --enable true`);
|
|
197
|
+
}
|
|
58
198
|
}
|
|
199
|
+
guidance(` Snapshot: formlm-cli snapshot --app ${parsed.appId} --summary`);
|
|
59
200
|
}
|
|
60
201
|
});
|
|
61
202
|
// ── smart execute ────────────────────────────────────────────
|
|
62
203
|
smart
|
|
63
204
|
.command('execute')
|
|
64
|
-
.description('Execute a single module from the plan.
|
|
205
|
+
.description('Execute a single module from the plan. Plan is cached server-side (~10min) after smart plan — no --plan needed. After the cache expires, resume an EXISTING app with --plan-file <saved plan JSON> (or --plan <inline JSON>). Each module completes within ~60s.')
|
|
65
206
|
.requiredOption('--app <appId>', 'App ID')
|
|
66
|
-
.requiredOption('--module <name>',
|
|
67
|
-
.
|
|
207
|
+
.requiredOption('--module <name>', `Module: ${MODULE_ORDER.join(' / ')}`)
|
|
208
|
+
.option('--plan <json>', 'Plan JSON inline (fallback when the server cache expired; transmitted Base64-safe as --plan-b64)')
|
|
209
|
+
.option('--plan-file <file>', 'Plan JSON file (written by smart plan --save-plan) — fallback when server cache expired')
|
|
210
|
+
.option('--clear-first', 'For module=scale only: clear existing dimensions before executing, so a retried run REPLACES instead of appending duplicate dimensions')
|
|
68
211
|
.action(async (opts) => {
|
|
69
|
-
|
|
70
|
-
const result = await execCommand(cmd, undefined, TIMEOUT_EXECUTE);
|
|
212
|
+
const result = await runExecute(opts);
|
|
71
213
|
output(result);
|
|
72
|
-
// ── Next Steps guidance ──────
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
console.log(` ✅ All modules done!`);
|
|
87
|
-
console.log(` Editor: https://formlm.me/mypage/builder.html?id=${parsed.appId}`);
|
|
88
|
-
console.log(` Data: https://formlm.me/mypage/data.html?id=${parsed.appId}`);
|
|
89
|
-
console.log(` Snapshot: formlm-cli snapshot --app ${parsed.appId}`);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
214
|
+
// ── Structured success signal + Next Steps guidance ──────
|
|
215
|
+
// (script callers should trust data.taskStatus/status, not human text)
|
|
216
|
+
const parsed = result.code === 0 ? parseJson(result.data) : null;
|
|
217
|
+
if (parsed?.appId) {
|
|
218
|
+
if (parsed.taskStatus === 'error') {
|
|
219
|
+
guidance(`⚠️ Module '${opts.module}' ended with status=error: ${parsed.error || 'see output'}`);
|
|
220
|
+
}
|
|
221
|
+
const nextModule = MODULE_ORDER[MODULE_ORDER.indexOf(opts.module) + 1];
|
|
222
|
+
guidance('');
|
|
223
|
+
guidance('💡 Next steps:');
|
|
224
|
+
if (nextModule) {
|
|
225
|
+
guidance(` Execute next: formlm-cli smart execute --app ${parsed.appId} --module ${nextModule}`);
|
|
92
226
|
}
|
|
93
|
-
|
|
94
|
-
|
|
227
|
+
else {
|
|
228
|
+
guidance(` ✅ All modules done!`);
|
|
229
|
+
guidance(` Verify: formlm-cli doctor --app ${parsed.appId}`);
|
|
230
|
+
guidance(` Publish: formlm-cli share publish --app ${parsed.appId}`);
|
|
231
|
+
guidance(` Snapshot: formlm-cli snapshot --app ${parsed.appId} --summary`);
|
|
95
232
|
}
|
|
96
233
|
}
|
|
97
234
|
});
|
|
235
|
+
// ── smart generate ───────────────────────────────────────────
|
|
236
|
+
smart
|
|
237
|
+
.command('generate')
|
|
238
|
+
.description('One-shot convenience over the pipeline: plan → execute every planned module in order → (optional) publish → (optional) doctor. ' +
|
|
239
|
+
'Progress and per-module status go to stderr under --json so stdout stays one parseable envelope; the saved plan path is reported for --plan-file resume if a module fails midway. ' +
|
|
240
|
+
'For full resumability/observability prefer explicit plan + execute; this is the short path.')
|
|
241
|
+
.requiredOption('--input <text>', 'Natural language description of the app you want to build')
|
|
242
|
+
.addOption(new Option('--plan-type <type>', 'Plan type').choices(['assessment', 'consultation', 'survey', 'exam', 'report', 'learn']))
|
|
243
|
+
.option('--style <style>', 'Visual style preference')
|
|
244
|
+
.addOption(new Option('--question-count <count>', 'Question count range').choices(['5-9', '10-15', '15-20', '20-30', '30-50', '50-100']))
|
|
245
|
+
.option('--lang <lang>', 'BCP-47 language code (e.g. zh / zh-hant / en / ja) — anchors the AI output language for the plan and every module')
|
|
246
|
+
.option('--dimensions <names>', 'Pin scoring dimensions (pipe/semicolon separated) so generated dimensions match an existing page/ledger')
|
|
247
|
+
.option('--app-name <name>', 'Pin the app display name')
|
|
248
|
+
.option('--save-plan <file>', 'Where to write the full plan JSON (default: auto-named next to the profile dir). Reported on failure for --plan-file resume')
|
|
249
|
+
.option('--only <modules>', 'Execute only these modules (comma-separated subset of ' + MODULE_ORDER.join('/') + ')')
|
|
250
|
+
.option('--skip <modules>', 'Skip these modules (comma-separated)')
|
|
251
|
+
.option('--publish', 'After all modules, publish the app for anonymous access (share publish --access visitor) and return the fill-in URL + shareToken')
|
|
252
|
+
.option('--access <type>', 'With --publish: visitor (default, anonymous) / all (requires login) / secret (password)', 'visitor')
|
|
253
|
+
.option('--days <n>', 'With --publish: validity in days (1-30), or 0/forever (default)', 'forever')
|
|
254
|
+
.option('--doctor', 'After generating, run the read-only quality audit and include its findings in the result')
|
|
255
|
+
.action(async (opts) => {
|
|
256
|
+
const only = opts.only ? String(opts.only).split(',').map((m) => m.trim()).filter(Boolean) : null;
|
|
257
|
+
const skip = opts.skip ? String(opts.skip).split(',').map((m) => m.trim()).filter(Boolean) : [];
|
|
258
|
+
for (const m of [...(only || []), ...skip]) {
|
|
259
|
+
if (!MODULE_ORDER.includes(m))
|
|
260
|
+
localFail(`Invalid module "${m}". Valid: ${MODULE_ORDER.join(', ')}`);
|
|
261
|
+
}
|
|
262
|
+
if (opts.access && !['visitor', 'all', 'secret', 'owner', 'no'].includes(String(opts.access).trim())) {
|
|
263
|
+
localFail(`Invalid --access "${opts.access}". Valid: visitor / all / secret / owner / no.`);
|
|
264
|
+
}
|
|
265
|
+
// ── Phase 1: plan (always keep a plan file for resume) ──────
|
|
266
|
+
const { result: planResult, parsed: plan } = await runPlan({ ...opts, savePlan: opts.savePlan });
|
|
267
|
+
if (planResult.code !== 0 || !plan?.appId) {
|
|
268
|
+
output(planResult);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const appId = plan.appId;
|
|
272
|
+
const savePlan = opts.savePlan
|
|
273
|
+
? String(opts.savePlan)
|
|
274
|
+
: (writePlanFile(path.join(os.tmpdir(), `formlm-plan-${appId}.json`), plan) || '');
|
|
275
|
+
const planned = (plan.tasks || []).map((t) => t.skill);
|
|
276
|
+
const modules = (only || planned).filter(m => MODULE_ORDER.includes(m) && !skip.includes(m));
|
|
277
|
+
guidance(`📋 Plan ready — appId=${appId}, type=${plan.planType || '?'}, tasks=${planned.join(' → ') || '(none)'}`);
|
|
278
|
+
if (savePlan)
|
|
279
|
+
guidance(`↩️ Resume any module later with: formlm-cli smart execute --app ${appId} --module <m> --plan-file ${savePlan}`);
|
|
280
|
+
const missing = MODULE_ORDER.filter(m => !planned.includes(m));
|
|
281
|
+
if (missing.length > 0)
|
|
282
|
+
guidance(`ℹ️ Not covered by this plan: ${missing.join(', ')}${missing.includes('expert') ? ' (add later with: formlm-cli expert config --app ' + appId + ' ...)' : ''}`);
|
|
283
|
+
// ── Phase 2: execute modules sequentially ──────────────────
|
|
284
|
+
const moduleResults = [];
|
|
285
|
+
let failedAt = null;
|
|
286
|
+
for (const m of modules) {
|
|
287
|
+
guidance(`⏳ Generating module: ${m} (30-120s, do not cancel)…`);
|
|
288
|
+
const r = await runExecute({ app: appId, module: m });
|
|
289
|
+
const p = r.code === 0 ? parseJson(r.data) : null;
|
|
290
|
+
const status = r.code !== 0 ? 'error' : (p?.taskStatus === 'error' ? 'error' : 'success');
|
|
291
|
+
moduleResults.push({
|
|
292
|
+
module: m,
|
|
293
|
+
status,
|
|
294
|
+
code: r.code,
|
|
295
|
+
error: r.code !== 0 ? r.message : (p?.error ?? null),
|
|
296
|
+
});
|
|
297
|
+
guidance(`${status === 'success' ? '✅' : '❌'} ${m}: ${status}${status !== 'success' ? ' — ' + (r.code !== 0 ? r.message : (p?.error || 'see output')) : ''}`);
|
|
298
|
+
if (status !== 'success') {
|
|
299
|
+
failedAt = m;
|
|
300
|
+
guidance(`⏸️ Stopped at module '${m}'. Fix the cause, then resume WITHOUT re-creating the app:`);
|
|
301
|
+
guidance(` formlm-cli smart execute --app ${appId} --module ${m} --plan-file ${savePlan}`);
|
|
302
|
+
guidance(` formlm-cli smart execute --app ${appId} --module <next> --plan-file ${savePlan}`);
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
// ── Phase 3: optional publish ─────────────────────────────
|
|
307
|
+
let publish = null;
|
|
308
|
+
if (!failedAt && opts.publish) {
|
|
309
|
+
const mapped = mapDays(opts.days);
|
|
310
|
+
if (!mapped) {
|
|
311
|
+
localFail(`Invalid --days "${opts.days}". Use 1-30, or 0/forever for permanent.`);
|
|
312
|
+
}
|
|
313
|
+
const day = mapped.days;
|
|
314
|
+
if (mapped.normalized) {
|
|
315
|
+
guidance(`ℹ️ --days ${opts.days} normalized to permanent (the server only honours finite windows of 1..30 days).`);
|
|
316
|
+
}
|
|
317
|
+
guidance('🚀 Publishing…');
|
|
318
|
+
const pub = await execCommand(`assess share set --app ${appId} --form-type ${opts.access} --form-perm 1 --form-day ${day} --json`);
|
|
319
|
+
const urlsRes = pub.code === 0 ? await execCommand(`assess app urls --app ${appId} --json`) : null;
|
|
320
|
+
const urls = urlsRes && urlsRes.code === 0 ? parseJson(urlsRes.data) : null;
|
|
321
|
+
const fillAbs = urls?.shareUrlAbsolute || absHttpsUrl(getBaseUrl(), urls?.shareUrl || '');
|
|
322
|
+
publish = {
|
|
323
|
+
ok: pub.code === 0,
|
|
324
|
+
access: opts.access,
|
|
325
|
+
days: day,
|
|
326
|
+
shareUrl: urls?.shareUrl ?? null,
|
|
327
|
+
shareUrlAbsolute: fillAbs || null,
|
|
328
|
+
shareToken: urls?.shareToken || shareTokenFromUrl(urls?.shareUrl || ''),
|
|
329
|
+
error: pub.code === 0 ? null : pub.message,
|
|
330
|
+
};
|
|
331
|
+
guidance(`${publish.ok ? '✅' : '❌'} Published (access=${opts.access}, ${day === FOREVER ? 'permanent' : day + ' day(s)'})${publish.ok ? ' → ' + (fillAbs || '(no url)') : ' — ' + publish.error}`);
|
|
332
|
+
}
|
|
333
|
+
// ── Phase 4: optional doctor ──────────────────────────────
|
|
334
|
+
let doctor = null;
|
|
335
|
+
if (!failedAt && opts.doctor) {
|
|
336
|
+
const expectLang = opts.lang && isValidLangCode(String(opts.lang)) ? String(opts.lang) : undefined;
|
|
337
|
+
if (opts.lang && !expectLang)
|
|
338
|
+
guidance(`⚠️ --lang "${opts.lang}" is not a BCP-47 code — skipping the doctor language check (other checks still run).`);
|
|
339
|
+
guidance('🩺 Running the read-only quality audit (doctor)…');
|
|
340
|
+
doctor = await runDoctor(appId, { expectLang, deep: false, probe: !!opts.publish });
|
|
341
|
+
}
|
|
342
|
+
const ok = !failedAt && (!publish || publish.ok) && (!doctor || doctor.ok);
|
|
343
|
+
const payload = {
|
|
344
|
+
appId,
|
|
345
|
+
appName: plan.name ?? (opts.appName || null),
|
|
346
|
+
planType: plan.planType ?? null,
|
|
347
|
+
ok,
|
|
348
|
+
modules: moduleResults,
|
|
349
|
+
skipped: skip,
|
|
350
|
+
notInPlan: missing,
|
|
351
|
+
failedAt,
|
|
352
|
+
resumeHint: failedAt
|
|
353
|
+
? (savePlan
|
|
354
|
+
? `formlm-cli smart execute --app ${appId} --module ${failedAt} --plan-file ${savePlan}`
|
|
355
|
+
: `formlm-cli smart execute --app ${appId} --module ${failedAt} (plan may still be cached server-side; re-plan is NOT an option — it creates a new app)`)
|
|
356
|
+
: null,
|
|
357
|
+
planFile: savePlan,
|
|
358
|
+
publish,
|
|
359
|
+
doctor: doctor ? {
|
|
360
|
+
ok: doctor.ok,
|
|
361
|
+
failCount: doctor.failCount,
|
|
362
|
+
warnCount: doctor.warnCount,
|
|
363
|
+
findings: doctor.findings,
|
|
364
|
+
} : null,
|
|
365
|
+
};
|
|
366
|
+
const message = failedAt
|
|
367
|
+
? `stopped at module '${failedAt}'`
|
|
368
|
+
: (publish && !publish.ok ? `published failed: ${publish.error}`
|
|
369
|
+
: (doctor && !doctor.ok ? `doctor found ${doctor.failCount} blocking issue(s)` : 'ok'));
|
|
370
|
+
output({ code: ok ? 0 : 400, message, data: JSON.stringify(payload) });
|
|
371
|
+
if (!isJsonMode() && !ok) {
|
|
372
|
+
// output() already printed the failure line; keep the resume hint visible on stdout too
|
|
373
|
+
console.log(failedAt ? `Resume: ${payload.resumeHint}` : `Doctor: formlm-cli doctor --app ${appId}`);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
98
376
|
}
|
|
99
377
|
//# sourceMappingURL=smart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart.js","sourceRoot":"","sources":["../../src/commands/smart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;;GAWG;AAEH,iFAAiF;AACjF,oFAAoF;AACpF,MAAM,YAAY,GAAG,OAAO,CAAC,CAAG,8CAA8C;AAC9E,MAAM,eAA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C;gBAC3J,CAAC,CAAC,IAAI;YACR,QAAQ,EAAE,QAAQ;YAClB,OAAO;YACP,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;gBACf,EAAE,EAAE,MAAM,CAAC,EAAE;gBACb,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B,CAAC,CAAC,CAAC,IAAI;SACT,CAAC;QACF,MAAM,OAAO,GAAG,QAAQ;YACtB,CAAC,CAAC,sBAAsB,QAAQ,GAAG;YACnC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,qBAAqB,OAAO,CAAC,KAAK,EAAE;gBAC9D,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,MAAM,CAAC,SAAS,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5F,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACvE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;YACzB,wFAAwF;YACxF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,mCAAmC,KAAK,EAAE,CAAC,CAAC;QACvG,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
/**
|
|
3
|
-
* Snapshot Command — Aggregated App State Query
|
|
4
|
-
*
|
|
5
|
-
* Fetches the current state of ALL 6 modules (form, scale, connect, report, expert, share)
|
|
6
|
-
* in a single command, returning a unified JSON snapshot. This is the equivalent of
|
|
7
|
-
* newapp.html's "reference data injection" step — it gives the AI agent full context
|
|
8
|
-
* about the current app state before generating modification commands.
|
|
9
|
-
*
|
|
10
|
-
* By default, all modules use --json for consistent structured output.
|
|
11
|
-
* Use --md to switch to markdown format (token-efficient for AI consumption).
|
|
12
|
-
*/
|
|
13
2
|
export declare function registerSnapshotCommand(parent: Command): void;
|
|
14
3
|
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/commands/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/commands/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqHpC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAmF7D"}
|