openyida 2026.11.2-1 → 2026.11.2-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 CHANGED
@@ -472,7 +472,7 @@ When preparing a PR that needs a personal Fork, or when you ask how to support t
472
472
  | `openyida login [--qwenwork] [target-url] [--env <name>\|--intl\|--overseas\|--global\|--yidaapps\|--alibaba] [--client-id <clientId>] [--endpoint <url>] [--no-browser]` | Login with OAuth token mode |
473
473
  | `openyida logout` | Logout / unbind current project auth |
474
474
  | `openyida auth <status\|login\|refresh\|logout\|profiles\|profile switch\|qwenwork user-info> [--json]` | Token login state and profile management |
475
- | `openyida org <list\|switch> [--json] [--corp-id <corpId>]` | Organization management (list / switch existing profiles first) |
475
+ | `openyida org <list\|switch> [--json] [--corp-id <corpId>] [--no-browser]` | Organization management (list / switch existing profiles first) |
476
476
  | `openyida env [--json\|setup\|list\|show\|switch\|add\|remove] [options]` | Detect AI tool environment & token login state |
477
477
 
478
478
  ### App Management
@@ -698,7 +698,7 @@ function runDingtalkLoopback(options = {}) {
698
698
  prompt: options.prompt,
699
699
  });
700
700
  const callerOwnsBrowser = callerOwnsLoginBrowser(options);
701
- if (!options.quiet || callerOwnsBrowser) {
701
+ if (!options.quiet || callerOwnsBrowser || options.showAuthUrl) {
702
702
  process.stderr.write(`Open this URL to login:\n${authUrl}\n`);
703
703
  }
704
704
  if (!options.quiet) {
package/lib/auth/org.js CHANGED
@@ -235,6 +235,7 @@ async function switchOrganization(targetCorpId, options = {}) {
235
235
  endpoint: options.endpoint || (currentSession && currentSession.base_url),
236
236
  clientId: options.clientId || (currentSession && currentSession.client_id),
237
237
  corpId: targetCorpId,
238
+ showAuthUrl: true,
238
239
  };
239
240
 
240
241
  const cloud = isQwenWorkWebRuntime(options.runtime || detectRuntimeCapabilities({ env: options.env || process.env }));
@@ -322,6 +323,7 @@ async function run(args = []) {
322
323
  const json = hasFlag(args, '--json');
323
324
  const options = {
324
325
  quiet: hasFlag(args, '--quiet') || json,
326
+ noBrowser: hasFlag(args, '--no-browser'),
325
327
  clientId: getArgValue(args, '--client-id'),
326
328
  authProfile: getArgValue(args, '--profile'),
327
329
  userId: getArgValue(args, '--user-id'),
@@ -336,6 +336,7 @@ async function tokenLogin(options = {}) {
336
336
  port: options.port,
337
337
  quiet: options.quiet,
338
338
  noBrowser: options.noBrowser,
339
+ showAuthUrl: options.showAuthUrl,
339
340
  timeoutMs: options.timeoutMs,
340
341
  });
341
342
 
@@ -1201,7 +1201,7 @@ const COMMAND_GROUPS = [
1201
1201
  command('login-qwenwork', ['login-qwenwork'], 'login-qwenwork --exchange-ticket <ticket> --ticket-context <json> [--json]', 'help.cmd_login_qwenwork', { managedRun: { scope: 'denied', reason: 'identity_exchange' }, requiresLogin: false, output: 'json', hidden: true }),
1202
1202
  command('logout', ['logout'], 'logout', 'help.cmd_logout', { managedRun: { scope: 'denied', reason: 'scope_not_audited' }, requiresLogin: false }),
1203
1203
  command('auth', ['auth'], 'auth <status|login|refresh|logout|profiles|profile switch|qwenwork user-info> [--json]', 'help.cmd_auth', { managedRun: { scope: 'actions', actions: { status: { scope: 'local', allowedFlags: ['--json', '--quiet'] }, qwenwork: { scope: 'denied', reason: 'identity_exchange' } } }, requiresLogin: false }),
1204
- command('org', ['org'], 'org <list|switch> [--json] [--corp-id <corpId>]', 'help.cmd_org', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1204
+ command('org', ['org'], 'org <list|switch> [--json] [--corp-id <corpId>] [--no-browser]', 'help.cmd_org', { managedRun: { scope: 'denied', reason: 'scope_not_audited' } }),
1205
1205
  command('env', ['env'], 'env [--json|setup|list|show|switch|add|remove] [options]', 'help.cmd_env', { managedRun: { scope: 'local', allowedFlags: ['--json', '--quiet'] },
1206
1206
  requiresLogin: false,
1207
1207
  output: 'text|json',
@@ -527,7 +527,7 @@ Examples:
527
527
  login_unsupported_option: 'Removed legacy login option is no longer supported: {0}. Use token/OAuth login; env token mode reads only OPENYIDA_* tokens.',
528
528
  auth_usage: 'Usage: openyida auth <status|login|refresh|logout|profiles|profile switch|qwenwork user-info> [--json]',
529
529
  auth_example: 'Examples:\n openyida auth status # View login status\n openyida auth profiles # List existing login profiles\n openyida auth profile switch <auth_profile> # Switch current project to an existing profile\n openyida auth login # Add a profile when the target does not exist\n openyida auth refresh # Refresh login session\n openyida auth logout # Unbind current project auth\n openyida auth logout --profile <auth_profile> # Delete a shared profile explicitly',
530
- org_usage: 'Usage: openyida org <list|switch> [--json] [--corp-id <corpId>]',
530
+ org_usage: 'Usage: openyida org <list|switch> [--json] [--corp-id <corpId>] [--no-browser]',
531
531
  org_example: 'Examples:\n openyida org list --json # List accessible organizations\n openyida org switch --corp-id dingXXX # Switch existing profiles first; login to add one if missing',
532
532
  first_run_title: ' 🤖 OpenYida - AI Conversation Mode Activated! ',
533
533
  first_run_welcome: " {0}Welcome to OpenYida!{1} Here's a quick start guide:",
@@ -1183,7 +1183,7 @@ Examples:
1183
1183
  exec_failed: '\n❌ Execution failed: {0}',
1184
1184
  auth_usage: 'Usage: openyida auth <status|login|refresh|logout|profiles|profile switch|qwenwork user-info> [--json]',
1185
1185
  auth_example: 'Examples:\n openyida auth status # View login status\n openyida auth profiles # List existing login profiles\n openyida auth profile switch <auth_profile> # Switch current project to an existing profile\n openyida auth login # Add a profile when the target does not exist\n openyida auth refresh # Refresh login session\n openyida auth logout # Unbind current project auth\n openyida auth logout --profile <auth_profile> # Delete a shared profile explicitly',
1186
- org_usage: 'Usage: openyida org <list|switch> [--json] [--corp-id <corpId>]',
1186
+ org_usage: 'Usage: openyida org <list|switch> [--json] [--corp-id <corpId>] [--no-browser]',
1187
1187
  org_example: 'Examples:\n openyida org list --json # List accessible organizations\n openyida org switch --corp-id dingXXX # Switch existing profiles first; login to add one if missing',
1188
1188
  title: ' openyida import - Yida App Import Tool',
1189
1189
 
@@ -1155,7 +1155,7 @@ openyida - 宜搭命令行工具
1155
1155
  exec_failed: '\n❌ 执行失败: {0}',
1156
1156
  auth_usage: '用法: openyida auth <status|login|refresh|logout|profiles|profile switch|qwenwork user-info> [--json]',
1157
1157
  auth_example: '示例:\n openyida auth status # 查看登录状态\n openyida auth profiles # 列出已有登录 profile\n openyida auth profile switch <auth_profile> # 切换当前项目到已有 profile\n openyida auth login # 目标 profile 不存在时登录新增\n openyida auth refresh # 刷新登录态\n openyida auth logout # 解绑当前项目登录态\n openyida auth logout --profile <auth_profile> # 删除指定共享 profile',
1158
- org_usage: '用法: openyida org <list|switch> [--json] [--corp-id <corpId>]',
1158
+ org_usage: '用法: openyida org <list|switch> [--json] [--corp-id <corpId>] [--no-browser]',
1159
1159
  org_example: '示例:\n openyida org list --json # 列出可访问的组织\n openyida org switch --corp-id dingXXX # 优先切换已有 profile;不存在时登录新增',
1160
1160
  title: ' openyida import - 宜搭应用导入工具',
1161
1161
 
@@ -41,7 +41,6 @@ function resolvePermissionPage(location, baseUrl) {
41
41
  }
42
42
 
43
43
  function createPermissionError(response, options = {}) {
44
- if (options.tool !== 'qwenwork') { return null; }
45
44
  let payload = response;
46
45
  if (typeof payload === 'string') {
47
46
  try { payload = JSON.parse(payload); } catch { payload = {}; }
@@ -60,17 +59,18 @@ function createPermissionError(response, options = {}) {
60
59
  if (!failed) { return null; }
61
60
  let page = resolvePermissionPage(options.location || payload.__location, options.baseUrl);
62
61
  const legacyDenied = /^(?:TIANSHU_)?000006$/.test(code);
63
- if (!page && legacyDenied) {
64
- const normalized = normalizeMessage(message);
65
- if (normalized === '已升级宜搭你未在授权范围内因此无法使用如要使用请联系管理员授权') {
66
- page = resolvePermissionPage('/defaultPage.html?type=unauth', options.baseUrl);
67
- } else if (normalized === '管理员暂未为您分配权限请联系管理员授权'
68
- && /^\/query\/app\/registerApp(?:\.json)?(?:\?|$)/.test(options.requestPath || '')) {
69
- // 000006 被多个权限检查共用,只有已核实的创建接口及文案组合才可归类。
70
- page = resolvePermissionPage('/defaultPage.html?type=noAppCreationAuth', options.baseUrl);
71
- }
62
+ const normalized = normalizeMessage(message);
63
+ const creationDenied = /^\/query\/app\/registerApp(?:\.json)?(?:\?|$)/.test(options.requestPath || '')
64
+ && (legacyDenied || !code || code === '403')
65
+ && ['没有权限', '无权限', '暂无权限', '管理员暂未为您分配权限请联系管理员授权'].includes(normalized);
66
+ if (!page && creationDenied) {
67
+ page = resolvePermissionPage('/defaultPage.html?type=noAppCreationAuth', options.baseUrl);
68
+ }
69
+ if (!page && legacyDenied && normalized === '已升级宜搭你未在授权范围内因此无法使用如要使用请联系管理员授权') {
70
+ page = resolvePermissionPage('/defaultPage.html?type=unauth', options.baseUrl);
72
71
  }
73
72
  if (!page && !legacyDenied && httpStatus !== 403 && code !== '403' && status !== '403') { return null; }
73
+ if (!page && options.tool !== 'qwenwork') { return null; }
74
74
  const permissionType = page ? page.permissionType : 'unknown';
75
75
  const label = page ? t(`permission_guidance.${permissionType}_link`) : '';
76
76
  const details = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openyida",
3
- "version": "2026.11.2-1",
3
+ "version": "2026.11.2-2",
4
4
  "description": "OpenYida CLI - 宜搭低代码 AI 开发工具(安装即用,零配置)",
5
5
  "bin": {
6
6
  "openyida": "bin/yida.js",
@@ -18,7 +18,7 @@ Fast / Plan 已选主题是全应用决定,本步骤必须保存同一份应
18
18
 
19
19
  1. 已有 `appType`、应用 URL 或已绑定 app → 直接复用该 app。
20
20
  2. 缺少 app 且 Step 1 判定 `allowCreate=true` → 执行 `use_skill("yida-create-app", "按 PRD 创建应用并获取 appType")`,再按 PRD 创建应用。执行创建前按[创建应用时的提示](../../../references/user-facing-summary.md#创建应用时的提示)告知一次“当前在{组织名称}组织下为您创建{应用名称}应用”;名称取已确认的当前组织与应用,不附带登录或准备说明。
21
- 千问办公返回 `status=permission_required` 时,按 [权限处理](../../yida-create-app/SKILL.md#千问办公权限处理) 展示 CLI 指引并暂停后续步骤,等待用户处理并要求继续。
21
+ `status=permission_required` 时按 [权限处理](../../yida-create-app/SKILL.md#创建权限不足时的处理) 展示申请链接、保留已有结果并暂停,不自动换组织。
22
22
  3. 创建或复用后提取真实 `appType`,写入 `.cache/<项目名>-schema.json` 或当前任务资源上下文。
23
23
  - Step 2 已确认的 `requirement-brief.json`、PRD 与 design 保持不变;不得仅因拿到真实 `appType` 回写需求文件或重新生成 PRD 和视觉设计。
24
24
  4. 用户确认计划或主题且 `constraints.prohibitedActions` 不含 `theme-file` 时立即准备 CSS,不等表单或页面完成。创建完整应用时,Plan 复用 `materialize` 返回的 `outputs.theme`。其他场景用以下命令生成或更新主题:
@@ -164,11 +164,13 @@ CLI 校验主题文件完整声明平台实际生成的 `--color-brand1-1/2/3/5/
164
164
  - 自定义页面源码默认使用 `.canvas.jsx`,完成编写后发布。
165
165
  - 造测试数据或修旧数据时,可以用 Python 或 JS 编写 `.cache/` 下的一次性脚本;优先选择更快更清晰的方式,但字段 ID 和记录 ID 必须来自真实查询。
166
166
 
167
- ## 千问办公权限处理
167
+ ## 创建权限不足时的处理
168
168
 
169
169
  执行 `openyida create-app`,以 CLI 返回的权限结果和申请指引为准。
170
170
 
171
- 返回 `status=permission_required` 时,暂停后续搭建,展示 CLI 的错误说明和 `nextStep` 中的具名申请链接;未返回链接时保留原因。仅提供指引,等待用户处理并要求继续后再执行,不因权限不足重新登录或重复创建。
171
+ `status=permission_required` 时暂停,展示 `nextAction` / `details.permissionUrl` 或 `nextStep` 的具名申请链接;缺少链接不自行拼接。应用管理员不等于组织级创建者。
172
+
173
+ 保留已有文件,用户处理后要求继续时核对组织与权限。不重新登录、重复创建或枚举组织;用户选了其他组织才按 `yida-login` 切换,组织列表不证明创建权限。
172
174
 
173
175
  ## 异常处理
174
176
 
@@ -168,3 +168,9 @@ openyida auth qwenwork user-info --json
168
168
 
169
169
  - Login/auth snapshot 返回可用登录态;或
170
170
  - 运行环境注入 token 模式返回明确停止原因,交由宿主修复。
171
+
172
+ ## 用户明确要求切换组织
173
+
174
+ 用户选定目标后,千问办公与 env Token 由宿主切换;受管拒绝时停止。
175
+
176
+ 本地 OAuth 使用 `openyida org switch --corp-id <corpId> --json`;`--quiet` 仍向 stderr 输出 URL。加 `--no-browser` 由调用方按上方规则打开;工具不可用时给出链接并保持原进程运行。最终 `ok=true`、`can_auto_use=true` 且 `corp_id` 匹配才续做。