Skip to content

feat(bft): Bun File Trace for node:fs / Bun.file() assets in agent builds#213

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/add-nft-bft-support-xyz-21
Draft

feat(bft): Bun File Trace for node:fs / Bun.file() assets in agent builds#213
Copilot wants to merge 3 commits into
mainfrom
copilot/add-nft-bft-support-xyz-21

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 25, 2026

Bun.build() has no awareness of files accessed at runtime via node:fs or Bun.file() — those calls survive in the bundle verbatim, but the referenced files are never copied to the output. This is the same gap Node File Trace (NFT) fills for Node.js deployments.

What changed

packages/aixyz-config — two new build fields

Mirrors Next.js outputFileTracingIncludes / outputFileTracingExcludes. Accepts string | string[], defaults to [].

// aixyz.config.ts
export default {
  build: {
    // Auto-traced (literal readFileSync/Bun.file paths) needs no config.
    // Use these only for files discovered dynamically, e.g. via readdirSync:
    outputFileTracingIncludes: ["prompts/**", "data/*.db"],
    outputFileTracingExcludes: ["data/dev-*"],
  },
} satisfies AixyzConfig;

packages/aixyz-cli/build/nft.ts — new Bun File Trace (BFT) module

Export Behaviour
traceFileSystemAssets(appDir, cwd) Regex-scans every source file in app/ for literal-string arguments to readFileSync, readFile, createReadStream, existsSync, statSync, Bun.file(). Resolves paths against both CWD (most common) and import.meta.dir. Returns absolute paths of non-code files that exist on disk.
copyTracedFiles(files, cwd, outputDir) Copies auto-traced files into the output, preserving CWD-relative paths.
copyAppAssets(appDir, outputDir, includes, excludes) Manual-override sweep driven by outputFileTracingIncludes / outputFileTracingExcludes. No-op by default.

packages/aixyz-cli/build/index.ts

Both buildBun and buildVercel run all three BFT steps after Bun.build() succeeds. Auto-tracing always runs; the config-driven sweep is opt-in.

packages/aixyz-cli/build/nft.test.ts

13 tests covering: literal-path detection (readFileSync, Bun.file()), template-literal/variable path skipping, absolute-path rejection, code-file exclusion, outputFileTracingExcludes precedence, and the empty-includes no-op default.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • nextjs.org
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@linear
Copy link
Copy Markdown

linear Bot commented Feb 25, 2026

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Feb 25, 2026

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

Project Deployment Actions Updated (UTC)
agent-boilerplate Ready Ready Preview, Comment Feb 25, 2026 0:46am
agent-chainlink Ready Ready Preview, Comment Feb 25, 2026 0:46am
agent-job-hunter Ready Ready Preview, Comment Feb 25, 2026 0:46am
agent-price-oracle Ready Ready Preview, Comment Feb 25, 2026 0:46am
agent-travel Ready Ready Preview, Comment Feb 25, 2026 0:46am
agent-with-custom-server Ready Ready Preview, Comment Feb 25, 2026 0:46am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ai-xyz.dev Ignored Ignored Feb 25, 2026 0:46am

Request Review

Co-authored-by: fuxingloh <4266087+fuxingloh@users.noreply.github.com>
Co-authored-by: fuxingloh <4266087+fuxingloh@users.noreply.github.com>
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