Files
dingtalk-workspace-cli/scripts/policy/with-catalog.sh
T
玉澜 51dc237d8a feat: declarative LeafSpec command framework + schema generation/consumption separation
== LeafSpec command framework (internal/helpers/leaf.go) ==
Declarative command construction: LeafSpec/LeafFlag/NewLeafCommand with
Call (pluggable dispatch), LeafInt, PostMount, Trim, Validate. Collapses
per-command hand-written required validation, alias/env fallback, value
transform, and toolArgs assembly into one declarative path.

== devapp migration (28/31 commands) ==
All MCP-direct devapp leaf commands migrated to LeafSpec. Factories
(devAppCall/devAppCallCursor/devAppMeta) fold 33 repeated closures.
fakeDevAppRunner asserts toolArgs for every migrated command. 4 complex
commands (delete/robot submit/result/config) kept hand-written.

== Schema generation/consumption separation ==
- gen.go: isolated //go:generate pragmas from business code.
- command_meta.go: ResolveMeta(cliPath) -> CommandMeta{Identity,Safety,Selection}.
- command_safety.go: SafetyForCLIPath + RenderSafetyAnnotation; safety metadata
  flows from embedded catalog into --help output.
- calendar.go HelpFunc fix: delegates to root HelpFunc at help-time.
- schema_catalog_structure.go: closed catalog structure validation gate.

== Registry + catalog per-product sharding ==
schema_command_registry and schema_catalog split into per-product shards,
eliminating concurrent-PR merge conflicts on these files.

== MCP metadata refresh tool ==
cmd/fetch_mcp_metadata: iterates 26 MCP server endpoints, merges with previous
data for cross-server interface_ref. make fetch-mcp-metadata target.

== AGENTS.md ==
Documents the generation/consumption split.

Verified: make policy exit 0, drift zero, all tests pass.
2026-07-19 09:38:43 +08:00

26 lines
978 B
Bash
Executable File

#!/bin/sh
# Reassemble the split release Catalog shards back into the single JSON
# document shape (version + surface_hash + source_hash + catalog + tools) that
# the policy jq queries consume.
#
# The Catalog is a committed global file (schema_catalog/catalog.json); each
# product's leaf ToolSpecs live in their own shard (schema_catalog/tools/*.json)
# so concurrent feature PRs only rewrite one shard. This helper merges the
# shards back into one document so existing jq queries keep working unchanged.
set -eu
ROOT="$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)"
dir="$ROOT/internal/cli/schema_catalog"
jq -s '
.[0] as $envelope |
($envelope.surface_hash // null) as $surface |
{
version: $envelope.version,
source_hash: $envelope.source_hash,
catalog: $envelope.catalog,
tools: (reduce .[1:][] as $shard ({}; . + ($shard.tools // {})))
} +
(if $surface then {surface_hash: $surface} else {} end)
' "$dir/catalog.json" "$dir"/tools/*.json