march-cli 0.1.32 → 0.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,7 @@ const MANAGED_PACKAGES = {
12
12
  "vscode-json-language-server": ["vscode-langservers-extracted"],
13
13
  "vscode-html-language-server": ["vscode-langservers-extracted"],
14
14
  "vscode-css-language-server": ["vscode-langservers-extracted"],
15
+ "sql-language-server": ["sql-language-server"],
15
16
  "docker-langserver": ["dockerfile-language-server-nodejs"],
16
17
  };
17
18
 
@@ -88,6 +88,14 @@ export function createLspServerDefinitions({ resolveTypeScriptProjectRoot, resol
88
88
  managedCommand: "vscode-json-language-server",
89
89
  args: ["--stdio"],
90
90
  },
91
+ {
92
+ id: "sql",
93
+ extensions: [".sql"],
94
+ rootMarkers: [".sqllsrc.json", ".sqllsrc", "package.json", ".git"],
95
+ command: ["sql-language-server"],
96
+ managedCommand: "sql-language-server",
97
+ args: ["up", "--method", "stdio"],
98
+ },
91
99
  {
92
100
  id: "html",
93
101
  extensions: [".html", ".htm"],
package/src/main.mjs CHANGED
@@ -38,7 +38,8 @@ import { installNetworkEnvironment } from "./network/environment.mjs";
38
38
  import { runMemoryCommand } from "./memory/command.mjs";
39
39
  import { normalizeRemoteMemorySources } from "./memory/remote/config.mjs";
40
40
  import { resolveMemoryRoot } from "./memory/root.mjs";
41
- import { runBrowserCommand } from "./browser/cli/command.mjs";
41
+ import { runConfiguredCliCommand } from "./cli/startup/configured-command.mjs";
42
+ import { maybeRunGatewayDaemonCommand } from "./cli/startup/gateway-daemon-command.mjs";
42
43
  import { ensureBrowserDaemon } from "./browser/client/lifecycle.mjs";
43
44
  export async function run(argv) {
44
45
  const cwd = process.cwd();
@@ -77,14 +78,8 @@ export async function run(argv) {
77
78
  args.memoryRoot = resolveMemoryRoot(config.memoryRoot, stateRoot);
78
79
  return await runMemoryCommand(args, { homeDir: homedir() });
79
80
  }
80
- if (args.command?.name === "browser") {
81
- try {
82
- return await runBrowserCommand(args, { stateRoot });
83
- } catch (err) {
84
- process.stderr.write(`Error: ${err.message}\n`);
85
- return 1;
86
- }
87
- }
81
+ const configuredCommand = await runConfiguredCliCommand(args, { config, cwd, stateRoot });
82
+ if (configuredCommand.handled) return configuredCommand.code;
88
83
  if (!existsSync(stateRoot)) mkdirSync(stateRoot, { recursive: true });
89
84
  await ensureBrowserDaemon({ stateRoot }).catch(() => {});
90
85
  const logger = createLogger({ logDir: join(stateRoot, "logs") });
@@ -243,6 +238,8 @@ export async function run(argv) {
243
238
  ui,
244
239
  });
245
240
  refreshStatusBar();
241
+ const gatewayDaemonCommand = await maybeRunGatewayDaemonCommand(args, { config, cwd, runner, currentProject, memoryStore, ui, logger });
242
+ if (gatewayDaemonCommand.handled) return gatewayDaemonCommand.code;
246
243
 
247
244
  if (args.prompt) {
248
245
  turnRunning = true;
@@ -1,9 +1,9 @@
1
1
  import { spawn } from "node:child_process";
2
2
 
3
- export function openFileWithDefaultApp(filePath) {
3
+ export function openFileWithDefaultApp(filePath, { spawnFn = spawn } = {}) {
4
4
  return new Promise((resolve, reject) => {
5
- const { command, args } = openCommand(filePath);
6
- const child = spawn(command, args, { detached: true, stdio: "ignore" });
5
+ const { command, args, options } = openCommand(filePath);
6
+ const child = spawnFn(command, args, { ...options, detached: true, stdio: "ignore" });
7
7
  child.once("error", reject);
8
8
  child.once("spawn", () => {
9
9
  child.unref();
@@ -12,15 +12,14 @@ export function openFileWithDefaultApp(filePath) {
12
12
  });
13
13
  }
14
14
 
15
- function openCommand(filePath) {
16
- if (process.platform === "win32") {
17
- return {
18
- command: "powershell.exe",
19
- args: ["-NoProfile", "-Command", "Start-Process -LiteralPath $args[0]", filePath],
20
- };
15
+ export function openCommand(filePath, { platform = process.platform } = {}) {
16
+ if (platform === "win32") {
17
+ // cmd.exe start delegates to the user's shell association more reliably than
18
+ // PowerShell Start-Process for media files on Windows.
19
+ return { command: "cmd.exe", args: ["/c", "start", "", filePath] };
21
20
  }
22
21
 
23
- if (process.platform === "darwin") {
22
+ if (platform === "darwin") {
24
23
  return { command: "open", args: [filePath] };
25
24
  }
26
25