contrueCT opened a new pull request, #8218: URL: https://github.com/apache/incubator-seata/pull/8218
- [x] I have read the [CONTRIBUTING.md](https://github.com/apache/incubator-seata/blob/2.x/CONTRIBUTING.md) guidelines. - [ ] I have registered the PR [changes](https://github.com/apache/incubator-seata/tree/2.x/changes). ### Ⅰ. Describe what this PR did Add an independent Go module at `tools/seata-ai-cli` as the first implementation checkpoints for an agent-oriented Seata CLI. This establishes a shared invocation contract, discoverable commands, and tested local storage / HTTP primitives before connecting business operations. - **Protocol and discovery:** derive the Cobra command tree and canonical JSON validation from one registry containing 57 command definitions and 56 invocation schemas. Implement system help, schema, capabilities and version, with canonical invocation dispatch, strict JSON parsing, stable exit categories and validated output envelopes. Unimplemented business commands return `command_unavailable`; registry presence does not imply availability. - **Local consistency foundation:** implement SQLite WAL/FULL storage, atomic journal transitions and plan consumption, generation fences, process lifetime ownership locks, and recovery that preserves uncertain outcomes without replaying a remote write. Include restrictive filesystem checks and deadline-bounded lock waiting. - **Read transport foundation:** allow only four source-inspected GET operations, require an explicitly accepted endpoint, preserve management base paths, validate TLS, reject redirects, and bound retries, deadlines and JSON response sizes. This transport is not yet connected to business command handlers. - **Contract coverage:** retain machine-readable design fixtures with checksum verification; compile runtime contracts with strict Ajv and validate independent positive/negative cases. The five implementation commits are retained as review checkpoints. No Java service behavior or TC Admin API is changed. **Scope implemented in this PR**  <details> <summary>Full v0.1 design workflow — context for subsequent stages</summary> The supplied workflow below describes the broader design target, including authentication, diagnosis and controlled recovery. Those flows are not all implemented by this PR. Its technology/version labels are design context; the actual module currently declares Go 1.27.1.  </details> ### Ⅱ. Does this pull request fix one issue? No linked issue. This is an initial foundation implementation for review. ### Ⅲ. Why don't you add test cases (unit test/integration test)? Tests are included: typed/canonical invocation parity, schema and output validation, duplicate JSON keys and large integers, SQLite transaction rollback and concurrent claims, subprocess crash recovery and ownership, and local HTTP/TLS server tests for redirects, retry limits, cancellation and response bounds. Real Seata deployment integration and release/platform certification have **not** been performed. Local HTTP test servers provide transport evidence only. ### Ⅳ. Describe how to verify it From `tools/seata-ai-cli`, using Go 1.27.1 and Node/npm: ```sh go test ./... go test -race ./internal/adapter/statestore ./internal/adapter/transport ./internal/protocol go vet ./... npm ci --prefix test/contract npm test --prefix test/contract go run ./cmd/seata-ai --help go run ./cmd/seata-ai system version go run ./cmd/seata-ai system capabilities ``` Local Go tests, the targeted race checks, `go vet`, and strict Ajv validation passed. Ajv compiled 56 invocation contracts and four implemented command-data schemas, accepted the supplied invocation examples, and checked 19 independent corpus cases. These are local results, not an upstream CI pass. ### Ⅴ. Special notes for reviews - Profile/credential workflows, business command wiring, diagnosis, remote writes and real Seata integration acceptance remain follow-up work. Production writes are disabled. The journal is a consistency foundation, not a completed remote executor. - SQLite filesystem support is currently experimental on Linux ext-family filesystems; other platforms fail closed. The Go module is independent of the Maven build; existing Java CI does not establish Go coverage. - The large diff is substantially machine-readable contracts and test fixtures. Runtime code is under `cmd/` and `internal/`; contract verification is under `test/contract/`. - Documentation and changelog files are intentionally excluded from this code-only submission, so the changelog checkbox remains open. Both illustrations are hosted separately in [Gist](https://gist.github.com/contrueCT/aa46771322efd0b7ba36d6c05ba63138). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
