failproofai 0.0.4 → 0.0.5
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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +2 -2
- package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +10 -10
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +10 -10
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g72weg._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09icjsf._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0v1egkj._.js → [root-of-the-server]__0a~g15g._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g.lg8b._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h..k-e._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0okos0k._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0lty_fo._.js → [root-of-the-server]__0qn95h3._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11pa2ra._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12t-wym._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/pages/404.html +2 -2
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +9 -9
- package/.next/standalone/.next/static/chunks/{0de3q2juhg_dr.js → 09ikntpt2-o9b.js} +1 -1
- package/.next/standalone/.next/static/chunks/{11zlh73ggln0w.js → 0_yayar~bpphd.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0b2_069x5qnxg.js → 0em7tspi4kylh.js} +2 -2
- package/.next/standalone/.next/static/chunks/{0y-bi_mp2rv4l.js → 0lgbwkfqmnsmc.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0uxpbrcv44lga.js → 0sme4lkv.tgn-.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0tw_xfxb1tto..js → 0yumumfzx_f27.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0p5sfob-upg0g.js → 13juklu.vksks.js} +1 -1
- package/.next/standalone/.next/static/chunks/17manv47o-~wp.js +1 -0
- package/.next/standalone/CHANGELOG.md +9 -0
- package/.next/standalone/README.md +2 -2
- package/.next/standalone/dist/cli.mjs +52 -11
- package/.next/standalone/docs/ar/architecture.mdx +2 -2
- package/.next/standalone/docs/ar/configuration.mdx +1 -1
- package/.next/standalone/docs/ar/custom-policies.mdx +2 -5
- package/.next/standalone/docs/architecture.mdx +2 -2
- package/.next/standalone/docs/configuration.mdx +1 -1
- package/.next/standalone/docs/custom-policies.mdx +2 -6
- package/.next/standalone/docs/de/architecture.mdx +2 -2
- package/.next/standalone/docs/de/configuration.mdx +1 -1
- package/.next/standalone/docs/de/custom-policies.mdx +2 -5
- package/.next/standalone/docs/es/architecture.mdx +2 -2
- package/.next/standalone/docs/es/configuration.mdx +1 -1
- package/.next/standalone/docs/es/custom-policies.mdx +2 -5
- package/.next/standalone/docs/fr/architecture.mdx +2 -2
- package/.next/standalone/docs/fr/configuration.mdx +1 -1
- package/.next/standalone/docs/fr/custom-policies.mdx +2 -5
- package/.next/standalone/docs/he/architecture.mdx +2 -2
- package/.next/standalone/docs/he/configuration.mdx +1 -1
- package/.next/standalone/docs/he/custom-policies.mdx +2 -5
- package/.next/standalone/docs/hi/architecture.mdx +2 -2
- package/.next/standalone/docs/hi/configuration.mdx +1 -1
- package/.next/standalone/docs/hi/custom-policies.mdx +2 -5
- package/.next/standalone/docs/i18n/README.ar.md +2 -2
- package/.next/standalone/docs/i18n/README.de.md +2 -2
- package/.next/standalone/docs/i18n/README.es.md +2 -2
- package/.next/standalone/docs/i18n/README.fr.md +2 -2
- package/.next/standalone/docs/i18n/README.he.md +2 -2
- package/.next/standalone/docs/i18n/README.hi.md +2 -2
- package/.next/standalone/docs/i18n/README.it.md +2 -2
- package/.next/standalone/docs/i18n/README.ja.md +2 -2
- package/.next/standalone/docs/i18n/README.ko.md +2 -2
- package/.next/standalone/docs/i18n/README.pt-br.md +2 -2
- package/.next/standalone/docs/i18n/README.ru.md +2 -2
- package/.next/standalone/docs/i18n/README.tr.md +2 -2
- package/.next/standalone/docs/i18n/README.vi.md +2 -2
- package/.next/standalone/docs/i18n/README.zh.md +2 -2
- package/.next/standalone/docs/it/architecture.mdx +2 -2
- package/.next/standalone/docs/it/configuration.mdx +1 -1
- package/.next/standalone/docs/it/custom-policies.mdx +2 -5
- package/.next/standalone/docs/ja/architecture.mdx +2 -2
- package/.next/standalone/docs/ja/configuration.mdx +1 -1
- package/.next/standalone/docs/ja/custom-policies.mdx +2 -5
- package/.next/standalone/docs/ko/architecture.mdx +2 -2
- package/.next/standalone/docs/ko/configuration.mdx +1 -1
- package/.next/standalone/docs/ko/custom-policies.mdx +2 -5
- package/.next/standalone/docs/pt-br/architecture.mdx +2 -2
- package/.next/standalone/docs/pt-br/configuration.mdx +1 -1
- package/.next/standalone/docs/pt-br/custom-policies.mdx +2 -5
- package/.next/standalone/docs/ru/architecture.mdx +2 -2
- package/.next/standalone/docs/ru/configuration.mdx +1 -1
- package/.next/standalone/docs/ru/custom-policies.mdx +2 -5
- package/.next/standalone/docs/tr/architecture.mdx +2 -2
- package/.next/standalone/docs/tr/configuration.mdx +1 -1
- package/.next/standalone/docs/tr/custom-policies.mdx +2 -5
- package/.next/standalone/docs/vi/architecture.mdx +2 -2
- package/.next/standalone/docs/vi/configuration.mdx +1 -1
- package/.next/standalone/docs/vi/custom-policies.mdx +2 -5
- package/.next/standalone/docs/zh/architecture.mdx +2 -2
- package/.next/standalone/docs/zh/configuration.mdx +1 -1
- package/.next/standalone/docs/zh/custom-policies.mdx +2 -5
- package/.next/standalone/package.json +1 -1
- package/.next/standalone/server.js +1 -1
- package/.next/standalone/src/hooks/builtin-policies.ts +40 -8
- package/.next/standalone/src/hooks/policy-evaluator.ts +15 -1
- package/README.md +2 -2
- package/dist/cli.mjs +52 -11
- package/package.json +1 -1
- package/src/hooks/builtin-policies.ts +40 -8
- package/src/hooks/policy-evaluator.ts +15 -1
- package/.next/standalone/.next/static/chunks/0xjz3w.yw5tza.js +0 -1
- /package/.next/standalone/.next/static/{LayjxQulxIcNH19Lqgjbf → hYQM6iCWnF1W5XDpsIRhV}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{LayjxQulxIcNH19Lqgjbf → hYQM6iCWnF1W5XDpsIRhV}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{LayjxQulxIcNH19Lqgjbf → hYQM6iCWnF1W5XDpsIRhV}/_ssgManifest.js +0 -0
|
@@ -212,6 +212,36 @@ function getThirdPartyCheckRuns(cwd: string, sha: string): CiCheck[] {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
/** Fetch commit statuses (legacy Status API) and normalize to CiCheck format. */
|
|
216
|
+
function getCommitStatuses(cwd: string, sha: string): CiCheck[] {
|
|
217
|
+
try {
|
|
218
|
+
const json = execFileSync(
|
|
219
|
+
"gh",
|
|
220
|
+
[
|
|
221
|
+
"api",
|
|
222
|
+
`repos/{owner}/{repo}/commits/${sha}/statuses`,
|
|
223
|
+
"--jq",
|
|
224
|
+
'map({name: .context, state: .state}) | unique_by(.name)',
|
|
225
|
+
],
|
|
226
|
+
{
|
|
227
|
+
cwd,
|
|
228
|
+
encoding: "utf8",
|
|
229
|
+
timeout: 15000,
|
|
230
|
+
},
|
|
231
|
+
).trim();
|
|
232
|
+
|
|
233
|
+
if (!json || json === "[]") return [];
|
|
234
|
+
const statuses = JSON.parse(json) as Array<{ name: string; state: string }>;
|
|
235
|
+
return statuses.map((s) => ({
|
|
236
|
+
name: s.name,
|
|
237
|
+
status: s.state === "pending" ? "in_progress" : "completed",
|
|
238
|
+
conclusion: s.state === "pending" ? "" : s.state === "success" ? "success" : "failure",
|
|
239
|
+
}));
|
|
240
|
+
} catch {
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
215
245
|
/**
|
|
216
246
|
* Check if a command matches an allow pattern using token-by-token comparison.
|
|
217
247
|
* The "*" token is a wildcard. Extra command tokens beyond the pattern are allowed,
|
|
@@ -859,7 +889,7 @@ function requireCommitBeforeStop(ctx: PolicyContext): PolicyResult {
|
|
|
859
889
|
|
|
860
890
|
if (status.length > 0) {
|
|
861
891
|
return deny(
|
|
862
|
-
"You have uncommitted changes in the working directory. Commit all changes
|
|
892
|
+
"You have uncommitted changes in the working directory. Commit all changes now.",
|
|
863
893
|
);
|
|
864
894
|
}
|
|
865
895
|
return allow("All changes are committed.");
|
|
@@ -937,7 +967,7 @@ function requirePushBeforeStop(ctx: PolicyContext): PolicyResult {
|
|
|
937
967
|
if (!hasTracking) {
|
|
938
968
|
return deny(
|
|
939
969
|
`Branch "${branch}" has not been pushed to remote "${remote}". ` +
|
|
940
|
-
`
|
|
970
|
+
`Run now: git push -u ${remote} ${branch}`,
|
|
941
971
|
);
|
|
942
972
|
}
|
|
943
973
|
|
|
@@ -952,7 +982,7 @@ function requirePushBeforeStop(ctx: PolicyContext): PolicyResult {
|
|
|
952
982
|
const commitCount = unpushed.split("\n").length;
|
|
953
983
|
return deny(
|
|
954
984
|
`You have ${commitCount} unpushed commit${commitCount > 1 ? "s" : ""} on branch "${branch}". ` +
|
|
955
|
-
`
|
|
985
|
+
`Run now: git push`,
|
|
956
986
|
);
|
|
957
987
|
}
|
|
958
988
|
|
|
@@ -1024,7 +1054,7 @@ function requirePrBeforeStop(ctx: PolicyContext): PolicyResult {
|
|
|
1024
1054
|
// gh pr view exits non-zero when no PR exists
|
|
1025
1055
|
return deny(
|
|
1026
1056
|
`No pull request found for branch "${branch}". ` +
|
|
1027
|
-
`
|
|
1057
|
+
`Run now: gh pr create`,
|
|
1028
1058
|
);
|
|
1029
1059
|
}
|
|
1030
1060
|
|
|
@@ -1035,7 +1065,7 @@ function requirePrBeforeStop(ctx: PolicyContext): PolicyResult {
|
|
|
1035
1065
|
}
|
|
1036
1066
|
|
|
1037
1067
|
return deny(
|
|
1038
|
-
`Pull request for branch "${branch}" is ${pr.state.toLowerCase()}.
|
|
1068
|
+
`Pull request for branch "${branch}" is ${pr.state.toLowerCase()}. Run now: gh pr create`,
|
|
1039
1069
|
);
|
|
1040
1070
|
} catch {
|
|
1041
1071
|
return allow("Could not check PR status, skipping.");
|
|
@@ -1075,13 +1105,15 @@ function requireCiGreenBeforeStop(ctx: PolicyContext): PolicyResult {
|
|
|
1075
1105
|
|
|
1076
1106
|
// 2. Third-party check runs (CodeRabbit, SonarCloud, Codecov, etc.)
|
|
1077
1107
|
let thirdPartyChecks: CiCheck[] = [];
|
|
1108
|
+
let commitStatuses: CiCheck[] = [];
|
|
1078
1109
|
const sha = getHeadSha(cwd);
|
|
1079
1110
|
if (sha) {
|
|
1080
1111
|
thirdPartyChecks = getThirdPartyCheckRuns(cwd, sha);
|
|
1112
|
+
commitStatuses = getCommitStatuses(cwd, sha);
|
|
1081
1113
|
}
|
|
1082
1114
|
|
|
1083
1115
|
// 3. Merge all checks
|
|
1084
|
-
const allChecks = [...workflowRuns, ...thirdPartyChecks];
|
|
1116
|
+
const allChecks = [...workflowRuns, ...thirdPartyChecks, ...commitStatuses];
|
|
1085
1117
|
|
|
1086
1118
|
if (allChecks.length === 0) return allow(`No CI runs found for branch "${branch}".`);
|
|
1087
1119
|
|
|
@@ -1091,7 +1123,7 @@ function requireCiGreenBeforeStop(ctx: PolicyContext): PolicyResult {
|
|
|
1091
1123
|
if (failing.length > 0) {
|
|
1092
1124
|
const names = failing.map((r) => `"${r.name}"`).join(", ");
|
|
1093
1125
|
return deny(
|
|
1094
|
-
`CI checks are failing on branch "${branch}": ${names}. Fix the failing checks
|
|
1126
|
+
`CI checks are failing on branch "${branch}": ${names}. Fix the failing checks now.`,
|
|
1095
1127
|
);
|
|
1096
1128
|
}
|
|
1097
1129
|
|
|
@@ -1101,7 +1133,7 @@ function requireCiGreenBeforeStop(ctx: PolicyContext): PolicyResult {
|
|
|
1101
1133
|
if (pending.length > 0) {
|
|
1102
1134
|
const names = pending.map((r) => `"${r.name}"`).join(", ");
|
|
1103
1135
|
return deny(
|
|
1104
|
-
`CI checks are still running on branch "${branch}": ${names}. Wait for all checks to complete
|
|
1136
|
+
`CI checks are still running on branch "${branch}": ${names}. Wait for all checks to complete, then verify they pass.`,
|
|
1105
1137
|
);
|
|
1106
1138
|
}
|
|
1107
1139
|
|
|
@@ -130,6 +130,17 @@ export async function evaluatePolicies(
|
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
if (eventType === "Stop") {
|
|
134
|
+
return {
|
|
135
|
+
exitCode: 2,
|
|
136
|
+
stdout: "",
|
|
137
|
+
stderr: `MANDATORY ACTION REQUIRED from failproofai (policy: ${policy.name}): ${reason}\n\nYou MUST complete the above action NOW. Do NOT ask the user for confirmation — execute the required action, then attempt to finish your task again.`,
|
|
138
|
+
policyName: policy.name,
|
|
139
|
+
reason,
|
|
140
|
+
decision: "deny",
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
133
144
|
// Other event types: exit 2
|
|
134
145
|
return {
|
|
135
146
|
exitCode: 2,
|
|
@@ -165,10 +176,13 @@ export async function evaluatePolicies(
|
|
|
165
176
|
if (eventType === "Stop") {
|
|
166
177
|
// Stop hook: exitCode 2 blocks Claude from stopping.
|
|
167
178
|
// Reason goes to stderr so Claude Code receives it as context.
|
|
179
|
+
const policyAttribution = policyNames.length === 1
|
|
180
|
+
? `policy: ${policyNames[0]}`
|
|
181
|
+
: `policies: ${policyNames.join(", ")}`;
|
|
168
182
|
return {
|
|
169
183
|
exitCode: 2,
|
|
170
184
|
stdout: "",
|
|
171
|
-
stderr: combined,
|
|
185
|
+
stderr: `MANDATORY ACTION REQUIRED from failproofai (${policyAttribution}): ${combined}\n\nYou MUST complete the above action(s) NOW. Do NOT ask the user for confirmation — execute the required action(s), then attempt to finish your task again.`,
|
|
172
186
|
policyName: policyNames[0],
|
|
173
187
|
policyNames,
|
|
174
188
|
reason: combined,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,53348,e=>{"use strict";var r=e.i(43476),t=e.i(71645),n=e.i(5888),i=e.i(9969);e.s(["default",0,function({error:e,reset:o}){return(0,t.useEffect)(()=>{(0,n.getTelemetryConfig)().then(r=>{(0,i.setClientTelemetryConfig)(r),(0,i.captureClientEvent)("client_error",{error_message:e.message,error_name:e.name,error_digest:e.digest,boundary:"global"})}).catch(()=>{})},[e]),(0,r.jsx)("html",{children:(0,r.jsx)("body",{children:(0,r.jsx)("main",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"#031035",color:"#f8fafc",fontFamily:"system-ui, sans-serif"},children:(0,r.jsxs)("div",{style:{textAlign:"center",padding:"2rem",border:"1px solid rgba(239,68,68,0.4)",borderRadius:"0.5rem",maxWidth:"500px"},children:[(0,r.jsx)("h2",{style:{color:"#ef4444",marginBottom:"0.5rem",fontSize:"1.25rem"},children:"Something went wrong"}),(0,r.jsx)("p",{style:{color:"#94a3b8",marginBottom:"1.5rem"},children:e.message||"An unexpected error occurred."}),(0,r.jsx)("button",{onClick:o,style:{padding:"0.5rem 1.25rem",background:"#3b82f6",color:"white",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},children:"Try again"})]})})})})}])}]);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|