ai-extension-preview 0.1.2 → 0.1.3

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.
@@ -84,14 +84,6 @@ export const BrowserPlugin = {
84
84
  // Convert Chrome path to Windows format if in WSL
85
85
  // /mnt/c/Program Files/... -> C:\Program Files\...
86
86
  let executable = chromePath;
87
- let args = [
88
- `--load-extension=${extensionPath}`,
89
- `--user-data-dir=${userDataDir}`,
90
- '--no-first-run',
91
- '--no-default-browser-check',
92
- '--disable-gpu',
93
- 'about:blank'
94
- ];
95
87
  // If WSL, use a batch file to handle the launch robustly
96
88
  if (isWSL) {
97
89
  const driveLetter = chromePath.match(/\/mnt\/([a-z])\//)?.[1] || 'c';
@@ -103,8 +95,6 @@ export const BrowserPlugin = {
103
95
  const winDist = 'C:\\Temp\\ai-ext-preview';
104
96
  const winProfile = 'C:\\Temp\\ai-ext-profile';
105
97
  // Create the batch file content
106
- // NOTE: We quote the executable path and arguments carefully
107
- // start "" "Executable" args...
108
98
  const batContent = `@echo off
109
99
  start "" "${winChromePath}" --load-extension="${winDist}" --user-data-dir="${winProfile}" --no-first-run --no-default-browser-check --disable-gpu about:blank
110
100
  exit
@@ -120,10 +110,9 @@ exit
120
110
  }
121
111
  await ctx.actions.runAction('core:log', { level: 'info', message: `EXEC: ${winBatPath}` });
122
112
  // Execute the batch file via cmd.exe using spawn + PATH lookup
123
- // We rely on 'cmd.exe' being in the path so spawn works without /bin/sh
124
- const executable = 'cmd.exe';
125
- await ctx.actions.runAction('core:log', { level: 'info', message: `SPAWN (WSL): ${executable} /c ${winBatPath}` });
126
- const subprocess = spawn(executable, ['/c', winBatPath], {
113
+ const cli = 'cmd.exe';
114
+ await ctx.actions.runAction('core:log', { level: 'info', message: `SPAWN (WSL): ${cli} /c ${winBatPath}` });
115
+ const subprocess = spawn(cli, ['/c', winBatPath], {
127
116
  detached: true,
128
117
  stdio: 'ignore',
129
118
  cwd: '/mnt/c'
@@ -132,13 +121,23 @@ exit
132
121
  return true;
133
122
  }
134
123
  else {
135
- // Standard Windows / Linux Launch
136
- await ctx.actions.runAction('core:log', { level: 'info', message: `SPAWN: ${chromePath}` });
137
- // On Windows, ensure we quote paths correctly if they have spaces?
138
- // Node's spawn handles argument quoting automatically usually.
139
- // But let's log them to be sure
140
- await ctx.actions.runAction('core:log', { level: 'info', message: `ARGS: ${args.join(' ')}` });
141
- const subprocess = spawn(executable, args, {
124
+ // Standard Windows / Linux Launch (Git Bash / Native)
125
+ // Normalize paths (stripping trailing slashes which Chrome hates)
126
+ const safeDist = path.resolve(extensionPath);
127
+ const safeProfile = path.resolve(userDataDir);
128
+ await ctx.actions.runAction('core:log', { level: 'info', message: `SPAWN: ${executable}` });
129
+ await ctx.actions.runAction('core:log', { level: 'info', message: `EXT PATH: ${safeDist}` });
130
+ // Reconstruct args with safe paths
131
+ const cleanArgs = [
132
+ `--load-extension=${safeDist}`,
133
+ `--user-data-dir=${safeProfile}`,
134
+ '--no-first-run',
135
+ '--no-default-browser-check',
136
+ '--disable-gpu',
137
+ 'chrome://extensions' // Better for verifying if it loaded
138
+ ];
139
+ await ctx.actions.runAction('core:log', { level: 'info', message: `ARGS: ${cleanArgs.join(' ')}` });
140
+ const subprocess = spawn(executable, cleanArgs, {
142
141
  detached: true,
143
142
  stdio: 'ignore'
144
143
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-extension-preview",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Local preview tool for AI Extension Builder",
5
5
  "type": "module",
6
6
  "bin": {