opencode-conductor-cdd-plugin 1.0.0-beta.13

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 (91) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +163 -0
  3. package/README.test.md +51 -0
  4. package/dist/commands/implement.d.ts +1 -0
  5. package/dist/commands/implement.js +30 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +108 -0
  8. package/dist/index.test.d.ts +1 -0
  9. package/dist/index.test.js +122 -0
  10. package/dist/prompts/agent/cdd.md +41 -0
  11. package/dist/prompts/agent/implementer.md +22 -0
  12. package/dist/prompts/agent.md +23 -0
  13. package/dist/prompts/cdd/implement.json +4 -0
  14. package/dist/prompts/cdd/newTrack.json +4 -0
  15. package/dist/prompts/cdd/revert.json +4 -0
  16. package/dist/prompts/cdd/setup.json +4 -0
  17. package/dist/prompts/cdd/setup.test.d.ts +1 -0
  18. package/dist/prompts/cdd/setup.test.js +132 -0
  19. package/dist/prompts/cdd/setup.test.ts +168 -0
  20. package/dist/prompts/cdd/status.json +4 -0
  21. package/dist/prompts/strategies/delegate.md +11 -0
  22. package/dist/prompts/strategies/manual.md +9 -0
  23. package/dist/templates/code_styleguides/c.md +28 -0
  24. package/dist/templates/code_styleguides/cpp.md +46 -0
  25. package/dist/templates/code_styleguides/csharp.md +115 -0
  26. package/dist/templates/code_styleguides/dart.md +238 -0
  27. package/dist/templates/code_styleguides/general.md +23 -0
  28. package/dist/templates/code_styleguides/go.md +48 -0
  29. package/dist/templates/code_styleguides/html-css.md +49 -0
  30. package/dist/templates/code_styleguides/java.md +39 -0
  31. package/dist/templates/code_styleguides/javascript.md +51 -0
  32. package/dist/templates/code_styleguides/julia.md +27 -0
  33. package/dist/templates/code_styleguides/kotlin.md +41 -0
  34. package/dist/templates/code_styleguides/php.md +37 -0
  35. package/dist/templates/code_styleguides/python.md +37 -0
  36. package/dist/templates/code_styleguides/react.md +37 -0
  37. package/dist/templates/code_styleguides/ruby.md +39 -0
  38. package/dist/templates/code_styleguides/rust.md +44 -0
  39. package/dist/templates/code_styleguides/shell.md +35 -0
  40. package/dist/templates/code_styleguides/solidity.md +60 -0
  41. package/dist/templates/code_styleguides/sql.md +39 -0
  42. package/dist/templates/code_styleguides/swift.md +36 -0
  43. package/dist/templates/code_styleguides/typescript.md +43 -0
  44. package/dist/templates/code_styleguides/vue.md +38 -0
  45. package/dist/templates/code_styleguides/zig.md +27 -0
  46. package/dist/templates/workflow.md +336 -0
  47. package/dist/tools/background.d.ts +54 -0
  48. package/dist/tools/background.js +198 -0
  49. package/dist/tools/commands.d.ts +11 -0
  50. package/dist/tools/commands.js +80 -0
  51. package/dist/tools/commands.test.d.ts +1 -0
  52. package/dist/tools/commands.test.js +142 -0
  53. package/dist/tools/delegate.d.ts +3 -0
  54. package/dist/tools/delegate.js +45 -0
  55. package/dist/utils/autogenerateFlow.d.ts +65 -0
  56. package/dist/utils/autogenerateFlow.js +391 -0
  57. package/dist/utils/autogenerateFlow.test.d.ts +1 -0
  58. package/dist/utils/autogenerateFlow.test.js +610 -0
  59. package/dist/utils/bootstrap.d.ts +1 -0
  60. package/dist/utils/bootstrap.js +46 -0
  61. package/dist/utils/commandFactory.d.ts +11 -0
  62. package/dist/utils/commandFactory.js +69 -0
  63. package/dist/utils/commitMessages.d.ts +35 -0
  64. package/dist/utils/commitMessages.js +33 -0
  65. package/dist/utils/commitMessages.test.d.ts +1 -0
  66. package/dist/utils/commitMessages.test.js +79 -0
  67. package/dist/utils/configDetection.d.ts +7 -0
  68. package/dist/utils/configDetection.js +49 -0
  69. package/dist/utils/configDetection.test.d.ts +1 -0
  70. package/dist/utils/configDetection.test.js +119 -0
  71. package/dist/utils/contentGeneration.d.ts +10 -0
  72. package/dist/utils/contentGeneration.js +141 -0
  73. package/dist/utils/contentGeneration.test.d.ts +1 -0
  74. package/dist/utils/contentGeneration.test.js +147 -0
  75. package/dist/utils/contextAnalysis.d.ts +100 -0
  76. package/dist/utils/contextAnalysis.js +308 -0
  77. package/dist/utils/contextAnalysis.test.d.ts +1 -0
  78. package/dist/utils/contextAnalysis.test.js +307 -0
  79. package/dist/utils/gitNotes.d.ts +23 -0
  80. package/dist/utils/gitNotes.js +53 -0
  81. package/dist/utils/gitNotes.test.d.ts +1 -0
  82. package/dist/utils/gitNotes.test.js +105 -0
  83. package/dist/utils/ignoreMatcher.d.ts +9 -0
  84. package/dist/utils/ignoreMatcher.js +77 -0
  85. package/dist/utils/ignoreMatcher.test.d.ts +1 -0
  86. package/dist/utils/ignoreMatcher.test.js +126 -0
  87. package/dist/utils/stateManager.d.ts +10 -0
  88. package/dist/utils/stateManager.js +30 -0
  89. package/package.json +90 -0
  90. package/scripts/convert-legacy.cjs +17 -0
  91. package/scripts/postinstall.cjs +38 -0
