Skip to content

michael-denyer/pstack-claude / plugins/pstack/skills/poteto-mode

poteto-mode

Verified

poteto's agent style for concise, detailed responses, deliberate subagents, unslopped prose, simple code, and verified work. Use for poteto, /poteto-mode, or requests to work in this style.

FileKindSize
SKILL.mdskill md18.2 KB
playbooks/authoring-a-skill.mdmarkdown852 B
playbooks/autonomous-run.mdmarkdown1.9 KB
playbooks/autopilot-full.mdmarkdown8.3 KB
playbooks/autopilot-stack.mdmarkdown1.3 KB
playbooks/babysit.mdmarkdown2.3 KB
playbooks/bug-fix.mdmarkdown4.8 KB
playbooks/eval.mdmarkdown2.8 KB
playbooks/feature.mdmarkdown3.4 KB
playbooks/hillclimb.mdmarkdown4.4 KB
playbooks/investigation.mdmarkdown920 B
playbooks/multi-phase-plan.mdmarkdown1.6 KB
playbooks/opening-a-pr.mdmarkdown1.0 KB
playbooks/pause-safely.mdmarkdown1.9 KB
playbooks/perf-issue.mdmarkdown1.5 KB
playbooks/prototype.mdmarkdown2.1 KB
playbooks/refactoring.mdmarkdown3.3 KB
playbooks/runtime-forensics.mdmarkdown1.3 KB
playbooks/session-pickup.mdmarkdown2.7 KB
playbooks/shipping.mdmarkdown7.2 KB
playbooks/trace-forensics.mdmarkdown1.8 KB
playbooks/visual-parity.mdmarkdown1.2 KB
playbooks/worktree-cleanup.mdmarkdown4.5 KB
references/agents/comment-sicko.mdmarkdown2.9 KB
references/agy-tools.mdmarkdown10.3 KB
references/bugbot-triage.mdmarkdown9.4 KB
references/codex-tools.mdmarkdown13.6 KB
references/copilot-tools.mdmarkdown20.6 KB
references/dsh-tools.mdmarkdown4.8 KB
references/grok.mdmarkdown3.9 KB
references/kimi-tools.mdmarkdown4.6 KB
references/licenses/LICENSEother1.1 KB
references/licenses/LICENSE-cursor-team-kitother1.0 KB
references/licenses/LICENSE-thermosother1.0 KB
references/licenses/NOTICE.mdmarkdown1.9 KB
references/merge-safety.mdmarkdown5.2 KB
references/minimax-tools.mdmarkdown10.2 KB
references/muse-tools.mdmarkdown12.5 KB
references/omp-tools.mdmarkdown6.8 KB
references/opencode-tools.mdmarkdown3.3 KB
references/pi-tools.mdmarkdown23.5 KB
references/resume-storage.mdmarkdown3.6 KB
scripts/.prettierignoreother652 B
scripts/.prettierrc.jsonconfig29 B
scripts/bootstrap.tsscript2.0 KB
scripts/bun.lockother6.5 KB
scripts/check-playbooks.mjsscript6.8 KB
scripts/codex-session-effort.mjsscript3.9 KB
scripts/package.jsonmanifest320 B
scripts/resume.mjsscript7.2 KB
scripts/tsconfig.jsonconfig304 B
scripts/watch-pr/check-suites.tsscript1.9 KB
scripts/watch-pr/cli.port.test.tsscript2.9 KB
scripts/watch-pr/cli.test.tsscript11.2 KB
scripts/watch-pr/cli.tsscript8.7 KB
scripts/watch-pr/deadline.tsscript522 B
scripts/watch-pr/fakes.test-helper.tsscript4.2 KB
scripts/watch-pr/fresh-install.test.tsscript1.3 KB
scripts/watch-pr/github.port.test.tsscript19.7 KB
scripts/watch-pr/github.test.tsscript16.6 KB
scripts/watch-pr/github.tsscript34.7 KB
scripts/watch-pr/head-checks.tsscript1.3 KB
scripts/watch-pr/integrity.test.tsscript24.3 KB
scripts/watch-pr/landing.tsscript3.0 KB
scripts/watch-pr/live-merge-safety.mjsscript7.4 KB
scripts/watch-pr/policy.port.test.tsscript29.0 KB
scripts/watch-pr/policy.test.tsscript14.8 KB
scripts/watch-pr/policy.tsscript29.6 KB
scripts/watch-pr/render.tsscript9.6 KB
scripts/watch-pr/ship-prexecutablescript220 B
scripts/watch-pr/shipping-cli.test.tsscript5.3 KB
scripts/watch-pr/shipping-cli.tsscript2.3 KB
scripts/watch-pr/shipping.test-helper.tsscript2.1 KB
scripts/watch-pr/shipping.test.tsscript11.0 KB
scripts/watch-pr/shipping.tsscript6.7 KB
scripts/watch-pr/transport.test.tsscript15.2 KB
scripts/watch-pr/tsconfig.jsonconfig270 B
scripts/watch-pr/types.compile.tsscript2.7 KB
scripts/watch-pr/types.tsscript15.0 KB
scripts/watch-pr/watch-prexecutablescript211 B
scripts/watch-pr/wrapper.test.tsscript587 B
scripts/worktree-audit.mjsexecutablescript22.4 KB
worker.mdmarkdown1.3 KB

