Skip to content

Commit faa2420

Browse files
committed
fix: align cli commands
1 parent 37b8c8d commit faa2420

5 files changed

Lines changed: 264 additions & 15 deletions

File tree

skills/nocobase-env-manage/SKILL.md

Lines changed: 105 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
---
22
name: nocobase-env-manage
3-
description: "Use when users need NocoBase bootstrap and runtime lifecycle with nb CLI only."
4-
argument-hint: "[task: install|app-manage|upgrade|start|stop]"
3+
description: "Use when users need NocoBase bootstrap, runtime lifecycle, CLI maintenance, and skills maintenance with nb CLI only."
4+
argument-hint: "[task: install|app-manage|upgrade|start|stop|restart|logs|down|self-check|self-update|skills-check|skills-update]"
55
allowed-tools: Bash, Read, Write, Grep, Glob
66
owner: platform-tools
7-
version: 2.5.1
8-
last-reviewed: 2026-04-23
7+
version: 2.6.0
8+
last-reviewed: 2026-04-29
99
risk-level: medium
1010
---
1111

1212
# Goal
1313

14-
Use `nb` CLI only to complete NocoBase bootstrap and lifecycle actions.
14+
Use `nb` CLI only to complete NocoBase bootstrap, lifecycle, and maintenance actions.
1515

1616
# Scope
1717

1818
- Bootstrap or connect NocoBase environments through `nb init`.
1919
- Manage saved CLI environments through `nb env`.
2020
- Manage app runtime lifecycle through `nb app`.
21+
- Check and update the `nb` CLI through `nb self`.
22+
- Check and update installed NocoBase skills through `nb skills`.
2123
- Inspect built-in database runtime only when it helps verify or diagnose the selected environment.
2224

2325
# Non-Goals
@@ -39,6 +41,9 @@ Use `nb` CLI only to complete NocoBase bootstrap and lifecycle actions.
3941
- Never proactively fill install/setup forms on the user's behalf; only surface the URL, explain the next step, and let the user complete the form.
4042
- If the CLI prints a continuation or recovery command, especially `nb init ... --resume ...`, execute that exact direct `nb` command unless it is destructive or conflicts with the user's latest instruction.
4143
- Use `nb app <command>` for runtime lifecycle operations.
44+
- Use `nb self <command>` only for CLI self-check/update.
45+
- Use `nb skills <command>` only for installed skills check/update.
46+
- Do not execute ambiguous status/check/update/upgrade intents until the target is clear: app/runtime/env, CLI, or skills.
4247
- Do not add extra precheck gates before executing user-requested `nb` commands.
4348
- Prefer executing user-requested runtime commands first; use `nb --help` when user asks for diagnostics/help output or command discovery is needed.
4449
- Surface CLI outputs and hints directly to users.
@@ -53,12 +58,16 @@ Use `nb` CLI only to complete NocoBase bootstrap and lifecycle actions.
5358
- `restart`
5459
- `logs`
5560
- `down`
61+
- `self-check`
62+
- `self-update`
63+
- `skills-check`
64+
- `skills-update`
5665

5766
# Input Contract
5867

5968
| Input | Required | Default | Notes |
6069
|---|---|---|---|
61-
| `task` | yes | inferred | one of `install/app-manage/upgrade/start/stop/restart/logs/down` |
70+
| `task` | yes | inferred | one of `install/app-manage/upgrade/start/stop/restart/logs/down/self-check/self-update/skills-check/skills-update` |
6271
| `app_env_action` | for `task=app-manage` | `list` | one of `add/use/current/list/remove`; `current` is derived from list output |
6372
| `app_env_name` | conditional | none | required for `add/use/remove` |
6473
| `app_base_url` | conditional | none | required for `add`; accepts URL with or without `/api` (auto-normalized) |
@@ -69,6 +78,7 @@ Use `nb` CLI only to complete NocoBase bootstrap and lifecycle actions.
6978
# Execution Policy
7079

7180
- Execute the target `nb` command directly.
81+
- Intent clarification is not a precheck gate. If the user's wording is ambiguous, ask one concise clarification question before running any command.
7282
- Install routing:
7383
- when the user provides an official NocoBase install or quick-start URL, read it first and follow that official flow, ignoring local install command tables on conflict
7484
- otherwise use `nb init --ui` as the guided install entrypoint
@@ -91,6 +101,45 @@ Use `nb` CLI only to complete NocoBase bootstrap and lifecycle actions.
91101
- For `env add`, normalize API base URL before execution:
92102
- if URL already ends with `/api`, keep as-is
93103
- otherwise append `/api`
104+
- For CLI maintenance, execute the exact command requested by task:
105+
- `self-check` -> `nb self check --json`
106+
- `self-update` -> `nb self update --yes`
107+
- For skills maintenance, execute the exact command requested by task:
108+
- `skills-check` -> `nb skills check --json`
109+
- `skills-update` -> `nb skills update --yes`
110+
- Preserve JSON check output from `nb self check --json` and `nb skills check --json` when reporting results.
111+
- After `self-update` or `skills-update`, run the matching check command as readback unless the CLI says the shell/session must be restarted first.
112+
113+
# Intent Disambiguation
114+
115+
When the user says generic status/check/update/upgrade wording without an explicit target, do not infer a command.
116+
117+
Ambiguous examples include:
118+
119+
- `检查状态`
120+
- `检查一下`
121+
- `健康检查`
122+
- `诊断一下`
123+
- `检查更新`
124+
- `升级`
125+
- `更新`
126+
- `修复`
127+
128+
Ask which target they mean before executing:
129+
130+
- app/runtime/env: `nb env list`, `nb env info`, or `nb app ...`
131+
- CLI: `nb self check --json` or `nb self update --yes`
132+
- skills: `nb skills check --json` or `nb skills update --yes`
133+
134+
Clarification template:
135+
136+
- `你想检查/更新哪一类:NocoBase app/runtime/env、nb CLI,还是已安装 skills?`
137+
138+
Treat these as clear targets:
139+
140+
- explicit command text, such as `nb self check --json`
141+
- exact task names, such as `self-check` or `skills-update`
142+
- wording that names the target, such as `检查 nb CLI`, `更新已安装 skills`, `升级 NocoBase app`, `检查当前环境`
94143

95144
# Env Resolution Rule
96145

@@ -103,11 +152,13 @@ For `upgrade/start/stop/restart/logs/down`:
103152
# Workflow
104153

105154
1. Infer the requested task and any explicit env name, API base URL, auth mode, or official install URL.
106-
2. For install requests with an official URL, read the URL first and follow the official guide flow.
107-
3. Execute only direct `nb` commands from the current command map or from CLI-provided continuation hints.
108-
4. Keep interactive install commands alive until completion, actionable failure, or user interruption.
109-
5. Verify with `nb env list`, `nb env info`, and app/database status when relevant.
110-
6. Report executed commands, important CLI output, and the next concrete action.
155+
2. If status/check/update/upgrade intent could target app/runtime/env, CLI, or skills, ask for clarification before executing.
156+
3. For install requests with an official URL, read the URL first and follow the official guide flow.
157+
4. Execute only direct `nb` commands from the current command map or from CLI-provided continuation hints.
158+
5. Keep interactive install commands alive until completion, actionable failure, or user interruption.
159+
6. Verify with `nb env list`, `nb env info`, and app/database status when relevant.
160+
7. For CLI/skills maintenance, use the `nb self` / `nb skills` commands exactly as mapped.
161+
8. Report executed commands, important CLI output, and the next concrete action.
111162

112163
# Command Map
113164

@@ -232,12 +283,48 @@ nb app logs [--env <env>] [--tail <lines>] [--no-follow]
232283
nb app down [--env <env>]
233284
```
234285

286+
## self-check
287+
288+
```bash
289+
nb self check --json
290+
```
291+
292+
Use this for `nb` CLI health/version/update checks. No env is required.
293+
294+
## self-update
295+
296+
```bash
297+
nb self update --yes
298+
nb self check --json
299+
```
300+
301+
Run the update command first. Run the check command afterward as readback unless the CLI says a new shell/session is required.
302+
303+
## skills-check
304+
305+
```bash
306+
nb skills check --json
307+
```
308+
309+
Use this for installed NocoBase skills health/version/update checks. No env is required.
310+
311+
## skills-update
312+
313+
```bash
314+
nb skills update --yes
315+
nb skills check --json
316+
```
317+
318+
Run the update command first. Run the check command afterward as readback unless the CLI says a new shell/session is required.
319+
235320
# Safety
236321

237322
- Never run `upgrade` on ambiguous env.
238323
- Ask explicit confirmation before `upgrade` when user intent is not explicit.
239324
- Treat `nb app down` as destructive because it removes runtime containers and saved local app files. Always ask explicit confirmation before running it.
240325
- Never pass `--all` or `--yes` to `nb app down` unless the user explicitly requests those flags.
326+
- Treat `nb self update --yes` and `nb skills update --yes` as allowed update shortcuts only when the user clearly requests CLI or skills update.
327+
- Do not substitute package-manager update commands (`npm`, `pnpm`, `yarn`) for `nb self update --yes` or `nb skills update --yes`.
241328

242329
Confirmation template:
243330

@@ -247,18 +334,19 @@ Confirmation template:
247334

248335
Require explicit user confirmation before:
249336

337+
- ambiguous status/check/update/upgrade intents where the target could be app/runtime/env, CLI, or skills.
250338
- `nb app upgrade` when the target env is ambiguous or the user did not clearly request an upgrade.
251339
- `nb app down` in all cases.
252340
- `nb env remove <name> -f`.
253-
- Any command that includes `--all`, `--yes`, or force-style deletion flags.
341+
- Any command that includes `--all`, `--yes`, or force-style deletion flags, except exact `nb self update --yes` / `nb skills update --yes` commands when the user clearly requested that update.
254342

255343
# Output Contract
256344

257345
Final response must include:
258346

259347
- selected task
260348
- executed commands
261-
- relevant CLI outputs (including error/hint lines when failed)
349+
- relevant CLI outputs, including JSON check output and error/hint lines when failed
262350
- normalized API base URL (for `env add`)
263351
- next action
264352

@@ -279,6 +367,10 @@ Final response must include:
279367
- Any CLI-provided `nb init ... --resume ...` continuation was followed or surfaced with a blocker.
280368
- Runtime lifecycle commands used `nb app ...`.
281369
- Env operations used the final `nb env` syntax.
370+
- Ambiguous status/check/update/upgrade wording was clarified before command execution.
371+
- CLI maintenance used `nb self check --json` or `nb self update --yes`.
372+
- Skills maintenance used `nb skills check --json` or `nb skills update --yes`.
373+
- Maintenance update commands were followed by matching check commands when the CLI allowed it.
282374
- Final readback used `nb env list` and, when relevant, `nb env info`.
283375

284376
# References

skills/nocobase-env-manage/agents/openai.yaml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interface:
22
display_name: "NocoBase Env Manage"
3-
short_description: "Bootstrap and manage NocoBase with nb CLI only"
3+
short_description: "Bootstrap, lifecycle, CLI, and skills maintenance with nb CLI only"
44
default_prompt: >
55
Use $nocobase-env-manage with nb CLI only.
66
@@ -17,12 +17,17 @@ interface:
1717
- If install prints a URL that cannot be opened in a sandbox, ask to elevate/open outside the sandbox first; if the user refuses, provide the URL directly.
1818
- Never proactively fill or submit install/setup forms for the user.
1919
- Runtime lifecycle commands are under `nb app`.
20+
- CLI self maintenance commands are under `nb self`.
21+
- Skills maintenance commands are under `nb skills`.
22+
- Do not execute ambiguous status/check/update/upgrade intents until the target is clear: app/runtime/env, CLI, or skills.
2023
- Do not add extra precheck gates before executing requested `nb` commands.
2124
- Prefer executing requested runtime commands first; use `nb --help` when user asks diagnostics/help output or command discovery is needed.
2225
- Relay CLI outputs and hints directly.
2326
2427
Execution policy:
2528
- execute target command directly
29+
- intent clarification is not a precheck gate: if the user says generic `检查状态`, `健康检查`, `诊断`, `检查更新`, `升级`, or `更新` without naming app/runtime/env, CLI, or skills, ask which target they mean before running any command
30+
- clarification wording: `你想检查/更新哪一类:NocoBase app/runtime/env、nb CLI,还是已安装 skills?`
2631
- for `nb init --ui`, treat it as a long-running interactive command; wait for completion instead of interrupting it mid-run or stopping at the setup URL
2732
- when an install command fails with a CLI hint, follow the printed direct `nb` next-step command, especially `nb init ... --resume ...`
2833
- if command fails, report key CLI error/hint lines as-is and provide next action
@@ -35,6 +40,14 @@ interface:
3540
- for `env add`, normalize `--api-base-url` before execution:
3641
- if URL already ends with `/api`, keep as-is
3742
- otherwise append `/api`
43+
- for CLI maintenance, execute exact commands:
44+
- self-check: `nb self check --json`
45+
- self-update: `nb self update --yes`, then `nb self check --json` unless CLI asks for a new shell/session first
46+
- for skills maintenance, execute exact commands:
47+
- skills-check: `nb skills check --json`
48+
- skills-update: `nb skills update --yes`, then `nb skills check --json` unless CLI asks for a new shell/session first
49+
- preserve JSON check output from `nb self check --json` and `nb skills check --json`
50+
- do not substitute package-manager update commands for `nb self update --yes` or `nb skills update --yes`
3851
3952
Tasks:
4053
- install: official URL flow when provided; otherwise `nb init --ui`; follow `--resume` hints; verify with `nb env list` and `nb env info`
@@ -51,6 +64,16 @@ interface:
5164
- restart: `nb app restart --env <env>`
5265
- logs: `nb app logs --env <env> --tail 100 --no-follow`
5366
- down: `nb app down --env <env>`; require explicit confirmation
67+
- self-check: `nb self check --json`
68+
- self-update: `nb self update --yes`
69+
- skills-check: `nb skills check --json`
70+
- skills-update: `nb skills update --yes`
71+
72+
Clear target examples:
73+
- `检查 nb CLI` or `self-check` means `nb self check --json`
74+
- `更新已安装 skills` or `skills-update` means `nb skills update --yes`
75+
- `升级 NocoBase app` means `nb app upgrade --env <env>` after env resolution
76+
- `检查当前环境` means `nb env list` / `nb env info`
5477
5578
Env resolution for upgrade/start/stop/restart/logs/down/current:
5679
1) if explicit env is provided, use it
@@ -60,12 +83,16 @@ interface:
6083
After write actions (`env add/use/remove`), always run readback:
6184
- `nb env list`
6285
86+
After maintenance update actions, run matching readback unless CLI asks for a new shell/session first:
87+
- after `nb self update --yes`: `nb self check --json`
88+
- after `nb skills update --yes`: `nb skills check --json`
89+
6390
If `nb env list` reports:
6491
- `No envs configured.`
6592
- `Run 'nb env add <name> --api-base-url <url>' to add one.`
6693
relay this to user directly and ask whether to create a new app (`nb init --ui`) or add env.
6794
68-
Output should include executed command, relevant CLI outputs, and normalized API base URL when `env add` is used.
95+
Output should include executed command, relevant CLI outputs, JSON check output when present, and normalized API base URL when `env add` is used.
6996
7097
policy:
7198
allow_implicit_invocation: true

skills/nocobase-env-manage/references/preflight-checklist.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ nb app --help
1717
nb app upgrade --help
1818
nb app stop --help
1919
nb app start --help
20+
nb self check --json
21+
nb skills check --json
2022
```
2123

