Skip to content
Back to search

apexyard

MarketplaceWorks with Claude CodeGitHub

ApexYard plugins: ORBIT planning and fork-only add-ons for an ApexYard ops fork.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/me2resh/apexyard with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/me2resh/apexyard'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/me2resh--apexyard/badge.svg)](/listings/me2resh--apexyard)

HTML

<a href="/listings/me2resh--apexyard"><img src="/api/listings/me2resh--apexyard/badge.svg" alt="findsafeskills safety rating" /></a>

Install

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

ApexYard governs a **portfolio of repos** as one organisation. Fork and clone the repository. Use that fork as your ops repo. Register each project you want to manage. The fork is the ops repo, so no nested installation is needed.

> **Using opencode, pi, or Codex?** Steps 1–3 use plain `git` and `gh`. Install > your tool's adapter before steps 4–6. Each step also gives a manual file > option. The enforced rules are the same in both paths.

1. Star + Fork on GitHub

Visit [`github.com/me2resh/apexyard`](https://github.com/me2resh/apexyard). Star it, then fork it into your organisation. Keep the name `apexyard`, or use a name such as `your-org/ops`.

2. Clone your fork locally

gh repo clone your-org/apexyard
cd apexyard

Or with plain git:

git clone https://github.com/your-org/apexyard.git
cd apexyard

3. Add `upstream` for future updates

git remote add upstream https://github.com/me2resh/apexyard.git

Later, run **`/update`** to bring upstream changes into your fork. The skill previews the diff, uses a sync branch, and guides any version migrations.

4. Configure the framework — run `/setup`

Run **`/setup`** in Claude Code. The skill asks about your company, team, technology, and quality bar. It shows the proposed defaults before it writes the configuration.

/setup

Your real config lives in the **gitignored** `onboarding.yaml`. It stays local. `/setup` copies the tracked `onboarding.example.yaml` placeholder and fills it in. A commit-time guard blocks the real file if you try to add it.

No `/setup` on your tool? Copy the example and fill it in by hand: `cp onboarding.example.yaml onboarding.yaml`. The gates read the file, not the skill.

5. Register your projects — run `/handover`

Projects join the portfolio through a skill. For each repo you want to manage:

/handover <repo-url-or-local-path>

**`/handover`** clones the repo, scores five harnessability dimensions, seeds the project docs, and **registers the repo in `apexyard.projects.yaml`**. It creates the registry on first use. `/setup` can register your first project.

The registry it maintains looks like this — you rarely touch it by hand:

version: 1
projects:
  - name: example-app
    repo: your-org/example-app
    docs: projects/example-app
    status: active

Register a single repo too. The portfolio skills (`/projects`, `/inbox`, and `/status`) read the same registry. No `/handover` on your tool? Copy `apexyard.projects.yaml.example` and add the repos by hand.

6. Start working

/projects          # list managed projects and status
/inbox             # show PRs, issues, and comments that need attention
/status            # show the git and CI state for each project
/decide            # record a technical decision

Hooks run on `git` and `gh` commands. Portfolio skills read the registry. Run `/code-review <pr>` to invoke the Code Reviewer agent.

Full setup guide with directory layout, daily workflow, and FAQ: [`docs/multi-project.md`](docs/multi-project.md).

Keeping a fork current — upgrade in place, when to re-fork instead, and how to preserve your portfolio data either way: [`docs/upgrading.md`](docs/upgrading.md).

Optional: status band above the prompt

The `apexyard-status` plugin draws one line above the Claude Code prompt. The line shows the active ticket, the PRs that wait for your `/approve-merge`, and the reviewer lock of the session. The plugin only reads data. It checks the open PRs with one cached, read-only `gh pr list` call for each repo. It does not replace a hook or a gate.

`/setup` asks if you want the band. If you skipped that question, run these two commands from the ops-fork root:

claude plugin marketplace add ./ --scope local
claude plugin install apexyard-status@apexyard --scope local

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 33 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. {
  2. "name": "apexyard",
  3. "description": "ApexYard plugins: ORBIT planning and fork-only add-ons for an ApexYard ops fork.",
  4. "owner": {
  5. "name": "me2resh",
  6. "url": "https://github.com/me2resh"
  7. },
  8. "plugins": [
  9. {
  10. "name": "orbit",
  11. "source": {
  12. "source": "github",
  13. "repo": "me2resh/orbit-spec"
  14. },
  15. "description": "ORBIT planning lifecycle: plan, snapshot, reconcile, slice, progress"
  16. },
  17. {
  18. "name": "apexyard-status",
  19. "source": "./plugins/apexyard-status",
  20. "description": "Fork-only, display-only status band above the prompt: active ticket, PRs waiting for /approve-merge, reviewer lock"
  21. },
  22. {
  23. "name": "apexyard-explainer",
  24. "source": "./plugins/apexyard-explainer",
  25. "description": "Display-only pane that explains each tool call in one plain sentence"
  26. },
  27. {
  28. "name": "apexyard-bootcamp",
  29. "source": "./plugins/apexyard-bootcamp",
  30. "description": "Display-only guided bootcamp pane with nine modules and session checkpoints"
  31. }
  32. ]
  33. }
README.md · README · 350 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <p align="center">
  2. <a href="https://apexyard.ai"><img src="https://apexyard.ai/brand/apexyard-avatar-512.png" alt="ApexYard" width="88"></a>
  3. </p>
  4. <h1 align="center">ApexYard</h1>
  5. <p align="center">
  6. <strong>Take agent-built code the last mile — safely to production.</strong>
  7. </p>
  8. <p align="center">
  9. <a href="https://github.com/me2resh/apexyard/releases"><img src="https://img.shields.io/github/v/release/me2resh/apexyard?color=2F6DF6&label=release" alt="Release"></a>
  10. <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
  11. <a href="https://claude.com/claude-code"><img src="https://img.shields.io/badge/built%20for-Claude%20Code-8A63D2" alt="Built for Claude Code"></a>
  12. <a href="https://apexyard.ai"><img src="https://img.shields.io/badge/site-apexyard.ai-2F6DF6" alt="Site"></a>
  13. <a href="https://github.com/me2resh/apexyard/stargazers"><img src="https://img.shields.io/github/stars/me2resh/apexyard?style=social" alt="Stars"></a>
  14. </p>
  15. ## AI can build quickly. Shipping safely needs a system.
  16. AI can produce a working prototype in a weekend. Teams still need a way to
  17. track decisions, review changes, run checks, and approve a release.
  18. **ApexYard provides that system.** Every change starts with a ticket. An
  19. independent reviewer checks the change. A merge gate stays closed until a
  20. named human approves the exact commit.
  21. ApexYard is a multi-project **ops repo**. You fork it, register your projects,
  22. and manage the portfolio from one place. Shared rules, project records, and
  23. shell hooks keep the workflow consistent.
  24. Claude Code is the default driver. The rules, hooks, and templates are plain
  25. Markdown and shell, so you can use another coding tool through an adapter.
  26. There is no service to run and no hosted lock-in.
  27. The workflow has been used with TypeScript and AWS Lambda backends, Next.js
  28. apps, Chrome extensions, and native Swift macOS apps.
  29. ## What makes it different
  30. | Area | Without ApexYard | With ApexYard |
  31. |---|---|---|
  32. | Code review | Ad-hoc prompts | Rex reviews every pull request. |
  33. | Technical decisions | Lost in chat | Agent Decision Records preserve them. |
  34. | Quality gates | Manual memory | Shell hooks block unsafe actions. |
  35. | Merge approval | Informal “LGTM” | Rex and a named human approve the exact commit. |
  36. | Database migrations | High-risk edits | A migration ticket and rollback plan are required. |
  37. | Architecture | Scattered notes | C4 templates and the `/c4` skill create a shared model. |
  38. | Portfolio view | Several GitHub tabs | `/inbox`, `/status`, and `/tasks` read one registry. |
  39. | Upstream updates | Easy to forget | `/update` reports drift and guides the sync. |
  40. | Roles | Repeated context | Role files activate from clear triggers. |
  41. | Onboarding | Manual setup | `/setup` collects the required configuration. |
  42. ## What's inside
  43. ApexYard is a set of plain-text files. Claude Code reads them from the repo
  44. root. No runtime or service is required.
  45. - **20 roles** across 6 departments (engineering, product, design, security, data, architecture) that activate on triggers
  46. - **60 shell hooks** that mechanically enforce the SDLC — ticket-first edits, a two-marker merge gate, migration gates, secrets scanning, and more
  47. - **69 slash-command skills** — from `/setup`, `/handover`, and `/scaffold` to `/decide`, `/code-review`, `/migration`, and `/launch-check`
  48. - **23 sub-agents** — Rex (code review), Hakim (security), Tariq (design review), plus the department personas
  49. - **22 rule files**, workflow docs, and document templates (PRD, tech design, ADR, AgDR, C4 diagrams)
  50. **See [`docs/whats-inside.md`](docs/whats-inside.md) for the full directory and component list.**
  51. > **Marketing site:** the site that was previously bundled here has moved to its own repo ([me2resh/apexyard-site](https://github.com/me2resh/apexyard-site)) and is deployed independently at [apexyard.ai](https://apexyard.ai).
  52. >
  53. > **Built for Claude Code first.** opencode, pi, and Codex use the same rules through small adapters. Cursor loads `.claude/` natively in the IDE. See [Using another AI coding tool?](#using-another-ai-coding-tool).
  54. >
  55. > **For AI coding agents:** `AGENTS.md` is the universal entry document for tools that do not load `CLAUDE.md`. See [`docs/harnesses/pi.md`](docs/harnesses/pi.md).
  56. ## Quick Start — fork and go
  57. ApexYard governs a **portfolio of repos** as one organisation. Fork and clone
  58. the repository. Use that fork as your ops repo. Register each project you want
  59. to manage. The fork is the ops repo, so no nested installation is needed.
  60. > **Using opencode, pi, or Codex?** Steps 1–3 use plain `git` and `gh`. Install
  61. > your tool's adapter before steps 4–6. Each step also gives a manual file
  62. > option. The enforced rules are the same in both paths.
  63. ### 1. Star + Fork on GitHub
  64. Visit [`github.com/me2resh/apexyard`](https://github.com/me2resh/apexyard).
  65. Star it, then fork it into your organisation. Keep the name `apexyard`, or use
  66. a name such as `your-org/ops`.
  67. ### 2. Clone your fork locally
  68. ```bash
  69. gh repo clone your-org/apexyard
  70. cd apexyard
  71. ```
  72. Or with plain git:
  73. ```bash
  74. git clone https://github.com/your-org/apexyard.git
  75. cd apexyard
  76. ```
  77. ### 3. Add `upstream` for future updates
  78. ```bash
  79. git remote add upstream https://github.com/me2resh/apexyard.git
  80. ```
  81. Later, run **`/update`** to bring upstream changes into your fork. The skill
  82. previews the diff, uses a sync branch, and guides any version migrations.
  83. ### 4. Configure the framework — run `/setup`
  84. Run **`/setup`** in Claude Code. The skill asks about your company, team,
  85. technology, and quality bar. It shows the proposed defaults before it writes
  86. the configuration.
  87. ```text
  88. /setup
  89. ```
  90. Your real config lives in the **gitignored** `onboarding.yaml`. It stays local.
  91. `/setup` copies the tracked `onboarding.example.yaml` placeholder and fills it
  92. in. A commit-time guard blocks the real file if you try to add it.
  93. No `/setup` on your tool? Copy the example and fill it in by hand:
  94. `cp onboarding.example.yaml onboarding.yaml`. The gates read the file, not the
  95. skill.
  96. ### 5. Register your projects — run `/handover`
  97. Projects join the portfolio through a skill. For each repo you want to manage:
  98. ```text
  99. /handover <repo-url-or-local-path>
  100. ```
  101. **`/handover`** clones the repo, scores five harnessability dimensions, seeds
  102. the project docs, and **registers the repo in `apexyard.projects.yaml`**. It
  103. creates the registry on first use. `/setup` can register your first project.
  104. The registry it maintains looks like this — you rarely touch it by hand:
  105. ```yaml
  106. version: 1
  107. projects:
  108. - name: example-app
  109. repo: your-org/example-app
  110. docs: projects/example-app
  111. status: active
  112. ```
  113. Register a single repo too. The portfolio skills (`/projects`, `/inbox`, and
  114. `/status`) read the same registry. No `/handover` on your tool? Copy
  115. `apexyard.projects.yaml.example` and add the repos by hand.
  116. ### 6. Start working
  117. ```
  118. /projects # list managed projects and status
  119. /inbox # show PRs, issues, and comments that need attention
  120. /status # show the git and CI state for each project
  121. /decide # record a technical decision
  122. ```
  123. Hooks run on `git` and `gh` commands. Portfolio skills read the registry. Run
  124. `/code-review <pr>` to invoke the Code Reviewer agent.
  125. Full setup guide with directory layout, daily workflow, and FAQ: [`docs/multi-project.md`](docs/multi-project.md).
  126. Keeping a fork current — upgrade in place, when to re-fork instead, and how to preserve your portfolio data either way: [`docs/upgrading.md`](docs/upgrading.md).
  127. ### Optional: status band above the prompt
  128. The `apexyard-status` plugin draws one line above the Claude Code prompt. The line shows the active ticket, the PRs that wait for your `/approve-merge`, and the reviewer lock of the session. The plugin only reads data. It checks the open PRs with one cached, read-only `gh pr list` call for each repo. It does not replace a hook or a gate.
  129. `/setup` asks if you want the band. If you skipped that question, run these two commands from the ops-fork root:
  130. ```bash
  131. claude plugin marketplace add ./ --scope local
  132. claude plugin install apexyard-status@apexyard --scope local
  133. ```
  134. The band is on only for you, on this machine. After `/update`, run `/reload-plugins` to load the new version. Details and settings: [`plugins/apexyard-status/README.md`](plugins/apexyard-status/README.md).
  135. ## Using another AI coding tool?
  136. **ApexYard was built for Claude Code.** Its slash commands are native Claude
  137. Code skills. The enforcement layer is plain Bash, so other tools can use the
  138. same rules through an adapter.
  139. As of **2026-07-09**, opencode, pi, and Codex have passed real enforcement
  140. checks. Each tool needs one setting so its commands reach the rules. Cursor
  141. IDE native exec was observed later (2026-09-16) when third-party configs are
  142. on. You can always use the
  143. manual configuration files from Quick Start when a skill is unavailable.
  144. | Tool | Enforces your rules? | Setup | Good to know |
  145. |------|----------------------|-------|--------------|
  146. | **Claude Code** | ✅ **Yes — natively.** Built in; the rules fire on every command. | Nothing to install — `/setup` and you're done. | On Windows, use Git Bash or WSL (the rules are bash). |
  147. | **opencode** | ✅ **Yes — proven.** A real agent's `git add -A` was blocked by the same rule. | `bash bin/install-opencode-adapter.sh` | Run opencode with `--auto` so the agent's command reaches the rule. |
  148. | **pi** | ✅ **Yes — proven.** Same, in a real pi session. | `bash bin/install-pi-adapter.sh` | Run pi with `-a` (auto-approve). pi is deliberately bare-bones — ApexYard is the governance it leaves to you. |
  149. | **Codex** | ✅ **Yes — proven.** Same, in a real Codex session. | `bash bin/sync-codex-adapter.sh` | Codex has to trust the rules once — `/hooks`, a one-off flag, or a user-level install. Details: [`docs/codex-adapter.md`](docs/codex-adapter.md). |
  150. | **Cursor** | ✅ **Yes — native in the IDE.** Cursor loads `.claude/` when third-party configs are on. A real Write call was refused by the ticket-first rule (2026-09-16). | Enable third-party configs. Then `bash bin/install-cursor-adapter.sh` for the session-pin overlay. | IDE only. The command-line `cursor-agent` ignores hooks. A leftover full adapter can lock the session. |
  151. *Under the hood:* your rules stay one set of portable bash scripts, and every tool reads the **same** ones — never a separate copy that can drift out of sync. A daily, credentialed [Conformance CI](docs/conformance-ci.md) job re-verifies opencode, pi, and Codex. Cursor has no headless path in that matrix. Full per-tool setup, limits, and how to add a new tool → **[`docs/harnesses/README.md`](docs/harnesses/README.md)**.
  152. ## Roles, workflows & templates
  153. ApexYard ships **20 roles** across 6 departments that activate on triggers, a full **SDLC** (Planning → Design → Build → Review → QA → Deploy → Monitor) with a dedicated migration sub-workflow, and reusable **document templates** (PRD, technical design, ADR, AgDR, migration AgDR, C4 diagrams).
  154. The full role roster, workflow detail, and template catalogue live in **[`docs/whats-inside.md`](docs/whats-inside.md)**. The canonical entry point Claude Code reads is [`CLAUDE.md`](CLAUDE.md).
  155. ## Show you're governed by ApexYard
  156. Running your repo under ApexYard? Add a badge to its README. Every adopter repo that carries one is a backlink and a bit of social proof — and `/handover` will offer to drop it into the repos it onboards.
  157. **Governed by** — for a repo managed under an ApexYard ops fork:
  158. ```markdown
  159. [![Governed by ApexYard](https://img.shields.io/badge/governed_by-ApexYard-2F6DF6?style=flat-square)](https://github.com/me2resh/apexyard)
  160. ```
  161. [![Governed by ApexYard](https://img.shields.io/badge/governed_by-ApexYard-2F6DF6?style=flat-square)](https://github.com/me2resh/apexyard)
  162. **Built with** — for a project built out through the ApexYard workflow:
  163. ```markdown
  164. [![Built with ApexYard](https://img.shields.io/badge/built_with-ApexYard-2F6DF6?style=flat-square)](https://github.com/me2resh/apexyard)
  165. ```
  166. [![Built with ApexYard](https://img.shields.io/badge/built_with-ApexYard-2F6DF6?style=flat-square)](https://github.com/me2resh/apexyard)
  167. ## Customization
  168. ApexYard is designed to be customized. Every role, workflow, and template can be modified to fit your team:
  169. 1. **Add roles**: Create new `.md` files in `roles/your-department/`
  170. 2. **Modify workflows**: Edit files in `workflows/`
  171. 3. **Add templates**: Drop new templates in `templates/`
  172. 4. **Override anything**: The stack is just markdown files -- edit freely
  173. ## Contributing
  174. Read [CONTRIBUTING.md](CONTRIBUTING.md) for the fork, branch, PR, and review flow.
  175. Open a Bug report or Feature request issue.
  176. The [Code of Conduct](CODE_OF_CONDUCT.md) applies to all participation.
  177. Report security issues in [SECURITY.md](SECURITY.md). Do not open a public issue for those.
  178. ## Contributors
  179. Thanks to everyone who contributes code, documentation, bug reports, ideas, and feedback.
  180. <p>
  181. <a href="https://github.com/me2resh" title="me2resh"><img src="https://github.com/me2resh.png?size=100" width="64" height="64" alt="me2resh"></a>
  182. <a href="https://github.com/AbdElrahmaN31" title="AbdElrahmaN31"><img src="https://github.com/AbdElrahmaN31.png?size=100" width="64" height="64" alt="AbdElrahmaN31"></a>
  183. <a href="https://github.com/HishamM1" title="HishamM1"><img src="https://github.com/HishamM1.png?size=100" width="64" height="64" alt="HishamM1"></a>
  184. <a href="https://github.com/tifa64" title="tifa64"><img src="https://github.com/tifa64.png?size=100" width="64" height="64" alt="tifa64"></a>
  185. <a href="https://github.com/hossam-96" title="hossam-96"><img src="https://github.com/hossam-96.png?size=100" width="64" height="64" alt="hossam-96"></a>
  186. <a href="https://github.com/aniketshukla1" title="aniketshukla1"><img src="https://github.com/aniketshukla1.png?size=100" width="64" height="64" alt="aniketshukla1"></a>
  187. <a href="https://github.com/ahmedashraffcih" title="ahmedashraffcih"><img src="https://github.com/ahmedashraffcih.png?size=100" width="64" height="64" alt="ahmedashraffcih"></a>
  188. <a href="https://github.com/ahmedk20" title="ahmedk20"><img src="https://github.com/ahmedk20.png?size=100" width="64" height="64" alt="ahmedk20"></a>
  189. <a href="https://github.com/moussaws" title="moussaws"><img src="https://github.com/moussaws.png?size=100" width="64" height="64" alt="moussaws"></a>
  190. <a href="https://github.com/a-abdellatif98" title="a-abdellatif98"><img src="https://github.com/a-abdellatif98.png?size=100" width="64" height="64" alt="a-abdellatif98"></a>
  191. <a href="https://github.com/AhmedTheGeek" title="AhmedTheGeek"><img src="https://github.com/AhmedTheGeek.png?size=100" width="64" height="64" alt="AhmedTheGeek"></a>
  192. <a href="https://github.com/MohammedEl-sayedAhmed" title="MohammedEl-sayedAhmed"><img src="https://github.com/MohammedEl-sayedAhmed.png?size=100" width="64" height="64" alt="MohammedEl-sayedAhmed"></a>
  193. <a href="https://github.com/NagyWesley" title="NagyWesley"><img src="https://github.com/NagyWesley.png?size=100" width="64" height="64" alt="NagyWesley"></a>
  194. </p>
  195. ### Issue contributors
  196. Thank you to everyone who opened issues, including bug reports, feature requests, questions, and documentation feedback.
  197. <p>
  198. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aa-abdellatif98" title="a-abdellatif98"><img src="https://github.com/a-abdellatif98.png?size=100" width="64" height="64" alt="a-abdellatif98"></a>
  199. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aa-elnemr" title="a-elnemr"><img src="https://github.com/a-elnemr.png?size=100" width="64" height="64" alt="a-elnemr"></a>
  200. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aabbaseya" title="abbaseya"><img src="https://github.com/abbaseya.png?size=100" width="64" height="64" alt="abbaseya"></a>
  201. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AAbdelrahman-Shahda" title="Abdelrahman-Shahda"><img src="https://github.com/Abdelrahman-Shahda.png?size=100" width="64" height="64" alt="Abdelrahman-Shahda"></a>
  202. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AAbdElrahmaN31" title="AbdElrahmaN31"><img src="https://github.com/AbdElrahmaN31.png?size=100" width="64" height="64" alt="AbdElrahmaN31"></a>
  203. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aaelnemr" title="aelnemr"><img src="https://github.com/aelnemr.png?size=100" width="64" height="64" alt="aelnemr"></a>
  204. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aahmedashraffcih" title="ahmedashraffcih"><img src="https://github.com/ahmedashraffcih.png?size=100" width="64" height="64" alt="ahmedashraffcih"></a>
  205. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aahmedgemi" title="ahmedgemi"><img src="https://github.com/ahmedgemi.png?size=100" width="64" height="64" alt="ahmedgemi"></a>
  206. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AAhmedTheGeek" title="AhmedTheGeek"><img src="https://github.com/AhmedTheGeek.png?size=100" width="64" height="64" alt="AhmedTheGeek"></a>
  207. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aahmedwael216" title="ahmedwael216"><img src="https://github.com/ahmedwael216.png?size=100" width="64" height="64" alt="ahmedwael216"></a>
  208. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aalalm3i" title="alalm3i"><img src="https://github.com/alalm3i.png?size=100" width="64" height="64" alt="alalm3i"></a>
  209. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aasami-me" title="asami-me"><img src="https://github.com/asami-me.png?size=100" width="64" height="64" alt="asami-me"></a>
  210. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aatlas-apex" title="atlas-apex"><img src="https://github.com/atlas-apex.png?size=100" width="64" height="64" alt="atlas-apex"></a>
  211. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aaureyia" title="aureyia"><img src="https://github.com/aureyia.png?size=100" width="64" height="64" alt="aureyia"></a>
  212. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Abatout" title="batout"><img src="https://github.com/batout.png?size=100" width="64" height="64" alt="batout"></a>
  213. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Abitwhispererrr" title="bitwhispererrr"><img src="https://github.com/bitwhispererrr.png?size=100" width="64" height="64" alt="bitwhispererrr"></a>
  214. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aborzoj" title="borzoj"><img src="https://github.com/borzoj.png?size=100" width="64" height="64" alt="borzoj"></a>
  215. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3ADr-kersho" title="Dr-kersho"><img src="https://github.com/Dr-kersho.png?size=100" width="64" height="64" alt="Dr-kersho"></a>
  216. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Adrmas" title="drmas"><img src="https://github.com/drmas.png?size=100" width="64" height="64" alt="drmas"></a>
  217. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aeibrahim95" title="eibrahim95"><img src="https://github.com/eibrahim95.png?size=100" width="64" height="64" alt="eibrahim95"></a>
  218. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aengnaruto" title="engnaruto"><img src="https://github.com/engnaruto.png?size=100" width="64" height="64" alt="engnaruto"></a>
  219. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Ahamoda-dev" title="hamoda-dev"><img src="https://github.com/hamoda-dev.png?size=100" width="64" height="64" alt="hamoda-dev"></a>
  220. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Ahazemahmedx0" title="hazemahmedx0"><img src="https://github.com/hazemahmedx0.png?size=100" width="64" height="64" alt="hazemahmedx0"></a>
  221. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AHC12026" title="HC12026"><img src="https://github.com/HC12026.png?size=100" width="64" height="64" alt="HC12026"></a>
  222. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AHishamM1" title="HishamM1"><img src="https://github.com/HishamM1.png?size=100" width="64" height="64" alt="HishamM1"></a>
  223. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AHOSS11H" title="HOSS11H"><img src="https://github.com/HOSS11H.png?size=100" width="64" height="64" alt="HOSS11H"></a>
  224. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Ahossam-96" title="hossam-96"><img src="https://github.com/hossam-96.png?size=100" width="64" height="64" alt="hossam-96"></a>
  225. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aibrahim-gad" title="ibrahim-gad"><img src="https://github.com/ibrahim-gad.png?size=100" width="64" height="64" alt="ibrahim-gad"></a>
  226. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Ajafarguzman666-ops" title="jafarguzman666-ops"><img src="https://github.com/jafarguzman666-ops.png?size=100" width="64" height="64" alt="jafarguzman666-ops"></a>
  227. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AKarimEbrahemAbdelaziz" title="KarimEbrahemAbdelaziz"><img src="https://github.com/KarimEbrahemAbdelaziz.png?size=100" width="64" height="64" alt="KarimEbrahemAbdelaziz"></a>
  228. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Akhaledmedra" title="khaledmedra"><img src="https://github.com/khaledmedra.png?size=100" width="64" height="64" alt="khaledmedra"></a>
  229. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Amabdelaziz77" title="mabdelaziz77"><img src="https://github.com/mabdelaziz77.png?size=100" width="64" height="64" alt="mabdelaziz77"></a>
  230. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Amahmoudsobhy74" title="mahmoudsobhy74"><img src="https://github.com/mahmoudsobhy74.png?size=100" width="64" height="64" alt="mahmoudsobhy74"></a>
  231. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AManito2z" title="Manito2z"><img src="https://github.com/Manito2z.png?size=100" width="64" height="64" alt="Manito2z"></a>
  232. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AMedNewton" title="MedNewton"><img src="https://github.com/MedNewton.png?size=100" width="64" height="64" alt="MedNewton"></a>
  233. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AMeDoTarek73" title="MeDoTarek73"><img src="https://github.com/MeDoTarek73.png?size=100" width="64" height="64" alt="MeDoTarek73"></a>
  234. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AMina4lfy" title="Mina4lfy"><img src="https://github.com/Mina4lfy.png?size=100" width="64" height="64" alt="Mina4lfy"></a>
  235. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AmohamedELamine" title="mohamedELamine"><img src="https://github.com/mohamedELamine.png?size=100" width="64" height="64" alt="mohamedELamine"></a>
  236. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AMohammedEl-sayedAhmed" title="MohammedEl-sayedAhmed"><img src="https://github.com/MohammedEl-sayedAhmed.png?size=100" width="64" height="64" alt="MohammedEl-sayedAhmed"></a>
  237. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Amosta7il" title="mosta7il"><img src="https://github.com/mosta7il.png?size=100" width="64" height="64" alt="mosta7il"></a>
  238. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Amostiwheelietravel" title="mostiwheelietravel"><img src="https://github.com/mostiwheelietravel.png?size=100" width="64" height="64" alt="mostiwheelietravel"></a>
  239. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Amoussaws" title="moussaws"><img src="https://github.com/moussaws.png?size=100" width="64" height="64" alt="moussaws"></a>
  240. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Amuhammadattia95" title="muhammadattia95"><img src="https://github.com/muhammadattia95.png?size=100" width="64" height="64" alt="muhammadattia95"></a>
  241. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3ANagyWesley" title="NagyWesley"><img src="https://github.com/NagyWesley.png?size=100" width="64" height="64" alt="NagyWesley"></a>
  242. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Anickyreinert" title="nickyreinert"><img src="https://github.com/nickyreinert.png?size=100" width="64" height="64" alt="nickyreinert"></a>
  243. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AnLoops" title="nLoops"><img src="https://github.com/nLoops.png?size=100" width="64" height="64" alt="nLoops"></a>
  244. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AOmar-Elhorbity" title="Omar-Elhorbity"><img src="https://github.com/Omar-Elhorbity.png?size=100" width="64" height="64" alt="Omar-Elhorbity"></a>
  245. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AOmarEhab007" title="OmarEhab007"><img src="https://github.com/OmarEhab007.png?size=100" width="64" height="64" alt="OmarEhab007"></a>
  246. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AOmarElaraby26" title="OmarElaraby26"><img src="https://github.com/OmarElaraby26.png?size=100" width="64" height="64" alt="OmarElaraby26"></a>
  247. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Aosama-abu-baker" title="osama-abu-baker"><img src="https://github.com/osama-abu-baker.png?size=100" width="64" height="64" alt="osama-abu-baker"></a>
  248. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AOsamaAlSabry" title="OsamaAlSabry"><img src="https://github.com/OsamaAlSabry.png?size=100" width="64" height="64" alt="OsamaAlSabry"></a>
  249. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Apsmend" title="psmend"><img src="https://github.com/psmend.png?size=100" width="64" height="64" alt="psmend"></a>
  250. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Arafik-wahid-cubeish" title="rafik-wahid-cubeish"><img src="https://github.com/rafik-wahid-cubeish.png?size=100" width="64" height="64" alt="rafik-wahid-cubeish"></a>
  251. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3ARef34t" title="Ref34t"><img src="https://github.com/Ref34t.png?size=100" width="64" height="64" alt="Ref34t"></a>
  252. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Asamahali" title="samahali"><img src="https://github.com/samahali.png?size=100" width="64" height="64" alt="samahali"></a>
  253. <a href="https://github.com/SecFathy" title="SecFathy"><img src="https://github.com/SecFathy.png?size=100" width="64" height="64" alt="SecFathy"></a>
  254. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Asts1078" title="sts1078"><img src="https://github.com/sts1078.png?size=100" width="64" height="64" alt="sts1078"></a>
  255. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Asudanese" title="sudanese"><img src="https://github.com/sudanese.png?size=100" width="64" height="64" alt="sudanese"></a>
  256. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Atifa64" title="tifa64"><img src="https://github.com/tifa64.png?size=100" width="64" height="64" alt="tifa64"></a>
  257. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Avjcv26" title="vjcv26"><img src="https://github.com/vjcv26.png?size=100" width="64" height="64" alt="vjcv26"></a>
  258. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Ayehiagamalx" title="yehiagamalx"><img src="https://github.com/yehiagamalx.png?size=100" width="64" height="64" alt="yehiagamalx"></a>
  259. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AYOoOUNiieeSS" title="YOoOUNiieeSS"><img src="https://github.com/YOoOUNiieeSS.png?size=100" width="64" height="64" alt="YOoOUNiieeSS"></a>
  260. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3Azeyadsleem" title="zeyadsleem"><img src="https://github.com/zeyadsleem.png?size=100" width="64" height="64" alt="zeyadsleem"></a>
  261. <a href="https://github.com/me2resh/apexyard/issues?q=is%3Aissue%20author%3AZiadHosny" title="ZiadHosny"><img src="https://github.com/ZiadHosny.png?size=100" width="64" height="64" alt="ZiadHosny"></a>
  262. </p>
  263. When updating these credits, include new issue authors as well as pull-request contributors.
  264. Use public GitHub handles and links. Describe each contribution accurately.
  265. ## License
  266. MIT License. See [LICENSE](LICENSE) for details.
  267. ---
  268. Built with real-world experience shipping software with Claude Code.
plugins/apexyard-status/hooks/band.test.ts · Bundled script · 280 lines · 1 finding marked
  1. import { describe, expect, test } from 'claude-code/testing'
  2. import {
  3. candidatesFrom,
  4. classify,
  5. countBuilds,
  6. findOpsRoot,
  7. ghArgv,
  8. lockLabel,
  9. lockLabels,
  10. markerRef,
  11. markerSha,
  12. newMarkers,
  13. openPrsFor,
  14. parseOpenPrs,
  15. parentDir,
  16. reReviewText,
  17. rexMarkers,
  18. safeSessionId,
  19. ticketLabel,
  20. validRepo,
  21. waitingText,
  22. } from './band'
  23. import type { Candidate, GhCache, GhRun, OpenPrs } from './band'
  24. import { readSettings, RESOLVE_TICKET } from './register'
  25. const DAY = 24 * 60 * 60 * 1000
  26. describe('review markers (AgDR-0060 names)', () => {
  27. test('a marker name maps to owner/repo#N', async () => {
  28. expect(markerRef('me2resh__apexyard__1541-rex.approved')).toBe('me2resh/apexyard#1541')
  29. expect(markerRef('acme__my_repo.js__7-ceo.approved')).toBe('acme/my_repo.js#7')
  30. })
  31. test('a bare-number marker is not an AgDR-0060 name', async () => {
  32. expect(markerRef('429-rex.approved')).toBe(null)
  33. })
  34. test('candidates = recent Rex marker and no CEO marker', async () => {
  35. const now = 10 * DAY
  36. const entries = [
  37. { name: 'me2resh__apexyard__11-rex.approved', mtimeMs: now - 60_000 },
  38. { name: 'me2resh__apexyard__11-ceo.approved', mtimeMs: now - 30_000 },
  39. { name: 'acme__infra__176-rex.approved', mtimeMs: now - 60_000 },
  40. { name: 'acme__infra__20-rex.approved', mtimeMs: now - 5 * DAY },
  41. { name: '429-rex.approved', mtimeMs: now },
  42. { name: 'acme__infra__30-architecture.approved', mtimeMs: now },
  43. ]
  44. const refs = (days: number) => candidatesFrom(entries, now, days).map(c => c.ref)
  45. expect(refs(3)).toEqual(['acme/infra#176'])
  46. expect(refs(7)).toEqual(['acme/infra#176', 'acme/infra#20'])
  47. expect(candidatesFrom(entries, now, 3)[0]).toEqual({
  48. name: 'acme__infra__176-rex.approved',
  49. ref: 'acme/infra#176',
  50. repo: 'acme/infra',
  51. number: 176,
  52. })
  53. })
  54. test('the first refresh never toasts; later ones toast only new Rex markers', async () => {
  55. const first = rexMarkers([{ name: 'a__b__1-rex.approved', mtimeMs: 0 }])
  56. expect(newMarkers(null, first)).toEqual([])
  57. const second = rexMarkers([
  58. { name: 'a__b__1-rex.approved', mtimeMs: 0 },
  59. { name: 'a__b__2-rex.approved', mtimeMs: 0 },
  60. { name: 'a__b__2-ceo.approved', mtimeMs: 0 },
  61. ])
  62. expect(newMarkers(first, second)).toEqual(['a__b__2-rex.approved'])
  63. })
  64. test('waiting text lists up to three references', async () => {
  65. expect(waitingText([])).toBe('nothing waiting for /approve-merge')
  66. expect(waitingText(['a/b#1', 'a/b#2', 'a/b#3', 'a/b#4'])).toBe(
  67. '4 waiting for your /approve-merge: a/b#1, a/b#2, a/b#3 +1',
  68. )
  69. expect(waitingText(['a/b#1'], true)).toBe('1 waiting for your /approve-merge (offline): a/b#1')
  70. expect(waitingText([], true)).toBe('nothing waiting for /approve-merge (offline)')
  71. })
  72. test('re-review text', async () => {
  73. expect(reReviewText([])).toBe(null)
  74. expect(reReviewText(['a/b#1'])).toBe('1 needs re-review: a/b#1')
  75. expect(reReviewText(['a/b#1', 'a/b#2'])).toBe('2 need re-review: a/b#1, a/b#2')
  76. })
  77. test('the marker SHA is the bare reviewed commit', async () => {
  78. expect(markerSha('ABCDEF1234567\n')).toBe('abcdef1234567')
  79. expect(markerSha('')).toBe(null)
  80. expect(markerSha('approved by rex')).toBe(null)
  81. expect(markerSha(null)).toBe(null)
  82. })
  83. })
  84. const SHA_A = 'a'.repeat(40)
  85. const SHA_B = 'b'.repeat(40)
  86. const cand = (repo: string, n: number): Candidate => ({
  87. name: `${repo.replace('/', '__')}__${n}-rex.approved`,
  88. ref: `${repo}#${n}`,
  89. repo,
  90. number: n,
  91. })
  92. describe('open-PR check (cached, read only)', () => {
  93. test('open with the reviewed head -> waiting; another head -> re-review; not open -> dropped', async () => {
  94. const c1 = cand('me2resh/apexyard', 1)
  95. const c2 = cand('me2resh/apexyard', 2)
  96. const c3 = cand('me2resh/apexyard', 3)
  97. const shas = new Map([[c1.name, SHA_A], [c2.name, SHA_A], [c3.name, SHA_A]])
  98. const open = new Map<string, OpenPrs | null>([['me2resh/apexyard', new Map([[1, SHA_A], [2, SHA_B]])]])
  99. expect(classify([c1, c2, c3], shas, open)).toEqual({
  100. waiting: ['me2resh/apexyard#1'],
  101. reReview: ['me2resh/apexyard#2'],
  102. offline: false,
  103. })
  104. })
  105. test('a short SHA in the marker matches the full head', async () => {
  106. const c = cand('a/b', 5)
  107. const q = classify([c], new Map([[c.name, 'aaaaaaa']]), new Map([['a/b', new Map([[5, SHA_A]])]]))
  108. expect(q.waiting).toEqual(['a/b#5'])
  109. })
  110. test('an open PR whose marker has no SHA needs re-review', async () => {
  111. const c = cand('a/b', 6)
  112. const q = classify([c], new Map([[c.name, null]]), new Map([['a/b', new Map([[6, SHA_A]])]]))
  113. expect(q.reReview).toEqual(['a/b#6'])
  114. })
  115. test('a repo with a failed lookup falls back to the markers and is offline', async () => {
  116. const c1 = cand('a/b', 1)
  117. const c2 = cand('c/d', 2)
  118. const open = new Map<string, OpenPrs | null>([['a/b', null], ['c/d', new Map()]])
  119. expect(classify([c1, c2], new Map(), open)).toEqual({ waiting: ['a/b#1'], reReview: [], offline: true })
  120. })
  121. test('the gh command is read only, an argument array, and needs a valid repo', async () => {
  122. expect(ghArgv('me2resh/apexyard')).toEqual([
  123. 'gh', 'pr', 'list', '--repo', 'me2resh/apexyard', '--state', 'open',
  124. '--json', 'number,headRefOid', '--limit', '200',
  125. ])
  126. expect(validRepo('me2resh/apexyard')).toBe(true)
  127. expect(validRepo('acme/my_repo.js')).toBe(true)
  128. expect(validRepo('a/b; rm -rf /')).toBe(false)
    • Note: Quoted as data in code: Runs `rm -rf` against a root or home-directory path
    • Line 143 on GitHub
  129. expect(validRepo('../b')).toBe(false)
  130. expect(validRepo('a/b/c')).toBe(false)
  131. expect(validRepo('-R/x')).toBe(false)
  132. expect(validRepo('me2resh/.github')).toBe(true)
  133. })
  134. test('parses the open-PR list and refuses another shape', async () => {
  135. const out = parseOpenPrs(JSON.stringify([{ number: 7, headRefOid: SHA_A.toUpperCase() }, { number: 'x' }]))
  136. expect(out && [...out.entries()]).toEqual([[7, SHA_A]])
  137. expect(parseOpenPrs('not json')).toBe(null)
  138. expect(parseOpenPrs('{}')).toBe(null)
  139. })
  140. test('the lookup is cached for 120 seconds per repo, failures too', async () => {
  141. const calls: string[][] = []
  142. let ok = true
  143. const run: GhRun = async argv => {
  144. calls.push([...argv])
  145. if (!ok) throw new Error('gh: not found')
  146. return { exitCode: 0, stdout: JSON.stringify([{ number: 1, headRefOid: SHA_A }]) }
  147. }
  148. const cache: GhCache = new Map()
  149. expect((await openPrsFor(cache, 'a/b', 0, run))?.get(1)).toBe(SHA_A)
  150. await openPrsFor(cache, 'a/b', 119_999, run)
  151. expect(calls.length).toBe(1)
  152. await openPrsFor(cache, 'c/d', 1000, run)
  153. expect(calls.length).toBe(2)
  154. ok = false
  155. expect(await openPrsFor(cache, 'a/b', 120_000, run)).toBe(null)
  156. expect(calls.length).toBe(3)
  157. expect(await openPrsFor(cache, 'a/b', 200_000, run)).toBe(null)
  158. expect(calls.length).toBe(3)
  159. })
  160. test('a failed or invalid lookup returns null and never throws', async () => {
  161. const fail: GhRun = async () => ({ exitCode: 4, stdout: '' })
  162. expect(await openPrsFor(new Map(), 'a/b', 0, fail)).toBe(null)
  163. let called = false
  164. const spy: GhRun = async () => {
  165. called = true
  166. return { exitCode: 0, stdout: '[]' }
  167. }
  168. expect(await openPrsFor(new Map(), 'not a repo', 0, spy)).toBe(null)
  169. expect(called).toBe(false)
  170. })
  171. })
  172. describe('active ticket', () => {
  173. test('label is repo#N plus a short title without the [Type] prefix', async () => {
  174. const text = 'repo=me2resh/apexyard\nnumber=1541\ntitle=[Feature] Optional status band\n'
  175. expect(ticketLabel(text)).toBe('apexyard#1541 Optional status band')
  176. })
  177. test('a long title is cut to 48 characters', async () => {
  178. const label = ticketLabel(`repo=a/b\nnumber=1\ntitle=${'x'.repeat(80)}\n`) ?? ''
  179. expect(label).toBe(`b#1 ${'x'.repeat(47)}…`)
  180. })
  181. test('a marker without repo or number gives null', async () => {
  182. expect(ticketLabel('started_at=now\n')).toBe(null)
  183. })
  184. })
  185. describe('ops-fork discovery', () => {
  186. const fs = (paths: string[]) => async (p: string) => paths.includes(p)
  187. test('the session pin wins when it is an ops fork', async () => {
  188. const exists = fs(['/ops/.apexyard-fork', '/cwd-fork/.apexyard-fork'])
  189. expect(await findOpsRoot('/ops\n', '/cwd-fork/sub', exists)).toBe('/ops')
  190. })
  191. test('a stale pin falls back to a walk up from the working directory', async () => {
  192. const exists = fs(['/home/me/fork/onboarding.yaml', '/home/me/fork/apexyard.projects.yaml'])
  193. expect(await findOpsRoot('/gone', '/home/me/fork/workspace/app', exists)).toBe('/home/me/fork')
  194. })
  195. test('one v1 anchor file alone is not a fork', async () => {
  196. expect(await findOpsRoot(null, '/a/b', fs(['/a/onboarding.yaml']))).toBe(null)
  197. })
  198. test('parent directories walk to the root', async () => {
  199. expect(parentDir('/a/b')).toBe('/a')
  200. expect(parentDir('/a')).toBe('/')
  201. expect(parentDir('/')).toBe(null)
  202. })
  203. })
  204. describe('reviewer lock and builds', () => {
  205. test('the lock reads owner/repo#N:role', async () => {
  206. expect(lockLabel('me2resh/apexyard#12:rex\n')).toBe('me2resh/apexyard#12 (rex)')
  207. expect(lockLabel(' \n')).toBe(null)
  208. })
  209. test('the lock joins every review marker and keeps the legacy file', async () => {
  210. expect(lockLabels(['a/b#1:rex\n', 'a/b#2:security\n', null])).toBe('a/b#1 (rex), a/b#2 (security)')
  211. expect(lockLabels(['a/b#1:rex', 'a/b#1:rex'])).toBe('a/b#1 (rex)')
  212. expect(lockLabels([null, ' \n'])).toBe(null)
  213. })
  214. test('the session id is sanitised like active_reviewer_marker_path', async () => {
  215. expect(safeSessionId('abc-1.2_3')).toBe('abc-1.2_3')
  216. expect(safeSessionId('../x y')).toBe('.._x_y')
  217. })
  218. test('the build count is off when the pattern is empty or invalid', async () => {
  219. expect(countBuilds('codex exec\n', '')).toBe(null)
  220. expect(countBuilds('codex exec\n', '(')).toBe(null)
  221. })
  222. test('the build count is the number of matching command lines', async () => {
  223. const ps = 'codex exec -C /w/a\n/bin/zsh\ncodex exec -C /w/b\n\n'
  224. expect(countBuilds(ps, '^codex exec')).toBe(2)
  225. })
  226. })
  227. describe('ticket resolver', () => {
  228. test('the ticket comes from the framework resolver, not from a marker path', async () => {
  229. expect(RESOLVE_TICKET).toContain('_lib-active-ticket.sh')
  230. expect(RESOLVE_TICKET).toContain('active_ticket_lookup')
  231. expect(RESOLVE_TICKET).not.toContain('apexyard-ticket')
  232. expect(RESOLVE_TICKET).not.toContain('.claude/session')
  233. })
  234. })
  235. describe('settings', () => {
  236. test('defaults: build count off, three-day window', async () => {
  237. expect(readSettings(undefined)).toEqual({ pattern: '', windowDays: 3 })
  238. })
  239. test('values from the plugin options', async () => {
  240. expect(readSettings({ build_process_pattern: 'codex', waiting_window_days: 7 })).toEqual({
  241. pattern: 'codex',
  242. windowDays: 7,
  243. })
  244. expect(readSettings({ waiting_window_days: -1 })).toEqual({ pattern: '', windowDays: 3 })
  245. })
  246. })

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.