scripts/watch-pr/shipping.test.ts

View on GitHub
import { describe, expect, it } from "bun:test";
import { parsePrNumber } from "./types.ts";
import {
  GhShippingService,
  cancelPending,
  inspectLanding,
  parseLandingRecord,
  type LandingRecord,
  type ShippingService,
} from "./shipping.ts";
import { fakeGitHub } from "./shipping.test-helper.ts";

const context = { owner: "owner", repo: "repo", number: parsePrNumber(1) };
const empty: LandingRecord = {
  revision: {
    context,
    headRefOid: "head",
    baseRefName: "main",
    baseRefOid: "base",
  },
  pullRequestId: "pr-id",
  state: "OPEN",
  pending: { autoMerge: false, queueEntryId: null },
  mergeCommitOid: null,
};

function fixture(pending: LandingRecord["pending"]) {
  let current: LandingRecord = { ...empty, pending };
  const mutations: string[] = [];
  const service: ShippingService = {
    async inspect() {
      return current;
    },
    async disableAutoMerge(id) {
      expect(id).toBe("pr-id");
      mutations.push("disable");
      current = {
        ...current,
        pending: { ...current.pending, autoMerge: false },
      };
    },
    async dequeue(id) {
      expect(id).toBe("pr-id");
      mutations.push("dequeue");
      current = {
        ...current,
        pending: { ...current.pending, queueEntryId: null },
      };
    },
  };
  return {
    service,
    mutations,
    read: () => current,
    set: (value: LandingRecord) => {
      current = value;
    },
  };
}

