Skip to content

Feat/okr semi plain text and patch#1671

Merged
syh-cpdsss merged 1 commit into
mainfrom
feat/okr-semi-plain-text-and-patch
Jul 2, 2026
Merged

Feat/okr semi plain text and patch#1671
syh-cpdsss merged 1 commit into
mainfrom
feat/okr-semi-plain-text-and-patch

Conversation

@syh-cpdsss

@syh-cpdsss syh-cpdsss commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR enhances the OKR skill with three major improvements: semi-plain text content format with mention position preservation, a new +patch shortcut for partial updates, and simplified +cycle-list response with pre-computed active cycle detection. Additionally, it adds comprehensive skill documentation for native alignment and indicator APIs to guide agents through complex OKR workflows.

Changes

  • Semi-plain text format (shortcuts/okr/okr_openapi.go): Introduced SemiPlainContent struct and conversion methods that preserve mention positions when converting between ContentBlock and simplified text format, enabling lossless round-trip conversions for OKR content editing.
  • New +patch shortcut (shortcuts/okr/okr_patch.go): Partial update shortcut for Objectives and Key Results supporting content, notes, score, and deadline fields. Supports both simple (semi-plain JSON) and richtext (full ContentBlock) input styles with comprehensive validation.
  • Simplified +cycle-list response (shortcuts/okr/okr_cycle_list.go): Removed rarely-used fields (create_time, update_time, owner, score, tenant_cycle_id) to reduce payload size. Added current_active_cycles field that pre-filters cycles where current time falls within the period and status is default/normal, eliminating the need for agents to manually compare timestamps.
  • Alignment API guide (skills/lark-okr/references/lark-okr-alignments.md): Combined workflow documentation for objective.alignments list, objective.alignments create, and alignments delete native APIs with parameter tables, examples, and complete usage workflows.
  • Indicator API guide (skills/lark-okr/references/lark-okr-indicators.md): Combined workflow documentation for objective.indicators list, key_result.indicators list, and indicators patch native APIs, including field descriptions, update restrictions, and when to use vs. the +indicator-update shortcut.
  • Skill documentation updates (skills/lark-okr/SKILL.md): Added +patch shortcut to the shortcuts table, and linked new API guides in the API Resources section for alignments and indicators.
  • Comprehensive tests: Added unit tests for +patch shortcut (1172 lines), isCurrentActiveCycle function (10 scenarios), and updated existing tests to reflect simplified response structures.
  • E2E tests: Added dry-run and live E2E tests for +patch shortcut and progress shortcuts in tests/cli_e2e/okr/.

Test Plan

  • Unit tests pass (make unit-test)
  • go vet ./... passes
  • gofmt -l . produces no output
  • go mod tidy does not change go.mod/go.sum
  • Manual local verification confirms the lark-cli okr <command> flow works as expected:
    • lark-cli okr +patch --level objective --target-id <id> --content '{"text":"test","mention":[]}' --as user
    • lark-cli okr +patch --level key-result --target-id <id> --score 0.7 --as user
    • lark-cli okr +cycle-list --user-id <id> --as user returns simplified structure with current_active_cycles
    • lark-cli okr objective.alignments list --objective-id <id> --as user
    • lark-cli okr objective.indicators list --objective-id <id> --as user
  • Dry-run E2E tests pass (go test ./tests/cli_e2e/okr/...)
  • Live E2E tests pass with valid credentials

Related Issues

  • None

Summary by CodeRabbit

  • New Features
    • Added okr +patch to incrementally update objective/key result fields (supports --dry-run).
    • Added --style (simple/richtext, default simple) to +cycle-detail and progress commands (+progress-create/get/update), changing request/response and console output accordingly.
    • Enhanced +cycle-list with current_active_cycles (and “Current active cycle(s)” output when present).
  • Bug Fixes
    • Improved cycle overlap and active-cycle detection with consistent UTC time handling.
  • Documentation
    • Updated OKR reference docs for +patch, cycle list/detail, progress commands, and SemiPlainContent formatting behavior.
  • Tests
    • Expanded unit and CLI end-to-end coverage for style-dependent payloads/output.

@github-actions github-actions Bot added the size/XL Architecture-level or global-impact change label Jun 30, 2026
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds SemiPlainContent conversion helpers, style-aware OKR shortcuts for simple and richtext output/input, a new incremental patch shortcut, current active cycle detection, and updated docs and tests for the new response and content formats.

Changes

OKR Style Mode, Patch Shortcut, and Cycle Enhancements

