Skip to content

Commit c5f10ae

Browse files
Release: Add npm publishing and update documentation (#719)
* Changes required by Gorelase version > 2 * npm-publish script supports conditional publishing. If gorelease in not in "Release" mode, npm packages are not pushed, so we can avoid multitudes of snapshot packages being pushed to public registry * Create npm packages after goreleaser via a hook script The hook runs after. If goreaser is not in release mode, npm will build in dry-run mode, so the packages are not pushed to registry * Update documentation with NPM installation instructions * Switch npm package scope to @kosli * Fix: Add the missing bin/kosli JS Shim * Fix: Token Variable Mismatch * Fix: Silent Postinstall Failures * Update npm/README.md Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> * refactor(npm-publish): replace sed/perl with jq and harden publish script - Use jq instead of sed/perl for JSON version updates (portable across macOS and Linux, handles JSON correctly) - Separate pack and publish into two distinct phases so all packages are packed before any are published - Add npm_publish_with_retry with exponential backoff (3 attempts) - Fail fast with clear error messages on pack or publish failure * Fix: Frontmatter formatting * Consistent formatting of package.json files * Include npm packages in binary provenance processing * Add directory and engines specification to packages * Documention updates: - npx is not supported - package @kosli/cli should be used to install * Fix three issues in npm postinstall and publish script - postinstall: exit 1 on unsupported platform to match bin/kosli shim behaviour - npm-publish.sh: use process substitution instead of pipe to while loop so set -e catches failures inside the loop - npm-publish.sh: fix out-of-scope max_attempts variable in publish error message * Update scripts/npm-publish.sh Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> * Integrate npm package build and publish into GoReleaser pipeline - Copy each platform binary into its npm package dir via per-build post hooks - Run npm-publish.sh after release (dry-run on snapshots) via after hook - Clean npm bin dirs and tarballs before each build via before hooks * Update scripts/npm-publish.sh Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> * Update scripts/npm-publish.sh Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> * Update scripts/npm-publish.sh Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> * Update scripts/npm-publish.sh Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> * Add --provenance flag to npm publish when running in GitHub Actions * Fix temp file leak and add npm provenance in GitHub Actions - Clean up temp file on jq/mv failure for wrapper package.json update, consistent with the platform loop - Pass --provenance to npm publish when running in GitHub Actions * Added distribution: goreleaser-pro and GORELEASER_KEY: ${{ secrets.KOSLI_GORELEASERPRO }} — that's the standard way the goreleaser-action picks up the pro license. * Add npm installation test job to install-script-tests workflow - Test npm install -g @kosli/cli on all 6 supported platforms - Trigger on release (published) to test newly published packages - Also trigger on push/PR to npm/**, .goreleaser.yml, and scripts/npm-publish.sh * Select npm tag snapshot for now * Removed macos-13. macos-13 is the only GitHub-hosted x64 macOS runner but it's not available in all GitHub org configuration * Refine dry-run condition in npm-publish script for clarity * Add prepack scripts to fail fast when binary is missing npm pack silently succeeds even if the binary is absent, producing a broken package. Each platform package now checks for bin/kosli (or bin/kosli.exe on Windows) before packing; the wrapper also checks for install.js. * Exclude node_modules from package.json search in npm-publish script * Refactor binary validation in postinstall script to use fs.accessSync for executable check to address @dangrondahl ai review kosli version false negatives in install.js --------- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
1 parent 639eb41 commit c5f10ae

89 files changed

Lines changed: 261 additions & 254 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"currentversion": "v2.14.0"}
1+
{"currentversion": "v2.15.0"}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: "kosli evaluate input"
3+
beta: false
4+
deprecated: false
5+
summary: "Evaluate a local JSON input against a Rego policy."
6+
---
7+
8+
# kosli evaluate input
9+
10+
## Synopsis
11+
12+
```shell
13+
kosli evaluate input [flags]
14+
```
15+
16+
Evaluate a local JSON input against a Rego policy.
17+
Read JSON from a file or stdin and evaluate it against a Rego policy.
18+
The input file should contain the raw JSON object your policy expects —
19+
not the wrapper produced by `--show-input`. Use `jq '.input'` to extract
20+
the policy input from a `--show-input --output json` capture.
21+
22+
The policy must use `package policy` and define an `allow` rule.
23+
An optional `violations` rule (a set of strings) can provide human-readable denial reasons.
24+
The command exits with code 0 when allowed and code 1 when denied.
25+
26+
When `--input-file` is omitted, JSON is read from stdin.
27+
28+
## Flags
29+
| Flag | Description |
30+
| :--- | :--- |
31+
| -h, --help | help for input |
32+
| -i, --input-file string | [optional] Path to a JSON input file. Reads from stdin if omitted. |
33+
| -o, --output string | [defaulted] The format of the output. Valid formats are: [table, json]. (default "table") |
34+
| -p, --policy string | Path to a Rego policy file to evaluate against the input. |
35+
| --show-input | [optional] Include the policy input data in the output. |
36+
37+
38+
## Flags inherited from parent commands
39+
| Flag | Description |
40+
| :--- | :--- |
41+
| -a, --api-token string | The Kosli API token. |
42+
| -c, --config-file string | [optional] The Kosli config file path. (default "kosli") |
43+
| --debug | [optional] Print debug logs to stdout. A boolean flag https://docs.kosli.com/faq/#boolean-flags (default false) |
44+
| -H, --host string | [defaulted] The Kosli endpoint. (default "https://app.kosli.com") |
45+
| --http-proxy string | [optional] The HTTP proxy URL including protocol and port number. e.g. 'http://proxy-server-ip:proxy-port' |
46+
| -r, --max-api-retries int | [defaulted] How many times should API calls be retried when the API host is not reachable. (default 3) |
47+
| --org string | The Kosli organization. |
48+
49+
50+
## Examples Use Cases
51+
52+
These examples all assume that the flags `--api-token`, `--org`, `--host`, (and `--flow`, `--trail` when required), are [set/provided](https://docs.kosli.com/getting_started/install/#assigning-flags-via-environment-variables).
53+
54+
##### capture trail data for local policy iteration
55+
56+
```shell
57+
kosli evaluate trail TRAIL --flow FLOW
58+
--policy allow-all.rego
59+
--show-input --output json | jq '.input' > trail-data.json
60+
61+
```
62+
63+
##### then iterate on your policy locally
64+
65+
```shell
66+
kosli evaluate input
67+
--input-file trail-data.json
68+
--policy policy.rego
69+
70+
```
71+
72+
##### evaluate and show the data passed to the policy
73+
74+
```shell
75+
kosli evaluate input
76+
--input-file trail-data.json
77+
--policy policy.rego
78+
--show-input
79+
--output json
80+
81+
```
82+
83+
##### read input from stdin
84+
85+
```shell
86+
cat trail-data.json | kosli evaluate input
87+
--policy policy.rego
88+
```
89+

docs.kosli.com/content/client_reference/kosli_evaluate_trail.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ kosli evaluate trail TRAIL-NAME [flags]
1414
```
1515

1616
Evaluate a trail against a policy.
17-
Fetch a single trail from Kosli and evaluate it against a Rego policy using OPA.
17+
Fetch a single trail from Kosli and evaluate it against a Rego policy.
1818
The trail data is passed to the policy as `input.trail`.
1919

2020
Use `--attestations` to enrich the input with detailed attestation data

docs.kosli.com/content/client_reference/kosli_evaluate_trails.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ kosli evaluate trails TRAIL-NAME [TRAIL-NAME...] [flags]
1414
```
1515

1616
Evaluate multiple trails against a policy.
17-
Fetch multiple trails from Kosli and evaluate them together against a Rego policy using OPA.
17+
Fetch multiple trails from Kosli and evaluate them together against a Rego policy.
1818
The trail data is passed to the policy as `input.trails` (an array), unlike
1919
`evaluate trail` which passes `input.trail` (a single object).
2020

docs.kosli.com/content/legacy_ref/v2.12.0/_index.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs.kosli.com/content/legacy_ref/v2.12.0/kosli_expect_deployment.md

Lines changed: 0 additions & 57 deletions
This file was deleted.

docs.kosli.com/content/legacy_ref/v2.12.0/kosli_get_deployment.md

Lines changed: 0 additions & 71 deletions
This file was deleted.

docs.kosli.com/content/legacy_ref/v2.12.0/kosli_list_deployments.md

Lines changed: 0 additions & 69 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: v2.12.1
33
bookCollapseSection: true
4-
weight: 603
4+
weight: 604
55
---
66

77
# v2.12.1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: v2.13.0
33
bookCollapseSection: true
4-
weight: 602
4+
weight: 603
55
---
66

77
# v2.13.0

0 commit comments

Comments
 (0)