Skip to content

Add Project Directories Scanning#6

Open
pdegeeter wants to merge 1 commit into
phartenfeller:masterfrom
pdegeeter:master
Open

Add Project Directories Scanning#6
pdegeeter wants to merge 1 commit into
phartenfeller:masterfrom
pdegeeter:master

Conversation

@pdegeeter

Copy link
Copy Markdown

Summary

Add ability to scan custom directories for projects in addition to VS Code recent workspaces.

Features

  • New projects_directories configuration option accessible via Alfred's "Configure..." menu
  • Scan first-level subdirectories of configured paths as available workspaces
  • Automatic deduplication with VS Code recent workspaces
  • Build script for packaging the workflow

Configuration

  1. Right-click on the workflow → Configure...
  2. Add directories in the Project Directories field (one per line):

~/Projects
~/Work
~/GitHub

Changes

File Description
lib/directory-scanner.mjs New module to scan directories
index.js Integrate scanner and merge results
info.plist Add user configuration UI
build.bash Build script for .alfredworkflow
README.md Document new feature
.gitignore Ignore build artifacts

Copilot AI review requested due to automatic review settings December 27, 2025 10:24

Copilot AI left a comment

Copy link
Copy Markdown

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 adds the ability to scan custom project directories in addition to VS Code's recent workspaces, allowing users to discover projects that haven't been opened in VS Code yet.

Key changes:

  • New directory scanning module that reads subdirectories from configured paths
  • User-configurable "Project Directories" setting accessible via Alfred's Configure menu
  • Automatic deduplication to merge scanned projects with VS Code recent workspaces

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/directory-scanner.mjs New module implementing directory scanning and path expansion logic
index.js Integrates directory scanner with existing workspace fetching and implements deduplication
info.plist Adds user configuration UI for project directories with textarea input
build.bash New build script to package the workflow as .alfredworkflow file
README.md Documents the new Project Directories configuration feature
.gitignore Adds pattern to ignore generated .alfredworkflow files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/directory-scanner.mjs
.filter((entry) => entry.isDirectory() && !entry.name.startsWith('.'))
.map((entry) => {
const fullPath = join(dirPath, entry.name);
const folderUri = `file://${fullPath}`;

Copilot AI Dec 27, 2025

Copy link

Choose a reason for hiding this comment

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

The file URI format is missing the required third slash for absolute paths. The correct format should be file:///${fullPath} (with three slashes) to properly represent an absolute path on Unix-like systems. The current format file://${fullPath} will result in file:///path/to/project being generated as file://path/to/project, which is invalid.

Suggested change
const folderUri = `file://${fullPath}`;
const folderUri = `file:///${fullPath}`;

Copilot uses AI. Check for mistakes.
Comment thread info.plist
@@ -110,6 +110,31 @@ code -n --folder-uri "$1"</string>
<string># Alfred Visual Studio Code Workspace Workflow

For furher details see https://github.com/phartenfeller/alfred-vscode-workspaces</string>

Copilot AI Dec 27, 2025

Copy link

Choose a reason for hiding this comment

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

Spelling error: 'furher' should be 'further'.

Suggested change
For furher details see https://github.com/phartenfeller/alfred-vscode-workspaces</string>
For further details see https://github.com/phartenfeller/alfred-vscode-workspaces</string>

Copilot uses AI. Check for mistakes.
Comment thread build.bash

echo "Done! Created: $WORKFLOW_NAME"

open "$SCRIPT_DIR/$WORKFLOW_NAME"

Copilot AI Dec 27, 2025

Copy link

Choose a reason for hiding this comment

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

The build script automatically opens the generated workflow file at the end, which may not be desirable in all contexts (e.g., CI/CD pipelines or when running multiple builds). Consider making this optional or removing it to avoid unexpected behavior.

Suggested change
open "$SCRIPT_DIR/$WORKFLOW_NAME"
# Optionally open the generated workflow. Set OPEN_WORKFLOW=0 to disable.
if [[ "${OPEN_WORKFLOW:-1}" == "1" ]]; then
open "$SCRIPT_DIR/$WORKFLOW_NAME"
fi

Copilot uses AI. Check for mistakes.
Comment thread lib/directory-scanner.mjs
Comment on lines +11 to +16
function expandHome(filepath) {
if (filepath.startsWith('~/')) {
return join(homedir(), filepath.slice(2));
}
return filepath;
}

Copilot AI Dec 27, 2025

Copy link

Choose a reason for hiding this comment

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

The expandHome function only handles paths starting with '/' but doesn't handle a standalone ''. If a user enters just '' as a directory path, it will not be expanded to the home directory and will be treated as a literal '' directory in the current working directory.

Copilot uses AI. Check for mistakes.
add ability to scan configured directories for projects in addition
to VS Code recent workspaces. includes build script for workflow
packaging and user configuration via Alfred's Configure Workflow.
@phartenfeller

Copy link
Copy Markdown
Owner

Thanks for the contribution @pdegeeter ! Could you elaborate a bit the need of such a feature?
Cause opening a folder once in VS Code should make the current version find the repo.
The only advantage I see is that you have dozens of never opened repositories that you need to find with this alfred workflow.

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.

3 participants