bamboo-agents 0.1.16-dev.135.bad28cb → 0.1.16-dev.136.c3da754
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/VERSION +1 -1
- package/dist/index.js +44 -5
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.16-dev.
|
|
1
|
+
0.1.16-dev.136.c3da754
|
package/dist/index.js
CHANGED
|
@@ -3037,7 +3037,7 @@ var VERSION;
|
|
|
3037
3037
|
var init_version = __esm({
|
|
3038
3038
|
"src/version.ts"() {
|
|
3039
3039
|
"use strict";
|
|
3040
|
-
VERSION = "0.1.16-dev.
|
|
3040
|
+
VERSION = "0.1.16-dev.136.c3da754";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -7256,7 +7256,7 @@ function isSafeRepoPath(path2) {
|
|
|
7256
7256
|
if (path2.split("/").includes("..")) return false;
|
|
7257
7257
|
return true;
|
|
7258
7258
|
}
|
|
7259
|
-
var SaveEditSchema, SaveBatchRequestSchema, SaveFileResultSchema, SaveBatchResponseSchema;
|
|
7259
|
+
var SaveEditSchema, SaveBatchRequestSchema, SaveFileResultSchema, SaveBatchResponseSchema, SaveFindingSchema, SaveRefusalDetailsSchema;
|
|
7260
7260
|
var init_save = __esm({
|
|
7261
7261
|
"../../src/lib/api-contracts/cli/save.ts"() {
|
|
7262
7262
|
init_zod();
|
|
@@ -7311,6 +7311,20 @@ var init_save = __esm({
|
|
|
7311
7311
|
/** BAM-2588: true when this was a --dry-run preview (nothing was written). */
|
|
7312
7312
|
dry_run: external_exports.boolean().optional()
|
|
7313
7313
|
});
|
|
7314
|
+
SaveFindingSchema = external_exports.object({
|
|
7315
|
+
ruleId: external_exports.string(),
|
|
7316
|
+
check: external_exports.number().int(),
|
|
7317
|
+
path: external_exports.string(),
|
|
7318
|
+
line: external_exports.number().int().nullable(),
|
|
7319
|
+
message: external_exports.string(),
|
|
7320
|
+
fix: external_exports.string()
|
|
7321
|
+
});
|
|
7322
|
+
SaveRefusalDetailsSchema = external_exports.object({
|
|
7323
|
+
routed: external_exports.literal("rejected"),
|
|
7324
|
+
classification: external_exports.enum(["self_only", "cross_scope", "forbidden"]),
|
|
7325
|
+
reason: external_exports.string(),
|
|
7326
|
+
findings: external_exports.array(SaveFindingSchema)
|
|
7327
|
+
});
|
|
7314
7328
|
}
|
|
7315
7329
|
});
|
|
7316
7330
|
|
|
@@ -7346,7 +7360,8 @@ var init_knowledge_save = __esm({
|
|
|
7346
7360
|
pr_url: external_exports.string().optional(),
|
|
7347
7361
|
pr_number: external_exports.number().optional(),
|
|
7348
7362
|
/** Present on `rejected` / `noop` / `conflict` — short machine-friendly reason. */
|
|
7349
|
-
reason: external_exports.string().optional()
|
|
7363
|
+
reason: external_exports.string().optional(),
|
|
7364
|
+
findings: external_exports.array(SaveFindingSchema).optional()
|
|
7350
7365
|
});
|
|
7351
7366
|
}
|
|
7352
7367
|
});
|
|
@@ -7783,7 +7798,15 @@ function emitError(err, opts, exitCode) {
|
|
|
7783
7798
|
writeStdout(JSON.stringify(envelope, null, 2));
|
|
7784
7799
|
} else if (!opts.quiet) {
|
|
7785
7800
|
writeStderr(`bamboo-agents: [${err.code}] ${err.message}`);
|
|
7786
|
-
|
|
7801
|
+
const findings = Array.isArray(err.details?.findings) ? err.details.findings.filter(
|
|
7802
|
+
(finding) => finding !== null && typeof finding === "object" && typeof finding.path === "string" && (finding.line === null || typeof finding.line === "number") && typeof finding.message === "string" && typeof finding.fix === "string"
|
|
7803
|
+
) : [];
|
|
7804
|
+
for (const finding of findings) {
|
|
7805
|
+
const location = `${finding.path}${finding.line === null ? "" : `:${finding.line}`}`;
|
|
7806
|
+
writeStderr(` ${location} ${finding.message}`);
|
|
7807
|
+
writeStderr(` Fix: ${finding.fix}`);
|
|
7808
|
+
}
|
|
7809
|
+
if (findings.length === 0 && typeof err.details?.reason === "string")
|
|
7787
7810
|
writeStderr(` Reason: ${err.details.reason}`);
|
|
7788
7811
|
if (err.details?.read_back !== void 0)
|
|
7789
7812
|
writeStderr(` Read-back: ${JSON.stringify(err.details.read_back)}`);
|
|
@@ -18981,6 +19004,21 @@ async function runSave(intent, options = {}) {
|
|
|
18981
19004
|
dry_run: dryRun || void 0
|
|
18982
19005
|
});
|
|
18983
19006
|
} catch (err) {
|
|
19007
|
+
if (err instanceof ApiError && err.status === 422) {
|
|
19008
|
+
const findings = err.details?.findings;
|
|
19009
|
+
const count = Array.isArray(findings) ? findings.length : null;
|
|
19010
|
+
emitError(
|
|
19011
|
+
{
|
|
19012
|
+
code: err.errorCode ?? "rejected",
|
|
19013
|
+
message: count === null ? `couldn't save \u2014 ${err.message}` : `couldn't save \u2014 ${count} problem${count === 1 ? "" : "s"} to fix.`,
|
|
19014
|
+
hint: "Fix each problem and run `bamboo-agents save` again.",
|
|
19015
|
+
details: err.details
|
|
19016
|
+
},
|
|
19017
|
+
opts,
|
|
19018
|
+
1
|
|
19019
|
+
);
|
|
19020
|
+
return;
|
|
19021
|
+
}
|
|
18984
19022
|
if (err instanceof ApiError && err.status === 403) {
|
|
18985
19023
|
emitError(
|
|
18986
19024
|
{
|
|
@@ -21005,7 +21043,8 @@ async function runKnowledgeSave(options) {
|
|
|
21005
21043
|
{
|
|
21006
21044
|
code: "rejected",
|
|
21007
21045
|
message: `save rejected${result.reason ? `: ${result.reason}` : "."}`,
|
|
21008
|
-
hint: "Check the path scope and your permissions."
|
|
21046
|
+
hint: "Check the path scope and your permissions.",
|
|
21047
|
+
details: { reason: result.reason, findings: result.findings }
|
|
21009
21048
|
},
|
|
21010
21049
|
opts,
|
|
21011
21050
|
1
|