@hardfin/cli 0.1.1-dev.72 → 0.1.1-dev.73
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 +22 -20
- package/dist/{check-CvjTUx-K.js → check-8Ta7vSnU.js} +4 -4
- package/dist/cli.js +5 -5
- package/dist/completion-tree.json +1 -1
- package/dist/{notice-D6mbHF9O.js → notice-DWvcEHhw.js} +4 -4
- package/dist/{program-CC8Iqb14.js → program-BsfVvLRA.js} +1708 -962
- package/package.json +1 -1
- package/skills/hardfin-cli/SKILL.md +34 -18
- package/templates/AGENTS.md +9 -9
package/package.json
CHANGED
|
@@ -42,25 +42,25 @@ Then run `hardfin update --yes --json`, and retry what failed once.
|
|
|
42
42
|
hardfin status --offline --json
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
`credential.kind` is `none` when nobody is signed in. Then sign in one of
|
|
45
|
+
`credential.kind` is `none` when nobody is signed in. Then sign in one of these ways.
|
|
46
46
|
|
|
47
|
-
| Situation
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
| The person gave you an API key
|
|
52
|
-
| The person only wants things looked up
|
|
47
|
+
| Situation | Do this |
|
|
48
|
+
| ------------------------------------------------------------------ | ---------------------------------------- |
|
|
49
|
+
| The person's browser is on this machine, even if you are sandboxed | Run `hardfin login` in the foreground |
|
|
50
|
+
| The person's browser is on another machine | Ask the person for an API key |
|
|
51
|
+
| The person gave you an API key | Set `HARDFIN_API_KEY` in the environment |
|
|
52
|
+
| The person only wants things looked up | Add `--read-only` to `hardfin login` |
|
|
53
53
|
|
|
54
|
-
`hardfin login` writes one JSON line on stderr before it waits
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
whether a browser tab opened
|
|
58
|
-
- `{"event": "device_code", "userCode": …, "verificationUri": …}`: show the person the code
|
|
59
|
-
and where to enter it
|
|
54
|
+
`hardfin login` writes one JSON line on stderr before it waits,
|
|
55
|
+
`{"event": "sign_in_url", "url": …, "browserOpened": …}`. Show the person `url`, and say
|
|
56
|
+
whether a browser tab opened.
|
|
60
57
|
|
|
61
58
|
It then waits up to `waitSeconds` (300) for the person to approve. Give the command that
|
|
62
59
|
long to finish. Do not run it in the background and move on.
|
|
63
60
|
|
|
61
|
+
Once signed in, `hardfin status --json` names the organization the CLI acts in, under
|
|
62
|
+
`api.identity.organization`. Read it there rather than guessing at an endpoint.
|
|
63
|
+
|
|
64
64
|
Never write an API key into a file in the repository, and never echo it back. Never pass it
|
|
65
65
|
as `--api-key` either, because a command line is kept in transcripts and shown to other
|
|
66
66
|
programs on the machine.
|
|
@@ -127,10 +127,22 @@ answers "what state are the assets of this item in", however many there are:
|
|
|
127
127
|
```sh
|
|
128
128
|
hardfin asset list --limit 1 --for-item <item id> --with-functional-statuses FUNCTIONAL
|
|
129
129
|
hardfin asset list --limit 1 --for-item <item id> --with-functional-statuses NEEDS_REVIEW
|
|
130
|
-
hardfin asset list --limit 1 --for-item <item id> --with-functional-statuses
|
|
131
|
-
hardfin asset list --limit 1 --for-item <item id> --with-functional-statuses SCRAPPED
|
|
130
|
+
hardfin asset list --limit 1 --for-item <item id> --with-functional-statuses NON_FUNCTIONAL
|
|
131
|
+
hardfin asset list --limit 1 --for-item <item id> --with-functional-statuses SCRAPPED --scrapped all
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
+
A list also leaves some records out unless you ask for them, and `totalCount` does not count
|
|
135
|
+
them:
|
|
136
|
+
|
|
137
|
+
| List | Leaves out | To include them |
|
|
138
|
+
| --------------------------------------------- | ------------------- | -------------------- |
|
|
139
|
+
| `asset list` | Scrapped assets | `--scrapped all` |
|
|
140
|
+
| `customer list`, `item list`, `location list` | Archived records | `--archived all` |
|
|
141
|
+
| `location list` | Transient locations | `--is-transient all` |
|
|
142
|
+
|
|
143
|
+
An archived item's assets still appear in `asset list`. Summing `assetCount` over
|
|
144
|
+
`item list` misses them unless you pass `--archived all` to `item list`.
|
|
145
|
+
|
|
134
146
|
| List | Search with | Filters worth knowing |
|
|
135
147
|
| --------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
136
148
|
| `asset list` | `--search-query` | `--for-item`, `--for-customer`, `--at-site`, `--with-functional-statuses`, `--with-transit-statuses`, `--scrapped` |
|
|
@@ -165,11 +177,13 @@ Set fields with one flag each, or send the whole body as JSON with `--input`:
|
|
|
165
177
|
|
|
166
178
|
```sh
|
|
167
179
|
hardfin customer create --name "Acme"
|
|
168
|
-
echo '{"name": "Dock 4, north side"}' | hardfin location create --input -
|
|
180
|
+
echo '{"name": "Dock 4, north side", "type": "ZONE", "parentLocationId": "<site id>"}' | hardfin location create --input -
|
|
169
181
|
hardfin asset accounting update ast_4f9xk2mq7plr8stz --unset useful-life
|
|
170
182
|
```
|
|
171
183
|
|
|
172
|
-
|
|
184
|
+
`--help` on a command that takes `--input` lays out its whole JSON body, nested objects such
|
|
185
|
+
as `address` included. Read it rather than guessing field names. A flag given with `--input`
|
|
186
|
+
replaces that field of the body. A value with a comma in it
|
|
173
187
|
must go through `--input`, because a `key=value` flag cannot carry one. A field the command
|
|
174
188
|
does not take is refused with `invalid_input`, which names the field and the ones taken there.
|
|
175
189
|
|
|
@@ -190,8 +204,10 @@ that carries `event` instead of `code` is a notice, such as a newer CLI being pu
|
|
|
190
204
|
| `code` | Do this |
|
|
191
205
|
| --------------------------------------------------- | ------------------------------------------------------------------ |
|
|
192
206
|
| `not_signed_in`, `unauthorized` | Sign in again |
|
|
193
|
-
| `missing_scope`
|
|
207
|
+
| `missing_scope`, `forbidden` | Tell the person the sign in may not do this. Do not retry |
|
|
194
208
|
| `invalid_flag`, `missing_flag`, `invalid_arguments` | Read `--help` for that command |
|
|
209
|
+
| `invalid_input` | Fix the field or file the message names |
|
|
210
|
+
| `not_confirmed` | Ask the person, then pass `--yes` once they agree |
|
|
195
211
|
| `not_found` | Check you passed a key, not an ID, where the command wants a key |
|
|
196
212
|
| `bad_request`, `invalid_request`, `conflict` | Read `errors`, which names the field |
|
|
197
213
|
| `rate_limited` | Wait a minute, then retry once |
|
package/templates/AGENTS.md
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
This project works with Hardfin data through the Hardfin CLI, `hardfin`.
|
|
4
4
|
|
|
5
|
-
| Task | Command
|
|
6
|
-
| ---------------------------------- |
|
|
7
|
-
| Install | `npm install -g @hardfin/cli`, with Node 20.12 or later
|
|
8
|
-
| Sign in | `hardfin login`, or
|
|
9
|
-
| Update | `hardfin update --yes`
|
|
10
|
-
| Check
|
|
11
|
-
| Find a command | `hardfin --help`, then `hardfin <noun> --help`
|
|
12
|
-
| Every command, flag and error code | `hardfin agent-guide`
|
|
13
|
-
| The API reference | https://docs.hardfin.com
|
|
5
|
+
| Task | Command |
|
|
6
|
+
| ---------------------------------- | ------------------------------------------------------------------------ |
|
|
7
|
+
| Install | `npm install -g @hardfin/cli`, with Node 20.12 or later |
|
|
8
|
+
| Sign in | `hardfin login`, or set `HARDFIN_API_KEY` away from the person's browser |
|
|
9
|
+
| Update | `hardfin update --yes` |
|
|
10
|
+
| Check which organization it is in | `hardfin status` |
|
|
11
|
+
| Find a command | `hardfin --help`, then `hardfin <noun> --help` |
|
|
12
|
+
| Every command, flag and error code | `hardfin agent-guide` |
|
|
13
|
+
| The API reference | https://docs.hardfin.com |
|
|
14
14
|
|
|
15
15
|
Start with the `hardfin-cli` skill in `.agents/skills/hardfin-cli/SKILL.md`.
|
|
16
16
|
|