@brainervirus/workit-cli 0.6.1 → 0.8.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.
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # @brainervirus/workit-cli
2
2
 
3
- The workit CLI — an interactive wizard that configures workit for OpenCode and/or Cursor.
3
+ The workit CLI — an interactive Ink wizard that configures workit for OpenCode and/or Cursor, plus an offline installation doctor.
4
+
5
+ ## Requirements
6
+
7
+ - **Node.js ≥ 22** — the published CLI is a self-contained Node bundle (no Bun runtime). Node 21 and below fail (`ERR_MODULE_NOT_FOUND`/ESM syntax or the `>=22` engine gate).
4
8
 
5
9
  ## Install
6
10
 
@@ -13,10 +17,31 @@ npx @brainervirus/workit-cli init
13
17
  ## Usage
14
18
 
15
19
  ```bash
16
- workit init
20
+ workit init # interactive setup wizard
21
+ workit doctor # offline installation health report
22
+ workit doctor --json # machine-readable report
23
+ workit # help
24
+ ```
25
+
26
+ `workit init` guides you through: platform selection (OpenCode/Cursor), global config (locale, timezone, branch policy), YouTrack, VCS, workspaces (path globs → provider), and project hygiene files. The wizard is a TTY application — `workit init` requires an interactive terminal and prints guidance (exiting nonzero) when stdin is not a TTY.
27
+
28
+ `workit doctor` checks the offline installation health and exits nonzero when problems are found; `--json` prints the full report as JSON instead of the human-readable table.
29
+
30
+ ## Behavior
31
+
32
+ - **Safe apply semantics** — a malformed `config.json` is detected before the wizard renders and reported as a friendly blocked output instead of crashing; the same guard runs after the Apply preview.
33
+ - **Stable interaction** — unchanged wizard inputs are no-ops; they settle without React render warnings and never discard draft state.
34
+ - **Clean terminal** — only `warn`/`error` diagnostics print to stderr; routine structured `info` records stay in the JSONL journal. Nonzero failures and human-readable errors remain visible.
35
+ - **Node support** — the packed CLI runs on Node 22+; installation on Node 22.19 emits no engine warning from workit's dependency tree.
36
+
37
+ ## Package scripts
38
+
39
+ ```bash
40
+ bun run build # bundle dist/index.js (self-contained, Node shebang) + assets
41
+ bun run typecheck # tsc --noEmit
17
42
  ```
18
43
 
19
- Guides you through: platform selection (OpenCode/Cursor), global config (locale, timezone, branch policy), YouTrack, VCS, workspaces (path globs → provider), and project hygiene files.
44
+ The build produces a nonsplitting `dist/index.js` with a portable `#!/usr/bin/env node` shebang and copies the deterministic `assets/` (templates) from core.
20
45
 
21
46
  ## Docs
22
47
 
@@ -0,0 +1,58 @@
1
+ Load `using-superpowers`, `subagent-driven-development`, `test-driven-development`, and `verification-before-completion` through OpenCode's `skill` tool. Implement the existing plan; do not re-plan.
2
+
3
+ **Spec:** <SPEC_PATH>
4
+ **Plan:** <PLAN_PATH>
5
+ **Branch:** <BRANCH>
6
+ **SDD:** `<SDD_DIR>`
7
+
8
+ ## Hard gates
9
+
10
+ - The parent is coordinator-only: it does not edit product code or perform delegated exploration.
11
+ - Never use a worktree. Branch changes are in-place through `workflow_branch_setup` on `feature/*` or `bugfix/*`; never commit on protected branches.
12
+ - Working state, briefs, ledgers, and review diffs live only under gitignored `<SDD_DIR>` in `docs/<slug>/sdd/` and use `workflow_sdd_*` tools.
13
+ - Use native `todowrite` for visible task state as well as the gitignored ledger.
14
+ - Use native `question` for branch/stash choices and guarded external mutations; call mutation tools only after approval with `confirmed: true` (grounded in the recorded NativeChoiceEvidence).
15
+ - Flow-tool confirmations are never agent-typed booleans and never caller-supplied evidence objects: on OpenCode the plugin records the user's native-`question` answer as a host-observed one-use receipt (`attested: true`, `callID`, `selectedLabel`, `recordedAt`) consumed by `workflow_spec_approve` / `workflow_plan_approve` / `workflow_plan_menu` — no evidence argument exists, and delegated worker status comes from host session parentage (`parentID`), never a caller `role` field. On Cursor, confirmations are policy-only (`attested: false`) and subagent-driven execution is rejected as unsupported.
16
+ - On Cursor, for every repository-scoped `workflow_*` call, pass the active Cursor workspace as `workspace_root`; never rely on the MCP process default.
17
+ - Use native `task` with only the built-in `explore` and `general` agents.
18
+
19
+ ## Flow gates (HARD)
20
+
21
+ - `wk-implement` refuses to run unless the plan is `approved` (flow.json) and the post-plan menu was presented.
22
+ - `wk-handoff` refuses to run unless both spec and plan are `approved`.
23
+ - Sequence is enforced by tools: `workflow_spec_approve`, `workflow_plan_approve`, `workflow_plan_menu` — never skip a step (the spec/plan self-review runs automatically inside the transition; only the final approval asks for your confirmation).
24
+
25
+ ## Setup
26
+
27
+ 0. Call `workflow_docs_validate` with the linked spec/plan paths. Hard-fail on any error before todos or branch setup.
28
+ 1. Call `workflow_sdd_context` with `<PLAN_PATH>` and initialize `todowrite` from returned tasks.
29
+ 2. Call `workflow_plan_tasks`; cache each top-level task's `section_text`.
30
+ 3. Mark IDs in `completed_task_ids` completed and never redispatch them.
31
+ 4. Call `workflow_resolve_branch`, then show the current branch, target branch, and stash behavior before any in-place checkout/setup mutation.
32
+ 5. Always use `question`: for a clean tree ask whether to proceed or cancel; for a dirty tree add the stash choice and describe what will be stashed.
33
+ 6. Call `workflow_branch_setup` with `confirmed: true` only after approval.
34
+
35
+ ## Remaining-task loop
36
+
37
+ For each top-level task absent from `completed_task_ids`:
38
+
39
+ 1. Mark it `in_progress` with `todowrite`.
40
+ 2. Create a working-state brief with `workflow_sdd_task_brief` and `confirmed: true`.
41
+ 3. Delegate read-only discovery, when needed, to an `explore` agent. Delegate implementation to a fresh `general` agent. Product changes follow TDD.
42
+ 4. Create a working-state diff with `workflow_sdd_review_package` and `confirmed: true`.
43
+ 5. Delegate spec-compliance review and code-quality review to separate `general` agents.
44
+ 6. **Blocking** findings (Critical, Important, or spec-compliance) may trigger at most **two** fix+re-review rounds per task. **Advisory** findings (Minor, style, YAGNI, taste) never pause the loop — append them to `<SDD_DIR>/advisories.md`.
45
+ 7. Append the validated ledger entry with `workflow_sdd_append_progress` and `confirmed: true`; mark the todo completed.
46
+
47
+ ## Final gate
48
+
49
+ Run a separate full-branch code review, then `workflow_verify`. Present the full `<SDD_DIR>/advisories.md` roll-up once, then use native `question` so the user can choose which advisory items to fix, discuss, or discard. Report exact check results and never infer success. Use `workflow_git_context` for a commit preview and load `wk-commit` through `skill` for an approved commit. If working state contains a stash reference, preview reapplication through `question`, then call `workflow_branch_setup` with `confirmed: true` after approval.
50
+
51
+ ## Task order
52
+
53
+ <TASK_LIST>
54
+
55
+ ## Quality gate (HARD)
56
+
57
+ - Specs/plans are written from `templates/spec-template.md` / `templates/plan-template.md`.
58
+ - After `workflow_docs_validate`, surface `quality` findings (spec scan). Hard findings (missing required section, missing CA-XX) block task start unless the user explicitly waives them. Warnings are advisory.
@@ -0,0 +1 @@
1
+ {{greetingText}}
@@ -0,0 +1,3 @@
1
+ ## Adjunto capturas
2
+
3
+ ## Archivos adjuntos
@@ -0,0 +1,8 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ indent_style = space
8
+ indent_size = 2
@@ -0,0 +1,3 @@
1
+ * text=auto
2
+ *.md text
3
+ *.bat text eol=crlf
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ ### Changed
13
+
14
+ ### Fixed
@@ -0,0 +1,3 @@
1
+ # Contributing
2
+
3
+ <!-- How to report issues, propose changes, and the review process. -->
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) <YEAR> <HOLDER>
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.
@@ -0,0 +1,3 @@
1
+ # <PROJECT>
2
+
3
+ <!-- Describe the project: what it does, how to run it, how to contribute. -->
@@ -0,0 +1,6 @@
1
+ # Actualización
2
+ {{greetingSection}}
3
+ {{projectSection}}
4
+ {{userNotesSection}}
5
+ {{progressSection}}
6
+ {{gitCommitsSection}}
@@ -0,0 +1,25 @@
1
+ # <Feature> Implementation Plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
+
5
+ **Spec:** `docs/<slug>/spec.md`
6
+ **Branch:** `feature/<slug>`
7
+
8
+ **Goal:** <one sentence>
9
+
10
+ ## Global Constraints
11
+
12
+ - <project-wide requirements, one line each>
13
+
14
+ ---
15
+
16
+ ### Task N: <Component>
17
+
18
+ - [ ] **Step 1: <action>**
19
+
20
+ <!-- per-task criteria: how this task is verified -->
21
+ **Criteria:** <verifiable check>
22
+
23
+ | Status | Task |
24
+ | --- | --- |
25
+ | pending | N: <Component> |
@@ -0,0 +1,51 @@
1
+ # Spec: <feature>
2
+
3
+ **Branch:** `feature/<slug>`
4
+
5
+ ## Context
6
+
7
+ <!-- Why does this exist? What problem does it solve? 1-3 sentences. -->
8
+
9
+ ## Goals
10
+
11
+ - <!-- measurable, one per bullet -->
12
+
13
+ ## Non-goals
14
+
15
+ - <!-- explicitly out of scope -->
16
+
17
+ ## Architecture
18
+
19
+ <!-- REQUIRED if this spec has flows or architecture: render a mermaid diagram (workflow_present_flow). -->
20
+ ```mermaid
21
+ flowchart TD
22
+ A[Start] --> B[Step]
23
+ ```
24
+
25
+ <!-- REQUIRED if this spec touches UI: render an ASCII wireframe (workflow_present_ascii). -->
26
+ ```text
27
+ ┌──────────────┐
28
+ │ Header │
29
+ └──────────────┘
30
+ ```
31
+
32
+ ## Data flow / contracts
33
+
34
+ <!-- REQUIRED when there is a glossary, scope comparison, or contracts: use markdown tables. -->
35
+ | Term | Meaning |
36
+ | --- | --- |
37
+ | <term> | <meaning> |
38
+
39
+ ## Acceptance criteria
40
+
41
+ <!-- REQUIRED: enumerable, each verifiable. Numbered CA-01, CA-02, ... -->
42
+ - CA-01 …
43
+ - CA-02 …
44
+
45
+ ## Decisions
46
+
47
+ - D-01 …
48
+
49
+ ## Future work
50
+
51
+ - …
@@ -0,0 +1,70 @@
1
+ # Superpowers document contract
2
+
3
+ Use OpenCode's native `question` for every bounded user choice. Give concise choices and allow a custom answer; if the tool is unavailable, ask one concise plain-text question. Use `skill` to load workflow and Superpowers skills, `todowrite` for task state, and `task` for delegated work.
4
+
5
+ ## Tracked document layout
6
+
7
+ | Document | Path |
8
+ | --- | --- |
9
+ | Spec | `docs/<slug>/spec.md` |
10
+ | Plan | `docs/<slug>/plan.md` |
11
+ | SDD state | `docs/<slug>/sdd/` |
12
+
13
+ An optional human mirror may live at `docs/specs/<same-basename>.md`; when present, keep its branch identical.
14
+
15
+ Specs require:
16
+
17
+ ```markdown
18
+ **Branch:** `feature/<slug>`
19
+ ```
20
+
21
+ Plans require:
22
+
23
+ ```markdown
24
+ **Spec:** `docs/<slug>/spec.md`
25
+ **Branch:** `feature/<slug>`
26
+ ```
27
+
28
+ `bugfix/<slug>` is also valid. Never use `main`, `develop`, `master`, or `prod`. Use plain backtick paths. Top-level headings are exactly `### Task N: Title`; steps use `- [ ] **Step N:** ...`; task headings never appear inside fences.
29
+
30
+ Before writing **Branch:** into a new spec or plan, call `workflow_docs_branch` and write the returned `branch` verbatim. When `action` is `keep`, use the current feature/bugfix branch. When `action` is `create_from_develop` or `create_from_base`, create the branch only through `workflow_branch_setup`; it uses the configured workspace/global target branch.
31
+
32
+ ## Execution and handoff
33
+
34
+ - Implementation uses `wk-implement` and subagent-driven development, with native `todowrite` and `task`.
35
+ - Commits use `wk-commit` after its native `question` confirmation.
36
+ - Continuation uses `wk-handoff`, whose `workflow_handoff_session` creates and seeds the OpenCode session automatically.
37
+ - Never use worktrees. Resolve the declared branch with `workflow_resolve_branch`, preview dirty-tree stash choices with `question`, and apply an approved in-place checkout through `workflow_branch_setup` with `confirmed: true` (grounded in the recorded NativeChoiceEvidence).
38
+ - Flow-tool confirmations are never agent-typed booleans and never caller-supplied evidence objects: on OpenCode the plugin records the user's native-`question` answer as a host-observed one-use receipt (`attested: true`, `callID`, `selectedLabel`, `recordedAt`) consumed by `workflow_spec_approve` / `workflow_plan_approve` / `workflow_plan_menu` — no evidence argument exists, and delegated worker status comes from host session parentage (`parentID`), never a caller `role` field. On Cursor, confirmations are policy-only (`attested: false`) and subagent-driven execution is rejected as unsupported.
39
+ - Keep all SDD state under the gitignored `docs/<slug>/sdd/`; use `workflow_sdd_context` and the registered `workflow_sdd_*` tools.
40
+ - After implementation, use `question` before an approved stash reapply through `workflow_branch_setup` with `confirmed: true`.
41
+
42
+ ## YouTrack content
43
+
44
+ Chat follows the user's language. YouTrack task comments are Spanish (`es-CL`) and use `workflow_youtrack_draft` followed by reviewed `workflow_youtrack_post` with `confirmed: true`. Preserve the user's paragraph voice; do not inject commits, file paths, or robotic bullet reports.
45
+
46
+ ## Final self-check
47
+
48
+ Before handoff, call `workflow_docs_validate` on the linked spec/plan pair. Hard-fail on any error; never offer execution when validation fails.
49
+
50
+ Before handoff, verify the saved spec path, plan path, declared branch, top-level task numbering, and workflow-managed SDD directory through the registered read-only workflow tools. Report structured failures; never infer success.
51
+
52
+ ## Post-plan execution choice
53
+
54
+ After saving a plan, call `workflow_docs_validate` on the spec/plan pair. On failure, stop and fix docs — do not offer execution.
55
+
56
+ On success, use native `question` / Cursor `AskQuestion` with exactly these options (no stay, no A/B/C prose duplicate):
57
+
58
+ 1. Subagent-driven → load `wk-implement`
59
+ 2. Inline → execute in this session
60
+ 3. Handoff → load `wk-handoff` (new session only)
61
+ 4. Review spec first
62
+ 5. Review plan first
63
+
64
+ Never emit Superpowers text beginning “Two execution options”.
65
+
66
+ - Specs/plans must follow `templates/spec-template.md` / `templates/plan-template.md` (mandated diagrams, tables, CA-XX).
67
+
68
+ ## Doc delivery
69
+
70
+ When delivering a spec or plan, use a clickable markdown link (\`[spec.md](docs/<slug>/spec.md)\`) and a 3-5 bullet summary of the content (Context, Goals, key decisions, status). Never reference docs with backtick-only paths.