describe("pending merge cancellation", () => {
  for (const pending of [
    { autoMerge: false, queueEntryId: null },
    { autoMerge: true, queueEntryId: null },
    { autoMerge: false, queueEntryId: "queue-id" },
    { autoMerge: true, queueEntryId: "queue-id" },
  ]) {
    it(`removes ${JSON.stringify(pending)} and reads back a stable open record`, async () => {
      const f = fixture(pending);
      const expected = f.read();
      expect(await cancelPending(f.service, expected)).toEqual({
        kind: "cancelled",
        record: empty,
      });
      expect(f.read().pending).toEqual({
        autoMerge: false,
        queueEntryId: null,
      });
      expect(f.mutations).toEqual([
        ...(pending.autoMerge ? ["disable"] : []),
        ...(pending.queueEntryId ? ["dequeue"] : []),
      ]);
      expect(await cancelPending(f.service, expected)).toEqual({
        kind: "cancelled",
        record: empty,
      });
    });
  }

  it("does not dequeue when disabling auto-merge also removes queue membership", async () => {
    const f = fixture({ autoMerge: true, queueEntryId: "queue-id" });
    const expected = f.read();
    f.service.disableAutoMerge = async () => {
      f.set(empty);
    };
    expect(await cancelPending(f.service, expected)).toEqual({
      kind: "cancelled",
      record: empty,
    });
    expect(f.mutations).toEqual([]);
  });

  for (const change of [
    { revision: { ...empty.revision, headRefOid: "changed" } },
    { revision: { ...empty.revision, baseRefName: "release" } },
    { revision: { ...empty.revision, baseRefOid: "advanced" } },
    { pullRequestId: "different-pr" },
  ]) {
    it(`refuses a stale record before mutation: ${JSON.stringify(change)}`, async () => {
      const f = fixture({ autoMerge: true, queueEntryId: "queue-id" });
      const expected = f.read();
      f.set({ ...expected, ...change });
      expect(await cancelPending(f.service, expected)).toMatchObject({
        kind: "changed",
      });
      expect(f.mutations).toEqual([]);
      expect(f.read().pending).toEqual(expected.pending);
    });
  }

  it("stops if the base moves during cancellation without dequeuing the changed PR", async () => {
    const f = fixture({ autoMerge: true, queueEntryId: "queue-id" });
    const expected = f.read();
    const disable = f.service.disableAutoMerge;
    f.service.disableAutoMerge = async (id) => {
      await disable(id);
      f.set({
        ...f.read(),
        revision: { ...empty.revision, baseRefOid: "advanced" },
      });
    };
    expect(await cancelPending(f.service, expected)).toMatchObject({
      kind: "changed",
    });
    expect(f.mutations).toEqual(["disable"]);
    expect(f.read().pending.queueEntryId).toBe("queue-id");
  });

  it("reports a merge during cancellation instead of permission to rewrite", async () => {
    const f = fixture({ autoMerge: false, queueEntryId: "queue-id" });
    const expected = f.read();
    f.service.dequeue = async () => {
      f.set({ ...empty, state: "MERGED", mergeCommitOid: "merged" });
    };
    expect(await cancelPending(f.service, expected)).toMatchObject({
      kind: "not-open",
      record: { state: "MERGED" },
    });
  });

  it("refuses rearmed pending state on readback", async () => {
    const f = fixture({ autoMerge: false, queueEntryId: "queue-id" });
    const expected = f.read();
    f.service.dequeue = async () => {
      f.set({ ...empty, pending: { autoMerge: true, queueEntryId: null } });
    };
    expect(await cancelPending(f.service, expected)).toMatchObject({
      kind: "still-pending",
    });
  });

  it("reports an unavailable readback and does not continue mutating", async () => {
    const f = fixture({ autoMerge: true, queueEntryId: "queue-id" });
    const expected = f.read();
    let reads = 0;
    f.service.inspect = async () => {
      if (++reads > 1) throw new Error("offline");
      return f.read();
    };
    expect(await cancelPending(f.service, expected)).toEqual({
      kind: "unavailable",
      detail: "offline",
    });
    expect(f.mutations).toEqual(["disable"]);
  });
});

const raw = {
  id: "pr-id",
  state: "OPEN",
  headRefOid: "head",
  baseRefName: "main",
  baseRef: { target: { oid: "base" } },
  autoMergeRequest: null,
  mergeQueueEntry: null,
  mergeCommit: null,
};
const response = (pullRequest: unknown) => ({
  data: { repository: { pullRequest } },
});

describe("shipping GitHub boundary", () => {
  it("reads the current base target instead of the PR's stored base OID", async () => {
    let query = "";
    const service = new GhShippingService(async (args) => {
      query = args.find((arg) => arg.startsWith("query=")) ?? "";
      return response(raw);
    });
    expect(await service.inspect(context)).toMatchObject({
      revision: { baseRefOid: "base" },
    });
    expect(query).toContain("baseRef { target { oid } }");
  });

  it("parses the complete record and distinguishes queue-only pending state", async () => {
    const service = new GhShippingService(async () =>
      response({ ...raw, mergeQueueEntry: { id: "queued" } })
    );
    expect(await service.inspect(context)).toEqual({
      ...empty,
      pending: { autoMerge: false, queueEntryId: "queued" },
    });
  });

  for (const field of [
    "baseRef",
    "autoMergeRequest",
    "mergeQueueEntry",
    "mergeCommit",
  ]) {
    it(`treats missing ${field} as unavailable, never absent`, async () => {
      const missing = Object.fromEntries(
        Object.entries(raw).filter(([name]) => name !== field)
      );
      const service = new GhShippingService(async () => response(missing));
      expect(await inspectLanding(service, context)).toMatchObject({
        kind: "unavailable",
      });
    });
  }

  it("rejects partial GraphQL data when errors exist", async () => {
    const service = new GhShippingService(async () => ({
      ...response(raw),
      errors: [{ message: "denied" }],
    }));
    expect(await inspectLanding(service, context)).toMatchObject({
      kind: "unavailable",
    });
  });

  it("uses separate mutations for both pending mechanisms", async () => {
    const pullRequest = {
      ...raw,
      autoMergeRequest: { enabledAt: "now" },
      mergeQueueEntry: { id: "queue" },
    };
    const service = new GhShippingService(async (args) =>
      fakeGitHub(pullRequest, args)
    );
    const expected = await service.inspect(context);
    expect(await cancelPending(service, expected)).toEqual({
      kind: "cancelled",
      record: empty,
    });
  });

  it("stops before dequeue when the current base moves during readback", async () => {
    const reads = [
      {
        ...raw,
        baseRef: { target: { oid: "base" } },
        autoMergeRequest: { enabledAt: "now" },
        mergeQueueEntry: { id: "queue" },
      },
      {
        ...raw,
        baseRef: { target: { oid: "base" } },
        autoMergeRequest: { enabledAt: "now" },
        mergeQueueEntry: { id: "queue" },
      },
      {
        ...raw,
        baseRef: { target: { oid: "advanced" } },
        autoMergeRequest: null,
        mergeQueueEntry: { id: "queue" },
      },
      {
        ...raw,
        baseRef: { target: { oid: "advanced" } },
        autoMergeRequest: null,
        mergeQueueEntry: null,
      },
    ];
    const mutations: string[] = [];
    const service = new GhShippingService(async (args) => {
      const query = args.find((arg) => arg.startsWith("query=")) ?? "";
      if (query.includes("disablePullRequestAutoMerge")) {
        mutations.push("disable");
        return { data: { disablePullRequestAutoMerge: {} } };
      }
      if (query.includes("dequeuePullRequest")) {
        mutations.push("dequeue");
        return { data: { dequeuePullRequest: {} } };
      }
      const pullRequest = reads.shift();
      if (!pullRequest) throw new Error("unexpected inspection");
      return response(pullRequest);
    });
    const expected = await service.inspect(context);

    expect(await cancelPending(service, expected)).toMatchObject({
      kind: "changed",
      expected: { revision: { baseRefOid: "base" } },
      observed: { revision: { baseRefOid: "advanced" } },
    });
    expect(mutations).toEqual(["disable"]);
  });

  it("treats a null base ref as unavailable for an open PR", async () => {
    const service = new GhShippingService(async () =>
      response({ ...raw, baseRef: null, baseRefOid: "stored-base" })
    );
    expect(await inspectLanding(service, context)).toMatchObject({
      kind: "unavailable",
    });
  });

  it("rejects malformed saved context before it can select a PR", () => {
    expect(() =>
      parseLandingRecord({
        ...empty,
        revision: { ...empty.revision, context: { ...context, number: -1 } },
      })
    ).toThrow();
  });
});

describe("shipping validation detail", () => {
  for (const [name, pullRequest, detail] of [
    [
      "an unknown state",
      { ...raw, state: "DRAFT" },
      "missing or invalid PR state",
    ],
    [
      "an empty base commit",
      { ...raw, baseRef: { target: { oid: "" } } },
      "baseRef.target.oid must be a non-empty string",
    ],
    [
      "a malformed queue entry",
      { ...raw, mergeQueueEntry: { id: 1 } },
      "queue entry id must be a non-empty string",
    ],
  ] as const)
    it(`names ${name} in the unavailable detail`, async () => {
      const service = new GhShippingService(async () => response(pullRequest));
      expect(await inspectLanding(service, context)).toEqual({
        kind: "unavailable",
        detail,
      });
    });

  it("names a missing autoMerge state in a saved record", () => {
    expect(() =>
      parseLandingRecord({ ...empty, pending: { queueEntryId: null } })
    ).toThrow("missing autoMerge state");
  });
});
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