Skip to content

fix(create-agent-app): repair template deps/types, harden scaffold CI, scope npm name (#188)#195

Merged
drewstone merged 1 commit into
mainfrom
fix/scaffold-template
Jul 15, 2026
Merged

fix(create-agent-app): repair template deps/types, harden scaffold CI, scope npm name (#188)#195
drewstone merged 1 commit into
mainfrom
fix/scaffold-template

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

Repairs the create-agent-app scaffolder so a freshly generated app is green out of the box, hardens the CI test so this class of drift cannot ship again, and scopes the npm name (the bare create-agent-app is squatted — Collab.Land, v1.0.1, Jan 2025).

1. Template deps/types (reproduced against published agent-app@0.43.25)

node create-agent-app/index.mjs demo && cd demo && pnpm install && pnpm typecheck && pnpm test, before → after:

Check Before After
pnpm install unmet peer @tangle-network/agent-integrations: installed 0.32.0, agent-app wants >=0.44.0 no peer warnings
pnpm typecheck src/worker.ts(110,25) TS7006: 'call' implicitly any + src/worker.ts(117,46) TS7006: 't' implicitly any clean
pnpm test Cannot find package '@tangle-network/agent-runtime' (imported by agent-app's dist chunk) — 0 tests run 4/4 pass

Root cause: @tangle-network/agent-app/runtime re-exports the tool loop from @tangle-network/agent-runtime, which the template never declared (it is an optional peer of agent-app, so pnpm does not auto-install it). Without it the loop types collapse to any (→ the two TS7006s) and the dist chunk's import fails at runtime (→ the vitest error).

Template fixes:

All pins read from agent-app's current peerDependencies (unchanged by the #194 rebase — re-checked).

2. Hardened scaffold CI test (tests/create-agent-app.test.ts)

The existing test symlinked the repo root as the installed agent-app — so Node resolved undeclared engine deps by walking up into the repo's own node_modules, masking exactly the bug that shipped (verified: the old harness passes with agent-runtime deleted from the template). Now:

  • Faithful install: agent-app is installed into the generated project as a copy of the published payload (package.json + dist), and only the engine deps the generated package.json declares get linked — an undeclared dep fails here the same way it fails a user.
  • Drift gate: template peer pins must string-match agent-app's peerDependencies; every required engine peer must be declared; every peer pin must ship a devDep meeting the floor.
  • Nested suite: the generated project's own vitest run executes against the real dist (catches runtime-import gaps types can't see).

Red-state proof (template reverted to the old pins): the drift gate fails with template pins @tangle-network/agent-integrations@>=0.32.0; agent-app wants >=0.44.0, and the nested suite fails with the user's exact Cannot find package '@tangle-network/agent-runtime'. Cost: the whole 6-test scaffold file runs in ~1.8s locally (dist copy + skeleton tsc + nested 4-test vitest) — far under the CI budget.

3. npm identity

  • create-agent-app/package.json@tangle-network/create-agent-app (bare name is squatted), bin create-agent-app unchanged, publishConfig.access: public + repository.directory added, README with the create command (npm create @tangle-network/agent-app@latest my-agent).
  • Not published — made publishable only.
  • Publish-coverage finding: publish.yml never touches create-agent-app/ — both the auto-release and tag paths run npm publish at the repo root only, so the scaffolder has no publish path today. Left unmodified per scope; wiring it in needs a follow-up inside publish.yml (npm OIDC trusted publishing is filename-bound).

Next

The --chat template variant (scaffold onto /chat-routes) is the follow-up, now unblocked by #194.

Part of #188.

🤖 Generated with Claude Code

…, scope npm name

- template: add the agent-runtime peer (+devDep) the /runtime subpath imports
  at runtime, align agent-integrations to >=0.44.0 and add agent-interface
  >=0.15.0 to match agent-app's current peerDependencies; annotate the two
  tool-loop callback params in src/worker.ts (implicit-any under noImplicitAny
  when engine types are absent)
- scaffold CI test: install agent-app into the generated project as a COPY of
  the published payload (package.json + dist) instead of a repo-root symlink,
  so undeclared engine deps cannot resolve through the repo's node_modules;
  link only the engine deps the generated package.json declares; add a
  peer-pin drift gate against agent-app's peerDependencies and run the
  generated project's own vitest suite against the real dist
- package: scope the npm name to @tangle-network/create-agent-app (the bare
  name is squatted), keep the create-agent-app bin, add publishConfig +
  repository and a README with the npm create command

@tangletools tangletools left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Auto-approved drewstone PR — ffbb220c

This PR was opened by the trusted drewstone account.
The full PR reviewer audit still runs separately and will publish findings if it detects issues.

tangletools · auto-approval · reason: drewstone_author · 2026-07-15T19:37:22Z

@drewstone
drewstone merged commit 8918958 into main Jul 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants