Skip to content

feat(pluginkit/wire): write an app's plugin frontend dependencies from the manifests - #89

Merged
SirLouen merged 1 commit into
mainfrom
feat/87
Oct 15, 2026
Merged

SirLouen merged 1 commit into
mainfrom
feat/87

Conversation

@SirLouen

@SirLouen SirLouen commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Closes #87

What

  • wire.Config gains an optional PackageJSONPath. When it is set, wire.Run writes every plugin frontend into that package.json as a workspace:* dependency and records the names it wrote under a top-level pluginwire key.
  • On the next run it drops only recorded names that no manifest names any more. A dependency the app added by hand is never touched, whatever its name or value.
  • The dependencies come out sorted, every other key keeps its place and value, the file uses tabs and a final newline, and a file that is already right stays byte for byte the same.
  • A malformed or missing package.json stops Run before it writes any file. An empty PackageJSONPath changes nothing.
  • Run now renders every file first and writes them in one loop, so a refusal still writes nothing.
  • The CHANGELOG also records the Go 1.27.2 floor the module already needs.

Why

An app lists every plugin frontend in its package.json by hand, although each manifest already names it. A new plugin directory should need no edit anywhere else.

Testing Instructions

  1. cd pluginkit && GOWORK=off go test -race ./...
  2. cd pluginkit && GOWORK=off go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.14.0 run ./...
  3. Read TestSyncPackageJSONKeepsACanonicalFileOnTheFirstRun and TestSyncPackageJSONDropsARecordedPluginNoManifestNames for the two rules that matter most.

Summary by CodeRabbit

  • New Features
    • The wiring generator can optionally synchronize frontend packages in package.json, adding configured workspace dependencies and removing stale ones it previously recorded.
    • Unrelated dependencies and other package manifest content are preserved.
    • Package synchronization is optional; when not configured, existing behavior is unchanged.
  • Documentation
    • Updated the changelog with the Go 1.27.2 requirement and the optional package manifest setting.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 1594865a-55bf-48a6-a7d3-63cf27887683
📥 Commits

Reviewing files that changed from the base of the PR and between 4560112 and c284ac5.

📒 Files selected for processing: 5
  • pluginkit/CHANGELOG.md
  • pluginkit/wire/packagejson.go
  • pluginkit/wire/packagejson_test.go
  • pluginkit/wire/wire.go
  • pluginkit/wire/wire_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

wire.Run can optionally synchronize plugin frontend dependencies in package.json. The synchronization records managed names, removes stale recorded entries, and preserves unrelated dependencies. Run assembles and writes the synchronized file with its other generated outputs.

Changes: Frontend dependency synchronization

Layer / File(s) Summary
Package JSON synchronization
pluginkit/wire/packagejson.go, pluginkit/wire/packagejson_test.go
The synchronizer validates package JSON, updates and sorts frontend dependencies, records managed names, and removes stale recorded entries. Tests cover validation, preservation, formatting, and idempotence.
Configuration and output assembly
pluginkit/wire/wire.go, pluginkit/wire/wire_test.go, pluginkit/CHANGELOG.md
Config adds PackageJSONPath. Output assembly includes synchronized package JSON when configured. Tests cover unset paths, errors before writes, and frontends from multiple roots.
Writing outputs and reporting failures
pluginkit/wire/wire.go, pluginkit/wire/wire_test.go, pluginkit/CHANGELOG.md
Run writes the assembled outputs and returns errors from generation or writing. Tests check path-qualified package JSON errors. The changelog records the optional path and Go version requirement.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature · Severity of issue fixed: Low

Sequence Diagram(s)

sequenceDiagram
  participant Run as wire.Run
  participant Outputs as outputs
  participant Sync as syncedPackageJSON
  participant PackageJSON as package.json
  Run->>Outputs: Assemble output paths and data
  Outputs->>Sync: Synchronize configured package JSON
  Sync->>PackageJSON: Read current file
  PackageJSON-->>Sync: Return file bytes
  Sync-->>Outputs: Return synchronized bytes
  Outputs-->>Run: Return assembled outputs
  Run->>PackageJSON: Write synchronized output
Loading
Merge Risk: ⚪ Minimal · up to c284a

The identified concerns do not block merging; normal checks can proceed.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 51.02% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 49 functions across 4 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: writing plugin frontend dependencies to an application package.json from manifests. It is specific and concise.
Linked Issues check Passed Issue #87 requirements are implemented. Config.PackageJSONPath enables package synchronization. frontendPackages collects sorted, unique frontend names across all loaded roots. syncPackageJSON w…
Out of Scope Changes check Passed The changed implementation, tests, documentation, and changelog support issue #87. The changes do not modify a lock file or add unrelated product behavior. No unrelated change is demonstrated by the r…
Full details: Docstring Coverage

Explanation

Docstring coverage is 51.02% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 49 functions across 4 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gates Passed
4 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] Safe to merge based on the checked behavior; no blocking concerns were found.

Summary

Adds optional PackageJSONPath support to wire.Config.

  • Plugin manifests now keep app frontend dependencies in sync.

Tests cover dependency ownership, formatting, repeated runs, multiple plugin roots, and refusal before writing. Executed race-enabled tests and filesystem checks confirmed that unrelated dependencies survive cleanup, shared frontend dependencies remain until their last manifest is removed, and repeated runs preserve canonical bytes. Missing and malformed configured files left existing wiring and registry files unchanged. Leaving PackageJSONPath unset neither changed nor created a package.json.

No actionable issues were found. The checked behavior is safe to merge.

Reviews (1) · Last reviewed commit: "feat(pluginkit/wire): write an app's plu..." · Reviewed by Greptile

@SirLouen
SirLouen merged commit bfcc05c into main Oct 15, 2026
41 checks passed
@SirLouen
SirLouen deleted the feat/87 branch October 15, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The wiring generator should write an app's plugin frontend dependencies

1 participant