Add headless CI setup commands: ci apply and ci install#923
Draft
0x0079 wants to merge 5 commits into
Draft
Conversation
CI / fully-managed environments need to configure (provider, model, agent) without any interactive prompts. Existing `provider add` + `agent apply` both fall through to stdin reads, which hang in non-TTY contexts. This adds a flat command that takes everything via flags, upserts the provider by name (idempotent re-runs), and delegates to ApplyAgent with Force=true.
Provider name added no value — URL already uniquely identifies an endpoint. Upsert now iterates ListProviders() matching APIBase; new providers use the URL as their display name too. Remove --provider-name flag and ciSpec field.
New subcommand wraps `npm install -g <pkg>[@Version]` for the three supported agents. Package mapping lives in AgentInfo.NPMPackage so each agent owns its own canonical name; --package and --version flags allow overrides for forks and version pinning. Sudo is intentionally not handled — npm's own EACCES message is more informative.
install.sh fetches nvm, installs LTS Node, then `npm install -g tingly-box` from defaults. install-mirror.sh routes the same flow through gh-proxy (github), npmmirror node binaries, and registry.npmmirror.com so users on restricted networks can finish the bootstrap without manual mirror config. Both scripts are idempotent: re-running detects an existing nvm install and skips re-fetching it. Mirror endpoints are env-overridable. Unignore the script/ directory so these (and future) helpers are tracked.
Drop the gh-proxy hop for nvm bootstrap and clone directly from gitee.com/mirrors/nvm — fewer moving parts, more reliable inside CN. Skip the upstream install.sh entirely; replicate its profile-snippet append manually (idempotent grep) so subsequent shells still pick up nvm. Node binaries and the npm registry continue to use Taobao (npmmirror.com), which was already the default.
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
Adds headless one-shot agent setup for CI and fully-managed environments via two new commands:
tingly-box ci apply(configure provider/model/agent from flags) andtingly-box ci install(install agent CLI via npm). Both commands are non-interactive, idempotent, and designed for automation.Key Changes
New
ci applycommand (internal/command/ci.go,ci_runner.go):agent.ApplyAgentwithForce=trueto skip confirmation prompts--dry-runto preview changes without applyingNew
ci installcommand (internal/command/ci_install.go):--packageoverride--versionInstallation scripts (
script/install.sh,script/install-mirror.sh):install.sh: Standard installation from official sources (nvm + Node.js LTS + tingly-box)install-mirror.sh: Mirror-aware variant for mainland China networks (gitee nvm, npmmirror registry)Comprehensive test coverage (
internal/command/ci_test.go,ci_install_test.go):Agent metadata extension (
ai/agent/info.go):NPMPackagefield toAgentInfostructCLI integration (
cli/tingly-box/main.go):CICmdKongas top-levelcicommand withapplyas default subcommandImplementation Details
https://claude.ai/code/session_01HPEmfNiFZEMELLg858CCLJ