Skip to content

docs(slides): harden update file input guidance - #2273

Closed
fangshuyu-768 wants to merge 1 commit into
mainfrom
docs/slides-update-shell-input
Closed

docs(slides): harden update file input guidance#2273
fangshuyu-768 wants to merge 1 commit into
mainfrom
docs/slides-update-shell-input

Conversation

@fangshuyu-768

@fangshuyu-768 fangshuyu-768 commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Improve slides +update-slide guidance for shell loops where a computed @file path can collapse to .xml when a variable is empty or expanded too early. This keeps the command fail-closed and changes guidance only; file parsing and Slides write behavior are unchanged.

Changes

  • Move the existing +update-slide tips to the affordance surface and add safe shell-loop guidance.
  • Update the skill reference to validate computed paths and prefer stdin for loop-generated filenames.
  • Document the cannot read file ".xml" signal and clarify that braces alone do not fix an empty variable.

Test Plan

  • make unit-test
  • make vet
  • make fmt-check
  • QUALITY_GATE_CHANGED_FROM=origin/main make quality-gate
  • node scripts/skill-format-check/index.js
  • Manual go run . slides +update-slide --help verification

Related Issues

  • None

Summary by CodeRabbit

  • Documentation

    • Added guidance for updating presentation slides, including full-slide edits, partial replacements, and batch updates.
    • Clarified safe shell usage, file validation, and troubleshooting for invalid XML file paths.
    • Updated examples to use shell redirection for submitting slide content.
  • Tests

    • Added coverage to verify that slide update guidance retains required safety and shell-usage instructions.

@github-actions github-actions Bot added the size/M Single-domain feat or fix with limited business impact label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change moves slide update guidance into the affordance documentation, removes shortcut tips, adds validation, and updates XML input examples with shell-safe file checks.

Changes

Slides update guidance

Layer / File(s) Summary
Affordance guidance and validation
affordance/slides.md, shortcuts/slides/slides_update_slide.go, internal/affordance/slides_source_test.go
The affordance documents slide XML retrieval, full-page updates, partial replacement, and shell redirection. The shortcut removes embedded tips. A test verifies the required guidance.
Shell-safe XML reference examples
skills/lark-slides/references/lark-slides-update-slide.md, skills/lark-slides/references/workflow/error-handling.md
The references use stdin redirection and validate XML variables and file paths before batch updates. Troubleshooting guidance covers invalid empty file paths.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 clearly summarizes the main change: safer file-input guidance for slides update commands.
Description check ✅ Passed The description includes all required sections, explains the scope, lists changes, records verification, and identifies no 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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/slides-update-shell-input

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.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

PR Quality Summary

CI did not complete successfully. Use the failed check links below to decide whether this PR needs a code change or a rerun.

Failed checks

@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 `@internal/affordance/slides_source_test.go`:
- Line 16: Replace the os.DirFS call in SetSource with the repository-backed
fs.FS helper from internal/vfs, adding that helper if it does not already exist.
Ensure the affordance source remains rooted at the repository’s affordance
directory while using the internal filesystem abstraction.
🪄 Autofix

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 Plus

Run ID: 3d67ae20-93cd-4963-b76c-ae3606786653

📥 Commits

Reviewing files that changed from the base of the PR and between bd38b9b and ff4e13d.

📒 Files selected for processing (5)
  • affordance/slides.md
  • internal/affordance/slides_source_test.go
  • shortcuts/slides/slides_update_slide.go
  • skills/lark-slides/references/lark-slides-update-slide.md
  • skills/lark-slides/references/workflow/error-handling.md

func TestSlidesUpdateAffordancePreservesSafetyAndShellGuidance(t *testing.T) {
prev := mdSource
t.Cleanup(func() { SetSource(prev) })
SetSource(os.DirFS("../../affordance"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 5 'os\.DirFS|fs\.FS|internal/vfs|SetSource' internal/affordance internal/vfs

Repository: larksuite/cli

Length of output: 11924


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- files ---\n'
git ls-files 'internal/vfs/**/*.go' | sed -n '1,200p'
printf '\n--- os.DirFS / internal/vfs occurrences ---\n'
rg -n '"os"|os\.(DirFS|Open|ReadFile|Stat)|internal/vfs|func .*FS|fs\.open|Local|Open' internal/vfs internal/affordance | sed -n '1,240p'
printf '\n--- target test file ---\n'
cat -n internal/affordance/slides_source_test.go
printf '\n--- application source helpers if any ---\n'
sed -n '1,90p' internal/affordance/application_source_test.go

Repository: larksuite/cli

Length of output: 242


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- files ---'
git ls-files 'internal/vfs/**/*.go' | sed -n '1,200p'

printf '%s\n' '--- os.DirFS / internal/vfs occurrences ---'
rg -n '"os"|os\.(DirFS|Open|ReadFile|Stat)|internal/vfs|func .*FS|fs\.open|Local|Open' internal/vfs internal/affordance | sed -n '1,280p'

printf '%s\n' '--- target test file ---'
cat -n internal/affordance/slides_source_test.go

printf '%s\n' '--- application source helpers if any ---'
sed -n '1,90p' internal/affordance/application_source_test.go

Repository: larksuite/cli

Length of output: 18617


Use the repository filesystem abstraction for the affordance source.

SetSource(os.DirFS("../../affordance")) bypasses internal/vfs. Use or add a repository-backed fs.FS helper, then use that helper instead of os.DirFS.

🤖 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 `@internal/affordance/slides_source_test.go` at line 16, Replace the os.DirFS
call in SetSource with the repository-backed fs.FS helper from internal/vfs,
adding that helper if it does not already exist. Ensure the affordance source
remains rooted at the repository’s affordance directory while using the internal
filesystem abstraction.

Sources: Coding guidelines, Learnings

@github-actions

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#docs/slides-update-shell-input -y -g

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.39%. Comparing base (bd38b9b) to head (ff4e13d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2273   +/-   ##
=======================================
  Coverage   76.39%   76.39%           
=======================================
  Files        1013     1013           
  Lines      111788   111788           
=======================================
  Hits        85400    85400           
  Misses      19878    19878           
  Partials     6510     6510           

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant