Repo verbs
Wherever a command takes an item ID, you can omit it inside that item's worktree. Every verb here accepts --json; the exceptions are in Output format.
Verbs at a glance
| Verb | What it does |
|---|---|
repo list | The connected repositories. |
repo connect | Connects a repo; safe to repeat. |
repo disconnect | Forgets a repo with no unfinished items. |
repo library | Reviews a repo's .kraft/ library and takes it. Added in 2.1 |
repo path | Prints an item's worktree path; repo cd is an alias. |
repo open | Opens an item's worktree in an editor. |
Connected repos
repo list
kraft repo list [flags]
The connected repos. * marks the one you are in.
| Flag | Type | Default | Meaning |
|---|---|---|---|
--all | switch | off | Also lists auto-connected repos nobody has touched yet. |
What repo list prints
repo list prints a table with the columns NAME, STATE, CHAIN and PATH. The first column holds * for the repo you are in. STATE is enabled or disabled, and CHAIN is the repo's default_chain. A line after the table counts the repos left out, and names --all, when it hides any.
NAME STATE CHAIN PATH
* app enabled default /Users/you/code/app
api enabled quick-task /Users/you/code/api
repo connect
kraft repo connect [flags] [PATH]
Connects the repo at PATH, by default the current directory, and is safe to repeat. A relative PATH, . included, is read from where you stand. A repo with no commit yet is refused: commit its files first.
| Flag | Type | Default | Meaning |
|---|---|---|---|
-y, --yes | switch | off | Takes the proposal without asking, even in a terminal. |
--test-command | text | the proposal | Replaces the proposed test command ("" for none). Exclusive with --no-tests. |
--setup-command | text | the proposal | Replaces the proposed setup command ("" for none). |
--no-tests | switch | off | Declares a repo with no tests, and saves it enabled (disabled from a worker, as below): its work items pass verification without running a test. |
--in-place | switch | off | Saves worktrees: false: the repo's items run in this checkout, one at a time, rather than in a worktree each. On a repo already connected, it saves that and says so. Added in 2.1 |
--forge | github or gitlab | what the host's name says | Names the forge when the host's name doesn't say. On a host that names its forge, or a repo already connected, it is ignored, and connect says so. Added in 2.5 |
--web-url | URL | none | With --forge: the forge's web address, saved as a forge account for the host. Ignored, and said so, where the host names its forge. Added in 2.5 |
--api-url | URL | derived from the web address | With --web-url: the API address, when the derived one is wrong. It must be on the web address's host. Added in 2.5 |
--forge-account | account name | the host | Names the account --web-url saves, or the existing account the repo uses. Added in 2.5 |
--client | cli or api | none | api sets up an API account for the host and tests its token before connecting. --token-from and --token-stdin imply it. On an account that is client: cli, it is refused: change that with kraft admin forge edit. Added in 2.5 |
--token-from | git-credential, env:NAME, file:PATH or command:CMD | none | Where the token is read from. A command is written on the server's machine. Exclusive with --token-stdin. Added in 2.5 |
--token-stdin | switch | off | Reads the token from stdin, never from the command line. The server keeps it in a private file. Added in 2.5 |
--kind | pat, oauth or unknown | unknown | What the token is. Added in 2.5 |
--verify | switch | off | After connecting, runs the setup and test commands once. See Verify a repo's commands. |
--timeout | number, minutes | 30 | With --verify, the minutes each command may take. |
--on-host | switch | off | With --verify, runs a sandboxed repo's commands on this machine. |
--json | switch | off | Prints the answer as JSON. With --verify, its lines are in verify.output. |
With --no-tests, and nothing found to prepare either, setup_command is saved as "" too. Nested and area scopes still run. How connect proposes commands has the rest.
| Refusal | Cause |
|---|---|
saved disabled: an agent chose its commands, which run for every work item on it, so no agent files work on it until a person has read them and enabled it in Settings › Repos | From a worker session or an escalation turn, --test-command, --no-tests and a non-empty --setup-command are an agent's choice of commands, so the repo is saved disabled. |
Connect prints that line in place of its usual saved disabled: line. A connect with no commands given, or one you type in your own terminal, is unchanged.
What connect proposes
repo connect proposes a setup command and a test command from the repo's task runner, CI and lockfiles (How connect proposes commands). It prints each with the file it came from, lists what else it found, and says when it found none. In a terminal it asks which candidate to use.
A self-hosted host
Added in 2.5
Connect asks about the forge only when the remote's host doesn't name it and no forge account is the default for that host. A repo on github.com, or on a host such as gitlab.example.com, is connected with no new question and no forges.yaml.
Otherwise, in a terminal, connect asks which forge it is (github or gitlab), then the web address. It offers https://HOST and, for a remote path like gitlab/team/app, https://HOST/gitlab; you can type any address. It saves the answer as an account named for the host and the default for it, then connects the repo.
When the address is on another host than the remote's, as for an SSH alias such as github-work, the account is no host's default: the repo names it in forge_account instead.
With --forge and --web-url, connect asks nothing. With --forge-account naming an existing account, connect takes its forge and asks nothing. -y without --forge asks nothing and saves no account. If an account of that name exists, connect stops and asks for --forge-account. If connecting then fails, the account stays; connecting again finds it.
Connect with a token
Added in 2.5
--client api, --token-from or --token-stdin makes connect set up a client: api forge account for the host, with https://HOST as its web address. Without them, and with no such account for the host, connect is as above.
It first tries git credential fill, silently. If git has no saved credential, a terminal is asked where the token comes from: paste it (not shown, never on the command line), an environment variable the server reads at start, or a command that prints it. -y and --json ask nothing, and without a token flag they exit 1 and keep nothing.
Then it tests the token and prints what the server saw: the login it signs in as, and its scopes and expiry. Project visibility isn't shown here, because the check runs on connected repos and this one isn't yet. If the API didn't answer at the derived address, connect asks for the API address and tests again.
A test that fails asks keep forge account NAME anyway? [y/N]. A no, or -y, removes the account and exits 1 without connecting. An environment variable is read once, when the server starts, so its no_token result doesn't fail connect: set it where Kraft starts, and restart.
With no terminal, --forge is required. A repo already connected is left as it is. On a host whose account is already client: api, connect shows that account's test and asks nothing, even with -y --client api; a failing test never fails the connect.
Verify a repo's commands
--verify runs the setup command, then each test command, in a throwaway worktree of the commit a work item starts from. It runs them as a work item would, with a worker's environment. It also runs each scope's targeted_command against the last commit, and skips it on a repo with one commit.
With carry set, it seeds those files as a work item does and lists each with its source and whether git ignores it. A file git doesn't ignore fails the run, because a work item would refuse it. It never saves a copy back.
It exits 1 when a command fails, when one runs past --timeout minutes, or when a command leaves files a work item would commit.
A sandboxed repo's commands run in its sandbox when a work item runs them, so --verify refuses the repo unless you pass --on-host. It prints verify: this repo runs sandboxed, and --verify would run its commands on this machine instead; pass --on-host to do that anyway.
Connecting a repo that is already connected
On a repo already connected, connect probes again for what its entry leaves undecided: a test command where it has none and no test scopes, and a setup command where none is declared. It says what it found and saves only that, after a yes in a terminal.
A repo saved disabled for want of a test command is enabled once it has one.
From a worker session or an escalation turn, connect on a connected repo saves nothing and says its commands are a person's to set, in Settings › Repos.
Anything already decided stays as it is: change it in repos.yaml. --verify rehearses what it then declares.
repo disconnect
kraft repo disconnect [flags] [PATH]
Forgets the repo at PATH, by default the current directory. It takes no flags. Ended items are untouched, and no file in the repo is. Disconnecting drops the library's lock entry.
| Refusal | Cause |
|---|---|
Exit 1 | The repo has an item that hasn't ended, paused and never-started ones included: complete, cancel or abandon them first (kraft item complete, cancel, or abandon --yes). |
| Refused, listing each reference | The repo's repo library is accepted and local configuration names its namespace, the repo's own schedules included. |
repo library
Added in 2.1
kraft repo library [flags] [PATH]
Asks the remote of the repo at PATH, by default the current directory, for its repo library, prints the review, and in a terminal asks whether to take it. A worker is refused.
| Flag | Type | Default | Meaning |
|---|---|---|---|
-y, --yes | switch | off | Takes a waiting library without asking. Exclusive with --check. |
--check | switch | off | Prints the review and takes nothing. The exit code says what was found. |
--json | switch | off | Prints the answer as JSON. With -y, it takes a waiting library first. |
With no terminal and no -y, it prints the review and takes nothing.
A first load is refused while something outside the repo already names its id: another repo's entry, your own chains or library.yaml, or an installed add-on's skill. The review lists each; change them first. The library is loaded only for this repo's items. See Who can name it.
After a first load taken at the prompt, it asks once whether to take later changes to prompts, skills and steering without asking. A yes sets library_auto_update: true on the repo's entry. See Automatic updates.
--check exit code | Meaning |
|---|---|
0 | The accepted library is current, or the remote has none. |
1 | A first load or a change is waiting. |
2 | The remote's library would be refused. The review names why. |
3 | The remote couldn't be checked: the network or its credentials. |
kraft repo connect also shows the library after it connects a repo, and asks in a terminal. -y, --json and a connect with no terminal never take it: they say to run kraft repo library. A library that can't be checked never fails the connect.
Reaching a worktree
repo path
kraft repo path [flags] [ID]
Prints the item's worktree path, or for an in-place item the repo's own folder. repo cd is an alias. It takes no --json: see Output format.
| Flag | Type | Default | Meaning |
|---|---|---|---|
--shell | switch | off | Prints a shell function that does the cd for you. |
With no flag the command prints a path, so substitute it into cd:
cd "$(kraft repo path ID)"
kraft repo path --shell
repo open
kraft repo open [flags] [ID]
Opens the item's worktree in an editor.
| Flag | Type | Default | Meaning |
|---|---|---|---|
--editor | code, cursor, zed, obsidian or system | the Default editor in Settings, else KRAFT_EDITOR, else the OS opener | Picks the editor. system is the OS opener. |
Related
- repos.yaml: each repo's settings, such as
setup_command,envandtest_scopes. Past connecting, you edit them in Settings › Repos or inrepos.yaml, not with the CLI. - How connect proposes commands: where the proposed setup and test commands come from.
- Item verbs: file work in a repo you connected.