diff --git a/README.md b/README.md index 0649d2835b..34da61f5a2 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,14 @@ npx poe-code@latest spawn codex "Review the auth module" --cwd github://owner/re echo "Say hello" | npx poe-code@latest spawn codex ``` +#### Review a GitHub pull request + +```bash +npx poe-code@latest code-review install +npx poe-code@latest code-review run "https://github.com/owner/repo/pull/123" +npx poe-code@latest code-review commit "https://github.com/owner/repo/pull/123" --dry-run +``` + #### Test a configured service ```bash @@ -217,6 +225,23 @@ const { events, result: ghResult } = spawn("codex", { console.log(result.stdout); ``` +For plugin-first agent composition, import the public agent builder from the +`poe-code/agent` subpath: + +```typescript +import { agent, openaiResponsesPlugin, systemPromptPlugin } from "poe-code/agent"; + +const run = await agent() + .model("gpt-5.5") + .use(openaiResponsesPlugin()) + .use(systemPromptPlugin()) + .run("Summarize the current repository", { + cwd: process.cwd() + }); + +console.log(run.output); +``` + ### `spawn(service, options)` Runs a single prompt through a configured service CLI. diff --git a/docs/README_FULL.md b/docs/README_FULL.md index f865038075..2e9d4fe83a 100644 --- a/docs/README_FULL.md +++ b/docs/README_FULL.md @@ -22,6 +22,7 @@ - [provider](#provider) - [approvals](#approvals) - [spawn](#spawn) + - [code-review](#code-review) - [research](#research) - [wrap](#wrap) - [test](#test) @@ -36,6 +37,7 @@ - [SDK Reference](#sdk-reference) - [spawn()](#spawn-sdk) - [spawn.pretty()](#spawnpretty) + - [Composable agent runtime](#composable-agent-runtime) - [generate()](#generate-sdk) - [generateImage()](#generateimage) - [generateVideo()](#generatevideo) @@ -448,6 +450,36 @@ poe-code spawn codex "Run lint and fix issues" --mode yolo --yes --- +### code-review + +Run agent-assisted GitHub pull request reviews. + +```bash +poe-code code-review +``` + +**Subcommands:** + +| Subcommand | Description | +|------------|-------------| +| `install` | Install repo-local reviewer profiles and prompts. | +| `profiles` | List repo-local reviewer profiles. | +| `ingest ` | Build a runtime reviewer profile from GitHub review history. | +| `run ` | Fetch a PR, run reviewer agents, and create a YAML draft. | +| `drafts ` | Read the active YAML draft for a PR. | +| `commit ` | Validate and publish the merged draft to GitHub; use `--dry-run` to preview. | +| `agent-mcp` | Run the stdio MCP server used by spawned review agents. | + +**Examples:** + +```bash +poe-code code-review install +poe-code code-review run "https://github.com/owner/repo/pull/123" +poe-code code-review commit "https://github.com/owner/repo/pull/123" --dry-run +``` + +--- + ### research Research a codebase using a coding agent in read-only mode. @@ -1153,6 +1185,31 @@ const result2 = await spawn.pretty("claude-code", { }); ``` +### Composable agent runtime + +The `poe-code/agent` subpath exposes the plugin-first agent builder and focused +runtime types for SDK users that want to compose providers, tools, MCP servers, +and hooks directly instead of spawning an external agent CLI. + +```typescript +import { agent, openaiResponsesPlugin, systemPromptPlugin } from "poe-code/agent"; + +const result = await agent() + .model("gpt-5.5") + .use(openaiResponsesPlugin()) + .use(systemPromptPlugin()) + .run("Summarize the current repository", { + cwd: process.cwd() + }); + +console.log(result.output); +``` + +The builder supports `.model(...)`, `.use(...)`, `.tools(...)`, `.mcp(...)`, +`.acp(...)`, `.run(...)`, and `.stream(...)`. The subpath also exports +`openaiChatCompletionsPlugin`, `openaiResponsesPlugin`, and +`systemPromptPlugin`. + ### generate() {#generate-sdk} Generate text using the Poe API. @@ -2617,6 +2674,7 @@ poe-code/ | `provider` | `list`, `login`, `logout` | Provider authentication management | | `approvals` | `list`, `show`, `run` | Toolcraft human-in-loop approval queue | | `spawn [prompt]` | — | Run agent with prompt | +| `code-review` | `install`, `profiles`, `ingest`, `run`, `drafts`, `commit`, `agent-mcp` | Agent-assisted GitHub pull request reviews | | `research [prompt]` | — | Research codebase (read mode) | | `wrap ` | — | One-off isolated session | | `test [agent]` | — | Health check | @@ -2640,6 +2698,12 @@ export { generateImage } from "poe-code"; // Image generation export { generateVideo } from "poe-code"; // Video generation export { generateAudio } from "poe-code"; // Audio generation export { getPoeApiKey } from "poe-code"; // API key resolution +export { + agent, + openaiChatCompletionsPlugin, + openaiResponsesPlugin, + systemPromptPlugin +} from "poe-code/agent"; // Composable agent runtime // Types export type { SpawnOptions } from "poe-code"; @@ -2648,6 +2712,14 @@ export type { GenerateOptions } from "poe-code"; export type { GenerateResult } from "poe-code"; export type { MediaGenerateOptions } from "poe-code"; export type { MediaGenerateResult } from "poe-code"; +export type { + AgentBuilder, + AgentPlugin, + AgentRunOptions, + Provider, + RunResult, + Tool +} from "poe-code/agent"; // CLI (for programmatic CLI invocation) export { main, isCliInvocation } from "poe-code"; diff --git a/packages/github-workflows/README.md b/packages/github-workflows/README.md index af94242295..94ecb301b4 100644 --- a/packages/github-workflows/README.md +++ b/packages/github-workflows/README.md @@ -50,7 +50,7 @@ The workflow triggers automatically on the configured event. | Name | Trigger | Description | | ---------------------------------- | --------------------- | ---------------------------------------------------------------------------------------- | -| `github-issue-opened` | Issue opened | Reads the issue, asks for missing details when needed, and implements actionable changes | +| `github-issue-opened` | Issue labeled `agent` | Reads the issue, asks for missing details when needed, and implements actionable changes | | `github-issue-comment-created` | Issue comment created | Acts on prefixed issue comments, restricted to allowed roles | | `github-pull-request-opened` | PR opened | Reviews the pull request | | `github-pull-request-synchronized` | PR updated | Re-reviews the PR after new commits are pushed | @@ -62,9 +62,11 @@ The built-in GitHub issue, issue-comment, pull-request, pull-request-comment, an pull-request-synchronized automations allow `OWNER`, `MEMBER`, `COLLABORATOR`, and `CONTRIBUTOR` author associations by default. -The built-in issue-opened automation always leaves a visible response. When the -issue lacks enough detail for a code change, it asks for the missing details and -leaves the issue open instead of closing it. +The built-in issue-opened automation runs when the `agent` label is added to an +issue. Opening an issue without that label, or adding any other label, does not +spawn an agent. When the automation runs, it always leaves a visible response. +When the issue lacks enough detail for a code change, it asks for the missing +details and leaves the issue open instead of closing it. ### List available automations