Skip to content

@endo/agent-tools declarations are gitignored and would be absent from a published tarball #884

Description

@kriscendobot

Split out of the review question on #705 ("Does this file interfere with the npm pack process?"). The answer for that PR is no — but investigating it surfaced a real, dormant condition worth recording before @endo/agent-tools ever goes public.

The condition

Every hand-authored declaration in @endo/agent-tools is matched by the root .gitignore catch-all and is therefore absent from an npm pack tarball, even though all eleven are tracked in git (force-added past the ignore rule).

.gitignore:93:*.d.ts*	packages/agent-tools/pi.d.ts
.gitignore:93:*.d.ts*	packages/agent-tools/src/adapters/pi.d.ts
.gitignore:93:*.d.ts*	packages/agent-tools/src/json-tools/fs.d.ts
.gitignore:93:*.d.ts*	packages/agent-tools/src/json-tools/git-mount.d.ts
.gitignore:93:*.d.ts*	packages/agent-tools/src/json-tools/git-remote.d.ts
.gitignore:93:*.d.ts*	packages/agent-tools/src/json-tools/git.d.ts
.gitignore:93:*.d.ts*	packages/agent-tools/src/json-tools/http.d.ts
.gitignore:93:*.d.ts*	packages/agent-tools/src/json-tools/shell.d.ts
.gitignore:93:*.d.ts*	packages/agent-tools/src/tool.d.ts
.gitignore:93:*.d.ts*	packages/agent-tools/tool.d.ts
.gitignore:93:*.d.ts*	packages/agent-tools/types-index.d.ts

npm-packlist honours that ignore rule, so a tarball built from this package contains zero .d.ts files while shipping all of the .js they describe:

$ cd packages/agent-tools && npm pack --dry-run --json | jq -r '.[0].files[].path' | grep -c '\.d\.ts$'
0
$ ... | grep -c 'src/json-tools/git-remote\.js'
1

The consequence, were the package published as-is: the top-level "types": "./types-index.d.ts" and every types condition in the exports map would dangle — a consumer would get untyped JS.

The correlation is exact, not incidental. @endo/exo is on the .gitignore negation allowlist for precisely two declarations, and its tarball ships precisely those two:

$ cd packages/exo && npm pack --dry-run --json | jq -r '.[0].files[].path' | grep '\.d\.ts$'
src/types.d.ts
types-index.d.ts

@endo/agent-tools has no allowlist entries and ships none.

Why it is dormant today

@endo/agent-tools is "private": true, and both scripts/pack-all.mjs and scripts/release-npm.mjs enumerate workspaces with yarn workspaces list --no-private. The package is never packed and never published, including by the viable-release CI job (yarn smoketest:publishyarn release:npmpack:all). Nothing is broken now; the hole opens the moment the private flag comes off.

Options

  1. Allowlist — add the eleven !packages/agent-tools/... negations to .gitignore, alongside the existing entries the file labels "legacy exceptions to the above rule".
  2. Rename to the current convention — the .gitignore comment states the going-forward convention is *.types.d.ts (!*.types.d.ts is already negated), which would make new declarations tracked without per-file edits. This is the cleaner fix but renames eleven files and their exports types targets.
  3. Do it at un-private time — fold either fix into whichever PR makes the package public, gated by a check.

Option 2 plus a guard (a check that every types target in every non-private package's exports map survives npm pack) would prevent the class rather than this instance. Recording rather than choosing here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions