* ci(interface): 添加接口完整性和CLI烟雾测试检查 - 在Makefile中新增interface-integrity、update-interface-baseline、cli-smoke和mock-mcp-smoke目标 - 实现接口基线脚本以比较CLI公共命令树与基线文件 - 新增脚本确保二进制文件可渲染所有顶层命令的帮助信息 - 添加mock-mcp-smoke测试验证HTTP和stdio MCP请求/响应传输 - 在GitHub Actions CI工作流中加入interface-integrity、cli-smoke和mock-mcp-smoke检查 - 新增AI行为检查工作流,限制AI生成PR的改动范围和禁改保护文件 - 文档中补充PR质量门禁要求及接口变更流程说明 * feat(policy): 增加多项兼容性和完整性检查 - Makefile中新增reset-interface-baseline、schema-compatibility、update-schema-baseline、skill-command-integrity等目标 - CI流程新增schema-compatibility和skill-command-integrity步骤 - 文档中详细说明接口兼容性基线更新和重置流程及schema基线注意事项 - 实现interface-baseline工具支持兼容性重置和合并,多项接口兼容性检查逻辑完善 - 新增schema-compat工具用于标准化schema列表及兼容性检查与合并 - 新增skill-command-integrity检查确保技能中引用命令存在 - 为interface-baseline和schema-compat添加单元测试覆盖基本兼容性规则 * test(skill-command-check): 增加命令解析和解析结果测试用例 - 补充对 parseReference 函数的边界情况和跳过条件的测试 - 新增 resolveCommandReference 函数测试,覆盖有效、无效及跳过场景 - 增加 isPlaceholder 函数的测试,验证占位符识别准确性 refactor(skill-command-check): 优化命令路径解析和验证逻辑 - 使用 resolveCommandReference 统一处理命令解析结果,清晰区分有效、无效和跳过情况 - 新增 commandResolution 类型及常量,提升代码可读性和扩展性 - 调整 parseReference 增加对 shell 组合符 “ & ” 的跳过处理 docs(mono): 更新最佳实践和产品文档命令示例 - 优化《best_practices/07-minutes.md》中行动项与摘要拉取示例命令,提升准确性 - 修改产品文档中 ALIDOC 表格数据和多维表格记录相关命令,命令路径更规范统一 - 同步多端技能文档,确保命令示例一致且正确 * ci: check interface against PR merge-base * feat(policy): enforce CLI contract compatibility * ci: enforce PR coverage thresholds * ci: add fail-closed CI gate * ci: adapt schema compatibility gate to runtime catalog * fix(ci): close schema compatibility gate gaps * test(auth): skip POSIX mode assertion on Windows * test(auth): scope POSIX file-backend checks * fix(ci): enforce native platform coverage * test(ci): make skill paths portable --------- Co-authored-by: 修雨 <huyizhou.hyz@alibaba-inc.com>
140 lines
5.9 KiB
Makefile
140 lines
5.9 KiB
Makefile
GO ?= go
|
|
|
|
.PHONY: all help build rebuild test lint fmt policy edition-test interface-integrity authoritative-interface-integrity coverage-gate coverage-gate-platform update-interface-baseline reset-interface-baseline schema-compatibility skill-command-integrity cli-smoke mock-mcp-smoke test-schema-agent-examples generate-schema generate-schema-agent-metadata generate-schema-catalog package release publish-homebrew-formula setup-hooks
|
|
|
|
all: setup-hooks fmt lint build test rebuild
|
|
|
|
help:
|
|
@printf "Available targets:\n"
|
|
@printf " make build - Build the dws CLI binary\n"
|
|
@printf " make test - Run the Go test suite\n"
|
|
@printf " make lint - Run formatting checks and golangci-lint when available\n"
|
|
@printf " make fmt - Format Go source files\n"
|
|
@printf " make policy - Run open-source asset and Schema registry checks\n"
|
|
@printf " make interface-integrity - Check historical commands and help contracts still work\n"
|
|
@printf " make authoritative-interface-integrity BASE_REF=<ref> - Check the Git-owned PR merge-base\n"
|
|
@printf " make coverage-gate BASE_REF=<ref> - Enforce overall non-regression and changed-code coverage\n"
|
|
@printf " make coverage-gate-platform BASE_REF=<ref> PROFILE=<file> - Enforce native-platform changed-code coverage\n"
|
|
@printf " make update-interface-baseline - Add new CLI contracts without removing history\n"
|
|
@printf " make reset-interface-baseline - DANGEROUS: replace all CLI compatibility history\n"
|
|
@printf " make schema-compatibility BASE_REF=<ref> - Check the complete Schema contract against the PR merge-base\n"
|
|
@printf " make skill-command-integrity - Check dws commands referenced by skills exist\n"
|
|
@printf " make cli-smoke - Verify help for every public top-level command\n"
|
|
@printf " make mock-mcp-smoke - Verify HTTP and stdio MCP request/response transport\n"
|
|
@printf " make test-schema-agent-examples - Contract-check all Agent examples and dry-run the eligible subset\n"
|
|
@printf " make generate-schema - Regenerate embedded Agent metadata and the release Catalog\n"
|
|
@printf " make generate-schema-agent-metadata - Regenerate versioned Agent metadata\n"
|
|
@printf " make generate-schema-catalog - Regenerate the embedded release Catalog\n"
|
|
@printf " make package - Build all release artifacts locally (goreleaser snapshot)\n"
|
|
@printf " make release - Build and publish a release via goreleaser\n"
|
|
@printf " make publish-homebrew-formula - Push dist/homebrew/dingtalk-workspace-cli.rb to a tap repo\n"
|
|
|
|
build:
|
|
@./scripts/dev/build.sh
|
|
|
|
rebuild:
|
|
@./scripts/dev/build.sh
|
|
|
|
test:
|
|
@./test/scripts/run_all_tests.sh
|
|
|
|
lint:
|
|
@./scripts/dev/lint.sh
|
|
|
|
fmt:
|
|
@find cmd internal test scripts/policy -name '*.go' -print0 2>/dev/null | xargs -0r gofmt -w
|
|
|
|
policy:
|
|
@./scripts/policy/check-open-source-assets.sh
|
|
@./scripts/policy/check-schema-command-registry.sh
|
|
@./scripts/policy/check-command-surface.sh --strict
|
|
@./scripts/policy/check-generated-drift.sh
|
|
@./scripts/policy/check-schema-catalog.sh
|
|
@./scripts/policy/check-schema-binary.sh
|
|
@$(MAKE) test-schema-agent-examples
|
|
|
|
edition-test:
|
|
$(GO) test -v -count=1 ./pkg/editiontest/...
|
|
|
|
interface-integrity:
|
|
@./scripts/policy/check-interface-baseline.sh
|
|
|
|
authoritative-interface-integrity:
|
|
@./scripts/policy/check-authoritative-interface-baselines.sh --base-ref "$(BASE_REF)"
|
|
|
|
coverage-gate:
|
|
@./scripts/policy/check-coverage-gate.sh --base-ref "$(BASE_REF)" --scope-buildable
|
|
|
|
coverage-gate-platform:
|
|
@./scripts/policy/run-platform-coverage-gate.sh --base-ref "$(BASE_REF)" --profile "$(PROFILE)"
|
|
|
|
update-interface-baseline:
|
|
@./scripts/policy/check-interface-baseline.sh --update
|
|
|
|
reset-interface-baseline:
|
|
@./scripts/policy/check-interface-baseline.sh --reset
|
|
|
|
schema-compatibility:
|
|
@./scripts/policy/check-authoritative-schema-compatibility.sh --base-ref "$(BASE_REF)"
|
|
|
|
skill-command-integrity:
|
|
@./scripts/policy/check-skill-commands.sh
|
|
|
|
cli-smoke:
|
|
@./scripts/policy/check-cli-smoke.sh
|
|
|
|
mock-mcp-smoke:
|
|
$(GO) test -v -count=1 -run '^(TestHTTPClientEndToEnd|TestStdioClientEndToEnd)$$' ./internal/transport
|
|
|
|
test-schema-agent-examples:
|
|
DWS_AGENT_EXAMPLES_DRY_RUN=1 $(GO) test -v -count=1 ./internal/app -run '^TestManualAgentExamplesDryRun$$'
|
|
|
|
generate-schema:
|
|
@set -e; \
|
|
registry_guard=$$(mktemp); \
|
|
metadata_guard=$$(mktemp -d); \
|
|
selection_guard=$$(mktemp -d); \
|
|
trap 'rm -rf "$$registry_guard" "$$metadata_guard" "$$selection_guard"' EXIT HUP INT TERM; \
|
|
cp internal/cli/schema_command_registry.json "$$registry_guard"; \
|
|
cp -R internal/cli/schema_hints/metadata/. "$$metadata_guard/"; \
|
|
cp -R internal/cli/schema_hints/selection/. "$$selection_guard/"; \
|
|
$(GO) generate ./internal/cli; \
|
|
cmp -s internal/cli/schema_command_registry.json "$$registry_guard" || { \
|
|
printf '%s\n' 'generation modified reviewed input internal/cli/schema_command_registry.json' >&2; \
|
|
exit 1; \
|
|
}; \
|
|
diff -qr internal/cli/schema_hints/metadata "$$metadata_guard" >/dev/null || { \
|
|
printf '%s\n' 'generation modified reviewed input internal/cli/schema_hints/metadata' >&2; \
|
|
exit 1; \
|
|
}; \
|
|
diff -qr internal/cli/schema_hints/selection "$$selection_guard" >/dev/null || { \
|
|
printf '%s\n' 'generation modified reviewed input internal/cli/schema_hints/selection' >&2; \
|
|
exit 1; \
|
|
}
|
|
|
|
generate-schema-agent-metadata:
|
|
$(GO) run ./internal/generator/cmd_schema_agent_metadata \
|
|
-root . \
|
|
-registry internal/cli/schema_command_registry.json \
|
|
-output-dir internal/cli/schema_agent_metadata \
|
|
-audit-output internal/cli/schema_agent_metadata_audit.json
|
|
|
|
generate-schema-catalog:
|
|
$(GO) run -a ./internal/generator/cmd_schema_catalog \
|
|
-root . \
|
|
-output internal/cli/schema_catalog.json
|
|
|
|
package:
|
|
@./scripts/dev/build-all.sh
|
|
@./scripts/release/post-goreleaser.sh
|
|
|
|
publish-homebrew-formula:
|
|
@./scripts/release/publish-homebrew-formula.sh
|
|
|
|
setup-hooks:
|
|
@git config core.hooksPath scripts/hooks 2>/dev/null || true
|
|
|
|
release:
|
|
goreleaser release --clean
|
|
@./scripts/release/post-goreleaser.sh
|