Skip to content

fix: hoist fs/path requires to top-level imports in chat-webview-provider - #729

Merged
will-lamerton merged 1 commit into
Nano-Collective:mainfrom
DeepamJha:fix/inline-requires
Aug 2, 2026
Merged

will-lamerton merged 1 commit into
Nano-Collective:mainfrom
DeepamJha:fix/inline-requires

Conversation

@DeepamJha

Copy link
Copy Markdown
Contributor

Closes #724

Description

Hoists require('fs') and require('path') out of _getHtmlForWebview
in plugins/vscode/src/chat-webview-provider.ts into top-level ES module
imports, matching the existing import style in the file. No runtime
behavior change — purely a maintainability cleanup as described in #724.

Note: on current main, this file doesn't have separate
requestPathInfo/requestOpenDialog handlers as mentioned in the issue —
_getHtmlForWebview is the only place with the duplicated inline
require() calls, so that's the single location fixed here.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

This is an internal chore (no user-facing behavior change), so I ran
pnpm changeset --empty instead of a real changeset.

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

(No new tests added — this is a non-functional refactor of an existing
code path with no behavior change, so no new .spec.ts coverage applies.)

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

(N/A — change is isolated to webview HTML loading, unrelated to provider/model integration.)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see CONTRIBUTING.md#logging)

(No logging changes needed — this touches only import statements, not runtime logic.)

@github-actions

Copy link
Copy Markdown
Contributor

No changeset found

This PR does not add a changeset, so it will not appear in the changelog or trigger a release.

If the change is user-facing, add one:

pnpm changeset

Pick a bump (patch / minor / major) and write the changelog entry in our usual voice ("Added X... Thanks to @you. Closes #123."), then commit the generated .changeset/*.md file.

If this PR is docs-only or a chore that needs no release note, you can ignore this - or run pnpm changeset --empty to record that intentionally.

@A-S-Manoj A-S-Manoj 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.

Verified against main, _getHtmlForWebview in chat-webview-provider.ts was the only spot in the repo with inline require('fs')/require('path') calls, and this PR hoists both to top-level imports correctly with no remaining inline requires anywhere else in the codebase. Scope matches #724 exactly, no unrelated changes. LGTM, approving.

@will-lamerton

Copy link
Copy Markdown
Member

@will-lamerton
will-lamerton merged commit dafa58e into Nano-Collective:main Aug 2, 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.

[Bug] Inline require() calls inside file attachment handlers

3 participants