larksuite / larksuite/cli

feat(contact): persistent canonical contact store with chat-cache merge

Open
#664 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

domain/core enhancement
Dominant language
Go
Stars
17.3k
Forks
1.4k
Avg merge
2d 4h
Merged PRs (30d)
105

Description

Problem

lark-cli contact +search-user returns a fresh API result every time. Recipes that need to repeatedly resolve open_id ↔ display_name ↔ aliases ↔ identifiers (email/handle/employee_id) end up either:

  • Re-querying contact.users.search per call (rate-limit pressure + cost), or
  • Maintaining their own JSON store on disk (every recipe reinvents schema + lookup).

The existing +chat-search for chat IDs has the same problem.

Proposed shape

A local persistent store, scoped per lark-cli config (so multi-tenant setups stay separate), with three operations:

# Add or update a contact (idempotent on open_id)
lark-cli contact +canonical-set \
  --open-id ou_xxx \
  --name "Full Name" \
  --aliases '["FN", "Initials"]' \
  --identifiers '{"email":"x@y.com","github":"handle"}'

# Look up by name, alias, or open_id (substring or exact)
lark-cli contact +canonical-lookup --query "Full" --format json

# Show one (exact open_id)
lark-cli contact +canonical-show --open-id ou_xxx --format json

Storage: SQLite or a flat JSON next to the lark-cli config dir (whichever fits the existing config conventions).

Ideally +canonical-lookup falls back to the chat-member cache when no canonical hit is found (so a recently-active chat participant resolves even before it's been canonically set).

Why now

PM/customer-success recipes need stable contact resolution across sessions. Today every recipe carries its own contacts CSV.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing contact +search-user and +chat-search entry points, then inspect how lark-cli determines its config directory and stores the chat-member cache. Define the persistent store and the canonical-set, canonical-lookup, and canonical-show command behavior, including the proposed cache fallback. Done means contacts persist per configuration and all three commands support the stated lookup and output expectations.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.