@mcrescenzo/opencode-workflows 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/CODE_OF_CONDUCT.md +134 -0
  3. package/CONTRIBUTING.md +95 -0
  4. package/LICENSE +21 -0
  5. package/README.md +746 -0
  6. package/SECURITY.md +38 -0
  7. package/commands/repo-bughunt.md +94 -0
  8. package/commands/repo-review.md +148 -0
  9. package/commands/workflow-live-gates-release-check.md +143 -0
  10. package/docs/workflow-plugin.md +400 -0
  11. package/opencode-workflows.js +5 -0
  12. package/package.json +86 -0
  13. package/skills/opencode-workflow-authoring/SKILL.md +180 -0
  14. package/skills/repo-review-command-protocol/SKILL.md +56 -0
  15. package/skills/workflow-model-tiering/SKILL.md +57 -0
  16. package/skills/workflow-plan-review/SKILL.md +91 -0
  17. package/workflow-kernel/approval-hashing.js +39 -0
  18. package/workflow-kernel/async-util.js +33 -0
  19. package/workflow-kernel/audited-shell-policy.js +200 -0
  20. package/workflow-kernel/authority-policy.js +670 -0
  21. package/workflow-kernel/budget-accounting.js +142 -0
  22. package/workflow-kernel/capability-adapter.js +753 -0
  23. package/workflow-kernel/child-agent-runner.js +1264 -0
  24. package/workflow-kernel/constants.js +117 -0
  25. package/workflow-kernel/diagnostics.js +152 -0
  26. package/workflow-kernel/drain-runtime.js +421 -0
  27. package/workflow-kernel/errors.js +181 -0
  28. package/workflow-kernel/event-journal.js +487 -0
  29. package/workflow-kernel/extension-registry.js +144 -0
  30. package/workflow-kernel/free-text-redactor.js +91 -0
  31. package/workflow-kernel/gate-shapes.js +82 -0
  32. package/workflow-kernel/git-util.js +45 -0
  33. package/workflow-kernel/index.js +72 -0
  34. package/workflow-kernel/integration-mode.js +155 -0
  35. package/workflow-kernel/lane-effort-policy.js +134 -0
  36. package/workflow-kernel/lifecycle-control.js +608 -0
  37. package/workflow-kernel/live-gate-probes.js +916 -0
  38. package/workflow-kernel/notification-toast-cards.js +393 -0
  39. package/workflow-kernel/notification-toast-policy.js +179 -0
  40. package/workflow-kernel/notification-toast-scope.js +100 -0
  41. package/workflow-kernel/notification-toast.js +287 -0
  42. package/workflow-kernel/path-policy.js +219 -0
  43. package/workflow-kernel/result-readback.js +106 -0
  44. package/workflow-kernel/role-template-loading.js +606 -0
  45. package/workflow-kernel/run-context.js +139 -0
  46. package/workflow-kernel/run-observability.js +43 -0
  47. package/workflow-kernel/run-store-fs.js +231 -0
  48. package/workflow-kernel/run-store-locks.js +180 -0
  49. package/workflow-kernel/run-store-projections.js +421 -0
  50. package/workflow-kernel/run-store-rehydrate.js +68 -0
  51. package/workflow-kernel/run-store-state.js +147 -0
  52. package/workflow-kernel/run-store-status-format.js +1154 -0
  53. package/workflow-kernel/run-store-status.js +107 -0
  54. package/workflow-kernel/sandbox-executor.js +1131 -0
  55. package/workflow-kernel/session-access.js +56 -0
  56. package/workflow-kernel/structured-output.js +143 -0
  57. package/workflow-kernel/test-fix-drain-adapter.js +119 -0
  58. package/workflow-kernel/text-json.js +136 -0
  59. package/workflow-kernel/workflow-plugin.js +3017 -0
  60. package/workflow-kernel/workflow-source.js +444 -0
  61. package/workflow-kernel/worktree-adapter.js +256 -0
  62. package/workflow-kernel/worktree-git.js +147 -0
  63. package/workflows/repo-bughunt.js +362 -0
  64. package/workflows/repo-cleanup.js +383 -0
  65. package/workflows/repo-complexity.js +404 -0
  66. package/workflows/repo-deps.js +457 -0
  67. package/workflows/repo-modernize.js +395 -0
  68. package/workflows/repo-perf.js +394 -0
  69. package/workflows/repo-review.js +831 -0
  70. package/workflows/repo-security-audit.js +466 -0
  71. package/workflows/repo-test-gaps.js +377 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ This project follows the spirit of [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
6
+ and uses semantic versioning for published package releases.
7
+
8
+ ## [0.1.0] - Unreleased
9
+
10
+ ### Added
11
+
12
+ - Initial public package surface for the opencode workflows plugin.
13
+ - Durable workflow run store, approval-gated apply flow, bundled repo-review
14
+ workflows, live-gate probes, workflow templates, and extension seams.
@@ -0,0 +1,134 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic
9
+ status, nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ - Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ - The use of sexualized language or imagery, and sexual attention or advances
31
+ of any kind
32
+ - Trolling, insulting or derogatory comments, and personal or political
33
+ attacks
34
+ - Public or private harassment
35
+ - Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
37
+ - Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards
43
+ of acceptable behavior and will take appropriate and fair corrective action
44
+ in response to any behavior that they deem inappropriate, threatening,
45
+ offensive, or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or
48
+ reject comments, commits, code, wiki edits, issues, and other contributions
49
+ that are not aligned to this Code of Conduct, and will communicate reasons
50
+ for moderation decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies
55
+ when an individual is officially representing the community in public
56
+ spaces. Examples of representing our community include using an official
57
+ e-mail address, posting via an official social media account, or acting as
58
+ an appointed representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ michaelcrescenzo@gmail.com. All complaints will be reviewed and investigated
65
+ promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of
68
+ the reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in
73
+ determining the consequences for any action they deem in violation of this
74
+ Code of Conduct:
75
+
76
+ ### 1. Correction
77
+
78
+ **Community Impact**: Use of inappropriate language or other behavior deemed
79
+ unprofessional or unwelcome in the community.
80
+
81
+ **Consequence**: A private, written warning from community leaders,
82
+ providing clarity around the nature of the violation and an explanation of
83
+ why the behavior was inappropriate. A public apology may be requested.
84
+
85
+ ### 2. Warning
86
+
87
+ **Community Impact**: A violation through a single incident or series of
88
+ actions.
89
+
90
+ **Consequence**: A warning with consequences for continued behavior. No
91
+ interaction with the people involved, including unsolicited interaction with
92
+ those enforcing the Code of Conduct, for a specified period of time. This
93
+ includes avoiding interactions in community spaces as well as external
94
+ channels like social media. Violating these terms may lead to a temporary or
95
+ permanent ban.
96
+
97
+ ### 3. Temporary Ban
98
+
99
+ **Community Impact**: A serious violation of community standards, including
100
+ sustained inappropriate behavior.
101
+
102
+ **Consequence**: A temporary ban from any sort of interaction or public
103
+ communication with the community for a specified period of time. No public
104
+ or private interaction with the people involved, including unsolicited
105
+ interaction with those enforcing the Code of Conduct, is allowed during this
106
+ period. Violating these terms may lead to a permanent ban.
107
+
108
+ ### 4. Permanent Ban
109
+
110
+ **Community Impact**: Demonstrating a pattern of violation of community
111
+ standards, including sustained inappropriate behavior, harassment of an
112
+ individual, or aggression toward or disparagement of classes of individuals.
113
+
114
+ **Consequence**: A permanent ban from any sort of public interaction within
115
+ the community.
116
+
117
+ ## Attribution
118
+
119
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
120
+ version 2.1, available at
121
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
122
+
123
+ Community Impact Guidelines were inspired by
124
+ [Mozilla's code of conduct enforcement ladder][mozilla coc].
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ [https://www.contributor-covenant.org/faq][faq]. Translations are available
128
+ at [https://www.contributor-covenant.org/translations][translations].
129
+
130
+ [homepage]: https://www.contributor-covenant.org
131
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
132
+ [mozilla coc]: https://github.com/mozilla/diversity
133
+ [faq]: https://www.contributor-covenant.org/faq
134
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,95 @@
1
+ # Contributing to opencode-workflows
2
+
3
+ This is an independently publishable opencode plugin package
4
+ (`@mcrescenzo/opencode-workflows`) that can also be developed inside a private
5
+ parent monorepo checkout. Runtime package dependencies are declared in
6
+ `package.json`; parent-tree integrations are optional test/dev conveniences.
7
+ These notes are for contributors running the no-token test matrix and preparing a
8
+ public release.
9
+
10
+ ## Prerequisites
11
+
12
+ The full no-token test matrix needs the following tools on `PATH`:
13
+
14
+ | Tool | Required for | Notes |
15
+ | --- | --- | --- |
16
+ | **Node ≥ 20.11** | everything | See `engines` in `package.json`. The test runner is Node's built-in `node --test`. |
17
+ | **`git`** | worktree / apply / integration / drain tests | Several suites shell out to `git` to create temporary repos and exercise the worktree + `workflow_apply` paths. |
18
+ | **`bd` (Beads CLI)** | `beads-drain` adapter + scratch tests | A few suites shell out to `bd` to exercise the beads-drain adapter against a scratch Beads database. All `repo-*` workflows and the rest of the matrix run without it. |
19
+ | **`opencode` binary + local config** | the live child system smoke ONLY | The required system smoke (`npm run release:system-smoke-required`) needs the opencode binary and local opencode config and is intentionally NOT part of the token-free `npm test` / `release:no-token` matrix. |
20
+
21
+ If a tool is missing, the affected suites fail with a clear message rather than silently
22
+ passing — do not treat a skipped/missing-tool run as release evidence.
23
+
24
+ ## Package manager and lockfile policy
25
+
26
+ - The **canonical lockfile is `bun.lock`** (tracked). Use `bun install` to reproduce the
27
+ locked dependency set.
28
+ - All package scripts are invoked with **`npm run <script>`** and are thin `node` wrappers
29
+ (e.g. `node --test tests/*.test.mjs`, `node scripts/...`). They contain no npm-specific
30
+ behavior, so they run identically whether you installed with Bun or npm.
31
+ - `package-lock.json` is **gitignored** (see `.gitignore`): npm-using contributors may
32
+ generate one locally, but it is not tracked to avoid maintaining two divergent lockfiles.
33
+ `bun.lock` remains the single source of truth for the locked dependency set.
34
+ - CI uses the same policy: `.github/workflows/ci.yml` installs dependencies with
35
+ `bun install --frozen-lockfile`, provisions the Beads CLI, verifies the prerequisite
36
+ tool versions, and then runs `npm run release:no-token`.
37
+
38
+ ## Running the tests
39
+
40
+ From this directory:
41
+
42
+ ```sh
43
+ npm test # full no-token matrix (all suites)
44
+ npm run test:workflows # workflow_run / workflow_apply / repo-* regression
45
+ npm run test:beads-drain # beads-drain workflow/adapter/assets/scratch coverage
46
+ npm run test:workflow-adapters # drain adapter focused suites
47
+ npm run test:extension-seam # extension registration and trusted asset seams
48
+ npm run test:live-gates # mocked live-gate probe coverage
49
+ npm run release:no-token # complete public no-token release gate
50
+ ```
51
+
52
+ `npm test`, `npm run test:workflows`, and `npm run release:no-token` are all runnable from
53
+ a standalone clone (they do not depend on a private parent monorepo tree). The
54
+ optional parent-integration regression lives in a separate, clearly named script:
55
+
56
+ ```sh
57
+ npm run test:parent-integration # OPTIONAL: only runs inside a private parent monorepo tree
58
+ ```
59
+
60
+ ## Public release readiness
61
+
62
+ A public release must not equate "skipped" with "verified":
63
+
64
+ - The public CI workflow (`.github/workflows/ci.yml`) runs on pull requests, pushes to
65
+ `main`, and manual dispatch. It installs Node 22, Bun, Go, and
66
+ `github.com/steveyegge/beads/cmd/bd@v1.0.3` with the `gms_pure_go` build tag, then
67
+ runs the no-token release gate.
68
+ - `npm run release:no-token` runs lockfile sync, the full token-free `npm test` matrix,
69
+ and package dry-run validation, then explicitly notes that the live child system smoke is
70
+ a **separate required** step.
71
+ - `npm run release:system-smoke-required` **fails closed** (non-zero exit) when live
72
+ system-smoke evidence is missing — see `docs/plugin-system-tests.md` for the mandatory
73
+ evidence checklist (child ID/PID/port, trust mode, command + tool registry entries,
74
+ deterministic workflow tool execution, restart/reload, and cleanup `processAlive: false`).
75
+
76
+ ## Style and boundaries
77
+
78
+ - Pure Node ESM, no new runtime dependencies without review.
79
+ - Do not commit local runtime state: `.opencode/`, `.beads/` Dolt DB / sockets / locks /
80
+ credential key, `.remember/`, `node_modules/`, logs, or workflow run dirs.
81
+ - After changing plugin code (`opencode-workflows.js`, `workflow-kernel/`, bundled commands,
82
+ skills, or registration), restart opencode (or use a fresh/restarted disposable child) —
83
+ running sessions keep already-loaded config.
84
+
85
+ ## Pull request expectations
86
+
87
+ - Add or update tests alongside any behavior change, and make sure `npm test`
88
+ (the full no-token matrix) passes before opening a pull request.
89
+ - Keep `README.md`, `AGENTS.md`, and the relevant `docs/` file in sync with any
90
+ behavior or configuration change.
91
+ - Preserve the kernel invariants in `AGENTS.md` (single plugin export, in-place
92
+ `hooks`/`output.parts` mutation, module-level shared state, bounded maps,
93
+ model IDs from config) — see `AGENTS.md` for the full list.
94
+ - Run `npm run test:lockfile-sync` if you changed `package.json` dependencies,
95
+ and keep `bun.lock` (the canonical lockfile) up to date.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Michael Crescenzo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.