draftgo-cli 3.0.56 → 4.0.22

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.
Files changed (96) hide show
  1. package/README.md +169 -297
  2. package/package.json +12 -7
  3. package/resources/custom-service-sdk/ai.go +520 -0
  4. package/resources/custom-service-sdk/ai_test.go +156 -0
  5. package/resources/custom-service-sdk/billing.go +596 -0
  6. package/resources/custom-service-sdk/billing_test.go +150 -0
  7. package/resources/custom-service-sdk/go.mod +3 -0
  8. package/resources/custom-service-sdk/manifest.json +72 -0
  9. package/resources/custom-service-sdk/platform.go +360 -0
  10. package/resources/custom-service-sdk/platform_logger_test.go +24 -0
  11. package/resources/custom-service-sdk/registration_test.go +39 -0
  12. package/resources/custom-service-sdk/resources.go +246 -0
  13. package/resources/custom-service-sdk/resources_billing_test.go +115 -0
  14. package/resources/custom-service-sdk/resources_files_test.go +57 -0
  15. package/resources/custom-service-sdk/resources_scope_test.go +87 -0
  16. package/resources/custom-service-sdk/sdk.go +208 -0
  17. package/resources/skill/SKILL.md +36 -87
  18. package/resources/skill/init/SKILL.md +9 -14
  19. package/resources/skill/manifest.json +6 -2
  20. package/resources/skill/references/aihub.md +28 -5
  21. package/resources/skill/references/app-api.md +56 -6
  22. package/resources/skill/references/architecture.md +2 -2
  23. package/resources/skill/references/chat-sdk.md +4 -2
  24. package/resources/skill/references/checkout.md +21 -7
  25. package/resources/skill/references/custom-services.md +124 -222
  26. package/resources/skill/references/data.md +22 -6
  27. package/resources/skill/references/delivery.md +33 -0
  28. package/resources/skill/references/diagnostics.md +51 -0
  29. package/resources/skill/references/frontend.md +93 -499
  30. package/resources/skill/references/mcp.md +65 -101
  31. package/resources/skill/references/methods.md +189 -0
  32. package/resources/skill/references/modules.md +36 -8
  33. package/resources/skill/references/runtime.md +26 -3
  34. package/resources/skill/story/SKILL.md +1 -2
  35. package/src/apiContractCache.js +112 -0
  36. package/src/cli.js +24 -20
  37. package/src/commandRegistry.js +15 -12
  38. package/src/commands/api.js +41 -10
  39. package/src/commands/apiKey.js +34 -0
  40. package/src/commands/capabilities.js +93 -0
  41. package/src/commands/check.js +1 -10
  42. package/src/commands/checkout.js +1 -1
  43. package/src/commands/commit.js +1 -1
  44. package/src/commands/components.js +550 -0
  45. package/src/commands/conflict.js +1 -1
  46. package/src/commands/connect.js +18 -8
  47. package/src/commands/customService.js +22 -8
  48. package/src/commands/dataRange.js +33 -0
  49. package/src/commands/delete.js +34 -46
  50. package/src/commands/deploy.js +1 -1
  51. package/src/commands/diff.js +18 -2
  52. package/src/commands/grant.js +29 -0
  53. package/src/commands/group.js +38 -0
  54. package/src/commands/help.js +80 -51
  55. package/src/commands/init.js +6 -12
  56. package/src/commands/listTargets.js +1 -1
  57. package/src/commands/local.js +2 -6
  58. package/src/commands/map.js +145 -28
  59. package/src/commands/mcp.js +2 -2
  60. package/src/commands/reconcile.js +1 -1
  61. package/src/commands/role.js +32 -0
  62. package/src/commands/space.js +41 -0
  63. package/src/commands/status.js +111 -8
  64. package/src/commands/uninstall.js +3 -3
  65. package/src/commands/update.js +24 -12
  66. package/src/commands/verify.js +118 -21
  67. package/src/commands/{verifyUi.js → visualVerify.js} +28 -116
  68. package/src/commands/worklog.js +90 -0
  69. package/src/consoleEncoding.js +34 -0
  70. package/src/contractCompatibility.js +57 -0
  71. package/src/customServices.js +278 -41
  72. package/src/diffReport.js +106 -0
  73. package/src/index.js +2 -0
  74. package/src/{localdev → localRuntime}/compose.js +14 -17
  75. package/src/{localdev → localRuntime}/detect.js +1 -1
  76. package/src/{localdev → localRuntime}/index.js +22 -23
  77. package/src/{localdev → localRuntime}/mysqlClient.js +1 -1
  78. package/src/{localdev → localRuntime}/services.js +28 -37
  79. package/src/mcp/client.js +11 -2
  80. package/src/mcp/protocol.js +2 -2
  81. package/src/mcp/tools.js +14 -1
  82. package/src/platforms.js +9 -0
  83. package/src/projectConfig.js +8 -4
  84. package/src/releaseInstall.js +105 -0
  85. package/src/{installers/index.js → targets.js} +3 -5
  86. package/src/updateCheck.js +48 -28
  87. package/src/worklog.js +275 -0
  88. package/src/workspaceHealth.js +1 -1
  89. package/src/worktree/backend.js +1 -1
  90. package/src/worktree/index.js +86 -51
  91. package/src/changelog.js +0 -276
  92. package/src/commands/changelog.js +0 -24
  93. package/src/commands/localDev.js +0 -9
  94. package/src/commands/sync.js +0 -46
  95. package/src/commands/task.js +0 -408
  96. package/src/commands/verifyUiCompat.js +0 -16
@@ -0,0 +1,51 @@
1
+ ---
2
+ read_when: 运行失败、MCP/API 调用异常、远端状态不一致或需要查询运行日志时
3
+ ---
4
+
5
+ # 运行诊断
6
+
7
+ ## 最短诊断链
8
+
9
+ ```bash
10
+ draftgo status --output json
11
+ draftgo mcp status
12
+ draftgo mcp test
13
+ draftgo map --type pages --summary --output json
14
+ draftgo check --remote --output json
15
+ ```
16
+
17
+ `draftgo status` 的 `connection.health` 报告 `healthy`、`unhealthy` 或 `not_configured`,并输出当前 `platform`/`space` TokenScope;space 上下文同时带 `workspace_id` 与 `space_id`。只执行与故障层级有关的命令:连接失败看 `mcp test`;已知页面可用 `map --type pages --route <path>` 或 `--title <title>` 精确检查,未知资源先看 `map --summary`;checkout、哈希或版本异常看 `check --remote`。需要浏览时用 `--limit <1-100>`(默认 20)和单一类型的 `--cursor`,不运行默认全量 map。命令失败仍保留其非零退出码和脱敏输出。
18
+
19
+ API 运行失败时,用原 operation 生成结构化诊断:
20
+
21
+ ```bash
22
+ draftgo api describe <operation_id>
23
+ draftgo api call <operation_id> --input request.json --output json
24
+ draftgo api search "AI run logs"
25
+ ```
26
+
27
+ 记录 `operation_id`、`status_code`、`server_code`、`request_id`,再通过实时日志 operation 查询对应 run。AI 调用按入口 Agent/模型和 request ID 定位;子 Agent 链路从 span 查,不把一次入口请求误算成多条主 run。自定义服务再按 `custom-services.md` 执行 validate/test,页面运行时再读 `runtime.md`。
28
+
29
+ ## 权限与范围诊断
30
+
31
+ | 结果 | 最短定位 |
32
+ |---|---|
33
+ | 400 | 重新 `draftgo api describe <operation_id>`,核对当前 registry revision、`path/query/body/multipart` 容器、必填字段和 `scope_type/space_id` 组合。不要靠修改字段名试探契约。 |
34
+ | 401 | 运行 `draftgo status`;检查项目是否连接、当前用户 API Key 是否缺失、过期或已撤销。重新连接或轮换后再试一次,不把密钥放进输入、宿主配置或日志。 |
35
+ | 403 | 从结构化错误读取 `error_code`、`permission` 和 `scope_type`;核对 operation 所需 permission、API Key TokenScope、持久化 ResourceOwnership、有效 AccessGrant 和 DataRange。管理员身份与工作区成员关系都不是授权来源。 |
36
+ | space 跨根拒绝 | 这是预期边界。确认目标资源保存的 workspace root 与 Grant 所属 root;改用同根 self/subtree Grant 或合法迁移流程。只有实时契约支持且明确需要跨空间管理时,才检查显式 permission 的 platform Grant。不要篡改 workspace/space ID 或 header 重试。 |
37
+
38
+ 解释 Grant 来源时先用实时契约,不从角色名或 UI 状态推测:
39
+
40
+ ```bash
41
+ draftgo grant list --input request.json
42
+ draftgo api search "access grant explain"
43
+ draftgo api describe <explain_operation_id>
44
+ draftgo api call <explain_operation_id> --input request.json --output json
45
+ ```
46
+
47
+ 按解释结果核对直接用户 Grant 与用户组 Grant 的并集、Role 中的精确 permission、space 的 self/subtree 覆盖、Grant/Role/成员/组的启用状态和有效期,以及最终 `matched_grant_ids` / DataRange。没有匹配来源时保持拒绝,不临时授予更大的 platform 权限来验证。
48
+
49
+ 不要在 issue、工作日志、命令参数或诊断文件中写 API Key、服务凭据、Authorization、完整请求头或上游服务地址。非幂等写入失败后先回读状态,不自动重试。
50
+
51
+ 完成条件:故障已定位到连接、契约、权限、资源版本、Runner 或业务运行中的一层,并保留可关联的 request ID/run 证据;无法定位时明确缺少哪项服务端证据。