fix(base): clarify table-id tbl prefix requirement#270
Conversation
📝 WalkthroughWalkthroughTwo files updated to clarify that table IDs must start with the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR clarifies the Confidence Score: 5/5Safe to merge — changes are purely descriptive/documentation with no logic changes. Both changed files contain only documentation string updates; no logic, API, or schema is affected. The only remaining finding is a P2 suggestion to extend the same doc update to sibling reference files. No files require special attention. The sibling .md files are a P2 completeness suggestion, not a blocker. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User provides --table-id] --> B{Is it an ID or a name?}
B -->|Name| C[Resolve by name match]
B -->|ID| D{Starts with 'tbl'?}
D -->|Yes| E[Use directly as table_id in API call]
D -->|No| F[⚠️ Ask user which table, or run +table-list to confirm]
C --> G[Proceed with API call]
E --> G
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
skills/lark-base/references/lark-base-table-get.md (1)
39-39: Clarify the intended audience for this guidance.The warning states "如果
--table-id传的是id,必须是tbl开头;不是的话先询问用户具体是哪张表,或先用+table-list查表列表再确认" (If--table-idis anid, it must start withtbl; if not, ask the user which table they mean, or use+table-listfirst).The phrase "先询问用户" (ask the user) suggests this guidance is for developers or AI assistants helping users, not for end users directly. Consider clarifying:
- Is this validation performed by the CLI tool automatically, or is it manual guidance?
- If it's for AI assistants/helpers, should this be in a separate developer guide rather than user-facing reference documentation?
📝 Suggested rewording for clarity
If this is guidance for users encountering errors:
-- ⚠️ 如果 `--table-id` 传的是 `id`,必须是 `tbl` 开头;不是的话先询问用户具体是哪张表,或先用 `+table-list` 查表列表再确认。 +- ⚠️ 如果 `--table-id` 传的是 `id`,必须是 `tbl` 开头的表 ID(例如 `tbl_xxx`)。如果不确定表 ID,可以先用 `+table-list` 查询表列表。If this is guidance for AI assistants/developers:
-- ⚠️ 如果 `--table-id` 传的是 `id`,必须是 `tbl` 开头;不是的话先询问用户具体是哪张表,或先用 `+table-list` 查表列表再确认。 +- ⚠️ **开发者注意:** 如果 `--table-id` 传的是 `id`,必须是 `tbl` 开头;不是的话先询问用户具体是哪张表,或建议用户先用 `+table-list` 查表列表再确认。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/lark-base/references/lark-base-table-get.md` at line 39, The warning about `--table-id` requiring IDs to start with `tbl` is ambiguous about the intended audience; update the text around the `--table-id` guidance in lark-base-table-get.md to state whether the CLI performs this validation automatically or whether this is an instruction for AI assistants/developers, and if it is for assistants, move or duplicate the guidance into developer-facing docs (or prepend a note like "For assistants/developers: ..."). Mention the specific symbols `--table-id` and `+table-list` in the rewritten sentence so readers know the exact commands referenced.shortcuts/base/base_command_common.go (1)
17-17: Client-side validation for tbl prefix would improve user experience, but is not required since the Lark API enforces it.The flag description correctly states table IDs "must start with tbl if ID"—this is enforced by the Lark API, which returns error code 1254004 ("WrongTableId") for invalid IDs. However, the current implementation relies on API-side validation rather than catching this upfront. While functional, users would receive API error responses instead of clear CLI feedback. Adding client-side validation in
resolveTableRefwould provide better error messages and fail faster.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@shortcuts/base/base_command_common.go` at line 17, Add client-side validation in resolveTableRef to detect and reject invalid table IDs before calling the API: if the provided table-ref (from the "table-id" flag) appears to be an ID form but does not start with the "tbl" prefix, return a clear CLI error explaining "table IDs must start with 'tbl'"; implement this check at the start of resolveTableRef (and/or where the "table-id" flag is parsed) so users get immediate, friendly feedback instead of an API WrongTableId (1254004) response.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@shortcuts/base/base_command_common.go`:
- Line 17: Add client-side validation in resolveTableRef to detect and reject
invalid table IDs before calling the API: if the provided table-ref (from the
"table-id" flag) appears to be an ID form but does not start with the "tbl"
prefix, return a clear CLI error explaining "table IDs must start with 'tbl'";
implement this check at the start of resolveTableRef (and/or where the
"table-id" flag is parsed) so users get immediate, friendly feedback instead of
an API WrongTableId (1254004) response.
In `@skills/lark-base/references/lark-base-table-get.md`:
- Line 39: The warning about `--table-id` requiring IDs to start with `tbl` is
ambiguous about the intended audience; update the text around the `--table-id`
guidance in lark-base-table-get.md to state whether the CLI performs this
validation automatically or whether this is an instruction for AI
assistants/developers, and if it is for assistants, move or duplicate the
guidance into developer-facing docs (or prepend a note like "For
assistants/developers: ..."). Mention the specific symbols `--table-id` and
`+table-list` in the rewritten sentence so readers know the exact commands
referenced.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a0dbe63c-b491-4f35-92d2-92078f34037d
📒 Files selected for processing (2)
shortcuts/base/base_command_common.goskills/lark-base/references/lark-base-table-get.md
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@1bdc919b4ef82ddf3f7c38458977b7f7bdc0872f🧩 Skill updatenpx skills add larksuite/cli#fix/base-table-id-tbl-prefix -y -g |
Summary
Clarifies
--table-idusage for Base table operations by explicitly stating that when an ID is provided, it must start withtbl, while table names are still supported.Changes
shortcuts/base/base_command_common.goto:table ID (must start with tbl if ID) or name.skills/lark-base/references/lark-base-table-get.mdparameter docs to emphasize thetblprefix rule for IDs.skills/lark-base/references/lark-base-table-get.mdto guide users to ask for the target table or run+table-listwhen input is not a validtbl_*ID.Test Plan
lark xxxcommand works as expectedRelated Issues