@knotpad/app 0.1.8 → 0.2.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/bin/brief.js CHANGED
@@ -185,7 +185,9 @@ const BUILD_ID = path.join(PKG_DIR, ".next", "BUILD_ID");
185
185
  if (!fs.existsSync(BUILD_ID)) {
186
186
  log("Building Knotpad (first run — takes ~30 seconds)…");
187
187
  try {
188
- execSync("npx next build", { cwd: PKG_DIR, stdio: "inherit", env: process.env });
188
+ const nextBin = path.join(PKG_DIR, "node_modules", ".bin", "next");
189
+ const cmd = process.platform === "win32" ? `node "${nextBin}" build` : `"${nextBin}" build`;
190
+ execSync(cmd, { cwd: PKG_DIR, stdio: "inherit", env: process.env });
189
191
  ok("Build complete");
190
192
  } catch {
191
193
  die("Build failed. Run `npx @knotpad/app` again after fixing any errors.");
@@ -195,7 +197,12 @@ if (!fs.existsSync(BUILD_ID)) {
195
197
  // ── 4. Start server ────────────────────────────────────────────────────────────
196
198
 
197
199
  // Pre-create PGlite data directory so the app can open it immediately at startup
198
- fs.mkdirSync(path.join(WORK_DIR, ".brief", "db"), { recursive: true });
200
+ const DB_DIR = path.join(WORK_DIR, ".brief", "db");
201
+ try {
202
+ fs.mkdirSync(DB_DIR, { recursive: true });
203
+ } catch (e) {
204
+ // Ignore if directory already exists or creation fails
205
+ }
199
206
 
200
207
  const PORT = parseInt(process.env.PORT ?? "3099", 10);
201
208
  const URL = `http://localhost:${PORT}`;
@@ -14,6 +14,19 @@ export async function register() {
14
14
  if (process.env.NEXT_RUNTIME !== "nodejs") return;
15
15
  if (process.env.IS_CLOUD === "true") return;
16
16
 
17
+ // Ensure DB directory exists before initializing PGlite
18
+ const path = await import("path");
19
+ const fs = await import("fs/promises");
20
+ const os = await import("os");
21
+
22
+ const workDir = process.cwd();
23
+ const dbDir = path.join(workDir, ".brief", "db");
24
+ try {
25
+ await fs.mkdir(dbDir, { recursive: true });
26
+ } catch (e) {
27
+ // Ignore if directory already exists or creation fails
28
+ }
29
+
17
30
  const { initLocalPrisma } = await import("./lib/prisma");
18
31
  await initLocalPrisma();
19
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotpad/app",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "description": "Note-first project management with AI agent task routing",
5
5
  "bin": {
6
6
  "knotpad": "bin/brief.js"
@@ -26,6 +26,11 @@
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
+ "os": [
30
+ "darwin",
31
+ "linux",
32
+ "win32"
33
+ ],
29
34
  "scripts": {
30
35
  "postinstall": "prisma generate",
31
36
  "build": "next build"