瀏覽 1.1.1 文件
1.1.1

ait worktree — 完整參考

檢視、診斷、恢復、遷移並清理由 AIT 持有的 Task worktree 及其後設資料。

適用對象: coding agent 與儲存庫維運

作用邊界#

用途: 檢視、診斷、恢復、遷移並清理由 AIT 持有的 Task worktree 及其後設資料。

影響類別: 讀取與本地恢復/清理混合的入口;確切的歸屬檢查決定哪些寫操作被允許。

覆蓋: ait worktree 下共 16 個公開 help surface。

下面的程式碼區塊原樣保留 1.1.1 二進位的輸出,包含它給出的每一個引數、選項、 預設值、可選值、衝突關係和必填要求。

完整命令樹#

程式碼 · text
ait worktree
ait worktree status
ait worktree restore
ait worktree show
ait worktree path
ait worktree doctor
ait worktree cleanup-candidates
ait worktree cleanup
ait worktree prune-stale
ait worktree list
ait worktree sync
ait worktree recreate
ait worktree recover-task
ait worktree restore-owned-head
ait worktree rebase
ait worktree remove

原樣輸出的 help#

ait worktree#

二進位描述: Inspect and maintain isolated worktrees that share repository .ait data while carrying their own checked-out files, current Line, and optional Task/Change binding. Normal Task worktrees are created by task start. Cleanup, prune-stale, and remove require --yes when applied; use --dry-run to preview destructive removal.

程式碼 · text
Inspect and maintain isolated worktrees that share repository .ait data while carrying their own checked-out files, current Line, and optional Task/Change binding. Normal Task worktrees are created by task start. Cleanup, prune-stale, and remove require --yes when applied; use --dry-run to preview destructive removal.

Usage: ait worktree <COMMAND>

Commands:
  status              Compare one checkout with a Line head or specific Snapshot.
  restore             Restore all or selected checkout content from a Line head or Snapshot.
  show                Show one registered worktree and its refreshed live status.
  path                Print one worktree path or a shell command that enters it. [alias: open]
  doctor              Summarize registered worktree health and cleanup classification.
  cleanup-candidates  Inspect policy-selected cleanup candidates without removing them.
  cleanup             Preview or remove policy-selected safe worktrees.
  prune-stale         Preview or prune missing and detached worktree registrations.
  list                List every registered worktree.
  sync                Synchronize one or all worktrees to their selected Line heads.
  recreate            Recreate a missing registered Task worktree.
  recover-task        Recover a local authoring worktree for an existing remote Task and Change.
  restore-owned-head  Restore the last contiguous Snapshot head owned by a bound Task worktree.
  rebase              Replay a worktree's feature delta onto a target base Line.
  remove              Preview or explicitly remove registered worktrees.
  help                Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help (see a summary with '-h')

說明

檢視並維護隔離的 worktree:它們共享儲存庫 .ait 資料,但各自擁有 checkout 檔案、目前 Line 和可選的 Task/Change 繫結。普通 Task worktree 由 task start 建立。應用 cleanup、prune-stale 和 remove 時必須帶 --yes;用 --dry-run 預覽破壞性刪除。

引數 / 選項說明
status把一個 checkout 與 Line head 或特定 Snapshot 比較。
restore從 Line head 或 Snapshot 恢復全部或選定的檢出內容。
show顯示一個已註冊 worktree 及其重新整理後的即時狀態。
path列印一個 worktree 路徑,或一條進入該路徑的 shell 命令。[alias: open]
doctor彙總已註冊 worktree 的健康狀況和清理分類。
cleanup-candidates檢視按策略選出的清理候選,不刪除它們。
cleanup預覽或刪除按策略選出的安全 worktree。
prune-stale預覽或清理路徑缺失和已脫離的 worktree 註冊。
list列出每個已註冊的 worktree。
sync將一個或全部 worktree 同步到其選定的 Line head。
recreate重建一個路徑缺失的已註冊 Task worktree。
recover-task為已有的遠端 Task 和 Change 找回一個本地編寫 worktree。
restore-owned-head恢復由繫結的 Task worktree 擁有的最後一段連續 Snapshot head。
rebase將一個 worktree 的功能增量重放到目標基 Line 上。
remove預覽或顯式刪除已註冊的 worktree。
help列印本訊息或給定子命令的幫助

ait worktree status#

二進位描述: Report modified, missing, and untracked paths in the selected checkout without restoring content or moving a Line head. NAME selects a registered worktree; when omitted, inspect the current checkout. --snapshot and --line are mutually exclusive, and omission of both compares with the current Line head.

程式碼 · text
Report modified, missing, and untracked paths in the selected checkout without restoring content or moving a Line head. NAME selects a registered worktree; when omitted, inspect the current checkout. --snapshot and --line are mutually exclusive, and omission of both compares with the current Line head.

Usage: ait worktree status [OPTIONS] [NAME]

Arguments:
  [NAME]
          Registered worktree name; omit it to inspect the current checkout

Options:
      --snapshot <SNAPSHOT_ID>
          Compare with this exact local Snapshot instead of a Line head

      --line <LINE_NAME>
          Compare with this local Line head instead of the current Line head

      --verbose
          Show baseline and workspace-root detail in text output

      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

報告所選檢出中已修改、缺失和未跟蹤的路徑,不恢復內容也不移動 Line head。NAME 選擇一個已註冊 worktree;省略時檢視目前檢出。--snapshot 與 --line 互斥,兩者都省略時與目前 Line head 比較。

ait worktree restore#

二進位描述: Restore the selected registered worktree, or the current checkout when NAME is omitted. With no source option, restore the whole checkout from its current Line head. --snapshot and --line are mutually exclusive. Every --path is an exact workspace-relative path and requires an explicit --snapshot or --line; selected-path restore does not switch the current Line. Unsaved changes require --force, while --dry-run only reports the restore plan.

程式碼 · text
Restore the selected registered worktree, or the current checkout when NAME is omitted. With no source option, restore the whole checkout from its current Line head. --snapshot and --line are mutually exclusive. Every --path is an exact workspace-relative path and requires an explicit --snapshot or --line; selected-path restore does not switch the current Line. Unsaved changes require --force, while --dry-run only reports the restore plan.

Usage: ait worktree restore [OPTIONS] [NAME]

Arguments:
  [NAME]
          Registered worktree name; omit it to restore the current checkout

Options:
      --snapshot <SNAPSHOT_ID>
          Restore from this exact local Snapshot; mutually exclusive with --line

      --line <LINE_NAME>
          Restore from this local Line head; a whole-checkout restore also switches the current Line

      --path <PATH>
          Restore one exact workspace-relative path; repeat for more paths and supply --snapshot or --line

      --force
          Overwrite unsaved changes in the selected files

      --dry-run
          Report writes, removals, and overwritten changes without restoring content

      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

恢復所選的已註冊 worktree,省略 NAME 時恢復目前檢出。未給來源選項時,從其目前 Line head 恢復整個檢出。--snapshot 與 --line 互斥。每個 --path 都是確切的工作區相對路徑,且需要顯式的 --snapshot 或 --line;按路徑恢復不會切換目前 Line。有未儲存改動時需要 --force,--dry-run 僅報告恢復計劃。

ait worktree show#

二進位描述: Show the registered and current Line, checked-out Snapshot, Task/Change binding, cleanup classification, and rebase or merge state for one worktree. NAME may be omitted only when the current checkout belongs to a registered worktree.

程式碼 · text
Show the registered and current Line, checked-out Snapshot, Task/Change binding, cleanup classification, and rebase or merge state for one worktree. NAME may be omitted only when the current checkout belongs to a registered worktree.

Usage: ait worktree show [OPTIONS] [NAME]

Arguments:
  [NAME]
          Registered worktree name; omit it to use the current runtime worktree binding

Options:
      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

