Skip to content

feat(base): Add Base URL and title resolve shortcuts#1338

Merged
zgz2048 merged 13 commits into
larksuite:mainfrom
zgz2048:codex/base-url-title-resolve
Jun 24, 2026
Merged

feat(base): Add Base URL and title resolve shortcuts#1338
zgz2048 merged 13 commits into
larksuite:mainfrom
zgz2048:codex/base-url-title-resolve

Conversation

@zgz2048

@zgz2048 zgz2048 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add base +url-resolve to resolve Base, Wiki, record-share, and form-share URLs into actionable Base coordinates
  • add base +title-resolve to search BITABLE resources by title or keyword through Search v2
  • simplify the lark-base skill entry rules so agents route URLs through +url-resolve and titles through +title-resolve

Details

  • URL resolve accepts --url with --query as a compatibility alias, rejects raw tokens, and returns typed validation errors for unsupported Base URL patterns.
  • Record share URLs resolve metadata and best-effort enrich hint with record content and table fields.
  • Base URLs with table IDs best-effort enrich hint.fields; URLs without table IDs guide agents to +base-block-list.
  • If enrichment calls such as record get or field list fail, the command still returns the resolved coordinates and omits only the unavailable hint.record / hint.fields data.
  • Unsupported view share, dashboard share, and workspace URLs explicitly say CLI does not support resolving them and guide users to browser or the Base's own Wiki/Base URL.

Validation

  • go build ./shortcuts/base
  • git diff --check

Note: local Go unit tests were intentionally not run per request; CI should cover them.

Summary by CodeRabbit

  • New Features

    • Added two Base shortcuts: URL-based resolve (handles Base, wiki, record-share, form-share links) and title-based resolve (searches Drive for Base candidates and resolves titles).
  • Behavior

    • Resolutions return structured Base payloads with contextual hints and may enrich results with record/field details when available; disambiguation yields candidate lists with next-step hints.
  • Tests

    • Added comprehensive tests covering URL/title flows, enrichment, validation, and help text.
  • Documentation

    • Clarified Base coordinate-location rules and recovery guidance.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds two Base shortcuts, +url-resolve and +title-resolve, to parse/validate inputs, classify URLs or search Drive titles, resolve Base coordinates (optionally enrich with fields/record data), add standardized hints, include unit tests, register in the shortcuts catalog, and update SKILL docs.

Changes

Base URL and Title Resolution Shortcuts

Layer / File(s) Summary
Shortcut Definitions and Input Validation
shortcuts/base/base_resolve.go
BaseURLResolve and BaseTitleResolve shortcuts plus shared hint constants, CLI flags, and input validation enforcing mutual exclusivity of --url and --query.
URL Parsing, Classification, and Dispatcher
shortcuts/base/base_resolve.go
Parses full HTTP/HTTPS URLs, classifies supported/unsupported path patterns, and dispatches to the appropriate resolver or returns standardized validation errors.
Per-URL-Type Resolvers
shortcuts/base/base_resolve.go
Resolves Base URLs into token/coords, performs Wiki node lookup and bitable validation, extracts record-share metadata and optionally enriches hints, and constructs form-share payloads.
Title Search and Candidate Normalization
shortcuts/base/base_resolve.go
Builds Drive search for BITABLE docs, runs the search, normalizes/filter candidates (strips <h> highlights), and emits a single resolved payload or a candidates list with next_step.
Hint Enrichment and Record Formatting
shortcuts/base/base_resolve.go
Lists fields for base/table pairs, batch-fetches records when available, formats row values into keyed maps for hint.record_data, and computes hint.next_step.
Validation, Path and String Helpers
shortcuts/base/base_resolve.go
Adds resolve validation error builder, URL/path normalization and segment helpers, and safe string utilities used across resolution flows.
Unit Tests, Catalog Registration, and Docs
shortcuts/base/base_resolve_test.go, shortcuts/base/shortcuts.go, shortcuts/base/base_shortcuts_test.go, skills/lark-base/SKILL.md
Comprehensive tests with deterministic HTTP stubs for all flows, adds BaseURLResolve/BaseTitleResolve to the shortcuts catalog and its test expectations, and updates SKILL documentation on Base coordinate locating.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • larksuite/cli#1044: Related changes registering new base shortcut commands in the catalog.
  • larksuite/cli#982: Related SKILL documentation edits aligning Wiki→Base token resolution with node/get behavior.

Suggested reviewers

  • kongenpei
  • wittam-01

Poem

🐰 Two shortcuts hop across the glade,
URL or title, a path well-laid.
Tokens found and hints arranged,
Fields and records gently framed.
Tests assure the rabbit's aid.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.56% 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
Description check ✅ Passed The description is comprehensive and follows the template structure with Summary, Changes, and Validation sections, though it omits the Test Plan and Related Issues sections.
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.
Title check ✅ Passed The PR title 'feat(base): Add Base URL and title resolve shortcuts' directly and clearly describes the main changes: two new CLI shortcuts for resolving Base URLs and titles.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


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 and usage tips.

@github-actions github-actions Bot added domain/base PR touches the base domain size/L Large or sensitive change across domains or core paths labels Jun 9, 2026
@zgz2048
zgz2048 force-pushed the codex/base-url-title-resolve branch 2 times, most recently from 8d36067 to 3d80cfc Compare June 9, 2026 04:06
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.24852% with 60 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.85%. Comparing base (cc416a4) to head (2399ea5).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/base/base_resolve.go 82.14% 45 Missing and 15 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1338      +/-   ##
==========================================
+ Coverage   71.47%   71.85%   +0.37%     
==========================================
  Files         688      691       +3     
  Lines       65483    65916     +433     
==========================================
+ Hits        46807    47362     +555     
+ Misses      15031    14886     -145     
- Partials     3645     3668      +23     

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

@zgz2048
zgz2048 marked this pull request as ready for review June 9, 2026 08:00
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add zgz2048/cli#codex/base-url-title-resolve -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: 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/base/base_resolve.go`:
- Around line 369-399: The code is turning nil metadata into the string "<nil>"
when building keys; update formatResolvedRecord and resolvedRecordFieldKey to
treat nil as missing: in formatResolvedRecord only set out["record_id"] if
recordIDs[0] != nil (don’t fmt.Sprintf nil), and in resolvedRecordFieldKey check
each slice element for nil before stringifying (if nil treat as empty string) so
the key-building logic falls back to the remaining metadata or a default like
"field_<index>" (e.g., prefer non-empty fieldID, else use fieldName if
non-empty, else "field_<index>"). Use the existing symbols recordIDs, fieldIDs,
fieldNames, formatResolvedRecord and resolvedRecordFieldKey to locate the
changes.
🪄 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: 93a7a065-e621-4728-9bb2-2071d0e1aeae

📥 Commits

Reviewing files that changed from the base of the PR and between b543027 and 840082b.

📒 Files selected for processing (2)
  • shortcuts/base/base_resolve.go
  • shortcuts/base/base_resolve_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • shortcuts/base/base_resolve_test.go

Comment thread shortcuts/base/base_resolve.go Outdated
@zgz2048 zgz2048 changed the title [codex] Add Base URL and title resolve shortcuts feat(base): Add Base URL and title resolve shortcuts Jun 9, 2026
@zgz2048
zgz2048 force-pushed the codex/base-url-title-resolve branch from 2399ea5 to 820113f Compare June 24, 2026 14:06
@zgz2048
zgz2048 merged commit 7df37ed into larksuite:main Jun 24, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/base PR touches the base domain size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

【Feature request】支持直接通过多维表格记录链接直接读取记录内容,而不是多个链接才能读取。

2 participants