cskwork/supergoal-skill / skills/supergoal
supergoal
UnverifiedRoute objective-driven development, verification, planning, "teach/explain", codebase learning, and skill evaluation through the Supergoal workflow. Use when Supergoal is requested or an autonomous delivery workflow is needed.
templates/run-state-gate.mjs
View on GitHub#!/usr/bin/env node
import { readFile } from "node:fs/promises";
const path = process.argv[2];
if (!path) {
console.error("usage: run-state-gate.mjs <run-state.json>");
process.exit(2);
}
function fail(message) {
console.error(`RUN-STATE GATE FAIL: ${message}`);
process.exit(1);
}
let state;
try {
state = JSON.parse(await readFile(path, "utf8"));
} catch (error) {
if (error?.code === "ENOENT") fail("run-state.json missing");
fail(`cannot parse run-state.json: ${error.message}`);
}
if (!state || Array.isArray(state) || typeof state !== "object") {
fail("run-state.json root must be an object");
}
if (state.schema_version !== 3) fail("schema_version must be 3");
if (!["GREENFIELD", "DEBUG", "LEGACY"].includes(state.mode)) {
fail("mode must be GREENFIELD, DEBUG, or LEGACY");
}
if (!state.branches || typeof state.branches !== "object") {
fail("branches must be an object");
}
for (const key of ["source_base_branch", "target_integration_branch", "run_branch", "worktree_path"]) {
if (typeof state.branches[key] !== "string" || state.branches[key].trim() === "") {
fail(`branches.${key} must be a non-empty string`);
}
}
if (state.branches.refs_verified !== true) fail("branches.refs_verified must be true");
if (state.phase !== "Finalize") fail("phase must be Finalize");
if (!Number.isInteger(state.iteration) || state.iteration < 0) {
fail("iteration must be a non-negative integer");
}
if (!Number.isInteger(state.max_iterations) || state.max_iterations < 1) {
fail("max_iterations must be a positive integer");
}
for (const key of ["unresolved_gates", "blockers", "regression_ledger"]) {
if (!Array.isArray(state[key])) fail(`${key} must be an array`);
}
if (state.unresolved_gates.length !== 0) fail("unresolved_gates must be empty");
if (state.blockers.length !== 0) fail("blockers must be empty");
if (typeof state.next_action !== "string") fail("next_action must be a string");
if (state.forced_reflection !== null && typeof state.forced_reflection !== "object") {
fail("forced_reflection must be null or an object");
}
if (typeof state.updated_at !== "string" || state.updated_at.trim() === "") {
fail("updated_at must be a non-empty string");
}
console.log("== RUN-STATE GATE PASS ==");
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |