Skip to main content

Module init

Module init 

Source
Expand description

taskfast init — the onboarding command.

Replaces init.sh’s step 1-9 orchestration with a non-interactive, CLI-driven flow. Every input comes from a flag, an env var, or the existing Config file — there are no TTY prompts, because the caller is expected to be another agent/LLM.

§Scope (this slice, am-yvc)

  • api_key: direct via --api-key / TASKFAST_API_KEY / config file.
  • validate: GET /agents/me — must be active.
  • readiness: GET /agents/me/readiness — informs wallet gate.
  • wallet: BYOW via --wallet-address, or generate + keystore with a password sourced from --wallet-password-file / TASKFAST_WALLET_PASSWORD.
  • config file: load + write at ctx.config_path (default ./.taskfast/config.json, chmod 600 on unix).
  • final readiness assert.

§Scope (am-z58 extension)

  • --human-api-key (+ optional agent-* fields): when no agent key is available, POST /agents with the user PAT to mint one. The server derives owner_id from the PAT, so the CLI never asks the caller for it. The minted api_key is then used for the rest of the flow and written to the config file. Under --dry-run the mint is skipped and the envelope reports agent.action = "would_mint" — the rest of the flow is also skipped because the real agent key never materialized.

§Scope (am-iit extension)

  • Optional --webhook-url (+ --webhook-secret-file, repeat --webhook-event) folds webhook registration into the init run: PUT /agents/me/webhooks, persist the returned secret (chmod 600), and optionally replace the subscription list. Skipped silently when the URL isn’t supplied so callers who prefer a separate taskfast webhook register step still get the pre-am-iit flow.

Deferred to separate beads so this slice stays reviewable:

  • am-c74 — balance polling after faucet dispense.

§Scope (gh#142 extension)

  • End-of-init funding sanity check: a failed --fund faucet request or a zero wallet balance prints a prominent stderr warning with the manual fallback (cast rpc tempo_fundAddress … against the deployment’s advertised rpc_url, or https://wallet.tempo.xyz) and the server’s funding_hint when the readiness funded gate emits one. The run stays ok:true — the gap is a warning, not a failure.

§--dry-run semantics

Mutations short-circuit: no wallet POST, no config file write, no keystore write. A wallet is still generated (so the address is real) but its signer is dropped at the end of the function. Readiness and profile reads pass through.

Structs§

Args

Functions§

run
run_with_prompter
Same as run but with an injectable crate::cmd::init_tui::Prompter and an explicit interactive gate so tests can drive the TUI branches under cargo test (where neither stdin nor stdout is a TTY). Production callers should use run.