Layer / File(s) Summary
Content conversions and response shapes
shortcuts/okr/okr_openapi.go, shortcuts/okr/okr_openapi_test.go, shortcuts/okr/okr_batch_create.go, shortcuts/okr/okr_batch_create_test.go, shortcuts/okr/okr_cli_resp.go
Adds SemiPlainDoc/SemiPlainContent, ToSemiPlain(), ToContentBlock(), and BuildContentBlock(). Trims RespCycle to ID/StartTime/EndTime/CycleStatus, and adds RespKeyResultSimple, RespObjectiveSimple, RespProgressSimple plus ToSimple() methods.
Cycle list and cycle-detail style branching
shortcuts/okr/okr_cycle_list.go, shortcuts/okr/okr_cycle_list_test.go, shortcuts/okr/okr_cycle_detail.go, tests/cli_e2e/okr/okr_cycle_detail_test.go
Normalizes cycle overlap checks to UTC, derives current_active_cycles, and adds style-aware branching for cycle-detail output and validation.
Progress create, update, and get styles
shortcuts/okr/okr_progress_create.go, shortcuts/okr/okr_progress_update.go, shortcuts/okr/okr_progress_get.go, shortcuts/okr/okr_progress_create_test.go, shortcuts/okr/okr_progress_update_test.go, tests/cli_e2e/okr/okr_progress_test.go
Adds --style flags, style-dependent parsing and validation, and simple/richtext output handling for progress create/update/get, with matching unit and E2E coverage.
New +patch shortcut and tests
shortcuts/okr/okr_patch.go, shortcuts/okr/shortcuts.go, shortcuts/okr/okr_patch_test.go, tests/cli_e2e/okr/okr_shortcuts_test.go
Adds OKRPatch with parameter parsing, validation, dry-run, execute, registration, and coverage for validation, dry-run, execution, and score rounding.
Docs and skill references
skills/lark-okr/SKILL.md, skills/lark-okr/references/lark-okr-*.md
Updates the OKR skill guide and reference docs for content formats, style flags, cycle output, patch behavior, alignments, and indicators.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • larksuite/cli#522: Directly related OKR shortcut and response/conversion changes in the same area.
  • larksuite/cli#1487: Introduces the shared BuildContentBlock(...) helper now used by batch create.
  • larksuite/cli#574: Adds related progress response formatting changes that this PR extends.

Suggested labels

feature

Suggested reviewers

  • zhangzq0

Poem

A bunny with a style flag gave a hop and a cheer,
simple and richtext now both appear.
With patching and cycles and docs in the nest,
the OKR garden is hopping at best. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.54% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main changes: semi-plain OKR content support and the new patch shortcut.
Description check ✅ Passed The description follows the required template and covers summary, changes, test plan, and related issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/okr-semi-plain-text-and-patch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.20430% with 183 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.45%. Comparing base (3bda9e1) to head (3fc2a6c).

Files with missing lines Patch % Lines
shortcuts/okr/okr_cycle_detail.go 28.35% 45 Missing and 3 partials ⚠️
shortcuts/okr/okr_patch.go 79.51% 22 Missing and 12 partials ⚠️
shortcuts/okr/okr_progress_create.go 55.55% 19 Missing and 9 partials ⚠️
shortcuts/okr/okr_progress_update.go 55.55% 19 Missing and 9 partials ⚠️
shortcuts/okr/okr_progress_get.go 25.80% 21 Missing and 2 partials ⚠️
shortcuts/okr/okr_cli_resp.go 73.91% 12 Missing and 6 partials ⚠️
shortcuts/okr/okr_cycle_list.go 85.71% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1671      +/-   ##
==========================================
- Coverage   74.48%   74.45%   -0.04%     
==========================================
  Files         850      851       +1     
  Lines       86703    87129     +426     
==========================================
+ Hits        64583    64873     +290     
- Misses      17175    17282     +107     
- Partials     4945     4974      +29     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@3fc2a6c4c108e697675b87e53f7cbf469c1fb220

🧩 Skill update

npx skills add larksuite/cli#feat/okr-semi-plain-text-and-patch -y -g

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
shortcuts/okr/okr_cycle_list_test.go (1)

393-419: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Avoid hard-coding a “current” cycle to 2026.

Execute uses time.Now(), so this fixture stops being active after 2026-12-31 and the test will start failing. Build the mocked timestamps relative to time.Now().UTC() instead.

Proposed deterministic fixture shape
+	now := time.Now().UTC()
+	ms := func(t time.Time) string {
+		return strconv.FormatInt(t.UnixMilli(), 10)
+	}
+	activeStart := ms(now.Add(-24 * time.Hour))
+	activeEnd := ms(now.Add(24 * time.Hour))
+	pastStart := ms(now.AddDate(-2, 0, 0))
+	pastEnd := ms(now.AddDate(-1, 0, 0))
+
 	reg.Register(&httpmock.Stub{
...
-						"start_time":      "1767225600000", // 2026-01-01 00:00:00
-						"end_time":        "1798761599000", // 2026-12-31 23:59:59 UTC
+						"start_time":      activeStart,
+						"end_time":        activeEnd,
...
-						"start_time":      "1704067200000", // 2024-01-01
-						"end_time":        "1719791999999", // 2024-06-30 23:59:59
+						"start_time":      pastStart,
+						"end_time":        pastEnd,

This also requires adding strconv to the imports.

🤖 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 `@shortcuts/okr/okr_cycle_list_test.go` around lines 393 - 419, The
TestCycleListExecute_WithCycles fixture hard-codes a “current” cycle window for
2026, which will break once Execute()’s time.Now() falls outside that range.
Update the mocked cycle timestamps to be computed relative to time.Now().UTC()
so the active/past cycle setup stays stable over time, and add strconv where
needed to format the generated timestamps in the httpmock.Stub body.
skills/lark-okr/references/lark-okr-cycle-detail.md (1)

37-80: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Output JSON example doesn't match --style simple default.

The documented output example shows fields like create_time, update_time, owner, position, deadline, category_id, and stringified content/notes. However, with the default --style simple, +cycle-detail returns RespObjectiveSimple / RespKeyResultSimple which omit most of these fields and use SemiPlainContent objects for content/notes. Either update the example to show simple-style output (matching the default), or add a second example for richtext and clarify which example corresponds to which style.

Cross-reference: shortcuts/okr/okr_cycle_detail.go:98-155 shows RespObjectiveSimple contains only id, score, weight, content (as *SemiPlainContent), notes (as *SemiPlainContent), and key_results (as []RespKeyResultSimple).

🤖 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/references/lark-okr-cycle-detail.md` around lines 37 - 80,
The `+cycle-detail` JSON example is inconsistent with the default `--style
simple` output, since `RespObjectiveSimple` and `RespKeyResultSimple` do not
include fields like `create_time`, `update_time`, `owner`, `position`,
`deadline`, `category_id`, or stringified `content`/`notes`. Update the example
to match the simple-style shape returned by `okr_cycle_detail.go` (using the
`RespObjectiveSimple` / `RespKeyResultSimple` symbols), or add a separate
example for `richtext` and clearly label which output belongs to each style.
shortcuts/okr/okr_progress_create.go (1)

269-283: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Honor --style when emitting the create result.

Execute always uses record.ToResp(), so +progress-create --style simple still returns richtext progress.content whenever the API includes content. That leaves create inconsistent with the new simple/richtext response contract already implemented in +progress-get.

🤖 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 `@shortcuts/okr/okr_progress_create.go` around lines 269 - 283,
`okr_progress_create.go`’s `Execute` currently always uses `record.ToResp()`, so
the create output ignores `--style` and can emit richtext `progress.content`
even in simple mode. Update the result-building path in `Execute` to honor the
requested style the same way `+progress-get` does, using the existing response
conversion/helpers to choose between simple and richtext output before calling
`runtime.OutFormat`. Keep the `progress` payload consistent with the style
contract and only include `Content` when richtext is requested.
shortcuts/okr/okr_progress_update.go (1)

212-226: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Honor --style when emitting the update result.

Execute always serializes record.ToResp(), so +progress-update --style simple still emits richtext progress.content whenever content is present. That makes update inconsistent with +progress-get and the new simple/richtext response contract.

🤖 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 `@shortcuts/okr/okr_progress_update.go` around lines 212 - 226,
`OKRProgressUpdate.Execute` currently always outputs `record.ToResp()` as
richtext, so it ignores the selected `--style` and can emit `progress.content`
even in simple mode. Update the response-building logic in `Execute` (and the
`resp := record.ToResp()` / `runtime.OutFormat(...)` path) to honor the
requested style the same way `progress-get` does, returning a simple response
when `--style simple` is used and only including richtext content when the style
requires it.
tests/cli_e2e/okr/okr_progress_test.go (1)

68-90: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Verify the dry-run request payload, not only the URL.

These cases only assert the path/method, so they will still pass if the new --style plumbing builds the wrong request body. Please inspect the emitted JSON and assert the content structure/query fields that actually changed in this PR.
As per coding guidelines, dry-run E2E tests validate request structure without calling real APIs, and every behavior change needs a test alongside the change.

Also applies to: 93-115, 206-250

🤖 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 `@tests/cli_e2e/okr/okr_progress_test.go` around lines 68 - 90, The dry-run E2E
checks in TestOKR_ProgressCreateDryRun (and the related OKR dry-run tests) only
verify the URL/method, so they miss regressions in the new request body
plumbing. Update the assertions to inspect the emitted JSON from clie2e.RunCmd
and validate the request payload fields that changed with --style, especially
the content structure and any query/body fields tied to progress creation. Use
the existing test helpers and the relevant OKR command path to confirm the
dry-run output matches the expected request shape.

Source: Coding guidelines

🧹 Nitpick comments (1)
skills/lark-okr/references/lark-okr-progress-get.md (1)

43-64: 🧹 Nitpick | 🔵 Trivial

Clarify example JSON for style-dependent content shape.

The example JSON shows "content": "{...}" as a string placeholder, but the actual output shape differs by --style:

  • simple: content is a SemiPlainContent object (e.g., {"text":"...","mention":[...]})
  • richtext: content is a JSON string representing a ContentBlock

Consider updating the example to show the concrete simple style output (since it's the default) or add a comment noting that content is either an object or string depending on --style.

🤖 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/references/lark-okr-progress-get.md` around lines 43 - 64,
The example for the progress response uses a vague string placeholder for
progress.content, but the shape depends on the --style option. Update the
example in lark-okr-progress-get.md to make the default simple case explicit by
showing progress.content as a SemiPlainContent object, and note that richtext
returns a JSON string ContentBlock; reference the progress.content and
progress_rate sections so the style-dependent behavior is clear.
🤖 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_detail.go`:
- Line 29: The new style flag on the `+cycle-detail` command is changing the
default response shape, so preserve the existing `ContentBlock` JSON behavior by
making `richtext` the default in the flag definition for the `style` option.
Update the `okr_cycle_detail.go` command setup so callers that omit `--style`
continue to get the old richtext output, while `simple` remains an explicit
opt-in via the same flag and enum.

In `@shortcuts/okr/okr_cycle_list_test.go`:
- Around line 264-267: The test in okr_cycle_list_test is only checking that
current_active_cycles is empty, so a missing field can still pass because the
type assertion yields nil. Tighten the assertion around the response contract by
explicitly verifying the current_active_cycles key exists in the decoded data
map and that its value has the expected slice type before checking its length;
use the existing test logic in the OKR cycle list response assertions to fail
when the field is absent or has the wrong shape.

In `@shortcuts/okr/okr_openapi_test.go`:
- Around line 859-930: Add a direct regression test in TestToSimpleMethods for
the separate Progress.ToSimple() converter, since the current coverage only
exercises ProgressV1.ToSimple(). Use the Progress symbol from okr_cli_resp.go
and assert the distinct field mapping for UpdateTime, CreateTime,
ProgressPercent, and ProgressStatus so the new behavior is covered alongside the
change.

In `@shortcuts/okr/okr_openapi.go`:
- Around line 737-738: ToContentBlock() is flattening mention markers from
ToSemiPlain() by stripping all @{userID} placeholders from Text and appending
mentions at the end, which loses the original inline order. Update
ToContentBlock (and the helper logic around placeholderRE/multiSpaceRE) to parse
s.Text into alternating text and mention segments, then rebuild the paragraph in
sequence so round-trips like “Hello @{ou_123}, world” preserve the mention
position.

In `@shortcuts/okr/okr_patch_test.go`:
- Around line 44-596: The patch validation tests are too dependent on error
strings and direct concrete-type checks, so they can miss regressions in typed
metadata or preserved causes. Update the error-path cases in TestPatchValidate_*
to assert errs.ProblemOf(err) for category/subtype, and use errors.As only to
verify *errs.ValidationError.Param. Also add cause-preservation checks for
wrapped failures instead of relying on substrings alone, using the existing
runPatchShortcut and errs.ValidationError symbols to locate the affected
assertions.

In `@shortcuts/okr/okr_patch.go`:
- Around line 130-135: The deadline validation in the OKR patch path is too
permissive because `strconv.ParseInt` only checks that `deadline` is numeric,
not that it is a positive Unix-millis value. Update the validation in the
`runtime.Str("deadline")` block inside the patch logic to reject non-millisecond
inputs like seconds or negative numbers by explicitly enforcing a positive
minimum length/range and/or validating against a millisecond timestamp threshold
before assigning `p.Deadline`.

In `@shortcuts/okr/okr_progress_create_test.go`:
- Around line 429-478: The new simple-mode validation tests are only checking
error strings, so they should be updated to assert typed error metadata in the
progress-create validation path. In the relevant
TestProgressCreateValidate_SimpleMode_* cases, use errs.ProblemOf on the
returned error to verify category and subtype, and use errors.As with
errs.ValidationError when you need to assert Param for the validation failure.
Also ensure the underlying cause/unwrap chain is preserved for the invalid JSON
case rather than relying only on err.Error() substring matches.

In `@shortcuts/okr/okr_progress_create.go`:
- Around line 43-61: The simple-mode conversion in OKR progress creation is
reordering inline mentions by stripping placeholders and appending mentions
afterward. Update the `okr_progress_create.go` path that builds `contentV1` from
`SemiPlainContent` so mention positions are preserved when calling
`sp.ToContentBlock()` and converting to V1, instead of losing the original
inline order in `--style simple`.

In `@shortcuts/okr/okr_progress_update_test.go`:
- Around line 358-403: The new simple-mode validation tests only assert on
err.Error(), so they miss regressions in typed error metadata and unwrap/cause
behavior. Update the tests in
TestProgressUpdateValidate_SimpleMode_InvalidSemiPlainJSON,
TestProgressUpdateValidate_SimpleMode_EmptyMention, and
TestProgressUpdateValidate_SimpleMode_ImagesNotSupported to assert problem
fields with errs.ProblemOf, and use errors.As with errs.ValidationError when
checking Param-specific validation details. Keep the existing
runProgressUpdateShortcut setup, but replace substring-only checks with typed
assertions that verify category, subtype, param, and preserved cause where
applicable.

---

Outside diff comments:
In `@shortcuts/okr/okr_cycle_list_test.go`:
- Around line 393-419: The TestCycleListExecute_WithCycles fixture hard-codes a
“current” cycle window for 2026, which will break once Execute()’s time.Now()
falls outside that range. Update the mocked cycle timestamps to be computed
relative to time.Now().UTC() so the active/past cycle setup stays stable over
time, and add strconv where needed to format the generated timestamps in the
httpmock.Stub body.

In `@shortcuts/okr/okr_progress_create.go`:
- Around line 269-283: `okr_progress_create.go`’s `Execute` currently always
uses `record.ToResp()`, so the create output ignores `--style` and can emit
richtext `progress.content` even in simple mode. Update the result-building path
in `Execute` to honor the requested style the same way `+progress-get` does,
using the existing response conversion/helpers to choose between simple and
richtext output before calling `runtime.OutFormat`. Keep the `progress` payload
consistent with the style contract and only include `Content` when richtext is
requested.

In `@shortcuts/okr/okr_progress_update.go`:
- Around line 212-226: `OKRProgressUpdate.Execute` currently always outputs
`record.ToResp()` as richtext, so it ignores the selected `--style` and can emit
`progress.content` even in simple mode. Update the response-building logic in
`Execute` (and the `resp := record.ToResp()` / `runtime.OutFormat(...)` path) to
honor the requested style the same way `progress-get` does, returning a simple
response when `--style simple` is used and only including richtext content when
the style requires it.

In `@skills/lark-okr/references/lark-okr-cycle-detail.md`:
- Around line 37-80: The `+cycle-detail` JSON example is inconsistent with the
default `--style simple` output, since `RespObjectiveSimple` and
`RespKeyResultSimple` do not include fields like `create_time`, `update_time`,
`owner`, `position`, `deadline`, `category_id`, or stringified
`content`/`notes`. Update the example to match the simple-style shape returned
by `okr_cycle_detail.go` (using the `RespObjectiveSimple` /
`RespKeyResultSimple` symbols), or add a separate example for `richtext` and
clearly label which output belongs to each style.

In `@tests/cli_e2e/okr/okr_progress_test.go`:
- Around line 68-90: The dry-run E2E checks in TestOKR_ProgressCreateDryRun (and
the related OKR dry-run tests) only verify the URL/method, so they miss
regressions in the new request body plumbing. Update the assertions to inspect
the emitted JSON from clie2e.RunCmd and validate the request payload fields that
changed with --style, especially the content structure and any query/body fields
tied to progress creation. Use the existing test helpers and the relevant OKR
command path to confirm the dry-run output matches the expected request shape.

---

Nitpick comments:
In `@skills/lark-okr/references/lark-okr-progress-get.md`:
- Around line 43-64: The example for the progress response uses a vague string
placeholder for progress.content, but the shape depends on the --style option.
Update the example in lark-okr-progress-get.md to make the default simple case
explicit by showing progress.content as a SemiPlainContent object, and note that
richtext returns a JSON string ContentBlock; reference the progress.content and
progress_rate sections so the style-dependent behavior is clear.
🪄 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: 8d06f070-4a97-4395-a5a5-3b2f61f4c080

📥 Commits

Reviewing files that changed from the base of the PR and between 22108c3 and b3309b4.

📒 Files selected for processing (29)
  • shortcuts/okr/okr_batch_create.go
  • shortcuts/okr/okr_batch_create_test.go
  • shortcuts/okr/okr_cli_resp.go
  • shortcuts/okr/okr_cycle_detail.go
  • shortcuts/okr/okr_cycle_list.go
  • shortcuts/okr/okr_cycle_list_test.go
  • shortcuts/okr/okr_openapi.go
  • shortcuts/okr/okr_openapi_test.go
  • shortcuts/okr/okr_patch.go
  • shortcuts/okr/okr_patch_test.go
  • shortcuts/okr/okr_progress_create.go
  • shortcuts/okr/okr_progress_create_test.go
  • shortcuts/okr/okr_progress_get.go
  • shortcuts/okr/okr_progress_update.go
  • shortcuts/okr/okr_progress_update_test.go
  • shortcuts/okr/shortcuts.go
  • skills/lark-okr/SKILL.md
  • skills/lark-okr/references/lark-okr-alignments.md
  • skills/lark-okr/references/lark-okr-contentblock.md
  • skills/lark-okr/references/lark-okr-cycle-detail.md
  • skills/lark-okr/references/lark-okr-cycle-list.md
  • skills/lark-okr/references/lark-okr-indicators.md
  • skills/lark-okr/references/lark-okr-patch.md
  • skills/lark-okr/references/lark-okr-progress-create.md
  • skills/lark-okr/references/lark-okr-progress-get.md
  • skills/lark-okr/references/lark-okr-progress-update.md
  • tests/cli_e2e/okr/okr_cycle_detail_test.go
  • tests/cli_e2e/okr/okr_progress_test.go
  • tests/cli_e2e/okr/okr_shortcuts_test.go

Comment thread shortcuts/okr/okr_cycle_detail.go
Comment thread shortcuts/okr/okr_cycle_list_test.go Outdated
Comment thread shortcuts/okr/okr_openapi_test.go
Comment thread shortcuts/okr/okr_openapi.go
Comment thread shortcuts/okr/okr_patch_test.go
Comment thread shortcuts/okr/okr_patch.go
Comment thread shortcuts/okr/okr_progress_create_test.go
Comment thread shortcuts/okr/okr_progress_create.go
Comment thread shortcuts/okr/okr_progress_update_test.go
@syh-cpdsss
syh-cpdsss force-pushed the feat/okr-semi-plain-text-and-patch branch from b3309b4 to 3cd27f1 Compare June 30, 2026 07:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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.go`:
- Around line 222-225: The new “Current active cycle(s)” branch in OkrCycleList
output is untested, so extend okr_cycle_list_test.go to cover the non-empty
currentActiveCycles path. Add or update a test around OkrCycleList/its rendering
behavior that sets currentActiveCycles with at least one cycle and asserts the
output includes the “Current active cycle(s):” section and the expected cycle
row format.
🪄 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: 07dc43be-045b-4474-bb2b-33e36e468a2a

📥 Commits

Reviewing files that changed from the base of the PR and between b3309b4 and 3cd27f1.

📒 Files selected for processing (15)
  • shortcuts/okr/okr_cli_resp.go
  • shortcuts/okr/okr_cycle_list.go
  • shortcuts/okr/okr_cycle_list_test.go
  • shortcuts/okr/okr_openapi.go
  • shortcuts/okr/okr_openapi_test.go
  • shortcuts/okr/okr_patch_test.go
  • skills/lark-okr/SKILL.md
  • skills/lark-okr/references/lark-okr-alignments.md
  • skills/lark-okr/references/lark-okr-contentblock.md
  • skills/lark-okr/references/lark-okr-cycle-detail.md
  • skills/lark-okr/references/lark-okr-cycle-list.md
  • skills/lark-okr/references/lark-okr-indicators.md
  • skills/lark-okr/references/lark-okr-patch.md
  • skills/lark-okr/references/lark-okr-progress-create.md
  • skills/lark-okr/references/lark-okr-progress-update.md
✅ Files skipped from review due to trivial changes (6)
  • skills/lark-okr/references/lark-okr-alignments.md
  • skills/lark-okr/references/lark-okr-patch.md
  • skills/lark-okr/references/lark-okr-indicators.md
  • skills/lark-okr/references/lark-okr-cycle-detail.md
  • skills/lark-okr/references/lark-okr-cycle-list.md
  • skills/lark-okr/references/lark-okr-progress-update.md
🚧 Files skipped from review as they are similar to previous changes (6)
  • shortcuts/okr/okr_cycle_list_test.go
  • shortcuts/okr/okr_patch_test.go
  • skills/lark-okr/references/lark-okr-contentblock.md
  • shortcuts/okr/okr_openapi.go
  • skills/lark-okr/references/lark-okr-progress-create.md
  • shortcuts/okr/okr_openapi_test.go

Comment thread shortcuts/okr/okr_cycle_list.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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_openapi_test.go`:
- Around line 949-951: The current assertion in the OKR OpenAPI test only
verifies that CreateTime is non-empty, which can miss a swapped or incorrectly
formatted V2 timestamp mapping. Update the test around simpleProgressV2 to
assert the exact mapping for both fields: CreateTime should match the formatted
progressV2.CreateTime value and ModifyTime should match the formatted
progressV2.UpdateTime value, so the timestamp conversion logic is fully covered.
🪄 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: de88150a-93dc-4649-bde9-83d811d5c640

📥 Commits

Reviewing files that changed from the base of the PR and between 3cd27f1 and 8984dd4.

📒 Files selected for processing (12)
  • shortcuts/okr/okr_cycle_list_test.go
  • shortcuts/okr/okr_openapi.go
  • shortcuts/okr/okr_openapi_test.go
  • shortcuts/okr/okr_patch.go
  • shortcuts/okr/okr_patch_test.go
  • shortcuts/okr/okr_progress_create.go
  • shortcuts/okr/okr_progress_create_test.go
  • shortcuts/okr/okr_progress_update.go
  • shortcuts/okr/okr_progress_update_test.go
  • skills/lark-okr/references/lark-okr-cycle-detail.md
  • skills/lark-okr/references/lark-okr-progress-get.md
  • tests/cli_e2e/okr/okr_progress_test.go
✅ Files skipped from review due to trivial changes (2)
  • skills/lark-okr/references/lark-okr-progress-get.md
  • skills/lark-okr/references/lark-okr-cycle-detail.md
🚧 Files skipped from review as they are similar to previous changes (8)
  • shortcuts/okr/okr_progress_create.go
  • shortcuts/okr/okr_progress_update.go
  • shortcuts/okr/okr_patch.go
  • shortcuts/okr/okr_progress_create_test.go
  • shortcuts/okr/okr_cycle_list_test.go
  • shortcuts/okr/okr_openapi.go
  • shortcuts/okr/okr_patch_test.go
  • shortcuts/okr/okr_progress_update_test.go

@syh-cpdsss
syh-cpdsss force-pushed the feat/okr-semi-plain-text-and-patch branch from 8984dd4 to 4cb415b Compare June 30, 2026 09:19

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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_openapi_test.go`:
- Around line 949-951: The timestamp assertion in the Progress V2 test is too
weak because it only checks that CreateTime is non-empty, so regressions in the
CreateTime/ModifyTime mapping could still pass. Update the assertions in the
simpleProgressV2 check to verify exact values against
formatTimestamp(progressV2.CreateTime) and
formatTimestamp(progressV2.UpdateTime), using the existing Progress V2 fields
and the formatTimestamp helper to validate both CreateTime and ModifyTime.
🪄 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: f460c35f-36c5-47f6-afbd-33784a4a5a9d

📥 Commits

Reviewing files that changed from the base of the PR and between 8984dd4 and 4cb415b.

📒 Files selected for processing (29)
  • shortcuts/okr/okr_batch_create.go
  • shortcuts/okr/okr_batch_create_test.go
  • shortcuts/okr/okr_cli_resp.go
  • shortcuts/okr/okr_cycle_detail.go
  • shortcuts/okr/okr_cycle_list.go
  • shortcuts/okr/okr_cycle_list_test.go
  • shortcuts/okr/okr_openapi.go
  • shortcuts/okr/okr_openapi_test.go
  • shortcuts/okr/okr_patch.go
  • shortcuts/okr/okr_patch_test.go
  • shortcuts/okr/okr_progress_create.go
  • shortcuts/okr/okr_progress_create_test.go
  • shortcuts/okr/okr_progress_get.go
  • shortcuts/okr/okr_progress_update.go
  • shortcuts/okr/okr_progress_update_test.go
  • shortcuts/okr/shortcuts.go
  • skills/lark-okr/SKILL.md
  • skills/lark-okr/references/lark-okr-alignments.md
  • skills/lark-okr/references/lark-okr-contentblock.md
  • skills/lark-okr/references/lark-okr-cycle-detail.md
  • skills/lark-okr/references/lark-okr-cycle-list.md
  • skills/lark-okr/references/lark-okr-indicators.md
  • skills/lark-okr/references/lark-okr-patch.md
  • skills/lark-okr/references/lark-okr-progress-create.md
  • skills/lark-okr/references/lark-okr-progress-get.md
  • skills/lark-okr/references/lark-okr-progress-update.md
  • tests/cli_e2e/okr/okr_cycle_detail_test.go
  • tests/cli_e2e/okr/okr_progress_test.go
  • tests/cli_e2e/okr/okr_shortcuts_test.go
✅ Files skipped from review due to trivial changes (7)
  • skills/lark-okr/references/lark-okr-cycle-detail.md
  • skills/lark-okr/references/lark-okr-indicators.md
  • skills/lark-okr/references/lark-okr-progress-update.md
  • skills/lark-okr/references/lark-okr-alignments.md
  • skills/lark-okr/references/lark-okr-cycle-list.md
  • skills/lark-okr/references/lark-okr-patch.md
  • skills/lark-okr/references/lark-okr-progress-get.md
🚧 Files skipped from review as they are similar to previous changes (20)
  • shortcuts/okr/okr_batch_create_test.go
  • tests/cli_e2e/okr/okr_cycle_detail_test.go
  • shortcuts/okr/shortcuts.go
  • shortcuts/okr/okr_cycle_list.go
  • skills/lark-okr/references/lark-okr-contentblock.md
  • tests/cli_e2e/okr/okr_shortcuts_test.go
  • shortcuts/okr/okr_patch.go
  • shortcuts/okr/okr_progress_get.go
  • shortcuts/okr/okr_batch_create.go
  • shortcuts/okr/okr_progress_update.go
  • tests/cli_e2e/okr/okr_progress_test.go
  • shortcuts/okr/okr_progress_create.go
  • shortcuts/okr/okr_cycle_list_test.go
  • skills/lark-okr/references/lark-okr-progress-create.md
  • shortcuts/okr/okr_openapi.go
  • shortcuts/okr/okr_cycle_detail.go
  • shortcuts/okr/okr_progress_create_test.go
  • shortcuts/okr/okr_progress_update_test.go
  • shortcuts/okr/okr_cli_resp.go
  • shortcuts/okr/okr_patch_test.go

Comment thread shortcuts/okr/okr_openapi_test.go
@syh-cpdsss
syh-cpdsss force-pushed the feat/okr-semi-plain-text-and-patch branch from 4cb415b to 2661b9a Compare June 30, 2026 09:46

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
shortcuts/okr/okr_openapi_test.go (1)

949-951: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Strengthen the V2 timestamp assertions to exact source mappings.

This still won't catch CreateTime/UpdateTime being swapped, and ModifyTime is not asserted at all.

Suggested test tightening
-	if simpleProgressV2.CreateTime == nil || *simpleProgressV2.CreateTime == "" {
-		t.Fatal("expected non-empty CreateTime for Progress V2")
-	}
+	if simpleProgressV2.CreateTime == nil || *simpleProgressV2.CreateTime != formatTimestamp(progressV2.CreateTime) {
+		t.Fatalf("unexpected CreateTime: %+v", simpleProgressV2.CreateTime)
+	}
+	if simpleProgressV2.ModifyTime == nil || *simpleProgressV2.ModifyTime != formatTimestamp(progressV2.UpdateTime) {
+		t.Fatalf("unexpected ModifyTime: %+v", simpleProgressV2.ModifyTime)
+	}
🤖 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 `@shortcuts/okr/okr_openapi_test.go` around lines 949 - 951, The Progress V2
timestamp test only checks that CreateTime is non-empty, so it can miss
CreateTime/UpdateTime being swapped and does not verify ModifyTime. Tighten the
assertions in the relevant test around simpleProgressV2 so each timestamp field
is checked against its exact expected source mapping: assert CreateTime,
UpdateTime, and ModifyTime individually and compare each one to the correct
originating timestamp value.

Source: Coding guidelines

🤖 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_openapi_test.go`:
- Around line 60-62: The okr_openapi_test assertions for RespCycle are too loose
because they only check that StartTime and EndTime are non-empty. Tighten the
test around the resp mapping by asserting the exact converted timestamp values
produced from the source fields in the response, using the existing RespCycle
assertions in okr_openapi_test to verify StartTime maps to the expected start
value and EndTime maps to the expected end value.
- Around line 770-802: The round-trip test in
TestSemiPlainContentToContentBlock_PlaceholderStripping only checks that
mentions exist, not that their positions are preserved. Update the assertions
against SemiPlainContent.ToContentBlock() so the resulting Paragraph.Elements
are verified in the original interleaved order (text, mention, text, mention)
rather than allowing all mentions to be appended at the end. Confirm the
stripped text segments and the mention UserID values using the existing
cb.Blocks[0].Paragraph.Elements structure.

---

Duplicate comments:
In `@shortcuts/okr/okr_openapi_test.go`:
- Around line 949-951: The Progress V2 timestamp test only checks that
CreateTime is non-empty, so it can miss CreateTime/UpdateTime being swapped and
does not verify ModifyTime. Tighten the assertions in the relevant test around
simpleProgressV2 so each timestamp field is checked against its exact expected
source mapping: assert CreateTime, UpdateTime, and ModifyTime individually and
compare each one to the correct originating timestamp value.
🪄 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: 8ae83dfb-984a-4322-884e-6ca0e1913b76

📥 Commits

Reviewing files that changed from the base of the PR and between 4cb415b and 2661b9a.

📒 Files selected for processing (29)
  • shortcuts/okr/okr_batch_create.go
  • shortcuts/okr/okr_batch_create_test.go
  • shortcuts/okr/okr_cli_resp.go
  • shortcuts/okr/okr_cycle_detail.go
  • shortcuts/okr/okr_cycle_list.go
  • shortcuts/okr/okr_cycle_list_test.go
  • shortcuts/okr/okr_openapi.go
  • shortcuts/okr/okr_openapi_test.go
  • shortcuts/okr/okr_patch.go
  • shortcuts/okr/okr_patch_test.go
  • shortcuts/okr/okr_progress_create.go
  • shortcuts/okr/okr_progress_create_test.go
  • shortcuts/okr/okr_progress_get.go
  • shortcuts/okr/okr_progress_update.go
  • shortcuts/okr/okr_progress_update_test.go
  • shortcuts/okr/shortcuts.go
  • skills/lark-okr/SKILL.md
  • skills/lark-okr/references/lark-okr-alignments.md
  • skills/lark-okr/references/lark-okr-contentblock.md
  • skills/lark-okr/references/lark-okr-cycle-detail.md
  • skills/lark-okr/references/lark-okr-cycle-list.md
  • skills/lark-okr/references/lark-okr-indicators.md
  • skills/lark-okr/references/lark-okr-patch.md
  • skills/lark-okr/references/lark-okr-progress-create.md
  • skills/lark-okr/references/lark-okr-progress-get.md
  • skills/lark-okr/references/lark-okr-progress-update.md
  • tests/cli_e2e/okr/okr_cycle_detail_test.go
  • tests/cli_e2e/okr/okr_progress_test.go
  • tests/cli_e2e/okr/okr_shortcuts_test.go
✅ Files skipped from review due to trivial changes (9)
  • skills/lark-okr/references/lark-okr-patch.md
  • skills/lark-okr/references/lark-okr-cycle-detail.md
  • skills/lark-okr/references/lark-okr-alignments.md
  • skills/lark-okr/references/lark-okr-progress-get.md
  • skills/lark-okr/references/lark-okr-contentblock.md
  • skills/lark-okr/references/lark-okr-cycle-list.md
  • skills/lark-okr/references/lark-okr-progress-create.md
  • skills/lark-okr/references/lark-okr-indicators.md
  • skills/lark-okr/references/lark-okr-progress-update.md
🚧 Files skipped from review as they are similar to previous changes (18)
  • shortcuts/okr/shortcuts.go
  • shortcuts/okr/okr_batch_create_test.go
  • tests/cli_e2e/okr/okr_shortcuts_test.go
  • tests/cli_e2e/okr/okr_cycle_detail_test.go
  • shortcuts/okr/okr_batch_create.go
  • tests/cli_e2e/okr/okr_progress_test.go
  • shortcuts/okr/okr_cycle_list.go
  • shortcuts/okr/okr_progress_create.go
  • shortcuts/okr/okr_progress_get.go
  • shortcuts/okr/okr_progress_create_test.go
  • shortcuts/okr/okr_cycle_list_test.go
  • shortcuts/okr/okr_cli_resp.go
  • shortcuts/okr/okr_progress_update_test.go
  • shortcuts/okr/okr_progress_update.go
  • shortcuts/okr/okr_patch.go
  • shortcuts/okr/okr_cycle_detail.go
  • shortcuts/okr/okr_patch_test.go
  • shortcuts/okr/okr_openapi.go

Comment thread shortcuts/okr/okr_openapi_test.go
Comment thread shortcuts/okr/okr_openapi_test.go
…+ patch shortcut

Add semi-plain text (simple) format for OKR content I/O, and a new `+patch`
shortcut for incremental updates to objectives and key results.
@syh-cpdsss
syh-cpdsss force-pushed the feat/okr-semi-plain-text-and-patch branch from 2661b9a to 3fc2a6c Compare July 1, 2026 08:32
@syh-cpdsss
syh-cpdsss merged commit ddc0f2a into main Jul 2, 2026
24 checks passed
@syh-cpdsss
syh-cpdsss deleted the feat/okr-semi-plain-text-and-patch branch July 2, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Architecture-level or global-impact change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants