@brainervirus/workit-core 0.4.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 (177) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +180 -0
  3. package/commands/wk-changelog.md +2 -0
  4. package/commands/wk-commit.md +2 -0
  5. package/commands/wk-docs-refresh.md +2 -0
  6. package/commands/wk-handoff.md +2 -0
  7. package/commands/wk-implement.md +2 -0
  8. package/commands/wk-init.md +2 -0
  9. package/commands/wk-issue-update.md +2 -0
  10. package/commands/wk-meetings.md +2 -0
  11. package/commands/wk-pr.md +2 -0
  12. package/commands/wk-release-notes.md +2 -0
  13. package/commands/wk-status.md +2 -0
  14. package/commands/wk-verify.md +2 -0
  15. package/package.json +43 -0
  16. package/scripts/_shared/common.sh +158 -0
  17. package/scripts/changelog-context.sh +42 -0
  18. package/scripts/docs-refresh-context.sh +40 -0
  19. package/scripts/fixtures/sample-plan.md +15 -0
  20. package/scripts/fixtures/sample-sdd/progress.md +2 -0
  21. package/scripts/init/apply.sh +5 -0
  22. package/scripts/init/status.sh +5 -0
  23. package/scripts/init/toolkit-status.sh +5 -0
  24. package/scripts/install-cursor-plugin.sh +83 -0
  25. package/scripts/install-opencode-plugin.sh +76 -0
  26. package/scripts/pr-create.sh +5 -0
  27. package/scripts/pr-ready-context.sh +88 -0
  28. package/scripts/present/ascii-wireframe.sh +5 -0
  29. package/scripts/present/flow-diagram.sh +5 -0
  30. package/scripts/release-notes-context.sh +40 -0
  31. package/scripts/rewrite-workspace-deps.ts +17 -0
  32. package/scripts/run-cursor-mcp.sh +10 -0
  33. package/scripts/sync-runtime.sh +96 -0
  34. package/scripts/update-superpowers.sh +56 -0
  35. package/scripts/vcs/config.sh +5 -0
  36. package/scripts/vcs/merged-style.sh +5 -0
  37. package/scripts/vcs/token-create-urls.sh +5 -0
  38. package/scripts/vcs/verify-token.sh +5 -0
  39. package/scripts/verify-project.sh +140 -0
  40. package/scripts/youtrack/api.sh +5 -0
  41. package/scripts/youtrack/config.sh +5 -0
  42. package/scripts/youtrack/greeting.sh +5 -0
  43. package/scripts/youtrack/parse-duration.sh +5 -0
  44. package/scripts/youtrack/token-create-url.sh +5 -0
  45. package/scripts/youtrack/verify-token.sh +5 -0
  46. package/scripts/youtrack/work-date-ms.sh +5 -0
  47. package/skills/wk-changelog/SKILL.md +15 -0
  48. package/skills/wk-commit/SKILL.md +16 -0
  49. package/skills/wk-docs-refresh/SKILL.md +15 -0
  50. package/skills/wk-handoff/SKILL.md +17 -0
  51. package/skills/wk-implement/SKILL.md +41 -0
  52. package/skills/wk-init/SKILL.md +31 -0
  53. package/skills/wk-issue-update/SKILL.md +27 -0
  54. package/skills/wk-issue-update/references/youtrack-update-style.md +81 -0
  55. package/skills/wk-meetings/SKILL.md +17 -0
  56. package/skills/wk-pr/SKILL.md +27 -0
  57. package/skills/wk-release-notes/SKILL.md +15 -0
  58. package/skills/wk-status/SKILL.md +16 -0
  59. package/skills/wk-verify/SKILL.md +16 -0
  60. package/src/core/branch.ts +246 -0
  61. package/src/core/changelog.ts +312 -0
  62. package/src/core/config-guard.ts +26 -0
  63. package/src/core/config.ts +73 -0
  64. package/src/core/detector.ts +207 -0
  65. package/src/core/doc-render.ts +14 -0
  66. package/src/core/docs-repo.ts +196 -0
  67. package/src/core/docs-validate.ts +255 -0
  68. package/src/core/flow-state.ts +225 -0
  69. package/src/core/git.ts +56 -0
  70. package/src/core/gitignore.ts +43 -0
  71. package/src/core/handoff-context.ts +115 -0
  72. package/src/core/hygiene.ts +77 -0
  73. package/src/core/init.ts +443 -0
  74. package/src/core/parse-sections.ts +24 -0
  75. package/src/core/plan-tasks.ts +33 -0
  76. package/src/core/ports/init-apply.ts +15 -0
  77. package/src/core/ports/init-status.ts +4 -0
  78. package/src/core/ports/init-toolkit-status.ts +4 -0
  79. package/src/core/ports/pr-create.ts +22 -0
  80. package/src/core/ports/present-ascii.ts +10 -0
  81. package/src/core/ports/present-flow.ts +10 -0
  82. package/src/core/ports/vcs-config.ts +14 -0
  83. package/src/core/ports/vcs-merged-style.ts +5 -0
  84. package/src/core/ports/vcs-token-create-urls.ts +4 -0
  85. package/src/core/ports/vcs-verify-token.ts +4 -0
  86. package/src/core/ports/youtrack-api.ts +17 -0
  87. package/src/core/ports/youtrack-config.ts +23 -0
  88. package/src/core/ports/youtrack-greeting.ts +10 -0
  89. package/src/core/ports/youtrack-parse-duration.ts +14 -0
  90. package/src/core/ports/youtrack-token-create-url.ts +4 -0
  91. package/src/core/ports/youtrack-verify-token.ts +12 -0
  92. package/src/core/ports/youtrack-work-date-ms.ts +10 -0
  93. package/src/core/pr-create.ts +212 -0
  94. package/src/core/present.ts +100 -0
  95. package/src/core/reminder.ts +82 -0
  96. package/src/core/repo-tool.ts +9 -0
  97. package/src/core/rules.ts +122 -0
  98. package/src/core/scripts.ts +42 -0
  99. package/src/core/sdd.ts +188 -0
  100. package/src/core/templates.ts +37 -0
  101. package/src/core/vcs-config.ts +252 -0
  102. package/src/core/verify-parse.ts +27 -0
  103. package/src/core/workspaces.ts +81 -0
  104. package/src/core/youtrack.ts +488 -0
  105. package/src/core.ts +62 -0
  106. package/src/state.ts +22 -0
  107. package/src/tools/docs-repo.ts +42 -0
  108. package/src/tools/flow.ts +88 -0
  109. package/src/tools/handoff.ts +160 -0
  110. package/src/tools/index.ts +22 -0
  111. package/src/tools/present.ts +45 -0
  112. package/src/tools/repo.ts +357 -0
  113. package/src/tools/rules.ts +30 -0
  114. package/src/tools/sdd.ts +189 -0
  115. package/src/tools/templates.ts +27 -0
  116. package/src/tools/youtrack.ts +356 -0
  117. package/templates/execution-contract.md +56 -0
  118. package/templates/greeting.md +1 -0
  119. package/templates/headers.md +3 -0
  120. package/templates/hygiene/.editorconfig +8 -0
  121. package/templates/hygiene/.gitattributes +3 -0
  122. package/templates/hygiene/CHANGELOG.md +14 -0
  123. package/templates/hygiene/CONTRIBUTING.md +3 -0
  124. package/templates/hygiene/LICENSE +21 -0
  125. package/templates/hygiene/README.md +3 -0
  126. package/templates/issue-update.md +6 -0
  127. package/templates/plan-template.md +25 -0
  128. package/templates/spec-template.md +51 -0
  129. package/templates/superpowers-doc-contract.md +69 -0
  130. package/vendor/superpowers/skills/brainstorming/SKILL.md +159 -0
  131. package/vendor/superpowers/skills/brainstorming/scripts/frame-template.html +213 -0
  132. package/vendor/superpowers/skills/brainstorming/scripts/helper.js +167 -0
  133. package/vendor/superpowers/skills/brainstorming/scripts/server.cjs +723 -0
  134. package/vendor/superpowers/skills/brainstorming/scripts/start-server.sh +209 -0
  135. package/vendor/superpowers/skills/brainstorming/scripts/stop-server.sh +120 -0
  136. package/vendor/superpowers/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  137. package/vendor/superpowers/skills/brainstorming/visual-companion.md +291 -0
  138. package/vendor/superpowers/skills/dispatching-parallel-agents/SKILL.md +185 -0
  139. package/vendor/superpowers/skills/executing-plans/SKILL.md +70 -0
  140. package/vendor/superpowers/skills/finishing-a-development-branch/SKILL.md +241 -0
  141. package/vendor/superpowers/skills/receiving-code-review/SKILL.md +213 -0
  142. package/vendor/superpowers/skills/requesting-code-review/SKILL.md +103 -0
  143. package/vendor/superpowers/skills/requesting-code-review/code-reviewer.md +172 -0
  144. package/vendor/superpowers/skills/subagent-driven-development/SKILL.md +418 -0
  145. package/vendor/superpowers/skills/subagent-driven-development/implementer-prompt.md +139 -0
  146. package/vendor/superpowers/skills/subagent-driven-development/scripts/review-package +44 -0
  147. package/vendor/superpowers/skills/subagent-driven-development/scripts/sdd-workspace +22 -0
  148. package/vendor/superpowers/skills/subagent-driven-development/scripts/task-brief +40 -0
  149. package/vendor/superpowers/skills/subagent-driven-development/task-reviewer-prompt.md +188 -0
  150. package/vendor/superpowers/skills/systematic-debugging/CREATION-LOG.md +119 -0
  151. package/vendor/superpowers/skills/systematic-debugging/SKILL.md +296 -0
  152. package/vendor/superpowers/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  153. package/vendor/superpowers/skills/systematic-debugging/condition-based-waiting.md +115 -0
  154. package/vendor/superpowers/skills/systematic-debugging/defense-in-depth.md +122 -0
  155. package/vendor/superpowers/skills/systematic-debugging/find-polluter.sh +63 -0
  156. package/vendor/superpowers/skills/systematic-debugging/root-cause-tracing.md +169 -0
  157. package/vendor/superpowers/skills/systematic-debugging/test-academic.md +14 -0
  158. package/vendor/superpowers/skills/systematic-debugging/test-pressure-1.md +58 -0
  159. package/vendor/superpowers/skills/systematic-debugging/test-pressure-2.md +68 -0
  160. package/vendor/superpowers/skills/systematic-debugging/test-pressure-3.md +69 -0
  161. package/vendor/superpowers/skills/test-driven-development/SKILL.md +371 -0
  162. package/vendor/superpowers/skills/test-driven-development/testing-anti-patterns.md +299 -0
  163. package/vendor/superpowers/skills/using-git-worktrees/SKILL.md +202 -0
  164. package/vendor/superpowers/skills/using-superpowers/SKILL.md +62 -0
  165. package/vendor/superpowers/skills/using-superpowers/references/antigravity-tools.md +23 -0
  166. package/vendor/superpowers/skills/using-superpowers/references/codex-tools.md +39 -0
  167. package/vendor/superpowers/skills/using-superpowers/references/pi-tools.md +16 -0
  168. package/vendor/superpowers/skills/verification-before-completion/SKILL.md +139 -0
  169. package/vendor/superpowers/skills/writing-plans/SKILL.md +174 -0
  170. package/vendor/superpowers/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  171. package/vendor/superpowers/skills/writing-skills/SKILL.md +689 -0
  172. package/vendor/superpowers/skills/writing-skills/anthropic-best-practices.md +1150 -0
  173. package/vendor/superpowers/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  174. package/vendor/superpowers/skills/writing-skills/graphviz-conventions.dot +172 -0
  175. package/vendor/superpowers/skills/writing-skills/persuasion-principles.md +187 -0
  176. package/vendor/superpowers/skills/writing-skills/render-graphs.js +168 -0
  177. package/vendor/superpowers/skills/writing-skills/testing-skills-with-subagents.md +384 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cristhofer Pincetti
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.
package/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # Workit
2
+
3
+ Multi-platform Superpowers workflow plugin for **Cursor** and **OpenCode**: verify, PR, changelog, commits, SDD implementation, session handoff, YouTrack, and deterministic UI presentation.
4
+
5
+ | Platform | Path | Version |
6
+ | --- | --- | --- |
7
+ | **OpenCode** | `packages/workit-opencode/src/plugin.ts` | 0.4.0 |
8
+ | **Cursor** | `packages/workit-cursor/` (MCP + hooks + rules + skills) | 0.4.0 |
9
+ | **Shared core** | `packages/workit-core/` (src, skills, commands, scripts, templates) | 0.4.0 |
10
+ | **CLI** | `packages/workit-cli/` (Ink wizard, bin `workit`) | 0.4.0 |
11
+
12
+ Config directory (both platforms): `~/.config/workflow-toolkit/` (kept as-is for install stability).
13
+
14
+ [![npm version](https://img.shields.io/npm/v/@brainervirus/workit-opencode)](https://www.npmjs.com/package/@brainervirus/workit-opencode)
15
+ [![CI](https://img.shields.io/github/actions/workflow/status/BrainerVirus/workit/ci.yml?branch=main&label=CI)](https://github.com/BrainerVirus/workit/actions)
16
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
17
+
18
+ ## Install
19
+
20
+ **Quick start (wizard)** — the interactive wizard picks OpenCode and/or Cursor and configures tokens and project files:
21
+
22
+ Requires bun (`curl -fsSL https://bun.sh/install | bash`).
23
+
24
+ ```bash
25
+ npm i @brainervirus/workit-core # shared core (skills, commands, scripts)
26
+ npm i @brainervirus/workit-opencode # OpenCode plugin (thin over the core)
27
+ npm i @brainervirus/workit-cursor # Cursor plugin (MCP + hooks + rules)
28
+ npm i @brainervirus/workit-cli # interactive wizard
29
+ npx workit init
30
+ ```
31
+
32
+ **Local development** — use the repo path instead; no package cache, disk is the source of truth:
33
+
34
+ ```bash
35
+ bun i
36
+ ```
37
+
38
+ **Manual setup (skip the wizard)** — configure each tool by hand; see [Usage](#usage) for the OpenCode plugin entry and Cursor MCP server.
39
+
40
+ ## Usage
41
+
42
+ Manual setup for those who skipped the wizard (`npx workit init`):
43
+
44
+ **OpenCode** — reference the plugin entry in `opencode.json` / `opencode.jsonc` (`~/.config/opencode/opencode.json`):
45
+
46
+ ```json
47
+ {
48
+ "$schema": "https://opencode.ai/config.json",
49
+ "plugin": ["@brainervirus/workit-opencode"]
50
+ }
51
+ ```
52
+
53
+ Local dev variant (absolute path to this repo):
54
+
55
+ ```json
56
+ {
57
+ "$schema": "https://opencode.ai/config.json",
58
+ "plugin": ["file:///path/to/workit/packages/workit-opencode/src/plugin.ts"]
59
+ }
60
+ ```
61
+
62
+ **Cursor** — the MCP server runs from the package's `cursor/` directory. Add to `.cursor/mcp.json`:
63
+
64
+ ```json
65
+ {
66
+ "mcpServers": {
67
+ "workit": {
68
+ "command": "bun",
69
+ "args": ["run", "node_modules/@brainervirus/workit-cursor/mcp/server.ts"]
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
75
+ Local dev variant: point `WORKFLOW_TOOLKIT_ROOT` at this repo's `packages/workit-core` (the MCP launcher `packages/workit-core/scripts/run-cursor-mcp.sh` resolves it), or run the install script from the repo.
76
+
77
+ ## Requirements
78
+
79
+ - **Bun ≥ 1.0** — runtime for the shared `src/core` logic, the OpenCode plugin, and the Cursor MCP server (`bun server.ts`). Install once:
80
+
81
+ ```bash
82
+ curl -fsSL https://bun.sh/install | bash
83
+ ```
84
+
85
+ Then add to your shell profile (or rely on the MCP launcher's `~/.bun/bin/bun` fallback):
86
+
87
+ ```bash
88
+ export PATH="$HOME/.bun/bin:$PATH"
89
+ ```
90
+
91
+ - **Git** — branch resolution, SDD review diffs, and verify gates.
92
+
93
+ ## Repo layout
94
+
95
+ ```
96
+ workit/
97
+ ├── packages/
98
+ │ ├── workit-core/ # @brainervirus/workit-core — shared core
99
+ │ │ ├── src/ # core TS (src/core, src/tools, src/state)
100
+ │ │ ├── skills/ # OpenCode-native skills (wk-*)
101
+ │ │ ├── commands/ # OpenCode commands (wk-*)
102
+ │ │ ├── scripts/ # shared shell + installers (all logic in src/, TS via bun)
103
+ │ │ ├── templates/ # execution + superpowers contracts
104
+ │ │ └── vendor/ # vendored superpowers skills
105
+ │ ├── workit-opencode/ # @brainervirus/workit-opencode — OpenCode plugin (src/plugin.ts)
106
+ │ ├── workit-cursor/ # @brainervirus/workit-cursor — Cursor plugin (MCP, hooks, rules, skills)
107
+ │ └── workit-cli/ # @brainervirus/workit-cli — Ink setup wizard (bin: workit)
108
+ ├── .github/workflows/ # CI + release
109
+ └── test/ # bun tests (OpenCode plugin)
110
+ ```
111
+
112
+ ## CI / local checks
113
+
114
+ ```bash
115
+ bun run check # bun test + tsc + cursor MCP regressions
116
+ ```
117
+
118
+ GitHub Actions:
119
+
120
+ - **CI** — on push/PR to `main`: matrix of 3 OS (ubuntu, macos, windows) running `actions/checkout@v7` + `oven-sh/setup-bun@v2`, then `bun install --frozen-lockfile` + `bun run check`
121
+ - **Release** — on push to `main`: [semantic-release](https://github.com/semantic-release/semantic-release) computes the next version from Conventional Commits, publishes the four workspaces to npm in dependency order — `workit-core`, `workit-opencode`, `workit-cursor`, `workit-cli` (with provenance), and creates the git tag + GitHub Release
122
+ - **Code review** — on every PR: the [OpenCode GitHub integration](https://opencode.ai/docs/github/) reviews the diff (see [Code review](#code-review))
123
+
124
+ No manual tags — semantic-release owns the version/tag flow:
125
+
126
+ ```bash
127
+ git push origin main
128
+ ```
129
+
130
+ ## Code review
131
+
132
+ Every pull request is automatically reviewed by [OpenCode](https://opencode.ai/docs/github/) via `.github/workflows/opencode-review.yml` — it checks code quality, potential bugs, and this repo's own standards (the spec/plan contract, Conventional Commits, the CONTRIBUTING.md review flow). Model: `opencode-go/deepseek-v4-flash`.
133
+
134
+ Checks fall into two categories:
135
+
136
+ - **BLOCKING — the `pull_request` review** (`review` job): runs on every PR (opened/synchronized/reopened/ready_for_review) and is registered as a required check in branch protection — the PR cannot merge while it's red.
137
+ - **ADVISORY — on-demand and triage flows** (never block merge): mention `/oc` or `/opencode` in a comment — issue, PR thread, or a specific line in the Files tab — to have OpenCode fix, explain, or update the PR (`oc` job); new issues are triaged with guidance and doc links (`triage` job).
138
+
139
+ To activate the review on a fork or fresh clone:
140
+
141
+ 1. Install the [OpenCode GitHub app](https://github.com/apps/opencode-agent) on the repository.
142
+ 2. Add the `OPENCODE_API_KEY` secret under Settings → Secrets and variables → Actions.
143
+ 3. PRs trigger the review on opened/synchronized/reopened events automatically.
144
+
145
+ [Cursor Bugbot](https://cursor.com/dashboard/bugbot) is an optional alternative to the OpenCode review.
146
+
147
+ ## Architecture
148
+
149
+ | Concern | OpenCode | Cursor |
150
+ | --- | --- | --- |
151
+ | Tools | native plugin | MCP server |
152
+ | Session contract | `messages.transform` | `sessionStart` hook |
153
+ | Handoff | spawns OpenCode session | handoff prompt |
154
+ | Shared logic | `scripts/` | `scripts/` via `WORKFLOW_TOOLKIT_ROOT` |
155
+ | Install root | GitHub plugin pin | `~/.local/share/workflow-toolkit` + local plugin copy |
156
+
157
+ ## Future: Codex CLI
158
+
159
+ Add `codex/` adapter; reuse `scripts/` and `templates/`.
160
+
161
+ ## Workflow docs layout
162
+
163
+ Features live in `docs/<slug>/`:
164
+
165
+ - `docs/<slug>/spec.md` and `docs/<slug>/plan.md` are **committed** (they travel with the branch).
166
+ - `docs/<slug>/sdd/` (progress ledger, `flow.json` approval state, briefs, review diffs) is **gitignored** — working state for the current cycle.
167
+
168
+ Consequences:
169
+
170
+ - A fresh clone starts every workflow at `draft` — the flow gates (`workflow_spec_approve` / `workflow_plan_approve` / `workflow_plan_menu`) must be re-run after checkout.
171
+ - The SDD state does not travel with the branch; spec/plan do.
172
+
173
+ ## Contributing
174
+
175
+ Contributions welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
176
+
177
+ ## Kudos
178
+
179
+ - **Superpowers** — the vendored `vendor/superpowers/skills/` (brainstorming, writing-plans, executing-plans, TDD, …) is by [Adam Wiggins](https://github.com/obra), vendored with attribution.
180
+ - **Ponytail mode** — the lazy-engineer skill (ponytail, ponytail-review, ponytail-audit, …) by [Dietrich Gebert](https://github.com/dietrichgebert), active in this project's OpenCode config and installed as a shared skill.
@@ -0,0 +1,2 @@
1
+ Load the wk-changelog skill and follow it.
2
+ $ARGUMENTS
@@ -0,0 +1,2 @@
1
+ Load the wk-commit skill and follow it.
2
+ $ARGUMENTS
@@ -0,0 +1,2 @@
1
+ Load the wk-docs-refresh skill and follow it.
2
+ $ARGUMENTS
@@ -0,0 +1,2 @@
1
+ Load the wk-handoff skill and follow it.
2
+ $ARGUMENTS
@@ -0,0 +1,2 @@
1
+ Load the wk-implement skill and follow it.
2
+ $ARGUMENTS
@@ -0,0 +1,2 @@
1
+ Load the wk-init skill and follow it.
2
+ $ARGUMENTS
@@ -0,0 +1,2 @@
1
+ Load the wk-issue-update skill and follow it.
2
+ $ARGUMENTS
@@ -0,0 +1,2 @@
1
+ Load the wk-meetings skill and follow it.
2
+ $ARGUMENTS
@@ -0,0 +1,2 @@
1
+ Load the wk-pr skill and follow it.
2
+ $ARGUMENTS
@@ -0,0 +1,2 @@
1
+ Load the wk-release-notes skill and follow it.
2
+ $ARGUMENTS
@@ -0,0 +1,2 @@
1
+ Load the wk-status skill and follow it.
2
+ $ARGUMENTS
@@ -0,0 +1,2 @@
1
+ Load the wk-verify skill and follow it.
2
+ $ARGUMENTS
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@brainervirus/workit-core",
3
+ "version": "0.4.0",
4
+ "private": false,
5
+ "description": "Workit — workflow rails for agentic coding: specs, plans, YouTrack, CI-gated commits (shared core)",
6
+ "license": "MIT",
7
+ "keywords": ["opencode", "cursor", "workflow", "mcp", "youTrack", "agent"],
8
+ "bugs": {
9
+ "url": "https://github.com/BrainerVirus/workflow-toolkit/issues"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/BrainerVirus/workflow-toolkit.git"
14
+ },
15
+ "files": [
16
+ "src/",
17
+ "scripts/",
18
+ "skills/",
19
+ "commands/",
20
+ "vendor/superpowers/skills/",
21
+ "templates/",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "type": "module",
26
+ "main": "./src/core.ts",
27
+ "exports": {
28
+ "./src/tools": "./src/tools/index.ts",
29
+ "./src/*.ts": "./src/*.ts",
30
+ "./src/*": "./src/*.ts",
31
+ "./package.json": "./package.json"
32
+ },
33
+ "scripts": {
34
+ "typecheck": "tsc --noEmit"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "dependencies": {
40
+ "@modelcontextprotocol/sdk": "^1.12.0",
41
+ "zod": "^3.24.0"
42
+ }
43
+ }
@@ -0,0 +1,158 @@
1
+ #!/bin/sh
2
+
3
+ set -u
4
+
5
+ repo_root() {
6
+ git rev-parse --show-toplevel 2>/dev/null || pwd
7
+ }
8
+
9
+ current_branch() {
10
+ git rev-parse --abbrev-ref HEAD 2>/dev/null || printf 'unknown'
11
+ }
12
+
13
+ default_base() {
14
+ for ref in origin/main main origin/master master origin/develop develop; do
15
+ if git rev-parse --verify "$ref" >/dev/null 2>&1; then
16
+ printf '%s\n' "$ref"
17
+ return 0
18
+ fi
19
+ done
20
+ printf 'HEAD~1\n'
21
+ }
22
+
23
+ range_arg_or_default() {
24
+ if [ "${1:-}" != "" ]; then
25
+ printf '%s\n' "$1"
26
+ else
27
+ base=$(default_base)
28
+ printf '%s...HEAD\n' "$base"
29
+ fi
30
+ }
31
+
32
+ pr_range_arg_or_default() {
33
+ if [ "${1:-}" != "" ]; then
34
+ printf '%s\n' "$1"
35
+ return 0
36
+ fi
37
+ resolve_pr_range
38
+ }
39
+
40
+ is_protected_branch() {
41
+ branch=$1
42
+ case "$branch" in
43
+ main|master|develop|prod|production) return 0 ;;
44
+ *) return 1 ;;
45
+ esac
46
+ }
47
+
48
+ is_pr_branch() {
49
+ branch=$1
50
+ case "$branch" in
51
+ feature/*|bugfix/*) return 0 ;;
52
+ *) return 1 ;;
53
+ esac
54
+ }
55
+
56
+ # ponytail: develop-only base — main is release-only in this workflow; never compare PRs to main
57
+ resolve_pr_branch_context() {
58
+ branch=$(current_branch)
59
+
60
+ if is_protected_branch "$branch"; then
61
+ printf 'ERROR: cannot build PR context on protected branch %s — PRs are for feature/* or bugfix/* only\n' "$branch" >&2
62
+ return 1
63
+ fi
64
+
65
+ if ! is_pr_branch "$branch"; then
66
+ if [ "$branch" = "unknown" ]; then
67
+ printf 'ERROR: not in a git repository at %s — open the target repository as the OpenCode session directory\n' "$(pwd)" >&2
68
+ else
69
+ printf 'ERROR: branch %s is not feature/* or bugfix/* — checkout a feature branch or pass an explicit git range\n' "$branch" >&2
70
+ fi
71
+ return 1
72
+ fi
73
+
74
+ best_ref=""
75
+ best_mb=""
76
+
77
+ for ref in origin/develop develop; do
78
+ git rev-parse --verify "$ref" >/dev/null 2>&1 || continue
79
+ mb=$(git merge-base "$ref" HEAD 2>/dev/null) || continue
80
+ best_ref=$ref
81
+ best_mb=$mb
82
+ break
83
+ done
84
+
85
+ if [ "$best_ref" = "" ] || [ "$best_mb" = "" ]; then
86
+ printf 'ERROR: develop branch not found — PRs target develop (not main). Fetch/checkout develop or pass an explicit git range\n' >&2
87
+ return 1
88
+ fi
89
+
90
+ PR_BASE_REF=$best_ref
91
+ PR_MERGE_BASE=$best_mb
92
+ PR_RANGE="${best_ref}..HEAD"
93
+ PR_DIFF_RANGE="${best_mb}..HEAD"
94
+ export PR_BASE_REF PR_MERGE_BASE PR_RANGE PR_DIFF_RANGE
95
+ return 0
96
+ }
97
+
98
+ resolve_pr_range() {
99
+ if ! resolve_pr_branch_context; then
100
+ return 1
101
+ fi
102
+ printf '%s\n' "$PR_RANGE"
103
+ }
104
+
105
+ print_section() {
106
+ printf '\n## %s\n\n' "$1"
107
+ }
108
+
109
+ run_or_note() {
110
+ label=$1
111
+ shift
112
+ print_section "$label"
113
+ "$@" 2>&1 || printf '[command failed: %s]\n' "$*"
114
+ }
115
+
116
+ find_pr_template() {
117
+ for path in \
118
+ .gitlab/merge_request_templates/Default.md \
119
+ .gitlab/merge_request_templates/default.md \
120
+ .gitlab/merge_request_templates/merge_request_template.md \
121
+ .github/PULL_REQUEST_TEMPLATE.md \
122
+ .github/pull_request_template.md \
123
+ .github/PULL_REQUEST_TEMPLATE/pull_request_template.md \
124
+ docs/PULL_REQUEST_TEMPLATE.md \
125
+ PULL_REQUEST_TEMPLATE.md
126
+ do
127
+ if [ -f "$path" ]; then
128
+ printf '%s\n' "$path"
129
+ return 0
130
+ fi
131
+ done
132
+ return 1
133
+ }
134
+
135
+ fallback_pr_template() {
136
+ cat <<'TEMPLATE'
137
+ ## Summary
138
+ -
139
+
140
+ ## Validation
141
+ - [ ] Not run
142
+ TEMPLATE
143
+ }
144
+
145
+ changed_files_for_range() {
146
+ range=$1
147
+ git diff --name-only "$range" -- 2>/dev/null || git diff --name-only -- 2>/dev/null || true
148
+ }
149
+
150
+ commit_log_for_range() {
151
+ range=$1
152
+ git log --oneline --decorate --no-merges "$range" -- 2>/dev/null || git log --oneline --decorate -10 -- 2>/dev/null || true
153
+ }
154
+
155
+ diff_stat_for_range() {
156
+ range=$1
157
+ git diff --stat "$range" -- 2>/dev/null || git diff --stat -- 2>/dev/null || true
158
+ }
@@ -0,0 +1,42 @@
1
+ #!/bin/sh
2
+
3
+ set -u
4
+
5
+ SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
6
+ . "$SCRIPT_DIR/_shared/common.sh"
7
+
8
+ cd "$(repo_root)" || exit 1
9
+
10
+ range=$(range_arg_or_default "${1:-}")
11
+
12
+ print_section "Repository"
13
+ printf 'root: %s\n' "$(pwd)"
14
+ printf 'branch: %s\n' "$(current_branch)"
15
+ printf 'range: %s\n' "$range"
16
+
17
+ print_section "Keep a Changelog Rules"
18
+ cat <<'RULES'
19
+ - Use an [Unreleased] section.
20
+ - Use Added, Changed, Deprecated, Removed, Fixed, Security.
21
+ - Entries should be human-readable and user-facing.
22
+ - Do not use raw commit messages as changelog bullets.
23
+ - MERGE into existing ### Category under [Unreleased] — never append a second ### Added / ### Fixed block.
24
+ - Apply with the native workflow_changelog_apply tool only (not hand-edits under Unreleased).
25
+ - If Unreleased already has duplicate category headings, normalize_only first.
26
+ RULES
27
+
28
+ print_section "Existing CHANGELOG.md"
29
+ if [ -f CHANGELOG.md ]; then
30
+ sed -n '1,260p' CHANGELOG.md
31
+ else
32
+ printf 'CHANGELOG.md not found.\n'
33
+ fi
34
+
35
+ print_section "Commits"
36
+ commit_log_for_range "$range"
37
+
38
+ print_section "Diff Stat"
39
+ diff_stat_for_range "$range"
40
+
41
+ print_section "Changed Files"
42
+ changed_files_for_range "$range"
@@ -0,0 +1,40 @@
1
+ #!/bin/sh
2
+
3
+ set -u
4
+
5
+ SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
6
+ . "$SCRIPT_DIR/_shared/common.sh"
7
+
8
+ cd "$(repo_root)" || exit 1
9
+
10
+ range=$(range_arg_or_default "${1:-}")
11
+
12
+ print_section "Repository"
13
+ printf 'root: %s\n' "$(pwd)"
14
+ printf 'branch: %s\n' "$(current_branch)"
15
+ printf 'range: %s\n' "$range"
16
+
17
+ print_section "Changed Files"
18
+ changed_files_for_range "$range"
19
+
20
+ print_section "Documentation Files"
21
+ find . -maxdepth 3 \( -name 'README.md' -o -name '*.md' \) \
22
+ -not -path './.git/*' \
23
+ -not -path './node_modules/*' \
24
+ -not -path './target/*' \
25
+ -not -path './dist/*' \
26
+ | sort | sed -n '1,200p'
27
+
28
+ print_section "README Preview"
29
+ if [ -f README.md ]; then
30
+ sed -n '1,220p' README.md
31
+ else
32
+ printf 'README.md not found.\n'
33
+ fi
34
+
35
+ print_section "Package Scripts"
36
+ if [ -f package.json ]; then
37
+ node -e "const p=require('./package.json'); console.log(JSON.stringify({name:p.name,version:p.version,scripts:p.scripts}, null, 2))" 2>/dev/null || true
38
+ else
39
+ printf 'package.json not found.\n'
40
+ fi
@@ -0,0 +1,15 @@
1
+ # Sample Plan
2
+
3
+ ## File Map
4
+
5
+ Not a task.
6
+
7
+ ### Task 1: First task
8
+
9
+ - [ ] Step 1: Do alpha
10
+ - [ ] Step 2: Do beta
11
+ - [ ] Step 3: Do gamma
12
+
13
+ ### Task 2: Second task
14
+
15
+ - [ ] Step 1: Finish
@@ -0,0 +1,2 @@
1
+ Task 1: complete (commits abc1234..def5678, review clean)
2
+ Task 2: complete (commits def5678..111aaaa, review skipped — trivial doc)
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ # Ported to TS — CLI contract kept: execs bun <core>/ports/init-apply.ts
3
+ set -euo pipefail
4
+ SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
5
+ exec bun "$SCRIPT_DIR/../../src/core/ports/init-apply.ts" "$@"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ # Ported to TS — CLI contract kept: execs bun <core>/ports/init-status.ts
3
+ set -euo pipefail
4
+ SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
5
+ exec bun "$SCRIPT_DIR/../../src/core/ports/init-status.ts" "$@"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ # Ported to TS — CLI contract kept: execs bun <core>/ports/init-toolkit-status.ts
3
+ set -euo pipefail
4
+ SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
5
+ exec bun "$SCRIPT_DIR/../../src/core/ports/init-toolkit-status.ts" "$@"
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env bash
2
+ # Install / refresh Cursor plugin (+ OpenCode live loader via sync-runtime).
3
+ set -euo pipefail
4
+
5
+ REPO_SLUG="${WORKFLOW_TOOLKIT_REPO:-BrainerVirus/workit}"
6
+ SHARE="${HOME}/.local/share/workflow-toolkit"
7
+ SKILLS_DIR="${HOME}/.cursor/skills"
8
+
9
+ FROM_GITHUB=0
10
+ LOCAL_ROOT=""
11
+ if [ -n "${BASH_SOURCE[0]:-}" ] && [ -f "${BASH_SOURCE[0]}" ]; then
12
+ SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
13
+ LOCAL_ROOT="$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)"
14
+ else
15
+ FROM_GITHUB=1
16
+ fi
17
+
18
+ for arg in "$@"; do
19
+ case "$arg" in
20
+ --github|--from-github) FROM_GITHUB=1 ;;
21
+ esac
22
+ done
23
+
24
+ if [ "$FROM_GITHUB" -eq 0 ] && [ ! -d "${LOCAL_ROOT}/packages/workit-cursor/.cursor-plugin" ]; then
25
+ FROM_GITHUB=1
26
+ fi
27
+
28
+ if [ "$FROM_GITHUB" -eq 1 ]; then
29
+ mkdir -p "$(dirname "$SHARE")"
30
+ if [ -d "$SHARE/.git" ]; then
31
+ git -C "$SHARE" fetch --tags --force origin
32
+ git -C "$SHARE" checkout main
33
+ git -C "$SHARE" pull --ff-only origin main
34
+ else
35
+ rm -rf "$SHARE"
36
+ git clone --depth 1 "git@github.com:${REPO_SLUG}.git" "$SHARE"
37
+ fi
38
+ ROOT="$SHARE"
39
+ else
40
+ ROOT="$LOCAL_ROOT"
41
+ fi
42
+
43
+ chmod +x "$ROOT/packages/workit-core/scripts/sync-runtime.sh" "$ROOT/packages/workit-core/scripts/"*.sh
44
+ # Prefer syncing from this ROOT (dev or freshly cloned share)
45
+ WORKFLOW_TOOLKIT_DEV="$ROOT" "$ROOT/packages/workit-core/scripts/sync-runtime.sh"
46
+
47
+ # Drop stale CLI skill symlinks (duplicate /wf-* and /wk-* entries)
48
+ if [ -d "$SKILLS_DIR" ]; then
49
+ rm -f "$SKILLS_DIR"/wf-* "$SKILLS_DIR"/wk-*
50
+ fi
51
+
52
+ CURSOR_SETTINGS="$HOME/.cursor/settings.json" bun -e '
53
+ import fs from "node:fs";
54
+ import os from "node:os";
55
+ const path = process.env.CURSOR_SETTINGS!;
56
+ let data = {};
57
+ if (fs.existsSync(path)) data = JSON.parse(fs.readFileSync(path, "utf8"));
58
+ const prev = data.enabled_plugins && typeof data.enabled_plugins === "object" ? data.enabled_plugins : {};
59
+ const plugin = `${os.homedir()}/.cursor/plugins/local/workflow-toolkit`;
60
+ data.enabled_plugins = { ...prev, "workflow-toolkit": true, "local/workflow-toolkit": true };
61
+ data.plugin_dirs = [plugin];
62
+ fs.writeFileSync(path, JSON.stringify(data, null, 2) + "\n");
63
+ '
64
+
65
+ CURSOR_MCP="$HOME/.cursor/mcp.json" bun -e '
66
+ import fs from "node:fs";
67
+ const path = process.env.CURSOR_MCP!;
68
+ const data = fs.existsSync(path) ? JSON.parse(fs.readFileSync(path, "utf8")) : { mcpServers: {} };
69
+ data.mcpServers = data.mcpServers ?? {};
70
+ data.mcpServers["workflow-toolkit"] = {
71
+ command: "bash",
72
+ args: [
73
+ "-lc",
74
+ "exec \"$HOME/.local/share/workflow-toolkit/packages/workit-core/scripts/run-cursor-mcp.sh\" \"$0\"",
75
+ "${workspaceFolder}",
76
+ ],
77
+ };
78
+ fs.writeFileSync(path, JSON.stringify(data, null, 2) + "\n");
79
+ '
80
+
81
+ echo "Cursor plugin installed + auto-sync enabled (sessionStart)."
82
+ echo "Share: $SHARE"
83
+ ls "$HOME/.cursor/plugins/local/workflow-toolkit/skills" | grep '^wk-' || true