Skip to content

fix: remove CLI ambient .d.ts append for Vite/Bun - #1706

Merged
yamcodes merged 3 commits into
devfrom
1699-remove-cli-ambient-dts-append-for-vitebun-importmetaenvaugmented-processenvaugmented
Aug 29, 2026
Merged

yamcodes merged 3 commits into
devfrom
1699-remove-cli-ambient-dts-append-for-vitebun-importmetaenvaugmented-processenvaugmented

Conversation

@yamcodes

Copy link
Copy Markdown
Owner

Fixes #1699

Summary

  • Delete dead safeAppend ambient injection pipeline, templates (ImportMetaEnvAugmented / ProcessEnvAugmented), and unused scaffolding options (envDtsHandling, installTypeDefinitions).
  • Vite and Bun scaffolding now exclusively plans env.ts + framework configurations without emitting ambient .d.ts augmentations.
  • Add changeset for @arkenv/cli.

@yamcodes yamcodes added enhancement New feature or improvement refactor A change to the codebase that's neither a bug fix nor added functionality labels Aug 29, 2026
@changeset-bot

changeset-bot Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e1d22b9

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

This PR includes changesets to release 2 packages
Name Type
@arkenv/nuxt Patch
@arkenv/cli 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

@github-actions github-actions Bot added docs Adds or changes documentation, or acts as documentation in and of itself tests This issue or PR is about adding, removing or changing tests @arkenv/cli Issues or Pull Requests involving the ArkEnv CLI @arkenv/nuxt Issues or Pull Requests involving the Nuxt integration for ArkEnv labels Aug 29, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

arkenv

npm i https://pkg.pr.new/arkenv@1706

@arkenv/build

npm i https://pkg.pr.new/@arkenv/build@1706

@arkenv/bun-plugin

npm i https://pkg.pr.new/@arkenv/bun-plugin@1706

@arkenv/cli

npm i https://pkg.pr.new/@arkenv/cli@1706

@arkenv/fumadocs-ui

npm i https://pkg.pr.new/@arkenv/fumadocs-ui@1706

@arkenv/nextjs

npm i https://pkg.pr.new/@arkenv/nextjs@1706

@arkenv/nuxt

npm i https://pkg.pr.new/@arkenv/nuxt@1706

@arkenv/vite-plugin

npm i https://pkg.pr.new/@arkenv/vite-plugin@1706

commit: e1d22b9

@arkenv-bot

arkenv-bot Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

No results found

✅ All size limits passed!

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ Minor suggestions only — the dead-pipeline removal is clean, well-tested, and matches the issue's intent. A few small cleanups and scope/accuracy notes inline and below.

Reviewed changes — fix: remove CLI ambient .d.ts append for Vite/Bun, single commit 54c48f64 against dev.

  • Dead pipeline removal — safeAppend (adapters/injection.ts + its test) and the viteTypesTemplate / bunTypesTemplate templates (templates/types.ts) are deleted, along with the adapters/index.ts re-export; no references remain anywhere.
  • Scaffold option cleanup — envDtsHandling, installTypeDefinitions, and hasTypeFileAtPath are removed from ProjectOptions, the wizard, the prompt steps, PromptPort, and InitUseCase.
  • Planner / executor — the "Type Definitions" planning section is dropped, "append" is removed from files[].action, the executor's append branch and "types" file reporting are gone, and WorkspacePort.safeAppend / NodeWorkspace.safeAppend are deleted.
  • Next-steps copy — Vite/Bun users are now directed to import { env } from "./env" instead of native import.meta.env / process.env access, matching the generic nuxt/vanilla treatment.
  • Tests + changeset — planner tests assert no ambient files are planned, a new CLI smoke test verifies end-to-end behavior, and a @arkenv/cli patch changeset is added.
  • Drive-by — @arkenv/nuxt's peer dependency is widened; see the scope note below.

ℹ️ Leftover vite-env.d.ts / bun-env.d.ts probe in init.ts

The PR removes the ambient-dts path end-to-end, but packages/cli/src/cli/commands/init.ts:408-420 still computes typeFileName for vite/bun-fullstack and pushes the type-file path into existingFiles. No planner branch consults those entries anymore (only the shared/client/server schema paths, the env schema, .env, .env.example, and .gitignore are read from existingFiles), so this is now dead code that survives the removal. It sits outside any diff hunk, so I can't anchor it inline.

Technical details
# Remove leftover type-file probe

## Affected sites
- packages/cli/src/cli/commands/init.ts:408 — `typeFileName` branch for `vite` / `bun-fullstack`
- packages/cli/src/cli/commands/init.ts:415 — `if (typeFileName)` block pushing the path into `existingFiles`

## Required outcome
- `collectExistingProject` no longer probes for `vite-env.d.ts` / `bun-env.d.ts`, since nothing plans against them.

## Suggested approach
- Delete the `typeFileName` block (init.ts:408-420).

ℹ️ Unrelated @arkenv/nuxt peer-dependency widening

packages/nuxt/package.json widens the nuxt peer range from "^3.21.7 ^3.21.7" to "^3.0.0 || ^4.0.0-0", which is unrelated to the ambient-dts removal. The old range is functionally ^3.21.7 (space-separated ranges intersect), so this is not a syntax cleanup — it's a real release-semantics claim that @arkenv/nuxt supports Nuxt 3.0+ and Nuxt 4 (including pre-releases), with no testing, no changeset, and no mention in the PR body or commit. If intentional, it deserves its own changeset (@arkenv/nuxt); if accidental, splitting it out keeps this PR's release narration accurate.

Technical details
# Split out or justify the @arkenv/nuxt peer widening

## Affected sites
- packages/nuxt/package.json:32 — `peerDependencies.nuxt` → `"^3.0.0 || ^4.0.0-0"`

## Required outcome
- The peer widening lands with a matching changeset and a stated reason, or is excluded from this PR.

## Open questions for the human
- Is `@arkenv/nuxt` actually verified against Nuxt < 3.21 and Nuxt 4.x?
- Is there a companion change that removes the plugin ambient types (which would make the changeset's "no longer exist" framing accurate on `dev`)?

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread packages/cli/src/smoke.test.ts Resolved
@yamcodes

Copy link
Copy Markdown
Owner Author

Addressed review feedback:

  • Removed leftover vite-env.d.ts / bun-env.d.ts probe in packages/cli/src/cli/commands/init.ts.
  • Split smoke tests into dedicated Vite and Bun scaffolding test cases.
  • Refined .changeset/remove-cli-ambient-dts-append.md wording regarding ambient accessor typing.
  • Added .changeset/fix-nuxt-peer-dependencies.md documenting the @arkenv/nuxt peer dependency correction (^3.21.7 || ^4.0.0-0).

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — the follow-up cleanly retires the leftover dead probe, justifies the Nuxt peer widening with its own changeset, and rewords the CLI changeset accurately. One new test still doesn't exercise the branch it claims to guard; the fix is a small fixture tweak.

Reviewed changes — the delta since the prior review (commit 54c48f64 → 5fa911d, refactor(cli): address code review feedback).

  • Dead probe removed — the leftover typeFileName / vite-env.d.ts / bun-env.d.ts block in InitUseCase.collectExistingProject is deleted, so existingFiles now holds only paths the planner actually reads.
  • Smoke tests split — the Vite-and-Bun test is now two cases with finally clean-up each; the Vite case genuinely exercises the vite detection path.
  • Nuxt peer widening justified — a dedicated .changeset/fix-nuxt-peer-dependencies.md was added and the range narrowed to "^3.21.7 || ^4.0.0-0", matching the changeset's stated claim.
  • Changeset wording fixed — remove-cli-ambient-dts-append.md now says ambient accessor typing is being retired in scaffolded projects, which is accurate on dev (the Vite/Bun plugin helpers and docs still exist).

ℹ️ Bun smoke test doesn't exercise the bun-fullstack path

The new Bun case's fixture can never trigger bun-fullstack detection. detectFramework returns vanilla / [] for a project whose bunfig.toml is a bare comment and whose package.json only lists @types/bun (verified by running the detector against the fixture: { framework: "vanilla", features: [] } — there are no [serve]/[build] bunfig sections and no .ts/.js source files for detectBunFeatures to scan). The scaffold therefore never enters the bun-fullstack planning/bootstrap path, so expect(bunEnvExists).toBe(false) passes trivially no matter what — it would even pass if the ambient-dts append for Bun were reintroduced. Genuine Bun coverage still lives at the planner unit level (planner.test.ts asserts bun-env.d.ts is not planned for bun-fullstack), so there's no behavioral regression risk, but the smoke test is currently theatre.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread packages/cli/src/smoke.test.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found — the incremental change is a clean, verified fix that retires the last open thread from the prior review.

Reviewed changes — the delta since the prior review (commit 5fa911d → e1d22b9, test(cli): configure Bun smoke test fixture with [serve] in bunfig.toml).

  • Bun smoke fixture made genuine — the fixture's bunfig.toml now carries a [serve] section, so detectBunFeatures returns ["serve"] and detectFramework resolves to bun-fullstack (I verified this by running the detector against the exact fixture — it returns { features: ["serve"], framework: "bun-fullstack" }, and the full 11-test smoke suite passes). The bun-env.d.ts absence assertion can now genuinely fail if the ambient-dts append were ever reintroduced.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@yamcodes
yamcodes merged commit c4414ce into dev Aug 29, 2026
21 checks passed
@yamcodes
yamcodes deleted the 1699-remove-cli-ambient-dts-append-for-vitebun-importmetaenvaugmented-processenvaugmented branch August 29, 2026 16:22
@arkenv-bot arkenv-bot Bot mentioned this pull request Aug 29, 2026
yamcodes added a commit that referenced this pull request Aug 29, 2026
Reverts #1706 because the ambient .d.ts pipeline is actively used on the
v0 `dev` branch (issue #1699 is a v1-only task).
yamcodes pushed a commit that referenced this pull request Aug 29, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to dev, this PR will
be updated.


# Releases
## @arkenv/[email protected]

### Patch Changes

- #### Fix `nuxt` peer dependency range to support Nuxt 3 and Nuxt 4
_[`#1706`](#1706)
[`c4414ce`](c4414ce)
[@yamcodes](https://github.com/yamcodes)_

	
Update the `peerDependencies` range for `nuxt` to `"^3.21.7 ||
^4.0.0-0"` to support both Nuxt 3 (>=3.21.7) and Nuxt 4 development
dependencies.

Co-authored-by: arkenv-bot[bot] <237618717+arkenv-bot[bot]@users.noreply.github.com>
renovate Bot added a commit that referenced this pull request Sep 3, 2026
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [@arkenv/nuxt](https://arkenv.js.org)
([source](https://redirect.github.com/yamcodes/arkenv)) | [`0.1.1` →
`0.1.2`](https://renovatebot.com/diffs/npm/@arkenv%2fnuxt/0.1.1/0.1.2) |
![age](https://developer.mend.io/api/mc/badges/age/npm/@arkenv%2fnuxt/0.1.2?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@arkenv%2fnuxt/0.1.1/0.1.2?slim=true)
|

---

### Release Notes

<details>
<summary>yamcodes/arkenv (@&#8203;arkenv/nuxt)</summary>

###
[`v0.1.2`](https://redirect.github.com/yamcodes/arkenv/releases/tag/%40arkenv/nuxt%400.1.2)

[Compare
Source](https://redirect.github.com/yamcodes/arkenv/compare/@arkenv/[email protected]...@arkenv/[email protected])

##### Patch Changes

- #### Fix `nuxt` peer dependency range to support Nuxt 3 and Nuxt 4
*[`#1706`](https://redirect.github.com/yamcodes/arkenv/pull/1706)
[`c4414ce`](https://redirect.github.com/yamcodes/arkenv/commit/c4414ce060407ecd22785adc217f80887621ff05)
[@&#8203;yamcodes](https://redirect.github.com/yamcodes)*

Update the `peerDependencies` range for `nuxt` to `"^3.21.7 ||
^4.0.0-0"` to support both Nuxt 3 (>=3.21.7) and Nuxt 4 development
dependencies.

</details>

---

### Configuration

📅 **Schedule**: (in timezone Asia/Almaty)

- Branch creation
  - "on friday"
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/yamcodes/arkenv).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC42MS4zIiwidXBkYXRlZEluVmVyIjoiNDQuNjEuMyIsInRhcmdldEJyYW5jaCI6ImRldiIsImxhYmVscyI6W119-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: arkenv-bot[bot] <237618717+arkenv-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/cli Issues or Pull Requests involving the ArkEnv CLI @arkenv/nuxt Issues or Pull Requests involving the Nuxt integration for ArkEnv docs Adds or changes documentation, or acts as documentation in and of itself enhancement New feature or improvement refactor A change to the codebase that's neither a bug fix nor added functionality tests This issue or PR is about adding, removing or changing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove CLI ambient .d.ts append for Vite/Bun (ImportMetaEnvAugmented / ProcessEnvAugmented)

1 participant