Repository navigation
Conversation
`portman --initAgents` writes a Portman section to AGENTS.md in the current directory (and to CLAUDE.md when it exists). It tells coding agents how to run the contract tests (using portman-cli.json when present), to fix the code or deliberately change the spec when a contract test fails instead of editing the generated collection or weakening portman-config.json, how to see all failures, and where to find the docs and docs MCP server. The section is wrapped in <!-- portman:start --> / <!-- portman:end --> markers: existing content is preserved and re-running replaces the block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
portman --initAgents, which writes standing instructions for coding agents toAGENTS.mdin the current directory, and toCLAUDE.mdwhen that file already exists.The Portman section tells agents:
npx @apideck/portman --cliOptionsFile <path>when aportman-cli.jsonexists (in./or./portman/, the--initdefault), otherwise a generic-l <openapi-file> -c portman-config.json -b <baseUrl> --runNewmancommandportman-config.jsonto get a green run--newmanRunOptions '{"abortOnFailure":false}'to see all failures, because Portman aborts on the first failure by defaultDesign
--init: it is handled early insrc/index.tsand exits, without loading a spec or config. The CLI has no subcommands (yargs runs in strict, flag-only mode), so a flag is the consistent choice.<!-- portman:start -->/<!-- portman:end -->. When the markers exist, the block between them is replaced. Otherwise the block is appended after the existing content, separated by a blank line. Content outside the markers is preserved.src/utils/initAgents.ts(initAgents(cwd),renderAgentInstructions,upsertAgentInstructions).Tests
src/utils/initAgents.test.ts(temp dirs): creates AGENTS.md, uses the detectedportman-cli.json, appends while preserving content, re-runs idempotently while preserving surrounding content, updates CLAUDE.md only when it existsPortman.test.ts,tsc --noEmit, oxlint and oxfmt passCLAUDE.md+portman-cli.json: both files written, a re-run leaves one blockLimitations
CLAUDE.mdonly importsAGENTS.md(@AGENTS.md), the block ends up in an agent's context twice. Harmless, but it could be skipped in a follow-up.portman-cli.jsonis only detected in./and./portman/.🤖 Generated with Claude Code