trellis 2.0.6 → 2.0.8
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/dist/cli/index.js +379 -29
- package/dist/core/index.js +5 -1
- package/dist/decisions/index.js +5 -2
- package/dist/embeddings/index.js +1 -1
- package/dist/{index-3s0eak0p.js → index-3ejh8k6v.js} +26 -3
- package/dist/{index-gkvhzm9f.js → index-5bhe57y9.js} +6 -1
- package/dist/{index-8pce39mh.js → index-65z0xfjw.js} +17 -3
- package/dist/{index-gnw8d7d6.js → index-k5kf7sd0.js} +32 -3
- package/dist/{index-1j1anhmr.js → index-s603ev6w.js} +489 -335
- package/dist/{index-fd4e26s4.js → index-v9b4hqa7.js} +23 -15
- package/dist/{index-cy9k1g6v.js → index-zf6htvnm.js} +1 -1
- package/dist/index.js +15 -7
- package/dist/ui/client.html +695 -0
- package/dist/vcs/index.js +3 -3
- package/package.json +2 -2
- package/src/cli/index.ts +78 -1
- package/src/engine.ts +45 -3
- package/src/ui/client.html +695 -0
- package/src/ui/server.ts +419 -0
- package/src/watcher/fs-watcher.ts +41 -3
- package/dist/transformers-m9je15kg.js +0 -32491
package/dist/cli/index.js
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
3
|
import {
|
|
4
|
-
TrellisVcsEngine
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import"../index-
|
|
4
|
+
TrellisVcsEngine,
|
|
5
|
+
init_engine
|
|
6
|
+
} from "../index-s603ev6w.js";
|
|
7
|
+
import"../index-5bhe57y9.js";
|
|
8
|
+
import"../index-3ejh8k6v.js";
|
|
8
9
|
import {
|
|
9
10
|
exports_embeddings,
|
|
10
11
|
init_embeddings
|
|
11
|
-
} from "../index-
|
|
12
|
+
} from "../index-zf6htvnm.js";
|
|
12
13
|
import {
|
|
14
|
+
buildRefIndex,
|
|
15
|
+
createResolverContext,
|
|
13
16
|
exports_links,
|
|
14
17
|
init_links
|
|
15
18
|
} from "../index-vkpkfwhq.js";
|
|
16
|
-
import"../index-
|
|
19
|
+
import"../index-65z0xfjw.js";
|
|
17
20
|
import {
|
|
18
|
-
createVcsOp
|
|
19
|
-
|
|
21
|
+
createVcsOp,
|
|
22
|
+
init_ops
|
|
23
|
+
} from "../index-v9b4hqa7.js";
|
|
20
24
|
import {
|
|
21
25
|
__commonJS,
|
|
22
26
|
__esm,
|
|
@@ -2261,6 +2265,303 @@ var init_reconciler = __esm(() => {
|
|
|
2261
2265
|
]);
|
|
2262
2266
|
});
|
|
2263
2267
|
|
|
2268
|
+
// src/ui/server.ts
|
|
2269
|
+
var exports_server = {};
|
|
2270
|
+
__export(exports_server, {
|
|
2271
|
+
startUIServer: () => startUIServer
|
|
2272
|
+
});
|
|
2273
|
+
import { readFileSync as readFileSync3, existsSync as existsSync5 } from "fs";
|
|
2274
|
+
import { join as join5, dirname as dirname4 } from "path";
|
|
2275
|
+
function buildGraph(engine) {
|
|
2276
|
+
const nodes = [];
|
|
2277
|
+
const edges = [];
|
|
2278
|
+
const nodeIds = new Set;
|
|
2279
|
+
const files = engine.trackedFiles();
|
|
2280
|
+
for (const f of files) {
|
|
2281
|
+
const id = `file:${f.path}`;
|
|
2282
|
+
nodes.push({
|
|
2283
|
+
id,
|
|
2284
|
+
label: f.path,
|
|
2285
|
+
type: "file",
|
|
2286
|
+
meta: { contentHash: f.contentHash }
|
|
2287
|
+
});
|
|
2288
|
+
nodeIds.add(id);
|
|
2289
|
+
}
|
|
2290
|
+
const milestones = engine.listMilestones();
|
|
2291
|
+
for (const m of milestones) {
|
|
2292
|
+
const id = `milestone:${m.id}`;
|
|
2293
|
+
nodes.push({
|
|
2294
|
+
id,
|
|
2295
|
+
label: m.message ?? m.id,
|
|
2296
|
+
type: "milestone",
|
|
2297
|
+
meta: {
|
|
2298
|
+
createdAt: m.createdAt,
|
|
2299
|
+
affectedFiles: m.affectedFiles,
|
|
2300
|
+
fromOpHash: m.fromOpHash,
|
|
2301
|
+
toOpHash: m.toOpHash
|
|
2302
|
+
}
|
|
2303
|
+
});
|
|
2304
|
+
nodeIds.add(id);
|
|
2305
|
+
for (const fp of m.affectedFiles ?? []) {
|
|
2306
|
+
const fileId = `file:${fp}`;
|
|
2307
|
+
if (nodeIds.has(fileId)) {
|
|
2308
|
+
edges.push({
|
|
2309
|
+
source: id,
|
|
2310
|
+
target: fileId,
|
|
2311
|
+
type: "milestone_file"
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
const issues = engine.listIssues();
|
|
2317
|
+
for (const iss of issues) {
|
|
2318
|
+
const id = `issue:${iss.id}`;
|
|
2319
|
+
nodes.push({
|
|
2320
|
+
id,
|
|
2321
|
+
label: iss.title ?? iss.id,
|
|
2322
|
+
type: "issue",
|
|
2323
|
+
meta: {
|
|
2324
|
+
status: iss.status,
|
|
2325
|
+
priority: iss.priority,
|
|
2326
|
+
labels: iss.labels,
|
|
2327
|
+
assignee: iss.assignee,
|
|
2328
|
+
createdAt: iss.createdAt,
|
|
2329
|
+
description: iss.description,
|
|
2330
|
+
criteria: iss.criteria
|
|
2331
|
+
}
|
|
2332
|
+
});
|
|
2333
|
+
nodeIds.add(id);
|
|
2334
|
+
if (iss.branchName) {
|
|
2335
|
+
const branchId = `branch:${iss.branchName}`;
|
|
2336
|
+
if (nodeIds.has(branchId)) {
|
|
2337
|
+
edges.push({
|
|
2338
|
+
source: id,
|
|
2339
|
+
target: branchId,
|
|
2340
|
+
type: "issue_branch"
|
|
2341
|
+
});
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
const branches = engine.listBranches();
|
|
2346
|
+
for (const b of branches) {
|
|
2347
|
+
const id = `branch:${b.name}`;
|
|
2348
|
+
if (!nodeIds.has(id)) {
|
|
2349
|
+
nodes.push({
|
|
2350
|
+
id,
|
|
2351
|
+
label: b.name,
|
|
2352
|
+
type: "branch",
|
|
2353
|
+
meta: {
|
|
2354
|
+
isCurrent: b.isCurrent,
|
|
2355
|
+
createdAt: b.createdAt
|
|
2356
|
+
}
|
|
2357
|
+
});
|
|
2358
|
+
nodeIds.add(id);
|
|
2359
|
+
}
|
|
2360
|
+
for (const iss of issues) {
|
|
2361
|
+
if (iss.branchName === b.name) {
|
|
2362
|
+
edges.push({
|
|
2363
|
+
source: `issue:${iss.id}`,
|
|
2364
|
+
target: id,
|
|
2365
|
+
type: "issue_branch"
|
|
2366
|
+
});
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
try {
|
|
2371
|
+
const mdFiles = [];
|
|
2372
|
+
for (const f of files) {
|
|
2373
|
+
if (f.path.endsWith(".md")) {
|
|
2374
|
+
const absPath = join5(engine.getRootPath(), f.path);
|
|
2375
|
+
if (existsSync5(absPath)) {
|
|
2376
|
+
mdFiles.push({
|
|
2377
|
+
path: f.path,
|
|
2378
|
+
content: readFileSync3(absPath, "utf-8")
|
|
2379
|
+
});
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
if (mdFiles.length > 0) {
|
|
2384
|
+
const ctx = createResolverContext({
|
|
2385
|
+
trackedFiles: () => files,
|
|
2386
|
+
listIssues: () => issues,
|
|
2387
|
+
listMilestones: () => milestones
|
|
2388
|
+
});
|
|
2389
|
+
const refIndex = buildRefIndex(mdFiles, ctx);
|
|
2390
|
+
for (const [filePath, refs] of refIndex.outgoing) {
|
|
2391
|
+
const sourceId = `file:${filePath}`;
|
|
2392
|
+
if (!nodeIds.has(sourceId))
|
|
2393
|
+
continue;
|
|
2394
|
+
for (const ref of refs) {
|
|
2395
|
+
const targetId = `${ref.namespace}:${ref.target}`;
|
|
2396
|
+
const candidateIds = [
|
|
2397
|
+
targetId,
|
|
2398
|
+
`file:${ref.target}`,
|
|
2399
|
+
`issue:${ref.target}`,
|
|
2400
|
+
`milestone:${ref.target}`
|
|
2401
|
+
];
|
|
2402
|
+
for (const cid of candidateIds) {
|
|
2403
|
+
if (nodeIds.has(cid) && cid !== sourceId) {
|
|
2404
|
+
edges.push({
|
|
2405
|
+
source: sourceId,
|
|
2406
|
+
target: cid,
|
|
2407
|
+
type: "wikilink",
|
|
2408
|
+
label: ref.target
|
|
2409
|
+
});
|
|
2410
|
+
break;
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
} catch {}
|
|
2417
|
+
return { nodes, edges };
|
|
2418
|
+
}
|
|
2419
|
+
function getNodeDetail(engine, nodeId) {
|
|
2420
|
+
const [type, ...rest] = nodeId.split(":");
|
|
2421
|
+
const id = rest.join(":");
|
|
2422
|
+
switch (type) {
|
|
2423
|
+
case "file": {
|
|
2424
|
+
const files = engine.trackedFiles();
|
|
2425
|
+
const file = files.find((f) => f.path === id);
|
|
2426
|
+
if (!file)
|
|
2427
|
+
return null;
|
|
2428
|
+
const ops = engine.log({ filePath: id, limit: 10 });
|
|
2429
|
+
return {
|
|
2430
|
+
type: "file",
|
|
2431
|
+
path: id,
|
|
2432
|
+
contentHash: file.contentHash,
|
|
2433
|
+
recentOps: ops.map((o) => ({
|
|
2434
|
+
kind: o.kind,
|
|
2435
|
+
timestamp: o.timestamp,
|
|
2436
|
+
hash: o.hash.slice(0, 24)
|
|
2437
|
+
}))
|
|
2438
|
+
};
|
|
2439
|
+
}
|
|
2440
|
+
case "milestone": {
|
|
2441
|
+
const milestones = engine.listMilestones();
|
|
2442
|
+
const m = milestones.find((ms) => ms.id === id);
|
|
2443
|
+
if (!m)
|
|
2444
|
+
return null;
|
|
2445
|
+
return { type: "milestone", ...m };
|
|
2446
|
+
}
|
|
2447
|
+
case "issue": {
|
|
2448
|
+
const issue = engine.getIssue(id);
|
|
2449
|
+
if (!issue)
|
|
2450
|
+
return null;
|
|
2451
|
+
return { type: "issue", ...issue };
|
|
2452
|
+
}
|
|
2453
|
+
case "branch": {
|
|
2454
|
+
const branches = engine.listBranches();
|
|
2455
|
+
const b = branches.find((br) => br.name === id);
|
|
2456
|
+
if (!b)
|
|
2457
|
+
return null;
|
|
2458
|
+
return { type: "branch", ...b };
|
|
2459
|
+
}
|
|
2460
|
+
default:
|
|
2461
|
+
return null;
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
async function startUIServer(opts) {
|
|
2465
|
+
const engine = new TrellisVcsEngine({ rootPath: opts.rootPath });
|
|
2466
|
+
engine.open();
|
|
2467
|
+
const clientHtml = readFileSync3(join5(dirname4(new URL(import.meta.url).pathname), "client.html"), "utf-8");
|
|
2468
|
+
let embeddingManager = null;
|
|
2469
|
+
function getEmbeddingManager() {
|
|
2470
|
+
if (!embeddingManager) {
|
|
2471
|
+
try {
|
|
2472
|
+
const { EmbeddingManager } = (init_embeddings(), __toCommonJS(exports_embeddings));
|
|
2473
|
+
const dbPath = join5(opts.rootPath, ".trellis", "embeddings.db");
|
|
2474
|
+
if (existsSync5(dbPath)) {
|
|
2475
|
+
embeddingManager = new EmbeddingManager(dbPath);
|
|
2476
|
+
}
|
|
2477
|
+
} catch {}
|
|
2478
|
+
}
|
|
2479
|
+
return embeddingManager;
|
|
2480
|
+
}
|
|
2481
|
+
const requestedPort = opts.port ?? 3333;
|
|
2482
|
+
const server = Bun.serve({
|
|
2483
|
+
port: requestedPort,
|
|
2484
|
+
async fetch(req) {
|
|
2485
|
+
const url = new URL(req.url);
|
|
2486
|
+
const path = url.pathname;
|
|
2487
|
+
const headers = {
|
|
2488
|
+
"Access-Control-Allow-Origin": "*",
|
|
2489
|
+
"Access-Control-Allow-Methods": "GET, OPTIONS",
|
|
2490
|
+
"Access-Control-Allow-Headers": "Content-Type"
|
|
2491
|
+
};
|
|
2492
|
+
if (req.method === "OPTIONS") {
|
|
2493
|
+
return new Response(null, { status: 204, headers });
|
|
2494
|
+
}
|
|
2495
|
+
if (path === "/api/graph") {
|
|
2496
|
+
const graph = buildGraph(engine);
|
|
2497
|
+
return Response.json(graph, { headers });
|
|
2498
|
+
}
|
|
2499
|
+
if (path === "/api/search") {
|
|
2500
|
+
const query = url.searchParams.get("q");
|
|
2501
|
+
if (!query) {
|
|
2502
|
+
return Response.json({ error: "Missing ?q= parameter" }, { status: 400, headers });
|
|
2503
|
+
}
|
|
2504
|
+
const limit = parseInt(url.searchParams.get("limit") ?? "10", 10);
|
|
2505
|
+
const typeFilter = url.searchParams.get("type");
|
|
2506
|
+
const mgr = getEmbeddingManager();
|
|
2507
|
+
if (!mgr) {
|
|
2508
|
+
return Response.json({
|
|
2509
|
+
results: [],
|
|
2510
|
+
message: "No embedding index. Run `trellis reindex` first."
|
|
2511
|
+
}, { headers });
|
|
2512
|
+
}
|
|
2513
|
+
try {
|
|
2514
|
+
const searchOpts = { limit };
|
|
2515
|
+
if (typeFilter) {
|
|
2516
|
+
searchOpts.types = typeFilter.split(",").map((t) => t.trim());
|
|
2517
|
+
}
|
|
2518
|
+
const results = await mgr.search(query, searchOpts);
|
|
2519
|
+
return Response.json({
|
|
2520
|
+
results: results.map((r) => ({
|
|
2521
|
+
score: r.score,
|
|
2522
|
+
chunkType: r.chunk.chunkType,
|
|
2523
|
+
filePath: r.chunk.filePath,
|
|
2524
|
+
entityId: r.chunk.entityId,
|
|
2525
|
+
content: r.chunk.content
|
|
2526
|
+
}))
|
|
2527
|
+
}, { headers });
|
|
2528
|
+
} catch (err) {
|
|
2529
|
+
return Response.json({ error: err.message }, { status: 500, headers });
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
if (path.startsWith("/api/node/")) {
|
|
2533
|
+
const nodeId = decodeURIComponent(path.slice("/api/node/".length));
|
|
2534
|
+
const detail = getNodeDetail(engine, nodeId);
|
|
2535
|
+
if (!detail) {
|
|
2536
|
+
return Response.json({ error: "Node not found" }, { status: 404, headers });
|
|
2537
|
+
}
|
|
2538
|
+
return Response.json(detail, { headers });
|
|
2539
|
+
}
|
|
2540
|
+
if (path === "/" || path === "/index.html") {
|
|
2541
|
+
return new Response(clientHtml, {
|
|
2542
|
+
headers: { ...headers, "Content-Type": "text/html; charset=utf-8" }
|
|
2543
|
+
});
|
|
2544
|
+
}
|
|
2545
|
+
return new Response("Not Found", { status: 404, headers });
|
|
2546
|
+
}
|
|
2547
|
+
});
|
|
2548
|
+
return {
|
|
2549
|
+
port: server.port,
|
|
2550
|
+
stop: () => {
|
|
2551
|
+
server.stop();
|
|
2552
|
+
if (embeddingManager) {
|
|
2553
|
+
try {
|
|
2554
|
+
embeddingManager.close();
|
|
2555
|
+
} catch {}
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
};
|
|
2559
|
+
}
|
|
2560
|
+
var init_server = __esm(() => {
|
|
2561
|
+
init_engine();
|
|
2562
|
+
init_links();
|
|
2563
|
+
});
|
|
2564
|
+
|
|
2264
2565
|
// node_modules/commander/esm.mjs
|
|
2265
2566
|
var import__ = __toESM(require_commander(), 1);
|
|
2266
2567
|
var {
|
|
@@ -2767,7 +3068,8 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
|
2767
3068
|
var source_default = chalk;
|
|
2768
3069
|
|
|
2769
3070
|
// src/cli/index.ts
|
|
2770
|
-
|
|
3071
|
+
init_engine();
|
|
3072
|
+
import { resolve, join as join6 } from "path";
|
|
2771
3073
|
|
|
2772
3074
|
// src/git/git-reader.ts
|
|
2773
3075
|
import { execSync } from "child_process";
|
|
@@ -2867,6 +3169,8 @@ class GitReader {
|
|
|
2867
3169
|
}
|
|
2868
3170
|
|
|
2869
3171
|
// src/git/git-importer.ts
|
|
3172
|
+
init_engine();
|
|
3173
|
+
init_ops();
|
|
2870
3174
|
import { existsSync as existsSync2, mkdirSync } from "fs";
|
|
2871
3175
|
import { join as join2 } from "path";
|
|
2872
3176
|
async function importFromGit(opts) {
|
|
@@ -3067,6 +3371,7 @@ class ImportEngine {
|
|
|
3067
3371
|
}
|
|
3068
3372
|
|
|
3069
3373
|
// src/git/git-exporter.ts
|
|
3374
|
+
init_engine();
|
|
3070
3375
|
import { execSync as execSync2 } from "child_process";
|
|
3071
3376
|
import { existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync, unlinkSync } from "fs";
|
|
3072
3377
|
import { join as join3, dirname as dirname2 } from "path";
|
|
@@ -3329,7 +3634,22 @@ program2.command("init").description("Initialize a new TrellisVCS repository in
|
|
|
3329
3634
|
return;
|
|
3330
3635
|
}
|
|
3331
3636
|
const engine = new TrellisVcsEngine({ rootPath });
|
|
3332
|
-
|
|
3637
|
+
let renderedProgress = false;
|
|
3638
|
+
const result = await engine.initRepo({
|
|
3639
|
+
onProgress: (progress) => {
|
|
3640
|
+
renderedProgress = true;
|
|
3641
|
+
if (progress.phase === "done") {
|
|
3642
|
+
process.stdout.write("\r\x1B[2K");
|
|
3643
|
+
return;
|
|
3644
|
+
}
|
|
3645
|
+
const label = progress.phase === "discovering" ? "Discovering\u2026" : progress.phase === "hashing" ? "Hashing\u2026" : "Recording\u2026";
|
|
3646
|
+
process.stdout.write(`\r\x1B[2K ${source_default.dim(label)} ${progress.message}`);
|
|
3647
|
+
}
|
|
3648
|
+
});
|
|
3649
|
+
if (renderedProgress) {
|
|
3650
|
+
process.stdout.write(`
|
|
3651
|
+
`);
|
|
3652
|
+
}
|
|
3333
3653
|
console.log(source_default.green("\u2713 Initialized TrellisVCS repository"));
|
|
3334
3654
|
console.log(` ${source_default.dim("Path:")} ${rootPath}`);
|
|
3335
3655
|
console.log(` ${source_default.dim("Ops:")} ${result.opsCreated} initial operations recorded`);
|
|
@@ -3754,9 +4074,9 @@ program2.command("parse").description("Parse a file into AST-level semantic enti
|
|
|
3754
4074
|
const engine = new TrellisVcsEngine({ rootPath });
|
|
3755
4075
|
if (TrellisVcsEngine.isRepo(rootPath))
|
|
3756
4076
|
engine.open();
|
|
3757
|
-
const { readFileSync:
|
|
4077
|
+
const { readFileSync: readFileSync4 } = __require("fs");
|
|
3758
4078
|
const filePath = resolve(file);
|
|
3759
|
-
const content =
|
|
4079
|
+
const content = readFileSync4(filePath, "utf-8");
|
|
3760
4080
|
const result = engine.parseFile(content, file);
|
|
3761
4081
|
if (!result) {
|
|
3762
4082
|
console.log(source_default.dim(`No parser available for: ${file}`));
|
|
@@ -3792,9 +4112,9 @@ program2.command("sdiff").description("Show semantic diff between two versions o
|
|
|
3792
4112
|
const engine = new TrellisVcsEngine({ rootPath });
|
|
3793
4113
|
if (TrellisVcsEngine.isRepo(rootPath))
|
|
3794
4114
|
engine.open();
|
|
3795
|
-
const { readFileSync:
|
|
3796
|
-
const oldContent =
|
|
3797
|
-
const newContent =
|
|
4115
|
+
const { readFileSync: readFileSync4 } = __require("fs");
|
|
4116
|
+
const oldContent = readFileSync4(resolve(fileA), "utf-8");
|
|
4117
|
+
const newContent = readFileSync4(resolve(fileB), "utf-8");
|
|
3798
4118
|
const patches = engine.semanticDiff(oldContent, newContent, fileA);
|
|
3799
4119
|
if (patches.length === 0) {
|
|
3800
4120
|
console.log(source_default.dim("No semantic differences."));
|
|
@@ -4456,7 +4776,7 @@ decisionCmd.command("chain").description("Trace all decisions that affected a gi
|
|
|
4456
4776
|
});
|
|
4457
4777
|
program2.command("identity").description("Manage local identity (Ed25519 key pair)").argument("[action]", '"init" or "show" (default: show)').option("-p, --path <path>", "Repository path", ".").option("--name <name>", "Display name for new identity").option("--email <email>", "Email for new identity").action((action, opts) => {
|
|
4458
4778
|
const rootPath = resolve(opts.path);
|
|
4459
|
-
const trellisDir =
|
|
4779
|
+
const trellisDir = join6(rootPath, ".trellis");
|
|
4460
4780
|
if (action === "init") {
|
|
4461
4781
|
if (hasIdentity(trellisDir)) {
|
|
4462
4782
|
console.error(source_default.yellow("Identity already exists. Use `trellis identity` to view it."));
|
|
@@ -4500,31 +4820,31 @@ program2.command("refs").description("List wiki-link references in files or find
|
|
|
4500
4820
|
}
|
|
4501
4821
|
const engine = new TrellisVcsEngine({ rootPath });
|
|
4502
4822
|
engine.open();
|
|
4503
|
-
const { readFileSync:
|
|
4823
|
+
const { readFileSync: readFileSync4 } = __require("fs");
|
|
4504
4824
|
const {
|
|
4505
4825
|
parseFileRefs,
|
|
4506
|
-
buildRefIndex,
|
|
4507
|
-
getOutgoingRefs,
|
|
4508
|
-
getBacklinks,
|
|
4826
|
+
buildRefIndex: buildRefIndex2,
|
|
4827
|
+
getOutgoingRefs: getOutgoingRefs2,
|
|
4828
|
+
getBacklinks: getBacklinks2,
|
|
4509
4829
|
getIndexStats
|
|
4510
4830
|
} = (init_links(), __toCommonJS(exports_links));
|
|
4511
4831
|
const {
|
|
4512
4832
|
resolveRef,
|
|
4513
4833
|
resolveRefs,
|
|
4514
|
-
createResolverContext
|
|
4834
|
+
createResolverContext: createResolverContext2
|
|
4515
4835
|
} = (init_links(), __toCommonJS(exports_links));
|
|
4516
4836
|
const { StaleRefRegistry, getDiagnostics } = (init_links(), __toCommonJS(exports_links));
|
|
4517
|
-
const resolverCtx =
|
|
4837
|
+
const resolverCtx = createResolverContext2(engine);
|
|
4518
4838
|
const trackedFiles = engine.trackedFiles();
|
|
4519
4839
|
const fileContents = [];
|
|
4520
4840
|
for (const f of trackedFiles) {
|
|
4521
4841
|
try {
|
|
4522
|
-
const absPath =
|
|
4523
|
-
const content =
|
|
4842
|
+
const absPath = join6(rootPath, f.path);
|
|
4843
|
+
const content = readFileSync4(absPath, "utf-8");
|
|
4524
4844
|
fileContents.push({ path: f.path, content });
|
|
4525
4845
|
} catch {}
|
|
4526
4846
|
}
|
|
4527
|
-
const index =
|
|
4847
|
+
const index = buildRefIndex2(fileContents, resolverCtx);
|
|
4528
4848
|
if (opts.stats) {
|
|
4529
4849
|
const stats = getIndexStats(index);
|
|
4530
4850
|
console.log(source_default.bold(`Reference Index Stats
|
|
@@ -4547,7 +4867,7 @@ program2.command("refs").description("List wiki-link references in files or find
|
|
|
4547
4867
|
];
|
|
4548
4868
|
let found = false;
|
|
4549
4869
|
for (const eid of candidates) {
|
|
4550
|
-
const sources =
|
|
4870
|
+
const sources = getBacklinks2(index, eid);
|
|
4551
4871
|
if (sources.length > 0) {
|
|
4552
4872
|
console.log(source_default.bold(`Backlinks for ${source_default.cyan(eid)} (${sources.length})
|
|
4553
4873
|
`));
|
|
@@ -4599,7 +4919,7 @@ program2.command("refs").description("List wiki-link references in files or find
|
|
|
4599
4919
|
return;
|
|
4600
4920
|
}
|
|
4601
4921
|
if (file) {
|
|
4602
|
-
const refs =
|
|
4922
|
+
const refs = getOutgoingRefs2(index, file);
|
|
4603
4923
|
if (refs.length === 0) {
|
|
4604
4924
|
console.log(source_default.dim(`No [[...]] references found in: ${file}`));
|
|
4605
4925
|
return;
|
|
@@ -4640,7 +4960,7 @@ program2.command("search").description("Semantic search across all embedded cont
|
|
|
4640
4960
|
const engine = new TrellisVcsEngine({ rootPath });
|
|
4641
4961
|
engine.open();
|
|
4642
4962
|
const { EmbeddingManager } = (init_embeddings(), __toCommonJS(exports_embeddings));
|
|
4643
|
-
const dbPath =
|
|
4963
|
+
const dbPath = join6(rootPath, ".trellis", "embeddings.db");
|
|
4644
4964
|
const manager = new EmbeddingManager(dbPath);
|
|
4645
4965
|
try {
|
|
4646
4966
|
const searchOpts = {
|
|
@@ -4678,7 +4998,7 @@ program2.command("reindex").description("Rebuild the semantic embedding index").
|
|
|
4678
4998
|
const engine = new TrellisVcsEngine({ rootPath });
|
|
4679
4999
|
engine.open();
|
|
4680
5000
|
const { EmbeddingManager } = (init_embeddings(), __toCommonJS(exports_embeddings));
|
|
4681
|
-
const dbPath =
|
|
5001
|
+
const dbPath = join6(rootPath, ".trellis", "embeddings.db");
|
|
4682
5002
|
const manager = new EmbeddingManager(dbPath);
|
|
4683
5003
|
try {
|
|
4684
5004
|
console.log(source_default.dim("Loading embedding model\u2026"));
|
|
@@ -4690,6 +5010,36 @@ program2.command("reindex").description("Rebuild the semantic embedding index").
|
|
|
4690
5010
|
manager.close();
|
|
4691
5011
|
}
|
|
4692
5012
|
});
|
|
5013
|
+
program2.command("ui").description("Launch the interactive graph explorer in your browser").option("-p, --path <path>", "Repository path", ".").option("--port <port>", "Server port", "3333").option("--no-open", "Do not auto-open browser").action(async (opts) => {
|
|
5014
|
+
const rootPath = resolve(opts.path);
|
|
5015
|
+
if (!TrellisVcsEngine.isRepo(rootPath)) {
|
|
5016
|
+
console.error(source_default.red("Not a TrellisVCS repository. Run `trellis init` first."));
|
|
5017
|
+
process.exit(1);
|
|
5018
|
+
}
|
|
5019
|
+
const { startUIServer: startUIServer2 } = (init_server(), __toCommonJS(exports_server));
|
|
5020
|
+
const port = parseInt(opts.port, 10) || 3000;
|
|
5021
|
+
try {
|
|
5022
|
+
const server = await startUIServer2({ rootPath, port });
|
|
5023
|
+
const url = `http://localhost:${server.port}`;
|
|
5024
|
+
console.log(source_default.green(`\u2713 Trellis Graph Explorer running at ${source_default.bold(url)}`));
|
|
5025
|
+
console.log(source_default.dim(` Press Ctrl+C to stop
|
|
5026
|
+
`));
|
|
5027
|
+
if (opts.open !== false) {
|
|
5028
|
+
const { exec } = __require("child_process");
|
|
5029
|
+
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
5030
|
+
exec(`${cmd} ${url}`);
|
|
5031
|
+
}
|
|
5032
|
+
process.on("SIGINT", () => {
|
|
5033
|
+
server.stop();
|
|
5034
|
+
console.log(source_default.dim(`
|
|
5035
|
+
Server stopped.`));
|
|
5036
|
+
process.exit(0);
|
|
5037
|
+
});
|
|
5038
|
+
} catch (err) {
|
|
5039
|
+
console.error(source_default.red(`Failed to start server: ${err.message}`));
|
|
5040
|
+
process.exit(1);
|
|
5041
|
+
}
|
|
5042
|
+
});
|
|
4693
5043
|
function formatOpKind(kind) {
|
|
4694
5044
|
const kindMap = {
|
|
4695
5045
|
"vcs:fileAdd": source_default.green("+add"),
|
package/dist/core/index.js
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
EAVStore,
|
|
4
4
|
flatten,
|
|
5
|
+
init_eav_store,
|
|
5
6
|
jsonEntityFacts
|
|
6
|
-
} from "../index-
|
|
7
|
+
} from "../index-5bhe57y9.js";
|
|
7
8
|
import"../index-a76rekgs.js";
|
|
9
|
+
|
|
10
|
+
// src/core/index.ts
|
|
11
|
+
init_eav_store();
|
|
8
12
|
export {
|
|
9
13
|
jsonEntityFacts,
|
|
10
14
|
flatten,
|
package/dist/decisions/index.js
CHANGED
|
@@ -3,12 +3,15 @@ import {
|
|
|
3
3
|
HookRegistry,
|
|
4
4
|
getDecision,
|
|
5
5
|
getDecisionChain,
|
|
6
|
+
init_decisions,
|
|
6
7
|
queryDecisions,
|
|
7
8
|
recordDecision,
|
|
8
9
|
wrapToolHandler
|
|
9
|
-
} from "../index-
|
|
10
|
-
import"../index-
|
|
10
|
+
} from "../index-65z0xfjw.js";
|
|
11
|
+
import"../index-v9b4hqa7.js";
|
|
11
12
|
import"../index-a76rekgs.js";
|
|
13
|
+
init_decisions();
|
|
14
|
+
|
|
12
15
|
export {
|
|
13
16
|
wrapToolHandler,
|
|
14
17
|
recordDecision,
|
package/dist/embeddings/index.js
CHANGED
|
@@ -5,9 +5,12 @@ import {
|
|
|
5
5
|
decisionEntityId,
|
|
6
6
|
dirEntityId,
|
|
7
7
|
fileEntityId,
|
|
8
|
+
init_ops,
|
|
9
|
+
init_types,
|
|
8
10
|
issueEntityId
|
|
9
|
-
} from "./index-
|
|
11
|
+
} from "./index-v9b4hqa7.js";
|
|
10
12
|
import {
|
|
13
|
+
__esm,
|
|
11
14
|
__require
|
|
12
15
|
} from "./index-a76rekgs.js";
|
|
13
16
|
|
|
@@ -377,6 +380,9 @@ function decompose(op) {
|
|
|
377
380
|
}
|
|
378
381
|
return result;
|
|
379
382
|
}
|
|
383
|
+
var init_decompose = __esm(() => {
|
|
384
|
+
init_types();
|
|
385
|
+
});
|
|
380
386
|
|
|
381
387
|
// src/vcs/blob-store.ts
|
|
382
388
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -452,6 +458,7 @@ class BlobStore {
|
|
|
452
458
|
return Array.from(new Uint8Array(buffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
453
459
|
}
|
|
454
460
|
}
|
|
461
|
+
var init_blob_store = () => {};
|
|
455
462
|
|
|
456
463
|
// src/vcs/branch.ts
|
|
457
464
|
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
@@ -525,6 +532,9 @@ function loadBranchState(rootPath) {
|
|
|
525
532
|
}
|
|
526
533
|
return { currentBranch: "main" };
|
|
527
534
|
}
|
|
535
|
+
var init_branch = __esm(() => {
|
|
536
|
+
init_ops();
|
|
537
|
+
});
|
|
528
538
|
|
|
529
539
|
// src/vcs/milestone.ts
|
|
530
540
|
async function createMilestone(ctx, message, opts) {
|
|
@@ -585,6 +595,9 @@ function listMilestones(ctx) {
|
|
|
585
595
|
};
|
|
586
596
|
});
|
|
587
597
|
}
|
|
598
|
+
var init_milestone = __esm(() => {
|
|
599
|
+
init_ops();
|
|
600
|
+
});
|
|
588
601
|
|
|
589
602
|
// src/vcs/checkpoint.ts
|
|
590
603
|
async function createCheckpoint(ctx, trigger = "manual") {
|
|
@@ -609,6 +622,9 @@ function listCheckpoints(ctx) {
|
|
|
609
622
|
};
|
|
610
623
|
});
|
|
611
624
|
}
|
|
625
|
+
var init_checkpoint = __esm(() => {
|
|
626
|
+
init_ops();
|
|
627
|
+
});
|
|
612
628
|
|
|
613
629
|
// src/vcs/diff.ts
|
|
614
630
|
function diffFileStates(stateA, stateB, blobStore) {
|
|
@@ -849,6 +865,7 @@ function createHunk(edits, start, end) {
|
|
|
849
865
|
edits: hunkEdits
|
|
850
866
|
};
|
|
851
867
|
}
|
|
868
|
+
var init_diff = () => {};
|
|
852
869
|
|
|
853
870
|
// src/vcs/merge.ts
|
|
854
871
|
function threeWayMerge(base, ours, theirs, blobStore) {
|
|
@@ -1122,13 +1139,13 @@ function lcsMatch(a, b) {
|
|
|
1122
1139
|
}
|
|
1123
1140
|
return matches;
|
|
1124
1141
|
}
|
|
1142
|
+
var init_merge = () => {};
|
|
1125
1143
|
|
|
1126
1144
|
// src/vcs/issue.ts
|
|
1127
1145
|
import { exec } from "child_process";
|
|
1128
1146
|
import { promisify } from "util";
|
|
1129
1147
|
import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync2 } from "fs";
|
|
1130
1148
|
import { join as join3, dirname as dirname2 } from "path";
|
|
1131
|
-
var execAsync = promisify(exec);
|
|
1132
1149
|
function getIssueCounterPath(rootPath) {
|
|
1133
1150
|
return join3(rootPath, ".trellis", "issue-counter.json");
|
|
1134
1151
|
}
|
|
@@ -1552,5 +1569,11 @@ function checkCompletionReadiness(ctx) {
|
|
|
1552
1569
|
return { ready, queue, paused, inProgress, summary: parts.join(`
|
|
1553
1570
|
`) };
|
|
1554
1571
|
}
|
|
1572
|
+
var execAsync;
|
|
1573
|
+
var init_issue = __esm(() => {
|
|
1574
|
+
init_ops();
|
|
1575
|
+
init_types();
|
|
1576
|
+
execAsync = promisify(exec);
|
|
1577
|
+
});
|
|
1555
1578
|
|
|
1556
|
-
export { decompose, BlobStore, createBranch, switchBranch, listBranches, deleteBranch, saveBranchState, loadBranchState, createMilestone, listMilestones, createCheckpoint, listCheckpoints, diffFileStates, buildFileStateAtOp, diffOpRange, generateUnifiedDiff, myersDiff, threeWayMerge, threeWayTextMerge, createIssue, updateIssue, startIssue, pauseIssue, resumeIssue, closeIssue, triageIssue, reopenIssue, assignIssue, blockIssue, unblockIssue, addCriterion, setCriterionStatus, runCriteria, listIssues, getIssue, getActiveIssues, checkCompletionReadiness };
|
|
1579
|
+
export { decompose, init_decompose, BlobStore, init_blob_store, createBranch, switchBranch, listBranches, deleteBranch, saveBranchState, loadBranchState, init_branch, createMilestone, listMilestones, init_milestone, createCheckpoint, listCheckpoints, init_checkpoint, diffFileStates, buildFileStateAtOp, diffOpRange, generateUnifiedDiff, myersDiff, init_diff, threeWayMerge, threeWayTextMerge, init_merge, createIssue, updateIssue, startIssue, pauseIssue, resumeIssue, closeIssue, triageIssue, reopenIssue, assignIssue, blockIssue, unblockIssue, addCriterion, setCriterionStatus, runCriteria, listIssues, getIssue, getActiveIssues, checkCompletionReadiness, init_issue };
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
__esm
|
|
4
|
+
} from "./index-a76rekgs.js";
|
|
5
|
+
|
|
2
6
|
// src/core/store/eav-store.ts
|
|
3
7
|
function* flatten(obj, base = "") {
|
|
4
8
|
if (Array.isArray(obj)) {
|
|
@@ -317,5 +321,6 @@ class EAVStore {
|
|
|
317
321
|
}
|
|
318
322
|
}
|
|
319
323
|
}
|
|
324
|
+
var init_eav_store = () => {};
|
|
320
325
|
|
|
321
|
-
export { flatten, jsonEntityFacts, EAVStore };
|
|
326
|
+
export { flatten, jsonEntityFacts, EAVStore, init_eav_store };
|