@arbol-ai/sdk 1.20261019.4056 → 2.1.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 (2) hide show
  1. package/README.md +38 -23
  2. package/package.json +9 -3
package/README.md CHANGED
@@ -3,8 +3,9 @@
3
3
  The Arbol API for TypeScript and JavaScript, generated by
4
4
  [Cloudflare Forge](https://github.com/cloudflare/forge) from the platform's public OpenAPI,
5
5
  [`https://api.getarbol.com/openapi.json`](https://api.getarbol.com/openapi.json). Everything in `src/`
6
- is Forge's TypeScript output, unedited, and the package's version is the API release it was generated
7
- from (`1.YYYYMMDD.n`).
6
+ is Forge's TypeScript output, unedited. Versions are semver, and each one records the OpenAPI it was
7
+ generated from: `npm view @arbol-ai/sdk@<version> arbol.openapi` prints its `release` (`info.version`)
8
+ and content hash (`sha256`).
8
9
 
9
10
  ```sh
10
11
  npm install @arbol-ai/sdk
@@ -56,49 +57,63 @@ The server authorizes every call: a method in the client is not a grant.
56
57
  bun install
57
58
  bun run forge # build the pinned Cloudflare Forge with cargo into .forge/ (once; needs Rust)
58
59
  bun run openapi # download https://api.getarbol.com/openapi.json
59
- bun run generate # src/ from openapi.json with `forge --target ts`; the version from its info.version
60
+ bun run generate # src/ from openapi.json with `forge --target ts`; its release and hash in arbol.openapi
60
61
  bun run hash # the OpenAPI's content hash (see Releases)
61
62
  bun run verify # typecheck and build dist/
62
63
  ```
63
64
 
64
- `openapi.json` is downloaded at generation time and not committed; `package.json`'s version is the
65
- OpenAPI version `src/` was generated from, and `release.json` records that version and the OpenAPI's
66
- content hash. Forge is pinned to its commit
65
+ `openapi.json` is downloaded at generation time and not committed. `package.json`'s `arbol.openapi`
66
+ records the OpenAPI `src/` was generated from, its `info.version` as `release` and its content hash as
67
+ `sha256`; `version` and `arbol` are release metadata the workflows set. Forge is pinned to its commit
67
68
  `7f86447210b7bea3779bfdab3cd5655eade0eadb` (0.1.0) in the `forge` script.
68
69
 
69
70
  ## Releases
70
71
 
71
- Releases are automatic, from the API down to the CLI:
72
+ Versions are semver, independent of the OpenAPI's release number. The 1.x versions (`1.YYYYMMDD.n`)
73
+ were the OpenAPI's date releases; 2.x starts at 2.1.0.
74
+
75
+ Releases of a new OpenAPI are automatic, from the API down to the CLI:
72
76
 
73
77
  1. **Gateway.** When the Arbol API ships an OpenAPI release, the gateway sends this repository a
74
78
  `repository_dispatch` `openapi-release` with `{ "version": "<release>" }`.
75
79
  2. **SDK (this repository).** [Generate](.github/workflows/generate.yml) runs on that dispatch, every
76
80
  six hours, and by hand. It downloads the OpenAPI (waiting until the API serves the announced release)
77
- and hashes its content. When the hash differs from the one in `release.json`, it regenerates `src/`
78
- with Forge, verifies it, commits `Release <version>` to `main` as Arbol, and publishes
79
- `@arbol-ai/sdk` to npm with [Publish](.github/workflows/publish.yml), with a provenance statement.
80
- 3. **CLI.** After publishing, Generate sends
81
+ and hashes its content. When the hash differs from `arbol.openapi.sha256` in `package.json`, it
82
+ regenerates `src/` with Forge, records the OpenAPI in `arbol.openapi`, and takes the highest version
83
+ on npm with the minor raised and the patch at 0 (2.1.0, 2.2.0, 2.3.0, …). It verifies the result,
84
+ commits `Release <version>` to `main` as Arbol, and publishes `@arbol-ai/sdk` to npm with
85
+ [Publish](.github/workflows/publish.yml), with a provenance statement.
86
+ 3. **CLI.** After publishing, Publish sends
81
87
  [project-arbol-cli](https://github.com/getarbol/project-arbol-cli) a `repository_dispatch`
82
- `sdk-release` with `{ "version": "<published version>", "sha256": "<OpenAPI hash>" }`, and the CLI
83
- releases itself on it.
88
+ `sdk-release` with `{ "version": "<published version>", "openapi": { "release": "…", "sha256": "…" } }`,
89
+ the published `version` and `arbol.openapi`, and the CLI releases itself on it.
84
90
 
85
91
  The hash ([`scripts/release.ts`](scripts/release.ts)) is the SHA-256 hex of the OpenAPI's canonical
86
92
  JSON (object keys sorted recursively, arrays in order, no whitespace) with `info.version` removed. A new
87
- release number with an identical API hashes the same, so it commits, publishes, and announces nothing.
88
- A version on `main` that is not on npm yet, such as one a failed run left behind, is published by the
89
- next run.
93
+ release number with an identical API hashes the same, so Generate commits, publishes, and announces
94
+ nothing. A version on `main` that is not on npm yet, such as one a failed run left behind, is published
95
+ by the next run.
96
+
97
+ Changes to the SDK itself, such as a new Forge pin, are released by hand: commit them to `main`
98
+ (regenerated with `bun run generate` when they change `src/`), then run Publish on `main` with `bump`
99
+ `patch` (the default), `minor` or `major`:
100
+
101
+ ```sh
102
+ gh workflow run publish.yml --repo getarbol/project-arbol-sdk-js --ref main -f bump=patch
103
+ ```
90
104
 
91
- Changes outside the OpenAPI, such as a new Forge pin, release nothing on their own: they ship with the
92
- next OpenAPI change.
105
+ It raises that part of the highest version on npm (while no 2.x version is published, the result is
106
+ 2.1.0 whatever the bump), commits `Release <version>` to `main`, publishes it, and announces it to the
107
+ CLI like Generate. It refuses when `main`'s version is not on npm yet (run Generate, which publishes it),
108
+ and when nothing that goes into the package (`src/`, `package.json`, `tsconfig.json`, `bun.lock`,
109
+ `README.md`, `LICENSE`) changed since the commit that released `main`'s version, so the same SDK is
110
+ never published twice. A manual release and Generate wait for each other.
93
111
 
94
- Generate pushes and dispatches as the Arbol Bot GitHub App, so its commit to `main` runs
95
- [Verify](.github/workflows/verify.yml). It needs the organization variable `ARBOL_BOT_APP_ID`, the
112
+ Generate and Publish push and dispatch as the Arbol Bot GitHub App, so their commits to `main` run
113
+ [Verify](.github/workflows/verify.yml). They need the organization variable `ARBOL_BOT_APP_ID`, the
96
114
  organization secret `ARBOL_BOT_PRIVATE_KEY`, and the App installed with contents write access to this
97
115
  repository and project-arbol-cli. npm publishing uses the organization secret `NPM_TOKEN`.
98
116
 
99
- Run Publish by hand on `main` to publish the version in `package.json`; a version that is already on npm
100
- is left untouched.
101
-
102
117
  ## License
103
118
 
104
119
  [Apache License 2.0](LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbol-ai/sdk",
3
- "version": "1.20261019.4056",
3
+ "version": "2.1.0",
4
4
  "description": "The Arbol API for TypeScript and JavaScript, generated by Cloudflare Forge from the platform's public OpenAPI.",
5
5
  "keywords": [
6
6
  "arbol",
@@ -39,7 +39,7 @@
39
39
  "forge": "cargo install --quiet --locked --git https://github.com/cloudflare/forge --rev 7f86447210b7bea3779bfdab3cd5655eade0eadb --root .forge forge",
40
40
  "openapi": "curl -fsS --proto =https --max-redirs 0 --max-filesize 33554432 -o openapi.json https://api.getarbol.com/openapi.json",
41
41
  "hash": "bun scripts/release.ts hash",
42
- "generate": "rm -rf src && .forge/bin/forge --target ts --out src openapi.json && bun pm pkg set version=\"$(jq -r .info.version openapi.json)\" && bun scripts/release.ts record",
42
+ "generate": "rm -rf src && .forge/bin/forge --target ts --out src openapi.json && bun scripts/release.ts record",
43
43
  "typecheck": "tsc -p tsconfig.json --noEmit",
44
44
  "build": "rm -rf dist && tsc -p tsconfig.json",
45
45
  "verify": "bun run typecheck && bun run build"
@@ -47,5 +47,11 @@
47
47
  "devDependencies": {
48
48
  "typescript": "7.0.2"
49
49
  },
50
- "packageManager": "bun@1.4.3"
50
+ "packageManager": "bun@1.4.3",
51
+ "arbol": {
52
+ "openapi": {
53
+ "release": "1.20261019.4056",
54
+ "sha256": "a160f98ddd0944d6e78111d113869b22cac6caabc036bb47f7609c009c37e501"
55
+ }
56
+ }
51
57
  }