lanhu-cli

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: MIT

README

lanhu-cli

Go CLI and Agent Skill for reading Lanhu (蓝湖) designs, design context, slices, product docs, and invite links — built for scripts and coding agents.

Status: active development. Offline tests, real Lanhu smoke (T09-03), and release dry-run (T09-04) are green. This is not an official Lanhu product.

License

MIT — see LICENSE and THIRD_PARTY_NOTICES.md.

Requirements

  • Go version matching go.mod (developed on Go 1.26.x), or Homebrew for install
  • No Node, Python, Docker, or browser required for the core CLI

Install (Homebrew)

Homebrew requires a tap. This repository includes Formula/lanhu.rb.

# one-time: tap this repo (GitHub)
brew tap iwen-conf/lanhu-cli https://github.com/iwen-conf/lanhu-cli

# install
brew install iwen-conf/lanhu-cli/lanhu
lanhu version

From a local checkout (before/without push):

brew untap iwen-conf/lanhu-cli 2>/dev/null || true
brew tap iwen-conf/lanhu-cli "file://$(pwd)"
# ensure Formula is present in the tap (file:// clones git state)
mkdir -p "$(brew --repository)/Library/Taps/iwen-conf/homebrew-lanhu-cli/Formula"
cp Formula/lanhu.rb "$(brew --repository)/Library/Taps/iwen-conf/homebrew-lanhu-cli/Formula/"
brew reinstall iwen-conf/lanhu-cli/lanhu

Upgrade after formula url/sha256/version are bumped for a new commit:

brew update
brew upgrade iwen-conf/lanhu-cli/lanhu
# or track tip of main:
brew install --HEAD iwen-conf/lanhu-cli/lanhu

Uninstall:

brew uninstall lanhu
brew untap iwen-conf/lanhu-cli   # optional

Install from source / GitHub Releases

go install github.com/iwen-conf/lanhu-cli/cmd/lanhu@latest
# or download platform archives from GitHub Releases (includes LICENSE + notices)

Quick start (from source)

go test ./...
go run ./cmd/lanhu version
# optional: local multi-platform release dry-run
VERSION=dev ./scripts/release-build.sh && ./scripts/verify-release-dist.sh dist

Store/update the user Cookie without putting it in shell history:

pbpaste | go run ./cmd/lanhu auth cookie set --stdin  # macOS example
go run ./cmd/lanhu doctor

Export a version-locked pixel specification for one design page:

go run ./cmd/lanhu design inspect '<design-url>' --out .lanhu-cli.local/page --source figma --download-assets

The package contains the raw design JSON, normalized element geometry/spacing, frame membership, slice and asset inventories, preview when available, and a manifest. After the target project captures an equal-size screenshot, generate repeatable comparison evidence with:

go run ./cmd/lanhu design compare reference.png actual.png --out .lanhu-cli.local/page/compare

This writes diff.png, overlay.png, and pixel-report.json; differences over the configured tolerance exit with code 5 after preserving the report. Pixel parity is established only after every requested page/state passes the workflow described by skills/lanhu-design.

Documentation

Area Path
Requirements docs/01-需求分析/
References docs/02-参考文档/
Task plan & progress docs/03-任务/01-lanhu-cli与skill/
Agent conventions AGENTS.md

Module

github.com/iwen-conf/lanhu-cli

License

License file is deferred until Q-011 is decided by the project owner. Reference projects used for research remain separately attributed under their own licenses (see docs/02-参考文档/).

Directories

Path Synopsis
cmd
lanhu command
Command lanhu is the CLI entrypoint for the lanhu-cli project.
Command lanhu is the CLI entrypoint for the lanhu-cli project.
internal
buildinfo
Package buildinfo holds binary version metadata injectable via ldflags.
Package buildinfo holds binary version metadata injectable via ldflags.
cli
config
Package config loads CLI settings and credentials without writing secrets.
Package config loads CLI settings and credentials without writing secrets.
domain/entities
Package entities holds pure domain types with no I/O.
Package entities holds pure domain types with no I/O.
infrastructure/gateways/lanhu
Package lanhu implements Lanhu HTTP gateways and URL parsing.
Package lanhu implements Lanhu HTTP gateways and URL parsing.
infrastructure/support/fsx
Package fsx provides path-root confinement, atomic writes, and file digests.
Package fsx provides path-root confinement, atomic writes, and file digests.
infrastructure/support/imagex
Package imagex validates downloaded design images and reports their actual format.
Package imagex validates downloaded design images and reports their actual format.
infrastructure/support/observability
Package observability provides request IDs and a single slog-based logger (D-012).
Package observability provides request IDs and a single slog-based logger (D-012).
transform/geometry
Package geometry converts Lanhu design JSON into an auditable pixel ledger.
Package geometry converts Lanhu design JSON into an auditable pixel ledger.
transform/htmlcss
Package htmlcss converts DDS schema-like JSON into HTML+CSS.
Package htmlcss converts DDS schema-like JSON into HTML+CSS.
transform/style
Package style holds intermediate layout lengths used by CSS and Tailwind renderers.
Package style holds intermediate layout lengths used by CSS and Tailwind renderers.
transform/tailwind
Package tailwind renders design schema trees to Tailwind utility classes.
Package tailwind renders design schema trees to Tailwind utility classes.
transform/tokens
Package tokens extracts design tokens and high-risk layer notes from schema JSON.
Package tokens extracts design tokens and high-risk layer notes from schema JSON.
usecase/design
Package design implements design list/show/raw/context use cases.
Package design implements design list/show/raw/context use cases.
usecase/doctor
Package doctor implements local (and later network) diagnostics.
Package doctor implements local (and later network) diagnostics.
usecase/invite
Package invite resolves Lanhu invite links without following unsafe redirects.
Package invite resolves Lanhu invite links without following unsafe redirects.
usecase/product
Package product implements product document use cases.
Package product implements product document use cases.
usecase/shared
Package shared holds application-layer contracts shared by use cases.
Package shared holds application-layer contracts shared by use cases.
usecase/slice
Package slice implements slice discovery and download.
Package slice implements slice discovery and download.
wire
Package wire is the composition root: InitXxx only, no business logic.
Package wire is the composition root: InitXxx only, no business logic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL