Skip to content

chore(utils): Extract project helpers into new @vltpkg/project workspace#1512

Open
ruyadorno wants to merge 3 commits into
mainfrom
ruyadorno/move-project-helpers-to-srcproject
Open

chore(utils): Extract project helpers into new @vltpkg/project workspace#1512
ruyadorno wants to merge 3 commits into
mainfrom
ruyadorno/move-project-helpers-to-srcproject

Conversation

@ruyadorno

Copy link
Copy Markdown
Member

Summary

  • Introduced the @vltpkg/project workspace with copied configs, README, and tests mirroring src/server to host getProjectDat, readProjectFolders, and reloadConfig
  • Updated existing references in src/server and src/cli-sdk to rely on the new workspace exports

Testing

  • Not run (not requested)

@vercel

vercel Bot commented Mar 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Mar 3, 2026 9:36pm

Request Review

Copilot AI 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.

Pull request overview

This PR extracts “project” helper functionality (project discovery, project metadata derivation, and config reload) into a new @vltpkg/project workspace, and updates @vltpkg/cli-sdk / @vltpkg/server call sites to use the new implementation.

Changes:

  • Added new src/project workspace exporting getProjectData, readProjectFolders, and reloadConfig, plus TAP tests.
  • Updated @vltpkg/cli-sdk host-context querying to import helpers from @vltpkg/project instead of @vltpkg/server.
  • Updated @vltpkg/server to re-export/use the extracted helpers.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/server/src/read-project-folders.ts Re-exports readProjectFolders from the new project workspace.
src/server/src/graph-data.ts Switches project metadata collection to getProjectData from the new project workspace.
src/server/src/config-data.ts Re-exports reloadConfig from the new project workspace.
src/project/vlt.json Adds workspace config stub.
src/project/typedoc.mjs Adds typedoc workspace config wiring.
src/project/tsconfig.test.json Adds test tsconfig for the new workspace.
src/project/tsconfig.publish.json Adds publish/build tsconfig for new workspace.
src/project/tsconfig.json Adds base tsconfig extending repo defaults.
src/project/test/reload-config.ts Adds unit test coverage for reloadConfig.
src/project/test/read-project-folders.ts Adds unit test coverage for folder discovery behavior and edge cases.
src/project/test/get-project-data.ts Adds unit test coverage for project metadata/tool inference.
src/project/src/reload-config.ts Implements config cache unloading + Config.load() wrapper.
src/project/src/read-project-folders.ts Implements recursive discovery of candidate project folders.
src/project/src/index.ts Public exports for @vltpkg/project.
src/project/src/ignored-homedir-folder-names.ts Adds ignored-home-folder list for discovery filtering.
src/project/src/get-project-data.ts Implements project metadata derivation (tools + vlt install detection).
src/project/package.json New workspace package definition and exports.
src/project/README.md New workspace documentation and usage example.
src/project/LICENSE New workspace license file.
src/cli-sdk/test/query-host-contexts.ts Updates mocks to use @vltpkg/project instead of @vltpkg/server.
src/cli-sdk/src/query-host-contexts.ts Switches helper imports to @vltpkg/project; adds casts around reloadConfig() results.
src/cli-sdk/package.json Replaces @vltpkg/server dependency with @vltpkg/project.
Comments suppressed due to low confidence (2)

src/project/test/read-project-folders.ts:23

  • Typo in fixture data strings: “becasue” → “because”. Even in tests, keeping strings readable helps avoid confusion when snapshots/assertions fail.
                    'package.json': JSON.stringify({
                      name: 'becasue it is not too deep',
                    }),
                  },
                  _7: {
                    ignoreme: {
                      'package.json': JSON.stringify({
                        name: 'becasue it is too deep',
                      }),
                    },

src/project/test/read-project-folders.ts:66

  • Typo in fixture data string: “becasue” → “because”.
        ignoreme: {
          'package.json': JSON.stringify({
            name: 'becasue it is in a dot folder',
          }),
        },

Comment thread src/cli-sdk/src/query-host-contexts.ts Outdated
Comment thread src/server/src/read-project-folders.ts Outdated
Comment thread src/server/src/config-data.ts Outdated
Comment thread src/cli-sdk/src/query-host-contexts.ts Outdated
Comment thread src/project/src/reload-config.ts Outdated
Comment thread src/server/src/graph-data.ts Outdated
Comment on lines 12 to 15
export type GraphProjectData = {
tools: ProjectTools[]
tools: string[]
vltInstalled: boolean
}

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

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

GraphProjectData.tools is widened from a specific union type to string[], which weakens the public API and loses type-safety for downstream consumers. Consider importing type ProjectTool from @vltpkg/project and using ProjectTool[] here to preserve the previous contract.

Copilot uses AI. Check for mistakes.
@ruyadorno

Copy link
Copy Markdown
Member Author

@cursoragent please help me fix the validation in this PR and address the outstanding review comments

@cursor

cursor Bot commented Mar 2, 2026

Copy link
Copy Markdown

I've successfully addressed all the outstanding review comments and pushed the fixes to the PR. Here's what I fixed:

Import Path Issues (3 files)

  • Changed src/server files to import from @vltpkg/project instead of using relative paths (../../project/src/)
  • Added @vltpkg/project as a dependency in src/server/package.json

Type Safety Improvements

  • Added explicit Promise<LoadedConfig> return type to reloadConfig() function
  • Removed unsafe as unknown as LoadedConfig type casts in query-host-contexts.ts
  • Fixed GraphProjectData.tools type from string[] to ProjectTool[] to preserve type safety

Minor Fixes

  • Fixed typos in test fixtures: "becasue" → "because" (3 occurrences)

All changes have been committed and pushed. The CI will now validate these changes. The fixes ensure that the package imports will work correctly when built and published, and the type system will properly validate the code without requiring unsafe casts.

Open in Web Open in Cursor 

cursoragent and others added 2 commits March 2, 2026 22:25
- Replace relative imports (../../project/src/) with package imports (@vltpkg/project)
- Add explicit Promise<LoadedConfig> return type to reloadConfig
- Remove unsafe 'as unknown as LoadedConfig' type casts
- Fix GraphProjectData.tools type from string[] to ProjectTool[]
- Add @vltpkg/project dependency to @vltpkg/server
- Fix typos in test fixtures: 'becasue' → 'because'

Co-authored-by: Ruy Adorno <[email protected]>
@darcyclarke darcyclarke changed the title Extract project helpers into new @vltpkg/project workspace chore(utils): Extract project helpers into new @vltpkg/project workspace Mar 3, 2026
@darcyclarke darcyclarke added the cli cli specific issues label May 7, 2026
@darcyclarke darcyclarke self-assigned this May 7, 2026
@darcyclarke darcyclarke added the Release 1.0.0 related to/blocker of the v1.0.0 release label May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli cli specific issues needs-further-review Release 1.0.0 related to/blocker of the v1.0.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants