Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR promotes IDE configuration from a one-off --vscode init flag to a dedicated interactive command (powersync configure ide) that can be run at any time, and removes the old VSCode-specific helper/flag plumbing from the init flows.
Changes:
- Added
powersync configure idecommand with an IDE configurator registry (currently VSCode). - Implemented VSCode configurator to merge
yaml.customTagsinto.vscode/settings.jsonand prepend yaml-language-server schema comments to known config files. - Removed
--vscodefrompowersync init cloud/powersync init self-hosted, and updated init output/docs to point users to the new command.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| cli/src/commands/init/self-hosted.ts | Removes --vscode flag usage and prints a tip for powersync configure ide. |
| cli/src/commands/init/cloud.ts | Removes --vscode flag usage and prints a tip for powersync configure ide. |
| cli/src/commands/configure/index.ts | Adds a (hidden) configure command entrypoint directing users to subcommands. |
| cli/src/commands/configure/ide.ts | Adds interactive configure ide command, workspace scan, and configurator dispatch. |
| cli/src/api/write-vscode-settings-for-yaml-env.ts | Deletes old VSCode settings writer helper. |
| cli/src/api/ide/configure-vscode-ide.ts | Adds VSCode IDE configurator: settings merge + schema comment patching + guidance output. |
| cli/README.md | Documents configure ide and removes --vscode from init command docs. |
Comments suppressed due to low confidence (3)
cli/src/commands/configure/ide.ts:38
findLinkedProjectDirsonly inspects immediate subdirectories ofcwd, so runningpowersync configure idefrom inside an existing PowerSync project (wherecli.yamlis in the current directory) will produceprojectDirs = []and skip patchingservice.yaml/sync-config.yaml/cli.yamlin that project. Consider first checking whethercwd/cli.yamlis a valid PowerSync project and includingcwdin the returned list (in addition to scanning subdirectories).
/**
* Scans the current working directory for subdirectories that contain a valid
* PowerSync cli.yaml. Returns their absolute paths.
*/
function findLinkedProjectDirs(cwd: string): string[] {
const projectDirs: string[] = [];
for (const entry of readdirSync(cwd)) {
const entryPath = join(cwd, entry);
try {
if (!statSync(entryPath).isDirectory()) continue;
} catch {
continue;
}
try {
const doc = parseYamlFile(join(entryPath, CLI_FILENAME));
CLIConfig.decode(doc.contents?.toJSON());
projectDirs.push(entryPath);
} catch {
// Not a valid PowerSync project — skip.
}
}
return projectDirs;
cli/src/commands/configure/ide.ts:66
- This command always prompts via
@inquirer/promptswithout a non-interactive fallback. In non-TTY contexts (CI, redirected stdin) inquirer prompts typically throw or hang; other commands in this repo guard prompts withprocess.stdin.isTTY. Consider adding a--ideflag (e.g.--ide=vscode) or, at minimum, detect!process.stdin.isTTYand print an actionable message / exit cleanly instead of prompting.
const ide = await select({
choices: [
{ name: 'VSCode', value: 'vscode' },
{ name: 'Exit', value: 'exit' }
],
message: 'Select your IDE to configure (only VSCode is supported for now):'
});
if (ide === 'exit') return;
const projectDirs = findLinkedProjectDirs(process.cwd());
const configurator = IDE_CONFIGURATORS[ide];
configurator(process.cwd(), projectDirs, (msg) => this.log(msg));
cli/src/api/ide/configure-vscode-ide.ts:53
settings['yaml.customTags']is assumed to be astring[]via a cast. If the user has an unexpected type in settings.json (e.g. a string or object), spreading it intonew Set([...currentTags, ...VSCODE_YAML_TAGS])can behave incorrectly (e.g. string becomes characters). Consider validating that the existing value is an array of strings before merging, and otherwise default to[](or log that the existing value was ignored).
let settings: Record<string, unknown> = {};
if (existsSync(settingsPath)) {
try {
const raw = readFileSync(settingsPath, 'utf8');
settings = JSON.parse(raw) as Record<string, unknown>;
} catch {
// If invalid JSON, overwrite with our settings.
}
}
const currentTags = (settings['yaml.customTags'] ?? []) as string[];
settings['yaml.customTags'] = [...new Set([...currentTags, ...VSCODE_YAML_TAGS])];
mkdirSync(vscodeDir, { recursive: true });
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf8');
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Chriztiaan
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, IDE configuration was tucked away as a
--vscodeflag on theinit cloudandinit self-hostedcommands. When a user scaffolded a new project they could optionally pass--vscodeto have the CLI write a.vscode/settings.jsonthat taught the YAML language server about the!envcustom tag. It worked, but it was narrow: a one-shot flag buried in the scaffolding flow, only reachable at project creation time, and only aware of VSCode. If a user skipped it, or wanted to re-run it later, or used a different editor, there was no good path forward.This PR improves IDE configuration. IDE configuration is promoted to a first-class, named command:
powersync configure ide. Running it starts an interactive prompt that asks which IDE you are using, then applies the right configuration for that editor. For VSCode today, that means mergingyaml.customTagsinto.vscode/settings.json, scanning the workspace for known PowerSync config files, and prependingyaml-language-serverschema comments to any that are missing them — so schema validation and autocompletion light up immediately. It also prints a summary of what changed and recommends installing the Red Hat YAML extension.Because the configurator for each IDE is registered as a simple function behind an
IdeConfiguratortype, adding support for other editors in the future is a matter of writing a new function and dropping it into the registry, no changes to the command itself required.The
--vscodeflag has been removed from bothinitcommands, and the oldwrite-vscode-settings-for-yaml-envhelper is deleted. In their place, theinitoutput now surfaces a tip pointing users topowersync configure ide.