@openvcs/sdk 0.2.7 → 0.2.9

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.
package/lib/build.d.ts CHANGED
@@ -12,6 +12,8 @@ export interface ManifestInfo {
12
12
  }
13
13
  /** Returns the npm executable name for the current platform. */
14
14
  export declare function npmExecutable(): string;
15
+ /** Returns whether a command must be launched via the Windows shell. */
16
+ export declare function shouldUseWindowsShell(program: string): boolean;
15
17
  /** Formats help text for the build command. */
16
18
  export declare function buildUsage(commandName?: string): string;
17
19
  /** Parses `openvcs build` arguments. */
package/lib/build.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // SPDX-License-Identifier: GPL-3.0-or-later
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.npmExecutable = npmExecutable;
6
+ exports.shouldUseWindowsShell = shouldUseWindowsShell;
6
7
  exports.buildUsage = buildUsage;
7
8
  exports.parseBuildArgs = parseBuildArgs;
8
9
  exports.readManifest = readManifest;
@@ -21,7 +22,15 @@ const fs_utils_1 = require("./fs-utils");
21
22
  const AUTHORED_PLUGIN_MODULE_BASENAME = "plugin.js";
22
23
  /** Returns the npm executable name for the current platform. */
23
24
  function npmExecutable() {
24
- return process.platform === "win32" ? "npm.cmd" : "npm";
25
+ return "npm";
26
+ }
27
+ /** Returns whether a command must be launched via the Windows shell. */
28
+ function shouldUseWindowsShell(program) {
29
+ if (process.platform !== "win32") {
30
+ return false;
31
+ }
32
+ const normalized = program.toLowerCase();
33
+ return normalized === "npm" || normalized.endsWith(".cmd") || normalized.endsWith(".bat");
25
34
  }
26
35
  /** Formats help text for the build command. */
27
36
  function buildUsage(commandName = "openvcs") {
@@ -216,6 +225,7 @@ function runCommand(program, args, cwd, verbose) {
216
225
  }
217
226
  const result = (0, node_child_process_1.spawnSync)(program, args, {
218
227
  cwd,
228
+ shell: shouldUseWindowsShell(program),
219
229
  stdio: ["ignore", verbose ? "inherit" : "ignore", "inherit"],
220
230
  });
221
231
  if (result.error) {
package/lib/init.js CHANGED
@@ -11,7 +11,14 @@ const node_process_1 = require("node:process");
11
11
  const node_child_process_1 = require("node:child_process");
12
12
  const packageJson = require("../package.json");
13
13
  function npmExecutable() {
14
- return process.platform === "win32" ? "npm.cmd" : "npm";
14
+ return "npm";
15
+ }
16
+ function shouldUseWindowsShell(program) {
17
+ if (process.platform !== "win32") {
18
+ return false;
19
+ }
20
+ const normalized = program.toLowerCase();
21
+ return normalized === "npm" || normalized.endsWith(".cmd") || normalized.endsWith(".bat");
15
22
  }
16
23
  function initUsage(commandName = "openvcs") {
17
24
  return `Usage: ${commandName} init [--theme] [target-dir]\n\nOptions:\n --theme Start with a theme-only plugin template\n`;
@@ -165,6 +172,7 @@ async function collectAnswers({ forceTheme, targetHint }, promptDriver = createR
165
172
  function runNpmInstall(targetDir) {
166
173
  const result = (0, node_child_process_1.spawnSync)(npmExecutable(), ["install"], {
167
174
  cwd: targetDir,
175
+ shell: shouldUseWindowsShell(npmExecutable()),
168
176
  stdio: "inherit",
169
177
  });
170
178
  if (result.error) {
@@ -1,4 +1,5 @@
1
1
  export * from './host';
2
+ export * from './menubar';
2
3
  export * from './plugin';
3
4
  export * from './protocol';
4
5
  export * from './vcs';
@@ -17,6 +17,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  __exportStar(require("./host"), exports);
20
+ __exportStar(require("./menubar"), exports);
20
21
  __exportStar(require("./plugin"), exports);
21
22
  __exportStar(require("./protocol"), exports);
22
23
  __exportStar(require("./vcs"), exports);
@@ -0,0 +1,46 @@
1
+ /** API for manipulating top-level application menus. */
2
+ export interface MenubarManager {
3
+ /** Gets a menu by ID (e.g., 'file', 'repository', 'help'). Returns null if not found. */
4
+ get(menuId: string): MenubarMenu | null;
5
+ /** Gets a menu by ID, creating it if it doesn't exist. */
6
+ getOrCreate(menuId: string, label: string): MenubarMenu;
7
+ /** Creates a new menu at the specified position. */
8
+ create(menuId: string, label: string, options?: {
9
+ before?: string;
10
+ after?: string;
11
+ }): MenubarMenu;
12
+ /** Removes a menu entirely. */
13
+ remove(menuId: string): void;
14
+ /** Hides a menu (visibility: hidden). */
15
+ hide(menuId: string): void;
16
+ /** Shows a hidden menu. */
17
+ show(menuId: string): void;
18
+ }
19
+ /** Handle for manipulating a specific menu. */
20
+ export interface MenubarMenu {
21
+ /** Menu ID. */
22
+ id: string;
23
+ /** Adds an item to this menu. */
24
+ addItem(item: MenubarItem): void;
25
+ /** Adds a separator to this menu. */
26
+ addSeparator(beforeAction?: string): void;
27
+ /** Removes an item by action ID. */
28
+ removeItem(actionId: string): void;
29
+ /** Hides an item by action ID. */
30
+ hideItem(actionId: string): void;
31
+ /** Shows a hidden item. */
32
+ showItem(actionId: string): void;
33
+ }
34
+ /** Descriptor for a menu item. */
35
+ export interface MenubarItem {
36
+ /** Display label. */
37
+ label: string;
38
+ /** Action ID (plugin must register handler separately). */
39
+ action: string;
40
+ /** Optional tooltip. */
41
+ title?: string;
42
+ /** Insert before this action ID. */
43
+ before?: string;
44
+ /** Insert after this action ID. */
45
+ after?: string;
46
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Copyright © 2025-2026 OpenVCS Contributors
3
+ // SPDX-License-Identifier: GPL-3.0-or-later
4
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openvcs/sdk",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "OpenVCS SDK CLI for plugin scaffolding and .ovcsp tar.gz packaging",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "homepage": "https://openvcs.app/",
package/src/lib/build.ts CHANGED
@@ -36,7 +36,17 @@ const AUTHORED_PLUGIN_MODULE_BASENAME = "plugin.js";
36
36
 
37
37
  /** Returns the npm executable name for the current platform. */
38
38
  export function npmExecutable(): string {
39
- return process.platform === "win32" ? "npm.cmd" : "npm";
39
+ return "npm";
40
+ }
41
+
42
+ /** Returns whether a command must be launched via the Windows shell. */
43
+ export function shouldUseWindowsShell(program: string): boolean {
44
+ if (process.platform !== "win32") {
45
+ return false;
46
+ }
47
+
48
+ const normalized = program.toLowerCase();
49
+ return normalized === "npm" || normalized.endsWith(".cmd") || normalized.endsWith(".bat");
40
50
  }
41
51
 
42
52
  /** Formats help text for the build command. */
@@ -271,6 +281,7 @@ export function runCommand(program: string, args: string[], cwd: string, verbose
271
281
 
272
282
  const result = spawnSync(program, args, {
273
283
  cwd,
284
+ shell: shouldUseWindowsShell(program),
274
285
  stdio: ["ignore", verbose ? "inherit" : "ignore", "inherit"],
275
286
  }) as CommandResult;
276
287
 
package/src/lib/init.ts CHANGED
@@ -34,7 +34,16 @@ interface InitCommandError {
34
34
  }
35
35
 
36
36
  function npmExecutable(): string {
37
- return process.platform === "win32" ? "npm.cmd" : "npm";
37
+ return "npm";
38
+ }
39
+
40
+ function shouldUseWindowsShell(program: string): boolean {
41
+ if (process.platform !== "win32") {
42
+ return false;
43
+ }
44
+
45
+ const normalized = program.toLowerCase();
46
+ return normalized === "npm" || normalized.endsWith(".cmd") || normalized.endsWith(".bat");
38
47
  }
39
48
 
40
49
  export function initUsage(commandName = "openvcs"): string {
@@ -207,6 +216,7 @@ async function collectAnswers(
207
216
  function runNpmInstall(targetDir: string): void {
208
217
  const result = spawnSync(npmExecutable(), ["install"], {
209
218
  cwd: targetDir,
219
+ shell: shouldUseWindowsShell(npmExecutable()),
210
220
  stdio: "inherit",
211
221
  });
212
222
  if (result.error) {
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: GPL-3.0-or-later
3
3
 
4
4
  export * from './host';
5
+ export * from './menubar';
5
6
  export * from './plugin';
6
7
  export * from './protocol';
7
8
  export * from './vcs';
@@ -0,0 +1,48 @@
1
+ // Copyright © 2025-2026 OpenVCS Contributors
2
+ // SPDX-License-Identifier: GPL-3.0-or-later
3
+
4
+ /** API for manipulating top-level application menus. */
5
+ export interface MenubarManager {
6
+ /** Gets a menu by ID (e.g., 'file', 'repository', 'help'). Returns null if not found. */
7
+ get(menuId: string): MenubarMenu | null;
8
+ /** Gets a menu by ID, creating it if it doesn't exist. */
9
+ getOrCreate(menuId: string, label: string): MenubarMenu;
10
+ /** Creates a new menu at the specified position. */
11
+ create(menuId: string, label: string, options?: { before?: string; after?: string }): MenubarMenu;
12
+ /** Removes a menu entirely. */
13
+ remove(menuId: string): void;
14
+ /** Hides a menu (visibility: hidden). */
15
+ hide(menuId: string): void;
16
+ /** Shows a hidden menu. */
17
+ show(menuId: string): void;
18
+ }
19
+
20
+ /** Handle for manipulating a specific menu. */
21
+ export interface MenubarMenu {
22
+ /** Menu ID. */
23
+ id: string;
24
+ /** Adds an item to this menu. */
25
+ addItem(item: MenubarItem): void;
26
+ /** Adds a separator to this menu. */
27
+ addSeparator(beforeAction?: string): void;
28
+ /** Removes an item by action ID. */
29
+ removeItem(actionId: string): void;
30
+ /** Hides an item by action ID. */
31
+ hideItem(actionId: string): void;
32
+ /** Shows a hidden item. */
33
+ showItem(actionId: string): void;
34
+ }
35
+
36
+ /** Descriptor for a menu item. */
37
+ export interface MenubarItem {
38
+ /** Display label. */
39
+ label: string;
40
+ /** Action ID (plugin must register handler separately). */
41
+ action: string;
42
+ /** Optional tooltip. */
43
+ title?: string;
44
+ /** Insert before this action ID. */
45
+ before?: string;
46
+ /** Insert after this action ID. */
47
+ after?: string;
48
+ }