@bluestep-systems/b6p-cli 0.8.1 → 0.9.0

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.
Files changed (4) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +122 -12
  3. package/dist/cli.js +430 -243
  4. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,58 @@ All notable changes to `@bluestep-systems/b6p-cli` will be documented in this fi
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.9.0] — 2026-11-16
9
+
10
+ Depends on b6p-core 0.9.0, which moves scripts to git: a script's draft and snapshot are a git repository,
11
+ and its history is its git history. **Platform floor:** the platform's git publishing. Today's server works
12
+ through its `enableGitPublishing` switch (the first push, or `pull --enable-git`, turns a script over); the
13
+ release that moves script history to git makes it the only mode, and refuses WebDAV writes to a script's draft
14
+ and snapshot. 0.8.x clients stop working against a script once it is on git: update them to this version.
15
+
16
+ ### Changed (breaking, user-visible)
17
+
18
+ - **`push --json` lost `historyRecorded` and gained `commitSha`, `publishedSha`, `publishError` and
19
+ `switchedToGit`.** Every other field is unchanged. `commitSha` is the draft commit after the push,
20
+ `publishedSha` the commit a snapshot published, `publishError` why a publish failed, `switchedToGit` that this
21
+ push moved the script from WebDAV to git. Anything that reads `historyRecorded` must read `publishedSha`
22
+ (snapshot) or `commitSha` instead; the new shape is in the README.
23
+ - **New exit-code rules.** `1` when `pushed` is false. On a snapshot, also `1` when `publishedSha` is `null`,
24
+ `publishError` is set, or `liveVerified` is `false` . Otherwise
25
+ `0`. A plain push is judged by `pushed` alone.
26
+ - A push that stops after switching a script to git (a declined overwrite, for instance) reports `switchedToGit: true`; the switch stands.
27
+ - **A push is a git commit and needs an author.** `--author "Name <email>"`, or `b6p config set author "Name
28
+ <email>"`, or (as before for git users) `git config user.name/user.email` or `GIT_AUTHOR_*` in the
29
+ environment. With none, the push exits `1` and says how to fix it.
30
+ - **Pulls and pushes work on the script's git draft.** `pull` clones it (or fast-forwards an existing clone);
31
+ there is no WebDAV draft or snapshot transfer any more. `audit` needs a pulled git working copy.
32
+ - **Switching a script from WebDAV to git is one-way,** and the CLI says so: a push prints it (`switchedToGit` in
33
+ `--json`), and `pull` asks first (`[Cancel]` first, so `--yes` declines).
34
+
35
+ ### Added
36
+
37
+ - `--fail-on-type-errors` on `push` and `deploy` (and `failOnTypeErrors` in deploy configs). Type errors in a script's own sources are now warnings that exit `0` by default (0.8 failed a snapshot on them); errors in `.d.ts` files never count; syntax and emit errors still exit `1`.
38
+
39
+ - Build manifest: a push that builds writes `<outDir>/.b6p-build.json` with the build output (a draft with no TypeScript source needs none), and the platform refuses to publish a draft whose sources changed since the build. The refusal (`BUILD_STALE`, `BUILD_MANIFEST_MISSING`, `BUILD_MANIFEST_INVALID`) exits `1`, lists the files, says to rebuild and push, and appears in `--json` as `publishRefusal`. `--externally-built` (push) and `externallyBuilt` (deploy config) mark a script a bundler builds.
40
+
41
+ - `--enable-git` on `pull` (with a URL, `--file` or the current folder) and `push`: switch a script still on WebDAV to git without asking. Without it the switch is asked about and `--yes` declines.
42
+ - Clear messages, each exiting `1` with nothing changed, for a declined switch, a wrong branch checked out, staged-only changes and symlinks that escape the draft folder.
43
+ - `b6p push --author` and `b6p deploy --author`; `author` and `message` in deploy config files.
44
+ - A push prints the draft and published commit SHAs.
45
+ - `deploy` exits `1` when no author resolves (checked before anything is pushed) or when any target failed, was not pushed, or had its publish refused, and prints a line per target with its commit and published SHAs (and a switch to git). Before, it printed "Deploy complete!" and exited `0` whatever happened.
46
+
47
+ ## [0.8.2] — 2026-10-20
48
+
49
+ ### Fixed
50
+
51
+ - **`b6p pull` no longer stops part-way with `Could not parse upstairs etag`**
52
+ ([#35](https://github.com/Bluestep-Systems/b6p-cli/issues/35)). Files last saved on the platform
53
+ before about May 2026 come back with a weak numeric ETag (`W/"<ms>-<id>"`) that the pull didn't
54
+ recognise, so it stopped at the first such file, exited `1`, and never refreshed `declarations/`.
55
+ It now treats those files like other files that carry no content hash: it skips the integrity
56
+ check and keeps going, and the file keeps its push/pull record. Comes from
57
+ [b6p-core 0.8.1](https://github.com/Bluestep-Systems/b6p-core/releases/tag/v0.8.1), now bundled.
58
+ If you used the `.gitignore` workaround from the issue, take the entries out and pull again.
59
+
8
60
  ## [0.8.1] — 2026-09-29
9
61
 
10
62
  ### Fixed
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Command-line interface for managing [BlueStep](https://www.bluestep.net/) B6P
4
4
  scripts: pull components from the platform, push changes back, audit local vs.
5
- server, snapshot history, and deploy across targets.
5
+ server, git history, and deploy across targets.
6
6
 
7
7
  The CLI shares its core implementation
8
8
  ([`@bluestep-systems/b6p-core`](https://github.com/Bluestep-Systems/b6p-core)) with the
@@ -59,21 +59,39 @@ clear it with `xattr -d com.apple.quarantine ~/.bluestep/bin/b6p` and make it ex
59
59
 
60
60
  The npm install above is unchanged and remains the recommended path wherever Node is available.
61
61
 
62
+ ## Signing in
63
+
64
+ `b6p` signs in with your BlueStep platform access token, which starts with `b6pt_`. It is the same
65
+ token the BlueStep AI tools use for the gateway MCP (`B6PT_TOKEN`), so if you already have one, use it
66
+ here too. To make one: **Tools → Organization Admin → Super → Global Users → Access Tokens → Create
67
+ New Token**.
68
+
69
+ Store it with:
70
+
71
+ ```bash
72
+ b6p auth set
73
+ ```
74
+
75
+ If no token is stored, the first command you run asks for it. A `401` with a `b6pt_` token usually
76
+ means the token expired or its account lost access, not that it is the wrong kind of token.
77
+
62
78
  ## Commands
63
79
 
64
80
  | Command | Purpose |
65
81
  |---|---|
66
- | `b6p pull <webdav-url>` | Pull a script by URL |
82
+ | `b6p pull <webdav-url>` | Pull a script by URL (clones its git draft) |
83
+ | `b6p pull <webdav-url> --enable-git` | Same, and switch a script still on WebDAV to git without asking (one-way) |
67
84
  | `b6p pull --file <path>` | Pull using metadata stored with a local file |
68
85
  | `b6p push --file <path>` | Push local files to the platform |
69
- | `b6p push --file <path> --snapshot --message "…"` | Push and record a versioned snapshot |
86
+ | `b6p push --file <path> --snapshot --message "…"` | Commit the draft with a message and publish it |
87
+ | `b6p push --file <path> --author "Jane Doe <jane@example.com>"` | Push as a given commit author |
70
88
  | `b6p push --file <path> --overwrite <file>` | Push, overwriting a file that changed on the platform |
71
89
  | `b6p audit --file <path>` | Diff local vs. server |
72
90
  | `b6p audit --file <path> --pull` | Audit and pull if differences found |
73
91
  | `b6p deploy <config.json>` | Multi-target deploy from a config file |
74
92
  | `b6p setup --file <path>` | Print the web-UI setup URL for a script |
75
93
  | `b6p report` | Report cached state |
76
- | `b6p auth set` | Store or replace your platform access token (`b6pt_…`) |
94
+ | `b6p auth set` | Store or replace your platform access token (`b6pt_…`, see [Signing in](#signing-in)) |
77
95
 
78
96
  Most commands accept `--json` for machine-readable output and `--yes` to answer every question with
79
97
  its default (and print what it answered). Run `b6p <command> --help` for full options.
@@ -103,15 +121,107 @@ question, in order (`printf 'Overwrite all\nYes\n' | b6p push --file <path>`, or
103
121
  in PowerShell, `'Overwrite all', 'Yes' | b6p push --file <path>`). The commands the CLI prints are
104
122
  written for your shell: POSIX, or PowerShell on Windows outside Git Bash.
105
123
 
106
- **Exit codes:** `0` when the push went through (keeping platform-only files is still `0`); `1` when
107
- nothing was uploaded, an overwrite was not confirmed, an upload was refused, or, on a snapshot, a
108
- live copy is still wrong after one re-send, the history entry wasn't recorded, or type-check
109
- diagnostics were reported.
124
+ ### Git, authors and switching
125
+
126
+ A script's draft and its published snapshot are a git repository on the platform; a push commits your
127
+ `draft/` folder to it, and `--snapshot` (or `--message`, which implies it) also publishes that
128
+ commit. Its history is its git history. Requires a platform with git publishing for scripts (today's
129
+ server: its `enableGitPublishing` switch); a script still on WebDAV is switched
130
+ to git by its first push or by `b6p pull --enable-git`. **The switch is one-way**: afterwards the
131
+ script's draft and snapshot refuse WebDAV writes. The CLI says so when it happens
132
+ (`switchedToGit`).
133
+
134
+ Every commit needs an author. In order, the first complete one is used: `--author "Name <email>"`;
135
+ for `deploy`, the config file's `author`; the stored default (`b6p config set author "Name <email>"`);
136
+ `git config user.name` and `user.email` for the script folder; then `GIT_AUTHOR_NAME` and
137
+ `GIT_AUTHOR_EMAIL` (or the `GIT_COMMITTER_*` pair) in the environment. With none of them the push
138
+ stops with exit `1` and prints those fixes; nothing is ever committed as nobody.
139
+
140
+ `b6p pull` and `b6p push` without `--enable-git` ask before switching a WebDAV script (`[Cancel]` first),
141
+ and `--yes` declines, so an unattended run never switches anything and exits `1` (push) with nothing changed.
142
+ `--enable-git` works with a URL or with `--file`/the current folder.
143
+
144
+ Refusals that change nothing and exit `1`: a declined switch, a draft folder with a branch other than
145
+ `draft` checked out (push), staged-only changes that a pull would discard, and symbolic links that
146
+ would let a pull write outside the draft folder. Each message says how to fix it.
147
+
148
+ ### Exit codes
149
+
150
+ | Result | Exit |
151
+ |---|---|
152
+ | Pushed; kept platform-only files, a switch to git, or a read-back that could not run (`liveVerified: null`) are still fine | `0` |
153
+ | The user cancelled at the target-URL prompt | `0` |
154
+ | Nothing was pushed (`pushed: false`): bad `--root`, empty draft, an overwrite not confirmed, no commit author, an upload refused | `1` |
155
+ | Snapshot, and `publishedSha` is `null` (nothing was published) | `1` |
156
+ | Snapshot, and `publishError` is set (the platform refused or failed the publish; the draft is still pushed) | `1` |
157
+ | Snapshot, and `liveVerified` is `false` (the published branch reads back at another commit) | `1` |
158
+ | `--fail-on-type-errors` (or `failOnTypeErrors: true` in a deploy config), and the build reported type errors in the script's own sources (`typeCheckDiagnostics > 0`) | `1` |
159
+
160
+ A plain push (no `--snapshot`) is judged by `pushed` alone. Type errors are **warnings by default**: they
161
+ are printed, counted in `--json` (`typeCheckDiagnostics`) and the exit code stays `0`, because the platform
162
+ runs the emitted JavaScript and valid JS often comes from imperfect TypeScript. Errors located in a `.d.ts`
163
+ (the generated platform declarations) never count. Syntax and emit errors always stop the push with exit
164
+ `1`. Add `--fail-on-type-errors` to push, snapshot or deploy to make type errors fail instead.
165
+
166
+ ### `--json`
167
+
168
+ `--json` prints one object on stdout, the same shape for every outcome (agents parse it):
169
+
170
+ ```json
171
+ {
172
+ "pushed": true,
173
+ "commitSha": "3f2a…40 hex characters",
174
+ "publishedSha": "9c1b…40 hex characters",
175
+ "publishError": null,
176
+ "publishRefusal": null,
177
+ "switchedToGit": false,
178
+ "typeCheckDiagnostics": 0,
179
+ "typeCheckErrors": [],
180
+ "liveVerified": true,
181
+ "liveMismatches": [],
182
+ "keptPlatformOnly": [],
183
+ "declinedOverwrites": []
184
+ }
185
+ ```
186
+
187
+ - `commitSha`: the draft branch's head after the push (the commit this push made, or the one already
188
+ there); `null` when `pushed` is false.
189
+ - `publishedSha`: the commit the platform published; `null` on a plain push, an aborted push or a
190
+ failed publish.
191
+ - `publishError`: why the publish failed, else `null`.
192
+ - `publishRefusal`: `{ "reason", "withheld" }`, straight from the platform, when it refused the publish. For
193
+ a build that is missing, unreadable or older than its sources (`BUILD_MANIFEST_MISSING`,
194
+ `BUILD_MANIFEST_INVALID`, `BUILD_STALE`) `withheld` lists the stale files or the manifest's path: rebuild
195
+ and push. The draft is pushed, the published script unchanged, and the exit code is `1`. Else `null`.
196
+ - `typeCheckDiagnostics` / `typeCheckErrors`: the count and the list (`{ file, line, column, code, message }`) of
197
+ type errors in the script's own sources; `.d.ts` diagnostics are never included. Warnings unless
198
+ `--fail-on-type-errors`.
199
+ - `switchedToGit`: this push moved the script from WebDAV to git.
200
+ - `historyRecorded` is gone (0.9.0): history is the git history, so `commitSha` and `publishedSha`
201
+ replace it.
202
+ - A declined overwrite prints `pushed: false` with the files in `declinedOverwrites`; a missing
203
+ author prints `pushed: false` too (the reason is on stderr); a cancelled target-URL prompt prints
204
+ `{ "cancelled": true }`. Questions, warnings and next steps go to stderr.
205
+
206
+ ### Deploy
207
+
208
+ `b6p deploy <config.json>` pushes the source draft to each target:
209
+
210
+ ```json
211
+ {
212
+ "sourceRootPath": "./my-script",
213
+ "targets": [{ "url": "https://…/files/123/draft/", "snapshot": true }],
214
+ "author": { "name": "Jane Doe", "email": "jane@example.com" },
215
+ "message": "Deploy from CI",
216
+ "externallyBuilt": false,
217
+ "failOnTypeErrors": false
218
+ }
219
+ ```
110
220
 
111
- **`--json`** prints one object on stdout: `pushed`, `historyRecorded`, `typeCheckDiagnostics`,
112
- `liveVerified`, `liveMismatches`, `keptPlatformOnly`, `declinedOverwrites`. A declined overwrite
113
- prints `pushed: false` with the files in `declinedOverwrites`. Questions, warnings and next steps
114
- go to stderr.
221
+ `externallyBuilt: true` is for scripts a bundler outside b6p builds (no build manifest is written and the
222
+ platform skips its stale-build check); `b6p push --externally-built` is the same for a push. `author` (an object, or `"Jane Doe <jane@example.com>"`) and `message` are optional and apply to every
223
+ target; `b6p deploy --author "…"` overrides the file's author. `deploy` exits `1` if no author resolves
224
+ (nothing is pushed then) or if any target failed or its publish was refused.
115
225
 
116
226
  ## WebDAV URL format
117
227