@formlm/cli 0.1.2 → 0.2.0
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 +231 -77
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +7 -4
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/connect.d.ts +3 -0
- package/dist/commands/connect.d.ts.map +1 -0
- package/dist/commands/connect.js +555 -0
- package/dist/commands/connect.js.map +1 -0
- package/dist/commands/expert.d.ts +3 -0
- package/dist/commands/expert.d.ts.map +1 -0
- package/dist/commands/expert.js +123 -0
- package/dist/commands/expert.js.map +1 -0
- package/dist/commands/field.d.ts.map +1 -1
- package/dist/commands/field.js +38 -21
- package/dist/commands/field.js.map +1 -1
- package/dist/commands/profile.d.ts.map +1 -1
- package/dist/commands/profile.js +4 -3
- package/dist/commands/profile.js.map +1 -1
- package/dist/commands/report.d.ts +3 -0
- package/dist/commands/report.d.ts.map +1 -0
- package/dist/commands/report.js +507 -0
- package/dist/commands/report.js.map +1 -0
- package/dist/commands/scale.d.ts +3 -0
- package/dist/commands/scale.d.ts.map +1 -0
- package/dist/commands/scale.js +289 -0
- package/dist/commands/scale.js.map +1 -0
- package/dist/commands/share.js +2 -2
- package/dist/commands/share.js.map +1 -1
- package/dist/commands/skill.d.ts +15 -0
- package/dist/commands/skill.d.ts.map +1 -0
- package/dist/commands/skill.js +31 -0
- package/dist/commands/skill.js.map +1 -0
- package/dist/commands/smart.d.ts +16 -0
- package/dist/commands/smart.d.ts.map +1 -0
- package/dist/commands/smart.js +81 -0
- package/dist/commands/smart.js.map +1 -0
- package/dist/commands/snapshot.d.ts +13 -0
- package/dist/commands/snapshot.d.ts.map +1 -0
- package/dist/commands/snapshot.js +61 -0
- package/dist/commands/snapshot.js.map +1 -0
- package/dist/exec.d.ts +8 -2
- package/dist/exec.d.ts.map +1 -1
- package/dist/exec.js +28 -2
- package/dist/exec.js.map +1 -1
- package/dist/index.js +23 -8
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +444 -269
- package/dist/mcp.js.map +1 -1
- package/package.json +13 -5
package/README.md
CHANGED
|
@@ -20,13 +20,43 @@ With `formlm-cli`, you can control FormLM directly from your terminal or plug it
|
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## What's New in v0.2.0
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
29
|
-
- **
|
|
25
|
+
The MCP architecture has been completely redesigned from the ground up:
|
|
26
|
+
|
|
27
|
+
- **34 flat tools → 9 layered tools + 6 knowledge resources**
|
|
28
|
+
- **Intelligence Layer**: `formlm_create` / `formlm_modify` wrap the server-side AssessAgent/BuilderAgent pipeline
|
|
29
|
+
- **Chat-only Risk Confirmation**: `formlm_confirm` executes medium/high-risk `formlm_modify` plans after user approval — no web UI needed
|
|
30
|
+
- **Domain Knowledge**: 6 MCP resources expose SKILL.md files directly to AI agents
|
|
31
|
+
- **State Awareness**: `formlm_snapshot` aggregates all module states in one call
|
|
32
|
+
- **P0 Constraints**: Embedded directly in command descriptions — AI sees them every time
|
|
33
|
+
|
|
34
|
+
### Architecture
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
┌─────────────────────────────────────────────────────────┐
|
|
38
|
+
│ AI Agent (any MCP Client: Claude / Cursor / │
|
|
39
|
+
│ Codex CLI / Windsurf / Cline / ...) │
|
|
40
|
+
├─────────────────────────────────────────────────────────┤
|
|
41
|
+
│ Tier 0: auth_login, auth_status │
|
|
42
|
+
│ Tier 1: formlm_plan, formlm_create, │
|
|
43
|
+
│ formlm_modify, formlm_confirm ← Smart Pipeline │
|
|
44
|
+
│ Tier 2: formlm_snapshot, formlm_skill ← State + Knowledge│
|
|
45
|
+
│ Tier 3: formlm_exec ← Direct Commands │
|
|
46
|
+
├─────────────────────────────────────────────────────────┤
|
|
47
|
+
│ Resources: formlm://skills/{form,scale,connect, │
|
|
48
|
+
│ report,expert,share} │
|
|
49
|
+
├─────────────────────────────────────────────────────────┤
|
|
50
|
+
│ formlm-cli MCP Server │
|
|
51
|
+
├─────────────────────────────────────────────────────────┤
|
|
52
|
+
│ FormLM Server (McpV1Api) │
|
|
53
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
|
54
|
+
│ │AssessAgent│ │BuilderAgent│ │CliService│ │SKILL.md │ │
|
|
55
|
+
│ │ (Plan+ │ │ (Think+ │ │ (picocli │ │ (domain │ │
|
|
56
|
+
│ │ Execute) │ │ Reflect)│ │ dispatch)│ │ rules) │ │
|
|
57
|
+
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
|
|
58
|
+
└─────────────────────────────────────────────────────────┘
|
|
59
|
+
```
|
|
30
60
|
|
|
31
61
|
---
|
|
32
62
|
|
|
@@ -38,7 +68,7 @@ npm install -g @formlm/cli
|
|
|
38
68
|
|
|
39
69
|
Requires Node.js ≥ 18.
|
|
40
70
|
|
|
41
|
-
For a detailed step-by-step guide (including MCP setup for Claude / Cursor), see **[INSTALL.md](INSTALL.md)**.
|
|
71
|
+
For a detailed step-by-step guide (including MCP setup for Claude Desktop / Cursor / Codex CLI / Windsurf / Cline), see **[INSTALL.md](INSTALL.md)**.
|
|
42
72
|
|
|
43
73
|
---
|
|
44
74
|
|
|
@@ -52,42 +82,94 @@ formlm-cli auth login
|
|
|
52
82
|
formlm-cli auth login --token <your-token>
|
|
53
83
|
```
|
|
54
84
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
### 2. Use the CLI
|
|
85
|
+
### 2. Smart Pipeline (AI-recommended)
|
|
58
86
|
|
|
59
87
|
```bash
|
|
60
|
-
#
|
|
61
|
-
formlm-cli
|
|
88
|
+
# Preview the plan before executing (optional, for user review)
|
|
89
|
+
formlm-cli smart plan --input "Create a workplace stress assessment with 10 questions, 3 dimensions"
|
|
62
90
|
|
|
63
|
-
#
|
|
64
|
-
formlm-cli
|
|
91
|
+
# Generate a complete assessment app from natural language
|
|
92
|
+
formlm-cli smart create --input "Create a workplace stress assessment with 10 questions, 3 dimensions, and detailed score interpretations"
|
|
65
93
|
|
|
66
|
-
#
|
|
67
|
-
formlm-cli
|
|
94
|
+
# Modify an existing app
|
|
95
|
+
formlm-cli smart modify --app <appId> --input "Add a new dimension for workplace social support"
|
|
68
96
|
|
|
69
|
-
#
|
|
70
|
-
|
|
97
|
+
# If the change is medium/high risk, smart modify returns a plan preview instead of executing.
|
|
98
|
+
# Show the plan to the user, then confirm and execute it (no web UI needed):
|
|
99
|
+
formlm-cli smart confirm --app <appId> --plan-json '<the exact "plan" JSON returned above>'
|
|
100
|
+
```
|
|
71
101
|
|
|
72
|
-
|
|
73
|
-
formlm-cli share publish --app <appId>
|
|
102
|
+
### 3. Direct Commands (for fine-grained control)
|
|
74
103
|
|
|
75
|
-
|
|
76
|
-
|
|
104
|
+
```bash
|
|
105
|
+
# Get a snapshot of all module states
|
|
106
|
+
formlm-cli snapshot --app <appId>
|
|
107
|
+
|
|
108
|
+
# Read a skill document before constructing commands
|
|
109
|
+
formlm-cli skill form
|
|
110
|
+
formlm-cli skill scale
|
|
111
|
+
|
|
112
|
+
# Scale commands
|
|
113
|
+
formlm-cli scale query --app <appId>
|
|
114
|
+
formlm-cli scale add --app <appId> --id stress --name "Stress Level" --format sum --kbText "..."
|
|
115
|
+
formlm-cli scale keys add --app <appId> --scale stress --fields q1,q2,q3
|
|
116
|
+
formlm-cli scale data add --app <appId> --scale stress --ranges "0-10:Low,11-20:Moderate,21-30:High"
|
|
117
|
+
|
|
118
|
+
# Report commands
|
|
119
|
+
formlm-cli report query --app <appId>
|
|
120
|
+
formlm-cli report page add --app <appId> --name "Summary" --layout grid
|
|
121
|
+
formlm-cli report widget add --app <appId> --page <pageId> --type chart --chartType bar --name "Score Chart"
|
|
122
|
+
|
|
123
|
+
# Expert commands
|
|
124
|
+
formlm-cli expert query --app <appId>
|
|
125
|
+
formlm-cli expert config --app <appId> --enableChat true
|
|
77
126
|
```
|
|
78
127
|
|
|
79
|
-
###
|
|
128
|
+
### 4. Use as MCP Server
|
|
80
129
|
|
|
81
130
|
```bash
|
|
82
131
|
formlm-cli mcp
|
|
83
132
|
```
|
|
84
133
|
|
|
85
|
-
This starts the MCP Server (stdio transport), ready for AI Agents to connect.
|
|
134
|
+
This starts the MCP Server (stdio transport) with 9 tools + 6 resources, ready for AI Agents to connect.
|
|
86
135
|
|
|
87
136
|
---
|
|
88
137
|
|
|
89
138
|
## Command Reference
|
|
90
139
|
|
|
140
|
+
### Smart Pipeline (AI-recommended)
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Generate a complete app from natural language
|
|
144
|
+
formlm-cli smart create --input "..." [--plan-type assessment] [--style "温暖亲切"] [--question-count 10-15]
|
|
145
|
+
|
|
146
|
+
# Modify an existing app
|
|
147
|
+
formlm-cli smart modify --app <appId> --input "..."
|
|
148
|
+
|
|
149
|
+
# Confirm and execute a medium/high risk plan returned by smart modify (skips Think/Plan, no web UI needed)
|
|
150
|
+
formlm-cli smart confirm --app <appId> --plan-json '<exact plan JSON from smart modify>'
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Snapshot
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Get all module states in one call
|
|
157
|
+
formlm-cli snapshot --app <appId>
|
|
158
|
+
formlm-cli snapshot --app <appId> --module scale # Only scale module
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Skill Documents
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Get SKILL.md domain knowledge (P0/P1/P2 constraints, command templates)
|
|
165
|
+
formlm-cli skill form # Form field rules
|
|
166
|
+
formlm-cli skill scale # Scale dimension rules
|
|
167
|
+
formlm-cli skill connect # Page styling rules
|
|
168
|
+
formlm-cli skill report # Report layout rules
|
|
169
|
+
formlm-cli skill expert # Expert interpretation rules
|
|
170
|
+
formlm-cli skill share # Share/publish rules
|
|
171
|
+
```
|
|
172
|
+
|
|
91
173
|
### Auth
|
|
92
174
|
|
|
93
175
|
```bash
|
|
@@ -111,9 +193,9 @@ formlm-cli --profile work app list # Use a profile for one command
|
|
|
111
193
|
```bash
|
|
112
194
|
formlm-cli app list
|
|
113
195
|
formlm-cli app create --name "My Form" --description "..."
|
|
114
|
-
formlm-cli app get --app <appId>
|
|
115
196
|
formlm-cli app update --app <appId> --name "New Name" --theme blue
|
|
116
|
-
formlm-cli app
|
|
197
|
+
formlm-cli app remove --app <appId> # Delete an app (irreversible)
|
|
198
|
+
formlm-cli app urls --app <appId> # Get fill-in / editor / data URLs
|
|
117
199
|
```
|
|
118
200
|
|
|
119
201
|
### Field
|
|
@@ -123,83 +205,155 @@ formlm-cli field schema # All supported
|
|
|
123
205
|
formlm-cli field config --type radio # Configurable props for a type
|
|
124
206
|
formlm-cli field list --app <appId>
|
|
125
207
|
formlm-cli field find --app <appId> --id q1 # Get a single field
|
|
126
|
-
formlm-cli field find --app <appId> --filter "name" # Search fields by keyword
|
|
127
208
|
formlm-cli field add --app <appId> --id q1 --name "Name" --type input --required
|
|
128
|
-
formlm-cli field add --app <appId> --id n1 --type scale --min 1 --max 10
|
|
129
209
|
formlm-cli field update --app <appId> --id q1 --title "Your Full Name"
|
|
130
210
|
formlm-cli field remove --app <appId> --id q1
|
|
131
211
|
formlm-cli field set-property --app <appId> --id q1 --property options.0.score --value 5
|
|
132
212
|
```
|
|
133
213
|
|
|
134
|
-
###
|
|
214
|
+
### Scale (Dimensions & Scoring)
|
|
135
215
|
|
|
136
216
|
```bash
|
|
137
|
-
formlm-cli
|
|
138
|
-
formlm-cli
|
|
139
|
-
formlm-cli
|
|
140
|
-
formlm-cli
|
|
217
|
+
formlm-cli scale query --app <appId> # List all dimensions
|
|
218
|
+
formlm-cli scale find --app <appId> --id <scaleId> # Find a dimension
|
|
219
|
+
formlm-cli scale add --app <appId> --id stress --name "Stress" --format sum --kbText "..."
|
|
220
|
+
formlm-cli scale update --app <appId> --id stress --name "Stress Level"
|
|
221
|
+
formlm-cli scale set --app <appId> --id stress --direction negative
|
|
222
|
+
formlm-cli scale remove --app <appId> --id stress
|
|
223
|
+
formlm-cli scale clear --app <appId>
|
|
224
|
+
formlm-cli scale config --app <appId> --enable-single true
|
|
225
|
+
|
|
226
|
+
# Associate fields with a dimension
|
|
227
|
+
formlm-cli scale keys add --app <appId> --scale stress --fields q1,q2,q3 [--polarities "q3:negative"]
|
|
228
|
+
formlm-cli scale keys remove --app <appId> --scale stress --fields q1
|
|
229
|
+
formlm-cli scale keys list --app <appId> --scale stress
|
|
230
|
+
formlm-cli scale keys set --app <appId> --scale stress --fields q3 --negScore true
|
|
231
|
+
|
|
232
|
+
# Configure score ranges
|
|
233
|
+
formlm-cli scale data add --app <appId> --scale stress --ranges "0-10:Low,11-20:High"
|
|
234
|
+
formlm-cli scale data update --app <appId> --scale stress --id <dataId> --value "Moderate"
|
|
235
|
+
formlm-cli scale data remove --app <appId> --scale stress --id <dataId>
|
|
236
|
+
formlm-cli scale data list --app <appId> --scale stress
|
|
237
|
+
formlm-cli scale data clear --app <appId> --scale stress
|
|
141
238
|
```
|
|
142
239
|
|
|
143
|
-
|
|
240
|
+
### Connect (Page Styling & Visual Design)
|
|
144
241
|
|
|
145
|
-
|
|
242
|
+
```bash
|
|
243
|
+
formlm-cli connect query --app <appId> [--type cover|main|final] [--filter <keyword>] --md
|
|
244
|
+
formlm-cli connect find --app <appId> --filter <keyword>
|
|
245
|
+
formlm-cli connect types [--category cover|main|final] --verbose
|
|
246
|
+
formlm-cli connect config --category cover --format rich-text
|
|
247
|
+
|
|
248
|
+
# Cover page management
|
|
249
|
+
formlm-cli connect cover-page add --app <appId> --id cover_main --name "Welcome" --format text --value "<h1>Hello</h1>"
|
|
250
|
+
formlm-cli connect cover-page update --app <appId> --id cover_main --name "New Title"
|
|
251
|
+
formlm-cli connect cover-page find --app <appId> [--id cover_main]
|
|
252
|
+
formlm-cli connect cover-page remove --app <appId> [--id cover_main]
|
|
253
|
+
|
|
254
|
+
# Final page management
|
|
255
|
+
formlm-cli connect final-page add --app <appId> --id final_report --name "Thank You" --enable-report true
|
|
256
|
+
formlm-cli connect final-page update --app <appId> --id final_report --name "Done"
|
|
257
|
+
formlm-cli connect final-page find --app <appId> [--id final_report]
|
|
258
|
+
formlm-cli connect final-page remove --app <appId> [--id final_report]
|
|
259
|
+
|
|
260
|
+
# Main page management
|
|
261
|
+
formlm-cli connect main-page set --app <appId> --format card
|
|
262
|
+
formlm-cli connect main-page set --app <appId> --field X1 --description "<p>Context</p>"
|
|
263
|
+
|
|
264
|
+
# Visual style
|
|
265
|
+
formlm-cli connect style set --app <appId> --type cover --bg "#f3f3fe" --fg "#ffffff" --font "#01105c"
|
|
266
|
+
formlm-cli connect style query --app <appId> --type cover
|
|
267
|
+
formlm-cli connect style apply --app <appId> --look "deep blue tech, frosted glass cards" [--theme Minimal] [--layout flat]
|
|
268
|
+
formlm-cli connect style apply-all --app <appId> --look "light warm Japanese style" [--theme Minimal] [--layout flat]
|
|
269
|
+
formlm-cli connect style move --app <appId> --id <pageId> --direction up
|
|
270
|
+
```
|
|
146
271
|
|
|
147
|
-
###
|
|
272
|
+
### Report (Pages & Widgets)
|
|
148
273
|
|
|
149
|
-
|
|
274
|
+
```bash
|
|
275
|
+
formlm-cli report query --app <appId> # List all report pages
|
|
276
|
+
formlm-cli report find --app <appId> --filter <keyword> # Find report widget
|
|
277
|
+
formlm-cli report update --app <appId> --page <pageId> --name "New Name"
|
|
278
|
+
|
|
279
|
+
# Page management
|
|
280
|
+
formlm-cli report page add --app <appId> --name "Summary" --layout grid
|
|
281
|
+
formlm-cli report page update --app <appId> --id <pageId> --name "Overview"
|
|
282
|
+
formlm-cli report page remove --app <appId> --id <pageId>
|
|
283
|
+
|
|
284
|
+
# Widget management
|
|
285
|
+
formlm-cli report widget list --app <appId> --page <pageId>
|
|
286
|
+
formlm-cli report widget find --app <appId> --filter <keyword>
|
|
287
|
+
formlm-cli report widget set --app <appId> --id <widgetId> --value "{{TotalScore}}"
|
|
288
|
+
formlm-cli report widget add --app <appId> --page <pageId> --type chart --chartType bar --name "Score Chart"
|
|
289
|
+
formlm-cli report widget update --app <appId> --id <widgetId> --name "Updated Chart"
|
|
290
|
+
formlm-cli report widget remove --app <appId> --id <widgetId>
|
|
291
|
+
formlm-cli report widget types --category chart
|
|
292
|
+
formlm-cli report widget config --type chart --prop chartType
|
|
293
|
+
|
|
294
|
+
# Logic rules
|
|
295
|
+
formlm-cli report logic add --app <appId> --page <pageId> --condition "score>20" --action show
|
|
296
|
+
formlm-cli report logic list --app <appId> --page <pageId>
|
|
297
|
+
formlm-cli report logic remove --app <appId> --id <logicId>
|
|
298
|
+
```
|
|
150
299
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
300
|
+
### Expert (AI Interpretation)
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
formlm-cli expert query --app <appId> # Query expert config
|
|
304
|
+
formlm-cli expert find --app <appId> # Find expert details
|
|
305
|
+
formlm-cli expert config --app <appId> --enableChat true # Full configuration
|
|
306
|
+
formlm-cli expert set --app <appId> --key model --value gpt-4
|
|
307
|
+
formlm-cli expert avatar --app <appId> --name "Dr. AI" --avatar <url>
|
|
308
|
+
formlm-cli expert remove --app <appId>
|
|
309
|
+
formlm-cli expert chat --app <appId> --message "Explain my score"
|
|
160
310
|
```
|
|
161
311
|
|
|
162
|
-
|
|
312
|
+
### Share
|
|
163
313
|
|
|
164
|
-
|
|
314
|
+
```bash
|
|
315
|
+
formlm-cli share publish --app <appId> # Publish (each respondent can submit once; unlimited respondents)
|
|
316
|
+
formlm-cli share unpublish --app <appId> # Unpublish
|
|
317
|
+
formlm-cli share query --app <appId> # Check publish status
|
|
318
|
+
formlm-cli share url --app <appId> # Get the shareable URL
|
|
319
|
+
```
|
|
165
320
|
|
|
166
|
-
|
|
321
|
+
---
|
|
167
322
|
|
|
168
|
-
|
|
323
|
+
## MCP Integration
|
|
169
324
|
|
|
170
|
-
|
|
325
|
+
FormLM CLI works as a standard MCP Server over stdio and plugs into **any MCP-compatible AI platform** — Claude Desktop, Cursor, Codex CLI, Windsurf, Cline, etc.
|
|
171
326
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
```
|
|
327
|
+
> **⚠️ macOS/Linux users:** desktop AI clients often launch the MCP server without your full terminal PATH, which can cause `command not found` errors. See **[INSTALL.md → Step 4](INSTALL.md#step-4--connect-to-an-ai-agent-mcp-mode)** for the `env.PATH` fix, per-platform config file locations (including Codex CLI's TOML format), and the full setup guide.
|
|
328
|
+
|
|
329
|
+
> **No token? No problem.** If you omit `FORMLM_TOKEN`, the AI will prompt you to authenticate via the `auth_login` tool — just provide your email + password (or token) directly in the chat.
|
|
176
330
|
|
|
177
331
|
---
|
|
178
332
|
|
|
179
|
-
## Available MCP Tools (
|
|
333
|
+
## Available MCP Tools (9)
|
|
180
334
|
|
|
181
|
-
|
|
|
335
|
+
| Tier | Tool | Description |
|
|
182
336
|
|---|---|---|
|
|
183
|
-
|
|
|
184
|
-
|
|
|
185
|
-
|
|
|
186
|
-
|
|
|
187
|
-
|
|
|
188
|
-
|
|
|
189
|
-
|
|
|
190
|
-
|
|
|
191
|
-
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
|
196
|
-
|
|
197
|
-
|
|
|
198
|
-
|
|
|
199
|
-
|
|
|
200
|
-
|
|
|
201
|
-
|
|
|
202
|
-
|
|
|
337
|
+
| 0 | `auth_login` | Login with token or email + password |
|
|
338
|
+
| 0 | `auth_status` | Check current login status |
|
|
339
|
+
| 1 | `formlm_plan` | Preview execution plan without executing (for user review before create) |
|
|
340
|
+
| 1 | `formlm_create` | Generate a complete app from natural language (AssessAgent pipeline) |
|
|
341
|
+
| 1 | `formlm_modify` | Modify an existing app via natural language (BuilderAgent pipeline) |
|
|
342
|
+
| 1 | `formlm_confirm` | Confirm and execute a medium/high risk plan returned by `formlm_modify` — no web UI needed |
|
|
343
|
+
| 2 | `formlm_snapshot` | Get aggregated state of all modules (form/scale/connect/report/expert/share) |
|
|
344
|
+
| 2 | `formlm_skill` | Fetch SKILL.md domain knowledge for a skill module |
|
|
345
|
+
| 3 | `formlm_exec` | Execute any whitelisted CLI command directly |
|
|
346
|
+
|
|
347
|
+
## Available MCP Resources (6)
|
|
348
|
+
|
|
349
|
+
| Resource URI | Description |
|
|
350
|
+
|---|---|
|
|
351
|
+
| `formlm://skills/form` | Form field SKILL.md — P0 constraints, field types, scoring rules |
|
|
352
|
+
| `formlm://skills/scale` | Scale dimension SKILL.md — range rules, polarity, direction |
|
|
353
|
+
| `formlm://skills/connect` | Connect page SKILL.md — theme modes, layout formats |
|
|
354
|
+
| `formlm://skills/report` | Report layout SKILL.md — widget types, variables, logic |
|
|
355
|
+
| `formlm://skills/expert` | Expert interpretation SKILL.md — AI config, chat rules |
|
|
356
|
+
| `formlm://skills/share` | Share/publish SKILL.md — access types, idempotency |
|
|
203
357
|
|
|
204
358
|
---
|
|
205
359
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA4EzD"}
|
package/dist/commands/auth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { authLogin, authMe } from '../exec.js';
|
|
2
|
-
import { addProfile, removeProfile, getActiveProfile } from '../config.js';
|
|
2
|
+
import { addProfile, removeProfile, getActiveProfile, getBaseUrl } from '../config.js';
|
|
3
3
|
import * as readline from 'node:readline';
|
|
4
4
|
export function registerAuthCommand(parent) {
|
|
5
5
|
const auth = parent.command('auth').description('Authentication management');
|
|
@@ -7,11 +7,14 @@ export function registerAuthCommand(parent) {
|
|
|
7
7
|
.command('login')
|
|
8
8
|
.description('Log in to FormLM')
|
|
9
9
|
.option('--token <token>', 'Log in directly with a token')
|
|
10
|
-
.option('--url <url>', 'Server URL
|
|
10
|
+
.option('--url <url>', 'Server URL (defaults to FORMLM_BASE_URL env var or https://formlm.me)')
|
|
11
11
|
.action(async (opts) => {
|
|
12
|
+
// 优先级:--url 参数 > FORMLM_BASE_URL 环境变量 > 默认 https://formlm.me
|
|
13
|
+
// 避免本地/自建服务器用户未显式传 --url 时被静默写入错误的 formlm.me
|
|
14
|
+
const url = opts.url || getBaseUrl();
|
|
12
15
|
if (opts.token) {
|
|
13
16
|
// Use token directly
|
|
14
|
-
addProfile({ name: 'default', url
|
|
17
|
+
addProfile({ name: 'default', url, token: opts.token, active: true });
|
|
15
18
|
// Verify token
|
|
16
19
|
const result = await authMe();
|
|
17
20
|
if (result.code === 0) {
|
|
@@ -32,7 +35,7 @@ export function registerAuthCommand(parent) {
|
|
|
32
35
|
const result = await authLogin(email, password);
|
|
33
36
|
if (result.code === 0 && result.data) {
|
|
34
37
|
const token = typeof result.data === 'string' ? result.data : result.data.token || '';
|
|
35
|
-
addProfile({ name: 'default', url
|
|
38
|
+
addProfile({ name: 'default', url, token, active: true });
|
|
36
39
|
console.log('✅ Login successful!');
|
|
37
40
|
}
|
|
38
41
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,U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