@themoltnet/legreffier 0.26.0 → 0.26.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/dist/index.js +58 -22
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { parseArgs } from "node:util";
|
|
4
4
|
import { useInput, Box, Text, useApp, render } from "ink";
|
|
5
5
|
import { execFileSync } from "node:child_process";
|
|
6
|
-
import { join } from "node:path";
|
|
6
|
+
import { join, dirname } from "node:path";
|
|
7
7
|
import { useState, useEffect, useReducer, useRef } from "react";
|
|
8
8
|
import figlet from "figlet";
|
|
9
9
|
import { randomBytes as randomBytes$2, createHash } from "crypto";
|
|
@@ -1198,7 +1198,9 @@ class MoltNetError extends Error {
|
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
1200
|
function problemToError(problem, statusCode) {
|
|
1201
|
-
|
|
1201
|
+
const title = problem.title ?? "Request failed";
|
|
1202
|
+
const message = problem.detail ? `${title}: ${problem.detail}` : title;
|
|
1203
|
+
return new MoltNetError(message, {
|
|
1202
1204
|
code: problem.type ?? problem.code ?? "UNKNOWN",
|
|
1203
1205
|
statusCode,
|
|
1204
1206
|
detail: problem.detail
|
|
@@ -5321,10 +5323,19 @@ const POLL_INTERVAL_MS = 5e3;
|
|
|
5321
5323
|
function isProblemDetails(err2) {
|
|
5322
5324
|
return typeof err2 === "object" && err2 !== null && "title" in err2 && typeof err2.title === "string" && "status" in err2 && typeof err2.status === "number";
|
|
5323
5325
|
}
|
|
5326
|
+
function isValidationProblemDetails(err2) {
|
|
5327
|
+
return isProblemDetails(err2) && "errors" in err2 && Array.isArray(err2.errors);
|
|
5328
|
+
}
|
|
5324
5329
|
function toErrorMessage(err2) {
|
|
5325
5330
|
if (err2 instanceof Error) {
|
|
5326
5331
|
return err2.message;
|
|
5327
5332
|
}
|
|
5333
|
+
if (isValidationProblemDetails(err2)) {
|
|
5334
|
+
const base2 = problemToError(err2, err2.status).message;
|
|
5335
|
+
const fieldErrors = err2.errors.map((e) => ` ${e.field}: ${e.message}`).join("\n");
|
|
5336
|
+
return fieldErrors ? `${base2}
|
|
5337
|
+
${fieldErrors}` : base2;
|
|
5338
|
+
}
|
|
5328
5339
|
if (isProblemDetails(err2)) {
|
|
5329
5340
|
return problemToError(err2, err2.status).message;
|
|
5330
5341
|
}
|
|
@@ -5381,32 +5392,53 @@ async function pollUntil(baseUrl, workflowId, targetStatuses, onTick) {
|
|
|
5381
5392
|
}
|
|
5382
5393
|
const SKILL_VERSION = "legreffier-v0.1.0";
|
|
5383
5394
|
const SKILL_FALLBACK = "main";
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
return `https://raw.githubusercontent.com/getlarge/themoltnet/${ref}/.claude/skills/${name2}/SKILL.md`;
|
|
5395
|
+
function skillFileUrl(name2, ref, file) {
|
|
5396
|
+
return `https://raw.githubusercontent.com/getlarge/themoltnet/${ref}/.claude/skills/${name2}/${file}`;
|
|
5387
5397
|
}
|
|
5388
|
-
const SKILLS =
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
+
const SKILLS = [
|
|
5399
|
+
{ name: "legreffier", files: ["SKILL.md"] },
|
|
5400
|
+
{
|
|
5401
|
+
name: "legreffier-scan",
|
|
5402
|
+
files: [
|
|
5403
|
+
"SKILL.md",
|
|
5404
|
+
"references/scan-flows.md",
|
|
5405
|
+
"references/path-discovery.md",
|
|
5406
|
+
"references/content-templates.md"
|
|
5407
|
+
]
|
|
5408
|
+
},
|
|
5409
|
+
{
|
|
5410
|
+
name: "legreffier-explore",
|
|
5411
|
+
files: ["SKILL.md", "references/exploration-pack-plan.yaml"]
|
|
5412
|
+
}
|
|
5413
|
+
];
|
|
5414
|
+
async function downloadSkillFiles(skill) {
|
|
5415
|
+
for (const ref of [SKILL_VERSION, SKILL_FALLBACK]) {
|
|
5416
|
+
const files = /* @__PURE__ */ new Map();
|
|
5417
|
+
let ok = true;
|
|
5418
|
+
for (const file of skill.files) {
|
|
5398
5419
|
let res;
|
|
5399
5420
|
try {
|
|
5400
|
-
res = await fetch(
|
|
5421
|
+
res = await fetch(skillFileUrl(skill.name, ref, file));
|
|
5401
5422
|
} catch {
|
|
5402
|
-
|
|
5423
|
+
ok = false;
|
|
5424
|
+
break;
|
|
5403
5425
|
}
|
|
5404
|
-
if (res.ok) {
|
|
5405
|
-
|
|
5426
|
+
if (!res.ok) {
|
|
5427
|
+
ok = false;
|
|
5406
5428
|
break;
|
|
5407
5429
|
}
|
|
5430
|
+
files.set(file, await res.text());
|
|
5408
5431
|
}
|
|
5409
|
-
if (
|
|
5432
|
+
if (ok) {
|
|
5433
|
+
return files;
|
|
5434
|
+
}
|
|
5435
|
+
}
|
|
5436
|
+
return null;
|
|
5437
|
+
}
|
|
5438
|
+
async function downloadSkills(repoDir, skillDir) {
|
|
5439
|
+
for (const skill of SKILLS) {
|
|
5440
|
+
const files = await downloadSkillFiles(skill);
|
|
5441
|
+
if (!files) {
|
|
5410
5442
|
process.stderr.write(
|
|
5411
5443
|
`Warning: could not download skill "${skill.name}", skipping.
|
|
5412
5444
|
`
|
|
@@ -5415,7 +5447,11 @@ async function downloadSkills(repoDir, skillDir) {
|
|
|
5415
5447
|
}
|
|
5416
5448
|
const destDir = join(repoDir, skillDir, skill.name);
|
|
5417
5449
|
await mkdir(destDir, { recursive: true });
|
|
5418
|
-
|
|
5450
|
+
for (const [file, content] of files) {
|
|
5451
|
+
const filePath = join(destDir, file);
|
|
5452
|
+
await mkdir(dirname(filePath), { recursive: true });
|
|
5453
|
+
await writeFile(filePath, content, "utf-8");
|
|
5454
|
+
}
|
|
5419
5455
|
}
|
|
5420
5456
|
}
|
|
5421
5457
|
function buildGhTokenRule(agentName) {
|
|
@@ -6657,7 +6693,7 @@ function SetupApp({
|
|
|
6657
6693
|
setPhase("done");
|
|
6658
6694
|
setTimeout(() => exit(), 3e3);
|
|
6659
6695
|
} catch (err2) {
|
|
6660
|
-
setError(
|
|
6696
|
+
setError(toErrorMessage(err2));
|
|
6661
6697
|
setPhase("error");
|
|
6662
6698
|
setTimeout(() => exit(new Error("Setup failed")), 3e3);
|
|
6663
6699
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@themoltnet/legreffier",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.2",
|
|
4
4
|
"description": "LeGreffier — one-command accountable AI agent setup",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"typescript": "^5.3.3",
|
|
34
34
|
"vite": "^6.0.0",
|
|
35
35
|
"vitest": "^3.0.0",
|
|
36
|
-
"@moltnet/crypto-service": "0.1.0",
|
|
37
36
|
"@moltnet/api-client": "0.1.0",
|
|
37
|
+
"@moltnet/crypto-service": "0.1.0",
|
|
38
38
|
"@themoltnet/design-system": "0.3.0",
|
|
39
|
-
"@themoltnet/sdk": "0.
|
|
39
|
+
"@themoltnet/sdk": "0.83.1"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"dev": "vite build --watch",
|