Skip to content

Expose a high-level execution surface in the SDK (PmClient / runAction) #439

Closed

Description

@unbraind

Problem (current behavior)

The public SDK (@unbrained/pm-cli/sdk and /sdk/runtime) is overwhelmingly extension/package-authoring focused (defineExtension, composeExtension, manifest synthesis, capability reconciliation, test harness). The only command run* exports are runSearch, runNormalize, runReindex, runContracts, runCalendar, runGuide, and audit helpers. There is no runCreate / runUpdate / runGet / runList / runClose / runContext / runComments, and no generic pmRun(action, options) executor — even though the MCP server's pm_run tool is exactly such a dispatch entry over PM_TOOL_ACTIONS.

So an agent wanting a programmatic integration (CI script, custom bot, embedded runtime) can validate intent with the SDK but cannot actually perform a mutation without spawning a pm process and re-parsing its text/JSON output.

Proposed improvement

Export a high-level, typed execution surface, e.g.:

import { PmClient } from "@unbrained/pm-cli/sdk/runtime";
const pm = new PmClient({ pmRoot, author });
await pm.create({ title, type, status });
await pm.list({ status: "open", limit: 20, projection: "brief" });
await pm.get(id, { depth: "brief" });
await pm.update(id, { status: "in_progress" });
await pm.close(id, reason);
await pm.context({ depth: "brief" });

…backed by the same handlers the CLI/MCP use, returning the same typed results (and the same lean defaults as the MCP server). At minimum, export a single runAction(action, options, globalOptions) that mirrors pm_run.

Agent benefit

Unlocks true programmatic integrations (no shell-out, no text parsing, no per-flag quoting), with shared types end-to-end. Lets agents embed pm as a library in tooling, eval harnesses, and custom MCP servers.

Activity

  1. added
    enhancementNew feature or request
    agent-experienceImproves the AI agent / MCP / CLI ergonomics and token efficiency
    sdkTypeScript SDK surface
    on Jul 5, 2026
  2. coderabbitai commented on Jul 5, 2026

    @coderabbitai
    🔗 Related PRs

    #36 - [codex] Improve agent UX from manual pm audit [closed]
    #51 - Polish CLI ergonomics, delete safety, and templates dedup [closed]
    #328 - feat(sdk): runRegisteredCommandForTest invoke helper (pm-owm0) [merged]
    #411 - Reduce CodeFactor complexity across SDK dispatch paths [merged]
    #419 - Reduce shipped CLI complexity hotspots [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  3. unbraind commented on Jul 11, 2026

    @unbraind
    OwnerAuthor

    pm tracker item:

    • pm-xzhz — Expose SDK runAction and PmClient execution surface for programmatic integrations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-experienceImproves the AI agent / MCP / CLI ergonomics and token efficiencyenhancementNew feature or requestsdkTypeScript SDK surface

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions