Skip to content

npm resource on web#186

Open
bmdavis419 wants to merge 1 commit intomainfrom
davis/npm-resource-on-web
Open

npm resource on web#186
bmdavis419 wants to merge 1 commit intomainfrom
davis/npm-resource-on-web

Conversation

@bmdavis419
Copy link
Collaborator

@bmdavis419 bmdavis419 commented Feb 14, 2026

Greptile Overview

Greptile Summary

This PR adds npm package support as a new resource type alongside the existing git resources, and removes the sync MCP tool and its associated infrastructure (stripJsonComments, updateResourceInternal, updateProjectModelInternal, btca.remote.schema.json).

  • npm resource support: Users can now add npm packages (e.g., react, @types/node) as documentation resources through the web UI, MCP API, and internal mutations. The schema, validators, config generation, sandbox status detection, and UI have all been updated to handle the npm type discriminated union alongside git.
  • Sync tool removal: The sync MCP tool and related internal mutations have been removed. Documentation (mcp.mdx, btca.spec.md) has been updated accordingly and btca.remote.schema.json has been deleted.
  • Backward compatibility: Schema fields like cachedResources.type are optional, and userResources fields (url, branch, package, version) are optional to support existing data without a migration.
  • Duplicated validation: The npm package validation logic (isValidNpmPackage, NPM_PACKAGE_SEGMENT_REGEX, etc.) is duplicated across mcp.ts, mcpInternal.ts, resources.ts, and the Svelte settings page. Consider extracting into a shared module.
  • No plan md files were found in the repository.

Confidence Score: 4/5

  • This PR is safe to merge with minor cleanup considerations; no breaking changes to existing git resource flows.
  • The changes are well-structured with proper validation, backward-compatible schema changes, and consistent type discrimination. The main concerns are code duplication (style) and a minor inconsistency in when updatePackages is called. No existing features appear broken by these changes.
  • apps/web/src/convex/instances/actions.ts has inconsistent updatePackages gating. apps/web/src/convex/mcpInternal.ts and apps/web/src/convex/resources.ts contain heavily duplicated validation logic.

Important Files Changed

Filename Overview
apps/web/src/convex/schema.ts Schema updated to support npm resources: cachedResources and userResources tables extended with optional type, package, version fields. userResources.type is required (union), cachedResources.type is optional for backward compat.
apps/web/src/convex/mcp.ts Major refactor: removed sync action and stripJsonComments, added npm resource support to addResource and listResources with proper type-specific validation. Contains duplicated npm validation logic.
apps/web/src/convex/mcpInternal.ts Removed updateResourceInternal and updateProjectModelInternal (sync feature removal). Added resolveMcpResourceInput and npm validation logic. addResourceInternal now supports npm type resources.
apps/web/src/convex/resources.ts Major changes to support npm resource type alongside git. Added mapUserResource, mapGlobalResource, split validators into git/npm variants, added resolveAddCustomResourceInput with full validation. Contains duplicated npm validation logic.
apps/web/src/convex/instances/actions.ts Extended resource config types for npm, updated generateBtcaConfig, getResourceConfigs, getSandboxStatus to handle both types. Added conditional updatePackages in provision/wake paths. syncResources missing updatePackages for npm resources.
apps/web/src/routes/api/mcp/+server.ts Updated MCP endpoint: addResource schema now supports npm fields, removed sync tool entirely. Resource type is inferred when not explicitly provided for backward compatibility.
apps/web/src/routes/app/settings/resources/+page.svelte UI updated with type selector (git/npm), conditional form fields, npm package validation, and proper display of npm resources with link to npmjs.com.
apps/web/src/lib/components/InstanceCard.svelte Added npm-aware display for cached resources with isNpmCachedResource and getCachedResourceDetail helpers. Shows git/npm badge per resource.

Last reviewed commit: 5456f0b

Context used:

  • Context from dashboard - AGENTS.md (source)

@bmdavis419 bmdavis419 marked this pull request as ready for review February 14, 2026 04:18
Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

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