Skip to content

Add startup process lifecycle policies and prepare v1.1.0 - #1

Merged
PixelWinner merged 2 commits into
mainfrom
feat/process-lifecycle-policies
Sep 2, 2026
Merged

Add startup process lifecycle policies and prepare v1.1.0#1
PixelWinner merged 2 commits into
mainfrom
feat/process-lifecycle-policies

Conversation

@PixelWinner

@PixelWinner PixelWinner commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • add onExistingProcess policies: start, skip, restart, plus stopOnExit
  • track owner-aware process records and expose cleanup through OpenCode's async dispose hook
  • add POSIX/Windows process-tree shutdown, sanitized lifecycle logging, documentation, tests, and synchronized dist output

Validation

  • 275 automated tests passed
  • Git smoke test passed for commit 16e2f85 on Windows/OpenCode 1.18.25
  • GitHub CI passed on Ubuntu, macOS, Windows, and verify-build
  • release:check passed with Node 24.20.0 and npm 11.19.0

Release

This branch now contains the v1.1.0 release-preparation metadata. After CI passes, merge this PR into main, tag the merge commit as v1.1.0, then publish the verified opencode-startup-commands-1.1.0.tgz artifact to npm.

Copilot AI lite review requested due to automatic review settings September 1, 2026 15:37

Copilot AI 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.

🔵 Needs a closer look

It introduces a sizable, cross-platform process-lifecycle state machine (ownership tracking + restart/stop escalation) that warrants final human review for edge-case correctness and operational safety.

Pull request overview

This PR introduces configurable startup-command lifecycle policies and a cross-platform process-tree shutdown mechanism, then wires these capabilities through the plugin server so OpenCode can dispose/cleanup owned processes reliably.

Changes:

  • Adds onExistingProcess (start/skip/restart) and stopOnExit policies to configuration, docs, and tests.
  • Implements a process-tree controller with POSIX process-group and Windows taskkill.exe shutdown behavior, plus sanitized stop lifecycle logging.
  • Refactors startup core to track owner-aware process records, expose an async dispose hook, and synchronizes dist/ + release/package-contract checks.
File summaries
File Description
tests/server.test.ts Expands server/core tests to cover dispose semantics, ownership, and lifecycle policy behaviors.
tests/release-package.test.ts Updates package-contract expectations to include new dist/process-tree.* artifacts.
tests/readme.test.ts Extends README assertions to document lifecycle policies and stop behavior; relaxes line-count cap.
tests/process-tree.test.ts Adds comprehensive unit/integration coverage for POSIX + Windows process-tree stopping behaviors.
tests/logger.type-test.ts Adds type-level safety coverage for new stop lifecycle log events and allowed fields.
tests/logger.test.ts Verifies console/file formatting and sanitization for new stop lifecycle events.
tests/fixtures/process-tree-parent.mjs Adds real-process fixture parent that spawns a child and persists PIDs for stop tests.
tests/fixtures/process-tree-child.mjs Adds real-process fixture child used to validate descendant cleanup.
tests/config.type-test.ts Extends config type tests for new lifecycle-policy fields and validation.
tests/config.test.ts Adds runtime config normalization/validation tests for onExistingProcess and stopOnExit.
src/server.ts Wires a single processTree controller into the production server dependencies.
src/server-internal.ts Returns an async dispose hook backed by core activation cleanup and extends dependency typing.
src/process-tree.ts Implements cross-platform process-tree stopping with reasoned failure results and timeouts.
src/logger.ts Adds stop lifecycle event types, formatting, and ensures sanitized stop logging.
src/core.ts Replaces simple “started set” with owner-aware identity records, restart/skip/start policies, and disposal cleanup.
src/config.ts Introduces lifecycle-policy fields/types and validates/defaults them during config load.
scripts/release-package.mjs Updates required package paths to include process-tree dist outputs.
README.md Documents lifecycle policies, ownership semantics, and cross-platform stop behavior + logging guarantees.
dist/server.js.map Updates built artifact map for server dependency wiring changes.
dist/server.js Updates built server to include createProcessTreeController() wiring.
dist/server.d.ts.map Updates built type map for server changes.
dist/server-internal.js.map Updates built artifact map for server-internal dispose hook changes.
dist/server-internal.js Updates built server-internal to return dispose hook and await activation.
dist/server-internal.d.ts.map Updates built type map for server-internal dependency typing changes.
dist/server-internal.d.ts Updates built typings to extend StartupDependencies (incl. processTree) and reflect new contract.
dist/process-tree.js.map Adds built artifact map for new process-tree module.
dist/process-tree.js Adds built JS for new process-tree controller.
dist/process-tree.d.ts.map Adds built type map for new process-tree module.
dist/process-tree.d.ts Adds built typings for new process-tree controller and result types.
dist/logger.js.map Updates built artifact map for new stop lifecycle log formatting.
dist/logger.js Updates built logger output formatting for stop lifecycle events.
dist/logger.d.ts.map Updates built type map for logger stop lifecycle additions.
dist/logger.d.ts Updates built logger typings for stop lifecycle events and trigger/reason types.
dist/core.js Updates built core with new state machine, ownership tracking, and disposal behavior.
dist/core.d.ts.map Updates built type map for new core APIs and types.
dist/core.d.ts Updates built core typings (new StartupState shape, processTree dep, and async activation/dispose).
dist/config.js.map Updates built artifact map for new config lifecycle fields.
dist/config.js Updates built config loader to validate/default lifecycle policy fields.
dist/config.d.ts.map Updates built type map for new config types.
dist/config.d.ts Updates built config typings to include lifecycle-policy fields and OnExistingProcessPolicy.
Review details
  • Files reviewed: 19/42 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@PixelWinner PixelWinner changed the title Add startup process lifecycle policies Add startup process lifecycle policies and prepare v1.1.0 Sep 2, 2026
@PixelWinner
PixelWinner merged commit 28b52c6 into main Sep 2, 2026
4 checks passed
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.

2 participants