|
| 1 | +--- |
| 2 | +name: infinitrain-feishu-writer |
| 3 | +description: Use when provisioning InfiniTrain Feishu benchmark spreadsheets, creating machine/tag folders, copying model template sheets, granting document-app access, updating scripts/feishu_writer/token.json, or preparing write_to_feishu_sheet.py to run. |
| 4 | +--- |
| 5 | + |
| 6 | +# InfiniTrain Feishu Writer |
| 7 | + |
| 8 | +Use this skill for InfiniTrain benchmark result provisioning. The deterministic implementation is `scripts/feishu_writer/provision_feishu_sheets.py`; prefer running or patching that script instead of reconstructing raw `lark-cli` calls by hand. |
| 9 | + |
| 10 | +## Required Context |
| 11 | + |
| 12 | +Read only what is needed: |
| 13 | +- `scripts/feishu_writer/README.md` for user-facing commands and token JSON schema. |
| 14 | +- `scripts/logs/` to discover already-run benchmark tags for new-machine provisioning. |
| 15 | +- `scripts/test_config.json` only as secondary context for benchmark definitions. |
| 16 | +- `scripts/feishu_writer/token.json` for `APP_ID`, existing tag tokens, and optional `FEISHU_PROVISION`; never print `APP_SECRET`. |
| 17 | + |
| 18 | +Also use the Lark skills: |
| 19 | +- `lark-shared` for auth, identity, scope, and high-risk write handling. |
| 20 | +- `lark-drive` for folders, file copy, and permission member creation. |
| 21 | +- `lark-sheets` for spreadsheet info checks. |
| 22 | + |
| 23 | +## Defaults |
| 24 | + |
| 25 | +- Root folder token: `MW8Nfsd3ulIRmpdYSo1c7EBsn1G` |
| 26 | +- GPT2 template token: `X5mJskjzSh2mo3tzuERccAYxnib` |
| 27 | +- LLAMA3 template token: `NtT3syaRThyGXDtQyzdcpiyfnXd` |
| 28 | +- New machine folder name default: `yyyymm <hostname>` unless the user provides `--machine-folder-name`. |
| 29 | +- Permission default: grant `edit` to `APP_ID` as `member_type=appid`. |
| 30 | + |
| 31 | +## Workflow |
| 32 | + |
| 33 | +1. Summarize `scripts/feishu_writer/token.json` structurally only: keys, tags, model names, machine folder presence. Do not display secrets. |
| 34 | +2. Ensure the user identity has the required Feishu scopes before provisioning. The tested minimum scopes are `space:document:retrieve`, `space:folder:create`, `docs:document:copy`, `docs:permission.member:create`, and `sheets:spreadsheet.meta:read`. |
| 35 | +3. For a new machine, dry-run a fresh output token file: |
| 36 | + ```bash |
| 37 | + python3 scripts/feishu_writer/provision_feishu_sheets.py --new-machine --machine-folder-name "202605 machine-name" --dry-run |
| 38 | + ``` |
| 39 | + The tag list is discovered from `scripts/logs/<tag>/<model>_*.log` unless `--tags` is passed. Execute with `--yes`; this writes `scripts/feishu_writer/new_token.json` by default. |
| 40 | +4. For an existing machine or a new tag, dry-run an in-place update: |
| 41 | + ```bash |
| 42 | + python3 scripts/feishu_writer/provision_feishu_sheets.py --tags new_tag --dry-run |
| 43 | + ``` |
| 44 | + The script checks `scripts/logs/new_tag` and warns if no model logs exist, but still provisions the tag. Narrow scope with `--tags tag1,tag2`, `--models GPT2,LLAMA3`, or `--machine-folder-name "202605 machine-name"` when needed. |
| 45 | +5. If the plan is correct and the user asked to execute, run with `--yes`: |
| 46 | + ```bash |
| 47 | + python3 scripts/feishu_writer/provision_feishu_sheets.py --yes |
| 48 | + ``` |
| 49 | +6. If provisioning was interrupted after creating/copying some resources, rerun with `--grant-existing` so existing spreadsheets also receive app permission and template checks: |
| 50 | + ```bash |
| 51 | + python3 scripts/feishu_writer/provision_feishu_sheets.py --new-machine --yes --grant-existing |
| 52 | + ``` |
| 53 | +7. For an existing machine folder, pass either `--machine-folder-token <folder_token>` or rely on `FEISHU_PROVISION.machine_folder_token` in `scripts/feishu_writer/token.json`. |
| 54 | +8. After provisioning, write results with the generated config: |
| 55 | + ```bash |
| 56 | + python3 scripts/feishu_writer/write_to_feishu_sheet.py scripts/feishu_writer/token.json |
| 57 | + python3 scripts/feishu_writer/write_to_feishu_sheet.py scripts/feishu_writer/new_token.json |
| 58 | + ``` |
| 59 | + |
| 60 | +## Safety |
| 61 | + |
| 62 | +- `scripts/feishu_writer/token.json` is local secret-bearing state and must stay ignored by Git. |
| 63 | +- `scripts/feishu_writer/new_token*.json` is also secret-bearing output and must stay ignored by Git. |
| 64 | +- Use `--dry-run` before writes unless the user explicitly asks for immediate execution. |
| 65 | +- The provisioning script requires `--yes` for mutations and passes `--yes` to high-risk Lark operations only then. |
| 66 | +- If permission creation says the collaborator already exists, treat it as successful. |
| 67 | +- If a model template is added later, use `--template-token MODEL=TOKEN` or add it under `FEISHU_PROVISION.model_templates` in `scripts/feishu_writer/token.json`. |
0 commit comments