顯示一個 worktree 的註冊 Line 與目前 Line、checkout Snapshot、Task/Change 繫結、清理分類以及 rebase 或 merge 狀態。只有目前 checkout 屬於已註冊 worktree 時,才可省略 NAME。

ait worktree path#

二進位描述: Print the managed alias path when available, otherwise the registered physical path. This command refreshes live status and records worktree use. --shell prints a command that changes directory and exports managed Cargo paths when enabled; the visible alias open has identical print-only behavior.

程式碼 · text
Print the managed alias path when available, otherwise the registered physical path. This command refreshes live status and records worktree use. --shell prints a command that changes directory and exports managed Cargo paths when enabled; the visible alias `open` has identical print-only behavior.

Usage: ait worktree path [OPTIONS] [NAME]

Arguments:
  [NAME]
          Registered worktree name; omit it to use the current runtime worktree binding

Options:
      --shell
          Print a shell command that enters the worktree and exports managed Cargo paths

      --json
          Emit machine-readable path, command, status, and managed runtime fields

  -h, --help
          Print help (see a summary with '-h')

說明

可用時列印受管別名路徑,否則列印註冊的物理路徑。此命令會重新整理即時狀態並記錄 worktree 的使用。--shell 列印一條切換目錄並在啟用時匯出受管 Cargo 路徑的命令;可見別名 open 具有完全相同的僅列印行為。

ait worktree doctor#

二進位描述: Summarize current, clean, dirty, missing, detached, protected, and cleanup-candidate worktrees. The default uses metadata and cached status without a full content scan. --refresh verifies live content and may refresh derived runtime layout and status caches.

程式碼 · text
Summarize current, clean, dirty, missing, detached, protected, and cleanup-candidate worktrees. The default uses metadata and cached status without a full content scan. --refresh verifies live content and may refresh derived runtime layout and status caches.

Usage: ait worktree doctor [OPTIONS]

Options:
      --refresh
          Verify each worktree's live content and refresh derived runtime status before reporting

      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

彙總目前、乾淨、有改動、路徑缺失、已脫離、受保護和清理候選的 worktree。預設使用後設資料和快取狀態,不做完整內容掃描。--refresh 會核實實際內容,並可能重新整理派生的執行時佈局與狀態快取。

ait worktree cleanup-candidates#

二進位描述: Refresh and classify registered worktrees without removing paths or registrations. Filter by cleanup policy or idle age, opt clean manual-only worktrees into review, and optionally include protected rows with their exact reasons. Missing or detached registrations remain stale rather than cleanup candidates.

程式碼 · text
Refresh and classify registered worktrees without removing paths or registrations. Filter by cleanup policy or idle age, opt clean manual-only worktrees into review, and optionally include protected rows with their exact reasons. Missing or detached registrations remain stale rather than cleanup candidates.

Usage: ait worktree cleanup-candidates [OPTIONS]

Options:
      --older-than <DURATION>
          Idle threshold for after_idle policy, written as integer days, hours, or minutes (for example 7d, 12h, or 30m)
          
          [default: 7d]

      --policy <POLICY>
          Filter by cleanup policy: manual_only, after_remote_land, after_task_complete, after_idle, or never

      --allow-manual-only
          Classify otherwise-safe clean manual_only worktrees as explicit cleanup candidates

      --include-protected
          Include protected worktree rows and their reasons without making them removable

      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

重新整理並分類已註冊的 worktree,不刪除路徑或註冊。可按清理策略或空閒時長過濾、將乾淨的僅手動 worktree 納入審查,並可選包含受保護行及其確切原因。路徑缺失或已脫離的註冊保持為陳舊狀態,而不是清理候選。

ait worktree cleanup#

二進位描述: Select safe cleanup candidates using the same policy rules as cleanup-candidates. --dry-run previews the exact ordered removal plan without requiring confirmation. Applied cleanup deletes selected worktree paths, managed aliases, registrations, and managed Task Cargo build caches and therefore requires --yes.

程式碼 · text
Select safe cleanup candidates using the same policy rules as cleanup-candidates. --dry-run previews the exact ordered removal plan without requiring confirmation. Applied cleanup deletes selected worktree paths, managed aliases, registrations, and managed Task Cargo build caches and therefore requires --yes.

Usage: ait worktree cleanup [OPTIONS]

Options:
      --older-than <DURATION>
          Idle threshold for after_idle policy, written as integer days, hours, or minutes (for example 7d, 12h, or 30m)
          
          [default: 7d]

      --policy <POLICY>
          Filter by cleanup policy: manual_only, after_remote_land, after_task_complete, after_idle, or never

      --allow-manual-only
          Permit otherwise-safe clean manual_only worktrees to be selected for removal

      --limit <COUNT>
          Remove at most this many ordered candidates

      --dry-run
          Preview the exact ordered removals without changing paths or registrations

      --yes
          Confirm and apply cleanup removal; required unless --dry-run is supplied

      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

使用與 cleanup-candidates 相同的策略規則選出安全清理候選。--dry-run 預覽確切的有序刪除計劃,無需確認。實際清理會刪除選定的 worktree 路徑、受管別名、註冊以及受管的 Task Cargo 建置快取,因此需要 --yes。

ait worktree prune-stale#

二進位描述: Select registrations whose path is missing or whose worktree runtime layout is detached. Pruning removes stale registration and alias state without deleting surviving checkout content. --dry-run previews the exact rows; applied pruning requires --yes.

程式碼 · text
Select registrations whose path is missing or whose worktree runtime layout is detached. Pruning removes stale registration and alias state without deleting surviving checkout content. --dry-run previews the exact rows; applied pruning requires --yes.

Usage: ait worktree prune-stale [OPTIONS]

Options:
      --dry-run
          Preview missing and detached registrations without pruning them

      --yes
          Confirm and apply stale-registration pruning; required unless --dry-run is supplied

      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

選出路徑缺失或 worktree 執行時佈局已脫離的註冊。清理會刪除陳舊的註冊和別名狀態,但不刪除仍存在的檢出內容。--dry-run 預覽確切的行;實際清理需要 --yes。

ait worktree list#

二進位描述: List registered paths, current Lines, cached workspace status, cleanup classification, and current-context identity. --refresh verifies live content and may refresh derived runtime layout and status caches.

程式碼 · text
List registered paths, current Lines, cached workspace status, cleanup classification, and current-context identity. --refresh verifies live content and may refresh derived runtime layout and status caches.

Usage: ait worktree list [OPTIONS]

Options:
      --json
          Emit the complete stable machine-readable JSON array

      --refresh
          Verify live content and refresh derived runtime status for every worktree

  -h, --help
          Print help (see a summary with '-h')

說明

列出已註冊路徑、目前 Line、快取的工作區狀態、清理分類和目前上下文身份。--refresh 會核實實際內容,並可能重新整理派生的執行時佈局與狀態快取。

ait worktree sync#

二進位描述: Restore a complete registered worktree to a Line head and update its checked-out Snapshot, current Line, and runtime metadata. NAME selects one worktree; --all selects every available worktree and uses each one's current Line. --all cannot be combined with NAME or --line. Unsaved changes require --force, and --dry-run previews without applying the restore.

程式碼 · text
Restore a complete registered worktree to a Line head and update its checked-out Snapshot, current Line, and runtime metadata. NAME selects one worktree; --all selects every available worktree and uses each one's current Line. --all cannot be combined with NAME or --line. Unsaved changes require --force, and --dry-run previews without applying the restore.

Usage: ait worktree sync [OPTIONS] [NAME]

Arguments:
  [NAME]
          Registered worktree name; omit it to use the current runtime worktree binding

Options:
      --all
          Synchronize every live worktree to its own current Line; cannot be combined with NAME or --line

      --line <LINE_NAME>
          Synchronize one worktree to this Line head and make that Line current

      --force
          Overwrite unsaved changes while synchronizing

      --dry-run
          Preview complete restore plans without synchronizing content or metadata

      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

把一個完整註冊的 worktree 恢復到 Line head,並更新其 checkout Snapshot、目前 Line 和執行時後設資料。NAME 選擇一個 worktree;--all 選擇所有可用 worktree,並使用各自目前 Line。--all 不能與 NAME 或 --line 組合。未儲存改動必須帶 --force;--dry-run 只預覽,不應用恢復。

ait worktree recreate#

二進位描述: Recreate the recorded path and alias of a Task-bound worktree whose registered path is missing. Recovery selects the first locally available current-Line head, fork Snapshot, or selected remote Patchset revision. An existing or unbound worktree is rejected; --dry-run validates and reports the candidate without creating its files.

程式碼 · text
Recreate the recorded path and alias of a Task-bound worktree whose registered path is missing. Recovery selects the first locally available current-Line head, fork Snapshot, or selected remote Patchset revision. An existing or unbound worktree is rejected; --dry-run validates and reports the candidate without creating its files.

Usage: ait worktree recreate [OPTIONS] [NAME]

Arguments:
  [NAME]
          Missing registered Task worktree name; omit it to use the current runtime binding

Options:
      --dry-run
          Validate recovery candidates, path, and alias without recreating the worktree

      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

重建註冊路徑缺失的 Task 繫結 worktree 的已記錄路徑和別名。恢復會依次選擇本地可用的目前 Line head、fork Snapshot 或選定遠端 Patchset 修訂。已有或未繫結的 worktree 會被拒絕;--dry-run 只校驗並報告候選,不建立檔案。

ait worktree recover-task#

二進位描述: Run from the main repository root to validate an active or draft remote Task and its draft or review Change, then recreate their local feature Line and Task-bound worktree. This command does not create a remote Task or Change. If a registration already exists but its path is missing, use worktree recreate instead.

程式碼 · text
Run from the main repository root to validate an active or draft remote Task and its draft or review Change, then recreate their local feature Line and Task-bound worktree. This command does not create a remote Task or Change. If a registration already exists but its path is missing, use worktree recreate instead.

Usage: ait worktree recover-task [OPTIONS] --change <CHANGE> <TASK_ID>

Arguments:
  <TASK_ID>
          Existing remote Task ID to recover

Options:
      --change <CHANGE>
          Existing remote Change ID or Task-owned Change reference

      --remote <REMOTE>
          Configured remote name; omit it to use the effective default remote

      --dry-run
          Validate remote identity, local Snapshots, and placement without creating a worktree

      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

從主儲存庫根執行,校驗活動或 draft 遠端 Task 及其 draft 或 review Change,然後重建其本地功能 Line 和 Task 繫結 worktree。此命令不會建立遠端 Task 或 Change。如果註冊已存在但路徑缺失,應改用 worktree recreate。

ait worktree restore-owned-head#

二進位描述: Inspect first-parent history after the registered fork and retain the last contiguous Snapshot owned by the bound Task, Change, and worktree. Any first foreign Snapshot and its descendants are dropped from the Line head. The worktree must be Task-bound, clean, and outside a conflicted rebase; --dry-run reports the ownership decision without changing content or the head.

程式碼 · text
Inspect first-parent history after the registered fork and retain the last contiguous Snapshot owned by the bound Task, Change, and worktree. Any first foreign Snapshot and its descendants are dropped from the Line head. The worktree must be Task-bound, clean, and outside a conflicted rebase; --dry-run reports the ownership decision without changing content or the head.

Usage: ait worktree restore-owned-head [OPTIONS] [NAME]

Arguments:
  [NAME]
          Task-bound worktree name; omit it to use the current runtime worktree binding

Options:
      --dry-run
          Report the retained owned head and dropped foreign Snapshots without restoring

      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

檢查註冊分叉之後的第一父級歷史,保留由繫結的 Task、Change 和 worktree 擁有的最後一段連續 Snapshot。首個外來 Snapshot 及其後代會從 Line head 上丟棄。該 worktree 必須繫結 Task、乾淨且不處於衝突 rebase 中;--dry-run 只報告歸屬判定,不更改內容或 head。

ait worktree rebase#

二進位描述: Rebase the current feature Line from its registered fork onto --onto or the recorded target base Line. Starting an applied rebase requires a clean worktree. --dry-run previews ancestry, writes, removals, and conflicts. A conflicted rebase must later use exactly one of --continue or --abort; neither continuation mode accepts --dry-run.

程式碼 · text
Rebase the current feature Line from its registered fork onto --onto or the recorded target base Line. Starting an applied rebase requires a clean worktree. --dry-run previews ancestry, writes, removals, and conflicts. A conflicted rebase must later use exactly one of --continue or --abort; neither continuation mode accepts --dry-run.

Usage: ait worktree rebase [OPTIONS] [NAME]

Arguments:
  [NAME]
          Registered worktree name; omit it to use the current runtime worktree binding

Options:
      --onto <LINE_NAME>
          Target base Line for a new rebase; omit it to use recorded target metadata

      --continue
          Snapshot the resolved conflicted workspace and complete its rebase

      --abort
          Discard conflicted workspace resolution and restore the original head

      --dry-run
          Preview a new rebase plan; cannot be combined with --continue or --abort

      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

將目前功能 Line 從其註冊分叉 rebase 到 --onto 或記錄的目標基 Line 上。實際啟動 rebase 需要乾淨的 worktree。--dry-run 預覽祖先關係、寫入、刪除和衝突。發生衝突的 rebase 之後必須恰好使用 --continue 或 --abort 之一;兩種續作模式都不接受 --dry-run。

ait worktree remove#

二進位描述: Remove one or more named worktree registrations, managed aliases, and runtime identity files, leaving ordinary checkout content unless --delete-path is supplied. --all-stale performs the same stale-registration pruning as prune-stale and cannot be combined with names, --delete-path, or --force. --dry-run previews the exact plan; every applied removal requires --yes.

程式碼 · text
Remove one or more named worktree registrations, managed aliases, and runtime identity files, leaving ordinary checkout content unless --delete-path is supplied. --all-stale performs the same stale-registration pruning as prune-stale and cannot be combined with names, --delete-path, or --force. --dry-run previews the exact plan; every applied removal requires --yes.

Usage: ait worktree remove [OPTIONS] [NAME]...

Arguments:
  [NAME]...
          One or more registered worktree names; mutually exclusive with --all-stale

Options:
      --all-stale
          Prune every missing or detached registration; cannot be combined with names, --delete-path, or --force

      --delete-path
          Also delete each physical worktree path and managed Task Cargo build cache

      --force
          Permit explicit removal of dirty worktrees; does not bypass other safety checks

      --dry-run
          Preview exact removals without changing paths, aliases, or registrations

      --yes
          Confirm and apply worktree removal; required unless --dry-run is supplied

      --json
          Emit the complete stable machine-readable JSON payload

  -h, --help
          Print help (see a summary with '-h')

說明

刪除一個或多個指定名稱的 worktree 註冊、受管別名和執行時身份檔案,除非提供 --delete-path,否則保留普通檢出內容。--all-stale 執行與 prune-stale 相同的陳舊註冊清理,不能與名稱、--delete-path 或 --force 組合。--dry-run 預覽確切計劃;每次實際刪除都需要 --yes。

版本權威

對照 1.1.1 原始碼逐條核對

這一頁是公開文件,不是第二份產品契約。要確認發布權威,請以確切的原始碼和分發契約為準。

所屬元件 Snapshot
  • ait-coreSNP-ED7593DBF982
  • ait-serverSNP-0CCD7DD2A077
  • ait-runnerSNP-35C9C133D2EE
  • ait-pythonSNP-756C731A4CC0
  • ait-nodeSNP-55E90D0A81F1