hanoman 0.1.0 → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dena Meidina
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -50,7 +50,8 @@ sedang berjalan tak boleh diputus oleh update yang tak diminta.
50
50
  | Env | Default | Untuk apa |
51
51
  |---|---|---|
52
52
  | `HANOMAN_HOME` | `~/.hanoman` | DB SQLite, key SSH, transkrip sesi |
53
- | `DATABASE_URL` | `file:$HANOMAN_HOME/hanoman.db` | hanya URL `file:` (SQLite) |
53
+ | `HANOMAN_DATABASE_URL` | | berkas DB khusus hanoman; hanya URL `file:` (nilai lain **melempar**) |
54
+ | `DATABASE_URL` | `file:$HANOMAN_HOME/hanoman.db` | dipakai bila ber-`file:`; nilai lain **diabaikan** dengan peringatan |
54
55
  | `PORT` / `HOST` | `8787` / `127.0.0.1` | alamat bind |
55
56
  | `HANOMAN_CLAUDE_BIN` / `HANOMAN_CODEX_BIN` | `claude` / `codex` | biner agen |
56
57
  | `HANOMAN_TMUX_SOCKET` | `hanoman` | socket tmux terpisah dari milikmu |
@@ -71,3 +72,12 @@ hanoman migrate-from-postgres --from "postgresql://user:pass@host:5432/hanoman"
71
72
 
72
73
  `--dry-run` hanya menghitung baris per tabel tanpa menulis apa pun. Target yang sudah berisi data
73
74
  ditolak kecuali `--force`.
75
+
76
+ > **Punya `DATABASE_URL` untuk project lain?** Tidak masalah — hanoman mengabaikan nilai non-`file:`
77
+ > dan tetap memakai `$HANOMAN_HOME/hanoman.db`, sambil mencetak peringatan sekali. Untuk menunjuk
78
+ > berkas DB tertentu tanpa menyentuh var itu, pakai `HANOMAN_DATABASE_URL=file:/path/hanoman.db`
79
+ > atau `hanoman --db /path/hanoman.db`.
80
+
81
+ ## Lisensi
82
+
83
+ MIT — lihat `LICENSE`.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.0",
3
- "sha": "6d1867f",
4
- "builtAt": "2026-07-30T06:11:24.389Z"
2
+ "version": "0.1.1",
3
+ "sha": "55bc2c6",
4
+ "builtAt": "2026-07-30T07:00:27.508Z"
5
5
  }
package/dist/cli.js CHANGED
@@ -153,19 +153,36 @@ function resolveHome(env = process.env, home = homedir()) {
153
153
  const v = env.HANOMAN_HOME?.trim();
154
154
  return v ? v : join(home, ".hanoman");
155
155
  }
