@lousy-agents/cli 2.7.1 → 2.8.0
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 +8010 -3429
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.js +156 -0
- package/dist/mcp-server.js.map +1 -1
- package/package.json +2 -1
package/dist/mcp-server.js
CHANGED
|
@@ -45262,6 +45262,161 @@ async function watchConfig(options) {
|
|
|
45262
45262
|
return new FileSystemEnvironmentGateway();
|
|
45263
45263
|
}
|
|
45264
45264
|
|
|
45265
|
+
// EXTERNAL MODULE: external "node:child_process"
|
|
45266
|
+
var external_node_child_process_ = __webpack_require__(1421);
|
|
45267
|
+
;// CONCATENATED MODULE: ./src/gateways/github-ruleset-gateway.ts
|
|
45268
|
+
/**
|
|
45269
|
+
* Gateway for interacting with GitHub repository rulesets via Octokit.
|
|
45270
|
+
*/
|
|
45271
|
+
|
|
45272
|
+
|
|
45273
|
+
|
|
45274
|
+
const execFileAsync = (0,external_node_util_.promisify)(external_node_child_process_.execFile);
|
|
45275
|
+
const RulesetRuleSchema = schemas_object({
|
|
45276
|
+
type: schemas_string(),
|
|
45277
|
+
parameters: record(schemas_string(), unknown()).optional()
|
|
45278
|
+
});
|
|
45279
|
+
const RulesetSchema = schemas_object({
|
|
45280
|
+
id: schemas_number(),
|
|
45281
|
+
name: schemas_string(),
|
|
45282
|
+
enforcement: schemas_string(),
|
|
45283
|
+
rules: schemas_array(RulesetRuleSchema).optional()
|
|
45284
|
+
});
|
|
45285
|
+
/**
|
|
45286
|
+
* Parses a GitHub remote URL to extract owner and repo name
|
|
45287
|
+
*/ function parseRepoFromRemoteUrl(remoteUrl) {
|
|
45288
|
+
const httpsMatch = remoteUrl.match(/github\.com\/([\w-]+)\/([\w.-]+?)(?:\.git)?$/);
|
|
45289
|
+
if (httpsMatch) {
|
|
45290
|
+
return {
|
|
45291
|
+
owner: httpsMatch[1],
|
|
45292
|
+
repo: httpsMatch[2]
|
|
45293
|
+
};
|
|
45294
|
+
}
|
|
45295
|
+
const sshMatch = remoteUrl.match(/github\.com:([\w-]+)\/([\w.-]+?)(?:\.git)?$/);
|
|
45296
|
+
if (sshMatch) {
|
|
45297
|
+
return {
|
|
45298
|
+
owner: sshMatch[1],
|
|
45299
|
+
repo: sshMatch[2]
|
|
45300
|
+
};
|
|
45301
|
+
}
|
|
45302
|
+
return null;
|
|
45303
|
+
}
|
|
45304
|
+
function defaultExec(command, args, options) {
|
|
45305
|
+
return execFileAsync(command, args, {
|
|
45306
|
+
encoding: "utf-8",
|
|
45307
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
45308
|
+
cwd: options?.cwd
|
|
45309
|
+
});
|
|
45310
|
+
}
|
|
45311
|
+
/**
|
|
45312
|
+
* Extracts a descriptive error message from an Octokit error, including HTTP status when available
|
|
45313
|
+
*/ function formatOctokitError(error) {
|
|
45314
|
+
const message = error instanceof Error ? error.message : "";
|
|
45315
|
+
const status = error instanceof Object && "status" in error ? error.status : undefined;
|
|
45316
|
+
const parts = [];
|
|
45317
|
+
if (typeof status === "number") {
|
|
45318
|
+
parts.push(`status ${status}`);
|
|
45319
|
+
}
|
|
45320
|
+
if (message) {
|
|
45321
|
+
parts.push(message);
|
|
45322
|
+
}
|
|
45323
|
+
return parts.length > 0 ? parts.join(" - ") : "Unknown error";
|
|
45324
|
+
}
|
|
45325
|
+
/**
|
|
45326
|
+
* GitHub ruleset gateway implementation using Octokit
|
|
45327
|
+
*/ class OctokitRulesetGateway {
|
|
45328
|
+
octokit;
|
|
45329
|
+
exec;
|
|
45330
|
+
constructor(octokit = null, exec = defaultExec){
|
|
45331
|
+
this.octokit = octokit;
|
|
45332
|
+
this.exec = exec;
|
|
45333
|
+
}
|
|
45334
|
+
async isAuthenticated() {
|
|
45335
|
+
if (!this.octokit) {
|
|
45336
|
+
return false;
|
|
45337
|
+
}
|
|
45338
|
+
try {
|
|
45339
|
+
await this.octokit.rest.users.getAuthenticated();
|
|
45340
|
+
return true;
|
|
45341
|
+
} catch {
|
|
45342
|
+
return false;
|
|
45343
|
+
}
|
|
45344
|
+
}
|
|
45345
|
+
async getRepoInfo(targetDir) {
|
|
45346
|
+
try {
|
|
45347
|
+
const { stdout } = await this.exec("git", [
|
|
45348
|
+
"remote",
|
|
45349
|
+
"get-url",
|
|
45350
|
+
"origin"
|
|
45351
|
+
], {
|
|
45352
|
+
cwd: targetDir
|
|
45353
|
+
});
|
|
45354
|
+
return parseRepoFromRemoteUrl(stdout.trim());
|
|
45355
|
+
} catch {
|
|
45356
|
+
return null;
|
|
45357
|
+
}
|
|
45358
|
+
}
|
|
45359
|
+
async listRulesets(owner, repo) {
|
|
45360
|
+
if (!this.octokit) {
|
|
45361
|
+
throw new Error("Not authenticated");
|
|
45362
|
+
}
|
|
45363
|
+
try {
|
|
45364
|
+
const { data } = await this.octokit.rest.repos.getRepoRulesets({
|
|
45365
|
+
owner,
|
|
45366
|
+
repo
|
|
45367
|
+
});
|
|
45368
|
+
return z.array(RulesetSchema).parse(data);
|
|
45369
|
+
} catch (error) {
|
|
45370
|
+
const details = formatOctokitError(error);
|
|
45371
|
+
throw new Error(`Failed to list rulesets for ${owner}/${repo}: ${details}`);
|
|
45372
|
+
}
|
|
45373
|
+
}
|
|
45374
|
+
async createRuleset(owner, repo, payload) {
|
|
45375
|
+
if (!this.octokit) {
|
|
45376
|
+
throw new Error("Not authenticated");
|
|
45377
|
+
}
|
|
45378
|
+
try {
|
|
45379
|
+
await this.octokit.rest.repos.createRepoRuleset({
|
|
45380
|
+
owner,
|
|
45381
|
+
repo,
|
|
45382
|
+
...payload
|
|
45383
|
+
});
|
|
45384
|
+
} catch (error) {
|
|
45385
|
+
const details = formatOctokitError(error);
|
|
45386
|
+
throw new Error(`Failed to create ruleset for ${owner}/${repo}: ${details}`);
|
|
45387
|
+
}
|
|
45388
|
+
}
|
|
45389
|
+
}
|
|
45390
|
+
/**
|
|
45391
|
+
* Resolves a GitHub token from GH_TOKEN/GITHUB_TOKEN env vars, with gh CLI fallback
|
|
45392
|
+
*/ async function resolveGitHubToken() {
|
|
45393
|
+
const envToken = process.env.GH_TOKEN || process.env.GITHUB_TOKEN;
|
|
45394
|
+
if (envToken) {
|
|
45395
|
+
return envToken;
|
|
45396
|
+
}
|
|
45397
|
+
try {
|
|
45398
|
+
const { stdout } = await execFileAsync("gh", [
|
|
45399
|
+
"auth",
|
|
45400
|
+
"token"
|
|
45401
|
+
], {
|
|
45402
|
+
encoding: "utf-8"
|
|
45403
|
+
});
|
|
45404
|
+
const token = stdout.trim();
|
|
45405
|
+
return token || null;
|
|
45406
|
+
} catch {
|
|
45407
|
+
return null;
|
|
45408
|
+
}
|
|
45409
|
+
}
|
|
45410
|
+
/**
|
|
45411
|
+
* Creates the default GitHub ruleset gateway with resolved auth token
|
|
45412
|
+
*/ async function createGitHubRulesetGateway() {
|
|
45413
|
+
const token = await resolveGitHubToken();
|
|
45414
|
+
const octokit = token ? new Octokit({
|
|
45415
|
+
auth: token
|
|
45416
|
+
}) : null;
|
|
45417
|
+
return new OctokitRulesetGateway(octokit);
|
|
45418
|
+
}
|
|
45419
|
+
|
|
45265
45420
|
;// CONCATENATED MODULE: ./src/gateways/instruction-analysis-gateway.ts
|
|
45266
45421
|
/**
|
|
45267
45422
|
* Gateway for analyzing repository instructions for feedback loop coverage
|
|
@@ -46119,6 +46274,7 @@ async function watchConfig(options) {
|
|
|
46119
46274
|
|
|
46120
46275
|
|
|
46121
46276
|
|
|
46277
|
+
|
|
46122
46278
|
;// CONCATENATED MODULE: ./src/mcp/tools/types.ts
|
|
46123
46279
|
/**
|
|
46124
46280
|
* Shared types and utilities for MCP tool handlers.
|