@hagicode/cli 0.1.0-dev.43.1.03d9a6a → 0.1.0-dev.48.1.ce630a8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,12 +5,12 @@
5
5
  [![license](https://img.shields.io/npm/l/%40hagicode%2Fcli?color=ffd43b)](https://www.npmjs.com/package/@hagicode/cli)
6
6
  [![Node.js](https://img.shields.io/badge/node-%3E%3D24.0.0-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
7
7
 
8
- `@hagicode/cli` provides the published `hagi` command, which lets you drive a HagiCode backend from a terminal, scripts, or an AI agent without opening the app. Manage projects, proposals (generate, execute, archive, and send), vaults and their files, chat sessions, HagiTasks, scheduled plans, and skills (local list, enable, disable and uninstall, gallery search and install, and trusted providers). Every command supports a shared `--json` output for scripting, and an embedded Hagi skill under [`skills/`](skills/) guides agent workflows.
8
+ `@hagicode/cli` provides the published `hagi` command, which lets you drive a HagiCode backend from a terminal, scripts, or an AI agent without opening the app. Manage projects, proposals (generate, execute, archive, and send), local Sagas, vaults and their files, chat sessions, HagiTasks, scheduled plans, and skills (local list, enable, disable and uninstall, gallery search and install, and trusted providers). Every command supports a shared `--json` output for scripting, and an embedded Hagi skill under [`skills/`](skills/) guides agent workflows.
9
9
 
10
10
  ## Requirements
11
11
 
12
12
  - Node.js 24+
13
- - Access to a HagiCode backend API
13
+ - Access to a HagiCode backend API for backend-selected commands; Saga commands with `--path` work locally without one
14
14
 
15
15
  ## Installation
16
16
 
@@ -76,9 +76,44 @@ Example:
76
76
  hagi --base-url https://api.example.com --token "$HAGI_TOKEN" project list --json
77
77
  ```
78
78
 
79
+ ## Saga Commands
80
+
81
+ Each Saga command requires exactly one project selector: `--path <directory>` or `--project-id <id>`. Missing, empty,
82
+ or conflicting selectors exit with code `2`. `--path` is resolved on the CLI host, relative to the current directory,
83
+ and does not read backend configuration or contact the backend; backend flags do not change local behavior. Quote paths
84
+ that contain spaces.
85
+
86
+ ```bash
87
+ hagi saga init --path "./My Project"
88
+ hagi saga new demo --path "./My Project" --json
89
+ hagi saga list --path "./My Project"
90
+ hagi saga status demo --project-id <project-id> --json
91
+ hagi saga items demo --path "./My Project" --json
92
+ hagi saga claim demo --path "./My Project" --session orchestrator-1 --json
93
+ hagi saga check demo --path "./My Project" --phase run --json
94
+ hagi saga tick demo T1 --path "./My Project" --token "$SAGA_EXECUTION_TOKEN" --json
95
+ ```
96
+
97
+ Write and check commands (`claim`, `assert-owner`, `release`, `freeze`, `check`, `tick`, `block`, `set-status`, `amend`,
98
+ `archive`) run in the CLI itself; the CLI installs only the six method prompts and the ignore rule, and no standalone Saga tool. Mutating commands read the execution token
99
+ from `--token` or `SAGA_EXECUTION_TOKEN`; with `--project-id`, `--token` is rejected because it is the backend token, so use
100
+ `SAGA_EXECUTION_TOKEN` there. Exit code `0` means success, `1` a refusal or failed check, and `2` a usage error.
101
+
102
+ With `--project-id`, the CLI uses the normal base URL, token, and language settings to resolve the project through the
103
+ backend. The returned project path must exist on the machine running the CLI; it is not a remote filesystem path.
104
+
105
+ `saga init` installs managed resources without overwriting differing files by default: it preserves conflicts, installs
106
+ missing resources, and reports each file outcome. Conflicts exit with code `4`; `--force` replaces differing managed
107
+ resources, while `.gitignore` is always merged additively. Initialization refuses redirected or unsafe targets and
108
+ leaves identical resources untouched on repeat runs. See the [Saga command reference](skills/hagi/references/saga.md)
109
+ for outcomes, safety behavior, and JSON details.
110
+
111
+ For offline use, install the package or use a cached `npx` package. An uncached `npx @hagicode/cli` invocation may need
112
+ network access to download the package even though `saga ... --path` itself does not use a backend.
113
+
79
114
  ## Connection Setup
80
115
 
81
- Every operation command resolves the backend base URL on each invocation, in this order:
116
+ Every backend operation resolves the base URL on each invocation, in this order:
82
117
 
83
118
  1. `--base-url <url>` flag
84
119
  2. `HAGI_API_BASE_URL` environment variable
@@ -91,7 +126,9 @@ Every operation command resolves the backend base URL on each invocation, in thi
91
126
  }
92
127
  ```
93
128
 
94
- If none of the three is set, the command exits with code `2` and sends no backend request. The `steer` key is the default for `hagi chat send`, `hagi proposal send`, and `hagi hagitask send` (see [Steer](#steer-send-option)); it must be `true` or `false`.
129
+ If none of the three is set, a backend operation exits with code `2` and sends no backend request. Saga commands using
130
+ `--path` bypass this resolution and do not read backend configuration. The `steer` key is the default for `hagi chat send`,
131
+ `hagi proposal send`, and `hagi hagitask send` (see [Steer](#steer-send-option)); it must be `true` or `false`.
95
132
 
96
133
  Operation commands send requests without a credential by default. Pass `--token` (or set `HAGI_API_TOKEN`) only when your backend requires one.
97
134
 
@@ -112,6 +149,7 @@ hagi
112
149
  |-- project list | repositories | create | update | delete
113
150
  | `-- monospecs show | init | set | validate | reload | clone | remove-checkout
114
151
  |-- proposal list | create | optimize-description | generate | annotate | execute | archive | status | complete | send | get | messages
152
+ |-- saga init | new | list | status | items | claim | assert-owner | release | freeze | check | tick | block | set-status | amend | archive
115
153
  |-- vault list | create | update | delete
116
154
  | `-- files list | preview
117
155
  |-- chat list | create | archive | delete | send