2224
## Rule

skills/nocobase-env-manage/references/troubleshooting.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
- [6) `nb init --ui` fails and prints `--resume`](#6-nb-init---ui-fails-and-prints--resume)
1111
- [7) Token mode env add fails](#7-token-mode-env-add-fails)
1212
- [8) Wrong env targeted for runtime command](#8-wrong-env-targeted-for-runtime-command)
13+
- [9) CLI self check or update fails](#9-cli-self-check-or-update-fails)
14+
- [10) Skills check or update fails](#10-skills-check-or-update-fails)
15+
- [11) Generic check or update intent is ambiguous](#11-generic-check-or-update-intent-is-ambiguous)
1316

1417
## 1) `nb` command not found
1518

@@ -121,3 +124,64 @@ nb app upgrade --env <correct_env>
121124
nb app stop --env <correct_env>
122125
nb app start --env <correct_env>
123126
```
127+
128+
## 9) CLI self check or update fails
129+
130+
Symptom:
131+
132+
- `nb self check --json` reports an unhealthy CLI, version mismatch, or update availability
133+
- `nb self update --yes` fails or asks for a shell/session restart
134+
135+
Fix:
136+
137+
```bash
138+
nb self check --json
139+
nb self update --yes
140+
nb self check --json
141+
```
142+
143+
If the update command says a new shell/session is required, stop after surfacing that message and ask the user to restart the shell or agent session before rechecking. Do not replace the command with `npm`, `pnpm`, or `yarn` update flows.
144+
145+
## 10) Skills check or update fails
146+
147+
Symptom:
148+
149+
- `nb skills check --json` reports missing, stale, or invalid installed skills
150+
- `nb skills update --yes` fails or asks for a shell/session restart
151+
152+
Fix:
153+
154+
```bash
155+
nb skills check --json
156+
nb skills update --yes
157+
nb skills check --json
158+
```
159+
160+
If the update command prints repair instructions, surface them directly. Do not edit installed skill files manually unless the user explicitly asks for local skill development.
161+
162+
## 11) Generic check or update intent is ambiguous
163+
164+
Symptom:
165+
166+
- user says `检查状态`, `健康检查`, `诊断`, `检查更新`, `升级`, or `更新`
167+
- user does not name app/runtime/env, CLI, or skills
168+
169+
Fix:
170+
171+
Ask before executing:
172+
173+
```text
174+
你想检查/更新哪一类:NocoBase app/runtime/env、nb CLI,还是已安装 skills?
175+
```
176+
177+
Then run only the clarified command family:
178+
179+
```bash
180+
nb env list
181+
nb env info
182+
nb app upgrade [--env <env>]
183+
nb self check --json
184+
nb self update --yes
185+
nb skills check --json
186+
nb skills update --yes
187+
```

0 commit comments

Comments
 (0)