feat(cli): add gen and verify commands#12
Merged
Merged
Conversation
- 实现 ExportDocs 函数生成 OpenAPI 文档的 Markdown 格式 - 实现 ExportTypeScript 函数生成 TypeScript 类型声明 - 实现 ExportClientBundle 和 ExportClient 函数生成多语言客户端 SDK - 实现 Generate 和 GenerateWithOptions 函数用于生成合约相关代码文件 - 添加 Result 和 Options 类型定义控制生成过程和输出 - 实现多种编程语言客户端生成包括 TypeScript、Dart、Java 和 Kotlin - 添加单元测试验证代码生成功能的正确性 - 实现错误码、端点、路由参数等元数据的代码生成逻辑 - 添加文件写入、格式化和新鲜度标记等辅助功能
- 将默认验证命令从 go test ./... 替换为 nucleus verify --dir . --json - 添加 --strict 参数到 lint 命令中以启用严格模式 - 在 GeneratedFreshnessForDir 中添加对生成目标路径的规范化和验证 - 引入 normalizeGeneratedTarget 函数防止路径遍历攻击 - 添加 generatedFreshnessReasonInvalidTarget 常量用于无效路径情况 - 新增 sanitizeCommandOutput 函数用于清理命令输出中的敏感信息 - 实现模块文件变更后的自动恢复功能 - 添加测试用例验证路径遍历防护和命令输出清理功能
spelens-gud
approved these changes
Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nucleus genCLI flow for reproducible contract and HTTP adapter artifacts, with human and JSON evidence output.nucleus verifyCLI flow for validation, strict linting, generated freshness,go mod tidy, imports, builds, and tests with sanitized evidence.gen, and refresh the bundledexample/hello-httpgenerated outputs and manifest metadata.Why
This completes the next pieces of the AI-safe loop from
describe -> plan -> gen -> lint -> verify, so generated artifacts and verification evidence can be produced through the CLI instead of ad hoc commands.Affected Contracts and Manifests
example/hello-http/nucleus.yamlwith generated targets underai.generated.example/hello-http/contract/genandexample/hello-http/internal/adapter/http/gen.contractandruntime/httpsubmodule pointers for generation and freshness support.Verification
rtk go test ./...- passed, 39 tests in 8 packages.rtk go test ./... -race -count=1- passed, 39 tests in 8 packages.rtk go run ./cmd/nucleus validate --dir example/hello-http- passed, 0 diagnostics.rtk go run ./cmd/nucleus validate --dir example/hello-http --json- passed.rtk go run ./cmd/nucleus lint --dir example/hello-http- passed, 0 findings.rtk go run ./cmd/nucleus gen --dir example/hello-http --json- passed, 8 generated files, source hash6399c0636543078a250f6ee503877d3a75637fe0242950245796a2299874b3a1.rtk go run ./cmd/nucleus verify --dir example/hello-http --json- passed, 7/7 steps.Notes on Default Root Commands
rtk go run ./cmd/nucleus validate --dir .- not applicable in the current repository root becausenucleus.yamlis absent.rtk go run ./cmd/nucleus lint --dir .- not applicable for the same root manifest absence.rtk go run ./cmd/nucleus verify --dir . --json- fails at the validate step for the same reason.Residual Risks