@lark-apaas/coding-miaoda-sandbox-skills 0.1.0-dev.28c4f05 → 0.1.0-dev.4e64c13

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 (140) hide show
  1. package/miaoda/animation-skill/SKILL.md +348 -0
  2. package/miaoda/authz-cli/SKILL.md +1 -0
  3. package/miaoda/charts-skill/SKILL.md +264 -0
  4. package/miaoda/creative-to-fullstack/SKILL.md +157 -0
  5. package/miaoda/creative-to-fullstack/references/artifact-signals.md +46 -0
  6. package/miaoda/creative-to-fullstack/references/ui-to-function.md +134 -0
  7. package/miaoda/data-analysis/SKILL.md +151 -0
  8. package/miaoda/data-analysis/references/json-output-specification.md +277 -0
  9. package/miaoda/data-analysis/references/post-analysis-guide.md +77 -0
  10. package/miaoda/data-analysis/references/python-analysis-reference.md +272 -0
  11. package/miaoda/data-analysis/references/tmp-file-management-guide.md +100 -0
  12. package/miaoda/debug-investigation/SKILL.md +21 -18
  13. package/miaoda/extract-json-schema/SKILL.md +147 -0
  14. package/miaoda/lark-apps/SKILL.md +37 -0
  15. package/miaoda/lark-apps/references/openapi-key.md +80 -0
  16. package/miaoda/lark-apps-authz/SKILL.md +292 -0
  17. package/miaoda/lark-apps-authz/references/permission-points.md +39 -0
  18. package/miaoda/lark-apps-authz/references/role.md +122 -0
  19. package/miaoda/lark-apps-db/SKILL.md +226 -0
  20. package/miaoda/lark-apps-db/references/full-reference.md +302 -0
  21. package/miaoda/lark-apps-file/SKILL.md +216 -0
  22. package/miaoda/lark-apps-ops/SKILL.md +62 -0
  23. package/miaoda/lark-apps-ops/references/lark-apps-access-scope-get.md +30 -0
  24. package/miaoda/lark-apps-ops/references/lark-apps-access-scope-set.md +40 -0
  25. package/miaoda/lark-apps-ops/references/lark-apps-cache.md +62 -0
  26. package/miaoda/lark-apps-ops/references/lark-apps-env.md +46 -0
  27. package/miaoda/lark-apps-ops/references/lark-apps-local-dev.md +25 -0
  28. package/miaoda/lark-apps-ops/references/lark-apps-member.md +93 -0
  29. package/miaoda/lark-apps-ops/references/lark-apps-observability.md +46 -0
  30. package/miaoda/lark-apps-ops/references/lark-apps-plugin-install.md +36 -0
  31. package/miaoda/lark-apps-ops/references/lark-apps-plugin-list.md +23 -0
  32. package/miaoda/lark-apps-ops/references/lark-apps-plugin-uninstall.md +25 -0
  33. package/miaoda/lark-apps-ops/references/lark-apps-release-create.md +30 -0
  34. package/miaoda/lark-apps-ops/references/lark-apps-release-get.md +28 -0
  35. package/miaoda/lark-apps-ops/references/lark-apps-release-list.md +31 -0
  36. package/miaoda/lark-apps-ops/references/lark-apps-update.md +30 -0
  37. package/miaoda/lark-apps-ops/references/openapi-key.md +80 -0
  38. package/miaoda/miaoda-file/SKILL.md +1 -0
  39. package/miaoda/miaoda-sql/SKILL.md +6 -2
  40. package/miaoda/performance-review/SKILL.md +144 -0
  41. package/miaoda/performance-review/references/business-analyzer.md +139 -0
  42. package/miaoda/performance-review/references/examples.md +107 -0
  43. package/miaoda/reviewer-usage/SKILL.md +111 -0
  44. package/miaoda/testing-guide/SKILL.md +218 -0
  45. package/miaoda-design/lark-apps-comment/SKILL.md +110 -0
  46. package/miaoda-design/lark-apps-ops/SKILL.md +45 -0
  47. package/miaoda-design/lark-apps-ops/references/lark-apps-release-create.md +51 -0
  48. package/miaoda-design/lark-apps-ops/references/lark-apps-release-get.md +28 -0
  49. package/miaoda-design/lark-apps-ops/references/lark-apps-release-list.md +31 -0
  50. package/miaoda-design/lark-apps-ops/references/lark-apps-update.md +33 -0
  51. package/{shared → miaoda-modern}/lark-apps/SKILL.md +5 -5
  52. package/miaoda-modern/lark-apps/references/openapi-key.md +80 -0
  53. package/miaoda-modern/lark-apps-ops/SKILL.md +62 -0
  54. package/miaoda-modern/lark-apps-ops/references/lark-apps-access-scope-get.md +30 -0
  55. package/miaoda-modern/lark-apps-ops/references/lark-apps-access-scope-set.md +40 -0
  56. package/miaoda-modern/lark-apps-ops/references/lark-apps-cache.md +62 -0
  57. package/miaoda-modern/lark-apps-ops/references/lark-apps-env.md +46 -0
  58. package/miaoda-modern/lark-apps-ops/references/lark-apps-local-dev.md +25 -0
  59. package/miaoda-modern/lark-apps-ops/references/lark-apps-member.md +93 -0
  60. package/miaoda-modern/lark-apps-ops/references/lark-apps-observability.md +46 -0
  61. package/miaoda-modern/lark-apps-ops/references/lark-apps-plugin-install.md +36 -0
  62. package/miaoda-modern/lark-apps-ops/references/lark-apps-plugin-list.md +23 -0
  63. package/miaoda-modern/lark-apps-ops/references/lark-apps-plugin-uninstall.md +25 -0
  64. package/miaoda-modern/lark-apps-ops/references/lark-apps-release-create.md +30 -0
  65. package/miaoda-modern/lark-apps-ops/references/lark-apps-release-get.md +28 -0
  66. package/miaoda-modern/lark-apps-ops/references/lark-apps-release-list.md +31 -0
  67. package/miaoda-modern/lark-apps-ops/references/lark-apps-update.md +30 -0
  68. package/{shared/lark-apps → miaoda-modern/lark-apps-ops}/references/openapi-key.md +3 -3
  69. package/miaoda-modern/memory/SKILL.md +86 -0
  70. package/package.json +1 -1
  71. package/shared/lark-cli/SKILL.md +221 -0
  72. package/shared/lark-cli/lark-base/README.md +56 -0
  73. package/shared/lark-cli/lark-base/references/lark-base-commands.md +108 -0
  74. package/shared/lark-cli/lark-calendar/README.md +158 -0
  75. package/shared/lark-cli/lark-calendar/references/lark-calendar-meeting.md +30 -0
  76. package/shared/lark-cli/lark-calendar/references/lark-calendar-room-find.md +108 -0
  77. package/shared/lark-cli/lark-calendar/references/lark-calendar-suggestion.md +120 -0
  78. package/shared/lark-cli/lark-contact/README.md +35 -0
  79. package/shared/lark-cli/lark-contact/references/lark-contact-get-user.md +13 -0
  80. package/shared/lark-cli/lark-contact/references/lark-contact-search-user.md +121 -0
  81. package/shared/lark-cli/lark-doc/README.md +67 -0
  82. package/shared/lark-cli/lark-doc/references/lark-doc-fetch.md +138 -0
  83. package/shared/lark-cli/lark-doc/references/lark-doc-history.md +61 -0
  84. package/shared/lark-cli/lark-drive/README.md +129 -0
  85. package/shared/lark-cli/lark-drive/references/lark-drive-files-list.md +183 -0
  86. package/shared/lark-cli/lark-im/README.md +84 -0
  87. package/shared/lark-cli/lark-im/references/lark-im-chat-list.md +140 -0
  88. package/shared/lark-cli/lark-im/references/lark-im-chat-members-list.md +84 -0
  89. package/shared/lark-cli/lark-im/references/lark-im-chat-search.md +135 -0
  90. package/shared/lark-cli/lark-im/references/lark-im-reactions.md +232 -0
  91. package/shared/lark-cli/lark-minutes/README.md +51 -0
  92. package/shared/lark-cli/lark-minutes/references/lark-minutes-download.md +130 -0
  93. package/shared/lark-cli/lark-sheets/README.md +173 -0
  94. package/shared/lark-cli/lark-sheets/references/lark-sheets-changeset.md +105 -0
  95. package/shared/lark-cli/lark-sheets/references/lark-sheets-chart.md +45 -0
  96. package/shared/lark-cli/lark-sheets/references/lark-sheets-conditional-format.md +42 -0
  97. package/shared/lark-cli/lark-sheets/references/lark-sheets-filter-view.md +49 -0
  98. package/shared/lark-cli/lark-sheets/references/lark-sheets-filter.md +42 -0
  99. package/shared/lark-cli/lark-sheets/references/lark-sheets-float-image.md +43 -0
  100. package/shared/lark-cli/lark-sheets/references/lark-sheets-formula-verify.md +64 -0
  101. package/shared/lark-cli/lark-sheets/references/lark-sheets-history.md +70 -0
  102. package/shared/lark-cli/lark-sheets/references/lark-sheets-pivot-table.md +44 -0
  103. package/shared/lark-cli/lark-sheets/references/lark-sheets-read-data.md +216 -0
  104. package/shared/lark-cli/lark-sheets/references/lark-sheets-search-replace.md +67 -0
  105. package/shared/lark-cli/lark-sheets/references/lark-sheets-sheet-structure.md +52 -0
  106. package/shared/lark-cli/lark-sheets/references/lark-sheets-sparkline.md +47 -0
  107. package/shared/lark-cli/lark-sheets/references/lark-sheets-workbook.md +69 -0
  108. package/shared/lark-cli/lark-sheets/scripts/sheets_df.py +32 -0
  109. package/shared/lark-cli/lark-slides/README.md +86 -0
  110. package/shared/lark-cli/lark-slides/references/lark-slides-history.md +105 -0
  111. package/shared/lark-cli/lark-slides/references/lark-slides-xml-presentation-slide-get.md +108 -0
  112. package/shared/lark-cli/lark-slides/references/lark-slides-xml-presentations-get.md +77 -0
  113. package/shared/lark-cli/lark-task/README.md +93 -0
  114. package/shared/lark-cli/lark-task/references/lark-task-get-my-tasks.md +57 -0
  115. package/shared/lark-cli/lark-task/references/lark-task-get-related-tasks.md +49 -0
  116. package/shared/lark-cli/lark-task/references/lark-task-search.md +36 -0
  117. package/shared/lark-cli/lark-task/references/lark-task-tasklist-search.md +35 -0
  118. package/shared/lark-cli/lark-vc/README.md +40 -0
  119. package/shared/lark-cli/lark-vc/references/lark-vc-recording.md +31 -0
  120. package/shared/lark-cli/lark-whiteboard/README.md +35 -0
  121. package/shared/lark-cli/lark-whiteboard/references/lark-whiteboard-export.md +59 -0
  122. package/shared/lark-cli/lark-wiki/README.md +50 -0
  123. package/shared/lark-cli/lark-wiki/references/lark-wiki-node-get.md +59 -0
  124. package/shared/lark-cli/lark-wiki/references/lark-wiki-node-list.md +95 -0
  125. package/shared/lark-cli/lark-wiki/references/lark-wiki-space-list.md +68 -0
  126. package/miaoda-design/attachment/SKILL.md +0 -58
  127. /package/{shared → miaoda}/memory/SKILL.md +0 -0
  128. /package/{shared → miaoda-modern}/animation-skill/SKILL.md +0 -0
  129. /package/{shared → miaoda-modern}/charts-skill/SKILL.md +0 -0
  130. /package/{shared → miaoda-modern}/data-analysis/SKILL.md +0 -0
  131. /package/{shared → miaoda-modern}/data-analysis/references/json-output-specification.md +0 -0
  132. /package/{shared → miaoda-modern}/data-analysis/references/post-analysis-guide.md +0 -0
  133. /package/{shared → miaoda-modern}/data-analysis/references/python-analysis-reference.md +0 -0
  134. /package/{shared → miaoda-modern}/data-analysis/references/tmp-file-management-guide.md +0 -0
  135. /package/{shared → miaoda-modern}/extract-json-schema/SKILL.md +0 -0
  136. /package/{shared → miaoda-modern}/performance-review/SKILL.md +0 -0
  137. /package/{shared → miaoda-modern}/performance-review/references/business-analyzer.md +0 -0
  138. /package/{shared → miaoda-modern}/performance-review/references/examples.md +0 -0
  139. /package/{shared → miaoda-modern}/reviewer-usage/SKILL.md +0 -0
  140. /package/{shared → miaoda-modern}/testing-guide/SKILL.md +0 -0
