Skip to content

fix(create-agents): sync template deps to CLI version after clone#2209

Closed
nick-inkeep wants to merge 1 commit intofeat/unify-env-generationfrom
fix/sync-template-deps-and-localhost
Closed

fix(create-agents): sync template deps to CLI version after clone#2209
nick-inkeep wants to merge 1 commit intofeat/unify-env-generationfrom
fix/sync-template-deps-and-localhost

Conversation

@nick-inkeep
Copy link
Copy Markdown
Collaborator

@nick-inkeep nick-inkeep commented Feb 20, 2026

Summary

  • After create-agents clones the template via degit, syncTemplateDependencies() reads the CLI's own package.json version and updates all @inkeep/* deps in the template to ^{cliVersion}
  • Prevents version mismatch when the template hasn't been updated to match the latest CLI release (e.g., CLI v0.52.0 but template deps at ^0.50.3)
  • Stacked on Unify .env generation between quickstart CLI and contributor flows #2212 (feat/unify-env-generation) — scoped to only the dep sync logic, no overlap with env generation changes

Changes

packages/create-agents/src/utils.ts

  • getCliVersion() — reads CLI's own package.json version via readFileSync + fileURLToPath(import.meta.url), returns '' on failure
  • syncTemplateDependencies(templatePath) — iterates dependencies and devDependencies, updates any @inkeep/* entry to ^{cliVersion}
  • Call site added after process.chdir(directoryPath) in createAgents() flow

packages/create-agents/src/__tests__/utils.test.ts

.changeset/meaningful-orange-kangaroo.md

  • Patch changeset for @inkeep/create-agents

What this does NOT touch

Test plan

  • Unit: syncTemplateDependencies happy path — updates @inkeep/* deps to ^1.2.3
  • Unit: missing package.json — gracefully skips
  • Unit: no @inkeep deps — writes file unchanged (no crash)
  • Unit: no devDependencies — only processes dependencies
  • Unit: devDependencies — updates @inkeep/* in devDeps too
  • Unit: non-@inkeep preserved — react, next, etc. untouched
  • Typechecktsc --noEmit passes
  • Lintbiome lint --error-on-warnings passes
  • Formatbiome check passes
  • CI — waiting for checks to run

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 20, 2026

🦋 Changeset detected

Latest commit: 0d60b0e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@inkeep/agents-core Patch
@inkeep/create-agents Patch
@inkeep/agents-api Patch
@inkeep/agents-manage-ui Patch
@inkeep/agents-cli Patch
@inkeep/agents-sdk Patch
@inkeep/agents-work-apps Patch
@inkeep/ai-sdk-provider Patch
@inkeep/agents-mcp Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agents-api Ready Ready Preview, Comment Feb 24, 2026 7:54am
agents-docs Ready Ready Preview, Comment Feb 24, 2026 7:54am
agents-manage-ui Ready Ready Preview, Comment Feb 24, 2026 7:54am

Request Review

@nick-inkeep
Copy link
Copy Markdown
Collaborator Author

CI/CD Status Note

Two CI failures are pre-existing (not caused by this PR):

  1. Create Agents E2E Tests — Failed at "Run database migrations" with Constraint "sub_agent_skills_sub_agent_skill_unique" does not exist. This is a Doltgres migration issue from the reverted constraint PR (Revert "fix: scope sub_agent_skills unique constraint to tenant/project/agent" #2205).

  2. ci (Cypress E2E) — Failed at "Run Cypress E2E Tests" with table not found: projects. Same Doltgres migration issue.

Evidence: Main branch CI (main, 2026-02-20T04:06:21Z) shows the same failure pattern. The 4 most recent CI runs on main all failed with the same database migration errors. This PR only modifies create-agents package files (utils.ts, tests, changeset) — no database or migration changes.

All checks relevant to this PR's scope pass:

  • auto-format: pass
  • Vercel previews (agents-api, agents-docs, agents-manage-ui): all pass
  • Local tests: 34/34 pass, typecheck clean, lint clean

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

PR Review Summary

(0) Total Issues | Risk: Low

This is a well-scoped bug fix PR that addresses two real issues affecting the create-agents CLI onboarding experience:

  1. Template dependency sync: Smart fix to ensure @inkeep/* dependencies in cloned templates match the CLI version, preventing version mismatch issues
  2. Localhost URL consistency: Correct fix for cookie-based auth — localhost and 127.0.0.1 are different origins for SameSite=Lax cookies

💭 Consider (2) 💭

Inline Comments:

  • 💭 Consider: utils.ts:52 Add error handling to getCliVersion() for defensive robustness
  • 💭 Consider: utils.test.ts:659 Add error path test for syncTemplateDependencies to document error propagation behavior

Validation Notes

Strengths of this PR:

  • The localhost vs 127.0.0.1 fix is correct — this is a known browser security distinction for cookie origins
  • The dependency sync approach (using CLI version) is simple and effective
  • Good test coverage for the new functionality (4 tests for syncTemplateDependencies, 2 for localhost assertions)
  • Manual integration testing documented in the PR description covers the path resolution concerns
  • Changeset is correctly scoped as a patch release

Code quality:

  • Clean implementation with no bugs or security issues identified
  • Uses existing patterns (fs-extra, path utilities) consistently
  • Both getCliVersion and syncTemplateDependencies are simple and readable

✅ APPROVE

Summary: Clean bug fix PR with appropriate scope. The two "Consider" items are minor enhancements for defensive programming and test documentation — neither blocks merge. The core changes are correct and well-tested.

Discarded (4)
Location Issue Reason Discarded
utils.test.ts:28-45 Test mocks reduce confidence in path resolution Manual integration testing documented in PR description addresses this; test-time mocking is appropriate for unit tests
utils.test.ts:570 No test for peerDependencies exclusion Documentation concern only; current behavior is intentional and unlikely to regress
utils.test.ts:662 Localhost tests don't cover "Next Steps" output Cosmetic only; the functional behavior (cookie handling) depends on file contents, not printed messages
utils.ts:48-52 Path resolution may fail in unusual contexts PR author verified integration testing; the implementation follows standard ESM patterns
Reviewers (3)
Reviewer Returned Main Findings Consider While You're Here Inline Comments Pending Recs Discarded
pr-review-standards 0 0 0 0 0 0 0
pr-review-tests 5 0 1 0 1 0 3
pr-review-devops 4 0 1 0 1 0 2
Total 9 0 2 0 2 0 5

Comment thread packages/create-agents/src/utils.ts
Comment thread packages/create-agents/src/__tests__/utils.test.ts
Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

PR Review Summary

(0) Total Issues | Risk: Low

Delta Review (Re-review after 51527f2df)

This re-review validates the delta commit that addressed feedback from the prior review.

Changes since last review:

  • Consider #1 — ADDRESSED: Added try-catch to getCliVersion() with graceful fallback. The implementation correctly:

    • Wraps the file read in try-catch (lines 48-56)
    • Returns empty string on failure
    • syncTemplateDependencies already guards with if (!cliVersion) return; to skip updates gracefully
  • ℹ️ Consider #2 — DECLINED (acceptable): Author declined adding an error path test for syncTemplateDependencies, reasoning that testing natural error propagation from fs-extra doesn't add meaningful value. This is a reasonable judgment call.

Validation

The delta commit is clean:

  • No new bugs or issues introduced
  • Error handling implementation matches the suggested pattern
  • Behavior unchanged for happy path (version sync still works)
  • Graceful degradation for edge cases (CLI continues working even if version detection fails)

✅ APPROVE

Summary: The delta addresses the accepted feedback cleanly. Both the original fixes (template dependency sync, localhost URLs) and the new defensive error handling are correct and well-implemented. Ready to merge.

Note: Unable to formally approve via GitHub API due to permissions. This review recommends approval.

Reviewers (0)
Reviewer Returned Main Findings Consider While You're Here Inline Comments Pending Recs Discarded
Delta review — no subagents dispatched

Note: This is a delta review of a single-commit fix addressing prior feedback. No subagent reviewers were dispatched as the scope is minimal and the prior full review already approved the PR.

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

PR Review Summary

(0) Total Issues | Risk: Low

Delta Review (Re-review after merge with main)

This re-review covers the delta since the last automated review at 51527f2df.

Changes since last review:

Commit Description
8791f58d7 Merge branch 'main' — brought in version bumps (0.50.5 → 0.51.0)
cb76f28b4 E2E test update — aligned test expectations with localhost fix

Delta validation:

E2E test alignment — The E2E test now correctly expects localhost URLs instead of 127.0.0.1:

  • manageApiUrl changed from http://127.0.0.1:3002 to http://localhost:3002
  • Regex in .env verification updated: 127\.0\.0\.1localhost
  • Comment updated to reflect the single "same domain for cookies" rationale (removed stale IPv6/IPv4 comment)

Version bumps from main merge — Routine CHANGELOG.md and package.json updates (0.50.5 → 0.51.0)

This delta is trivial and correctly aligns the E2E test with the implementation changes that were already approved in the prior review.


✅ APPROVE

Summary: Clean delta — the E2E test now matches the localhost implementation fix. The prior full review approved this PR with 0 issues; this delta introduces no new concerns. Ready to merge. 🚀

Note: Unable to formally approve via GitHub API due to permissions. This review recommends approval.

Reviewers (0)
Reviewer Returned Main Findings Consider While You're Here Inline Comments Pending Recs Discarded
Delta review — no subagents dispatched

Note: This is a trivial delta review (test alignment + version bumps from main merge). No subagent reviewers were dispatched as the scope is minimal and the prior full review already approved the PR with 0 issues.

After cloning the template via degit, reads the CLI's own package.json
version and updates all @inkeep/* deps in the template's package.json
to ^{cliVersion}. This prevents version mismatch when the template
hasn't been updated to match the latest CLI release.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@nick-inkeep nick-inkeep force-pushed the fix/sync-template-deps-and-localhost branch from cb76f28 to 0d60b0e Compare February 24, 2026 07:50
@nick-inkeep nick-inkeep changed the title fix(create-agents): sync template deps and use localhost URLs fix(create-agents): sync template deps to CLI version after clone Feb 24, 2026
@nick-inkeep nick-inkeep changed the base branch from main to feat/unify-env-generation February 24, 2026 07:51
@nick-inkeep
Copy link
Copy Markdown
Collaborator Author

Closing in favor of a fresh PR with clean history stacked on #2212.

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

PR Review Summary

(0) Total Issues | Risk: Low

Full-Scope Review

This PR addresses two user-facing issues in the create-agents CLI:

  1. Template dependency sync — After degit clones the template, syncTemplateDependencies() now updates all @inkeep/* dependencies to ^{cliVersion}, ensuring new users get compatible versions.

  2. Localhost URL fix — Changed all generated URLs from 127.0.0.1 to localhost to fix cookie domain mismatch (SameSite=Lax cookies require same origin for auth to work between dashboard on localhost:3000 and API on localhost:3002).

Review Findings

Four specialized reviewers were dispatched:

Reviewer Returned Main Consider Discarded
pr-review-standards 0 0 0 0
pr-review-tests 3 0 0 3
pr-review-consistency 2 0 0 2
pr-review-devops 0 0 0 0
Total 5 0 0 5

All findings were LOW confidence or documented intentional deviations:

  • Test coverage gaps were flagged but are minor edge cases already covered by integration testing documented in the PR
  • Consistency findings noted intentional deviations from inline secret generation (now delegated to setup-dev)

Validation Notes

Error handlinggetCliVersion() has try-catch with graceful fallback (addressed in prior review feedback)

Cookie domain fix — Correct solution for SameSite=Lax cookie behavior

Secret generation — Appropriately delegated to generateSecrets() in setup-dev rather than inline in CLI

Test coverage — 6 new tests for syncTemplateDependencies, 4 for env generation, E2E assertions updated

Changeset — Correctly scoped as patch releases


✅ APPROVE

Summary: Clean implementation fixing two real user-facing issues. The template dependency sync and localhost URL changes are correct and well-tested. Prior review feedback (error handling in getCliVersion()) was addressed. Ready to merge. 🚀

Note: Unable to formally approve via GitHub API due to permissions. This review recommends approval.

Discarded (5)
Location Issue Reason Discarded
utils.test.ts Missing error path test for syncTemplateDependencies Declined by author — standard fs-extra error propagation doesn't need explicit testing
utils.test.ts Missing test for empty CLI version Covered by if (!cliVersion) return guard + documented in PR test plan
utils.test.ts Mock-based tests reduce confidence Integration testing documented in PR description validates real behavior
setup.ts generateSecrets uses placeholder detection Intentional design — allows user customization while generating secure defaults
.env.example Secrets left as placeholders Intentional — setup-dev generates secrets, not the CLI
Reviewers (4)
Reviewer Returned Main Findings Consider While You're Here Inline Comments Pending Recs Discarded
pr-review-standards 0 0 0 0 0 0 0
pr-review-tests 3 0 0 0 0 0 3
pr-review-consistency 2 0 0 0 0 0 2
pr-review-devops 0 0 0 0 0 0 0
Total 5 0 0 0 0 0 5

@github-actions github-actions Bot deleted a comment from claude Bot Feb 24, 2026
@itoqa
Copy link
Copy Markdown

itoqa Bot commented Feb 24, 2026

Ito Test Report ✅

19 test cases ran. 19 passed.

This test run verified the new syncTemplateDependencies feature in @inkeep/create-agents CLI v0.52.0. The feature ensures that @inkeep/* dependencies in scaffolded projects are synced to match the CLI version, preventing cryptic runtime errors from version mismatches. All unit tests, integration tests, and edge case scenarios passed successfully. The CLI correctly scaffolds projects with synced dependencies, handles edge cases gracefully (empty CLI version, missing package.json, no dependencies), and maintains backward compatibility with existing createAgents functionality.

✅ Passed (19)
Test Case Summary Timestamp Screenshot
ROUTE-1 CLI successfully scaffolded project with synced @inkeep/* dependencies at ^0.52.0, non-@inkeep deps preserved 2:09 ROUTE-1_2-09.png
ROUTE-2 Dashboard loads at /default/projects with synced deps, services healthy, no console errors 3:49 ROUTE-2_3-49.png
LOGIC-1 Unit tests confirm both dependencies and devDependencies @inkeep/* entries are updated 6:01 LOGIC-1_6-01.png
LOGIC-2 Verified getCliVersion reads version from CLI package.json using import.meta.url 9:31 LOGIC-2_9-31.png
LOGIC-3 Verified syncTemplateDependencies called at correct position in createAgents flow 9:52 LOGIC-3_9-52.png
EDGE-1 Verified empty CLI version causes early return at line 63 - no deps modified 6:30 EDGE-1_6-30.png
EDGE-2 Verified no package.json causes early return - readJson and writeJson not called 6:47 EDGE-2_6-47.png
EDGE-3 Code analysis confirms no-dependencies guard at line 67 prevents crash 10:31 EDGE-3_10-31.png
EDGE-4 Verified no devDependencies key - only dependencies updated, no crash 7:03 EDGE-4_7-03.png
EDGE-5 Verified zero @inkeep/* deps - file written unchanged with original deps preserved 7:22 EDGE-5_7-22.png
EDGE-6 Code analysis confirms prerelease version string interpolation produces valid semver range 10:51 EDGE-6_10-51.png
EDGE-7 Verified @inkeep/ prefix matching - non-@inkeep packages unchanged while @inkeep/* updated 7:40 EDGE-7_7-40.png
EDGE-8 Verified extra fields preserved - pkg object read whole, only @inkeep/* deps modified 8:01 EDGE-8_8-01.png
ADV-1 Code analysis confirms fs.readJson throws on malformed JSON, caught by error handler 11:09 ADV-1_11-09.png
ADV-2 Code analysis confirms fs.writeJson throws on read-only FS, caught by error handler 11:27 ADV-2_11-27.png
ADV-3 Verified prototype pollution keys handled safely - Object.keys only returns own props 8:28 ADV-3_8-28.png
ADV-4 Verified empty deps object handled gracefully - loop iterates zero times 8:44 ADV-4_8-44.png
UNIT-1 All 26 unit tests passed - syncTemplateDependencies and createAgents tests 5:35 UNIT-1_5-35.png
UNIT-2 All 26 unit tests passed including createAgents regression tests 12:09 UNIT-2_12-09.png
📋 View Recording

Screen Recording

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.

1 participant