@kmugalkhod/lightcode 0.16.0 → 0.17.0

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/lightcode.cjs CHANGED
@@ -82,30 +82,30 @@ if (!bunPath) {
82
82
  // to Bun unless we forward the certs explicitly.
83
83
  // Strategy: use PowerShell only to export raw DER .cer files; do all PEM
84
84
  // formatting in Node.js where string/encoding handling is reliable.
85
- if (process.platform === "win32" && !process.env.NODE_EXTRA_CA_CERTS) {
85
+ if (process.platform === "win32" && !process.env.NODE_EXTRA_CA_CERTS && !process.env.LIGHTCODE_CA_CERTS && !process.env.SSL_CERT_FILE) {
86
+ let exportDir;
86
87
  try {
87
- const tmpDir = os.tmpdir();
88
- const cerDir = path.join(tmpDir, "lightcode-certs");
89
- const pemFile = path.join(tmpDir, "lightcode-win-ca.pem");
90
- const ps1File = path.join(tmpDir, "lightcode-cert-export.ps1");
91
-
92
- if (!fs.existsSync(cerDir)) fs.mkdirSync(cerDir, { recursive: true });
93
-
94
- // Forward slashes work in PowerShell and avoid backslash escaping issues
95
- const cerDirFwd = cerDir.replace(/\\/g, "/");
88
+ exportDir = fs.mkdtempSync(path.join(os.tmpdir(), "lightcode-certs-"));
89
+ const cerDir = exportDir;
90
+ const pemFile = path.join(exportDir, "ca.pem");
91
+ const ps1File = path.join(exportDir, "export.ps1");
96
92
  const psLines = [
97
93
  "$i = 0",
98
- 'foreach ($s in @("Root", "CA")) {',
94
+ 'foreach ($s in @("LocalMachine", "CurrentUser")) {',
99
95
  ' try {',
100
- ' foreach ($c in (Get-ChildItem "Cert:\\LocalMachine\\$s" -EA Stop)) {',
101
- ' Export-Certificate -Cert $c -FilePath "' + cerDirFwd + '/$i.cer" -Type CERT | Out-Null',
96
+ ' foreach ($c in (Get-ChildItem "Cert:\\$s\\Root" -EA Stop)) {',
97
+ ' Export-Certificate -Cert $c -FilePath (Join-Path $env:LIGHTCODE_CERT_EXPORT_DIR "$i.cer") -Type CERT -ErrorAction Stop | Out-Null',
102
98
  ' $i++',
103
99
  ' }',
104
100
  ' } catch {}',
105
101
  '}',
106
102
  ];
107
103
  fs.writeFileSync(ps1File, psLines.join("\n"), "utf8");
108
- spawnSync("powershell", ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", ps1File], { stdio: "pipe" });
104
+ const exported = spawnSync("powershell", ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", ps1File], {
105
+ stdio: "pipe", timeout: 10000, windowsHide: true,
106
+ env: { ...process.env, LIGHTCODE_CERT_EXPORT_DIR: cerDir },
107
+ });
108
+ if (exported.error || exported.status !== 0) throw new Error("Certificate export failed");
109
109
  try { fs.unlinkSync(ps1File); } catch {}
110
110
 
111
111
  // Convert DER .cer files to PEM entirely in Node.js
@@ -123,8 +123,13 @@ if (process.platform === "win32" && !process.env.NODE_EXTRA_CA_CERTS) {
123
123
 
124
124
  // Cleanup individual cert files
125
125
  cerFiles.forEach(function(f) { try { fs.unlinkSync(path.join(cerDir, f)); } catch {} });
126
- try { fs.rmdirSync(cerDir); } catch {}
126
+ process.on("exit", () => {
127
+ try { fs.rmSync(exportDir, { recursive: true, force: true }); } catch {}
128
+ });
127
129
  } catch {
130
+ if (exportDir) {
131
+ try { fs.rmSync(exportDir, { recursive: true, force: true }); } catch {}
132
+ }
128
133
  // cert export failed — Bun uses its own bundled roots
129
134
  }
130
135
  }
@@ -146,7 +151,7 @@ try {
146
151
  stdio: "inherit",
147
152
  env: process.env,
148
153
  });
149
- process.exit(result.status || 0);
154
+ process.exit(result.status ?? 1);
150
155
  } catch (error) {
151
156
  process.exit(error.status || 1);
152
157
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmugalkhod/lightcode",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Lightcode — a local AI coding agent with terminal and browser interfaces.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,13 +38,13 @@
38
38
  "@openrouter/ai-sdk-provider": "2.10.0",
39
39
  "@opentui/core": "0.4.0",
40
40
  "@opentui/react": "0.4.0",
41
- "@prisma/adapter-libsql": "^7.8.0",
42
- "@prisma/client": "^7.8.0",
41
+ "@prisma/adapter-libsql": "7.10.0",
42
+ "@prisma/client": "7.10.0",
43
43
  "ai": "6.0.182",
44
44
  "diff": "^9.0.0",
45
- "hono": "4.12.25",
45
+ "hono": "4.13.7",
46
46
  "react": "19.2.6",
47
- "react-router": "^7.1.0",
47
+ "react-router": "^7.18.3",
48
48
  "zod": "^4.4.3"
49
49
  }
50
50
  }