Development¶
claude --plugin-dir <checkout> loads a checkout for one session.
Verify¶
From a checkout of the companion repository:
claude plugin validate .
claude plugin validate --strict .
claude plugin test .
The validation passes with no warning (checked on Claude Code 2.1.328). Its listing of the hooks module is the statement
of what the mod does: the events it hooks, the engine calls it makes, the variables it reads and writes (it writes
ANTHROPIC_CUSTOM_HEADERS and no other), and the state values types/index.d.ts declares. The gating hooks sit where a
hook could refuse what was asked, on agent.spawn, classic.SessionStart, classic.Stop, classic.SubagentStop,
classic.UserPromptSubmit, prompt.submit and tool.call, the hooks on classic.SessionStart and
classic.UserPromptSubmit only with Session title reports on. Each passes its event on unchanged, and its .catch
passes the event on when the mod fails, so the mod refuses no prompt, tool call, spawn or stop. The settings hooks on
config.set refuse a Management URL as Configure states and nothing else.
claude plugin test runs the cases in hooks/*.test.ts (checked on Claude Code 2.1.299 and 2.1.328). They replay the
event logs under hooks/fixtures/, recorded from sessions of Claude Code 2.1.287 and 2.1.328, and hand-built events
where no log shows a row, against a stubbed router whose answers each case scripts, on a clock the case advances. No
test opens a socket.
A hooks module may import sibling files of the plugin (checked on Claude Code 2.1.319).
Where the console shows a session the mod reports is on the router's page The companion mod, under "The Sessions view".
The start check and the plugin API¶
Two answers from the plugin API types of Claude Code 2.1.304, the claude-code.d.ts that build's engine lays beside a
loaded mod, settle how the start check runs:
Hook budget. HookBudget.ms gives a hook 10 seconds per dispatch, and the clock stops while a next(e) call or any
$ call of the hook's is in flight, a $.clock wait excepted. The start check's three-second $.clock.sleep counts
against the budget and its GET does not, so both fit.
Tool registration. The doc of $.tool.register says a name registered again is replaced, and the call rejects until
the session binds, at session.start. A reload runs session.start again and registers the same tool under the same
name, which replaces the registration without a second entry in the tool list.
Releasing¶
A release of the companion is a GitHub release with no asset. The Release workflow guards it and then writes the
release's tag and commit into the entry phoebis-companion of the catalog, phoebis-project/phoebis-marketplace, with
the token of a GitHub App. The App's client id is the variable CATALOG_APP_CLIENT_ID and its key the secret
CATALOG_APP_PRIVATE_KEY of the environment catalog. The workflow runs on a published release, on a manual dispatch,
and on a pull request that touches a file the guard reads (.claude-plugin/plugin.json, the workflow or
docs/site/changelog.md). To release:
- Run the three commands of Verify at the commit, since no workflow runs them.
- Set
versionin.claude-plugin/plugin.jsonto the version (X.Y.Z, orX.Y.Z-rc.1for a prerelease), rename the changelog's## Unreleasedheading to## X.Y.Z, or write that section where no change opened one, and merge tomain. The changelog's heading and the release's tag are the version exactly as this step sets it, a suffix included:## X.Y.Z-rc.1and the tagX.Y.Z-rc.1for a prerelease. A commit onmainreaches no installed user ahead of a release, and a release reaches one only under a raised version, since Claude Code takes a plugin's version from the manifest. - Run the manual dispatch (Actions, Release, Run workflow) on
mainas the dry run. It proves the guard, the App's token and the read of the catalog: the jobcatalogprints the entry that a release of the manifest's version would write, and it writes nothing. - Create the release on GitHub with the tag
X.Y.Z, novprefix, at the commit that the dry run proved, with the version as its title and a link to the changelog in its notes. Publishing it starts the workflow. - The workflow's guard refuses the release when the manifest states no version
(
.claude-plugin/plugin.json states no version) or states one that is notX.Y.ZorX.Y.Z-suffix, a number with a leading zero included (.claude-plugin/plugin.json states a version that is not X.Y.Z or X.Y.Z-suffix), when the tag has another form (release tag '{TAG}' is not X.Y.Z or X.Y.Z-suffix), when it differs from the manifest's version (release tag '{TAG}' differs from the version '{version}' in .claude-plugin/plugin.json), or when it has no section in the changelog (docs/site/changelog.md has no '## {TAG}' section for this release). On a dispatch and on a pull request the guard reads the manifest's version in the place of a tag (docs/site/changelog.md has no '## {version}' section for the manifest's version). Behind the guard a full release writes the entry: the jobcatalogsets the entry's source to the companion'shttps://address with the tag as itsrefand the tagged commit as itssha, in one commit on the catalog'smainwith the messageName phoebis-companion X.Y.Z. A prerelease, which is a tag with a suffix or a release that GitHub marks as one, writes nothing. A release whose version is not higher than the one that the catalog names is refused (the catalog names '{ref}', which is not lower than '{TAG}', so the catalog stays), so a release cut from an earlier line takes no user back.
No step by hand follows a release: the catalog names the release once its run ends, and a checkout of the catalog takes
the workflow's commit with a fast-forward pull. A release whose run fails for a reason in its commit is deleted with its
tag and created again at the corrected commit behind a green dry run, as long as the run did not write the catalog. Once
the catalog names the release, the correction ships as the next patch version. A change that a user sees writes its
entry under ## Unreleased, the first section of the changelog, and step 2 renames that heading to the
version.