feat: add okr single create shortcut & skill text opti#1941
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughAdds an ChangesOKR workflows
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant CLI
participant OKRCreate
participant OKRv2API
CLI->>OKRCreate: provide creation flags and content
OKRCreate->>OKRv2API: POST objective or key-result request
OKRv2API-->>OKRCreate: return created identifier
OKRCreate-->>CLI: print creation result
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@6959399ec49cff55bf755ec0ffecfca449484f0b🧩 Skill updatenpx skills add larksuite/cli#feat/okr_single_create_v2 -y -g |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@shortcuts/okr/okr_create_test.go`:
- Around line 351-363: Update the dry-run contract assertions at
shortcuts/okr/okr_create_test.go:351-363 to parse the structured envelope and
assert the objective API method, exact path, query fields, and serialized
content body; apply the same structured assertions at
shortcuts/okr/okr_create_test.go:381-390 for the key-result method, path, and
rich-text body. Replace substring method/path checks with exact structured-field
assertions at tests/cli_e2e/okr/okr_shortcuts_test.go:41-45 and
tests/cli_e2e/okr/okr_shortcuts_test.go:68-72, preserving the existing expected
API values.
In `@shortcuts/okr/okr_create.go`:
- Around line 126-149: Add typed validation in the level switch around the
existing cycleID and objectiveID handling: reject --objective-id when level is
"objective" and reject --cycle-id when level is "key-result", before processing
the applicable identifier. Use the existing errs.NewValidationError pattern with
the corresponding option parameter, while preserving current validation for
identifiers that apply to the selected level.
- Around line 46-89: Update the JSON decoding in the simple-style and
ContentBlock branches of the content parsing flow to reject unknown fields,
including typos such as “mentions.” Use strict decoder behavior for both
SemiPlainContent and ContentBlock, and preserve the existing typed --content
validation errors by wrapping unknown-field decode failures with the same
validation error context and cause.
- Around line 162-185: Replace the loose map contracts in the OKR create flow
with typed request, query, response, and output structs. Add one explicit
projection function per required map shape for the objective and key-result API
calls, and pass the typed models through CallAPITyped. Apply the same boundary
conversion to the response extraction and output payload sections referenced at
the additional locations, preserving their existing fields and behavior.
In `@shortcuts/okr/okr_cycle_list.go`:
- Around line 67-70: Update the month-cycle guard in the cycle classification
logic to compare cycleEnd against the next-month boundary derived from
cycleStart, rather than using AddDate with a one-year offset. Add coverage for
this month-cycle path in TestIsCurrentActiveCycle while preserving existing
behavior for other cycle types.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c9bf3b10-03f8-4ff5-bee7-d0abdc475dc0
📒 Files selected for processing (9)
shortcuts/okr/okr_create.goshortcuts/okr/okr_create_test.goshortcuts/okr/okr_cycle_list.goshortcuts/okr/shortcuts.goshortcuts/okr/shortcuts_test.goskills/lark-okr/SKILL.mdskills/lark-okr/references/lark-okr-create.mdskills/lark-okr/references/lark-okr-entities.mdtests/cli_e2e/okr/okr_shortcuts_test.go
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1941 +/- ##
==========================================
+ Coverage 74.66% 75.02% +0.35%
==========================================
Files 878 895 +17
Lines 91764 94483 +2719
==========================================
+ Hits 68520 70889 +2369
- Misses 17930 18164 +234
- Partials 5314 5430 +116 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
skills/lark-okr/SKILL.md (1)
111-113: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRestore creation operations in the API resource index.
The new
+createworkflow is documented, but its Objective and Key Result creation operations are absent from the API Resources index. Restore both entries, or explicitly document the actual endpoints used by the shortcut.
skills/lark-okr/SKILL.md#L111-L113: restore the Objectivecreateoperation.skills/lark-okr/SKILL.md#L155-L156: restore the Key Resultcreateoperation.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@skills/lark-okr/SKILL.md` around lines 111 - 113, The API Resources index omits creation operations required by the documented +create workflow. In skills/lark-okr/SKILL.md lines 111-113, restore the Objective create entry under cycle.objectives, and in lines 155-156, restore the Key Result create entry; if the shortcut uses different endpoints, document those actual endpoints instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@shortcuts/okr/okr_cycle_list_test.go`:
- Around line 125-140: The validation tests for
TestCycleListValidate_InvalidPageSize in
shortcuts/okr/okr_cycle_list_test.go:125-140 and the corresponding progress-list
test in shortcuts/okr/okr_progress_list_test.go:128-144 should assert the typed
pagination validation error fields directly. Verify the error classification and
that its parameter identifies --page-size, replacing the string-substring check
while preserving the invalid-input failure assertion.
In `@shortcuts/okr/okr_progress_list.go`:
- Around line 79-80: Update the page-token handling in the OKR progress list
flow to preserve the value returned by runtime.Str("page-token") exactly,
without strings.TrimSpace or any other normalization, in both affected
locations. Continue omitting the parameter only when the original value is
empty, so Validate, DryRun, and Execute transmit identical tokens.
In `@skills/lark-okr/references/lark-okr-cycle-list.md`:
- Around line 10-11: Update the example labels to reflect single-page retrieval:
in skills/lark-okr/references/lark-okr-cycle-list.md lines 10-11, describe the
default invocation as retrieving the first page; in
skills/lark-okr/references/lark-okr-progress-list.md line 5, rename the
key-result example so it does not claim to list all records.
---
Outside diff comments:
In `@skills/lark-okr/SKILL.md`:
- Around line 111-113: The API Resources index omits creation operations
required by the documented +create workflow. In skills/lark-okr/SKILL.md lines
111-113, restore the Objective create entry under cycle.objectives, and in lines
155-156, restore the Key Result create entry; if the shortcut uses different
endpoints, document those actual endpoints instead.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7d94b0c9-56ca-4f9e-8b5b-1b96edff1ff9
📒 Files selected for processing (10)
shortcuts/okr/okr_create_test.goshortcuts/okr/okr_cycle_list.goshortcuts/okr/okr_cycle_list_test.goshortcuts/okr/okr_progress_list.goshortcuts/okr/okr_progress_list_test.goskills/lark-okr/SKILL.mdskills/lark-okr/references/lark-okr-cycle-list.mdskills/lark-okr/references/lark-okr-progress-list.mdtests/cli_e2e/okr/okr_cycle_list_test.gotests/cli_e2e/okr/okr_progress_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- shortcuts/okr/okr_create_test.go
7818160 to
6959399
Compare
Summary
This PR adds a single-item OKR creation shortcut so agents can create one Objective or add one Key Result without using the batch-create flow. It also updates the OKR skill guidance to make common read, create, progress, score, and alignment paths easier for agents to choose correctly.
Changes
lark-cli okr +createfor single Objective creation and single Key Result creation under an existing Objective.+create, including level-specific ID requirements,simpleandrichtextcontent parsing, and typed validation errors.+createreference docs, and clearer guidance that separates score updates from progress/completion updates.Test Plan
lark-cli okr +createflow works as expectedRelated Issues
Summary by CodeRabbit
okr +createto create objectives or key results withsimple/richtextcontent, including--dry-runpreviews and creation confirmations.+cycle-listand+progress-listwith--page-size/--page-token, returninghas_more/page_token.+createreference pages, and updated cycle/progress pagination semantics.+createvalidation and pagination, including error handling and live+createflows.