hanoman 0.1.0 → 0.1.2
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 +21 -0
- package/README.md +18 -1
- package/dist/build-info.json +3 -3
- package/dist/cli.js +68 -17
- package/dist/server.js +27 -8
- package/package.json +4 -3
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
|
-
| `
|
|
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,19 @@ 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
|
+
## Kalau `hanoman` gagal menerapkan migrasi
|
|
82
|
+
|
|
83
|
+
**`P3005 — The database schema is not empty`** berarti berkas DB itu sudah punya tabel tapi tak
|
|
84
|
+
punya riwayat migrasi hanoman — biasanya bukan DB hanoman versi ini (sisa prototipe lama, atau
|
|
85
|
+
berkas tool lain yang kebetulan bernama sama). hanoman **tidak** mengubah isinya. Pindahkan berkas
|
|
86
|
+
itu lalu jalankan ulang, atau tunjuk berkas lain dengan `hanoman --db /path/baru.db`.
|
|
87
|
+
|
|
88
|
+
## Lisensi
|
|
89
|
+
|
|
90
|
+
MIT — lihat `LICENSE`.
|
package/dist/build-info.json
CHANGED
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
|
|
158
|
-
if (
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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);
|
|
@@ -239,6 +256,7 @@ __export(start_exports, {
|
|
|
239
256
|
default: () => start,
|
|
240
257
|
distDir: () => distDir,
|
|
241
258
|
ensurePrismaClient: () => ensurePrismaClient,
|
|
259
|
+
migrateFailureHint: () => migrateFailureHint,
|
|
242
260
|
parseStartArgs: () => parseStartArgs,
|
|
243
261
|
prismaClientUsable: () => prismaClientUsable
|
|
244
262
|
});
|
|
@@ -290,10 +308,29 @@ function distDir() {
|
|
|
290
308
|
}
|
|
291
309
|
function runPrisma(args, dbUrl) {
|
|
292
310
|
const prismaCli = prismaCliPath(createRequire(import.meta.url).resolve);
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
311
|
+
try {
|
|
312
|
+
const out = execFileSync(process.execPath, [prismaCli, ...args], {
|
|
313
|
+
env: { ...process.env, DATABASE_URL: dbUrl },
|
|
314
|
+
encoding: "utf8",
|
|
315
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
316
|
+
});
|
|
317
|
+
process.stdout.write(out);
|
|
318
|
+
return out;
|
|
319
|
+
} catch (e) {
|
|
320
|
+
const err = e;
|
|
321
|
+
const output = `${err.stdout ?? ""}${err.stderr ?? ""}`;
|
|
322
|
+
process.stderr.write(output);
|
|
323
|
+
throw Object.assign(new Error("prisma gagal"), { output });
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function migrateFailureHint(output, dbFile) {
|
|
327
|
+
if (!output.includes("P3005")) return null;
|
|
328
|
+
return `hanoman: berkas DB ${dbFile} sudah berisi tabel, tapi tak punya riwayat migrasi hanoman.
|
|
329
|
+
Biasanya ia bukan DB hanoman versi ini \u2014 mis. sisa prototipe lama atau berkas tool lain.
|
|
330
|
+
Pilih salah satu:
|
|
331
|
+
\u2022 Pindahkan berkas itu, lalu jalankan ulang: mv "${dbFile}" "${dbFile}.lama"
|
|
332
|
+
\u2022 Pakai berkas lain: hanoman --db /path/baru.db (atau HANOMAN_DATABASE_URL=file:/path/baru.db)
|
|
333
|
+
Isi berkas lama tidak diubah oleh hanoman \u2014 periksa dulu sebelum menghapusnya.`;
|
|
297
334
|
}
|
|
298
335
|
function applyMigrations(schema, dbUrl) {
|
|
299
336
|
runPrisma(["migrate", "deploy", "--schema", schema], dbUrl);
|
|
@@ -337,6 +374,9 @@ async function start(argv, ctx) {
|
|
|
337
374
|
`);
|
|
338
375
|
return 1;
|
|
339
376
|
}
|
|
377
|
+
const notice = dbUrlNotice(ctx.env);
|
|
378
|
+
if (notice) ctx.stderr(`${notice}
|
|
379
|
+
`);
|
|
340
380
|
const home = resolveHome(ctx.env);
|
|
341
381
|
mkdirSync(home, { recursive: true });
|
|
342
382
|
mkdirSync(dirname2(dbFilePath(dbUrl)), { recursive: true });
|
|
@@ -351,8 +391,11 @@ async function start(argv, ctx) {
|
|
|
351
391
|
`);
|
|
352
392
|
try {
|
|
353
393
|
applyMigrations(layout.schema, dbUrl);
|
|
354
|
-
} catch {
|
|
355
|
-
|
|
394
|
+
} catch (e) {
|
|
395
|
+
const hint = migrateFailureHint(String(e.output ?? ""), dbFilePath(dbUrl));
|
|
396
|
+
ctx.stderr(hint ? `
|
|
397
|
+
${hint}
|
|
398
|
+
` : "hanoman: `prisma migrate deploy` gagal \u2014 lihat keluaran di atas\n");
|
|
356
399
|
return 1;
|
|
357
400
|
}
|
|
358
401
|
}
|
|
@@ -446,6 +489,10 @@ async function doctor(_argv, ctx) {
|
|
|
446
489
|
});
|
|
447
490
|
ctx.stdout(`hanoman doctor
|
|
448
491
|
${r.lines.join("\n")}
|
|
492
|
+
`);
|
|
493
|
+
const notice = dbUrlNotice(ctx.env);
|
|
494
|
+
if (notice) ctx.stdout(`
|
|
495
|
+
${notice}
|
|
449
496
|
`);
|
|
450
497
|
if (!r.ok) ctx.stderr("\nada prasyarat yang belum terpenuhi \u2014 hanoman tak akan bisa menjalankan sesi\n");
|
|
451
498
|
return r.ok ? 0 : 1;
|
|
@@ -6119,9 +6166,11 @@ function packageJsonFor(version2, deps) {
|
|
|
6119
6166
|
// mendeteksi & menggenerate sendiri (ensurePrismaClient).
|
|
6120
6167
|
scripts: { postinstall: "prisma generate --schema prisma/schema.prisma || true" },
|
|
6121
6168
|
engines: { node: ">=20" },
|
|
6122
|
-
files: ["bin", "dist", "web", "prisma", "README.md"],
|
|
6169
|
+
files: ["bin", "dist", "web", "prisma", "README.md", "LICENSE"],
|
|
6123
6170
|
dependencies: deps,
|
|
6124
|
-
|
|
6171
|
+
// MIT: paket ini didistribusikan publik supaya orang `npm i -g`. `UNLICENSED` berarti "tak ada
|
|
6172
|
+
// izin pakai" — 0.1.0 terbit dengan kontradiksi itu, dan versi terbit tak bisa diperbaiki.
|
|
6173
|
+
license: "MIT"
|
|
6125
6174
|
};
|
|
6126
6175
|
}
|
|
6127
6176
|
function copyPlan(repo) {
|
|
@@ -6132,7 +6181,8 @@ function copyPlan(repo) {
|
|
|
6132
6181
|
{ from: join8(repo, "src/dist"), to: "web", dir: true },
|
|
6133
6182
|
{ from: join8(repo, "server/prisma/schema.prisma"), to: "prisma/schema.prisma" },
|
|
6134
6183
|
{ from: join8(repo, "server/prisma/migrations"), to: "prisma/migrations", dir: true },
|
|
6135
|
-
{ from: join8(repo, "internal/docs/operations/npm-readme.md"), to: "README.md" }
|
|
6184
|
+
{ from: join8(repo, "internal/docs/operations/npm-readme.md"), to: "README.md" },
|
|
6185
|
+
{ from: join8(repo, "LICENSE"), to: "LICENSE" }
|
|
6136
6186
|
];
|
|
6137
6187
|
}
|
|
6138
6188
|
var PKG_NAME, REPO_URL, RUNTIME_DEPS, REQUIRED_ARTIFACTS, BIN_SHIM;
|
|
@@ -6159,7 +6209,8 @@ var init_pack = __esm({
|
|
|
6159
6209
|
"dist/server.js",
|
|
6160
6210
|
"prisma/schema.prisma",
|
|
6161
6211
|
"web/index.html",
|
|
6162
|
-
"README.md"
|
|
6212
|
+
"README.md",
|
|
6213
|
+
"LICENSE"
|
|
6163
6214
|
];
|
|
6164
6215
|
BIN_SHIM = `#!/usr/bin/env node
|
|
6165
6216
|
// 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
|
|
6083
|
-
if (
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
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.
|
|
3
|
+
"version": "0.1.2",
|
|
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": "
|
|
38
|
+
"license": "MIT"
|
|
38
39
|
}
|