@@ -0,0 +1,43 @@
1
+ # Google TypeScript Style Guide Summary
2
+
3
+ This document summarizes key rules and best practices from the Google TypeScript Style Guide, which is enforced by the `gts` tool.
4
+
5
+ ## 1. Language Features
6
+ - **Variable Declarations:** Always use `const` or `let`. **`var` is forbidden.** Use `const` by default.
7
+ - **Modules:** Use ES6 modules (`import`/`export`). **Do not use `namespace`.**
8
+ - **Exports:** Use named exports (`export {MyClass};`). **Do not use default exports.**
9
+ - **Classes:**
10
+ - **Do not use `#private` fields.** Use TypeScript's `private` visibility modifier.
11
+ - Mark properties never reassigned outside the constructor with `readonly`.
12
+ - **Never use the `public` modifier** (it's the default). Restrict visibility with `private` or `protected` where possible.
13
+ - **Functions:** Prefer function declarations for named functions. Use arrow functions for anonymous functions/callbacks.
14
+ - **String Literals:** Use single quotes (`'`). Use template literals (`` ` ``) for interpolation and multi-line strings.
15
+ - **Equality Checks:** Always use triple equals (`===`) and not equals (`!==`).
16
+ - **Type Assertions:** **Avoid type assertions (`x as SomeType`) and non-nullability assertions (`y!`)**. If you must use them, provide a clear justification.
17
+
18
+ ## 2. Disallowed Features
19
+ - **`any` Type:** **Avoid `any`**. Prefer `unknown` or a more specific type.
20
+ - **Wrapper Objects:** Do not instantiate `String`, `Boolean`, or `Number` wrapper classes.
21
+ - **Automatic Semicolon Insertion (ASI):** Do not rely on it. **Explicitly end all statements with a semicolon.**
22
+ - **`const enum`:** Do not use `const enum`. Use plain `enum` instead.
23
+ - **`eval()` and `Function(...string)`:** Forbidden.
24
+
25
+ ## 3. Naming
26
+ - **`UpperCamelCase`:** For classes, interfaces, types, enums, and decorators.
27
+ - **`lowerCamelCase`:** For variables, parameters, functions, methods, and properties.
28
+ - **`CONSTANT_CASE`:** For global constant values, including enum values.
29
+ - **`_` Prefix/Suffix:** **Do not use `_` as a prefix or suffix** for identifiers, including for private properties.
30
+
31
+ ## 4. Type System
32
+ - **Type Inference:** Rely on type inference for simple, obvious types. Be explicit for complex types.
33
+ - **`undefined` and `null`:** Both are supported. Be consistent within your project.
34
+ - **Optional vs. `|undefined`:** Prefer optional parameters and fields (`?`) over adding `|undefined` to the type.
35
+ - **`Array<T>` Type:** Use `T[]` for simple types. Use `Array<T>` for more complex union types (e.g., `Array<string | number>`).
36
+ - **`{}` Type:** **Do not use `{}`**. Prefer `unknown`, `Record<string, unknown>`, or `object`.
37
+
38
+ ## 5. Comments and Documentation
39
+ - **JSDoc:** Use `/** JSDoc */` for documentation, `//` for implementation comments.
40
+ - **Redundancy:** **Do not declare types in `@param` or `@return` blocks** (e.g., `/** @param {string} user */`). This is redundant in TypeScript.
41
+ - **Add Information:** Comments must add information, not just restate the code.
42
+
43
+ *Source: [Google TypeScript Style Guide](https://google.github.io/styleguide/tsguide.html)*
@@ -0,0 +1,38 @@
1
+ # Vue.js Style Guide Summary
2
+
3
+ This document summarizes key rules and best practices from the official Vue.js Style Guide, specifically for Vue 3 and the Composition API.
4
+
5
+ ## 1. Component Files
6
+ - **Single File Components (SFC)**: Always use `.vue` files.
7
+ - **Naming**: Use `PascalCase` for component filenames (e.g., `TodoList.vue`).
8
+ - **Structure**: Follow the standard order: `<script setup>`, `<template>`, `<style>`.
9
+
10
+ ## 2. Component Data
11
+ - **Composition API**: Prefer `<script setup>` and the Composition API over the Options API.
12
+ - **Ref vs Reactive**: Use `ref()` for primitive values and `reactive()` for objects/arrays (or `ref()` consistently for both).
13
+ - **Props**:
14
+ - Use `defineProps` with TypeScript types.
15
+ - Props should be used for data passing only (unidirectional flow).
16
+
17
+ ## 3. Template Syntax
18
+ - **Directives**: Use shorthand for `v-bind` (`:`) and `v-on` (`@`).
19
+ - **Key Attribute**: Always use `:key` with `v-for`. Never use an index as a key if the list can change.
20
+ - **Computed Properties**: Use `computed()` for complex logic in templates. Never use method calls for data derived from other reactive state in templates.
21
+
22
+ ## 4. Lifecycle Hooks
23
+ - Use Composition API lifecycle hooks (e.g., `onMounted`, `onUnmounted`) within `setup`.
24
+ - Ensure listeners and timers are cleaned up in `onUnmounted`.
25
+
26
+ ## 5. Global State
27
+ - **Pinia**: Use Pinia for complex global state management.
28
+ - **Provide/Inject**: Use `provide`/`inject` for dependency injection across deeply nested components.
29
+
30
+ ## 6. Styling
31
+ - **Scoped Styles**: Use `<style scoped>` by default to prevent leaking styles.
32
+ - **CSS Variables**: Use reactive CSS variables via `v-bind()` in `<style>` blocks where appropriate.
33
+
34
+ ## 7. Directives & Events
35
+ - **Custom Directives**: Use sparingly. Prefer components for reusable logic.
36
+ - **Emit**: Use `defineEmits` for documenting and typed-checking events.
37
+
38
+ *Source: [Official Vue.js Style Guide](https://vuejs.org/style-guide/)*
@@ -0,0 +1,27 @@
1
+ # Zig Style Guide Summary
2
+
3
+ This document summarizes key rules and best practices for Zig development, based on the official Zig documentation and common community patterns.
4
+
5
+ ## 1. Naming Conventions
6
+ - **Functions**: `camelCase` (e.g., `initStack`).
7
+ - **Variables**: `camelCase` (e.g., `userCounter`).
8
+ - **Types (Structs, Enums, Unions)**: `PascalCase` (e.g., `MemoryPool`).
9
+ - **Files**: `snake_case.zig` (e.g., `array_list.zig`).
10
+ - **Constants**: `Screaming_Snake_Case` is avoided; prefer `camelCase` or `PascalCase` depending on if it's a value or a type.
11
+
12
+ ## 2. Formatting
13
+ - **Indentation**: 4 spaces.
14
+ - **Line Length**: 100 characters limit.
15
+ - **Braces**: Opening brace on the same line.
16
+
17
+ ## 3. Idiomatic Zig
18
+ - **Error Handling**: Use `error` sets and the `!` operator. Prefer `try` and `catch` for explicit error handling.
19
+ - **Memory Management**: Use `Allocator` explicitly. Avoid global allocators.
20
+ - **Comptime**: Use `comptime` for generic programming and compile-time logic.
21
+ - **Optionals**: Use `?T` for values that can be null. Use `if (maybe_value) |value|` to unwrap.
22
+
23
+ ## 4. Documentation
24
+ - Use `///` for doc comments.
25
+ - Use `//!` for top-level module documentation.
26
+
27
+ *Source: [Zig Documentation](https://ziglang.org/documentation/master/)*
@@ -0,0 +1,336 @@
1
+ # Project Workflow
2
+
3
+ ## Guiding Principles
4
+
5
+ 1. **The Plan is the Source of Truth:** All work must be tracked in `plan.md`
6
+ 2. **The Tech Stack is Deliberate:** Changes to the tech stack must be documented in `tech-stack.md` *before* implementation
7
+ 3. **Test-Driven Development:** Write unit tests before implementing functionality
8
+ 4. **High Code Coverage:** Aim for >80% code coverage for all modules
9
+ 5. **User Experience First:** Every decision should prioritize user experience
10
+ 6. **Non-Interactive & CI-Aware:** Prefer non-interactive commands. Use `CI=true` for watch-mode tools (tests, linters) to ensure single execution.
11
+
12
+ ## Task Workflow
13
+
14
+ All tasks follow a strict lifecycle:
15
+
16
+ ### Standard Task Workflow
17
+
18
+ 1. **Select Task:** Choose the next available task from `plan.md` in sequential order
19
+
20
+ 2. **Mark In Progress:** Before beginning work, edit `plan.md` and change the task from `[ ]` to `[~]`
21
+
22
+ 3. **Write Failing Tests (Red Phase):**
23
+ - Create a new test file for the feature or bug fix.
24
+ - Write one or more unit tests that clearly define the expected behavior and acceptance criteria for the task.
25
+ - **CRITICAL:** Run the tests and confirm that they fail as expected. This is the "Red" phase of TDD. Do not proceed until you have failing tests.
26
+
27
+ 4. **Implement to Pass Tests (Green Phase):**
28
+ - Write the minimum amount of application code necessary to make the failing tests pass.
29
+ - Run the test suite again and confirm that all tests now pass. This is the "Green" phase.
30
+
31
+ 5. **Refactor (Optional but Recommended):**
32
+ - With the safety of passing tests, refactor the implementation code and the test code to improve clarity, remove duplication, and enhance performance without changing the external behavior.
33
+ - Rerun tests to ensure they still pass after refactoring.
34
+
35
+ 6. **Verify Coverage:** Run coverage reports using the project's chosen tools. For example, in a Python project, this might look like:
36
+ ```bash
37
+ pytest --cov=app --cov-report=html
38
+ ```
39
+ Target: >80% coverage for new code. The specific tools and commands will vary by language and framework.
40
+
41
+ 7. **Document Deviations:** If implementation differs from tech stack:
42
+ - **STOP** implementation
43
+ - Update `tech-stack.md` with new design
44
+ - Add dated note explaining the change
45
+ - Resume implementation
46
+
47
+ 8. **Commit Code Changes:**
48
+ - Stage all code changes related to the task.
49
+ - Propose a clear, concise commit message e.g, `feat(ui): Create basic HTML structure for calculator`.
50
+ - Perform the commit.
51
+
52
+ 9. **Attach Task Summary with Git Notes:**
53
+ - **Step 9.1: Get Commit Hash:** Obtain the hash of the *just-completed commit* (`git log -1 --format="%H"`).
54
+ - **Step 9.2: Draft Note Content:** Create a detailed summary for the completed task. This should include the task name, a summary of changes, a list of all created/modified files, and the core "why" for the change.
55
+ - **Step 9.3: Attach Note:** Use the `git notes` command to attach the summary to the commit.
56
+ ```bash
57
+ # The note content from the previous step is passed via the -m flag.
58
+ git notes add -m "<note content>" <commit_hash>
59
+ ```
60
+
61
+ 10. **Get and Record Task Commit SHA:**
62
+ - **Step 10.1: Update Plan:** Read `plan.md`, find the line for the completed task, update its status from `[~]` to `[x]`, and append the first 7 characters of the *just-completed commit's* commit hash.
63
+ - **Step 10.2: Write Plan:** Write the updated content back to `plan.md`.
64
+
65
+ 11. **Commit Plan Update:**
66
+ - **Action:** Stage the modified `plan.md` file.
67
+ - **Action:** Commit this change with a descriptive message (e.g., `cdd(plan): Mark task 'Create user model' as complete`).
68
+
69
+
70
+ ### Phase Completion Verification and Checkpointing Protocol
71
+
72
+ **Trigger:** This protocol is executed immediately after a task is completed that also concludes a phase in `plan.md`.
73
+
74
+ 1. **Announce Protocol Start:** Inform the user that the phase is complete and the verification and checkpointing protocol has begun.
75
+
76
+ 2. **Ensure Test Coverage for Phase Changes:**
77
+ - **Step 2.1: Determine Phase Scope:** To identify the files changed in this phase, you must first find the starting point. Read `plan.md` to find the Git commit SHA of the *previous* phase's checkpoint. If no previous checkpoint exists, the scope is all changes since the first commit.
78
+ - **Step 2.2: List Changed Files:** Execute `git diff --name-only <previous_checkpoint_sha> HEAD` to get a precise list of all files modified during this phase.
79
+ - **Step 2.3: Verify and Create Tests:** For each file in the list:
80
+ - **CRITICAL:** First, check its extension. Exclude non-code files (e.g., `.json`, `.md`, `.yaml`).
81
+ - For each remaining code file, verify a corresponding test file exists.
82
+ - If a test file is missing, you **must** create one. Before writing the test, **first, analyze other test files in the repository to determine the correct naming convention and testing style.** The new tests **must** validate the functionality described in this phase's tasks (`plan.md`).
83
+
84
+ 3. **Execute Automated Tests with Proactive Debugging:**
85
+ - Before execution, you **must** announce the exact shell command you will use to run the tests.
86
+ - **Example Announcement:** "I will now run the automated test suite to verify the phase. **Command:** `CI=true npm test`"
87
+ - Execute the announced command.
88
+ - If tests fail, you **must** inform the user and begin debugging. You may attempt to propose a fix a **maximum of two times**. If the tests still fail after your second proposed fix, you **must stop**, report the persistent failure, and ask the user for guidance.
89
+
90
+ 4. **Propose a Detailed, Actionable Manual Verification Plan:**
91
+ - **CRITICAL:** To generate the plan, first analyze `product.md`, `product-guidelines.md`, and `plan.md` to determine the user-facing goals of the completed phase.
92
+ - You **must** generate a step-by-step plan that walks the user through the verification process, including any necessary commands and specific, expected outcomes.
93
+ - The plan you present to the user **must** follow this format:
94
+
95
+ **For a Frontend Change:**
96
+ ```
97
+ The automated tests have passed. For manual verification, please follow these steps:
98
+
99
+ **Manual Verification Steps:**
100
+ 1. **Start the development server with the command:** `npm run dev`
101
+ 2. **Open your browser to:** `http://localhost:3000`
102
+ 3. **Confirm that you see:** The new user profile page, with the user's name and email displayed correctly.
103
+ ```
104
+
105
+ **For a Backend Change:**
106
+ ```
107
+ The automated tests have passed. For manual verification, please follow these steps:
108
+
109
+ **Manual Verification Steps:**
110
+ 1. **Ensure the server is running.**
111
+ 2. **Execute the following command in your terminal:** `curl -X POST http://localhost:8080/api/v1/users -d '{"name": "test"}'`
112
+ 3. **Confirm that you receive:** A JSON response with a status of `201 Created`.
113
+ ```
114
+
115
+ 5. **Await Explicit User Feedback:**
116
+ - After presenting the detailed plan, ask the user for confirmation: "**Does this meet your expectations? Please confirm with yes or provide feedback on what needs to be changed.**"
117
+ - **PAUSE** and await the user's response. Do not proceed without an explicit yes or confirmation.
118
+
119
+ 6. **Create Checkpoint Commit:**
120
+ - Stage all changes. If no changes occurred in this step, proceed with an empty commit.
121
+ - Perform the commit with a clear and concise message (e.g., `cdd(checkpoint): Checkpoint end of Phase X`).
122
+
123
+
124
+ 7. **Attach Auditable Verification Report using Git Notes:**
125
+ - **Step 7.1: Draft Note Content:** Create a detailed verification report including the automated test command, the manual verification steps, and the user's confirmation.
126
+ - **Step 7.2: Attach Note:** Use the `git notes` command and the full commit hash from the previous step to attach the full report to the checkpoint commit.
127
+
128
+ 8. **Get and Record Phase Checkpoint SHA:**
129
+ - **Step 8.1: Get Commit Hash:** Obtain the hash of the *just-created checkpoint commit* (`git log -1 --format="%H"`).
130
+ - **Step 8.2: Update Plan:** Read `plan.md`, find the heading for the completed phase, and append the first 7 characters of the commit hash in the format `[checkpoint: <sha>]`.
131
+ - **Step 8.3: Write Plan:** Write the updated content back to `plan.md`.
132
+
133
+ 9. **Commit Plan Update:**
134
+ - **Action:** Stage the modified `plan.md` file.
135
+ - **Action:** Commit this change with a descriptive message following the format `cdd(plan): Mark phase '<PHASE NAME>' as complete`.
136
+
137
+
138
+ 10. **Announce Completion:** Inform the user that the phase is complete and the checkpoint has been created, with the detailed verification report attached as a git note.
139
+
140
+ ### Quality Gates
141
+
142
+ Before marking any task complete, verify:
143
+
144
+ - [ ] All tests pass
145
+ - [ ] Code coverage meets requirements (>80%)
146
+ - [ ] Code follows project's code style guidelines (as defined in `code_styleguides/`)
147
+ - [ ] All public functions/methods are documented (e.g., docstrings, JSDoc, GoDoc)
148
+ - [ ] Type safety is enforced (e.g., type hints, TypeScript types, Go types)
149
+ - [ ] No linting or static analysis errors (using the project's configured tools)
150
+ - [ ] Works correctly on mobile (if applicable)
151
+ - [ ] Documentation updated if needed
152
+ - [ ] No security vulnerabilities introduced
153
+
154
+ ## Development Commands
155
+
156
+ **AI AGENT INSTRUCTION: This section should be adapted to the project's specific language, framework, and build tools.**
157
+
158
+ ### Setup
159
+ ```bash
160
+ # Example: Commands to set up the development environment (e.g., install dependencies, configure database)
161
+ # e.g., for a Node.js project: npm install
162
+ # e.g., for a Go project: go mod tidy
163
+ ```
164
+
165
+ ### Daily Development
166
+ ```bash
167
+ # Example: Commands for common daily tasks (e.g., start dev server, run tests, lint, format)
168
+ # e.g., for a Node.js project: npm run dev, npm test, npm run lint
169
+ # e.g., for a Go project: go run main.go, go test ./..., go fmt ./...
170
+ ```
171
+
172
+ ### Before Committing
173
+ ```bash
174
+ # Example: Commands to run all pre-commit checks (e.g., format, lint, type check, run tests)
175
+ # e.g., for a Node.js project: npm run check
176
+ # e.g., for a Go project: make check (if a Makefile exists)
177
+ ```
178
+
179
+ ## Testing Requirements
180
+
181
+ ### Unit Testing
182
+ - Every module must have corresponding tests.
183
+ - Use appropriate test setup/teardown mechanisms (e.g., fixtures, beforeEach/afterEach).
184
+ - Mock external dependencies.
185
+ - Test both success and failure cases.
186
+
187
+ ### Integration Testing
188
+ - Test complete user flows
189
+ - Verify database transactions
190
+ - Test authentication and authorization
191
+ - Check form submissions
192
+
193
+ ### Mobile Testing
194
+ - Test on actual iPhone when possible
195
+ - Use Safari developer tools
196
+ - Test touch interactions
197
+ - Verify responsive layouts
198
+ - Check performance on 3G/4G
199
+
200
+ ## Code Review Process
201
+
202
+ ### Self-Review Checklist
203
+ Before requesting review:
204
+
205
+ 1. **Functionality**
206
+ - Feature works as specified
207
+ - Edge cases handled
208
+ - Error messages are user-friendly
209
+
210
+ 2. **Code Quality**
211
+ - Follows style guide
212
+ - DRY principle applied
213
+ - Clear variable/function names
214
+ - Appropriate comments
215
+
216
+ 3. **Testing**
217
+ - Unit tests comprehensive
218
+ - Integration tests pass
219
+ - Coverage adequate (>80%)
220
+
221
+ 4. **Security**
222
+ - No hardcoded secrets
223
+ - Input validation present
224
+ - SQL injection prevented
225
+ - XSS protection in place
226
+
227
+ 5. **Performance**
228
+ - Database queries optimized
229
+ - Images optimized
230
+ - Caching implemented where needed
231
+
232
+ 6. **Mobile Experience**
233
+ - Touch targets adequate (44x44px)
234
+ - Text readable without zooming
235
+ - Performance acceptable on mobile
236
+ - Interactions feel native
237
+
238
+ ## Commit Guidelines
239
+
240
+ ### Message Format
241
+ ```
242
+ <type>(<scope>): <description>
243
+
244
+ [optional body]
245
+
246
+ [optional footer]
247
+ ```
248
+
249
+ ### Types
250
+ - `feat`: New feature
251
+ - `fix`: Bug fix
252
+ - `docs`: Documentation only
253
+ - `style`: Formatting, missing semicolons, etc.
254
+ - `refactor`: Code change that neither fixes a bug nor adds a feature
255
+ - `test`: Adding missing tests
256
+ - `chore`: Maintenance tasks
257
+
258
+ ### Examples
259
+ ```bash
260
+ git commit -m "feat(auth): Add remember me functionality"
261
+ git commit -m "fix(posts): Correct excerpt generation for short posts"
262
+ git commit -m "test(comments): Add tests for emoji reaction limits"
263
+ git commit -m "style(mobile): Improve button touch targets"
264
+ ```
265
+
266
+ ## Definition of Done
267
+
268
+ A task is complete when:
269
+
270
+ 1. All code implemented to specification
271
+ 2. Unit tests written and passing
272
+ 3. Code coverage meets project requirements
273
+ 4. Documentation complete (if applicable)
274
+ 5. Code passes all configured linting and static analysis checks
275
+ 6. Works beautifully on mobile (if applicable)
276
+ 7. Implementation notes added to `plan.md`
277
+ 8. Changes committed with proper message
278
+ 9. Git note with task summary attached to the commit
279
+
280
+ ## Emergency Procedures
281
+
282
+ ### Critical Bug in Production
283
+ 1. Create hotfix branch from main
284
+ 2. Write failing test for bug
285
+ 3. Implement minimal fix
286
+ 4. Test thoroughly including mobile
287
+ 5. Deploy immediately
288
+ 6. Document in plan.md
289
+
290
+ ### Data Loss
291
+ 1. Stop all write operations
292
+ 2. Restore from latest backup
293
+ 3. Verify data integrity
294
+ 4. Document incident
295
+ 5. Update backup procedures
296
+
297
+ ### Security Breach
298
+ 1. Rotate all secrets immediately
299
+ 2. Review access logs
300
+ 3. Patch vulnerability
301
+ 4. Notify affected users (if any)
302
+ 5. Document and update security procedures
303
+
304
+ ## Deployment Workflow
305
+
306
+ ### Pre-Deployment Checklist
307
+ - [ ] All tests passing
308
+ - [ ] Coverage >80%
309
+ - [ ] No linting errors
310
+ - [ ] Mobile testing complete
311
+ - [ ] Environment variables configured
312
+ - [ ] Database migrations ready
313
+ - [ ] Backup created
314
+
315
+ ### Deployment Steps
316
+ 1. Merge feature branch to main
317
+ 2. Tag release with version
318
+ 3. Push to deployment service
319
+ 4. Run database migrations
320
+ 5. Verify deployment
321
+ 6. Test critical paths
322
+ 7. Monitor for errors
323
+
324
+ ### Post-Deployment
325
+ 1. Monitor analytics
326
+ 2. Check error logs
327
+ 3. Gather user feedback
328
+ 4. Plan next iteration
329
+
330
+ ## Continuous Improvement
331
+
332
+ - Review workflow weekly
333
+ - Update based on pain points
334
+ - Document lessons learned
335
+ - Optimize for user happiness
336
+ - Keep things simple and maintainable
@@ -0,0 +1,54 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin/tool";
2
+ import { type PluginInput } from "@opencode-ai/plugin";
3
+ export interface BackgroundTask {
4
+ id: string;
5
+ sessionID: string;
6
+ parentSessionID: string;
7
+ parentMessageID?: string;
8
+ description: string;
9
+ prompt: string;
10
+ agent: string;
11
+ status: "running" | "completed" | "failed" | "cancelled";
12
+ startedAt: Date;
13
+ completedAt?: Date;
14
+ error?: string;
15
+ progress: {
16
+ toolCalls: number;
17
+ lastUpdate: Date;
18
+ };
19
+ }
20
+ export interface LaunchInput {
21
+ description: string;
22
+ prompt: string;
23
+ agent: string;
24
+ parentSessionID: string;
25
+ parentMessageID?: string;
26
+ }
27
+ export interface BackgroundTaskArgs {
28
+ description: string;
29
+ prompt: string;
30
+ agent: string;
31
+ }
32
+ export interface BackgroundOutputArgs {
33
+ task_id: string;
34
+ block?: boolean;
35
+ timeout?: number;
36
+ }
37
+ export declare class BackgroundManager {
38
+ private tasks;
39
+ private client;
40
+ private pollingInterval?;
41
+ constructor(ctx: PluginInput);
42
+ launch(input: LaunchInput): Promise<BackgroundTask>;
43
+ cancel(id: string): Promise<string>;
44
+ private pollRunningTasks;
45
+ private completeTask;
46
+ private notifyParentSession;
47
+ getTask(id: string): BackgroundTask | undefined;
48
+ private startPolling;
49
+ private stopPolling;
50
+ private hasRunningTasks;
51
+ }
52
+ export declare function createBackgroundTask(manager: BackgroundManager): ToolDefinition;
53
+ export declare function createBackgroundOutput(manager: BackgroundManager): ToolDefinition;
54
+ export declare function createBackgroundCancel(manager: BackgroundManager): ToolDefinition;