# chamoji setup

> Set up releases, memory sharing, Claude Code and the commit composer in one command, and run it again to change them.

Source: https://www.chamoji.dev/docs/commands/setup

Set up a repo in one command: releases for each app or package, memory sharing, Claude Code and the commit composer. On a terminal it shows what it found and saves with Enter. Run it again to see where each step stands, or to change something.

[SETUP] [SINCE 0.14.0] [MONOREPO-AWARE] [--json FOR CI AND AGENTS]

> **Note:** Setup never commits. It writes only the `release` section of
> `chamoji.config.json`, so review it and commit it yourself.

## What it does, in order

SETUP · chamoji setup

1. **Looks at the repo.** Its apps and packages, version files, tags and remotes, from git and the files, with no AI. With the `gh` CLI and a GitHub `origin`, it also reads the repo’s squash-merge setting, and gives up on that after 5 seconds.
2. **Says where each step stands.** With no step named, a line for releases, memory sharing, Claude Code and the hook: ✓ when it’s done, ○ when it isn’t, and – when it can’t run here. The setup screen shows these itself.
3. **Asks.** On a terminal, the setup screen shows what it found and the questions the repo can’t answer. Enter saves, c changes something, and Esc cancels. Without a terminal and without `--yes`, it says what it would do and writes nothing.
4. **Writes the release section.** Only the `release` section of `chamoji.config.json`. The file’s other keys are kept, and a section with nothing new is left untouched.
5. **Runs the per-clone steps.** Memory sharing, Claude Code and the commit composer hook, the ones you picked. The hook is offered, never assumed.

[Set up a repo](https://www.chamoji.dev/docs/set-up-a-repo.md) walks through the screen, what setup looks for, and what each step writes.

## Arguments

| Name | Type | Description |
| --- | --- | --- |
| `step` | releases \| memory \| agents \| hook · optional | Run just this step, such as `chamoji setup releases`. Leave it out to run them all. Any other word exits 1. On a terminal, a named `memory`, `agents` or `hook` step runs without asking. |

The four steps:

| Name | Type | Description |
| --- | --- | --- |
| `releases` | | Writes the `release` section. Named, it asks the release questions again, even when the section exists. |
| `memory` | | Makes this clone share memory through `origin`, as `chamoji init` does. It’s offered only when there is an `origin`. |
| `agents` | | Connects Claude Code: the MCP server in `.mcp.json` and a commit hook in `.claude/settings.json`. It’s offered when the repo has a `.claude` folder or `claude` is on your PATH. |
| `hook` | | Installs the commit composer hook in this clone, as `chamoji hook install` does. |

## Flags

| Name | Type | Description |
| --- | --- | --- |
| `--yes` | boolean | Take every recommended answer without asking. It runs the memory and Claude Code steps when they’re offered and not done, and never installs the hook unless you name it: `chamoji setup hook --yes`. With a step, it runs just that step. Works with `--json` and `--explain`. |
| `--json` | boolean | Print what setup found and did as JSON on stdout, and nothing else. It never opens the screen. Without `--yes` it writes nothing and reports what it would do. With `--yes` it does it, then reports. The keys are `found`, `answers`, `why`, `steps`, `wrote` and `squashMerge`. |
| `--explain` | boolean | Print each value of the release section and where it came from: detected in the repo, recommended for its shape, chosen on the screen, or kept from `chamoji.config.json`. Works with or without `--yes`. Under `--json` it prints nothing more; the JSON’s `why` holds the same sources. |
| `--no-update-check` | boolean | Don’t check npm for a newer chamoji. See [the update notice](https://www.chamoji.dev/docs/install.md#the-update-notice). |

## Common combinations

- `chamoji setup`: On a terminal: see what it found, change what you need, save with Enter.
- `chamoji setup --yes`: Take every recommended answer, as in a fresh clone or a script.
- `chamoji setup --json`: Let CI or an agent read what setup would do. Nothing is written.
- `chamoji setup releases --yes --explain`: Write the release section, and say where each value came from.
- `chamoji setup hook --yes`: Install the commit composer hook in this clone.
- `chamoji setup memory`: Share memory through `origin` in this clone, and nothing else.

## Output

These are from real runs in two small repos: `widgets`, a single package, and `shop`, with two apps and a shared package. The first run in `shop`, without `--yes` and with `--explain`, is on [Set up a repo](https://www.chamoji.dev/docs/set-up-a-repo.md#what-it-found).

In a single package there is nothing to set up for releases. Without a terminal, setup says what else it would do and exits 2:

```txt title="chamoji setup"
✓ releases need no setup in a single package
○ memory sharing is off in this clone
○ Claude Code isn't connected here yet
✓ the commit composer hook is installed in this clone

One package, so chamoji release already knows what to do; there's nothing to set up for releases.
Setup would also share memory through origin, as chamoji init does.
Setup would also connect Claude Code here, as chamoji init --agents does.
chamoji: setup needs a terminal to ask; run chamoji setup --yes to take every recommended answer
```

With `--json`, the report is JSON. This is `shop` before its first setup, trimmed in `why`. It exits 2, because something would change:

```txt title="chamoji setup --json"
{
  "found": {
    "kind": "apps",
    "units": [
      "mobile",
      "web"
    ],
    "excluded": [],
    "inheritedTags": [],
    "upstream": {
      "remote": null,
      "name": null,
      "since": null,
      "authors": []
    }
  },
  "answers": {
    "schema": 1,
    "shape": "apps",
    "units": {
      "mobile": {
        "path": "apps/mobile",
        "tag": "mobile/v{version}"
      },
      "web": {
        "path": "apps/web",
        "tag": "web/v{version}"
      }
    },
    "exclude": [],
    "sharedChanges": "ride-along",
    "rootFiles": "none"
  },
  "why": {
    "shape": "detected",
    "units": "detected",
    …
  },
  "steps": [
    {
      "step": "releases",
      "result": "written"
    },
    {
      "step": "memory",
      "result": "written"
    },
    {
      "step": "agents",
      "result": "written"
    },
    {
      "step": "hook",
      "result": "offered"
    }
  ],
  "wrote": [],
  "squashMerge": null
}
```

Naming the hook step is how `--yes` installs it:

```txt title="chamoji setup hook --yes"
Installed the hook: /private/tmp/shop/.git/hooks/prepare-commit-msg
A plain `git commit` now opens the composer; -m, merges, amends and rebases are left alone.
```

Once everything is set up, a re-run only says so, and exits 0:

```txt title="chamoji setup"
✓ releases are set up in chamoji.config.json
✓ memory sharing is on in this clone
✓ Claude Code is connected here
✓ the commit composer hook is installed in this clone

chamoji.config.json is already up to date.
```

With a section already there, `--explain` says each value was kept:

```txt title="chamoji setup releases --yes --explain"
release.schema = 1 (the section's format)
release.shape = "apps" (kept from chamoji.config.json)
release.units.mobile.path = "apps/mobile" (kept from chamoji.config.json)
release.units.mobile.tag = "mobile/v{version}" (kept from chamoji.config.json)
release.units.web.path = "apps/web" (kept from chamoji.config.json)
release.units.web.tag = "web/v{version}" (kept from chamoji.config.json)
release.exclude = [] (kept from chamoji.config.json)
release.sharedChanges = "ride-along" (kept from chamoji.config.json)
release.rootFiles = "none" (kept from chamoji.config.json)

chamoji.config.json is already up to date.
```

## Exit codes

| Name | Type | Description |
| --- | --- | --- |
| `0` | | Setup saved, or nothing would change. |
| `2` | | Something would change, but there is no terminal and no `--yes`, or there is `--json` and no `--yes`. Also when the hook step finds another tool’s hook and leaves it alone, and for a `release` section from a newer chamoji. |
| `1` | | You cancelled, the step name is unknown, or a step failed, such as memory sharing that can’t reach `origin`. Also outside a git repo. |

[Exit codes](https://www.chamoji.dev/docs/reference/exit-codes.md) has every command’s codes.

## Related

- [Set up a repo](https://www.chamoji.dev/docs/set-up-a-repo.md): The setup screen, what it looks for, and what each step writes.
- [Config](https://www.chamoji.dev/docs/reference/config.md): Every key of the release section setup writes.
- [init](https://www.chamoji.dev/docs/commands/init.md): Memory sharing and Claude Code on their own.
- [Monorepos](https://www.chamoji.dev/docs/guides/monorepos.md): Which commits belong to which unit, tags, and template history.
