prime-dev-cli 2.0.1 → 2.0.2

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 ADDED
@@ -0,0 +1,132 @@
1
+ # prime-dev-cli
2
+
3
+ `prime-dev-cli` 是一个用于管理多前端项目开发环境的工具,当前包含:
4
+ - CLI
5
+ - 本地 Web UI
6
+ - 浏览器扩展
7
+ - 通用 skill 源与 Claude Code 适配层
8
+
9
+ ## 安装
10
+
11
+ ```bash
12
+ npm install -g prime-dev-cli
13
+ ```
14
+
15
+ 或:
16
+
17
+ ```bash
18
+ pnpm add -g prime-dev-cli
19
+ ```
20
+
21
+ ## 常用命令
22
+
23
+ ```bash
24
+ prime init
25
+ prime ui
26
+ prime update
27
+ prime version
28
+ prime help
29
+ ```
30
+
31
+ ## Skill 结构
32
+
33
+ 本仓库现在采用两层结构:
34
+
35
+ ### 1. 通用 skill 源
36
+
37
+ 平台无关的能力说明位于:
38
+ - `skills/prime-workspace/README.md`
39
+ - `skills/prime-workspace/SKILL.md`
40
+
41
+ 它描述的是 `prime-dev-cli` 的通用能力,而不是只绑定 Claude Code。
42
+
43
+ ### 2. Claude Code 适配层
44
+
45
+ Claude Code plugin / skill 位于:
46
+ - `plugin-marketplace/plugins/prime-dev-cli`
47
+
48
+ 其中提供:
49
+ - `/prime-workspace`
50
+
51
+ ## 推荐安装方式:skills CLI
52
+
53
+ 下面的 `./skills` 和 `./plugin-marketplace` 示例默认在仓库根目录执行。
54
+ 如果你不是在仓库里,而是在已安装的 npm 包目录中操作,请把它们替换成实际安装目录下的对应路径。
55
+
56
+ 推荐直接使用 `skills` 安装通用 skill:
57
+
58
+ ```bash
59
+ npx skills add ./skills --agent claude-code --global --copy --yes
60
+ ```
61
+
62
+ 如果你要装到别的 agent,替换 `--agent` 即可,例如:
63
+
64
+ ```bash
65
+ npx skills add ./skills --agent codex --global --copy --yes
66
+ ```
67
+
68
+ ## 这个 skill 的目标体验
69
+
70
+ 这个 skill 应该支持用户直接说自然语言,而不是要求用户记接口。
71
+
72
+ 例如:
73
+ - 帮我启动 icrc
74
+ - 停掉 ilink-icrc
75
+ - 看看 iqc 在不在跑
76
+ - 把 icrc 切到 sitnew
77
+ - 给 isource 挂上 ilink-isource
78
+ - 把 /api/user/info 切到异常场景
79
+ - 看下 esource-fe 分支
80
+
81
+ ## `/prime-workspace` 能做什么
82
+
83
+ - 查看 workspace / 项目状态看板
84
+ - 查询单个应用状态
85
+ - 启动 / 停止 / 查看日志
86
+ - 管理 mock 场景
87
+ - 切换代理地址
88
+ - 切换 microapp 地址
89
+ - 查看项目分支状态
90
+
91
+ ## Claude Code 兼容安装方式
92
+
93
+ 如果你需要使用 Claude Code plugin 兼容层,可以直接使用官方 Claude CLI:
94
+
95
+ ### 持久化安装
96
+
97
+ ```bash
98
+ claude plugin marketplace add ./plugin-marketplace
99
+ claude plugin install prime-dev-cli@prime-dev-cli-marketplace
100
+ ```
101
+
102
+ ### 当前 session 临时加载
103
+
104
+ ```bash
105
+ claude --plugin-dir ./plugin-marketplace/plugins/prime-dev-cli
106
+ ```
107
+
108
+ 如果本机有 `cc` 别名,也可以:
109
+
110
+ ```bash
111
+ cc --plugin-dir ./plugin-marketplace/plugins/prime-dev-cli
112
+ ```
113
+
114
+ ## 开发与验证
115
+
116
+ ### 校验 plugin / marketplace
117
+
118
+ ```bash
119
+ claude plugin validate ./plugin-marketplace
120
+ ```
121
+
122
+ ### 本地加载 Claude adapter
123
+
124
+ ```bash
125
+ claude --plugin-dir ./plugin-marketplace/plugins/prime-dev-cli
126
+ ```
127
+
128
+ ### 运行 root 测试
129
+
130
+ ```bash
131
+ pnpm run test:root
132
+ ```
package/bin/cli.mjs CHANGED
@@ -54,11 +54,11 @@ function helpStdout() {
54
54
  prime-cli ${pkg.version}
55
55
  `);
56
56
  console.log('Commands:');
57
- console.log(' init 初始化配置文件');
58
- console.log(' ui 启动UI');
59
- console.log(' update 覆盖式更新配置文件');
60
- console.log(' version 显示版本信息');
61
- console.log(' help 显示帮助信息');
57
+ console.log(' init 初始化配置文件');
58
+ console.log(' ui 启动UI');
59
+ console.log(' update 覆盖式更新配置文件');
60
+ console.log(' version 显示版本信息');
61
+ console.log(' help 显示帮助信息');
62
62
  }
63
63
 
64
64
 
@@ -90,6 +90,7 @@ function startServer(){
90
90
  });
91
91
  }
92
92
 
93
+
93
94
  // 设置环境文件
94
95
  async function setProjectsFile(forceUpdate = false){
95
96
  const __filename = fileURLToPath(import.meta.url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prime-dev-cli",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "refresh:config": "node ./bin/cli.mjs init",
@@ -8,7 +8,8 @@
8
8
  "zip:plugin": "pnpm --filter prime-dev-browser-extension zip",
9
9
  "dev:plugin": "pnpm --filter prime-dev-browser-extension dev",
10
10
  "dev:server": "pnpm --filter server dev",
11
- "postbuild:server": "mkdir -p ./dist/server && cp -R ./packages/server/.next ./dist/server && cp -R ./packages/server/public ./dist/server"
11
+ "postbuild:server": "mkdir -p ./dist/server && cp -R ./packages/server/.next ./dist/server && cp -R ./packages/server/public ./dist/server",
12
+ "test:root": "node --test ./test/skill-assets.test.mjs"
12
13
  },
13
14
  "bin": {
14
15
  "prime": "bin/cli.mjs"
@@ -17,7 +18,9 @@
17
18
  "bin",
18
19
  "dist",
19
20
  "config",
20
- "lib"
21
+ "lib",
22
+ "skills",
23
+ "plugin-marketplace"
21
24
  ],
22
25
  "keywords": [],
23
26
  "author": "",
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "prime-dev-cli-marketplace",
3
+ "owner": {
4
+ "name": "prime-dev-cli"
5
+ },
6
+ "metadata": {
7
+ "description": "Bundled Claude Code plugins shipped with prime-dev-cli"
8
+ },
9
+ "plugins": [
10
+ {
11
+ "name": "prime-dev-cli",
12
+ "source": "./plugins/prime-dev-cli",
13
+ "description": "Workspace, mock, proxy, and microapp operations for prime-dev-cli"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "prime-dev-cli",
3
+ "version": "2.0.1",
4
+ "description": "Claude Code plugin for prime-dev-cli workspace, mock, proxy, and microapp operations",
5
+ "author": {
6
+ "name": "prime-dev-cli"
7
+ },
8
+ "skills": "./skills"
9
+ }
@@ -0,0 +1,48 @@
1
+ # prime-dev-cli Claude adapter
2
+
3
+ This directory is the Claude Code adapter for the generic `prime-workspace` skill source.
4
+
5
+ The platform-neutral source lives at:
6
+ - `skills/prime-workspace/README.md`
7
+ - `skills/prime-workspace/SKILL.md`
8
+
9
+ For most users, the recommended installation path is the `skills` CLI, not this adapter.
10
+
11
+ ## Included Claude skill
12
+
13
+ - `/prime-workspace`
14
+
15
+ This adapter is meant to preserve the same friendly experience as the generic skill source, including phrases like:
16
+ - 帮我启动 icrc
17
+ - 看看 iqc 在不在跑
18
+ - 把 icrc 切到 sitnew
19
+ - 给 isource 挂上 ilink-isource
20
+ - 把 /api/user/info 切到异常场景
21
+
22
+ ## Persistent installation
23
+
24
+ ```bash
25
+ claude plugin marketplace add ./plugin-marketplace
26
+ claude plugin install prime-dev-cli@prime-dev-cli-marketplace
27
+ ```
28
+
29
+ ## Session-only loading
30
+
31
+ ```bash
32
+ claude --plugin-dir ./plugin-marketplace/plugins/prime-dev-cli
33
+ ```
34
+
35
+ If your shell exposes a `cc` alias, this also works:
36
+
37
+ ```bash
38
+ cc --plugin-dir ./plugin-marketplace/plugins/prime-dev-cli
39
+ ```
40
+
41
+ ## Local testing
42
+
43
+ From the repository root:
44
+
45
+ ```bash
46
+ claude plugin validate ./plugin-marketplace
47
+ claude --plugin-dir ./plugin-marketplace/plugins/prime-dev-cli
48
+ ```
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: prime-workspace
3
+ description: Use this skill when the user wants to operate prime-dev-cli through friendly phrases such as starting icrc, checking one app's status, managing mock scenes, switching proxy targets, or updating microapp bindings.
4
+ metadata:
5
+ author: prime-dev-cli
6
+ version: "0.1.0"
7
+ argument-hint: status | project | start | stop | logs | mock | proxy | microapp | branch
8
+ ---
9
+
10
+ # Prime Workspace
11
+
12
+ This file is the Claude Code adapter for the generic `skills/prime-workspace/SKILL.md` execution spec.
13
+
14
+ Follow the generic skill rules first. This adapter only adds Claude-specific guidance.
15
+
16
+ ## Claude-specific guidance
17
+
18
+ ### Default local server
19
+ - Base URL: `http://localhost:52741`
20
+
21
+ ### If the server is unavailable
22
+ Prefer telling packaged users to run:
23
+ - `prime ui`
24
+
25
+ For repository developers, `pnpm run dev:server` is also acceptable.
26
+
27
+ ### Output style
28
+ For successful actions, prefer concise task-oriented output. Example:
29
+ - 已启动 icrc
30
+ - 访问地址:`http://localhost:8806`
31
+
32
+ For ambiguous actions, ask one narrow follow-up question instead of dumping raw config.
33
+
34
+ ## High-value friendly examples
35
+ - 帮我启动 icrc
36
+ - 停掉 ilink-icrc
37
+ - 看看 iqc 在不在跑
38
+ - 把 icrc 切到 sitnew
39
+ - 把 ilink 的 /icrc-api 切到 uat
40
+ - 给 isource 挂上 ilink-isource
41
+ - 把 /api/user/info 切到异常场景
42
+ - 看下 esource-fe 分支
43
+
44
+ ## Claude-specific safety emphasis
45
+ Always confirm before:
46
+ - deleting a mock scene
47
+ - deleting a whole mock API
48
+ - opening all mock scenes
49
+ - closing all mock scenes
50
+ - changing microapp selections
51
+ - changing proxies when the target prefix is ambiguous
52
+
53
+ ## Reference
54
+ The generic execution contract lives at:
55
+ - `skills/prime-workspace/SKILL.md`
@@ -0,0 +1,109 @@
1
+ # prime-workspace
2
+
3
+ `prime-workspace` 是 `prime-dev-cli` 的通用 skill 源说明,不绑定单一 Agent 平台。
4
+
5
+ ## 目标效果
6
+
7
+ 这个 skill 的目标不是让用户记 endpoint。
8
+ 而是让用户可以直接说自然语言,例如:
9
+ - 帮我启动 icrc
10
+ - 停掉 ilink-icrc
11
+ - 看看 iqc 在不在跑
12
+ - 把 icrc 切到 sitnew
13
+ - 给 isource 挂上 ilink-isource
14
+ - 把 /api/user/info 切到异常场景
15
+
16
+ ## 能力范围
17
+
18
+ - workspace / 项目状态看板
19
+ - 单项目状态查询
20
+ - 启动 / 停止 / 状态 / 日志
21
+ - mock 接口创建与返回体编辑(含 Mock.js 随机数据)
22
+ - mock 场景管理
23
+ - 代理地址切换
24
+ - microapp 地址切换
25
+ - 分支状态查看
26
+
27
+ ## 推荐安装方式:skills CLI
28
+
29
+ 下面的 `./skills` 和 `./plugin-marketplace` 示例默认在仓库根目录执行。
30
+ 如果你是从已安装的 npm 包中读取 skill,请改成对应安装目录下的路径。
31
+
32
+ 推荐通过 `skills` CLI 安装这份通用 skill:
33
+
34
+ ```bash
35
+ npx skills add ./skills --agent claude-code --global --copy --yes
36
+ ```
37
+
38
+ 如果你要接到其他 agent,替换 `--agent` 即可,例如:
39
+
40
+ ```bash
41
+ npx skills add ./skills --agent codex --global --copy --yes
42
+ ```
43
+
44
+ ## 这个 skill 需要具备的执行能力
45
+
46
+ 它应该至少知道:
47
+ - 默认本地 server 是 `http://localhost:52741`
48
+ - server 不可达时不要编造结果
49
+ - 启动类操作优先按 env 解释
50
+ - 打开项目 / 看分支 / 创建工作区优先按 project 解释
51
+ - 启动成功后的访问地址优先来自 env 的 `host`
52
+ - 删除 mock / 一键 mock / microapp 修改 / 多前缀代理修改要先确认
53
+
54
+ ## Friendly usage examples
55
+
56
+ ### 启动 / 状态 / 日志
57
+ - 帮我启动 icrc
58
+ - 停掉 ilink-icrc
59
+ - 看看 iqc 在不在跑
60
+ - 打开 isource 的日志
61
+
62
+ ### 代理
63
+ - 看 icrc 现在走哪个代理
64
+ - 把 icrc 切到 sitnew
65
+ - 把 ilink 的 /icrc-api 切到 uat
66
+ - 给 ispar 新增 /idea-api
67
+
68
+ ### Mock
69
+ - 打开 iqc-fe 的 mock 功能
70
+ - 打开 iqc-fe 的 mock 拦截
71
+ - 看 mock 列表
72
+ - 把 /api/user/info 切到异常场景
73
+ - 新建一个超时场景
74
+ - 删除这个 mock 场景
75
+ - 一键关闭所有 mock
76
+
77
+ ### MicroApp
78
+ - 看 icrc 挂了哪些微应用
79
+ - 给 isource 挂上 ilink-isource
80
+ - 清空 iua 的微应用代理
81
+
82
+ ### 项目 / 工作区 / 分支
83
+ - 看下工作空间状态
84
+ - 打开 esource-fe
85
+ - 给我建个 ilink-fe 和 iqc-fe 的工作区
86
+ - 看下 esource-fe 分支
87
+
88
+ ## Claude Code 兼容适配
89
+
90
+ 如果你需要使用 Claude Code plugin 兼容层:
91
+
92
+ ### 手动持久化安装
93
+
94
+ ```bash
95
+ claude plugin marketplace add ./plugin-marketplace
96
+ claude plugin install prime-dev-cli@prime-dev-cli-marketplace
97
+ ```
98
+
99
+ ### 当前 session 临时加载
100
+
101
+ ```bash
102
+ claude --plugin-dir ./plugin-marketplace/plugins/prime-dev-cli
103
+ ```
104
+
105
+ 如果本机有 `cc` 别名,也可以:
106
+
107
+ ```bash
108
+ cc --plugin-dir ./plugin-marketplace/plugins/prime-dev-cli
109
+ ```
@@ -0,0 +1,347 @@
1
+ ---
2
+ name: prime-workspace
3
+ description: Use this skill to handle prime-dev-cli workspace operations through natural language, such as starting an env like icrc, checking one app's status, creating or editing mock APIs and Mock.js responses, managing mock scenes, switching proxy targets, and updating microapp bindings.
4
+ ---
5
+
6
+ # prime-workspace
7
+
8
+ This is the platform-neutral execution spec for `prime-dev-cli`.
9
+
10
+ The goal is not to expose raw API endpoints to the user. The goal is to let the user speak naturally, for example:
11
+ - 帮我启动 icrc
12
+ - 停掉 ilink-icrc
13
+ - 看看 iqc 在不在跑
14
+ - 把 icrc 切到 sitnew
15
+ - 给 isource 挂上 ilink-isource
16
+ - 把 /api/user/info 切到异常场景
17
+
18
+ ## Preconditions
19
+
20
+ ### Default local server
21
+ - Base URL: `http://localhost:52741`
22
+
23
+ ### Reachability rule
24
+ Before using any action, first verify that the local server is reachable.
25
+
26
+ If the local server is not reachable:
27
+ - do not fabricate results
28
+ - for packaged users, suggest `prime ui`
29
+ - for repository developers, `pnpm run dev:server` is also acceptable
30
+
31
+ ### Configuration source
32
+ Treat the runtime workspace configuration as the source of truth:
33
+ - current workspace/project/env structure comes from `~/.prime-projects.json`
34
+ - do not rely on stale example config fields if runtime data differs
35
+
36
+ ## Intent-first action map
37
+
38
+ Do not think in terms of endpoints first. Think in terms of user intent first.
39
+
40
+ ### 1. Workspace status
41
+ Typical requests:
42
+ - 看下工作空间状态
43
+ - 哪些项目还没准备好
44
+ - 项目空间现在什么情况
45
+
46
+ Use:
47
+ - `GET /api/check-workspace`
48
+ - `GET /api/process/status`
49
+
50
+ Return:
51
+ - whether workspace exists
52
+ - project counts
53
+ - existing / pending / incomplete projects
54
+ - currently running envs
55
+
56
+ ### 2. Project drill-down
57
+ Typical requests:
58
+ - 看下 esource-fe
59
+ - 看下 esource-fe 分支
60
+ - 打开 esource-fe
61
+ - 给我建个 ilink-fe 和 iqc-fe 的工作区
62
+
63
+ Use as needed:
64
+ - `GET /api/project-config?project=<projectName>`
65
+ - `GET /api/current-branch?project=<projectName>`
66
+ - `POST /api/open-project`
67
+ - `POST /api/workspace/create`
68
+
69
+ ### 3. Start / stop / status / logs
70
+ Typical requests:
71
+ - 帮我启动 icrc
72
+ - 停掉 ilink-icrc
73
+ - 看看 iqc 在不在跑
74
+ - 打开 isource 的日志
75
+
76
+ Use:
77
+ - `POST /api/process/start`
78
+ - `DELETE /api/process/start?projectName=<projectName>&envName=<envName>`
79
+ - `GET /api/process/status?projectName=<projectName>&envName=<envName>`
80
+ - `GET /api/process/logs?projectName=<projectName>&envName=<envName>&tail=100`
81
+
82
+ When starting one env:
83
+ - use that env's configured `startCommand`
84
+ - report the access URL from that env's configured `host`
85
+ - prefer output like:
86
+ - 已启动 icrc
87
+ - 访问地址:`http://localhost:8806`
88
+
89
+ ### 4. Mock project-level control
90
+ Typical requests:
91
+ - 打开 iqc-fe 的 mock 功能
92
+ - 关闭 iqc-fe 的 mock 功能
93
+ - 打开 iqc-fe 的 mock 拦截
94
+ - 关闭 iqc-fe 的 mock 拦截
95
+
96
+ Use:
97
+ - `GET /api/project-config?project=<projectName>`
98
+ - `PUT /api/project-config`
99
+
100
+ Project-level mock fields:
101
+ - `mockOpen`
102
+ - `mockingIntercept`
103
+
104
+ ### 5. Mock scene management
105
+ Typical requests:
106
+ - 看 mock 列表
107
+ - 把 /api/user/info 切到异常场景
108
+ - 新建一个超时场景
109
+ - 打开这个场景
110
+ - 关闭这个场景
111
+ - 预览 GET /api/user/info 现在返回什么
112
+
113
+ Use:
114
+ - `GET /api/mock-file?project=<projectName>`
115
+ - `POST /api/mock-file`
116
+ - `GET /api/mock-file-content?project=<projectName>&apiName=<apiName>&method=<method>&siteName=<siteName>`
117
+ - `PUT /api/mock-file-content`
118
+ - `PUT /api/mock-setting`
119
+ - `PUT /api/mock-open-status`
120
+ - `GET /api/get-mock-data?project=<projectName>&url=<url>&method=<method>`
121
+
122
+ ### 6. Mock deletion and bulk toggles
123
+ Typical requests:
124
+ - 删除这个 mock 场景
125
+ - 删除整个 /api/user mock 接口
126
+ - 一键开启所有 mock
127
+ - 一键关闭所有 mock
128
+
129
+ Use:
130
+ - `DELETE /api/mock-file?project=<projectName>&apiName=<apiName>&method=<method>&siteName=<siteName>`
131
+ - `DELETE /api/delete-mock-api?project=<projectName>&apiName=<apiName>`
132
+ - `POST /api/open-all-mock`
133
+ - `POST /api/cleanup-mock`
134
+
135
+ ### 7. Proxy viewing and editing
136
+ Typical requests:
137
+ - 看 icrc 现在走哪个代理
138
+ - 把 icrc 切到 sitnew
139
+ - 把 ilink 的 /icrc-api 切到 uat
140
+ - 给 ispar 新增 /idea-api
141
+
142
+ Use:
143
+ - `GET /api/project-config?project=<projectName>`
144
+ - `PUT /api/project-config`
145
+
146
+ ### 8. MicroApp bindings
147
+ Typical requests:
148
+ - 看 icrc 挂了哪些微应用
149
+ - 给 isource 挂上 ilink-isource
150
+ - 清空 iua 的微应用代理
151
+
152
+ Use:
153
+ - `GET /api/all-projects-envs`
154
+ - `PUT /api/microapp-proxy-config`
155
+
156
+ ## Natural-language routing rules
157
+
158
+ ### Project vs env interpretation
159
+ Normalize both forms:
160
+ - `project` / `projectName`
161
+ - `env` / `envName`
162
+
163
+ Interpretation priority:
164
+ - start / stop / logs / proxy / microapp -> prefer **env**
165
+ - open project / branch / workspace creation -> prefer **project**
166
+
167
+ Examples:
168
+ - `帮我启动 icrc` -> treat `icrc` as an env
169
+ - `打开 ilink-fe` -> treat `ilink-fe` as a project
170
+ - `打开 ilink` -> ambiguous, ask whether the user means the project or the env
171
+
172
+ ### Access URL rule
173
+ When an env is running or has just been started:
174
+ - derive the user-facing URL from that env's configured `host`
175
+ - if process APIs also return a port, still prefer `host` as the primary display URL
176
+
177
+ ### Project workspace vs editor workspace
178
+ These are different intents:
179
+ - “创建项目空间” -> initialize/repair local repos
180
+ - “创建工作区” -> create/open a multi-project editor workspace
181
+
182
+ Do not collapse them into one action.
183
+
184
+ ## Confirmation matrix
185
+
186
+ Always confirm before:
187
+ - deleting one mock scene
188
+ - deleting a whole mock API
189
+ - opening all mock scenes
190
+ - closing all mock scenes
191
+ - changing microapp selections
192
+ - changing proxies when multiple prefixes may match
193
+
194
+ Also explain why confirmation is needed.
195
+
196
+ ## Required input rules
197
+
198
+ ### Starting one env
199
+ To start an env reliably, determine:
200
+ - `projectName`
201
+ - `envName`
202
+ - `startCommand` from runtime config
203
+ - `host` from runtime config
204
+
205
+ If the env name maps cleanly to one configured env, proceed.
206
+ If multiple matches exist, ask a follow-up question.
207
+
208
+ ### Proxy edits
209
+ For proxy edits, determine:
210
+ - `projectName`
211
+ - `envName`
212
+ - target prefix
213
+ - target proxy name or custom URL
214
+ - optional rewrite settings
215
+
216
+ If the env has multiple prefixes and the user did not specify which one, ask.
217
+
218
+ ### Mock scene operations
219
+ For mock scene operations, determine:
220
+ - `projectName`
221
+ - `apiName`
222
+ - `method`
223
+ - `siteName`
224
+
225
+ Use “scene” as the user-facing term.
226
+
227
+ ### MicroApp edits
228
+ For microapp operations, determine:
229
+ - `projectName`
230
+ - `envName`
231
+ - `selectedItems`
232
+
233
+ Important:
234
+ - `selectedItems` are env-name strings
235
+ - they are not full project/env identifiers
236
+ - explain this if the operation may affect expectations
237
+
238
+ ## Request examples
239
+
240
+ ### Workspace status
241
+ ```http
242
+ GET /api/check-workspace
243
+ ```
244
+
245
+ ### Project config
246
+ ```http
247
+ GET /api/project-config?project=esource-fe
248
+ ```
249
+
250
+ ### One env status
251
+ ```http
252
+ GET /api/process/status?projectName=esource-fe&envName=icrc
253
+ ```
254
+
255
+ ### Start one env
256
+ ```http
257
+ POST /api/process/start
258
+ Content-Type: application/json
259
+
260
+ {
261
+ "projectName": "esource-fe",
262
+ "envName": "icrc",
263
+ "startCommand": "npm run serve:c"
264
+ }
265
+ ```
266
+
267
+ ### Switch current mock scene
268
+ ```http
269
+ PUT /api/mock-setting
270
+ Content-Type: application/json
271
+
272
+ {
273
+ "projectName": "iqc-fe",
274
+ "apiName": "api_user_info",
275
+ "method": "get",
276
+ "currentSite": "异常场景"
277
+ }
278
+ ```
279
+
280
+ ### Update env proxy config
281
+ ```http
282
+ PUT /api/project-config
283
+ Content-Type: application/json
284
+
285
+ {
286
+ "projectName": "esource-fe",
287
+ "envName": "icrc",
288
+ "apiProxies": []
289
+ }
290
+ ```
291
+
292
+ ### Update microapp bindings
293
+ ```http
294
+ PUT /api/microapp-proxy-config
295
+ Content-Type: application/json
296
+
297
+ {
298
+ "projectName": "isource-fe",
299
+ "envName": "isource",
300
+ "selectedItems": ["ilink-isource"]
301
+ }
302
+ ```
303
+
304
+ ## Friendly usage examples
305
+
306
+ ### Workspace / project / branch
307
+ - 看下工作空间状态
308
+ - 打开 esource-fe
309
+ - 给我建个 ilink-fe 和 iqc-fe 的工作区
310
+ - 看下 esource-fe 分支
311
+
312
+ ### Start / stop / status / logs
313
+ - 帮我启动 icrc
314
+ - 停掉 ilink-icrc
315
+ - 看看 iqc 在不在跑
316
+ - 打开 isource 的日志
317
+
318
+ ### Proxy
319
+ - 看 icrc 现在走哪个代理
320
+ - 把 icrc 切到 sitnew
321
+ - 把 ilink 的 /icrc-api 切到 uat
322
+ - 给 ispar 新增 /idea-api
323
+
324
+ ### Mock
325
+ - 打开 iqc-fe 的 mock 功能
326
+ - 打开 iqc-fe 的 mock 拦截
327
+ - 看 mock 列表
328
+ - 把 /api/user/info 切到异常场景
329
+ - 新建一个超时场景
330
+ - 删除这个 mock 场景
331
+ - 一键关闭所有 mock
332
+
333
+ ### MicroApp
334
+ - 看 icrc 挂了哪些微应用
335
+ - 给 isource 挂上 ilink-isource
336
+ - 清空 iua 的微应用代理
337
+
338
+ ## Failure handling
339
+
340
+ If an API fails:
341
+ - name the exact action that failed
342
+ - report whether the likely cause is missing project, missing env, missing local workspace, bad input, or server unavailability
343
+ - do not invent missing values
344
+
345
+ If a request is ambiguous:
346
+ - ask one narrow follow-up question
347
+ - prefer clarifying project/env/prefix/scene ambiguity before doing anything destructive