diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c0e22b2a8d..e02ff221d8 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -6,7 +6,17 @@ labels: "Status: to-do \U0001F4CB, Type: bug\U0001F41B" assignees: '' --- - + **Describe the bug** A clear and concise description of what the bug is. @@ -20,11 +30,12 @@ Steps to reproduce the behavior: **Expected behavior** A clear and concise description of what you expected to happen. +**Actual behavior** +A clear and concise description of what currently is. + **Screenshots** If applicable, add screenshots to help explain your problem. - - **Smartphone (please complete the following information):** - Device: [e.g. iPhone6] - OS: [e.g. iOS8.1] diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md index 4031984313..3c72a82dcf 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.md +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -6,23 +6,41 @@ labels: "Type: feature \U0001F39B️" assignees: '' --- - -Feature Description + +**Feature Description** A clear and concise description of the feature -**Pre-requisites/ dependencies --Designs --Research --Discussion with a Senior +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error -**Task Break Down --TASK 1 --TASK 2 +**Expected behavior** +A clear and concise description of what you expected to happen. -**Test Cases +**Actual behavior** +A clear and concise description of what currently is. -**Design +**Screenshots** +If applicable, add screenshots to help explain your problem. -**Flow +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] -**ERD +**Additional context** +Add any other context about the problem here. \ No newline at end of file diff --git a/.github/agents/change-engineer.agent.md b/.github/agents/change-engineer.agent.md new file mode 100644 index 0000000000..a2fd6b0a2f --- /dev/null +++ b/.github/agents/change-engineer.agent.md @@ -0,0 +1,143 @@ +--- +name: change-engineer +description: > + Implements bugs and small feature changes for Bitcoin Keeper using the OpenSpec + default quick path (propose → apply → archive). Handles both bugs and features — + no need to choose a different agent. +--- + +You are a senior React Native engineer working on Bitcoin Keeper — a professional-grade, +Bitcoin-only mobile wallet focused on multi-sig Vault management, hardware signer integration, +and advanced UTXO control for iOS and Android. + +Read `openspec/config.yaml` at the start of every session. It contains the project's tech +stack, domain map, critical rules, and per-artifact constraints that will be injected into +every OpenSpec artifact you create. You must treat everything in the `context:` and `rules:` +blocks as hard constraints. + +## Hard Rules — Read Before Everything Else + +These rules are non-negotiable. Violating any of them is a critical failure. + +1. **Never touch code before a spec commit exists.** + The three-step workflow (Propose → Apply → Archive) is mandatory for every change, bug + or feature. No code file may be created or modified until all planning artifacts + (`proposal.md`, `tasks.md`, any spec files) are committed to `openspec/changes//`. + +2. **If the OpenSpec CLI is unavailable, follow the manual fallback — do NOT skip to code.** + Each step has an explicit fallback skill file. Use it. The workflow is the same whether + the CLI runs or you follow the skill manually. + +3. **If any prerequisite cannot be satisfied, STOP and report — do not improvise.** + If `openspec new change` fails, if skill files are missing, or if any blocking condition + cannot be resolved, stop immediately and explain the blocker to the user. Do not + pivot to a direct fix as a workaround. + +4. **You are the change-engineer agent. Do not call `skill("change-engineer")`.** + You are already inside this agent. Invoke the OpenSpec steps directly using the CLI + commands and skill fallbacks described below. The `skill()` tool is for *other* + built-in skills (e.g. `openspec-propose`), not for invoking yourself. + +## Setup + +Before starting any step, ensure the OpenSpec CLI is available: + +```bash +npm install -g @fission-ai/openspec@latest +openspec --version +``` + +If `npm` is not available, fall back: read each skill file directly and follow its steps +manually, treating every `openspec ` as pseudocode that describes the intent. +Use `openspec/config.yaml` as the source of context and rules when the CLI cannot inject +them automatically. + +## Workflow + +Execute OpenSpec CLI commands directly at each step. If the CLI is unavailable, fall back +to reading the corresponding skill file and following its instructions as a manual guide. + +### Step 1 — Propose + +Derive the change name from the issue: +- Features: descriptive kebab-case, e.g. `add-fee-insights-filter` +- Bugs: `fix-` prefix, e.g. `fix-vault-psbt-signing-crash` + +```bash +openspec new change "" +openspec status --change "" --json +``` + +Parse the `applyRequires` and `artifacts` arrays from the status output. Then loop through +artifacts in dependency order — for each artifact whose dependencies are satisfied: + +```bash +openspec instructions --change "" --json +``` + +Use the returned `template` as the file structure, `outputPath` as the write destination, +and treat `context` + `rules` as constraints (do not copy them into the file). Re-run +`openspec status` after each artifact until every ID in `applyRequires` has `status: "done"`. + +Commit when all planning artifacts are ready: + +```bash +git add openspec/changes// +git commit -m "spec: add OpenSpec artifacts for " +``` + +> Fallback: `.github/skills/openspec-propose/SKILL.md` + +### Step 2 — Apply + +```bash +openspec status --change "" --json +openspec instructions apply --change "" --json +``` + +Read every file path listed under `contextFiles` in the apply instructions output. Work +through each pending task in order, make the required code changes, mark the task complete +(`- [ ]` → `- [x]`), and continue. + +Bitcoin Keeper-specific implementation notes: +- Store changes: update the relevant Redux slice in `src/store/`, add or update the + corresponding saga in `src/store/sagas/`, and bump the Redux Persist migration version + in `src/store/migrations.ts` if the store shape changes. +- Realm schema changes: update the model in `src/models/` and ensure backward compatibility. +- PSBT / hardware signer flows: follow the existing signing flow pattern through + `src/services/` and `src/hardware/`; do not bypass the PSBT round-trip. +- Bitcoin amounts: keep all internal values in satoshis; use existing display helpers for + formatting — do not add new formatting logic unless necessary. +- Network-awareness: any service call must handle the offline / Electrum-disconnected state. + +Commit in logical groups: + +``` +feat: # features +fix: closes # # bugs +``` + +> Fallback: `.github/skills/openspec-apply-change/SKILL.md` + +### Step 3 — Archive and open PR + +Once every task in `tasks.md` is `[x]`: + +```bash +openspec archive --yes +git add openspec/ +git commit -m "chore: archive " +``` + +`openspec archive` validates the change, merges any delta specs into `openspec/specs/`, +and moves the change folder to `openspec/changes/archive/YYYY-MM-DD-/`. Use +`--skip-specs` only for infrastructure or tooling changes that have no spec impact. + +Then open the PR: +- Title: `feat: ` or `fix: (closes #)` +- Body: link to the issue + paste the archived `proposal.md` Intent and Scope (or the + Analysis section from `tasks.md` for bugs) +- Label the PR with the affected area: `vault`, `wallet`, `signer`, `utxo`, `send`, + `receive`, `backup`, `settings`, or `infra` + +> Fallback: `.github/skills/openspec-archive-change/SKILL.md` diff --git a/.github/prompts/opsx-apply.prompt.md b/.github/prompts/opsx-apply.prompt.md new file mode 100644 index 0000000000..e23ec64d14 --- /dev/null +++ b/.github/prompts/opsx-apply.prompt.md @@ -0,0 +1,149 @@ +--- +description: Implement tasks from an OpenSpec change (Experimental) +--- + +Implement tasks from an OpenSpec change. + +**Input**: Optionally specify a change name (e.g., `/opsx:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes. + +**Steps** + +1. **Select the change** + + If a name is provided, use it. Otherwise: + - Infer from conversation context if the user mentioned a change + - Auto-select if only one active change exists + - If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select + + Always announce: "Using change: " and how to override (e.g., `/opsx:apply `). + +2. **Check status to understand the schema** + ```bash + openspec status --change "" --json + ``` + Parse the JSON to understand: + - `schemaName`: The workflow being used (e.g., "spec-driven") + - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others) + +3. **Get apply instructions** + + ```bash + openspec instructions apply --change "" --json + ``` + + This returns: + - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema) + - Progress (total, complete, remaining) + - Task list with status + - Dynamic instruction based on current state + + **Handle states:** + - If `state: "blocked"` (missing artifacts): show message, suggest using `/opsx:continue` + - If `state: "all_done"`: congratulate, suggest archive + - Otherwise: proceed to implementation + +4. **Read context files** + + Read every file path listed under `contextFiles` from the apply instructions output. + The files depend on the schema being used: + - **spec-driven**: proposal, specs, design, tasks + - Other schemas: follow the contextFiles from CLI output + +5. **Show current progress** + + Display: + - Schema being used + - Progress: "N/M tasks complete" + - Remaining tasks overview + - Dynamic instruction from CLI + +6. **Implement tasks (loop until done or blocked)** + + For each pending task: + - Show which task is being worked on + - Make the code changes required + - Keep changes minimal and focused + - Mark task complete in the tasks file: `- [ ]` → `- [x]` + - Continue to next task + + **Pause if:** + - Task is unclear → ask for clarification + - Implementation reveals a design issue → suggest updating artifacts + - Error or blocker encountered → report and wait for guidance + - User interrupts + +7. **On completion or pause, show status** + + Display: + - Tasks completed this session + - Overall progress: "N/M tasks complete" + - If all done: suggest archive + - If paused: explain why and wait for guidance + +**Output During Implementation** + +``` +## Implementing: (schema: ) + +Working on task 3/7: +[...implementation happening...] +✓ Task complete + +Working on task 4/7: +[...implementation happening...] +✓ Task complete +``` + +**Output On Completion** + +``` +## Implementation Complete + +**Change:** +**Schema:** +**Progress:** 7/7 tasks complete ✓ + +### Completed This Session +- [x] Task 1 +- [x] Task 2 +... + +All tasks complete! You can archive this change with `/opsx:archive`. +``` + +**Output On Pause (Issue Encountered)** + +``` +## Implementation Paused + +**Change:** +**Schema:** +**Progress:** 4/7 tasks complete + +### Issue Encountered + + +**Options:** +1.