# CLI Command Map

Run bare `kanject` for a short, project-aware landing screen; use `kanject --help` for the complete tree. Commands then fit into setup, local work, or provider operations. Root commands work on the project tree; provider-bound commands live under keys such as `kanject aws` and `kanject github`.

```bash
kanject <root-command>          # provider-agnostic, works on the project tree
kanject aws <cloud-command>     # provider-bound cloud operations
```

- **Set up** — Create or adopt a service and verify the local toolchain.
- **Daily** — Manage entries, stages, env, cross-repo dependencies, tests, and migrations.
- **AWS** — Deploy, roll back, inspect ledger history, manage preview stacks, bootstrap CI, distribute artifacts.

## Set up

- `kanject new <template>` — scaffold a deploy-ready service from a template (and run `init` for you). Guide: [Project Templates](https://www.kanject.com/docs/cli-templates/).
- `kanject init` — adopt an existing project: writes the `kanject-cli/` tree, stage files, `.gitignore` entries, and git hooks.
- `kanject doctor` — pre-flight checks, **fully offline** without `--env`; add `--env <stage>` for stage checks and `--json` for a CI-parseable report. Guide: [Troubleshooting](https://www.kanject.com/docs/cli-troubleshooting/).
- `kanject update` — update the CLI and template pack, then self-verify the new install (`--check-only`, `--templates-only`, `--json`).
- `kanject install provider [key]` — install an optional provider plugin; omit the key on a terminal to choose from the curated providers.

## Daily loop

- `kanject add function | stage | lib | env | param | secret | distributable` — register a Lambda entry, a stage, a cross-repo dependency, or a plain / SSM / Secrets Manager config value in the manifest and stage files. Guides: [Dependencies](https://www.kanject.com/docs/cli-dependencies/), [Local Development](https://www.kanject.com/docs/cli-local-dev/).
- `kanject configure distribution` — interactively add a distribution destination; `list`/`ls` inspects mappings and `remove` deletes one.
- `kanject env` — inspect local stage values and masked `param:` / `secret:` bindings; `--show-values` reveals binding strings but never fetches AWS values. Guide: [Local Development](https://www.kanject.com/docs/cli-local-dev/).
- `kanject sync` — resolve cross-repo dependencies into the lockfile and generated MSBuild imports; `--locked` verifies in CI, `--offline` replays the lock. Guide: [Dependencies](https://www.kanject.com/docs/cli-dependencies/).
- `kanject msbuild status | enable` — inspect or stand up the generated dependency wiring and git hooks.
- `kanject test` — run the service locally with the right runner per project type; `--watch`, `--event`, `--http`, `--debug`, and `--pull-env` for a stage's real config. Guide: [Local Development](https://www.kanject.com/docs/cli-local-dev/).
- `kanject migrate` — adopt legacy cross-repo `<ProjectReference>`s into the manifest (`--dry-run` first); `--schema-v2` upgrades a v1 manifest in place.

## AWS provider

- `kanject aws deploy` — build and ship a stage: Lambda, ECS Fargate, or a static site, per entry. `--dry-run` renders the plan without AWS changes. Guides: [Deploy targets](https://www.kanject.com/docs/deploy-targets/), [Deployment](https://www.kanject.com/docs/deployment/).
- `kanject aws rollback` — flip the `live` alias to a prior revision: `--to previous | previous-stable | <sha> | <version>`. No rebuild.
- `kanject aws deployments list | show | mark | gc` — read the S3 deployment ledger, annotate revisions `stable` / `broken`, and sweep artifacts outside the rollback window. Guide: [Deployment](https://www.kanject.com/docs/deployment/).
- `kanject aws preview publish | ls | url | extend | rm` — publish static-site previews and manage the live stack-backed/static-site preview inventory. These commands read provider state.
- `kanject aws pipeline up | init | bootstrap` — provision the AWS-native CodePipeline CI surface; `up` is the idempotent one-command path. Guide: [CI/CD Pipeline](https://www.kanject.com/docs/cli-pipeline/).
- `kanject aws configure vpc | domain` — interactive wizards that validate and write a stage's network and custom-domain config.
- `kanject aws distribute` — publish declared distributables to S3, CodeArtifact, or (via the `github` plugin) GitHub Releases. Guide: [Distribute](https://www.kanject.com/docs/distribute/).
- `kanject aws template migrate` — preview or apply migration from generated stage templates to a committed `template.json` base.
- `kanject github distribute` — publish only distribution cells mapped to GitHub Releases.

> **Progressive stage selection:** Stage-aware commands accept `--env <stage>`; `--stage <stage>` is an equal alias. When omitted interactively, progressive commands use the sole manifest stage or show a picker. Scripts and redirected input must pass the stage explicitly. Most commands also take `--cwd <dir>`.

> **Automation contract:** `--non-interactive` prevents prompts; it never grants approval. `--yes` grants an explicit confirmation. `--json` implies non-interactive output, not consent, so a mutating JSON command may require both `--json` and `--yes`.

> **Hit an error code?:** Every diagnostic carries a stable `KANCLI###` code — the [diagnostic-code reference](https://www.kanject.com/docs/cli-diagnostics/) indexes all of them by the command that raises them.

---
_Source: https://www.kanject.com/docs/cli-commands/ · Kanject Docs_