@@ -0,0 +1,100 @@
1
+ # Temporary File Management
2
+
3
+ All temporary code and intermediate artifacts generated during analysis should be written to the project's `tmp/` directory.
4
+
5
+ ## Directory Structure
6
+
7
+ ```text
8
+ <project_root>/
9
+ ├── tmp/ # Analysis temp directory
10
+ │ ├── analysis_scripts/ # Temporary analysis scripts
11
+ │ │ └── sales_2023_analysis.py
12
+ │ ├── intermediate/ # Intermediate artifacts
13
+ │ │ ├── sales_2023_cleaned.csv
14
+ │ │ └── sales_2023_correlation.csv
15
+ │ └── output/ # Final analysis output
16
+ │ ├── sales_2023_analysis.json
17
+ │ └── visualizations/
18
+ │ ├── sales_2023_age_vs_amount.png
19
+ │ └── sales_2023_amount_distribution.png
20
+ ```
21
+
22
+ ## Semantic File Naming
23
+
24
+ | Pattern | Example | Description |
25
+ | ------- | ------- | ----------- |
26
+ | `{dataset}_{purpose}.py` | `sales_2023_analysis.py` | Analysis script |
27
+ | `{dataset}_{stage}.csv` | `sales_2023_cleaned.csv` | Intermediate data |
28
+ | `{dataset}_{analysis_type}.json` | `sales_2023_exploratory.json` | Analysis result |
29
+ | `{dataset}_{chart_desc}.png` | `sales_2023_age_vs_amount.png` | Visualization |
30
+
31
+ **Best practices**:
32
+ - Derive base name from source file: `sales_2023.csv` → `sales_2023_*`
33
+ - Include analysis focus: `sales_2023_correlation.json`, `sales_2023_outliers.json`
34
+ - Use snake_case for consistency
35
+ - Avoid UUIDs or timestamps in primary filenames (use for deduplication only if needed)
36
+
37
+ ## Usage Guidelines
38
+
39
+ 1. **Create directories on first use**:
40
+ ```python
41
+ from pathlib import Path
42
+
43
+ project_root = Path.cwd()
44
+ tmp_dir = project_root / "tmp"
45
+
46
+ (tmp_dir / "analysis_scripts").mkdir(parents=True, exist_ok=True)
47
+ (tmp_dir / "intermediate").mkdir(parents=True, exist_ok=True)
48
+ (tmp_dir / "output" / "visualizations").mkdir(parents=True, exist_ok=True)
49
+ ```
50
+
51
+ 2. **Script naming**: Use semantic names based on dataset and purpose
52
+ ```python
53
+ source_file = "sales_2023.csv"
54
+ base_name = Path(source_file).stem # "sales_2023"
55
+ script_path = tmp_dir / "analysis_scripts" / f"{base_name}_analysis.py"
56
+ ```
57
+
58
+ 3. **Intermediate artifacts**: Write cleaned data, transformed results to `tmp/intermediate/`
59
+
60
+ 4. **Final output**: Write JSON results and visualizations to `tmp/output/`
61
+
62
+ 5. **gitignore**: Ensure `tmp/` is added to `.gitignore`
63
+
64
+ ## Why Use Project tmp/ Directory
65
+
66
+ | Benefit | Description |
67
+ | ------- | ----------- |
68
+ | Traceable | Artifacts are associated with the project for easy review |
69
+ | Reproducible | Intermediate scripts are retained for re-execution and verification |
70
+ | Isolated | Does not pollute system temp directories |
71
+ | Easy cleanup | Delete `tmp/` to remove all analysis artifacts at once |
72
+
73
+ ## Copying Output to shared/static/
74
+
75
+ When the analysis JSON needs to be consumed by application code, copy it from `tmp/output/` to `shared/static/`:
76
+
77
+ ```python
78
+ import shutil
79
+ from pathlib import Path
80
+
81
+ def export_to_shared(analysis_file: Path, dest_dir: Path = None, filename: str = None):
82
+ """Copy analysis result JSON to shared/static/ for downstream code consumption."""
83
+ if dest_dir is None:
84
+ dest_dir = Path("shared/static")
85
+ dest_dir.mkdir(parents=True, exist_ok=True)
86
+ dest_file = dest_dir / (filename or analysis_file.name)
87
+ shutil.copy2(analysis_file, dest_file)
88
+ print(f"Exported to: {dest_file}")
89
+ return dest_file
90
+
91
+ # Example:
92
+ # export_to_shared(Path("tmp/output/sales_2023_exploratory.json"))
93
+ # → shared/static/sales_2023_exploratory.json
94
+ # Import in code: import analysisData from '@shared/static/sales_2023_exploratory.json'
95
+ ```
96
+
97
+ **Best practices**:
98
+ - Only copy finalized, validated results to `shared/static/`
99
+ - Keep `tmp/` for iterative work; export to `shared/` only when analysis is complete
100
+ - Use descriptive filenames (e.g., `sales_q4_analysis.json` not `analysis_a1b2c3d4.json`)
@@ -20,8 +20,8 @@ Reviewer 的工具白名单已物理强制此规则:你无 Edit/Write 权限
20
20
  2. 日志证据(按环境选链路,两条链路日志互不相通):
