hanoman 0.1.33 → 0.1.34
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/README.md +3 -1
- package/dist/build-info.json +3 -3
- package/dist/cli.js +128 -117
- package/dist/server.js +176 -118
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,7 +127,9 @@ Sesi hanoman hidup di dalam **tmux**; layarnya dialirkan ke browser lewat node-p
|
|
|
127
127
|
- **tmux belum terpasang** — `brew install tmux` (macOS) atau paket distro Anda.
|
|
128
128
|
- **`spawn-helper` node-pty tak executable** — node-pty menerbitkan biner pendampingnya dengan mode
|
|
129
129
|
`0644`, jadi `posix_spawnp` gagal dan tak satu byte pun mengalir ke terminal walau sesinya hidup.
|
|
130
|
-
Sejak `0.1.3` `hanoman` memperbaikinya sendiri saat start
|
|
130
|
+
Sejak `0.1.3` `hanoman` memperbaikinya sendiri saat start, dan sejak `0.1.34` perbaikan itu
|
|
131
|
+
dipasang di jembatan node-pty-nya sendiri — jadi ia tetap jalan walau Anda memanggil bundle
|
|
132
|
+
server langsung (`node .../hanoman/dist/server.js`) alih-alih lewat `hanoman start`. Bila instalasi
|
|
131
133
|
global itu milik root dan hanoman dijalankan sebagai pengguna biasa, chmod-nya ditolak — perbaiki
|
|
132
134
|
manual: `sudo chmod +x "$(npm root -g)"/hanoman/node_modules/node-pty/prebuilds/*/spawn-helper`.
|
|
133
135
|
|
package/dist/build-info.json
CHANGED
package/dist/cli.js
CHANGED
|
@@ -7571,6 +7571,54 @@ var init_telegram_operator = __esm({
|
|
|
7571
7571
|
}
|
|
7572
7572
|
});
|
|
7573
7573
|
|
|
7574
|
+
// ../runner/src/spawn-helper.ts
|
|
7575
|
+
import { readdirSync as readdirSync2, existsSync as existsSync2, statSync, chmodSync } from "node:fs";
|
|
7576
|
+
import { dirname as dirname3, join as join3 } from "node:path";
|
|
7577
|
+
function spawnHelperPaths(ptyDir, listDir, exists) {
|
|
7578
|
+
const dirs = [join3(ptyDir, "build", "Release")];
|
|
7579
|
+
for (const name of listDir(join3(ptyDir, "prebuilds"))) dirs.push(join3(ptyDir, "prebuilds", name));
|
|
7580
|
+
return dirs.map((d) => join3(d, "spawn-helper")).filter(exists);
|
|
7581
|
+
}
|
|
7582
|
+
function ensureSpawnHelpersExecutable(paths2, ops) {
|
|
7583
|
+
const fixed = [];
|
|
7584
|
+
for (const p of paths2) {
|
|
7585
|
+
try {
|
|
7586
|
+
const mode = ops.mode(p) & 4095;
|
|
7587
|
+
if ((mode & 73) === 73) continue;
|
|
7588
|
+
ops.chmod(p, mode | 73);
|
|
7589
|
+
fixed.push(p);
|
|
7590
|
+
} catch {
|
|
7591
|
+
}
|
|
7592
|
+
}
|
|
7593
|
+
return fixed;
|
|
7594
|
+
}
|
|
7595
|
+
function repairSpawnHelper(resolve4, notify) {
|
|
7596
|
+
let ptyDir;
|
|
7597
|
+
try {
|
|
7598
|
+
ptyDir = dirname3(resolve4("node-pty/package.json"));
|
|
7599
|
+
} catch {
|
|
7600
|
+
return [];
|
|
7601
|
+
}
|
|
7602
|
+
const paths2 = spawnHelperPaths(ptyDir, (d) => {
|
|
7603
|
+
try {
|
|
7604
|
+
return readdirSync2(d);
|
|
7605
|
+
} catch {
|
|
7606
|
+
return [];
|
|
7607
|
+
}
|
|
7608
|
+
}, existsSync2);
|
|
7609
|
+
const fixed = ensureSpawnHelpersExecutable(paths2, {
|
|
7610
|
+
mode: (p) => statSync(p).mode,
|
|
7611
|
+
chmod: (p, m) => chmodSync(p, m)
|
|
7612
|
+
});
|
|
7613
|
+
if (fixed.length) notify?.("hanoman \xB7 memperbaiki izin `spawn-helper` node-pty (sekali per instalasi)\n");
|
|
7614
|
+
return fixed;
|
|
7615
|
+
}
|
|
7616
|
+
var init_spawn_helper = __esm({
|
|
7617
|
+
"../runner/src/spawn-helper.ts"() {
|
|
7618
|
+
"use strict";
|
|
7619
|
+
}
|
|
7620
|
+
});
|
|
7621
|
+
|
|
7574
7622
|
// ../runner/src/index.ts
|
|
7575
7623
|
var init_src2 = __esm({
|
|
7576
7624
|
"../runner/src/index.ts"() {
|
|
@@ -7590,28 +7638,29 @@ var init_src2 = __esm({
|
|
|
7590
7638
|
init_paths();
|
|
7591
7639
|
init_skills();
|
|
7592
7640
|
init_telegram_operator();
|
|
7641
|
+
init_spawn_helper();
|
|
7593
7642
|
}
|
|
7594
7643
|
});
|
|
7595
7644
|
|
|
7596
7645
|
// src/layout.ts
|
|
7597
|
-
import { join as
|
|
7646
|
+
import { join as join4, resolve as resolve3 } from "node:path";
|
|
7598
7647
|
function resolveLayout(distDir2, exists) {
|
|
7599
7648
|
const pkg = resolve3(distDir2, "..");
|
|
7600
|
-
if (exists(
|
|
7649
|
+
if (exists(join4(pkg, "prisma", "schema.prisma"))) {
|
|
7601
7650
|
return {
|
|
7602
7651
|
root: pkg,
|
|
7603
|
-
schema:
|
|
7604
|
-
server:
|
|
7605
|
-
web: exists(
|
|
7652
|
+
schema: join4(pkg, "prisma", "schema.prisma"),
|
|
7653
|
+
server: join4(pkg, "dist", "server.js"),
|
|
7654
|
+
web: exists(join4(pkg, "web")) ? join4(pkg, "web") : null
|
|
7606
7655
|
};
|
|
7607
7656
|
}
|
|
7608
7657
|
const repo = resolve3(distDir2, "../..");
|
|
7609
|
-
if (exists(
|
|
7658
|
+
if (exists(join4(repo, "server", "prisma", "schema.prisma"))) {
|
|
7610
7659
|
return {
|
|
7611
7660
|
root: repo,
|
|
7612
|
-
schema:
|
|
7613
|
-
server:
|
|
7614
|
-
web: exists(
|
|
7661
|
+
schema: join4(repo, "server", "prisma", "schema.prisma"),
|
|
7662
|
+
server: join4(repo, "server", "dist", "server.js"),
|
|
7663
|
+
web: exists(join4(repo, "src", "dist")) ? join4(repo, "src", "dist") : null
|
|
7615
7664
|
};
|
|
7616
7665
|
}
|
|
7617
7666
|
throw new Error(`hanoman: prisma/schema.prisma tak ditemukan dari ${distDir2} \u2014 instalasi rusak?`);
|
|
@@ -7697,20 +7746,17 @@ __export(start_exports, {
|
|
|
7697
7746
|
default: () => start,
|
|
7698
7747
|
distDir: () => distDir,
|
|
7699
7748
|
ensurePrismaClient: () => ensurePrismaClient,
|
|
7700
|
-
ensureSpawnHelpersExecutable: () => ensureSpawnHelpersExecutable,
|
|
7701
7749
|
installLatest: () => installLatest,
|
|
7702
7750
|
migrateFailureHint: () => migrateFailureHint,
|
|
7703
7751
|
parseStartArgs: () => parseStartArgs,
|
|
7704
7752
|
planSupervisorStep: () => planSupervisorStep,
|
|
7705
7753
|
prismaClientUsable: () => prismaClientUsable,
|
|
7706
|
-
|
|
7707
|
-
serverEnv: () => serverEnv,
|
|
7708
|
-
spawnHelperPaths: () => spawnHelperPaths
|
|
7754
|
+
serverEnv: () => serverEnv
|
|
7709
7755
|
});
|
|
7710
7756
|
import { spawn, execFileSync as execFileSync2 } from "node:child_process";
|
|
7711
7757
|
import { createRequire } from "node:module";
|
|
7712
|
-
import { existsSync as
|
|
7713
|
-
import { dirname as
|
|
7758
|
+
import { existsSync as existsSync3, mkdirSync, chmodSync as chmodSync2 } from "node:fs";
|
|
7759
|
+
import { dirname as dirname4, resolve as resolvePath } from "node:path";
|
|
7714
7760
|
import { fileURLToPath } from "node:url";
|
|
7715
7761
|
function parseStartArgs(argv) {
|
|
7716
7762
|
const out = { port: null, host: null, db: null, migrate: true };
|
|
@@ -7751,7 +7797,7 @@ function parseStartArgs(argv) {
|
|
|
7751
7797
|
return out;
|
|
7752
7798
|
}
|
|
7753
7799
|
function distDir() {
|
|
7754
|
-
return
|
|
7800
|
+
return dirname4(fileURLToPath(import.meta.url));
|
|
7755
7801
|
}
|
|
7756
7802
|
function runPrisma(args, dbUrl) {
|
|
7757
7803
|
const prismaCli = prismaCliPath(createRequire(import.meta.url).resolve);
|
|
@@ -7802,43 +7848,8 @@ async function ensurePrismaClient(schema, dbUrl, ctx) {
|
|
|
7802
7848
|
return false;
|
|
7803
7849
|
}
|
|
7804
7850
|
}
|
|
7805
|
-
function
|
|
7806
|
-
|
|
7807
|
-
for (const name of listDir(join4(ptyDir, "prebuilds"))) dirs.push(join4(ptyDir, "prebuilds", name));
|
|
7808
|
-
return dirs.map((d) => join4(d, "spawn-helper")).filter(exists);
|
|
7809
|
-
}
|
|
7810
|
-
function ensureSpawnHelpersExecutable(paths2, ops) {
|
|
7811
|
-
const fixed = [];
|
|
7812
|
-
for (const p of paths2) {
|
|
7813
|
-
try {
|
|
7814
|
-
const mode = ops.mode(p) & 4095;
|
|
7815
|
-
if ((mode & 73) === 73) continue;
|
|
7816
|
-
ops.chmod(p, mode | 73);
|
|
7817
|
-
fixed.push(p);
|
|
7818
|
-
} catch {
|
|
7819
|
-
}
|
|
7820
|
-
}
|
|
7821
|
-
return fixed;
|
|
7822
|
-
}
|
|
7823
|
-
function repairSpawnHelper(ctx) {
|
|
7824
|
-
let ptyDir;
|
|
7825
|
-
try {
|
|
7826
|
-
ptyDir = dirname3(createRequire(import.meta.url).resolve("node-pty/package.json"));
|
|
7827
|
-
} catch {
|
|
7828
|
-
return;
|
|
7829
|
-
}
|
|
7830
|
-
const paths2 = spawnHelperPaths(ptyDir, (d) => {
|
|
7831
|
-
try {
|
|
7832
|
-
return readdirSync2(d);
|
|
7833
|
-
} catch {
|
|
7834
|
-
return [];
|
|
7835
|
-
}
|
|
7836
|
-
}, existsSync2);
|
|
7837
|
-
const fixed = ensureSpawnHelpersExecutable(paths2, {
|
|
7838
|
-
mode: (p) => statSync(p).mode,
|
|
7839
|
-
chmod: (p, m) => chmodSync(p, m)
|
|
7840
|
-
});
|
|
7841
|
-
if (fixed.length) ctx.stdout("hanoman \xB7 memperbaiki izin `spawn-helper` node-pty (sekali per instalasi)\n");
|
|
7851
|
+
function repairSpawnHelperEarly(ctx) {
|
|
7852
|
+
repairSpawnHelper(createRequire(import.meta.url).resolve, ctx.stdout);
|
|
7842
7853
|
}
|
|
7843
7854
|
function planSupervisorStep(code, restartsUsed) {
|
|
7844
7855
|
if (code !== UPDATE_RESTART_EXIT) return { action: "exit", code };
|
|
@@ -7886,8 +7897,8 @@ async function start(argv, ctx) {
|
|
|
7886
7897
|
let layout;
|
|
7887
7898
|
let dbUrl;
|
|
7888
7899
|
try {
|
|
7889
|
-
layout = resolveLayout(distDir(),
|
|
7890
|
-
dbUrl = opts.db ? `file:${resolvePath(opts.db)}` : resolveDbUrl(ctx.env,
|
|
7900
|
+
layout = resolveLayout(distDir(), existsSync3);
|
|
7901
|
+
dbUrl = opts.db ? `file:${resolvePath(opts.db)}` : resolveDbUrl(ctx.env, dirname4(layout.schema));
|
|
7891
7902
|
} catch (e) {
|
|
7892
7903
|
ctx.stderr(`${e.message}
|
|
7893
7904
|
`);
|
|
@@ -7898,15 +7909,15 @@ async function start(argv, ctx) {
|
|
|
7898
7909
|
`);
|
|
7899
7910
|
const home = resolveHome(ctx.env);
|
|
7900
7911
|
mkdirSync(home, { recursive: true, mode: 448 });
|
|
7901
|
-
|
|
7902
|
-
mkdirSync(
|
|
7903
|
-
if (!
|
|
7912
|
+
chmodSync2(home, 448);
|
|
7913
|
+
mkdirSync(dirname4(dbFilePath(dbUrl)), { recursive: true, mode: 448 });
|
|
7914
|
+
if (!existsSync3(layout.server)) {
|
|
7904
7915
|
ctx.stderr(`hanoman: bundle server tak ada di ${layout.server} \u2014 jalankan \`pnpm build\` dulu
|
|
7905
7916
|
`);
|
|
7906
7917
|
return 1;
|
|
7907
7918
|
}
|
|
7908
7919
|
if (!await ensurePrismaClient(layout.schema, dbUrl, ctx)) return 1;
|
|
7909
|
-
|
|
7920
|
+
repairSpawnHelperEarly(ctx);
|
|
7910
7921
|
if (opts.migrate) {
|
|
7911
7922
|
ctx.stdout(`hanoman \xB7 menerapkan migrasi ke ${dbFilePath(dbUrl)}
|
|
7912
7923
|
`);
|
|
@@ -7920,7 +7931,7 @@ ${hint}
|
|
|
7920
7931
|
return 1;
|
|
7921
7932
|
}
|
|
7922
7933
|
}
|
|
7923
|
-
if (
|
|
7934
|
+
if (existsSync3(dbFilePath(dbUrl))) chmodSync2(dbFilePath(dbUrl), 384);
|
|
7924
7935
|
const port = opts.port ?? Number(ctx.env.PORT ?? 8787);
|
|
7925
7936
|
const host = opts.host ?? ctx.env.HOST ?? "127.0.0.1";
|
|
7926
7937
|
ctx.stdout(`hanoman \xB7 http://${host === "0.0.0.0" ? "127.0.0.1" : host}:${port}
|
|
@@ -7985,8 +7996,8 @@ __export(doctor_exports, {
|
|
|
7985
7996
|
doctorReport: () => doctorReport
|
|
7986
7997
|
});
|
|
7987
7998
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
7988
|
-
import { accessSync, constants, existsSync as
|
|
7989
|
-
import { dirname as
|
|
7999
|
+
import { accessSync, constants, existsSync as existsSync4 } from "node:fs";
|
|
8000
|
+
import { dirname as dirname5 } from "node:path";
|
|
7990
8001
|
function doctorReport(p) {
|
|
7991
8002
|
const major = Number(/^v?(\d+)/.exec(p.node)?.[1] ?? 0);
|
|
7992
8003
|
const rows = [
|
|
@@ -8035,8 +8046,8 @@ async function doctor(_argv, ctx) {
|
|
|
8035
8046
|
let layout;
|
|
8036
8047
|
let db;
|
|
8037
8048
|
try {
|
|
8038
|
-
layout = resolveLayout(distDir(),
|
|
8039
|
-
db = dbFilePath(resolveDbUrl(ctx.env,
|
|
8049
|
+
layout = resolveLayout(distDir(), existsSync4);
|
|
8050
|
+
db = dbFilePath(resolveDbUrl(ctx.env, dirname5(layout.schema)));
|
|
8040
8051
|
} catch (e) {
|
|
8041
8052
|
ctx.stderr(`${e.message}
|
|
8042
8053
|
`);
|
|
@@ -8045,7 +8056,7 @@ async function doctor(_argv, ctx) {
|
|
|
8045
8056
|
const home = resolveHome(ctx.env);
|
|
8046
8057
|
let homeWritable = false;
|
|
8047
8058
|
try {
|
|
8048
|
-
accessSync(
|
|
8059
|
+
accessSync(existsSync4(home) ? home : dirname5(home), constants.W_OK);
|
|
8049
8060
|
homeWritable = true;
|
|
8050
8061
|
} catch {
|
|
8051
8062
|
}
|
|
@@ -28892,7 +28903,7 @@ __export(mcp_exports, {
|
|
|
28892
28903
|
});
|
|
28893
28904
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
28894
28905
|
import { homedir as homedir3 } from "node:os";
|
|
28895
|
-
import { join as
|
|
28906
|
+
import { join as join6 } from "node:path";
|
|
28896
28907
|
async function mcp(argv, ctx) {
|
|
28897
28908
|
const cfg = resolveMcpConfig(argv, ctx.env, () => tokenFile(ctx.env));
|
|
28898
28909
|
const say = (s2) => ctx.stderr(redactToken(s2, cfg.token) + "\n");
|
|
@@ -28923,9 +28934,9 @@ var init_mcp2 = __esm({
|
|
|
28923
28934
|
init_server();
|
|
28924
28935
|
init_redact();
|
|
28925
28936
|
tokenFile = (env) => {
|
|
28926
|
-
const home = env.HANOMAN_HOME ??
|
|
28937
|
+
const home = env.HANOMAN_HOME ?? join6(homedir3(), ".hanoman");
|
|
28927
28938
|
try {
|
|
28928
|
-
return readFileSync2(
|
|
28939
|
+
return readFileSync2(join6(home, "agent-token"), "utf8");
|
|
28929
28940
|
} catch {
|
|
28930
28941
|
return null;
|
|
28931
28942
|
}
|
|
@@ -28945,8 +28956,8 @@ __export(migrate_pg_exports, {
|
|
|
28945
28956
|
migrationSteps: () => migrationSteps,
|
|
28946
28957
|
parseMigrateArgs: () => parseMigrateArgs
|
|
28947
28958
|
});
|
|
28948
|
-
import { existsSync as
|
|
28949
|
-
import { dirname as
|
|
28959
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
28960
|
+
import { dirname as dirname6, resolve as resolvePath2 } from "node:path";
|
|
28950
28961
|
function coerceInt8(rows, fields, model) {
|
|
28951
28962
|
const cols = fields.filter((f) => f.dataTypeID === INT8_OID).map((f) => f.name);
|
|
28952
28963
|
if (!cols.length) return rows;
|
|
@@ -29013,8 +29024,8 @@ async function migratePg(argv, ctx) {
|
|
|
29013
29024
|
let layout;
|
|
29014
29025
|
let dbUrl;
|
|
29015
29026
|
try {
|
|
29016
|
-
layout = resolveLayout(distDir(),
|
|
29017
|
-
dbUrl = opts.to ? `file:${resolvePath2(opts.to)}` : resolveDbUrl(ctx.env,
|
|
29027
|
+
layout = resolveLayout(distDir(), existsSync5);
|
|
29028
|
+
dbUrl = opts.to ? `file:${resolvePath2(opts.to)}` : resolveDbUrl(ctx.env, dirname6(layout.schema));
|
|
29018
29029
|
} catch (e) {
|
|
29019
29030
|
ctx.stderr(`${e.message}
|
|
29020
29031
|
`);
|
|
@@ -29152,11 +29163,11 @@ var init_migrate_pg = __esm({
|
|
|
29152
29163
|
});
|
|
29153
29164
|
|
|
29154
29165
|
// src/config.ts
|
|
29155
|
-
import { readFileSync as readFileSync3, existsSync as
|
|
29156
|
-
import { join as
|
|
29166
|
+
import { readFileSync as readFileSync3, existsSync as existsSync6 } from "node:fs";
|
|
29167
|
+
import { join as join7 } from "node:path";
|
|
29157
29168
|
function loadConfig(repoRoot) {
|
|
29158
|
-
const p =
|
|
29159
|
-
const raw =
|
|
29169
|
+
const p = join7(repoRoot, "hanoman.config.json");
|
|
29170
|
+
const raw = existsSync6(p) ? JSON.parse(readFileSync3(p, "utf8")) : {};
|
|
29160
29171
|
return zHanomanConfig.parse(raw);
|
|
29161
29172
|
}
|
|
29162
29173
|
var init_config3 = __esm({
|
|
@@ -29168,12 +29179,12 @@ var init_config3 = __esm({
|
|
|
29168
29179
|
|
|
29169
29180
|
// src/repo.ts
|
|
29170
29181
|
import { spawnSync } from "node:child_process";
|
|
29171
|
-
import { join as
|
|
29182
|
+
import { join as join8 } from "node:path";
|
|
29172
29183
|
function resolveRepo(cwd) {
|
|
29173
29184
|
const r = spawnSync("git", ["rev-parse", "--show-toplevel"], { cwd, encoding: "utf8" });
|
|
29174
29185
|
const root = r.status === 0 ? r.stdout.trim() : cwd;
|
|
29175
29186
|
const { docsDir } = loadConfig(root);
|
|
29176
|
-
return { root, docsDir, indexPath:
|
|
29187
|
+
return { root, docsDir, indexPath: join8(root, docsDir, "README.md") };
|
|
29177
29188
|
}
|
|
29178
29189
|
var init_repo = __esm({
|
|
29179
29190
|
"src/repo.ts"() {
|
|
@@ -29184,7 +29195,7 @@ var init_repo = __esm({
|
|
|
29184
29195
|
|
|
29185
29196
|
// src/docs-model.ts
|
|
29186
29197
|
import { readFileSync as readFileSync4, readdirSync as readdirSync3, statSync as statSync2 } from "node:fs";
|
|
29187
|
-
import { join as
|
|
29198
|
+
import { join as join9, relative } from "node:path";
|
|
29188
29199
|
function parseIndex(indexPath) {
|
|
29189
29200
|
const md = readFileSync4(indexPath, "utf8");
|
|
29190
29201
|
const out = /* @__PURE__ */ new Set();
|
|
@@ -29201,7 +29212,7 @@ function walkDocs(docsRoot) {
|
|
|
29201
29212
|
const walk = (dir) => {
|
|
29202
29213
|
for (const name of readdirSync3(dir)) {
|
|
29203
29214
|
if (name.startsWith(".")) continue;
|
|
29204
|
-
const abs =
|
|
29215
|
+
const abs = join9(dir, name);
|
|
29205
29216
|
if (statSync2(abs).isDirectory()) walk(abs);
|
|
29206
29217
|
else out.push(relative(docsRoot, abs).split("\\").join("/"));
|
|
29207
29218
|
}
|
|
@@ -29233,17 +29244,17 @@ var init_docs_model = __esm({
|
|
|
29233
29244
|
});
|
|
29234
29245
|
|
|
29235
29246
|
// src/verify.ts
|
|
29236
|
-
import { join as
|
|
29237
|
-
import { existsSync as
|
|
29247
|
+
import { join as join10 } from "node:path";
|
|
29248
|
+
import { existsSync as existsSync7, readFileSync as readFileSync5 } from "node:fs";
|
|
29238
29249
|
function scanCoverage(cwd) {
|
|
29239
29250
|
const { root, docsDir, indexPath } = resolveRepo(cwd);
|
|
29240
|
-
const docsRoot =
|
|
29241
|
-
if (!
|
|
29242
|
-
if (!
|
|
29251
|
+
const docsRoot = join10(root, docsDir);
|
|
29252
|
+
if (!existsSync7(docsRoot)) return { coverage: 100, cats: [] };
|
|
29253
|
+
if (!existsSync7(indexPath)) throw new Error(`index Source of Truth tidak ada: ${indexPath}`);
|
|
29243
29254
|
const corpus = walkDocs(docsRoot);
|
|
29244
29255
|
const read = (rel) => {
|
|
29245
29256
|
try {
|
|
29246
|
-
return readFileSync5(
|
|
29257
|
+
return readFileSync5(join10(docsRoot, rel), "utf8");
|
|
29247
29258
|
} catch {
|
|
29248
29259
|
return null;
|
|
29249
29260
|
}
|
|
@@ -29317,23 +29328,23 @@ __export(docs_index_exports, {
|
|
|
29317
29328
|
default: () => docs_index_default
|
|
29318
29329
|
});
|
|
29319
29330
|
import { parseArgs as parseArgs2 } from "node:util";
|
|
29320
|
-
import { join as
|
|
29321
|
-
import { existsSync as
|
|
29331
|
+
import { join as join11 } from "node:path";
|
|
29332
|
+
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
|
|
29322
29333
|
async function docs_index_default(args, ctx) {
|
|
29323
29334
|
const { values } = parseArgs2({ args, options: { check: { type: "boolean" }, fix: { type: "boolean" } }, allowPositionals: true });
|
|
29324
29335
|
const { root, docsDir, indexPath } = resolveRepo(ctx.cwd);
|
|
29325
|
-
const docsRoot =
|
|
29336
|
+
const docsRoot = join11(root, docsDir);
|
|
29326
29337
|
const corpus = walkDocs(docsRoot);
|
|
29327
29338
|
const read = (rel) => {
|
|
29328
29339
|
try {
|
|
29329
|
-
return readFileSync7(
|
|
29340
|
+
return readFileSync7(join11(docsRoot, rel), "utf8");
|
|
29330
29341
|
} catch {
|
|
29331
29342
|
return null;
|
|
29332
29343
|
}
|
|
29333
29344
|
};
|
|
29334
29345
|
const linked = linkedSetFrom(INDEX_NAME, corpus, read);
|
|
29335
29346
|
const unlinked = corpus.filter((f) => f !== INDEX_NAME && !linked.has(f));
|
|
29336
|
-
const dangling = [...parseIndex(indexPath)].filter((p) => !
|
|
29347
|
+
const dangling = [...parseIndex(indexPath)].filter((p) => !existsSync8(join11(docsRoot, p)));
|
|
29337
29348
|
if (values.fix) {
|
|
29338
29349
|
for (const f of unlinked) addLink(indexPath, f, f.split("/")[0]);
|
|
29339
29350
|
ctx.stdout(`linked ${unlinked.length} doc(s)
|
|
@@ -29386,7 +29397,7 @@ var init_docs_link = __esm({
|
|
|
29386
29397
|
});
|
|
29387
29398
|
|
|
29388
29399
|
// src/release/pack.ts
|
|
29389
|
-
import { join as
|
|
29400
|
+
import { join as join12 } from "node:path";
|
|
29390
29401
|
function packageJsonFor(version3, deps) {
|
|
29391
29402
|
return {
|
|
29392
29403
|
name: PKG_NAME,
|
|
@@ -29424,17 +29435,17 @@ function verifyPackedDeps(pkg) {
|
|
|
29424
29435
|
}
|
|
29425
29436
|
function copyPlan(repo) {
|
|
29426
29437
|
return [
|
|
29427
|
-
{ from:
|
|
29428
|
-
{ from:
|
|
29429
|
-
{ from:
|
|
29430
|
-
{ from:
|
|
29431
|
-
{ from:
|
|
29432
|
-
{ from:
|
|
29433
|
-
{ from:
|
|
29438
|
+
{ from: join12(repo, "server/dist/server.js"), to: "dist/server.js" },
|
|
29439
|
+
{ from: join12(repo, "server/dist/build-info.json"), to: "dist/build-info.json" },
|
|
29440
|
+
{ from: join12(repo, "cli/dist/hanoman.js"), to: "dist/cli.js" },
|
|
29441
|
+
{ from: join12(repo, "src/dist"), to: "web", dir: true },
|
|
29442
|
+
{ from: join12(repo, "server/prisma/schema.prisma"), to: "prisma/schema.prisma" },
|
|
29443
|
+
{ from: join12(repo, "server/prisma/migrations"), to: "prisma/migrations", dir: true },
|
|
29444
|
+
{ from: join12(repo, "internal/docs/operations/npm-readme.md"), to: "README.md" },
|
|
29434
29445
|
// SPEC-489 · dibaca runtime oleh pickGuideFile (kandidat `<pkg>/docs/…`). Bukan README:
|
|
29435
29446
|
// README paket adalah npm-readme.md (berhadapan-MANUSIA), ini naskah berhadapan-AGEN.
|
|
29436
|
-
{ from:
|
|
29437
|
-
{ from:
|
|
29447
|
+
{ from: join12(repo, "docs/agent-integration.md"), to: "docs/agent-integration.md" },
|
|
29448
|
+
{ from: join12(repo, "LICENSE"), to: "LICENSE" }
|
|
29438
29449
|
];
|
|
29439
29450
|
}
|
|
29440
29451
|
var PKG_NAME, REPO_URL, RUNTIME_DEPS, REQUIRED_ARTIFACTS, BIN_SHIM;
|
|
@@ -29481,10 +29492,10 @@ var pack_exports = {};
|
|
|
29481
29492
|
__export(pack_exports, {
|
|
29482
29493
|
default: () => pack
|
|
29483
29494
|
});
|
|
29484
|
-
import { cpSync, existsSync as
|
|
29485
|
-
import { dirname as
|
|
29495
|
+
import { cpSync, existsSync as existsSync9, mkdirSync as mkdirSync2, readFileSync as readFileSync8, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
29496
|
+
import { dirname as dirname7, join as join13 } from "node:path";
|
|
29486
29497
|
function depVersions(repo) {
|
|
29487
|
-
const read = (p) => JSON.parse(readFileSync8(
|
|
29498
|
+
const read = (p) => JSON.parse(readFileSync8(join13(repo, p), "utf8"));
|
|
29488
29499
|
const server = read("server/package.json"), cli = read("cli/package.json");
|
|
29489
29500
|
const pools = [server.dependencies, server.devDependencies, cli.dependencies, cli.devDependencies];
|
|
29490
29501
|
const out = {};
|
|
@@ -29498,19 +29509,19 @@ function depVersions(repo) {
|
|
|
29498
29509
|
async function pack(argv, ctx) {
|
|
29499
29510
|
let repo;
|
|
29500
29511
|
try {
|
|
29501
|
-
repo = resolveLayout(distDir(),
|
|
29512
|
+
repo = resolveLayout(distDir(), existsSync9).root;
|
|
29502
29513
|
} catch (e) {
|
|
29503
29514
|
ctx.stderr(`${e.message}
|
|
29504
29515
|
`);
|
|
29505
29516
|
return 1;
|
|
29506
29517
|
}
|
|
29507
|
-
if (!
|
|
29518
|
+
if (!existsSync9(join13(repo, "server/prisma/schema.prisma"))) {
|
|
29508
29519
|
ctx.stderr("pack: hanya bisa dijalankan dari checkout repo hanoman\n");
|
|
29509
29520
|
return 1;
|
|
29510
29521
|
}
|
|
29511
29522
|
const outIdx = argv.indexOf("--out");
|
|
29512
|
-
const out = outIdx === -1 ?
|
|
29513
|
-
const version3 = JSON.parse(readFileSync8(
|
|
29523
|
+
const out = outIdx === -1 ? join13(repo, "dist-npm") : join13(repo, argv[outIdx + 1] ?? "dist-npm");
|
|
29524
|
+
const version3 = JSON.parse(readFileSync8(join13(repo, "package.json"), "utf8")).version;
|
|
29514
29525
|
if (!version3) {
|
|
29515
29526
|
ctx.stderr("pack: root package.json tanpa field version\n");
|
|
29516
29527
|
return 1;
|
|
@@ -29524,20 +29535,20 @@ async function pack(argv, ctx) {
|
|
|
29524
29535
|
return 1;
|
|
29525
29536
|
}
|
|
29526
29537
|
rmSync(out, { recursive: true, force: true });
|
|
29527
|
-
mkdirSync2(
|
|
29538
|
+
mkdirSync2(join13(out, "bin"), { recursive: true });
|
|
29528
29539
|
for (const item of copyPlan(repo)) {
|
|
29529
|
-
if (!
|
|
29540
|
+
if (!existsSync9(item.from)) {
|
|
29530
29541
|
ctx.stderr(`pack: artefak hilang \u2014 ${item.from} (sudah \`pnpm build\`?)
|
|
29531
29542
|
`);
|
|
29532
29543
|
return 1;
|
|
29533
29544
|
}
|
|
29534
|
-
const dest =
|
|
29535
|
-
mkdirSync2(
|
|
29545
|
+
const dest = join13(out, item.to);
|
|
29546
|
+
mkdirSync2(dirname7(dest), { recursive: true });
|
|
29536
29547
|
cpSync(item.from, dest, item.dir ? { recursive: true } : {});
|
|
29537
29548
|
}
|
|
29538
|
-
writeFileSync2(
|
|
29539
|
-
writeFileSync2(
|
|
29540
|
-
const missing = REQUIRED_ARTIFACTS.filter((a) => !
|
|
29549
|
+
writeFileSync2(join13(out, "bin/hanoman.mjs"), BIN_SHIM);
|
|
29550
|
+
writeFileSync2(join13(out, "package.json"), JSON.stringify(packageJsonFor(version3, deps), null, 2) + "\n");
|
|
29551
|
+
const missing = REQUIRED_ARTIFACTS.filter((a) => !existsSync9(join13(out, a)));
|
|
29541
29552
|
if (missing.length) {
|
|
29542
29553
|
ctx.stderr(`pack: artefak wajib hilang: ${missing.join(", ")}
|
|
29543
29554
|
`);
|
|
@@ -29563,9 +29574,9 @@ __export(verify_packed_exports, {
|
|
|
29563
29574
|
default: () => verifyPacked
|
|
29564
29575
|
});
|
|
29565
29576
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
29566
|
-
import { join as
|
|
29577
|
+
import { join as join14 } from "node:path";
|
|
29567
29578
|
function verifyPacked(_argv, ctx) {
|
|
29568
|
-
const path =
|
|
29579
|
+
const path = join14(process.cwd(), "package.json");
|
|
29569
29580
|
let pkg;
|
|
29570
29581
|
try {
|
|
29571
29582
|
pkg = JSON.parse(readFileSync9(path, "utf8"));
|