@theagilemonkeys/facility 0.9.0 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theagilemonkeys/facility",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "Run an AI crew on your GitHub repo: agents that plan before building, build to your standard, verify on a provisioned environment, and never merge their own work.",
5
5
  "keywords": [
6
6
  "ai",
@@ -28,7 +28,8 @@ export function collectReceipt(env = process.env, now = new Date()) {
28
28
  const engine = parseEngineEvidence(env.FACILITY_RECEIPT_ENGINE_JSONL);
29
29
  const checkEvidence = parseChecks(env.FACILITY_RECEIPT_CHECKS_FILE);
30
30
  const target = githubTarget(env.GITHUB_EVENT_PATH);
31
- const git = gitActivity(env.FACILITY_RECEIPT_BASE_SHA, env.GITHUB_WORKSPACE);
31
+ const baseSha = gitCommitSha(env.FACILITY_RECEIPT_BASE_SHA);
32
+ const git = gitActivity(baseSha, env.GITHUB_WORKSPACE);
32
33
  const actor = env.GITHUB_ACTOR;
33
34
  const receipt = {
34
35
  schema: "facility.run.v1",
@@ -59,6 +60,7 @@ export function collectReceipt(env = process.env, now = new Date()) {
59
60
  repo: env.GITHUB_REPOSITORY?.split("/")[1],
60
61
  issue: target.issue,
61
62
  pr: target.pr,
63
+ ...(baseSha ? { base_sha: baseSha } : {}),
62
64
  ...(actor ? { actor_sha256: sha256(actor) } : {}),
63
65
  },
64
66
  timing: {
@@ -250,6 +252,12 @@ function normalizeResult(value) {
250
252
  return "failed";
251
253
  }
252
254
 
255
+ function gitCommitSha(value) {
256
+ return typeof value === "string" && /^[0-9a-f]{40}$/i.test(value)
257
+ ? value.toLowerCase()
258
+ : undefined;
259
+ }
260
+
253
261
  function requiredChoice(value, choices, name) {
254
262
  if (!value || !choices.has(value))
255
263
  throw new Error(`FACILITY_RECEIPT_${name.toUpperCase()} is invalid`);