21
21
  - **沙箱 dev 态** → ReadLogs browser / server-devserver / client-devserver /
22
22
  server,找对应错误栈、请求 / 响应、console error
23
- - **线上(已发布)** → 见下方「Phase 1 子步骤:线上异常取证」,用
24
- `miaoda observability` 拉线上日志。ReadLogs 读不到线上日志——
23
+ - **线上(已发布)** → 见下方「Phase 1 子步骤:线上异常取证」,按当前沙箱
24
+ 的线上观测手册拉线上日志。ReadLogs 读不到线上日志——
25
25
  不要拿沙箱日志当线上症状的证据
26
26
  3. 近期改动:`git log --oneline -20 <suspected_file>`,必要时看 `git show <sha>`
27
27
  4. 数据流反向追溯(见下方 5 步流程)
@@ -34,26 +34,29 @@ Reviewer 的工具白名单已物理强制此规则:你无 Edit/Write 权限
34
34
  证据,禁止只凭静态代码阅读下结论。所有取证在 Phase 1 内完成(Reviewer 的
35
35
  Phase 3 禁止工具调用规则不变)。
36
36
 
37
- 1. **加载命令手册**:Glob 定位 `**/miaoda-cli/references/observability.md`
38
- 并用 Read 加载——完整 flag / 默认值以该文档为准,不要凭记忆拼命令。
39
- 找不到该文件 → 当前栈不支持线上日志查询,在报告里注明
37
+ 1. **加载命令手册**:Glob 定位当前沙箱的线上观测手册,依次试
38
+ `**/lark-apps-ops/references/lark-apps-observability.md` 和
39
+ `**/miaoda-cli/references/observability.md`,命中哪份就用 Read 加载哪份。
40
+ 完整命令 / flag / 默认值一律以该文档为准,不要凭记忆拼命令。
41
+ 两份都找不到 → 当前栈不支持线上日志查询,在报告里注明
40
42
  「线上日志不可用」,回退沙箱日志 + 静态分析,不阻塞调查
41
- 2. **错误日志**:`miaoda observability log --since <时间窗> --level ERROR`,
42
- 时间窗按 caller 描述的发生时间收敛(如 `--since 1h`);有关键词时加
43
- `--grep "<keyword>"`,接口类症状加 `--api <path>`
44
- 3. **链路追溯**:从日志取 `trace_id` → `miaoda observability trace get <traceID>`
45
- 看完整调用链,定位慢点 / 失败环节
46
- 4. **前端报错反解源码**:日志含前端错误时,
47
- `miaoda observability source-stack --log-id <id>`(或 `--trace-id <id>`)
48
- 反解出 `file:line`,作为证据链入口
43
+ 2. **错误日志**:按手册的日志检索条目拉 ERROR 级日志,时间窗按 caller 描述
44
+ 的发生时间收敛(如最近 1 小时);有关键词或具体接口时,按手册支持的方式收窄
45
+ 3. **链路追溯**:从日志取 `trace_id`,按手册的 trace 检索条目看完整调用链,
46
+ 定位慢点 / 失败环节
47
+ 4. **前端报错反解源码**:日志含前端错误时,按手册的前端源码反解条目拿到
48
+ `file:line` 作为证据链入口。**手册没有这条能力就跳过并在报告里注明**——
49
+ 部分通道没有独立的源码反解命令,源码位置只可能作为日志详情的附带字段出现,
50
+ 不要臆造命令名或 flag
49
51
  5. **证据链标注来源**:报告中每条日志证据必须标注来源
50
- (`线上 observability` / `沙箱 ReadLogs`)+ 日志时间戳,
51
- 线上症状必须有至少一条线上日志证据支撑。两个例外都不阻塞调查,
52
+ (`线上观测` / `沙箱 ReadLogs`)+ 日志时间戳,
53
+ 线上症状必须有至少一条线上日志证据支撑。三个例外都不阻塞调查,
52
54
  在报告里注明即可:① 第 1 步已注明「线上日志不可用」;
53
- ② 查询成功但结果为空(注明查询命令与时间窗,回到静态分析)
55
+ ② 第 4 步手册未提供源码反解能力;
56
+ ③ 查询成功但结果为空(注明查询条件与时间窗,回到静态分析)
54
57
 
55
- > `miaoda observability` 全部为只读查询。不要使用 `miaoda deploy` /
56
- > `miaoda app update` 等有副作用的命令——那不是 Reviewer 的职责。
58
+ > 线上观测类查询全部为只读。不要使用触发发布 / 修改应用元数据等有副作用的
59
+ > 命令——那不是 Reviewer 的职责。
57
60
 
58
61
  ## Phase 1 子步骤:5 步反向追溯
59
62
 
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: extract-json-schema
3
+ description: "Extract concise JSON schema with semantic field descriptions from JSON data. Use when: (1) analyzing JSON structure for documentation, (2) generating schema for API/data contracts, (3) creating field-level documentation for programmatic use, (4) understanding complex nested JSON data. Keywords: JSON schema, 提取schema, 字段说明, field description, data structure, 数据结构分析"
4
+ ---
5
+
6
+ # Extract JSON Schema
7
+
8
+ 从 JSON 数据中提取精简的 schema 信息,包含语义化的字段解释,便于程序化处理和集成。
9
+
10
+ ---
11
+
12
+ ## Schema 输出规范
13
+
14
+ 输出必须符合 `extracted-json-schema/v1` 格式:
15
+
16
+ ```json
17
+ {
18
+ "$schema": "extracted-json-schema/v1",
19
+ "title": "数据集名称",
20
+ "description": "数据集整体描述",
21
+ "source": "数据来源(可选)",
22
+ "extracted_at": "ISO 8601 时间",
23
+ "root_type": "object | array",
24
+ "fields": [
25
+ {
26
+ "path": "字段路径(如 order.items[].price)",
27
+ "type": "string | number | boolean | object | array | null | mixed",
28
+ "element_type": "数组元素类型(仅 array 需要)",
29
+ "nullable": false,
30
+ "description": "语义化中文描述(核心字段)",
31
+ "example": "示例值",
32
+ "enum": ["枚举值(如有)"],
33
+ "format": "date | datetime | currency | percentage | url | email | uuid 等",
34
+ "unit": "元 | % | 天 等",
35
+ "children": ["子字段路径列表(仅 object/array)"]
36
+ }
37
+ ],
38
+ "statistics": {
39
+ "total_fields": 0, "max_depth": 0, "object_count": 0, "array_count": 0
40
+ }
41
+ }
42
+ ```
43
+
44
+ ### 类型与格式速查
45
+
46
+ | JSON 值 | type | 常见 format | unit |
47
+ |---------|------|------------|------|
48
+ | `"text"` | `string` | date, datetime, period, email, url, uuid | — |
49
+ | `123` / `1.5` | `number` | currency, percentage, ratio | 元, %, 天 |
50
+ | `true` | `boolean` | — | — |
51
+ | `{}` | `object` | — | — |
52
+ | `[]` | `array` | — | — |
53
+ | `null` | `null` | — | — |
54
+ | 混合类型 | `mixed` | — | — |
55
+
56
+ ---
57
+
58
+ ## 语义化描述规范
59
+
60
+ 描述是 schema 的核心价值。每个字段的 description 必须说明**业务含义**,而非重复字段名。
61
+
62
+ | 字段类型 | 描述模板 | 差的描述 ❌ | 好的描述 ✅ |
63
+ |----------|----------|-----------|-----------|
64
+ | 标识字段 | [实体]的[唯一标识] | "标题" | "财务报告的标题,标识报告类型和时间范围" |
65
+ | 数值字段 | [指标名称],单位为[单位] | "数量" | "该产品线的营收金额,单位为元" |
66
+ | 百分比字段 | [指标]的百分比/增长率 | "百分比" | "该产品线营收占总营收的百分比" |
67
+ | 日期字段 | [事件]的[日期/时间] | "时间" | "订单创建的时间戳,UTC 格式" |
68
+ | 状态字段 | [实体]的[状态],可选值包括... | "状态" | "订单状态,可选值:paid, pending, cancelled" |
69
+
70
+ 描述编写原则:结合数据集上下文理解字段含义 → 参考同级字段关联性 → 使用业务语言而非技术术语。
71
+
72
+ ---
73
+
74
+ ## 提取流程
75
+
76
+ ```
77
+ 1. 确认输入 JSON(用户提供或从文件读取)
78
+ ↓
79
+ 2. 识别根类型(object/array),递归遍历所有字段
80
+ ↓
81
+ 3. 推断 type、format、unit(优先根据字段名,结合值验证)
82
+ ↓
83
+ 4. 生成语义化 description(核心步骤,参考上方规范)
84
+ ↓
85
+ 5. 构建扁平化 fields 列表 + 计算 statistics
86
+ ↓
87
+ 6. 输出 Schema JSON,保存到 tmp/output/<source>_schema.json
88
+ ```
89
+
90
+ ### 类型推断规则
91
+
92
+ - 数组元素类型以第一个元素为准
93
+ - 遇到 `null` 值时标记 `nullable: true`
94
+ - 同一字段存在多种类型时标记为 `mixed`
95
+ - format 不确定时不标注
96
+
97
+ ---
98
+
99
+ ## 示例
100
+
101
+ **输入**:
102
+ ```json
103
+ {"order_id": "ORD-001", "total_amount": 598.00, "items": [{"name": "无线耳机", "price": 299.00}]}
104
+ ```
105
+
106
+ **输出(关键字段)**:
107
+ ```json
108
+ {
109
+ "$schema": "extracted-json-schema/v1",
110
+ "title": "电商订单",
111
+ "fields": [
112
+ {"path": "order_id", "type": "string", "nullable": false, "description": "订单的唯一标识编号", "example": "ORD-001"},
113
+ {"path": "total_amount", "type": "number", "nullable": false, "description": "订单总金额", "example": 598.00, "format": "currency", "unit": "元"},
114
+ {"path": "items", "type": "array", "element_type": "object", "nullable": false, "description": "订单包含的商品列表", "children": ["items[]"]},
115
+ {"path": "items[].name", "type": "string", "nullable": false, "description": "商品名称", "example": "无线耳机"},
116
+ {"path": "items[].price", "type": "number", "nullable": false, "description": "商品单价", "example": 299.00, "format": "currency", "unit": "元"}
117
+ ],
118
+ "statistics": {"total_fields": 5, "max_depth": 2, "object_count": 2, "array_count": 1}
119
+ }
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Common Mistakes
125
+
126
+ | 错误 | 正确做法 |
127
+ |------|----------|
128
+ | description 只写字段名翻译(如 "名称") | 结合业务上下文写语义描述(如 "产品线名称") |
129
+ | 数值字段不标注 unit | 金额标 "元",百分比标 "%",时长标 "天/ms" |
130
+ | 数组类型缺 element_type | array 类型必须标注元素类型 |
131
+ | object/array 缺 children | 必须列出子字段路径 |
132
+ | 忘记 statistics 段 | 每次输出必须包含 total_fields, max_depth 等统计 |
133
+ | format 乱标 | 不确定时不标注,优先根据字段名推断 |
134
+ | 输出标准 JSON Schema (draft-07) | 本 skill 输出 extracted-json-schema/v1 格式,非标准 JSON Schema |
135
+
136
+ ---
137
+
138
+ ## Checklist
139
+
140
+ 输出前逐项确认:
141
+
142
+ - [ ] 所有字段都有 description 且语义化(非字段名翻译)
143
+ - [ ] type 与实际值匹配
144
+ - [ ] array 类型有 element_type,object/array 有 children
145
+ - [ ] 金额/百分比等数值有 format 和 unit
146
+ - [ ] statistics 与实际字段数一致
147
+ - [ ] $schema 为 "extracted-json-schema/v1"
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: lark-apps
3
+ description: "在妙搭沙箱里用 lark-cli 操作【当前这个已存在的】妙搭应用:开放 API Key。当用户要在沙箱里对当前应用做这些操作时使用(可用能力以本次打包的模块为准)。"
4
+ metadata:
5
+ requires:
6
+ bins: ["lark-cli"]
7
+ cliHelp: "lark-cli apps --help; lark-cli apps +<cmd> --help"
8
+ control-by-feature-ab: true
9
+ ---
10
+
11
+ # 妙搭应用 (apps) · 沙箱版
12
+
13
+ 在妙搭沙箱里通过 `lark-cli` 操作**当前这个已存在的**妙搭应用。
14
+
15
+ ## 沙箱约定(先读)
16
+
17
+ - **命令名**:一律 `lark-cli apps +<cmd>`;命令/flag 细节以 `--help` 为准。
18
+ - **应用已存在、app_id 走环境变量**:应用 id 在环境变量 `app_id` 里,命令需要 `--app-id` 时用 `--app-id "$app_id"`。
19
+ - **鉴权自动**:apps 域请求由运行环境自动打到 innerAPI 并注入鉴权头。**不要** `auth login` / `config init` / `--as`。
20
+
21
+ ## 意图路由
22
+
23
+ | 用户意图 | 命令 | 详情 |
24
+ |---|---|---|
25
+ | 管理开放 API Key(列/查/建/改/启停/删/轮换) | `+openapi-key-list` / `+openapi-key-get` / `+openapi-key-create` / `+openapi-key-update` / `+openapi-key-enable` / `+openapi-key-disable` / `+openapi-key-delete` / `+openapi-key-reset` | [openapi-key](references/openapi-key.md) ⚠️ create/reset 密钥一次性可见;delete/reset 高风险 |
26
+
27
+
28
+ ## 失败处理
29
+ 命令失败时把 `error.hint` 转述给用户,别原样甩 envelope JSON。
30
+
31
+ ## 高风险写操作审批(exit 10)
32
+ `risk: high-risk-write` 的命令不带 `--yes` 会 **exit 10** 并返回 `confirmation_required`。处理:
33
+ 1. 识别 exit code=10 且 `error.type=="confirmation_required"`;
34
+ 2. 把 `error.risk.action` + 关键参数给用户,明确"高风险",等显式同意;
35
+ 3. 同意 → 原始 argv 末尾加 `--yes` 重试;拒绝 → 终止;
36
+ 4. 想先看请求 → `--dry-run`(不触发门禁、不需 `--yes`)。
37
+ **绝不**看到 exit 10 就默认补 `--yes` 静默重试。
@@ -0,0 +1,80 @@
1
+ # apps openapi-key 命令族(开放 API Key)
2
+
3
+ 管理妙搭应用对外暴露的 HTTP API Key(`/openapi/**` 鉴权凭证)。命令事实以 `lark-cli apps +openapi-key-list --help`(各子命令同理)为准;本文件只记录 Agent 不看就会做错的领域规则。鉴权由沙箱运行环境自动注入(见 SKILL.md「鉴权自动」),命令无需也不要传身份参数。
4
+
5
+ ## 命令路由
6
+
7
+ | 命令 | 用途 |
8
+ |---|---|
9
+ | `+openapi-key-list` | 列出应用所有 API Key(脱敏) |
10
+ | `+openapi-key-get` | 查看单个 Key 详情(脱敏) |
11
+ | `+openapi-key-create` | 创建新 Key,**原始密钥一次性可见** |
12
+ | `+openapi-key-update` | 改名或改 config(不改 status) |
13
+ | `+openapi-key-enable` | 启用 Key(status→1) |
14
+ | `+openapi-key-disable` | 停用 Key(status→0),**泄露/疑似泄露优先用这个而非 delete** |
15
+ | `+openapi-key-delete` | 永久删除 Key(不可逆,高风险) |
16
+ | `+openapi-key-reset` | 轮换密钥(刷新原始 Key),**一次性可见**(高风险) |
17
+
18
+ 命令均带 `--app-id "$app_id"`(当前沙箱应用),如:
19
+
20
+ ```bash
21
+ lark-cli apps +openapi-key-list --app-id "$app_id"
22
+ ```
23
+
24
+ ## 密钥红线(安全关键,务必遵守)
25
+
26
+ - `create` / `reset` 返回的**原始密钥仅一次性可见**:只在 `data.api_key`(顶层)随本次响应返回一次,同时 stderr 打印一次性提示(大意:此密钥仅显示一次、不被 lark-cli 保存,请立即复制到你自己的密钥管理器)。
27
+ - **绝不**把原始密钥写入 cache / config / recent / debug log / 错误信息,也不要在后续对话里回显完整密钥;只向用户转述一次并提示自行妥善保管。
28
+ - **密钥丢失不能找回**:`list` / `get` 不回显原始密钥。唯一恢复方式是 `+openapi-key-reset` 重新生成新密钥(旧密钥同时失效)。
29
+
30
+ ## 脱敏口径
31
+
32
+ - `list` / `get` / `update` / `enable` / `disable`:返回结构里 **无** `api_key` 字段,只有 `key_preview`(格式:`****` + 原始密钥末 4 位,如 `****5f4a`)。
33
+ - `create` / `reset`:**仅** 在 `data.api_key`(顶层)返回原始密钥一次(见上「密钥红线」)。
34
+
35
+ ## scope 结构与 CLI 表达
36
+
37
+ 后端 `config.request_scope` 的真实结构(**snake_case**——Lark 开放网关 `/open-apis/` 对外契约约定;`api_key.thrift` 的 camelCase go.tag 是内部表示,OGW 已转成 snake_case):
38
+
39
+ ```json
40
+ {
41
+ "allow_all": true,
42
+ "http_infos": [
43
+ { "http_method": "GET", "http_path": "/openapi/some-path" }
44
+ ]
45
+ }
46
+ ```
47
+
48
+ - `allow_all=true`:放开该应用所有 `/openapi/**` 路由;`http_infos` 此时忽略。
49
+ - `allow_all=false`:按 `http_infos` 逐条授权,每条需 `http_method`(大写)+ `http_path`(`/openapi/` 开头)。
50
+
51
+ CLI 提供三种互斥的 scope 表达方式:
52
+
53
+ | flag | 用途 | 备注 |
54
+ |---|---|---|
55
+ | `--scope-all` | `allow_all=true`,放开所有路由 | bool flag,显式传 `--scope-all=false` 也算"已设置" |
56
+ | `--scope-api 'METHOD /openapi/path'` | 逐条授权一个路由,可重复 | 路由从应用 `docs/openapi.json` 取 |
57
+ | `--scope '<raw request_scope JSON>'` | 高级逃生口,直传 request_scope JSON(snake_case) | CLI 只校验合法 JSON;`--scope` 与 `--scope-all`/`--scope-api` 互斥 |
58
+
59
+ ### scope 值来源
60
+
61
+ 妙搭应用的 `/openapi/**` 路由定义在应用仓库,并同步维护在 `docs/openapi.json`(`paths` 下每个 `"/openapi/..."` 条目 + HTTP 方法)。要授权哪些路由,读目标应用自己的 `docs/openapi.json`,取 `(method, path)` 对。CLI 本身不提供 API 路由发现功能(P1 规划中)。
62
+
63
+ ## 高风险操作(delete / reset)
64
+
65
+ `delete` 和 `reset` 是高风险写操作(`high-risk-write`):缺 `--yes` 会 **exit 10**(`confirmation_required`),须按 SKILL.md 的 exit-10 审批协议先征得用户显式同意再补 `--yes`——**不要**自动补 `--yes`;不确定先 `--dry-run` 查看将执行的 HTTP 请求(不含密钥)。
66
+
67
+ - **泄露场景**:应优先 `+openapi-key-disable` 立即停用,而非 `+openapi-key-delete`——停用可随时 `+openapi-key-enable` 恢复,delete 不可逆。
68
+
69
+ ## 典型决策场景
70
+
71
+ | 用户意图 | 正确操作 |
72
+ |---|---|
73
+ | "key 泄露了,先停掉" | `+openapi-key-disable`(不是 delete) |
74
+ | "key 丢了/忘了,再给我一个" | `+openapi-key-reset`(不是 create 新 key;reset 轮换密钥、保留原 key 配置) |
75
+ | "我的 key 密钥是什么" | 解释:list/get 不回显原始密钥,只能用 `+openapi-key-reset` 轮换 |
76
+ | "给应用创建一个有权限限制的 key" | `+openapi-key-create --name ... --scope-api 'GET /openapi/...'`(路由取自应用 `docs/openapi.json`) |
77
+
78
+ ## 不在本 skill 范围
79
+
80
+ - OpenAPI spec 全量导出、实时日志 tail、Webhook 消费、多鉴权方式:本期不支持。