lidge-jun/codexclaw / plugins/codexclaw/skills/dev-devops
cxc-dev-devops
UnverifiedUse for infra, CI/CD, releases, repo policy, worktree cleanup and native desktop apps. Triggers: Dockerfile, K8s, IaC, SRE, Tauri, 스택 PR CI, 배포, 인프라, 쿠버네티스, 브랜치 정리, 브랜치 삭제, 워크트리 정리, 저장소 세팅, 브랜치 보호, 에이전트 PR, PR 정책, 데스크톱 앱, 메뉴 막대.
scripts/verify-lipo-command.mjs
View on GitHub#!/usr/bin/env node
import { existsSync, mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { spawnSync } from "node:child_process";
import { fileURLToPath } from "node:url";
const USAGE = "usage: --artifact <file> --arch <name> --arch <name> --candidate-json <argv-json> [--lipo <path>]";
export function parseArgs(argv) {
const options = { arches: [] };
for (let i = 0; i < argv.length; i++) {
const flag = argv[i];
if (!["--artifact", "--arch", "--candidate-json", "--lipo"].includes(flag)) {
throw new Error(`unknown argument ${flag}`);
}
const value = argv[++i];
if (!value || value.startsWith("--")) throw new Error(`${flag} needs a value; ${USAGE}`);
if (flag === "--arch") options.arches.push(value);
else if (flag === "--candidate-json") {
try { options.candidate = JSON.parse(value); }
catch { throw new Error("candidate-json must be valid JSON argv"); }
} else options[flag === "--artifact" ? "artifact" : "lipo"] = value;
}
if (!options.artifact || options.arches.length < 2) throw new Error(USAGE);
if (new Set(options.arches).size !== options.arches.length) throw new Error("duplicate --arch value");
if (!Array.isArray(options.candidate) || options.candidate.length < 2
|| options.candidate.some((x) => typeof x !== "string" || x.length === 0)
|| options.candidate.filter((x) => x === "{artifact}").length !== 1
|| options.candidate[0] === "{artifact}") {
throw new Error("candidate-json must be a non-empty string argv array with exactly one {artifact} placeholder");
}
return { ...options, lipo: options.lipo ?? "lipo" };
}
function run(argv) {
const nodeModule = /\.(?:mjs|cjs|js)$/i.test(argv[0]);
const result = spawnSync(nodeModule ? process.execPath : argv[0],
nodeModule ? argv : argv.slice(1), { encoding: "utf8" });
return {
status: result.error ? null : result.status,
stdout: result.stdout ?? "",
stderr: result.stderr ?? "",
...(result.error ? { error: result.error.message } : {}),
};
}
function failure(result) {
return result.stderr.trim() || result.error || `exit ${result.status}`;
}
export function runOracle(options, { removeTree = rmSync } = {}) {
let root;
let outcome;
try {
const expected = [...options.arches].sort();
const inspected = run([options.lipo, "-archs", options.artifact]);
if (inspected.status !== 0) throw new Error(`cannot inspect artifact: ${failure(inspected)}`);
const actual = inspected.stdout.trim().split(/\s+/).filter(Boolean).sort();
if (JSON.stringify(actual) !== JSON.stringify(expected)) {
throw new Error(`artifact architectures ${actual.join(" ")} do not equal ${expected.join(" ")}`);
}
root = mkdtempSync(join(tmpdir(), "cxc-lipo-oracle-"));
const negative = join(root, "negative-thin");
const retained = expected.at(-1);
const missing = expected[0];
const thin = run([options.lipo, "-thin", retained, options.artifact, "-output", negative]);
if (thin.status !== 0) throw new Error(`could not create negative control: ${failure(thin)}`);
// A zero exit is not proof: the negative control must exist and hold exactly
// the retained architecture, or a candidate failing on a missing file would pass.
if (!existsSync(negative)) throw new Error("could not create negative control: thin command wrote no file");
const thinArchs = run([options.lipo, "-archs", negative]);
const thinActual = thinArchs.stdout.trim().split(/\s+/).filter(Boolean);
if (thinArchs.status !== 0 || thinActual.length !== 1 || thinActual[0] !== retained) {
throw new Error(`could not create negative control: expected only ${retained}, got ${thinActual.join(" ") || failure(thinArchs)}`);
}
const candidate = (artifact) => options.candidate.map((x) => x === "{artifact}" ? artifact : x);
const good = run(candidate(options.artifact));
const bad = run(candidate(negative));
if (good.status !== 0 || bad.status === 0 || bad.status === null) {
outcome = { code: 1, report: { ok: false, expected, actual, good,
negative: { artifact: negative, missing, result: bad } } };
} else {
outcome = { code: 0, report: { ok: true, expected, actual,
goodExit: good.status, negativeExit: bad.status, missing } };
}
} catch (error) {
outcome = { code: 2, error: error instanceof Error ? error.message : String(error) };
} finally {
if (root) {
try { removeTree(root, { recursive: true, force: true }); }
catch (error) {
outcome = { code: 2, error: `cleanup failed for ${root}: ${error instanceof Error ? error.message : String(error)}` };
}
}
}
return outcome;
}
if (process.argv[1] && resolve(process.argv[1]) === resolve(fileURLToPath(import.meta.url))) {
let outcome;
try { outcome = runOracle(parseArgs(process.argv.slice(2))); }
catch (error) { outcome = { code: 2, error: error instanceof Error ? error.message : String(error) }; }
if (outcome.report) {
const message = JSON.stringify(outcome.report, null, 2);
(outcome.code === 0 ? console.log : console.error)(message);
}
if (outcome.error) console.error(`[lipo oracle] ${outcome.error}`);
process.exitCode = outcome.code;
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 117k | Updated | Claude CodeCodex | Unverified | Install |