@intentic/gate 1.224.0 → 1.225.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.
- package/README.md +13 -13
- package/dist/gate.d.ts +1 -1
- package/dist/gate.d.ts.map +1 -1
- package/dist/gate.js +4 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @intentic/gate
|
|
2
2
|
|
|
3
|
-
The one-line CI step for a release gate
|
|
3
|
+
The one-line CI step for a release gate: POSTs what the pipeline knows to a gated workflow's webhook, waits for the run, and exits on the verdict.
|
|
4
4
|
|
|
5
5
|
## Responsibilities
|
|
6
6
|
|
|
7
7
|
A gated workflow (see `_sandbox/sandbox`, gate.routes.ts) already answers a bare `curl`: POST the request, hold
|
|
8
8
|
the connection, read `{outcome, reason, runId}` back. What every team then writes around that curl is the same
|
|
9
|
-
six lines of shell
|
|
9
|
+
six lines of shell: map `pass`/`fail`/`blocked` to exit codes, print the reason where the log will show it,
|
|
10
10
|
keep the client's timeout longer than the server's hold. This package is those six lines, written once:
|
|
11
11
|
|
|
12
12
|
```sh
|
|
@@ -14,19 +14,19 @@ npx @intentic/gate "commit $SHA on $BRANCH — preview at $URL"
|
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
- `pass` exits 0, `fail` exits 1.
|
|
17
|
-
- `blocked`
|
|
17
|
+
- `blocked` (the gate could not judge) exits 0 by default, because "the check broke" must not read as "the
|
|
18
18
|
product broke". `--blocked <code>` points it at a real neutral where the CI system has one.
|
|
19
19
|
- Exit 2 is never a verdict: it means the exchange itself failed (wrong token, no such gate, the daily run
|
|
20
20
|
ceiling, network), which needs the pipeline's owner rather than the product's.
|
|
21
21
|
|
|
22
|
-
The URL (token and all) comes from `--url` or the `INTENTIC_GATE_URL` environment variable
|
|
22
|
+
The URL (token and all) comes from `--url` or the `INTENTIC_GATE_URL` environment variable: the shape every
|
|
23
23
|
CI secret store hands things over in. The request is the arguments joined, or stdin when none are given. The
|
|
24
24
|
`--wait` deadline (default 1800 s) rides to the server, and the HTTP client waits a minute longer, so the
|
|
25
|
-
deadline that fires is the server's
|
|
25
|
+
deadline that fires is the server's: which stops the run instead of abandoning it mid-spend.
|
|
26
26
|
|
|
27
27
|
## Pipeline templates
|
|
28
28
|
|
|
29
|
-
GitHub Actions has a step of its own
|
|
29
|
+
GitHub Actions has a step of its own: the Marketplace action (`_sandbox/gate-action`), which wraps this
|
|
30
30
|
package's exchange and composes the request from the workflow's context:
|
|
31
31
|
|
|
32
32
|
```yaml
|
|
@@ -36,7 +36,7 @@ package's exchange and composes the request from the workflow's context:
|
|
|
36
36
|
url: ${{ secrets.INTENTIC_GATE_URL }}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
GitLab CI
|
|
39
|
+
GitLab CI, `allow_failure: exit_codes` is a real neutral, so `blocked` can have its own colour:
|
|
40
40
|
|
|
41
41
|
```yaml
|
|
42
42
|
release-gate:
|
|
@@ -52,13 +52,13 @@ release-gate:
|
|
|
52
52
|
The gate route is the daemon's door for a caller with no identity; the designer's gate panel (the workflows
|
|
53
53
|
extension) is where a gate is declared and its URL copied. This package is the third leg: the caller's side of
|
|
54
54
|
the exchange, distributed on npm so a pipeline runs it cold with `npx`. On GitHub specifically the same
|
|
55
|
-
exchange wears Marketplace clothes
|
|
56
|
-
`intentic/gate-action` action
|
|
57
|
-
every dependency would be install time on every pipeline of every team
|
|
55
|
+
exchange wears Marketplace clothes: `@intentic/gate-action` bundles this package's pure functions into the
|
|
56
|
+
`intentic/gate-action` action: and every other CI system runs this CLI. It deliberately depends on nothing:
|
|
57
|
+
every dependency would be install time on every pipeline of every team: and its hand-rolled verdict reader is
|
|
58
58
|
held against `@intentic/sandbox-contract`'s schema by a test instead of by an import.
|
|
59
59
|
|
|
60
60
|
## Key files
|
|
61
61
|
|
|
62
|
-
- [src/gate.ts](src/gate.ts)
|
|
63
|
-
- [src/cli.ts](src/cli.ts)
|
|
64
|
-
- [src/gate.test.ts](src/gate.test.ts)
|
|
62
|
+
- [src/gate.ts](src/gate.ts), everything the CLI decides, as pure functions: argument parsing, the dialled URL, the verdict reader, the exit mapping.
|
|
63
|
+
- [src/cli.ts](src/cli.ts), the process around them: stdin, one fetch, stdout, an exit code.
|
|
64
|
+
- [src/gate.test.ts](src/gate.test.ts): the behaviour a pipeline relies on, including the reader-versus-contract agreement test.
|
package/dist/gate.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type Parsed = {
|
|
|
20
20
|
message: string;
|
|
21
21
|
};
|
|
22
22
|
export declare const WAIT_DEFAULT_S = 1800;
|
|
23
|
-
export declare const USAGE = "intentic-gate
|
|
23
|
+
export declare const USAGE = "intentic-gate: run an intentic release gate and exit on its verdict\n\nusage: intentic-gate [options] [request...]\n\nThe request, what this pipeline knows: commit, branch, preview URL, is the arguments joined,\nor stdin when none are given (so `git log -1 | intentic-gate` works).\n\noptions:\n --url <url> the gate's webhook URL, token and all (or env INTENTIC_GATE_URL)\n --wait <seconds> how long the gate holds the connection (default 1800; the server caps at 3h)\n --blocked <code> exit code for a blocked verdict (default 0: \"could not judge\" is not a failed build)\n -h, --help this text\n\nexit codes: 0 pass (and blocked, unless --blocked says otherwise) \u00B7 1 fail \u00B7 2 the exchange itself\nfailed, wrong token, no such gate, daily ceiling reached, network. 2 is never a verdict: it means\nthe pipeline's wiring needs a person, not that the product does.";
|
|
24
24
|
export declare const parseArgs: (argv: readonly string[], envUrl: string | undefined) => Parsed;
|
|
25
25
|
export declare const targetOf: (url: string, waitS: number) => string;
|
|
26
26
|
export declare const clientTimeoutMs: (waitS: number) => number;
|
package/dist/gate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC9C,QAAQ,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AAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9G,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,eAAO,MAAM,KAAK,m4BAe+C,CAAC;AAElE,eAAO,MAAM,SAAS,SAAU,SAAS,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,KAAG,MAwC/E,CAAC;AAIF,eAAO,MAAM,QAAQ,QAAS,MAAM,SAAS,MAAM,KAAG,MAIrD,CAAC;AAIF,eAAO,MAAM,eAAe,UAAW,MAAM,KAAG,MAA8B,CAAC;AAM/E,eAAO,MAAM,WAAW,SAAU,OAAO,KAAG,WAAW,GAAG,SAczD,CAAC;AAEF,eAAO,MAAM,MAAM,YAAa,WAAW,eAAe,MAAM,KAAG,MAKlE,CAAC"}
|
package/dist/gate.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export const WAIT_DEFAULT_S = 1800;
|
|
2
|
-
export const USAGE = `intentic-gate
|
|
2
|
+
export const USAGE = `intentic-gate: run an intentic release gate and exit on its verdict
|
|
3
3
|
|
|
4
4
|
usage: intentic-gate [options] [request...]
|
|
5
5
|
|
|
6
|
-
The request
|
|
6
|
+
The request, what this pipeline knows: commit, branch, preview URL, is the arguments joined,
|
|
7
7
|
or stdin when none are given (so \`git log -1 | intentic-gate\` works).
|
|
8
8
|
|
|
9
9
|
options:
|
|
10
10
|
--url <url> the gate's webhook URL, token and all (or env INTENTIC_GATE_URL)
|
|
11
11
|
--wait <seconds> how long the gate holds the connection (default ${WAIT_DEFAULT_S}; the server caps at 3h)
|
|
12
|
-
--blocked <code> exit code for a blocked verdict (default 0
|
|
12
|
+
--blocked <code> exit code for a blocked verdict (default 0: "could not judge" is not a failed build)
|
|
13
13
|
-h, --help this text
|
|
14
14
|
|
|
15
15
|
exit codes: 0 pass (and blocked, unless --blocked says otherwise) · 1 fail · 2 the exchange itself
|
|
16
|
-
failed
|
|
16
|
+
failed, wrong token, no such gate, daily ceiling reached, network. 2 is never a verdict: it means
|
|
17
17
|
the pipeline's wiring needs a person, not that the product does.`;
|
|
18
18
|
export const parseArgs = (argv, envUrl) => {
|
|
19
19
|
let url = envUrl;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentic/gate",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Run an intentic release gate from a CI pipeline
|
|
3
|
+
"version": "1.225.0",
|
|
4
|
+
"description": "Run an intentic release gate from a CI pipeline, POST what the pipeline knows, wait for the run, exit on the verdict",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
38
38
|
"vitest": "4.1.10",
|
|
39
39
|
"@intentic/testing": "0.0.0",
|
|
40
|
-
"@intentic/sandbox-contract": "1.
|
|
40
|
+
"@intentic/sandbox-contract": "1.225.0",
|
|
41
41
|
"@intentic/tsconfig": "0.0.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|