@rayul/kordis 0.3.0 → 0.3.1
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 +14 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -175,6 +175,7 @@ var init_errors = __esm({
|
|
|
175
175
|
error: z3.object({
|
|
176
176
|
code: ErrorCodeSchema,
|
|
177
177
|
message: z3.string(),
|
|
178
|
+
hint: z3.string().optional(),
|
|
178
179
|
flags: z3.array(ReviewFlagSchema).optional(),
|
|
179
180
|
retry_after_seconds: z3.number().int().nonnegative().optional(),
|
|
180
181
|
request_id: z3.string().optional()
|
|
@@ -728,6 +729,7 @@ var init_errors2 = __esm({
|
|
|
728
729
|
KordisApiError = class extends Error {
|
|
729
730
|
code;
|
|
730
731
|
status;
|
|
732
|
+
hint;
|
|
731
733
|
flags;
|
|
732
734
|
retryAfter;
|
|
733
735
|
requestId;
|
|
@@ -736,6 +738,7 @@ var init_errors2 = __esm({
|
|
|
736
738
|
this.name = "KordisApiError";
|
|
737
739
|
this.code = envelope.error.code;
|
|
738
740
|
this.status = status;
|
|
741
|
+
this.hint = envelope.error.hint;
|
|
739
742
|
this.flags = envelope.error.flags ?? [];
|
|
740
743
|
this.retryAfter = envelope.error.retry_after_seconds;
|
|
741
744
|
this.requestId = envelope.error.request_id ?? requestId;
|
|
@@ -1953,10 +1956,13 @@ function zodFail(issues) {
|
|
|
1953
1956
|
hint = "description must be 1\u20132048 chars; current is too long. Move detail into the body.";
|
|
1954
1957
|
} else if (field === "description" && msg.includes("small")) {
|
|
1955
1958
|
hint = "description must be 1\u20132048 chars; provide a one-paragraph summary.";
|
|
1959
|
+
} else if (field) {
|
|
1960
|
+
hint = `Fix the value of frontmatter field "${field}" to match the schema. See the per-type spec under packages/harness-schema/src/types/ for the exact shape.`;
|
|
1961
|
+
} else {
|
|
1962
|
+
hint = "Fix the frontmatter to match the schema. See the per-type spec under packages/harness-schema/src/types/ for the exact shape.";
|
|
1956
1963
|
}
|
|
1957
|
-
const extra = {};
|
|
1964
|
+
const extra = { hint };
|
|
1958
1965
|
if (field) extra.field = field;
|
|
1959
|
-
if (hint) extra.hint = hint;
|
|
1960
1966
|
return flag("invalid_frontmatter", i.message, extra);
|
|
1961
1967
|
})
|
|
1962
1968
|
};
|
|
@@ -3745,6 +3751,7 @@ function handleError(err) {
|
|
|
3745
3751
|
error: {
|
|
3746
3752
|
code: err.code,
|
|
3747
3753
|
message: err.message,
|
|
3754
|
+
...err.hint ? { hint: err.hint } : {},
|
|
3748
3755
|
flags: err.flags,
|
|
3749
3756
|
...err.retryAfter !== void 0 ? { retry_after_seconds: err.retryAfter } : {},
|
|
3750
3757
|
request_id: err.requestId
|
|
@@ -3752,6 +3759,11 @@ function handleError(err) {
|
|
|
3752
3759
|
});
|
|
3753
3760
|
} else {
|
|
3754
3761
|
printHuman(c.red(`\u2717 ${err.code}: ${err.message}`));
|
|
3762
|
+
if (err.hint) {
|
|
3763
|
+
for (const line of err.hint.split("\n")) {
|
|
3764
|
+
printHuman(c.gray(` \u2192 ${line}`));
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3755
3767
|
for (const f of err.flags) {
|
|
3756
3768
|
printHuman(c.red(` - ${f.code}${f.message ? `: ${f.message}` : ""}`));
|
|
3757
3769
|
if (f.hint) {
|