Files
dingtalk-workspace-cli/internal/cli/gen.go
T
玉澜andCursor bb54761e50 perf(schema): add CommandMeta index so ResolveMeta skips full catalog decode
Publish a compact schema_meta_index.json beside the catalog so help/selection
lookups avoid decoding the full ToolSpec wire on the hot path.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 21:01:45 +08:00

41 lines
2.2 KiB
Go

// Copyright 2026 Alibaba Group
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// gen.go is the single entry point for reviewed CLI asset generation. It isolates
// all //go:generate pragmas from business code so that:
// - schema_catalog.go contains only types + embed.
// - Generation is a standalone process (make generate-schema triggers this).
// - The authored-input → generated-output contract is documented in one place.
//
// Generation inputs (authored, reviewed):
// 1. schema_command_registry/ identity (canonical/aliases/navigation)
// 2. contract.ProductDecl + leaf ContractFinal Agent routing / selection prose
// 3. schema_mcp_metadata.json MCP server tool definitions
// 4. schema_parameter_bindings.json parameter type/property mappings
// 5. param_concepts.json + schema reviewed parameter synonym policy
// 6. cobra command tree (Go runtime) flags/usage/required (reflected)
//
// schema_hints/ is retired entirely (must not reappear as a generation input).
// schema_agent_metadata/ is retired: Catalog generation injects Agent metadata
// in-memory and does not write or embed that intermediate JSON directory.
//
// Generation outputs (embedded at build):
// - schema_catalog/ per-product catalog shards (ToolSpec wire)
// - schema_meta_index.json CommandMeta summary for ResolveMeta
// - param_aliases_generated.go per-command parameter normalization
package cli
//go:generate go run -a ../generator/cmd_schema_catalog -root ../.. -output schema_catalog -meta-index schema_meta_index.json
//go:generate go run ../generator/cmd_param_aliases -root ../.. -output param_aliases_generated.go