Skip to content

Commit b5a8624

Browse files
robertsLandoclaude
andauthored
refactor!: drop pkg-CLI mirror inputs, own only action-layer surface (#13)
* refactor!: drop pkg-CLI mirror inputs, own only action-layer surface Pkg-specific knobs (mode, node-version, compress-node, fallback-to-source, public, public-packages, options, no-bytecode, no-dict, debug, extra-args) are removed from the action input surface. Users express them in their pkg config (.pkgrc, pkg.config.{js,ts,json}, or package.json pkg field) instead. The action keeps only action-layer concerns that do not exist in pkg config: config path, entry, targets, pkg-version/pkg-path, plus the archive, signing, windows-metadata, and performance groups. Motivation: mirroring pkg's CLI forced the action to grow a new input each time pkg added a flag, and to maintain back-compat on every pkg release. By letting pkg own its own schema we decouple the action from pkg's evolution. Docs updated: README gets a new "pkg configuration" section with a migration example; architecture.md §3/§6 note the scoped surface; STATUS.yaml records the dropped-inputs list and migration path. BREAKING CHANGE: the listed inputs are no longer accepted. Setting them now triggers the unknown-input warning and the value is ignored. Migrate into your pkg config file. * review: link STATUS from architecture, cover pkg-version/pkg-path in tests Address PR-review suggestions: - architecture.md §6 no longer duplicates the dropped-input list; points readers at STATUS.yaml#input-surface-slim as the single source. - inputs.test.ts: extend the defaults test with `pkgPath` and add a positive round-trip test for `pkg-version` + `pkg-path`. These remain live inputs and deserve the same explicit coverage the rest of BuildInputs has. 223/223 unit tests, lint clean. * feat: add config-inline input for file-less pkg config New optional input `config-inline` accepts a JSON string carrying the pkg config directly in the workflow. The orchestrator writes it to `${invocationDir}/pkg-config.inline.json` and forwards that path to pkg via `--config`. Mutually exclusive with `config`; the pair is validated at parse time alongside a JSON-object syntax check so a typo fails before pkg runs. Motivation: users with a trivial pkg config (entry + a couple of knobs) no longer need to commit a separate .pkgrc.json just to customize the build. Keeps the "pkg owns its schema" property — users still write pkg config keys (camelCase), we just let them write them inline. Not masked as a secret — README adds a note warning users against embedding secrets in the value. Docs: README gains an "Inline config" subsection with an example; action.yml + docs/inputs.md regenerated. Tests: four new unit tests cover the happy path, mutual exclusion, invalid JSON, and non-object JSON (string/array/null). 227/227 pass. * review(copilot): use correct camelCase pkg-config keys in warnings/docs Three nits from the Copilot review on PR #13: - targets.ts cross-compile warnings referenced `fallback-to-source` (kebab, like the retired CLI flag); pkg config uses `fallbackToSource` (camelCase). Reword both messages to point at the actual config key. - README "pkg configuration" example was fenced as jsonc with a `//` comment and trailing comma but labeled `.pkgrc.json` — .pkgrc.json is strict JSON, so a copy/paste would fail. Move the filename into the prose, fence as json, drop the comment + trailing comma. Unit tests + lint green. Matrix bundle rebuilt to pick up the new warning strings. * e2e(claude-code): move pkg-layer knobs from action inputs to pkg config Main (PR #12) wired the claude-code-smoke job through the action using `mode: sea` and `compress-node: Zstd` inputs. Those inputs no longer exist on this branch, so move both values into the package.json#pkg field that the fixture-prep step already injects. No behavior change on main; on this branch the e2e now exercises the pkg-config path the slim input surface forces users onto. * e2e(claude-code): use sea:true config, acknowledge CLI-only flag gap The merge from main brought in the claude-code-smoke job, which previously drove pkg via `mode: sea` + `compress-node: Zstd` action inputs. On this branch those inputs are dropped. The prior merge-conflict resolution moved both into `package.json#pkg` under the assumption that pkg config would pick them up. That assumption was wrong: - `mode: 'sea'` is not a pkg config key — the correct key is `sea: true`. (This was a user-visible bug; pkg silently ignored `mode` and ran standard-mode, which OOM'd trying to bytecode-compile claude-code's ESM bundle on macos-arm64.) - `compressNode` / `compress` is not a pkg config key at all. `--compress` is CLI-only today on @yao-pkg/pkg. No config equivalent exists. Fix the e2e: - Write `sea: true` into package.json#pkg so SEA is actually enabled. - Drop the Zstd request — there is no way to express it without the dropped CLI input. The job now exercises SEA + tar.gz; the Zstd branch is intentionally deferred until upstream lands config support. - Rename + retone the job's comment block accordingly. Also add an upstream-dependency note to STATUS.yaml and a draft issue body at docs/upstream-pkg-config-issue.md. The draft asks yao-pkg/pkg to accept the currently-CLI-only build flags (compress, fallbackToSource, public, publicPackages, options, noBytecode, noDict, debug, signature) in the config file — that's the piece that makes this PR's scope defensible for the full input set, not just for SEA. 227 unit tests pass; lint + prettier clean. * status: link upstream pkg-config tracking issue (yao-pkg/pkg#262) Issue is open upstream asking @yao-pkg/pkg to accept the currently-CLI-only build flags (compress, fallbackToSource, public, publicPackages, options, noBytecode, noDict, debug, signature) in the config file — the piece that makes this PR's drop-the-CLI-mirror direction fully viable. Replace the local draft with the issue URL in STATUS.yaml#upstream-dependency. * e2e(claude-code): enable Zstd via pkg config; bump pkg → ~6.19.0 pkg v6.19.0 (yao-pkg/pkg#263, closes #262) landed config support for the CLI-only build flags, and ships the SEA-mode detector fix (yao-pkg/pkg#268) that caused the prior OOM at bytecode-compile time. - claude-code-smoke: add `compress: 'Zstd'` alongside `sea: true` in package.json#pkg; bump pkg-version input ~6.18.0 → ~6.19.0. - Default `pkg-version` input bumped ~6.16.0 → ~6.19.0 — the whole config-as-source-of-truth direction of this branch requires it. - Regenerated action.yml / packages/build/action.yml / docs/inputs.md. - STATUS.yaml: upstream-dependency RESOLVED; Zstd gap dropped; e2e-status lists claude-code-smoke; ci-status bumped to 227 tests. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore: rebuild dist/ bundles after pkg-version bump Rebuild packages/{build,windows-metadata}/dist/index.mjs so the committed bundles match the ~6.19.0 default written into packages/core/src/inputs.ts. Drift gate caught it. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * review: correct pkg-config keys, mask config-inline, extract materialize helper Address four items from the self-review on PR #13: - README examples used `mode: "sea"` / `compressNode: "Brotli"` — neither exists in @yao-pkg/pkg's config schema. The authoritative FLAG_SPECS in lib/config.ts (and the docs-site configuration reference) show `sea: true` and `compress: "..."`. Fixed both examples so a copy-paste works. - `config-inline` carried user-authored JSON but was not masked. Mark the spec with `secret: true` so parseInputs registers the raw value via core.setSecret — exact-match redaction in logs costs nothing given pkg doesn't echo the config blob. README warning softened accordingly (still flags the on-disk temp file). - Extract the config-inline "bytes to disk" step out of the orchestrator into `materializePkgConfigInline` in fs-utils, alongside `PKG_CONFIG_INLINE_FILENAME`. Four new unit tests cover pass-through, both-undefined, inline-writes-and-returns-path, and inline-wins-over-config. Orchestrator is now a two-liner that just logs the resulting path. - BASE_BUILD fixture in pkg-runner.test.ts still pinned pkgVersion to the old `~6.16.0` default; bump to `~6.19.0` to match parseInputs. Regenerated action.yml + docs/inputs.md (secret flag on config-inline doesn't affect the YAML shape but the description changed). Rebuilt packages/{build,windows-metadata}/dist/index.mjs. Tests 231/231 pass (was 227/227), typecheck + lint + prettier green. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 2cb95b8 commit b5a8624

19 files changed

Lines changed: 451 additions & 480 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,18 @@ jobs:
253253
254254
# ──────────────────────────────────────────────────────────────────────
255255
# Real-world smoke: pull @anthropic-ai/claude-code from npm, build a
256-
# native binary per runner OS/arch with Zstd-compressed pkg payload +
257-
# tar.gz archive, execute the binary with --version, then verify the
258-
# archive round-trips and the sha256 sidecar matches the archive bytes.
256+
# native binary per runner OS/arch in SEA mode with Zstd-compressed
257+
# bundled sources, tar.gz archive, execute the binary with --version,
258+
# then verify the archive round-trips and the sha256 sidecar matches
259+
# the archive bytes.
259260
#
260-
# claude-code is ESM, so mode: sea (standard pkg can't bytecode-compile
261-
# ESM). Each matrix entry builds for the runner's native target so the
262-
# produced binary can be launched in-place for the smoke assertion,
263-
# giving real cross-OS + cross-arch coverage (x64 and arm64 on Linux,
264-
# arm64 on macOS, x64 on Windows). Zstd bundled-binary compression
265-
# requires Node.js >= 22.15 on the build host; .node-version is 22.22.
261+
# claude-code is ESM, so SEA mode is required (standard pkg can't
262+
# bytecode-compile ESM). Both `sea: true` and `compress: 'Zstd'` are
263+
# declared in the pkg config (package.json#pkg) — expressible in
264+
# config starting @yao-pkg/pkg v6.19.0 (yao-pkg/pkg#263). Each matrix
265+
# entry builds for the runner's native target so the produced binary
266+
# can be launched in-place, giving real cross-OS + cross-arch
267+
# coverage (x64 and arm64 on Linux, arm64 on macOS, x64 on Windows).
266268
claude-code-smoke:
267269
name: claude-code-smoke / ${{ matrix.os }} / ${{ matrix.target }}
268270
runs-on: ${{ matrix.os }}
@@ -332,8 +334,13 @@ jobs:
332334
const p = './package.json';
333335
const pkg = JSON.parse(fs.readFileSync(p, 'utf8'));
334336
pkg.bin = './' + process.argv[1];
337+
// Full pkg-layer config lives here — no CLI-mirror inputs.
338+
// Requires @yao-pkg/pkg >= 6.19.0 for \`compress\` in config
339+
// (yao-pkg/pkg#263).
335340
pkg.pkg = {
336-
assets: ['node_modules/@anthropic-ai/claude-code/**/*']
341+
assets: ['node_modules/@anthropic-ai/claude-code/**/*'],
342+
sea: true,
343+
compress: 'Zstd',
337344
};
338345
fs.writeFileSync(p, JSON.stringify(pkg, null, 2));
339346
" "$entry"
@@ -350,11 +357,10 @@ jobs:
350357
with:
351358
config: ${{ steps.fix.outputs.fixture }}/package.json
352359
targets: ${{ matrix.target }}
353-
mode: sea
354-
compress-node: Zstd
355-
# Zstd landed in @yao-pkg/pkg 6.17. The action's default
356-
# (~6.16.0) predates it, so pin a Zstd-capable version.
357-
pkg-version: ~6.18.0
360+
# 6.19.0+ is required for the `compress` key in pkg config.
361+
# SEA (`sea: true`) and Zstd (`compress: 'Zstd'`) live in the
362+
# package.json#pkg field, not as action inputs.
363+
pkg-version: ~6.19.0
358364
compress: tar.gz
359365
checksum: sha256
360366
filename: 'claude-{version}-{os}-{arch}'

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,63 @@ Tracking issue: [yao-pkg/pkg#248](https://github.com/yao-pkg/pkg/issues/248).
3131
path: "${{ join(fromJson(steps.build.outputs.artifacts), '\n') }}"
3232
```
3333
34+
## pkg configuration
35+
36+
The action does **not** mirror pkg's CLI flags as inputs. Pkg-specific knobs
37+
— SEA mode, bundled Node compression, `public` / `publicPackages`, V8
38+
`options`, `noBytecode`, `noDict`, `debug`, bytecode-fabricator fallback —
39+
live in your pkg config file (`.pkgrc.json`, `pkg.config.{js,ts,json}`, or
40+
the `pkg` field of `package.json`). See
41+
[yao-pkg/pkg's README](https://github.com/yao-pkg/pkg#config) for the full
42+
schema.
43+
44+
Example — SEA mode with Brotli-compressed bundle + fallback, saved as `.pkgrc.json`:
45+
46+
```json
47+
{
48+
"bin": "src/main.js",
49+
"sea": true,
50+
"compress": "Brotli",
51+
"fallbackToSource": true
52+
}
53+
```
54+
55+
```yaml
56+
- uses: yao-pkg/pkg-action@v1
57+
with:
58+
config: .pkgrc.json
59+
targets: node22-linux-x64
60+
```
61+
62+
### Inline config
63+
64+
For trivial setups you can skip the file and pass the config as a JSON string
65+
via `config-inline` — the action writes it to a temp file and points pkg at
66+
it. Mutually exclusive with `config`.
67+
68+
```yaml
69+
- uses: yao-pkg/pkg-action@v1
70+
with:
71+
targets: node22-linux-x64
72+
config-inline: |
73+
{
74+
"bin": "src/main.js",
75+
"sea": true,
76+
"compress": "Brotli"
77+
}
78+
```
79+
80+
> The value is registered with `core.setSecret`, so exact matches are redacted
81+
> from logs — but it is still written verbatim to a temp file on the runner.
82+
> Prefer `config` (a committed file) for anything beyond a couple of knobs,
83+
> and source long-lived secrets from GitHub Actions secrets / OIDC, not from
84+
> `config-inline`.
85+
86+
The action's inputs cover only concerns pkg config cannot express: matrix
87+
targets, pkg install version/path, archive format, filename template,
88+
checksum algorithms, Windows-metadata resedit patch, macOS/Windows signing,
89+
cache, step summary.
90+
3491
## Outputs
3592

3693
| Output | Shape |

STATUS.yaml

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
meta:
1111
repo: yao-pkg/pkg-action
1212
branch: main
13-
last-updated: '2026-04-23'
13+
last-updated: '2026-04-24'
1414
action-status: ALPHA — ready for early adopters to try in their own workflows
15-
ci-status: green (222 unit tests)
15+
ci-status: green (227 unit tests)
1616
e2e-status: |
17-
6 jobs after the scope cut — tiny-cjs (ubuntu/macos/windows), codegen-drift,
18-
matrix plan→fanout, multi-target-linux, windows-metadata. Signing e2e still
19-
deferred until live credentials are available.
17+
7 jobs after the scope cut — tiny-cjs (ubuntu/macos/windows), codegen-drift,
18+
matrix plan→fanout, multi-target-linux, windows-metadata, claude-code-smoke
19+
(SEA + Zstd, 4 OS/arch combos). Signing e2e still deferred until live
20+
credentials are available.
2021
2122
# ─── Scope decision (2026-04-23) ─────────────────────────────────────────
2223
#
@@ -48,6 +49,37 @@ recent-hardening:
4849
- '`yamlString` codegen helper throws on embedded control chars — prevents silent action.yml corruption (S2).'
4950
- 'CI coverage gate at 85% via scripts/check-coverage.ts parsing lcov (S6).'
5051

52+
# ─── Input-surface slim (2026-04-23) ─────────────────────────────────────
53+
# Stop mirroring pkg's CLI. Pkg-specific knobs live in the user's pkg config;
54+
# the action owns only concerns pkg config cannot express (CI-matrix targets,
55+
# pkg install version, archive, checksum, windows-metadata, signing, cache).
56+
57+
input-surface-slim:
58+
dropped-inputs:
59+
- mode
60+
- node-version
61+
- compress-node
62+
- fallback-to-source
63+
- public
64+
- public-packages
65+
- options
66+
- no-bytecode
67+
- no-dict
68+
- debug
69+
- extra-args
70+
migration: 'Move each value into .pkgrc / pkg.config.{js,ts,json} or the `pkg` field of package.json. `buildPkgArgs` forwards the config path to pkg.'
71+
breaking: 'yes — users setting any dropped input will see the unknown-input warning and the value will be ignored. Release note required.'
72+
minimum-pkg-version: |
73+
@yao-pkg/pkg >= 6.19.0 is required for the full build-flag surface in
74+
pkg config. The default `pkg-version` input is pinned to `~6.19.0`.
75+
upstream-dependency: |
76+
RESOLVED in @yao-pkg/pkg v6.19.0 (2026-04-24) via yao-pkg/pkg#263 —
77+
closes yao-pkg/pkg#262. All CLI-only build flags now have config
78+
equivalents: compress, fallbackToSource, public, publicPackages,
79+
options, bytecode (inverts --no-bytecode), nativeBuild (inverts
80+
--no-native-build), noDictionary (renamed from --no-dict), debug,
81+
signature.
82+
5183
# ─── Removed (2026-04-23) ────────────────────────────────────────────────
5284
# Distribution scope reset. Use dedicated downstream actions instead.
5385

action.yml

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,16 @@ branding:
1010

1111
inputs:
1212
config:
13-
description: 'Path to a pkg config (.pkgrc, pkg.config.{js,ts,json}, or package.json). Auto-detected when omitted.'
13+
description: 'Path to a pkg config (.pkgrc, pkg.config.{js,ts,json}, or package.json). Auto-detected when omitted. Mutually exclusive with config-inline.'
14+
config-inline:
15+
description: 'Pkg config as a JSON string. Written to a temp file and passed to pkg via --config. Mutually exclusive with config. Registered with core.setSecret so exact matches are redacted from logs; still written to a temp file on the runner, so prefer config for anything beyond trivial knobs.'
1416
entry:
1517
description: 'Entry script when not specified in the config.'
1618
targets:
1719
description: 'Comma- or newline-separated pkg target triples, e.g. node22-linux-x64,node22-macos-arm64. Defaults to the host target.'
18-
mode:
19-
description: 'standard | sea — selects pkg Standard or SEA mode.'
20-
default: 'standard'
21-
node-version:
22-
description: 'pkg''s bundled Node.js major (e.g. 22, 24). Does not affect the action''s own Node runtime.'
23-
default: '22'
24-
compress-node:
25-
description: 'pkg''s bundled-binary compression: Brotli | GZip | Zstd | None. Zstd requires Node.js >= 22.15 on the build host.'
26-
default: 'None'
27-
fallback-to-source:
28-
description: 'Pass pkg --fallback-to-source for bytecode-fabricator failures.'
29-
default: 'false'
30-
public:
31-
description: 'Pass pkg --public (ships sources as plaintext).'
32-
default: 'false'
33-
public-packages:
34-
description: 'Comma-separated package names to mark public (pkg --public-packages).'
35-
options:
36-
description: 'Comma-separated V8 options baked into the binary (pkg --options).'
37-
no-bytecode:
38-
description: 'Pass pkg --no-bytecode.'
39-
default: 'false'
40-
no-dict:
41-
description: 'Comma-separated list of packages for pkg --no-dict (or * for all).'
42-
debug:
43-
description: 'Pass pkg --debug.'
44-
default: 'false'
45-
extra-args:
46-
description: 'Raw extra flags appended to the pkg CLI invocation.'
4720
pkg-version:
48-
description: 'npm version specifier for @yao-pkg/pkg (e.g. ~6.16.0). Bypassed when pkg-path is set.'
49-
default: '~6.16.0'
21+
description: 'npm version specifier for @yao-pkg/pkg (e.g. ~6.19.0). 6.19.0+ is required for the full build-flag surface in pkg config (compress, fallbackToSource, public, publicPackages, options, bytecode, nativeBuild, noDictionary, debug, signature). Bypassed when pkg-path is set.'
22+
default: '~6.19.0'
5023
pkg-path:
5124
description: 'Absolute path to a pre-installed pkg binary. Skips the implicit npm i -g.'
5225
strip:
@@ -169,7 +142,7 @@ runs:
169142
uses: actions/cache@v5
170143
with:
171144
path: ${{ runner.temp }}/pkg-cache
172-
key: ${{ inputs.cache-key || format('pkg-fetch-{0}-{1}-node{2}-{3}', runner.os, runner.arch, inputs.node-version, hashFiles('**/package.json', '.pkgrc*', '**/pkg.config.{js,ts,json}')) }}
145+
key: ${{ inputs.cache-key || format('pkg-fetch-{0}-{1}-{2}', runner.os, runner.arch, hashFiles('**/package.json', '.pkgrc*', '**/pkg.config.{js,ts,json}')) }}
173146

174147
- name: Install @yao-pkg/pkg
175148
if: ${{ inputs.pkg-path == '' }}
@@ -182,19 +155,9 @@ runs:
182155
uses: ./packages/build
183156
with:
184157
config: ${{ inputs.config }}
158+
config-inline: ${{ inputs.config-inline }}
185159
entry: ${{ inputs.entry }}
186160
targets: ${{ inputs.targets }}
187-
mode: ${{ inputs.mode }}
188-
node-version: ${{ inputs.node-version }}
189-
compress-node: ${{ inputs.compress-node }}
190-
fallback-to-source: ${{ inputs.fallback-to-source }}
191-
public: ${{ inputs.public }}
192-
public-packages: ${{ inputs.public-packages }}
193-
options: ${{ inputs.options }}
194-
no-bytecode: ${{ inputs.no-bytecode }}
195-
no-dict: ${{ inputs.no-dict }}
196-
debug: ${{ inputs.debug }}
197-
extra-args: ${{ inputs.extra-args }}
198161
pkg-version: ${{ inputs.pkg-version }}
199162
pkg-path: ${{ inputs.pkg-path }}
200163
strip: ${{ inputs.strip }}

docs/architecture.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ directly).
6969
| `targets.ts` | `Target` type, `parseTarget`, `hostTarget`, `formatTarget` |
7070
| `templates.ts` | `{name}/{version}/{os}/{arch}/…` filename renderer + token bag |
7171
| `checksum.ts` | sha256/sha512/md5 streaming, `writeShasumsFile`, `writeSidecar` |
72-
| `inputs.ts` | `INPUT_SPECS` (source of truth for every input) + `parseInputs` |
73-
| `pkg-runner.ts` | `@yao-pkg/pkg` CLI bridge + `buildPkgArgs` |
72+
| `inputs.ts` | `INPUT_SPECS` (action-layer inputs only) + `parseInputs` |
73+
| `pkg-runner.ts` | `@yao-pkg/pkg` CLI bridge + `buildPkgArgs` (no pkg-flag mirroring) |
7474
| `pkg-output-map.ts` | Reconciles pkg on-disk outputs to `Target[]` |
7575
| `archive.ts` | tar.gz / tar.xz / zip / 7z writers (yazl for zip) |
7676
| `summary.ts` | Markdown table for `GITHUB_STEP_SUMMARY` |
@@ -156,6 +156,17 @@ Source of truth: `packages/core/src/inputs.ts::INPUT_SPECS`. One `InputSpec`
156156
record per input with `name / description / default? / required? / category /
157157
deprecated? / secret?`.
158158

159+
**Input-surface scope** (2026-04-23): the action intentionally does not
160+
mirror pkg's CLI. Pkg-specific knobs are expressed via the user's pkg config
161+
file, which `buildPkgArgs` forwards through `--config`. The action owns only
162+
concerns that pkg config cannot express: CI-matrix `targets`, the
163+
`pkg-version` / `pkg-path` install choice, archive format, filename template,
164+
checksum algorithms, Windows-metadata resedit patch, signing, cache, and step
165+
summary. Rationale: decouple the action from pkg's CLI evolution — each new
166+
pkg flag otherwise forced a back-compat-preserving input bump here.
167+
Authoritative list of dropped inputs + migration note lives in
168+
[`STATUS.yaml`](../STATUS.yaml) under `input-surface-slim`.
169+
159170
Emitted:
160171

161172
- `/action.yml` — top-level composite. Every input forwarded explicitly to the

docs/inputs.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,11 @@ Every `pkg-action` input, grouped by category.
88

99
| Input | Default | Required | Secret | Description |
1010
| --- | --- | --- | --- | --- |
11-
| `config` || no | no | Path to a pkg config (.pkgrc, pkg.config.{js,ts,json}, or package.json). Auto-detected when omitted. |
11+
| `config` || no | no | Path to a pkg config (.pkgrc, pkg.config.{js,ts,json}, or package.json). Auto-detected when omitted. Mutually exclusive with config-inline. |
12+
| `config-inline` || no | yes | Pkg config as a JSON string. Written to a temp file and passed to pkg via --config. Mutually exclusive with config. Registered with core.setSecret so exact matches are redacted from logs; still written to a temp file on the runner, so prefer config for anything beyond trivial knobs. |
1213
| `entry` || no | no | Entry script when not specified in the config. |
1314
| `targets` || no | no | Comma- or newline-separated pkg target triples, e.g. node22-linux-x64,node22-macos-arm64. Defaults to the host target. |
14-
| `mode` | `standard` | no | no | standard \| sea — selects pkg Standard or SEA mode. |
15-
| `node-version` | `22` | no | no | pkg's bundled Node.js major (e.g. 22, 24). Does not affect the action's own Node runtime. |
16-
| `compress-node` | `None` | no | no | pkg's bundled-binary compression: Brotli \| GZip \| Zstd \| None. Zstd requires Node.js >= 22.15 on the build host. |
17-
| `fallback-to-source` | `false` | no | no | Pass pkg --fallback-to-source for bytecode-fabricator failures. |
18-
| `public` | `false` | no | no | Pass pkg --public (ships sources as plaintext). |
19-
| `public-packages` || no | no | Comma-separated package names to mark public (pkg --public-packages). |
20-
| `options` || no | no | Comma-separated V8 options baked into the binary (pkg --options). |
21-
| `no-bytecode` | `false` | no | no | Pass pkg --no-bytecode. |
22-
| `no-dict` || no | no | Comma-separated list of packages for pkg --no-dict (or * for all). |
23-
| `debug` | `false` | no | no | Pass pkg --debug. |
24-
| `extra-args` || no | no | Raw extra flags appended to the pkg CLI invocation. |
25-
| `pkg-version` | `~6.16.0` | no | no | npm version specifier for @yao-pkg/pkg (e.g. ~6.16.0). Bypassed when pkg-path is set. |
15+
| `pkg-version` | `~6.19.0` | no | no | npm version specifier for @yao-pkg/pkg (e.g. ~6.19.0). 6.19.0+ is required for the full build-flag surface in pkg config (compress, fallbackToSource, public, publicPackages, options, bytecode, nativeBuild, noDictionary, debug, signature). Bypassed when pkg-path is set. |
2616
| `pkg-path` || no | no | Absolute path to a pre-installed pkg binary. Skips the implicit npm i -g. |
2717

2818
## Post-build

packages/build/action.yml

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,16 @@ author: 'yao-pkg contributors'
77

88
inputs:
99
config:
10-
description: 'Path to a pkg config (.pkgrc, pkg.config.{js,ts,json}, or package.json). Auto-detected when omitted.'
10+
description: 'Path to a pkg config (.pkgrc, pkg.config.{js,ts,json}, or package.json). Auto-detected when omitted. Mutually exclusive with config-inline.'
11+
config-inline:
12+
description: 'Pkg config as a JSON string. Written to a temp file and passed to pkg via --config. Mutually exclusive with config. Registered with core.setSecret so exact matches are redacted from logs; still written to a temp file on the runner, so prefer config for anything beyond trivial knobs.'
1113
entry:
1214
description: 'Entry script when not specified in the config.'
1315
targets:
1416
description: 'Comma- or newline-separated pkg target triples, e.g. node22-linux-x64,node22-macos-arm64. Defaults to the host target.'
15-
mode:
16-
description: 'standard | sea — selects pkg Standard or SEA mode.'
17-
default: 'standard'
18-
node-version:
19-
description: 'pkg''s bundled Node.js major (e.g. 22, 24). Does not affect the action''s own Node runtime.'
20-
default: '22'
21-
compress-node:
22-
description: 'pkg''s bundled-binary compression: Brotli | GZip | Zstd | None. Zstd requires Node.js >= 22.15 on the build host.'
23-
default: 'None'
24-
fallback-to-source:
25-
description: 'Pass pkg --fallback-to-source for bytecode-fabricator failures.'
26-
default: 'false'
27-
public:
28-
description: 'Pass pkg --public (ships sources as plaintext).'
29-
default: 'false'
30-
public-packages:
31-
description: 'Comma-separated package names to mark public (pkg --public-packages).'
32-
options:
33-
description: 'Comma-separated V8 options baked into the binary (pkg --options).'
34-
no-bytecode:
35-
description: 'Pass pkg --no-bytecode.'
36-
default: 'false'
37-
no-dict:
38-
description: 'Comma-separated list of packages for pkg --no-dict (or * for all).'
39-
debug:
40-
description: 'Pass pkg --debug.'
41-
default: 'false'
42-
extra-args:
43-
description: 'Raw extra flags appended to the pkg CLI invocation.'
4417
pkg-version:
45-
description: 'npm version specifier for @yao-pkg/pkg (e.g. ~6.16.0). Bypassed when pkg-path is set.'
46-
default: '~6.16.0'
18+
description: 'npm version specifier for @yao-pkg/pkg (e.g. ~6.19.0). 6.19.0+ is required for the full build-flag surface in pkg config (compress, fallbackToSource, public, publicPackages, options, bytecode, nativeBuild, noDictionary, debug, signature). Bypassed when pkg-path is set.'
19+
default: '~6.19.0'
4720
pkg-path:
4821
description: 'Absolute path to a pre-installed pkg binary. Skips the implicit npm i -g.'
4922
strip:

0 commit comments

Comments
 (0)