2.4 KiB
2.4 KiB
Architecture
dws is a Go CLI that turns DingTalk MCP metadata into a command-line surface for both humans and AI agents.
High-Level Flow
cmdis the CLI entrypoint, invokinginternal/appto build the root Cobra command tree.internal/appwires static utility commands (auth,audit,schema,completion), product helper commands, and plugin commands.internal/helperscontains the main command handlers for all product surfaces (dev,chat,calendar,contact,aitable, etc.).internal/executorandinternal/transportexecute MCP JSON-RPC calls;internal/outputformats responses.internal/authmanages login state, PAT tokens, and agent-code detection.
Repository Structure
cmd: CLI entrypointinternal/app: root command wiring, static utility commands, and plugin loadinginternal/helpers: product command handlers (dev, chat, calendar, contact, etc.)internal/plugin: plugin-based dynamic command loaderinternal/cli: catalog types and endpoint loader (static endpoint mode)internal/executor: invocation dispatch and result handlinginternal/transport: MCP HTTP client and request signinginternal/auth: login, token management, agent-code detection, identityinternal/audit: user operation audit log (JSONL, hash chain, forwarding)internal/errors: structured error model with categories and hintsinternal/keychain: OS keychain integration for credential storageinternal/security: endpoint allowlist and domain trustinternal/safety: runtime safety checks (confirm prompts, dry-run guards)internal/cobracmd: shared Cobra command buildersinternal/pat: PAT (Personal Access Token) authorization flowinternal/output: response formatting (json, table, raw, pretty)internal/logging: structured logging and argument sanitizationinternal/tui: terminal UI helpersinternal/recovery: panic recovery and graceful degradationpkg/configmeta: environment variable registry and documentationpkg/config: configuration constants and pathspkg/edition: edition detection (oss vs enterprise)pkg/mcptypes: MCP protocol type definitionsinternal/syncdata: generated static endpoint and command-routing data synced from the Wukong baselineskills/: bundled agent skills (mono/ and multi/ layouts)test/: CLI, integration, contract, unit, and skill E2E testsscripts/: install scripts, policy checks, and CI helpers