Skip to content

feat: add reports resource for report generation and download - #15

Merged
asachs01 merged 1 commit into
mainfrom
feat/reports-domain
Aug 19, 2026
Merged

feat: add reports resource for report generation and download#15
asachs01 merged 1 commit into
mainfrom
feat/reports-domain

Conversation

@asachs01

@asachs01 asachs01 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Why

The community PowerShell module (InforcerCommunity) exposes report generation (Get-InforcerReportType, Invoke-InforcerReport, Get-InforcerReportRun, Save-InforcerReportOutput) that this SDK had no equivalent for — a gap flagged while bringing inforcer-mcp's tool coverage to parity with it.

What changed

Endpoints below were confirmed by reading the PowerShell module's own Invoke-InforcerApiRequest/Invoke-WebRequest call sites, not guessed:

Endpoint Method
/beta/reports/types catalog of report types
/beta/reports/runs list runs / (POST) queue a run
/beta/reports/runs/{id}/outputs poll — 200 once terminal (with outputs), 404 while pending
/beta/reports/runs/{id}/outputs/{outputId} download raw bytes (Content-Disposition filename)
  • New ReportsResource: types(), listRuns(), run(reports, tenantIds), outputs(runId), downloadOutput(runId, outputId).
    • run() resolves tenant identifiers the same flexible way (resolveTenantId) as assessments.run().
    • outputs() normalizes the API's 200/404 polling contract into { isTerminal, outputs } by catching NotFoundError internally — callers don't handle 404 themselves.
  • New HttpClient.requestBinary() — the download endpoint returns a file, not a JSON envelope, so it can't go through HttpClient.request()'s JSON-parsing path. Mirrors request()'s timeout/retry behavior.
  • Not built: Compare-InforcerEnvironments and Export-InforcerTenantDocumentation call no API endpoint beyond /beta/baselines (already covered) — they're pure PowerShell-side diff/template rendering over existing data, not new API surface.

Testing

$ npm run lint   # tsc --noEmit — clean
$ npm test       # 70/70 passing (was 64; +6 new)
$ npm run build  # tsup ESM+CJS+DTS — clean

View with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is enabled.

The community PowerShell module (InforcerCommunity) exposes report
generation (Get-InforcerReportType, Invoke-InforcerReport,
Get-InforcerReportRun, Save-InforcerReportOutput) that this SDK had no
equivalent for. Endpoints confirmed by reading the module's own HTTP
calls, not guessed:

  GET  /beta/reports/types                          - type catalog
  GET  /beta/reports/runs                            - list runs
  POST /beta/reports/runs                            - queue a run
  GET  /beta/reports/runs/{id}/outputs               - poll (200 terminal, 404 pending)
  GET  /beta/reports/runs/{id}/outputs/{outputId}    - download raw bytes

Adds ReportsResource with types/listRuns/run/outputs/downloadOutput,
and HttpClient.requestBinary for the one endpoint that returns a file
instead of a JSON envelope. run() resolves tenant identifiers the same
flexible way as assessments.run().
@asachs01
asachs01 merged commit 65a1b1b into main Aug 19, 2026
3 checks passed
@asachs01
asachs01 deleted the feat/reports-domain branch August 19, 2026 21:34
github-actions Bot pushed a commit that referenced this pull request Aug 19, 2026
# [1.1.0](v1.0.0...v1.1.0) (2026-08-19)

### Features

* add reports resource for report generation and download ([#15](#15)) ([65a1b1b](65a1b1b))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

asachs01 added a commit to WYRE-AI/inforcer-mcp that referenced this pull request Aug 19, 2026
…#26)

* feat: add reports domain for cmdlet parity with the PowerShell module

The community PowerShell module (InforcerCommunity, github.com/royklo)
exposes report generation this server had no equivalent for. Backed
by @wyre-technology/node-inforcer@1.1.0's new reports resource
(github.com/WYRE-AI/node-inforcer#15), whose endpoints were
confirmed by reading the module's own HTTP calls, not guessed.

Adds a `reports` domain with 5 tools:
- inforcer_reports_types_list, inforcer_reports_runs_list — read-only
- inforcer_reports_run — HIGH-IMPACT write, elicitation-confirmed like
  inforcer_assessments_run; queues reports across one or more tenants
- inforcer_reports_run_status — polls a run to terminal
- inforcer_reports_download_output — returns file bytes base64-encoded
  (MCP tools return content, not files, so this replaces the module's
  Save-InforcerReportOutput disk-write behavior)

Not built: Compare-InforcerEnvironments and
Export-InforcerTenantDocumentation call no API beyond /beta/baselines
(already covered by inforcer_baselines_list) — they're pure
PowerShell-side diff/template rendering over data this server already
exposes, not new API surface. Building a templating pipeline to match
would replicate PowerShell's presentation layer, not close a gap.

* refactor: dedup elicitation confirm helper, simplify report-entry mapping

/simplify pass on the reports-domain diff: confirmAssessmentRun and
confirmReportRun were ~90% identical (elicitInput call shape, schema,
accept/decline/cancel handling) — extracted confirmHighImpactAction as
the shared primitive. Also drop the conditional spreads building the
report-run entry object; JSON.stringify already omits undefined-valued
properties, so the plain assignment produces the same wire body.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant