natureco-cli 5.18.2 → 5.19.0
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/package.json +1 -1
- package/skills/airunway-aks-setup/SKILL.md +73 -0
- package/skills/algorithmic-art/SKILL.md +405 -0
- package/skills/appinsights-instrumentation/SKILL.md +76 -0
- package/skills/azure-ai/SKILL.md +71 -0
- package/skills/azure-aigateway/SKILL.md +129 -0
- package/skills/azure-cloud-migrate/SKILL.md +52 -0
- package/skills/azure-compliance/SKILL.md +108 -0
- package/skills/azure-compute/SKILL.md +46 -0
- package/skills/azure-cost/SKILL.md +45 -0
- package/skills/azure-deploy/SKILL.md +97 -0
- package/skills/azure-diagnostics/SKILL.md +151 -0
- package/skills/azure-enterprise-infra-planner/SKILL.md +54 -0
- package/skills/azure-hosted-copilot-sdk/SKILL.md +89 -0
- package/skills/azure-kubernetes/SKILL.md +153 -0
- package/skills/azure-kusto/SKILL.md +231 -0
- package/skills/azure-messaging/SKILL.md +57 -0
- package/skills/azure-prepare/SKILL.md +165 -0
- package/skills/azure-quotas/SKILL.md +276 -0
- package/skills/azure-rbac/SKILL.md +17 -0
- package/skills/azure-reliability/SKILL.md +387 -0
- package/skills/azure-resource-lookup/SKILL.md +108 -0
- package/skills/azure-resource-visualizer/SKILL.md +183 -0
- package/skills/azure-storage/SKILL.md +100 -0
- package/skills/azure-upgrade/SKILL.md +91 -0
- package/skills/azure-validate/SKILL.md +72 -0
- package/skills/brainstorming/SKILL.md +159 -0
- package/skills/brand-guidelines/SKILL.md +73 -0
- package/skills/brandkit/SKILL.md +798 -0
- package/skills/brutalist-skill/SKILL.md +92 -0
- package/skills/canvas-design/SKILL.md +130 -0
- package/skills/cavecrew/SKILL.md +82 -0
- package/skills/caveman-commit/SKILL.md +65 -0
- package/skills/caveman-help/SKILL.md +63 -0
- package/skills/caveman-review/SKILL.md +55 -0
- package/skills/caveman-stats/SKILL.md +10 -0
- package/skills/claude-api/SKILL.md +356 -0
- package/skills/composition-patterns/SKILL.md +89 -0
- package/skills/decision-mapping/SKILL.md +84 -0
- package/skills/deploy-to-vercel/SKILL.md +296 -0
- package/skills/design-an-interface/SKILL.md +94 -0
- package/skills/design-doc-mermaid/SKILL.md +498 -0
- package/skills/develop-userscripts/SKILL.md +84 -0
- package/skills/doc-coauthoring/SKILL.md +375 -0
- package/skills/documentation/SKILL.md +109 -0
- package/skills/docx/SKILL.md +590 -0
- package/skills/edit-article/SKILL.md +15 -0
- package/skills/entra-agent-id/SKILL.md +356 -0
- package/skills/entra-app-registration/SKILL.md +191 -0
- package/skills/faceless-explainer/SKILL.md +202 -0
- package/skills/fastify/SKILL.md +75 -0
- package/skills/general-video/SKILL.md +143 -0
- package/skills/git-guardrails-claude-code/SKILL.md +95 -0
- package/skills/github-actions-docs/SKILL.md +98 -0
- package/skills/gpt-tasteskill/SKILL.md +74 -0
- package/skills/grill-me/SKILL.md +7 -0
- package/skills/grilling/SKILL.md +10 -0
- package/skills/handoff/SKILL.md +16 -0
- package/skills/hyperframes/SKILL.md +152 -0
- package/skills/hyperframes-animation/SKILL.md +82 -0
- package/skills/hyperframes-cli/SKILL.md +109 -0
- package/skills/hyperframes-core/SKILL.md +78 -0
- package/skills/hyperframes-creative/SKILL.md +68 -0
- package/skills/hyperframes-media/SKILL.md +97 -0
- package/skills/image-to-code-skill/SKILL.md +1228 -0
- package/skills/imagegen-frontend-mobile/SKILL.md +1465 -0
- package/skills/imagegen-frontend-web/SKILL.md +987 -0
- package/skills/implement/SKILL.md +15 -0
- package/skills/init/SKILL.md +91 -0
- package/skills/internal-comms/SKILL.md +32 -0
- package/skills/lark-approval/SKILL.md +56 -0
- package/skills/lark-base/SKILL.md +157 -0
- package/skills/lark-doc/SKILL.md +81 -0
- package/skills/lark-shared/SKILL.md +168 -0
- package/skills/lark-workflow-meeting-summary/SKILL.md +122 -0
- package/skills/linting-neostandard-eslint9/SKILL.md +64 -0
- package/skills/loop-me/SKILL.md +32 -0
- package/skills/microsoft-foundry/SKILL.md +262 -0
- package/skills/migrate-to-shoehorn/SKILL.md +118 -0
- package/skills/minimalist-skill/SKILL.md +85 -0
- package/skills/motion-graphics/SKILL.md +170 -0
- package/skills/music-to-video/SKILL.md +197 -0
- package/skills/node/SKILL.md +94 -0
- package/skills/nodejs-core/SKILL.md +156 -0
- package/skills/oauth/SKILL.md +186 -0
- package/skills/obsidian-vault/SKILL.md +59 -0
- package/skills/octocat/SKILL.md +93 -0
- package/skills/openclaw-secure-linux-cloud/SKILL.md +157 -0
- package/skills/opensource-guide-coach/SKILL.md +218 -0
- package/skills/output-skill/SKILL.md +49 -0
- package/skills/pdf/SKILL.md +314 -0
- package/skills/pptx/SKILL.md +232 -0
- package/skills/pr-to-video/SKILL.md +235 -0
- package/skills/product-launch-video/SKILL.md +205 -0
- package/skills/python-appservice-deploy/SKILL.md +36 -0
- package/skills/qa/SKILL.md +130 -0
- package/skills/react-best-practices/SKILL.md +149 -0
- package/skills/react-native-skills/SKILL.md +121 -0
- package/skills/react-view-transitions/SKILL.md +320 -0
- package/skills/readme-i18n/SKILL.md +176 -0
- package/skills/redesign-skill/SKILL.md +178 -0
- package/skills/remotion/SKILL.md +364 -0
- package/skills/request-refactor-plan/SKILL.md +68 -0
- package/skills/resolving-merge-conflicts/SKILL.md +14 -0
- package/skills/running-claude-code-via-litellm-copilot/SKILL.md +263 -0
- package/skills/scaffold-exercises/SKILL.md +106 -0
- package/skills/secure-linux-web-hosting/SKILL.md +162 -0
- package/skills/setup-pre-commit/SKILL.md +91 -0
- package/skills/shadcn/SKILL.md +267 -0
- package/skills/simple/SKILL.md +52 -0
- package/skills/skill-creator/SKILL.md +485 -0
- package/skills/skill-optimizer/SKILL.md +47 -0
- package/skills/skills-cli/SKILL.md +281 -0
- package/skills/slack-gif-creator/SKILL.md +254 -0
- package/skills/snipgrapher/SKILL.md +58 -0
- package/skills/soft-skill/SKILL.md +98 -0
- package/skills/stitch-skill/SKILL.md +184 -0
- package/skills/supabase/SKILL.md +135 -0
- package/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/talking-head-recut/SKILL.md +1191 -0
- package/skills/taste-skill/SKILL.md +1206 -0
- package/skills/taste-skill-v1/SKILL.md +226 -0
- package/skills/tdd/SKILL.md +108 -0
- package/skills/teach/SKILL.md +140 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/theme-factory/SKILL.md +59 -0
- package/skills/to-prd/SKILL.md +75 -0
- package/skills/typescript-magician/SKILL.md +117 -0
- package/skills/tzst/SKILL.md +68 -0
- package/skills/ubiquitous-language/SKILL.md +93 -0
- package/skills/use-my-browser/SKILL.md +110 -0
- package/skills/using-superpowers/SKILL.md +121 -0
- package/skills/vercel-cli-with-tokens/SKILL.md +353 -0
- package/skills/vercel-optimize/SKILL.md +322 -0
- package/skills/viral-instagram-reels/SKILL.md +180 -0
- package/skills/viral-short-form/SKILL.md +147 -0
- package/skills/viral-short-form-ideas/SKILL.md +184 -0
- package/skills/viral-tiktok-content/SKILL.md +180 -0
- package/skills/web-artifacts-builder/SKILL.md +74 -0
- package/skills/web-design-guidelines/SKILL.md +39 -0
- package/skills/webapp-testing/SKILL.md +96 -0
- package/skills/website-to-video/SKILL.md +145 -0
- package/skills/writing-beats/SKILL.md +67 -0
- package/skills/writing-fragments/SKILL.md +79 -0
- package/skills/writing-great-skills/SKILL.md +82 -0
- package/skills/writing-guidelines/SKILL.md +39 -0
- package/skills/writing-plans/SKILL.md +174 -0
- package/skills/writing-shape/SKILL.md +79 -0
- package/skills/xdrop/SKILL.md +78 -0
- package/skills/xget/SKILL.md +87 -0
- package/skills/xlsx/SKILL.md +292 -0
- package/src/tools/browser_use.js +2 -1
- package/src/tools/skills_download.js +217 -0
- package/src/utils/tools.js +2 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: implement
|
|
3
|
+
description: "Implement a piece of work based on a PRD or set of issues."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Implement the work described by the user in the PRD or issues.
|
|
8
|
+
|
|
9
|
+
Use /tdd where possible, at pre-agreed seams.
|
|
10
|
+
|
|
11
|
+
Run typechecking regularly, single test files regularly, and the full test suite once at the end.
|
|
12
|
+
|
|
13
|
+
Once done, use /review to review the work.
|
|
14
|
+
|
|
15
|
+
Commit your work to the current branch.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: init
|
|
3
|
+
description: Creates, updates, or optimizes an AGENTS.md file for a repository with minimal, high-signal instructions covering non-discoverable coding conventions, tooling quirks, workflow preferences, and project-specific rules that agents cannot infer from reading the codebase. Use when setting up agent instructions or Claude configuration for a new repository, when an existing AGENTS.md is too long, generic, or stale, when agents repeatedly make avoidable mistakes, or when repository workflows have changed and the agent configuration needs pruning. Applies a discoverability filter—omitting anything Claude can learn from README, code, config, or directory structure—and a quality gate to verify each line remains accurate and operationally significant.
|
|
4
|
+
metadata:
|
|
5
|
+
tags: initialization, agents, context-engineering, agents-md, maintenance
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## When to use
|
|
9
|
+
|
|
10
|
+
Use this skill when creating or updating `AGENTS.md` for a repository.
|
|
11
|
+
|
|
12
|
+
Use it especially when:
|
|
13
|
+
- the current `AGENTS.md` is long, generic, or stale
|
|
14
|
+
- agents repeatedly make the same avoidable mistakes
|
|
15
|
+
- repository workflows changed and agent guidance needs pruning
|
|
16
|
+
|
|
17
|
+
## Instructions
|
|
18
|
+
|
|
19
|
+
Treat `AGENTS.md` as a **living list of non-discoverable landmines and workflow gotchas**, not a codebase overview.
|
|
20
|
+
|
|
21
|
+
### Core rule: discoverability filter
|
|
22
|
+
|
|
23
|
+
Before adding any line, ask:
|
|
24
|
+
|
|
25
|
+
> Can an agent discover this by reading the repo (`README`, code, config, scripts, directory tree)?
|
|
26
|
+
|
|
27
|
+
- If **yes**: do **not** include it in `AGENTS.md`.
|
|
28
|
+
- If **no**, and it materially affects task success/cost/safety: include it.
|
|
29
|
+
|
|
30
|
+
### What earns a line
|
|
31
|
+
|
|
32
|
+
Include only guidance that is:
|
|
33
|
+
1. **Non-discoverable** from repository files alone
|
|
34
|
+
2. **Operationally significant** (changes commands, outcomes, or safety)
|
|
35
|
+
3. **Actionable** (specific enough to execute)
|
|
36
|
+
|
|
37
|
+
Typical examples:
|
|
38
|
+
- Non-standard tooling choices (e.g. use `uv` instead of `pip`)
|
|
39
|
+
- Command caveats (e.g. tests must run with `--no-cache` due to fixture behavior)
|
|
40
|
+
- Hidden constraints/landmines (deprecated directories still imported in production)
|
|
41
|
+
- Critical local conventions that are not encoded in lint/tests/config
|
|
42
|
+
|
|
43
|
+
### What to remove or avoid
|
|
44
|
+
|
|
45
|
+
Do **not** include:
|
|
46
|
+
- Tech stack summaries
|
|
47
|
+
- Directory structure overviews
|
|
48
|
+
- Architecture descriptions agents can infer from code
|
|
49
|
+
- Generic best-practice advice
|
|
50
|
+
- Rules already enforced by tooling (linters, typecheck, tests, CI)
|
|
51
|
+
- Mandatory boilerplate headers unless the repo explicitly requires one
|
|
52
|
+
|
|
53
|
+
### Recommended structure
|
|
54
|
+
|
|
55
|
+
Prefer short, high-signal sections such as:
|
|
56
|
+
- `Scope & routing` (which areas need separate/module-local AGENTS files)
|
|
57
|
+
- `Non-discoverable commands`
|
|
58
|
+
- `Landmines / do-not-touch areas`
|
|
59
|
+
- `Task-specific constraints`
|
|
60
|
+
|
|
61
|
+
For large repos, recommend **hierarchical AGENTS.md** files near relevant modules instead of one monolithic root file.
|
|
62
|
+
|
|
63
|
+
### Source files to check first
|
|
64
|
+
|
|
65
|
+
- Existing `AGENTS.md`
|
|
66
|
+
- `README.md`
|
|
67
|
+
- `PROJECT.md` (if present)
|
|
68
|
+
- Cursor rules (`.cursor/rules/` or `.cursorrules`)
|
|
69
|
+
- Copilot instructions (`.github/copilot-instructions.md`)
|
|
70
|
+
- `GEMINI.md`
|
|
71
|
+
- CI/workflow files and package manager config (for command/tooling mismatches)
|
|
72
|
+
|
|
73
|
+
If `AGENTS.md` exists, improve it incrementally instead of replacing it blindly.
|
|
74
|
+
|
|
75
|
+
### Maintenance mindset
|
|
76
|
+
|
|
77
|
+
`AGENTS.md` is temporary guidance, not permanent configuration.
|
|
78
|
+
|
|
79
|
+
When recurring issues appear:
|
|
80
|
+
1. Prefer fixing the root cause in code/tooling (lint rule, test, script, structure)
|
|
81
|
+
2. Keep only the minimum instruction needed until the root cause is solved
|
|
82
|
+
3. Prune stale instructions aggressively
|
|
83
|
+
|
|
84
|
+
### Quality gate before finalizing
|
|
85
|
+
|
|
86
|
+
For each line in `AGENTS.md`, verify:
|
|
87
|
+
- Is it non-discoverable?
|
|
88
|
+
- Is it still accurate today?
|
|
89
|
+
- Does it materially reduce mistakes/cost/time?
|
|
90
|
+
|
|
91
|
+
Delete any line that fails one of these checks.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: internal-comms
|
|
3
|
+
description: A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).
|
|
4
|
+
license: Complete terms in LICENSE.txt
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## When to use this skill
|
|
8
|
+
To write internal communications, use this skill for:
|
|
9
|
+
- 3P updates (Progress, Plans, Problems)
|
|
10
|
+
- Company newsletters
|
|
11
|
+
- FAQ responses
|
|
12
|
+
- Status reports
|
|
13
|
+
- Leadership updates
|
|
14
|
+
- Project updates
|
|
15
|
+
- Incident reports
|
|
16
|
+
|
|
17
|
+
## How to use this skill
|
|
18
|
+
|
|
19
|
+
To write any internal communication:
|
|
20
|
+
|
|
21
|
+
1. **Identify the communication type** from the request
|
|
22
|
+
2. **Load the appropriate guideline file** from the `examples/` directory:
|
|
23
|
+
- `examples/3p-updates.md` - For Progress/Plans/Problems team updates
|
|
24
|
+
- `examples/company-newsletter.md` - For company-wide newsletters
|
|
25
|
+
- `examples/faq-answers.md` - For answering frequently asked questions
|
|
26
|
+
- `examples/general-comms.md` - For anything else that doesn't explicitly match one of the above
|
|
27
|
+
3. **Follow the specific instructions** in that file for formatting, tone, and content gathering
|
|
28
|
+
|
|
29
|
+
If the communication type doesn't match any existing guideline, ask for clarification or more context about the desired format.
|
|
30
|
+
|
|
31
|
+
## Keywords
|
|
32
|
+
3P updates, company newsletter, company comms, weekly update, faqs, common questions, updates, internal comms
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lark-approval
|
|
3
|
+
version: 1.2.0
|
|
4
|
+
description: "飞书审批:查询和处理审批待办/已办/实例,搜索可发起审批定义、查看定义详情并发起原生审批实例。当用户要处理审批任务、查看审批实例、搜索或发起审批时使用。审批待办不是飞书任务;非审批类待办走 lark-task。不负责创建审批定义;三方审批定义不走原生提单。"
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["lark-cli"]
|
|
8
|
+
cliHelp: "lark-cli approval --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
**CRITICAL — 开始前 MUST 先用 Read 工具读取 [`../lark-shared/SKILL.md`](../lark-shared/SKILL.md),其中包含认证、权限处理**
|
|
12
|
+
|
|
13
|
+
所有命令默认 `--as user`(审批是人的动作)。调用前先 `lark-cli schema approval.<resource>.<method>` 查参数结构,不要猜字段。
|
|
14
|
+
|
|
15
|
+
## 选哪个命令
|
|
16
|
+
|
|
17
|
+
| 想做什么 | 命令 |
|
|
18
|
+
|---|---|
|
|
19
|
+
| 搜可发起定义 | `approvals search` |
|
|
20
|
+
| 看审批定义详情/提单前确认表单与流程 | `approvals get` |
|
|
21
|
+
| 发起原生审批实例 | `instances create` |
|
|
22
|
+
| 查待办/已办 | `tasks query`(`topic`:1待办 2已办 17未读 18已读)|
|
|
23
|
+
| 看表单/进度/当前节点 | `instances get` |
|
|
24
|
+
| 同意/拒绝 | `tasks approve` / `tasks reject` |
|
|
25
|
+
| 转交/加签/退回 | `tasks transfer` / `tasks add_sign` / `tasks rollback` |
|
|
26
|
+
| 催办 | `tasks remind` |
|
|
27
|
+
| 撤回/抄送/按定义查已发起 | `instances cancel` / `instances cc` / `instances initiated` |
|
|
28
|
+
|
|
29
|
+
处理链:
|
|
30
|
+
|
|
31
|
+
- 发起审批:`approvals search` -> `approvals get` -> `instances.create`
|
|
32
|
+
- 处理审批:`tasks query` 拿 `instance_code` + `task_id`(操作必须成对带上)→ 需要细节再 `instances get` → 执行操作
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
lark-cli approval approvals search --data '{"keyword":"请假"}' --as user
|
|
36
|
+
lark-cli approval approvals get --params '{"approval_code":"<code>"}' --as user
|
|
37
|
+
lark-cli approval instances create --data '{"approval_code":"<code>","form":"[...]"}' --yes --as user
|
|
38
|
+
lark-cli approval tasks query --params '{"topic":"1"}' --as user
|
|
39
|
+
lark-cli approval tasks approve --data '{"instance_code":"<ic>","task_id":"<tid>","comment":"同意"}' --as user
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 发起原生审批
|
|
43
|
+
|
|
44
|
+
发起审批属于高风险写操作,按下表处理:
|
|
45
|
+
|
|
46
|
+
| 规则 | 处理 |
|
|
47
|
+
|---|---|
|
|
48
|
+
| 用户意图是发起审批 / 提单 / 提交请假审批 / 提交报销审批 / 创建审批实例 | 先读 [`references/lark-approval-initiate.md`](references/lark-approval-initiate.md)、[`references/lark-approval-instance-form-control-parameters.md`](references/lark-approval-instance-form-control-parameters.md) 和 [`references/lark-approval-instance-value-sourcing.md`](references/lark-approval-instance-value-sourcing.md),并运行 `lark-cli schema approval.instances.create` |
|
|
49
|
+
| 编排顺序 | 固定走 `approvals.search` -> `approvals.get` -> `instances.create`;未拿到定义详情前不要猜 `form`、`node_approver_list` 或 `node_cc_list` |
|
|
50
|
+
| 三方定义 | `is_external=true` 时不要调用 `approval instances create`,返回 `create_link` 并说明需通过链接发起 |
|
|
51
|
+
| 表单与节点参数 | 控件 `value` 结构看 [`references/lark-approval-instance-form-control-parameters.md`](references/lark-approval-instance-form-control-parameters.md);值来源看 [`references/lark-approval-instance-value-sourcing.md`](references/lark-approval-instance-value-sourcing.md) |
|
|
52
|
+
| 真正执行前 | 让用户确认最终定义、表单值和节点参数;执行时显式传 `--yes`,成功后回报 `instance_code` 与 `instance_link` |
|
|
53
|
+
|
|
54
|
+
## 不在本 skill 范围
|
|
55
|
+
|
|
56
|
+
创建审批定义(走飞书客户端或审批管理后台);三方定义发起(返回 `create_link`,引导用户通过链接发起);非审批类待办 → [`lark-task`](../lark-task/SKILL.md)
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lark-base
|
|
3
|
+
version: 1.2.2
|
|
4
|
+
description: "飞书多维表格(Base)操作:建表、字段、记录、视图、统计、公式/lookup、表单、仪表盘、workflow、角色权限;遇到 Base/多维表格/bitable 或 /base/ 链接时使用。文件导入转 lark-drive,认证/授权转 lark-shared。"
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["lark-cli"]
|
|
8
|
+
cliHelp: "lark-cli base --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# base
|
|
12
|
+
|
|
13
|
+
## 何时使用
|
|
14
|
+
|
|
15
|
+
使用本 skill:
|
|
16
|
+
|
|
17
|
+
- 用户明确提到 Base / 多维表格 / bitable,或给出 `/base/` 链接。
|
|
18
|
+
- 用户要在 Base 内建表、改表、管理字段、写记录、查记录、配视图。
|
|
19
|
+
- 用户要在 Base 内做公式字段、lookup 字段、跨表计算、派生指标、筛选聚合、TopN、统计分析。
|
|
20
|
+
- 用户要管理 Base 表单、仪表盘、workflow、高级权限或角色。
|
|
21
|
+
- 用户要把旧 Base 聚合式命令或旧写法迁移到当前 `lark-cli base +...` shortcut。
|
|
22
|
+
|
|
23
|
+
不要使用本 skill:
|
|
24
|
+
|
|
25
|
+
- 只是认证、初始化配置、切换身份、处理 scope 或权限授权恢复,转 `lark-shared`。
|
|
26
|
+
- 把本地 Excel / CSV / `.base` 导入成 Base,转 `lark-drive +import --type bitable`。
|
|
27
|
+
- 泛化数据分析、字段设计、公式讨论,但没有 Base/多维表格上下文。
|
|
28
|
+
|
|
29
|
+
## 使用边界
|
|
30
|
+
|
|
31
|
+
- Base 业务操作只使用 `lark-cli base +...` shortcut,不使用旧聚合式 `+table / +field / +record / +view / +history / +workspace`。
|
|
32
|
+
- 本轮 Base 不依赖 `lark-cli schema`。SKILL 只保留路由、风险和复杂 JSON/DSL;简单命令由命令自身的参数、tips 和错误恢复承接。
|
|
33
|
+
- 用户要把 Excel / CSV / `.base` 导入成 Base 时,先转 `lark-cli drive +import --type bitable`,导入完成后再回到 Base 命令。
|
|
34
|
+
- 认证、初始化、scope、身份切换、权限不足恢复属于 `lark-shared`;Base 文档只保留会影响 Base 路径选择的权限规则。
|
|
35
|
+
|
|
36
|
+
## 先获取 Base Token 和所需 ID
|
|
37
|
+
|
|
38
|
+
进入任何需要目标 Base 的 shortcut 前,必须先拿到可用的 `base_token`,以及当前任务需要的 `table_id` / `view_id` / `record_id` / `form_id` / `dashboard_id` / `workflow_id` 等真实 ID;不要把完整 URL、wiki token、workspace token 或孤立 raw token 直接当作 `--base-token`。
|
|
39
|
+
|
|
40
|
+
- 用户输入 URL 或分享链接:先运行 `lark-cli base +url-resolve --url "<url>" --as user`,用返回的 `base_token` 和相关 ID 继续后续命令。
|
|
41
|
+
- 用户输入 Base 标题、关键词或不确定名称:先运行 `lark-cli base +title-resolve --title "<keyword>" --as user`;`--title` 传入标题中的短关键词,不超过 30 个字符;过长标题先取最有区分度的短关键词;多候选时先让用户消歧,不要猜。
|
|
42
|
+
- 文档嵌入 Base 标签:直接读取 `<bitable>` / `<base_refer>` 的 `token` 作为 `--base-token`,`table-id` 作为 `--table-id`,`view-id` 作为 `--view-id`;孤立 raw token 不走 `+url-resolve`。
|
|
43
|
+
- 仍无法定位且用户不是要新建 Base 时,先反问用户要操作哪一个 Base;用户要新建时才用 `+base-create`。
|
|
44
|
+
|
|
45
|
+
## 快速路由
|
|
46
|
+
|
|
47
|
+
| 用户目标 | 优先命令 | 何时读 reference |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| 查 Base 本体 | `+base-get` | 用返回确认 Base 名称、owner、权限和可继续操作的 token |
|
|
50
|
+
| 创建/复制 Base | `+base-create` / `+base-copy` | 新建时强烈推荐用 `--table-name` + `--fields` 同时配置新 Base 里唯一一个初始数据表的 name 和 schema;写入后报告新 Base 标识和 `permission_grant` |
|
|
51
|
+
| 查看 Base 内资源目录 | `+base-block-list` | 想先了解一个 Base 里有哪些 table/docx/dashboard/workflow/folder 时优先用它;返回 ID 关系和 fewshot 看 `--help` |
|
|
52
|
+
| 管理 Base 内资源目录 | `+base-block-create/move/rename/delete` | 创建或整理 Base 直接管理的 folder/table/docx/dashboard/workflow;资源内容继续用对应命令 |
|
|
53
|
+
| 管理数据表 | `+table-list/get/create/update/delete` | 处理 table 的列出、详情、创建、重命名和删除 |
|
|
54
|
+
| 列/查/删字段 | `+field-list/get/delete/search-options` | 写入前用 list/get 确认字段类型、选项、ID;删除前确认目标字段 |
|
|
55
|
+
| 创建/更新字段 | `+field-create` / `+field-update` | 必读 [lark-base-field-json.md](references/lark-base-field-json.md);公式读 [formula-field-guide.md](references/formula-field-guide.md);lookup 读 [lookup-field-guide.md](references/lookup-field-guide.md);命令细节读 [lark-base-field-create.md](references/lark-base-field-create.md) / [lark-base-field-update.md](references/lark-base-field-update.md) |
|
|
56
|
+
| 读记录明细 | `+record-get` / `+record-list` / `+record-search` | 涉及筛选、排序、Top/Bottom N、聚合、多表关联、全局结论时读 [lark-base-data-analysis-sop.md](references/lark-base-data-analysis-sop.md) |
|
|
57
|
+
| 写记录 | `+record-upsert` / `+record-batch-create` / `+record-batch-update` | 必读 [lark-base-record-upsert.md](references/lark-base-record-upsert.md) / [lark-base-record-batch-create.md](references/lark-base-record-batch-create.md) / [lark-base-record-batch-update.md](references/lark-base-record-batch-update.md) 和 [lark-base-cell-value.md](references/lark-base-cell-value.md) |
|
|
58
|
+
| 附件字段 | `+record-upload-attachment` / `+record-download-attachment` / `+record-remove-attachment` | 附件不要伪造成普通 CellValue;上传走本地文件,下载/删除按 file token 或字段定位 |
|
|
59
|
+
| 删除记录 / 分享记录链接 / 历史 | `+record-delete` / `+record-share-link-create` / `+record-history-list` | 删除前确认 record;分享链接最多 100 条;历史读 [lark-base-record-history-list.md](references/lark-base-record-history-list.md),只查单条记录,不做整表审计 |
|
|
60
|
+
| 管理视图 | `+view-*` | `+view-set-filter` 读 [lark-base-view-set-filter.md](references/lark-base-view-set-filter.md);其余配置先 get 现状,再按返回结构更新 |
|
|
61
|
+
| 一次性聚合统计 | `+data-query` | 必读 [lark-base-data-analysis-sop.md](references/lark-base-data-analysis-sop.md) 和入口 [lark-base-data-query-guide.md](references/lark-base-data-query-guide.md);完整 DSL 再读 [lark-base-data-query.md](references/lark-base-data-query.md) |
|
|
62
|
+
| 公式字段 | `+field-create/update --json '{"type":"formula",...}'` | 必读 [formula-field-guide.md](references/formula-field-guide.md),读后再加隐藏确认 flag `--i-have-read-guide` |
|
|
63
|
+
| Lookup 字段 | `+field-create/update --json '{"type":"lookup",...}'` | 必读 [lookup-field-guide.md](references/lookup-field-guide.md),读后再加隐藏确认 flag `--i-have-read-guide` |
|
|
64
|
+
| 表单提交 | `+form-submit` | 先读 [lark-base-form-detail.md](references/lark-base-form-detail.md) 获取题目、filter 和附件所需 `base_token`;提交 JSON 读 [lark-base-form-submit.md](references/lark-base-form-submit.md) |
|
|
65
|
+
| 表单题目创建/更新 | `+form-questions-create` / `+form-questions-update` | 读 [lark-base-form-questions-create.md](references/lark-base-form-questions-create.md) / [lark-base-form-questions-update.md](references/lark-base-form-questions-update.md) |
|
|
66
|
+
| 其他表单管理 | `+form-list/get/detail/create/update/delete` / `+form-questions-list/delete` | `+form-detail` 读 [lark-base-form-detail.md](references/lark-base-form-detail.md);删除前确认目标表单 |
|
|
67
|
+
| 仪表盘与组件 | `+dashboard-*` / `+dashboard-block-*` | 提到图表/看板/block 时先读 [lark-base-dashboard.md](references/lark-base-dashboard.md);组件 `data_config` 读 [dashboard-block-data-config.md](references/dashboard-block-data-config.md);读取图表计算结果用 `+dashboard-block-get-data` |
|
|
68
|
+
| Workflow | `+workflow-*` | 创建/更新或理解 steps 时读入口 [lark-base-workflow-guide.md](references/lark-base-workflow-guide.md) 和 steps JSON SSOT [lark-base-workflow-schema.md](references/lark-base-workflow-schema.md);list/get/enable/disable 只处理 workflow ID 与启停状态 |
|
|
69
|
+
| 高级权限与角色 | `+advperm-*` / `+role-*` | 角色操作先读入口 [lark-base-role-guide.md](references/lark-base-role-guide.md);角色 create/update 或解读完整配置再读权限 JSON SSOT [role-config.md](references/role-config.md);系统角色不可删除;关闭高级权限会影响自定义角色 |
|
|
70
|
+
|
|
71
|
+
## Base 心智模型
|
|
72
|
+
|
|
73
|
+
- Base 曾用名 Bitable;返回字段、错误或旧文档里的 `bitable` 多为历史兼容,不代表应改走裸 API 或另一套命令。
|
|
74
|
+
- `+base-block-list` 是查看一个 Base 内资源目录的新入口:它列出这个 Base 直接管理的 `folder/table/docx/dashboard/workflow`,适合先判断 Base 里有什么,再决定走 table、dashboard、workflow 或 docx 命令。
|
|
75
|
+
- `base-block` 只负责资源目录管理,包括创建资源、移动到 folder、重命名和删除;具体资源内容仍走 table/dashboard/workflow 命令。
|
|
76
|
+
- 新建 Base 时,强烈推荐一次性执行 `lark-cli base +base-create --name "<base>" --table-name "<table>" --fields '<field-json-array>'`,同时配置新 Base 里唯一一个初始数据表的 name 和 schema;使用 `--fields` 前先读 [lark-base-field-json.md](references/lark-base-field-json.md) 或复用 `+field-create` 的字段 JSON 形状,不要猜字段属性。
|
|
77
|
+
- `+base-create` 不传 `--table-name` 和 `--fields` 时,会创建一个默认 schema 的初始数据表。
|
|
78
|
+
- 表、字段、视图、workflow、dashboard block 的名称和 ID 必须来自真实返回,不要凭用户口述猜。
|
|
79
|
+
- 存储字段可写;系统字段、`formula`、`lookup` 只读;附件字段走专用 attachment 命令。
|
|
80
|
+
- 一次性原始记录查询优先用 `+record-list` / `+record-search` 的 filter/sort;聚合分析优先用 `+data-query`;需要长期显示在表中时,才新增 `formula` / `lookup` 字段。
|
|
81
|
+
- `formula` 适合常规计算、条件判断、文本/日期处理和长期派生指标;`lookup` 适合明确的跨表查找、筛选后取值或聚合引用。
|
|
82
|
+
- 写入、分析、公式、lookup、workflow、dashboard 前,先读取真实结构:表、字段、视图、关联表和 dashboard block 名称都以命令返回为准。
|
|
83
|
+
- 跨表场景必须读取目标表结构;link 单元格中的关联 `record_id` 只是连接键,最终回答要回查并展示用户可读字段。
|
|
84
|
+
|
|
85
|
+
## 身份与权限降级
|
|
86
|
+
|
|
87
|
+
- 默认显式使用 `--as user` 操作用户资源;只有用户明确要求应用身份时,才直接用 `--as bot`。
|
|
88
|
+
- user 身份报 scope/授权不足,或错误中包含 `permission_violations` / `hint`,先转 `lark-shared` 做用户授权恢复,不要直接降级 bot。
|
|
89
|
+
- user 身份报资源级无访问且无授权恢复提示时,才可用 `--as bot` 重试一次;bot 仍失败就停止重试并按权限错误处理。
|
|
90
|
+
- `91403` 或明确不可访问错误不要循环换身份重试。
|
|
91
|
+
- `+base-create` / `+base-copy` 若用 bot 身份执行,关注返回中的 `permission_grant`,并把用户是否可打开新 Base 告知用户。
|
|
92
|
+
|
|
93
|
+
## 查询与统计规则
|
|
94
|
+
|
|
95
|
+
涉及查询、统计或判断结论时,先阅读 [lark-base-data-analysis-sop.md](references/lark-base-data-analysis-sop.md),并遵守:
|
|
96
|
+
|
|
97
|
+
1. `+record-list` 的默认页、固定 `--limit` 和本地 `jq` 只能证明已读取范围内的事实,不能直接支撑全局最值、全量计数、Top/Bottom N、异常识别或分组结论。
|
|
98
|
+
2. 能由 Base 表达的筛选、排序、投影、聚合、分组和限制,应在 Base 云端查询能力中执行;不要先拉原始记录到本地上下文再手工筛选排序。
|
|
99
|
+
3. `has_more=true` 或等价分页信号表示当前结果不是全量;除非用户只要样例/前 N 条,不能基于该页回答全局问题。
|
|
100
|
+
4. 多表查询必须先确认关系字段和连接键;link 单元格里的 `record_id` 是关系键,不是用户可读答案。
|
|
101
|
+
5. 最终答案必须能追溯到真实表、真实字段、查询范围、筛选/排序/聚合条件和必要的连接键。
|
|
102
|
+
6. 一次性原始记录查询优先用 `+record-list` / `+record-search` 的 filter/sort;聚合分析优先用 `+data-query`;要把结果长期显示在表里,才考虑新增 `formula` / `lookup` 字段。
|
|
103
|
+
7. `+data-query` 可返回聚合结果或维度字段行,但维度行按字段组合去重且不返回 `record_id`;需要逐条记录、记录定位或完整行级字段时,再用 `+record-list` / `+record-search` / `+record-get` 回查。
|
|
104
|
+
|
|
105
|
+
## 写入前置规则
|
|
106
|
+
|
|
107
|
+
- 写记录前先读字段结构;只写存储字段。系统字段、附件字段、`formula`、`lookup` 不作为普通记录写入目标。
|
|
108
|
+
- 附件上传、下载、删除走专用 `+record-*-attachment` 命令。
|
|
109
|
+
- 写字段前先读 [lark-base-field-json.md](references/lark-base-field-json.md);涉及 `formula` / `lookup` 时必须读 [formula-field-guide.md](references/formula-field-guide.md) / [lookup-field-guide.md](references/lookup-field-guide.md)。
|
|
110
|
+
- 表名、字段名、视图名、workflow 配置中的名称必须来自真实返回;跨表场景还要读取目标表结构。
|
|
111
|
+
- 删除、角色更新、字段更新等高风险操作遵循 CLI 的 confirmation gate;目标不明确时先用 get/list 消歧。
|
|
112
|
+
- 批量写入单批最多 200 条;连续写同一表时串行执行,遇到 `1254291` 按短暂等待后重试处理。
|
|
113
|
+
- `+record-batch-update` 是“同值批量更新”:同一份 patch 应用到全部 `record_id_list`,不要拿它做逐行不同值映射。
|
|
114
|
+
- select/multiselect 写入未知选项可能触发平台新增选项;不是要新增时,先用 `+field-list` 或 `+field-search-options` 确认可选值。
|
|
115
|
+
|
|
116
|
+
## 表单与视图细节
|
|
117
|
+
|
|
118
|
+
- `+form-submit` 前必须先跑 `+form-detail`,读取 `questions[].type`、`required`、`filter` 和附件场景需要的 `base_token`;不要填写被 filter 隐藏的问题。
|
|
119
|
+
- 表单附件不要写进 `fields`,放在 `--json.attachments`;提交附件时必须同时传表单所属 Base 的 `--base-token`。
|
|
120
|
+
- `+view-set-filter` 是唯一保留的 view reference;sort/group/card/timebar/visible-fields 这类配置先用对应 get 命令读现状,保留未修改字段,只替换用户要求变更的配置。
|
|
121
|
+
- 视图适合持久化、共享和 UI 复用;一次性筛选/排序可先用 `+record-list` / `+record-search` 的 filter/sort 验证结果,再按需要沉淀为持久视图。
|
|
122
|
+
|
|
123
|
+
## Dashboard / Workflow / Role
|
|
124
|
+
|
|
125
|
+
- Dashboard 的复杂点是 block 的 `data_config`,不是 list/get/create/delete 命令参数。创建或更新 block 前先读 [dashboard-block-data-config.md](references/dashboard-block-data-config.md),组件必须串行创建;`+dashboard-arrange` 是服务端智能布局,只在用户明确要求重排/美化时执行。`+dashboard-block-get-data` 读取图表最终计算结果,不返回 block 名称、类型、布局或 `data_config`;需要元数据先用 `+dashboard-block-get`。
|
|
126
|
+
- Workflow 的复杂点是 `steps` 结构。创建、更新或解释完整 workflow 时读入口 [lark-base-workflow-guide.md](references/lark-base-workflow-guide.md) 和 steps JSON SSOT [lark-base-workflow-schema.md](references/lark-base-workflow-schema.md);enable/disable/list 只需确认 workflow ID、当前启停状态和用户意图。
|
|
127
|
+
- Role 的复杂点是权限 JSON。角色操作先读入口 [lark-base-role-guide.md](references/lark-base-role-guide.md);`+role-create` 只支持自定义角色;`+role-update` 是 delta merge;角色 create/update 或解读完整配置时读权限 JSON SSOT [role-config.md](references/role-config.md)。`+role-delete` 只适用于自定义角色,系统角色不可删除;删除角色和关闭高级权限前必须确认目标和影响。
|
|
128
|
+
|
|
129
|
+
## 常见恢复
|
|
130
|
+
|
|
131
|
+
| 错误 / 现象 | 恢复动作 |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `param baseToken is invalid` / `base_token invalid` | 检查是否把 wiki token、workspace token 或完整 URL 当成了 `--base-token`;按入口规则重新获取真实 `base_token` |
|
|
134
|
+
| `not found` 且输入来自 Wiki 链接 | 优先检查是否把 wiki token 当成 base token,不要立刻改走裸 API |
|
|
135
|
+
| `1254045` 字段名不存在 | 重新 `+field-list`,使用真实字段名或字段 ID;注意空格、大小写和跨表字段 |
|
|
136
|
+
| `1254015` 字段值类型不匹配 | 先 `+field-list`,再按 [lark-base-cell-value.md](references/lark-base-cell-value.md) 构造 CellValue |
|
|
137
|
+
| 日期 / 人员 / 超链接字段报格式错误 | 日期用 `YYYY-MM-DD HH:mm:ss`;人员用 `[{ "id": "ou_xxx" }]`;超链接用 URL 或 markdown link 字符串 |
|
|
138
|
+
| formula / lookup 创建失败 | 先读 [formula-field-guide.md](references/formula-field-guide.md) / [lookup-field-guide.md](references/lookup-field-guide.md),再按 guide 重建请求 |
|
|
139
|
+
| `ignored_fields` / `READONLY` | 移除只读字段,只写存储字段 |
|
|
140
|
+
| `1254104` | 批量超过 200,分批调用 |
|
|
141
|
+
| `1254291` | 并发写冲突,串行写入并在批次间短暂等待 |
|
|
142
|
+
| `91403` | 无权限访问该 Base,按 `lark-shared` 权限流程处理,不要盲目重试 |
|
|
143
|
+
|
|
144
|
+
## 保留 Reference
|
|
145
|
+
|
|
146
|
+
- [lark-base-data-analysis-sop.md](references/lark-base-data-analysis-sop.md):查询/统计/全局结论的选路 SOP
|
|
147
|
+
- [lark-base-data-query-guide.md](references/lark-base-data-query-guide.md) / [lark-base-data-query.md](references/lark-base-data-query.md):聚合查询入口 fewshot 与 DSL SSOT
|
|
148
|
+
- [lark-base-cell-value.md](references/lark-base-cell-value.md):记录 CellValue 构造
|
|
149
|
+
- [lark-base-field-json.md](references/lark-base-field-json.md):字段 JSON 构造
|
|
150
|
+
- [formula-field-guide.md](references/formula-field-guide.md) / [lookup-field-guide.md](references/lookup-field-guide.md):公式与 lookup 字段
|
|
151
|
+
- [lark-base-field-create.md](references/lark-base-field-create.md) / [lark-base-field-update.md](references/lark-base-field-update.md):字段创建/更新命令级补充
|
|
152
|
+
- [lark-base-record-upsert.md](references/lark-base-record-upsert.md) / [lark-base-record-batch-create.md](references/lark-base-record-batch-create.md) / [lark-base-record-batch-update.md](references/lark-base-record-batch-update.md) / [lark-base-record-history-list.md](references/lark-base-record-history-list.md):记录写入 JSON 与历史返回解释
|
|
153
|
+
- [lark-base-view-set-filter.md](references/lark-base-view-set-filter.md):视图筛选 JSON
|
|
154
|
+
- [lark-base-form-detail.md](references/lark-base-form-detail.md) / [lark-base-form-submit.md](references/lark-base-form-submit.md) / [lark-base-form-questions-create.md](references/lark-base-form-questions-create.md) / [lark-base-form-questions-update.md](references/lark-base-form-questions-update.md):表单详情、提交和复杂 JSON
|
|
155
|
+
- [lark-base-dashboard.md](references/lark-base-dashboard.md) / [dashboard-block-data-config.md](references/dashboard-block-data-config.md) / [lark-base-dashboard-block-get-data.md](references/lark-base-dashboard-block-get-data.md):仪表盘、组件配置与图表结果协议
|
|
156
|
+
- [lark-base-workflow-guide.md](references/lark-base-workflow-guide.md) / [lark-base-workflow-schema.md](references/lark-base-workflow-schema.md):workflow 入口与 steps JSON SSOT
|
|
157
|
+
- [lark-base-role-guide.md](references/lark-base-role-guide.md) / [role-config.md](references/role-config.md):角色入口与权限 JSON SSOT
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lark-doc
|
|
3
|
+
version: 2.0.0
|
|
4
|
+
description: "飞书云文档(Docx / Wiki 文档,v2 API):读取和编辑飞书文档内容。当用户给出文档 URL 或 token,或需要查看、创建、编辑文档、插入或下载文档图片附件时使用。文档中嵌入的电子表格、多维表格、画板,先用本 skill 提取 token 再切到对应 skill。当用户给出 doubao.com 的 /docx/ 或 /wiki/ URL/token 时,也应直接使用本 skill;路由依据是 URL 路径模式和 token,而不是域名。不负责文档评论管理,也不负责表格或 Base 的数据操作。"
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["lark-cli"]
|
|
8
|
+
cliHelp: "lark-cli docs --api-version v2 --help; lark-cli docs +create --api-version v2 --help; lark-cli docs +fetch --api-version v2 --help; lark-cli docs +update --api-version v2 --help; lark-cli docs +resource-download --help; lark-cli docs +resource-update --help; lark-cli docs +resource-delete --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# docs (v2)
|
|
12
|
+
|
|
13
|
+
**身份:文档操作默认使用 `--as user`。首次使用前执行 `lark-cli auth login`。**
|
|
14
|
+
|
|
15
|
+
> **CRITICAL — API 版本:本 skill 使用 v2 API。执行 `docs +create`、`docs +fetch`、`docs +update` 时必须显式传入 `--api-version v2`。**
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# 常用示例
|
|
19
|
+
lark-cli docs +fetch --api-version v2 --doc "文档URL或token"
|
|
20
|
+
lark-cli docs +create --api-version v2 --content '<title>标题</title><p>内容</p>'
|
|
21
|
+
lark-cli docs +update --api-version v2 --doc "文档URL或token" --command append --content '<p>内容</p>'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 前置条件 — 执行操作前必读
|
|
25
|
+
|
|
26
|
+
**CRITICAL — 执行对应操作前,MUST 先用 Read 工具读取以下文件,缺一不可:**
|
|
27
|
+
1. [`../lark-shared/SKILL.md`](../lark-shared/SKILL.md) — 认证、权限处理、全局参数(所有操作通用)
|
|
28
|
+
2. **读取文档(`docs +fetch --api-version v2`)** → 必读 [`lark-doc-fetch.md`](references/lark-doc-fetch.md)(`--scope` / `--detail` 选择、局部读取策略、`<fragment>` / `<excerpt>` 输出结构)
|
|
29
|
+
3. **创建或编辑文档内容** → 必读 [`lark-doc-xml.md`](references/lark-doc-xml.md)(XML 语法规则,仅当用户明确要求 Markdown 时改读 [`lark-doc-md.md`](references/lark-doc-md.md))和 [`lark-doc-style.md`](references/style/lark-doc-style.md)(元素选择、丰富度规则、颜色语义);从零创建时加读 [`lark-doc-create-workflow.md`](references/style/lark-doc-create-workflow.md);编辑已有文档时加读 [`lark-doc-update.md`](references/lark-doc-update.md) 和 [`lark-doc-update-workflow.md`](references/style/lark-doc-update-workflow.md)
|
|
30
|
+
|
|
31
|
+
**未读完以上文件就执行相应操作会导致参数选择错误或格式错误。**
|
|
32
|
+
|
|
33
|
+
> **格式选择规则(全局):**
|
|
34
|
+
> - **创建 / 导入场景**(`docs +create`,或 `docs +update --command append/overwrite` 的整段写入):XML 和 Markdown 都可以。用户提供 `.md` 本地文件、或明确说"导入 Markdown"时,直接用 Markdown;否则默认 XML(可用 callout、grid、checkbox 等富 block)。
|
|
35
|
+
> - **精准编辑场景**(`docs +update` 的 `str_replace` / `block_insert_after` / `block_replace` / `block_delete` / `block_move_after` 等局部精修指令):优先使用 XML(`--doc-format xml`,即默认值)。XML 能稳定表达 block 结构和样式,局部精修更可控;不要因为 Markdown 更简单就自行切换。
|
|
36
|
+
|
|
37
|
+
## 快速决策
|
|
38
|
+
- 先判定任务路径:找文档 / 导入导出走 [`lark-drive`](../lark-drive/SKILL.md);只读 / 摘要用 `docs +fetch` 默认 `simple`;明确旧文本 → 新文本直接 `str_replace`;只有 block 链接、评论锚点、插入 / 替换 / 删除 / 移动才局部 fetch `with-ids`;保真改写已有内容才读 `full`
|
|
39
|
+
- block 直达链接格式:`文档基础 URL#block_id`;没有 block_id 时局部 fetch `with-ids`
|
|
40
|
+
- 连续执行多个文档写操作时,必须按 [`lark-doc-update.md`](references/lark-doc-update.md) 的「Block ID 生命周期」判断旧 block ID 是否还能复用;`overwrite` / `block_replace` / `block_delete` 后不要复用受影响的旧 ID,插入 / 复制后要重新 fetch 才能拿到新 block ID
|
|
41
|
+
- 用户需要在文档内**创建、复制或移动**资源块(画板、电子表格、多维表格等)时,必须先读取 [`lark-doc-xml.md`](references/lark-doc-xml.md) 的「三、资源块」章节
|
|
42
|
+
- 写文档时,由内容和用户意图决定表达形式;流程、架构、路线图、关键指标等信息可以使用画板,但不要默认把重要信息都画板化
|
|
43
|
+
- 新增画板必须隔离到 SubAgent:简单图由 SubAgent 直接插入 `<whiteboard type="svg">完整 SVG</whiteboard>`,不读 `lark-whiteboard`;复杂图才由主 Agent 先建 `<whiteboard type="blank"></whiteboard>`,再启动 SubAgent 读取 `lark-whiteboard` 写入
|
|
44
|
+
- 用户说"看一下文档里的图片/附件/素材""预览素材" → 用 `lark-cli docs +media-preview`
|
|
45
|
+
- 用户明确说"下载素材" → 用 `lark-cli docs +media-download`
|
|
46
|
+
- 用户明确说"下载/更新/删除文档封面图" → 用 `lark-cli docs +resource-download/+resource-update/+resource-delete --type cover`
|
|
47
|
+
- `resource-*` 目前仅支持 Docx 封面资源;其他图片、附件或素材请走 `+media-*`
|
|
48
|
+
- 如果目标是画板/whiteboard/画板缩略图 → 只能用 `lark-cli docs +media-download --type whiteboard`(不要用 `+media-preview`)
|
|
49
|
+
- 拿到 spreadsheet URL/token 后 → 切到 `lark-sheets` 做对象内部操作
|
|
50
|
+
- 用户说"给文档加评论""查看评论""回复评论""给评论加/删除表情 reaction" → 切到 `lark-drive` 处理
|
|
51
|
+
- 文档内容中出现嵌入的 `<sheet>`、`<bitable>` 或 `<cite file-type="sheets|bitable">` 标签时 → **必须主动提取 token 并切到对应技能下钻读取内部数据**,不能只呈现标签本身
|
|
52
|
+
|
|
53
|
+
| 标签 / 属性 | 提取字段 | 切到技能 |
|
|
54
|
+
|-|-|-|
|
|
55
|
+
| `<sheet token="..." sheet-id="...">` | `token` -> spreadsheet_token, `sheet-id` | [`lark-sheets`](../lark-sheets/SKILL.md) |
|
|
56
|
+
| `<bitable token="..." table-id="...">` | `token` -> app_token, `table-id` | [`lark-base`](../lark-base/SKILL.md) |
|
|
57
|
+
| `<cite type="doc" file-type="sheets" token="..." sheet-id="...">` | 同 `<sheet>` | [`lark-sheets`](../lark-sheets/SKILL.md) |
|
|
58
|
+
| `<cite type="doc" file-type="bitable" token="..." table-id="...">` | 同 `<bitable>` | [`lark-base`](../lark-base/SKILL.md) |
|
|
59
|
+
| `<vc-transcribe-tab vc-node-id="...">` | `vc-node-id` -> note_id | [`lark-note`](../lark-note/SKILL.md):先 `note +detail --note-id <vc-node-id>` |
|
|
60
|
+
| `<synced_reference src-token="..." src-block-id="...">` | `src-token` -> doc_token, `src-block-id` -> block_id | 用 `docs +fetch --api-version v2` 读取 src-token 文档,定位 block |
|
|
61
|
+
|
|
62
|
+
## Shortcuts(推荐优先使用)
|
|
63
|
+
|
|
64
|
+
Shortcut 是对常用操作的高级封装(`lark-cli docs +<verb> [flags]`)。有 Shortcut 的操作优先使用。
|
|
65
|
+
|
|
66
|
+
| Shortcut | 说明 |
|
|
67
|
+
|----------|------|
|
|
68
|
+
| [`+create`](references/lark-doc-create.md) | Create a Lark document (XML / Markdown) |
|
|
69
|
+
| [`+fetch`](references/lark-doc-fetch.md) | Fetch Lark document content (XML / Markdown / im-markdown; `im-markdown` only after fetch for `lark-im`) |
|
|
70
|
+
| [`+update`](references/lark-doc-update.md) | Update a Lark document (str_replace / block_insert_after / block_replace / ...) |
|
|
71
|
+
| [`+media-insert`](references/lark-doc-media-insert.md) | Insert a local image or file at the end of a Lark document (4-step orchestration + auto-rollback). Prefer `--from-clipboard` when the image is already on the system clipboard (screenshots, copy from Feishu/browser); use `--file` only for on-disk sources. |
|
|
72
|
+
| [`+media-download`](references/lark-doc-media-download.md) | Download document media or whiteboard thumbnail (auto-detects extension) |
|
|
73
|
+
| [`+media-preview`](references/lark-doc-media-preview.md) | Preview document media file (auto-detects extension) |
|
|
74
|
+
| [`+resource-download` / `+resource-update` / `+resource-delete`](references/lark-doc-resource-cover.md) | Download, update, or delete a Docx cover image resource with `--type cover` |
|
|
75
|
+
| [`+whiteboard-update`](../lark-whiteboard/references/lark-whiteboard-update.md) | Alias of `whiteboard +update`. Update an existing whiteboard with DSL, Mermaid or PlantUML. Prefer `whiteboard +update`; refer to lark-whiteboard skill for details. |
|
|
76
|
+
|
|
77
|
+
## 不在本 Skill 范围
|
|
78
|
+
|
|
79
|
+
- 文档评论管理 → [`lark-drive`](../lark-drive/SKILL.md)
|
|
80
|
+
- 电子表格或 Base 的数据操作 → [`lark-sheets`](../lark-sheets/SKILL.md) / [`lark-base`](../lark-base/SKILL.md)
|
|
81
|
+
- 云空间文件上传、下载、权限管理 → [`lark-drive`](../lark-drive/SKILL.md)
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lark-shared
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "Use when first setting up lark-cli, running auth login, switching user/bot identity (--as), handling permission denied or scope errors, needing to update lark-cli, or seeing _notice in JSON output."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# lark-cli 共享规则
|
|
8
|
+
|
|
9
|
+
本技能指导你如何通过lark-cli操作飞书资源, 以及有哪些注意事项。
|
|
10
|
+
|
|
11
|
+
## 配置初始化
|
|
12
|
+
|
|
13
|
+
首次使用需运行 `lark-cli config init` 完成应用配置。
|
|
14
|
+
|
|
15
|
+
当你帮用户初始化配置时,使用background方式使用下面的命令发起配置应用流程,启动后读取输出,从中提取授权链接并发给用户。
|
|
16
|
+
|
|
17
|
+
**URL 转发规则**:当命令输出 `verification_url`、`verification_uri_complete`、`console_url` 等 URL 字段时:**必须生成二维码**:你必须调用 `lark-cli auth qrcode` 将 URL 转为二维码并展示给用户,这是必须步骤,不要跳过。优先生成 PNG 二维码(--output);仅当用户明确要求时才使用 ASCII(--ascii)。**URL 输出规则**:将 URL 视为不可修改的 opaque string,不要做任何修改(包括 URL 编码/解码、添加空格或标点、重新拼接 query),二维码和链接请一起展示给用户。
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 发起配置(该命令会阻塞直到用户打开链接并完成操作或过期)
|
|
21
|
+
lark-cli config init --new
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 认证
|
|
25
|
+
|
|
26
|
+
### 身份类型
|
|
27
|
+
|
|
28
|
+
两种身份类型,通过 `--as` 切换:
|
|
29
|
+
|
|
30
|
+
| 身份 | 标识 | 获取方式 | 适用场景 |
|
|
31
|
+
|------|------|---------|---------|
|
|
32
|
+
| user 用户身份 | `--as user` | `lark-cli auth login` 等 | 访问用户自己的资源(日历、云空间/云盘/云存储等) |
|
|
33
|
+
| bot 应用身份 | `--as bot` | 自动,只需 appId + appSecret | 应用级操作,访问bot自己的资源 |
|
|
34
|
+
|
|
35
|
+
### 身份选择原则
|
|
36
|
+
|
|
37
|
+
输出的 `[identity: bot/user]` 代表当前身份。bot 与 user 表现差异很大,需确认身份符合目标需求:
|
|
38
|
+
|
|
39
|
+
- **Bot 看不到用户资源**:无法访问用户的日历、云空间(云盘/云存储)文档、邮箱等个人资源。例如 `--as bot` 查日程返回 bot 自己的(空)日历
|
|
40
|
+
- **Bot 无法代表用户操作**:发消息以应用名义发送,创建文档归属 bot
|
|
41
|
+
- **Bot 权限**:只需在飞书开发者后台开通 scope,无需 `auth login`
|
|
42
|
+
- **User 权限**:后台开通 scope + 用户通过 `auth login` 授权,两层都要满足
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### 权限不足处理
|
|
46
|
+
|
|
47
|
+
遇到权限相关错误时,**根据当前身份类型采取不同解决方案**。
|
|
48
|
+
|
|
49
|
+
错误响应中包含关键信息:
|
|
50
|
+
- `permission_violations`:列出缺失的 scope (N选1)
|
|
51
|
+
- `console_url`:飞书开发者后台的权限配置链接
|
|
52
|
+
- `hint`:建议的修复命令
|
|
53
|
+
|
|
54
|
+
#### Bot 身份(`--as bot`)
|
|
55
|
+
|
|
56
|
+
将错误中的 `console_url` 原样提供给用户,引导去后台开通 scope。**禁止**对 bot 执行 `auth login`。
|
|
57
|
+
|
|
58
|
+
#### User 身份(`--as user`)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
lark-cli auth login --domain <domain> # 按业务域授权
|
|
62
|
+
lark-cli auth login --scope "<missing_scope>" # 按具体 scope 授权(推荐,符合最小权限原则)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**规则**:auth login 必须指定范围(`--domain` 或 `--scope`)。多次 login 的 scope 会累积(增量授权)。
|
|
66
|
+
|
|
67
|
+
#### Agent 代理发起认证(推荐)
|
|
68
|
+
|
|
69
|
+
当你作为 AI agent 需要帮用户完成认证时,优先使用 split-flow,避免在同一轮对话中阻塞等待用户授权:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# 发起授权(立即返回 device_code 和 verification_url)
|
|
73
|
+
lark-cli auth login --scope "calendar:calendar:readonly" --no-wait --json
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
拿到 `verification_url` 后,将它原样作为本轮最终消息发给用户,并结束本轮/交还控制权。不要在同一轮中展示 URL 后立刻执行 `--device-code` 阻塞轮询;在不透传中间输出的 agent harness 里,这会导致用户永远看不到 URL。
|
|
77
|
+
|
|
78
|
+
用户回复已完成授权后,再在后续步骤执行:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
lark-cli auth login --device-code <device_code>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Split-Flow 完整步骤**:
|
|
85
|
+
|
|
86
|
+
**第一步:发起授权(当前轮)**
|
|
87
|
+
|
|
88
|
+
1. 执行 `lark-cli auth login --scope "xxx" --no-wait --json`(必须加 `--no-wait --json`)
|
|
89
|
+
2. 从 JSON 输出中提取 `verification_url` 和 `device_code`
|
|
90
|
+
3. 生成二维码:`lark-cli auth qrcode <verification_url> --output "xxx"`
|
|
91
|
+
4. 将 URL 和二维码展示给用户(先 URL,后二维码)
|
|
92
|
+
5. **结束本轮对话前,必须明确告知用户**:"请完成授权后,回来告诉我已授权完成,我会帮你完成后续步骤"
|
|
93
|
+
|
|
94
|
+
**第二步:完成授权(后续轮)**
|
|
95
|
+
|
|
96
|
+
1. 等待用户回复"已完成授权"
|
|
97
|
+
2. **由你(AI agent)亲自执行**:`lark-cli auth login --device-code <device_code>`
|
|
98
|
+
3. 此命令会轮询授权状态并完成登录
|
|
99
|
+
4. 如果返回授权成功,流程结束
|
|
100
|
+
|
|
101
|
+
**关键规则**:
|
|
102
|
+
|
|
103
|
+
- **你必须亲自执行 `--device-code` 命令**,不要指示用户自行执行
|
|
104
|
+
- **不要在同一轮中展示 URL 后立刻执行 `--device-code`**,这会导致用户看不到 URL
|
|
105
|
+
- **禁止缓存 `verification_url` 或 `device_code`**:每次需要授权时,必须重新执行 `lark-cli auth login --no-wait --json` 生成新的链接。不要将授权链接和 device code 存入上下文供后续复用
|
|
106
|
+
|
|
107
|
+
## 更新检查
|
|
108
|
+
|
|
109
|
+
lark-cli 命令执行后,如果检测到新版本,JSON 输出中会包含 `_notice.update` 字段(含 `message`、`command` 等)。
|
|
110
|
+
|
|
111
|
+
**当你在输出中看到 `_notice.update` 时,完成用户当前请求后,主动提议帮用户更新**:
|
|
112
|
+
|
|
113
|
+
1. 告知用户当前版本和最新版本号
|
|
114
|
+
2. 提议执行更新(同时更新 CLI 和 Skills):
|
|
115
|
+
```bash
|
|
116
|
+
lark-cli update
|
|
117
|
+
```
|
|
118
|
+
3. 更新完成后提醒用户:**退出并重新打开 AI Agent** 以加载最新 Skills
|
|
119
|
+
|
|
120
|
+
**重要**:始终使用 `lark-cli update` 更新,它会同时更新 CLI 和 AI Skills。
|
|
121
|
+
|
|
122
|
+
**规则**:不要静默忽略更新提示。即使当前任务与更新无关,也应在完成用户请求后补充告知。
|
|
123
|
+
|
|
124
|
+
## 安全规则
|
|
125
|
+
|
|
126
|
+
- **禁止输出密钥**(appSecret、accessToken)到终端明文。
|
|
127
|
+
- **写入/删除操作前必须确认用户意图**。
|
|
128
|
+
- 用 `--dry-run` 预览危险请求。
|
|
129
|
+
- **文件路径只接受相对路径**:`--file`、`--output`、`--output-dir`、`@file` 等路径参数只接受 cwd 下的相对路径,传绝对路径会报 `unsafe file path`。数据输入(`@file`、大 JSON)优先用 stdin 传入,避免路径和转义问题。
|
|
130
|
+
|
|
131
|
+
## 高风险操作的审批协议(exit 10)
|
|
132
|
+
|
|
133
|
+
lark-cli 对高风险写操作(`risk: "high-risk-write"`)有强制确认门禁。当你不带 `--yes` 调用这类命令时,CLI 会退出码 `10`、并在 stderr 返回如下结构化 envelope:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"ok": false,
|
|
138
|
+
"error": {
|
|
139
|
+
"type": "confirmation_required",
|
|
140
|
+
"message": "drive +delete requires confirmation",
|
|
141
|
+
"hint": "add --yes to confirm",
|
|
142
|
+
"risk": {
|
|
143
|
+
"level": "high-risk-write",
|
|
144
|
+
"action": "drive +delete"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**遇到这种情况,不要当普通错误放弃。** 按以下流程处理:
|
|
151
|
+
|
|
152
|
+
1. **识别**:看到子进程 exit code = `10` 且 stderr JSON 里 `error.type == "confirmation_required"`
|
|
153
|
+
2. **向用户确认**:把 `error.risk.action` 和关键参数展示给用户,明确告知"这是高风险操作",等待用户显式同意
|
|
154
|
+
3. **用户同意** → 在你**原始 argv 的末尾追加 `--yes`** 后重试
|
|
155
|
+
4. **用户拒绝** → 终止流程,不要擅自改写参数或跳过门禁
|
|
156
|
+
|
|
157
|
+
**绝对不允许**:
|
|
158
|
+
- 看到 exit 10 就默认加 `--yes` 静默重试(这等于禁用门禁)
|
|
159
|
+
- 把 `confirmation_required` 当网络错误/权限错误处理
|
|
160
|
+
- 在用户没明确同意的前提下追加 `--yes` 重试
|
|
161
|
+
- 用 `sh -c` 等 shell 方式拼接命令重试——用 `exec.Command(argv...)` 参数数组形式,避免 shell 解析把用户参数当作语法
|
|
162
|
+
|
|
163
|
+
提前预判:想先让用户 review 危险操作的具体请求,调用时加 `--dry-run`——它不触发门禁,会打印完整请求详情(URL / body / params),你可以把这个预览给用户看过再去真正执行。
|
|
164
|
+
|
|
165
|
+
### 如何识别一条命令是高风险
|
|
166
|
+
|
|
167
|
+
- shortcut:`lark-cli <service> +<cmd> --help` 顶部会显示 `Risk: high-risk-write`
|
|
168
|
+
- service 命令:`lark-cli schema <service>.<resource>.<method> --format json` 的返回值里 `"risk": "high-risk-write"`
|