156
+ function schemeOf(raw) {
157
+ return raw.split("://")[0] ?? "?";
158
+ }
156
159
  function resolveDbUrl(env, schemaDir) {
157
- const raw = env.DATABASE_URL?.trim();
158
- if (!raw) return `file:${join(resolveHome(env), "hanoman.db")}`;
159
- if (!raw.startsWith("file:")) {
160
- const scheme = raw.split("://")[0] ?? raw;
161
- throw new Error(
162
- `DATABASE_URL harus URL SQLite \`file:\u2026\` sejak ADR-0086 (dapat \`${scheme}\`). Masih punya data Postgres? Pindahkan sekali: hanoman migrate-from-postgres --from "${raw}"`
163
- );
160
+ const own = env.HANOMAN_DATABASE_URL?.trim();
161
+ if (own) {
162
+ if (!own.startsWith("file:")) {
163
+ throw new Error(
164
+ `HANOMAN_DATABASE_URL harus URL SQLite \`file:\u2026\` sejak ADR-0086 (dapat \`${schemeOf(own)}\`). Masih punya data Postgres? Pindahkan sekali: hanoman migrate-from-postgres --from "<url-postgres>"`
165
+ );
166
+ }
167
+ return absoluteFileUrl(own, schemaDir);
164
168
  }
169
+ const raw = env.DATABASE_URL?.trim();
170
+ if (!raw || !raw.startsWith("file:")) return `file:${join(resolveHome(env), "hanoman.db")}`;
171
+ return absoluteFileUrl(raw, schemaDir);
172
+ }
173
+ function absoluteFileUrl(raw, schemaDir) {
165
174
  const p = raw.slice("file:".length);
166
175
  if (p.startsWith(":")) return raw;
167
176
  return `file:${isAbsolute(p) ? p : resolve(schemaDir, p)}`;
168
177
  }
178
+ function dbUrlNotice(env) {
179
+ if (env.HANOMAN_DATABASE_URL?.trim()) return null;
180
+ const raw = env.DATABASE_URL?.trim();
181
+ if (!raw || raw.startsWith("file:")) return null;
182
+ return `hanoman: DATABASE_URL bertipe \`${schemeOf(raw)}\` DIABAIKAN \u2014 hanoman memakai SQLite (ADR-0086), dan var itu biasanya milik project lain.
183
+ \u2022 Punya data Postgres hanoman? Pindahkan sekali: hanoman migrate-from-postgres --from "<url>"
184
+ \u2022 Mau menunjuk berkas DB tertentu? Pakai HANOMAN_DATABASE_URL=file:/path/hanoman.db (atau --db)`;
185
+ }
169
186
  function dbFilePath(url) {
170
187
  if (!url.startsWith("file:")) throw new Error(`bukan URL SQLite: ${url}`);
171
188
  return url.slice("file:".length);
@@ -337,6 +354,9 @@ async function start(argv, ctx) {
337
354
  `);
338
355
  return 1;
339
356
  }
357
+ const notice = dbUrlNotice(ctx.env);
358
+ if (notice) ctx.stderr(`${notice}
359
+ `);
340
360
  const home = resolveHome(ctx.env);
341
361
  mkdirSync(home, { recursive: true });
342
362
  mkdirSync(dirname2(dbFilePath(dbUrl)), { recursive: true });
@@ -446,6 +466,10 @@ async function doctor(_argv, ctx) {
446
466
  });
447
467
  ctx.stdout(`hanoman doctor
448
468
  ${r.lines.join("\n")}
469
+ `);
470
+ const notice = dbUrlNotice(ctx.env);
471
+ if (notice) ctx.stdout(`
472
+ ${notice}
449
473
  `);
450
474
  if (!r.ok) ctx.stderr("\nada prasyarat yang belum terpenuhi \u2014 hanoman tak akan bisa menjalankan sesi\n");
451
475
  return r.ok ? 0 : 1;
@@ -6119,9 +6143,11 @@ function packageJsonFor(version2, deps) {
6119
6143
  // mendeteksi & menggenerate sendiri (ensurePrismaClient).
6120
6144
  scripts: { postinstall: "prisma generate --schema prisma/schema.prisma || true" },
6121
6145
  engines: { node: ">=20" },
6122
- files: ["bin", "dist", "web", "prisma", "README.md"],
6146
+ files: ["bin", "dist", "web", "prisma", "README.md", "LICENSE"],
6123
6147
  dependencies: deps,
6124
- license: "UNLICENSED"
6148
+ // MIT: paket ini didistribusikan publik supaya orang `npm i -g`. `UNLICENSED` berarti "tak ada
6149
+ // izin pakai" — 0.1.0 terbit dengan kontradiksi itu, dan versi terbit tak bisa diperbaiki.
6150
+ license: "MIT"
6125
6151
  };
6126
6152
  }
6127
6153
  function copyPlan(repo) {
@@ -6132,7 +6158,8 @@ function copyPlan(repo) {
6132
6158
  { from: join8(repo, "src/dist"), to: "web", dir: true },
6133
6159
  { from: join8(repo, "server/prisma/schema.prisma"), to: "prisma/schema.prisma" },
6134
6160
  { from: join8(repo, "server/prisma/migrations"), to: "prisma/migrations", dir: true },
6135
- { from: join8(repo, "internal/docs/operations/npm-readme.md"), to: "README.md" }
6161
+ { from: join8(repo, "internal/docs/operations/npm-readme.md"), to: "README.md" },
6162
+ { from: join8(repo, "LICENSE"), to: "LICENSE" }
6136
6163
  ];
6137
6164
  }
6138
6165
  var PKG_NAME, REPO_URL, RUNTIME_DEPS, REQUIRED_ARTIFACTS, BIN_SHIM;
@@ -6159,7 +6186,8 @@ var init_pack = __esm({
6159
6186
  "dist/server.js",
6160
6187
  "prisma/schema.prisma",
6161
6188
  "web/index.html",
6162
- "README.md"
6189
+ "README.md",
6190
+ "LICENSE"
6163
6191
  ];
6164
6192
  BIN_SHIM = `#!/usr/bin/env node
6165
6193
  // SPEC-398 \xB7 shim tipis: seluruh logika ada di dist/cli.js (bundle esbuild).
package/dist/server.js CHANGED
@@ -6078,19 +6078,36 @@ function resolveHome(env = process.env, home = homedir()) {
6078
6078
  const v = env.HANOMAN_HOME?.trim();
6079
6079
  return v ? v : join(home, ".hanoman");
6080
6080
  }
6081
+ function schemeOf(raw) {
6082
+ return raw.split("://")[0] ?? "?";
6083
+ }
6081
6084
  function resolveDbUrl(env, schemaDir2) {
6082
- const raw = env.DATABASE_URL?.trim();
6083
- if (!raw) return `file:${join(resolveHome(env), "hanoman.db")}`;
6084
- if (!raw.startsWith("file:")) {
6085
- const scheme = raw.split("://")[0] ?? raw;
6086
- throw new Error(
6087
- `DATABASE_URL harus URL SQLite \`file:\u2026\` sejak ADR-0086 (dapat \`${scheme}\`). Masih punya data Postgres? Pindahkan sekali: hanoman migrate-from-postgres --from "${raw}"`
6088
- );
6085
+ const own = env.HANOMAN_DATABASE_URL?.trim();
6086
+ if (own) {
6087
+ if (!own.startsWith("file:")) {
6088
+ throw new Error(
6089
+ `HANOMAN_DATABASE_URL harus URL SQLite \`file:\u2026\` sejak ADR-0086 (dapat \`${schemeOf(own)}\`). Masih punya data Postgres? Pindahkan sekali: hanoman migrate-from-postgres --from "<url-postgres>"`
6090
+ );
6091
+ }
6092
+ return absoluteFileUrl(own, schemaDir2);
6089
6093
  }
6094
+ const raw = env.DATABASE_URL?.trim();
6095
+ if (!raw || !raw.startsWith("file:")) return `file:${join(resolveHome(env), "hanoman.db")}`;
6096
+ return absoluteFileUrl(raw, schemaDir2);
6097
+ }
6098
+ function absoluteFileUrl(raw, schemaDir2) {
6090
6099
  const p = raw.slice("file:".length);
6091
6100
  if (p.startsWith(":")) return raw;
6092
6101
  return `file:${isAbsolute2(p) ? p : resolve4(schemaDir2, p)}`;
6093
6102
  }
6103
+ function dbUrlNotice(env) {
6104
+ if (env.HANOMAN_DATABASE_URL?.trim()) return null;
6105
+ const raw = env.DATABASE_URL?.trim();
6106
+ if (!raw || raw.startsWith("file:")) return null;
6107
+ return `hanoman: DATABASE_URL bertipe \`${schemeOf(raw)}\` DIABAIKAN \u2014 hanoman memakai SQLite (ADR-0086), dan var itu biasanya milik project lain.
6108
+ \u2022 Punya data Postgres hanoman? Pindahkan sekali: hanoman migrate-from-postgres --from "<url>"
6109
+ \u2022 Mau menunjuk berkas DB tertentu? Pakai HANOMAN_DATABASE_URL=file:/path/hanoman.db (atau --db)`;
6110
+ }
6094
6111
  function dbFilePath(url2) {
6095
6112
  if (!url2.startsWith("file:")) throw new Error(`bukan URL SQLite: ${url2}`);
6096
6113
  return url2.slice("file:".length);
@@ -6123,13 +6140,15 @@ import { mkdirSync as mkdirSync2 } from "node:fs";
6123
6140
  import { dirname as dirname3, resolve as resolve5 } from "node:path";
6124
6141
  import { fileURLToPath as fileURLToPath2 } from "node:url";
6125
6142
  import { PrismaClient } from "@prisma/client";
6126
- var schemaDir, url, prisma;
6143
+ var schemaDir, notice, url, prisma;
6127
6144
  var init_db = __esm({
6128
6145
  "src/db.ts"() {
6129
6146
  "use strict";
6130
6147
  init_env();
6131
6148
  init_src2();
6132
6149
  schemaDir = resolve5(dirname3(fileURLToPath2(import.meta.url)), "../prisma");
6150
+ notice = dbUrlNotice(process.env);
6151
+ if (notice) console.warn(notice);
6133
6152
  url = resolveDbUrl(process.env, schemaDir);
6134
6153
  process.env.DATABASE_URL = url;
6135
6154
  mkdirSync2(dirname3(dbFilePath(url)), { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hanoman",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Orchestrator + dashboard workflow docs-driven untuk sesi Claude Code / Codex",
5
5
  "type": "module",
6
6
  "repository": {
@@ -21,7 +21,8 @@
21
21
  "dist",
22
22
  "web",
23
23
  "prisma",
24
- "README.md"
24
+ "README.md",
25
+ "LICENSE"
25
26
  ],
26
27
  "dependencies": {
27
28
  "fastify": "^4.28.0",
@@ -34,5 +35,5 @@
34
35
  "prisma": "^6.19.0",
35
36
  "pg": "^8.13.1"
36
37
  },
37
- "license": "UNLICENSED"
38
+ "license": "MIT"
38
39
  }