Skip to content

hassan-mohiddin/freeflow / .deprecated/skill-tooling-pre-rewrite/skills/evaluate-skill

evaluate-skill

Verified

Use when evaluating, comparing, or making readiness claims about agent-skill behavior.

scripts/lib/publication.mjs

View on GitHub
import { lstat, mkdir, rename } from "node:fs/promises";
import { dirname } from "node:path";
import { completeOperation, failedPublication, incompleteOperation, publishedPath } from "./outcome.mjs";

function message(error) {
  return error instanceof Error ? error.message : String(error);
}

function fsOperations(overrides = {}) {
  return { lstat, mkdir, rename, ...overrides };
}

async function destinationExists(path, operations) {
  try {
    await operations.lstat(path);
    return true;
  } catch (error) {
    if (error?.code === "ENOENT") return false;
    throw error;
  }
}

export async function createStagingDirectory(path, operations = {}) {
  const fs = fsOperations(operations);
  try {
    await fs.mkdir(path, { recursive: false });
    return completeOperation({ value: { path } });
  } catch (error) {
    return incompleteOperation({ primary: message(error) });
  }
}

export async function publishResult({ stagingDir, destinationDir, prepare, verify, operations = {} }) {
  const fs = fsOperations(operations);
  try {
    if (await destinationExists(destinationDir, fs))
      throw new Error(`Result destination already exists: ${destinationDir}`);
    await prepare(stagingDir);
    await verify(stagingDir);
    await fs.mkdir(dirname(destinationDir), { recursive: true });
    await fs.rename(stagingDir, destinationDir);
    return publishedPath(destinationDir);
  } catch (error) {
    return failedPublication(message(error));
  }
}

export async function publishDiagnostic({ stagingDir, destinationDir, writeDiagnostic, operations = {} }) {
  const fs = fsOperations(operations);
  try {
    if (await destinationExists(destinationDir, fs))
      throw new Error(`Diagnostic destination already exists: ${destinationDir}`);
    await writeDiagnostic(stagingDir);
    await fs.mkdir(dirname(destinationDir), { recursive: true });
    await fs.rename(stagingDir, destinationDir);
    return publishedPath(destinationDir);
  } catch (error) {
    return failedPublication(message(error));
  }
}
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: 471kUpdated Claude CodeCodexVerifiedInstall
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: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 availableStars: 322kUpdated Claude CodeCodexVerifiedInstall