gibi-bot 1.0.0 → 1.1.1

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 (48) hide show
  1. package/.context.json +47 -3
  2. package/.github/workflows/npm-publish.yml +33 -0
  3. package/.github/workflows/release.yml +45 -0
  4. package/.husky/commit-msg +1 -0
  5. package/.husky/pre-commit +2 -0
  6. package/.prettierignore +3 -0
  7. package/.prettierrc +7 -0
  8. package/CHANGELOG.md +45 -0
  9. package/DISTRIBUTION.md +9 -1
  10. package/GEMINI.md +28 -9
  11. package/README.md +55 -28
  12. package/commitlint.config.js +3 -0
  13. package/conductor/code_styleguides/general.md +6 -1
  14. package/conductor/code_styleguides/ts.md +42 -35
  15. package/conductor/product-guidelines.md +16 -12
  16. package/conductor/product.md +12 -7
  17. package/conductor/setup_state.json +1 -1
  18. package/conductor/tech-stack.md +4 -1
  19. package/conductor/tracks/slack_bot_20260107/metadata.json +1 -1
  20. package/conductor/tracks/slack_bot_20260107/plan.md +6 -1
  21. package/conductor/tracks/slack_bot_20260107/spec.md +9 -6
  22. package/conductor/tracks.md +2 -1
  23. package/conductor/workflow.md +74 -53
  24. package/dist/agents.js +7 -10
  25. package/dist/agents.test.js +17 -12
  26. package/dist/app.js +212 -135
  27. package/dist/config.js +5 -5
  28. package/dist/context.js +4 -3
  29. package/dist/context.test.js +2 -4
  30. package/eslint.config.mjs +17 -0
  31. package/jest.config.js +4 -3
  32. package/nodemon.json +5 -9
  33. package/package.json +34 -4
  34. package/release.config.js +22 -0
  35. package/src/agents.test.ts +62 -57
  36. package/src/agents.ts +94 -82
  37. package/src/app.d.ts +1 -1
  38. package/src/app.ts +298 -178
  39. package/src/config.ts +48 -48
  40. package/src/context.test.ts +54 -56
  41. package/src/context.ts +123 -114
  42. package/test_gemini.js +13 -9
  43. package/test_gemini_approval.js +13 -9
  44. package/test_gemini_write.js +19 -9
  45. package/tests/context.test.ts +145 -0
  46. package/tsconfig.json +1 -1
  47. package/src/app.js +0 -55
  48. package/src/app.js.map +0 -1
@@ -3,50 +3,57 @@
3
3
  This document defines the coding standards and conventions for the Gibi project.
4
4
 
5
5
  ## 1. General Principles
6
- * **Strict Typing:** Always enable `"strict": true` in `tsconfig.json`. Avoid `any` whenever possible; use `unknown` if the type is truly uncertain and narrow it down.
7
- * **Immutability:** Prefer `const` over `let`. Never use `var`.
8
- * **Functional Style:** Prefer pure functions and immutable data structures where feasible.
9
- * **Clarity:** Code should be self-documenting. Use descriptive variable and function names.
6
+
7
+ - **Strict Typing:** Always enable `"strict": true` in `tsconfig.json`. Avoid `any` whenever possible; use `unknown` if the type is truly uncertain and narrow it down.
8
+ - **Immutability:** Prefer `const` over `let`. Never use `var`.
9
+ - **Functional Style:** Prefer pure functions and immutable data structures where feasible.
10
+ - **Clarity:** Code should be self-documenting. Use descriptive variable and function names.
10
11
 
11
12
  ## 2. Naming Conventions
12
- * **Files & Directories:** Use `kebab-case` (e.g., `user-profile.ts`, `event-handlers/`).
13
- * **Variables & Functions:** Use `camelCase` (e.g., `fetchUserData`, `isReady`).
14
- * **Classes & Interfaces:** Use `PascalCase` (e.g., `UserProfile`, `slackClient`).
15
- * **Constants:**
16
- * Global/Exported constants: `UPPER_SNAKE_CASE` (e.g., `MAX_RETRY_COUNT`).
17
- * Local constants: `camelCase`.
18
- * **Types:** Use `PascalCase`. Suffix with `Type` if aliasing a primitive or union (e.g., `UserIdType`), but prefer interfaces for objects.
19
- * **Interfaces:** Use `PascalCase`. Do **not** prefix with `I` (e.g., use `User` instead of `IUser`).
13
+
14
+ - **Files & Directories:** Use `kebab-case` (e.g., `user-profile.ts`, `event-handlers/`).
15
+ - **Variables & Functions:** Use `camelCase` (e.g., `fetchUserData`, `isReady`).
16
+ - **Classes & Interfaces:** Use `PascalCase` (e.g., `UserProfile`, `slackClient`).
17
+ - **Constants:**
18
+ - Global/Exported constants: `UPPER_SNAKE_CASE` (e.g., `MAX_RETRY_COUNT`).
19
+ - Local constants: `camelCase`.
20
+ - **Types:** Use `PascalCase`. Suffix with `Type` if aliasing a primitive or union (e.g., `UserIdType`), but prefer interfaces for objects.
21
+ - **Interfaces:** Use `PascalCase`. Do **not** prefix with `I` (e.g., use `User` instead of `IUser`).
20
22
 
21
23
  ## 3. Formatting
22
- * **Indentation:** 2 spaces.
23
- * **Quotes:** Single quotes `'` for strings, backticks `` ` `` for template literals. Avoid double quotes `"` unless escaping is otherwise required.
24
- * **Semicolons:** Always use semicolons.
25
- * **Trailing Commas:** Enable trailing commas where valid (ES5+).
26
- * **Braces:** "One True Brace Style" (opening brace on the same line).
24
+
25
+ - **Indentation:** 2 spaces.
26
+ - **Quotes:** Single quotes `'` for strings, backticks `` ` `` for template literals. Avoid double quotes `"` unless escaping is otherwise required.
27
+ - **Semicolons:** Always use semicolons.
28
+ - **Trailing Commas:** Enable trailing commas where valid (ES5+).
29
+ - **Braces:** "One True Brace Style" (opening brace on the same line).
27
30
 
28
31
  ## 4. TypeScript Specifics
29
- * **Interfaces vs Types:** Prefer `interface` for defining public API shapes and object structures. Use `type` for unions, intersections, and primitives.
30
- * **Visibility:** Explicitly define `private`, `protected`, and `public` for class members.
31
- * **Async/Await:** Prefer `async`/`await` syntax over `.then()` chains for readability.
32
- * **Null/Undefined:** Use optional chaining (`?.`) and nullish coalescing (`??`) operators. Avoid explicit `null` checks when possible.
32
+
33
+ - **Interfaces vs Types:** Prefer `interface` for defining public API shapes and object structures. Use `type` for unions, intersections, and primitives.
34
+ - **Visibility:** Explicitly define `private`, `protected`, and `public` for class members.
35
+ - **Async/Await:** Prefer `async`/`await` syntax over `.then()` chains for readability.
36
+ - **Null/Undefined:** Use optional chaining (`?.`) and nullish coalescing (`??`) operators. Avoid explicit `null` checks when possible.
33
37
 
34
38
  ## 5. Slack Bolt Patterns
35
- * **Listeners:** Group related listeners in dedicated modules/directories (e.g., `src/listeners/messages/`).
36
- * **Typed Context:** Use Bolt's generics to type arguments in listeners:
37
- ```typescript
38
- app.message('ping', async ({ message, say }: { message: GenericMessageEvent; say: SayFn }) => { ... });
39
- ```
40
- * **Error Handling:** All async listeners must catch errors or bubble them up to a global error handler.
39
+
40
+ - **Listeners:** Group related listeners in dedicated modules/directories (e.g., `src/listeners/messages/`).
41
+ - **Typed Context:** Use Bolt's generics to type arguments in listeners:
42
+ ```typescript
43
+ app.message('ping', async ({ message, say }: { message: GenericMessageEvent; say: SayFn }) => { ... });
44
+ ```
45
+ - **Error Handling:** All async listeners must catch errors or bubble them up to a global error handler.
41
46
 
42
47
  ## 6. Testing
43
- * Write unit tests for logic-heavy functions.
44
- * Mock external dependencies (Slack API calls) using standard mocking libraries.
45
- * Test files should be named `*.test.ts` or `*.spec.ts` and reside next to the source file or in a `tests/` directory.
48
+
49
+ - Write unit tests for logic-heavy functions.
50
+ - Mock external dependencies (Slack API calls) using standard mocking libraries.
51
+ - Test files should be named `*.test.ts` or `*.spec.ts` and reside next to the source file or in a `tests/` directory.
46
52
 
47
53
  ## 7. Imports
48
- * Group imports:
49
- 1. Node.js built-ins.
50
- 2. External dependencies (node_modules).
51
- 3. Internal modules (relative paths).
52
- * Avoid circular dependencies.
54
+
55
+ - Group imports:
56
+ 1. Node.js built-ins.
57
+ 2. External dependencies (node_modules).
58
+ 3. Internal modules (relative paths).
59
+ - Avoid circular dependencies.
@@ -1,28 +1,32 @@
1
1
  # Product Guidelines: Gibi
2
2
 
3
3
  ## Persona & Tone
4
- Gibi is designed to be a **Friendly & Helpful** "personal code monkey." The bot's personality should be approachable and proactive, using a conversational tone that makes complex AI interactions feel accessible.
5
4
 
6
- * **Tone:** Conversational, supportive, and efficient.
7
- * **Personality:** Enthusiastic about helping with code, yet reliable and professional in its execution.
8
- * **Voice:** Proactive—offering tips, clear status updates, and helpful suggestions when appropriate.
5
+ Gibi is designed to be a **Friendly & Helpful** "personal code monkey." The bot's personality should be approachable and proactive, using a conversational tone that makes complex AI interactions feel accessible.
6
+
7
+ - **Tone:** Conversational, supportive, and efficient.
8
+ - **Personality:** Enthusiastic about helping with code, yet reliable and professional in its execution.
9
+ - **Voice:** Proactive—offering tips, clear status updates, and helpful suggestions when appropriate.
9
10
 
10
11
  ## Visual Identity & Branding
12
+
11
13
  Gibi embraces a **Character-Driven** brand identity in Slack.
12
14
 
13
- * **Avatar:** A distinct and friendly monkey-themed icon.
14
- * **Visual Language:** Lighthearted use of monkey-themed emojis or subtle puns where appropriate to maintain a unique and recognizable personality.
15
- * **Formatting:** Leverages standard Slack UI components while maintaining a clean, developer-friendly look.
15
+ - **Avatar:** A distinct and friendly monkey-themed icon.
16
+ - **Visual Language:** Lighthearted use of monkey-themed emojis or subtle puns where appropriate to maintain a unique and recognizable personality.
17
+ - **Formatting:** Leverages standard Slack UI components while maintaining a clean, developer-friendly look.
16
18
 
17
19
  ## Interaction Design
20
+
18
21
  Interaction with Gibi should prioritize ease of use and clarity, minimizing the friction of managing AI agents.
19
22
 
20
- * **Clarity First:** All messages must be easy to scan. Use clear headings, bullet points, and properly formatted code blocks.
21
- * **Interactive Elements:** Heavily utilize Slack buttons, menus, and modals. The goal is to allow users to trigger agents, approve plans, and make selections with minimal typing.
22
- * **Progress Updates:** Provide **Incremental Status Updates**. Long-running tasks should use message threading or frequent, concise updates (e.g., "Analyzing codebase...", "Drafting plan...") to keep the user informed of specific steps.
23
+ - **Clarity First:** All messages must be easy to scan. Use clear headings, bullet points, and properly formatted code blocks.
24
+ - **Interactive Elements:** Heavily utilize Slack buttons, menus, and modals. The goal is to allow users to trigger agents, approve plans, and make selections with minimal typing.
25
+ - **Progress Updates:** Provide **Incremental Status Updates**. Long-running tasks should use message threading or frequent, concise updates (e.g., "Analyzing codebase...", "Drafting plan...") to keep the user informed of specific steps.
23
26
 
24
27
  ## Error Handling & Support
28
+
25
29
  When things go wrong, Gibi remains helpful rather than just technical.
26
30
 
27
- * **User-Friendly & Actionable:** Instead of raw stack traces, explain errors in plain English.
28
- * **Next Steps:** Every error message should suggest a clear path forward or provide options for the user to retry or adjust the task.
31
+ - **User-Friendly & Actionable:** Instead of raw stack traces, explain errors in plain English.
32
+ - **Next Steps:** Every error message should suggest a clear path forward or provide options for the user to retry or adjust the task.
@@ -1,20 +1,25 @@
1
1
  # Product Guide: Gibi
2
2
 
3
3
  ## Initial Concept
4
+
4
5
  **Gibi** is a personal "code monkey" designed to bring the power of autonomous AI coding agents out of the terminal and into a collaborative environment, specifically Slack, without compromising the security and control of local execution. It allows users to chat with a bot to trigger and manage various AI agents that perform coding tasks.
5
6
 
6
7
  ## Target Users
7
- * **Individual Developers:** Programmers seeking to automate repetitive coding tasks and leverage AI assistance for debugging and code generation.
8
- * **Development Teams:** Groups looking for a shared, accessible AI assistant to facilitate code reviews, boilerplate generation, and collaborative problem-solving.
8
+
9
+ - **Individual Developers:** Programmers seeking to automate repetitive coding tasks and leverage AI assistance for debugging and code generation.
10
+ - **Development Teams:** Groups looking for a shared, accessible AI assistant to facilitate code reviews, boilerplate generation, and collaborative problem-solving.
9
11
 
10
12
  ## Core Features
11
- * **Slack Bot Interface:** A user-friendly chat interface that serves as the primary command center. Users can trigger agents, monitor progress, and receive results directly within Slack conversations.
12
- * **Multi-Agent Support:** A flexible architecture that supports multiple specialized agents (e.g., refactoring, documentation, bug fixing). Users can select the appropriate agent for their specific task.
13
- * **Local Execution:** A key differentiator is "freeing the coding agents from the terminal without throwing them into the cloud." Gibi runs agents in a controlled, local environment (or user-managed server), ensuring code privacy and avoiding full reliance on cloud-hosted SaaS execution environments.
13
+
14
+ - **Slack Bot Interface:** A user-friendly chat interface that serves as the primary command center. Users can trigger agents, monitor progress, and receive results directly within Slack conversations.
15
+ - **Multi-Agent Support:** A flexible architecture that supports multiple specialized agents (e.g., refactoring, documentation, bug fixing). Users can select the appropriate agent for their specific task.
16
+ - **Local Execution:** A key differentiator is "freeing the coding agents from the terminal without throwing them into the cloud." Gibi runs agents in a controlled, local environment (or user-managed server), ensuring code privacy and avoiding full reliance on cloud-hosted SaaS execution environments.
14
17
 
15
18
  ## Primary Goals
16
- * **Increase Developer Velocity:** By offloading repetitive and time-consuming tasks to AI agents, developers can focus on high-leverage architectural and creative work.
17
- * **Improve Code Quality:** Utilizing specialized agents helps ensure consistent coding styles, comprehensive documentation, and proactive bug detection, leading to a more robust codebase.
19
+
20
+ - **Increase Developer Velocity:** By offloading repetitive and time-consuming tasks to AI agents, developers can focus on high-leverage architectural and creative work.
21
+ - **Improve Code Quality:** Utilizing specialized agents helps ensure consistent coding styles, comprehensive documentation, and proactive bug detection, leading to a more robust codebase.
18
22
 
19
23
  ## Vision
24
+
20
25
  To democratize access to powerful local AI coding agents by providing a familiar, chat-based interface. Gibi aims to bridge the gap between CLI-based AI tools and team collaboration platforms, ensuring data stays local while making advanced automation accessible to everyone on the team.
@@ -1 +1 @@
1
- {"last_successful_step": "3.3_initial_track_generated"}
1
+ { "last_successful_step": "3.3_initial_track_generated" }
@@ -1,15 +1,18 @@
1
1
  # Technology Stack
2
2
 
3
3
  ## Core Language & Runtime
4
+
4
5
  - **Language:** TypeScript
5
6
  - **Runtime:** Node.js (Latest LTS recommended)
6
7
 
7
8
  ## Frameworks & Libraries
9
+
8
10
  - **Slack Framework:** @slack/bolt (Official Slack framework for building apps)
9
11
  - **Configuration:** dotenv (Environment variable management)
10
12
 
11
13
  ## Development Tools
14
+
12
15
  - **Build/Transpilation:** TypeScript (`tsc`)
13
16
  - **Execution:** `ts-node` (for development) or `node` (production build)
14
17
  - **Linting/Formatting:** ESLint, Prettier (Recommended)
15
- - **Testing:** Jest or Mocha (To be determined)
18
+ - **Testing:** Jest or Mocha (To be determined)
@@ -5,4 +5,4 @@
5
5
  "created_at": "2026-01-07T12:00:00Z",
6
6
  "updated_at": "2026-01-07T12:10:00Z",
7
7
  "description": "Initialize the TypeScript project and create a basic Slack bot using @slack/bolt."
8
- }
8
+ }
@@ -1,26 +1,31 @@
1
1
  # Track Plan: Initialize Slack Bot (TypeScript)
2
2
 
3
3
  ## Goal
4
+
4
5
  Initialize the project as a TypeScript application and implement a basic "ping-pong" Slack bot using the `@slack/bolt` framework.
5
6
 
6
7
  ## Steps
7
8
 
8
9
  ### 1. Project Initialization
10
+
9
11
  - [x] Initialize `package.json` (`npm init -y`). [3538e0d]
10
12
  - [x] Install dependencies: `typescript`, `ts-node`, `@slack/bolt`, `dotenv`. [3538e0d]
11
13
  - [x] Install dev dependencies: `@types/node`. [3538e0d]
12
14
  - [x] Initialize `tsconfig.json`. [3538e0d]
13
15
 
14
16
  ### 2. Basic Configuration
17
+
15
18
  - [x] Create `.env` file (and add to `.gitignore`). [52ef449]
16
19
  - [x] Create `src/` directory. [52ef449]
17
20
 
18
21
  ### 3. Bot Implementation
22
+
19
23
  - [x] Create `src/app.ts` as the main entry point. [8cefef6]
20
24
  - [x] Initialize `App` from `@slack/bolt`. [8cefef6]
21
25
  - [x] Implement a simple message listener for "ping" that responds with "pong". [8cefef6]
22
26
  - [x] Add start script to `package.json`. [8cefef6]
23
27
 
24
28
  ### 4. Verification
29
+
25
30
  - [x] Verify compilation (`tsc`). [Verified]
26
- - [x] Verify execution (`npm start`). [Verified]
31
+ - [x] Verify execution (`npm start`). [Verified]
@@ -1,18 +1,21 @@
1
1
  # Feature Spec: Basic Slack Bot (TS)
2
2
 
3
3
  ## Overview
4
+
4
5
  A simple Slack bot built with TypeScript and Bolt that proves connectivity.
5
6
 
6
7
  ## Requirements
8
+
7
9
  1. **Language:** TypeScript.
8
10
  2. **Framework:** `@slack/bolt`.
9
11
  3. **Commands:**
10
- - When a user types "ping" in a channel the bot is in, it should reply "pong".
12
+ - When a user types "ping" in a channel the bot is in, it should reply "pong".
11
13
  4. **Configuration:**
12
- - `SLACK_BOT_TOKEN`
13
- - `SLACK_SIGNING_SECRET`
14
- - `SLACK_APP_TOKEN` (if using Socket Mode, which is recommended for local dev).
14
+ - `SLACK_BOT_TOKEN`
15
+ - `SLACK_SIGNING_SECRET`
16
+ - `SLACK_APP_TOKEN` (if using Socket Mode, which is recommended for local dev).
15
17
 
16
18
  ## Implementation Details
17
- - Entry point: `src/app.ts`.
18
- - Use Socket Mode for easier local development (requires `SLACK_APP_TOKEN`).
19
+
20
+ - Entry point: `src/app.ts`.
21
+ - Use Socket Mode for easier local development (requires `SLACK_APP_TOKEN`).
@@ -5,4 +5,5 @@ This file tracks all major tracks for the project. Each track has its own detail
5
5
  ---
6
6
 
7
7
  ## [x] Track: Initialize TypeScript project and create a basic Slack bot
8
- *Link: [./conductor/tracks/slack_bot_20260107/](./conductor/tracks/slack_bot_20260107/)*
8
+
9
+ _Link: [./conductor/tracks/slack_bot_20260107/](./conductor/tracks/slack_bot_20260107/)_
@@ -3,7 +3,7 @@
3
3
  ## Guiding Principles
4
4
 
5
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
6
+ 2. **The Tech Stack is Deliberate:** Changes to the tech stack must be documented in `tech-stack.md` _before_ implementation
7
7
  3. **Test-Driven Development:** Write unit tests before implementing functionality
8
8
  4. **High Code Coverage:** Aim for >80% code coverage for all modules
9
9
  5. **User Experience First:** Every decision should prioritize user experience
@@ -33,9 +33,11 @@ All tasks follow a strict lifecycle:
33
33
  - Rerun tests to ensure they still pass after refactoring.
34
34
 
35
35
  6. **Verify Coverage:** Run coverage reports using the project's chosen tools. For example, in a Python project, this might look like:
36
+
36
37
  ```bash
37
38
  pytest --cov=app --cov-report=html
38
39
  ```
40
+
39
41
  Target: >80% coverage for new code. The specific tools and commands will vary by language and framework.
40
42
 
41
43
  7. **Document Deviations:** If implementation differs from tech stack:
@@ -55,16 +57,17 @@ All tasks follow a strict lifecycle:
55
57
  - Perform the commit.
56
58
 
57
59
  10. **Attach Task Summary with Git Notes:**
58
- - **Step 10.1: Get Commit Hash:** Obtain the hash of the *just-completed commit* (`git log -1 --format="%H"`).
59
- - **Step 10.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.
60
- - **Step 10.3: Attach Note:** Use the `git notes` command to attach the summary to the commit.
61
- ```bash
62
- # The note content from the previous step is passed via the -m flag.
63
- git notes add -m "<note content>" <commit_hash>
64
- ```
60
+
61
+ - **Step 10.1: Get Commit Hash:** Obtain the hash of the _just-completed commit_ (`git log -1 --format="%H"`).
62
+ - **Step 10.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.
63
+ - **Step 10.3: Attach Note:** Use the `git notes` command to attach the summary to the commit.
64
+ ```bash
65
+ # The note content from the previous step is passed via the -m flag.
66
+ git notes add -m "<note content>" <commit_hash>
67
+ ```
65
68
 
66
69
  11. **Get and Record Task Commit SHA:**
67
- - **Step 11.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.
70
+ - **Step 11.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.
68
71
  - **Step 11.2: Write Plan:** Write the updated content back to `plan.md`.
69
72
 
70
73
  12. **Commit Plan Update:**
@@ -78,66 +81,68 @@ All tasks follow a strict lifecycle:
78
81
  1. **Announce Protocol Start:** Inform the user that the phase is complete and the verification and checkpointing protocol has begun.
79
82
 
80
83
  2. **Ensure Test Coverage for Phase Changes:**
81
- - **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.
82
- - **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.
83
- - **Step 2.3: Verify and Create Tests:** For each file in the list:
84
- - **CRITICAL:** First, check its extension. Exclude non-code files (e.g., `.json`, `.md`, `.yaml`).
85
- - For each remaining code file, verify a corresponding test file exists.
86
- - 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`).
84
+ - **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.
85
+ - **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.
86
+ - **Step 2.3: Verify and Create Tests:** For each file in the list:
87
+ - **CRITICAL:** First, check its extension. Exclude non-code files (e.g., `.json`, `.md`, `.yaml`).
88
+ - For each remaining code file, verify a corresponding test file exists.
89
+ - 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`).
87
90
 
88
91
  3. **Execute Automated Tests with Proactive Debugging:**
89
- - Before execution, you **must** announce the exact shell command you will use to run the tests.
90
- - **Example Announcement:** "I will now run the automated test suite to verify the phase. **Command:** `CI=true npm test`"
91
- - Execute the announced command.
92
- - 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.
92
+ - Before execution, you **must** announce the exact shell command you will use to run the tests.
93
+ - **Example Announcement:** "I will now run the automated test suite to verify the phase. **Command:** `CI=true npm test`"
94
+ - Execute the announced command.
95
+ - 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.
93
96
 
94
97
  4. **Propose a Detailed, Actionable Manual Verification Plan:**
95
- - **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.
96
- - You **must** generate a step-by-step plan that walks the user through the verification process, including any necessary commands and specific, expected outcomes.
97
- - The plan you present to the user **must** follow this format:
98
-
99
- **For a Frontend Change:**
100
- ```
101
- The automated tests have passed. For manual verification, please follow these steps:
102
-
103
- **Manual Verification Steps:**
104
- 1. **Start the development server with the command:** `npm run dev`
105
- 2. **Open your browser to:** `http://localhost:3000`
106
- 3. **Confirm that you see:** The new user profile page, with the user's name and email displayed correctly.
107
- ```
108
-
109
- **For a Backend Change:**
110
- ```
111
- The automated tests have passed. For manual verification, please follow these steps:
112
-
113
- **Manual Verification Steps:**
114
- 1. **Ensure the server is running.**
115
- 2. **Execute the following command in your terminal:** `curl -X POST http://localhost:8080/api/v1/users -d '{"name": "test"}'`
116
- 3. **Confirm that you receive:** A JSON response with a status of `201 Created`.
117
- ```
98
+ - **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.
99
+ - You **must** generate a step-by-step plan that walks the user through the verification process, including any necessary commands and specific, expected outcomes.
100
+ - The plan you present to the user **must** follow this format:
101
+
102
+ **For a Frontend Change:**
103
+
104
+ ```
105
+ The automated tests have passed. For manual verification, please follow these steps:
106
+
107
+ **Manual Verification Steps:**
108
+ 1. **Start the development server with the command:** `npm run dev`
109
+ 2. **Open your browser to:** `http://localhost:3000`
110
+ 3. **Confirm that you see:** The new user profile page, with the user's name and email displayed correctly.
111
+ ```
112
+
113
+ **For a Backend Change:**
114
+
115
+ ```
116
+ The automated tests have passed. For manual verification, please follow these steps:
117
+
118
+ **Manual Verification Steps:**
119
+ 1. **Ensure the server is running.**
120
+ 2. **Execute the following command in your terminal:** `curl -X POST http://localhost:8080/api/v1/users -d '{"name": "test"}'`
121
+ 3. **Confirm that you receive:** A JSON response with a status of `201 Created`.
122
+ ```
118
123
 
119
124
  5. **Await Explicit User Feedback:**
120
- - 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.**"
121
- - **PAUSE** and await the user's response. Do not proceed without an explicit yes or confirmation.
125
+ - 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.**"
126
+ - **PAUSE** and await the user's response. Do not proceed without an explicit yes or confirmation.
122
127
 
123
128
  6. **Create Checkpoint Commit:**
124
- - Stage all changes. If no changes occurred in this step, proceed with an empty commit.
125
- - Perform the commit with a clear and concise message (e.g., `conductor(checkpoint): Checkpoint end of Phase X`).
129
+ - Stage all changes. If no changes occurred in this step, proceed with an empty commit.
130
+ - Perform the commit with a clear and concise message (e.g., `conductor(checkpoint): Checkpoint end of Phase X`).
126
131
 
127
132
  7. **Attach Auditable Verification Report using Git Notes:**
128
- - **Step 8.1: Draft Note Content:** Create a detailed verification report including the automated test command, the manual verification steps, and the user's confirmation.
129
- - **Step 8.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.
133
+ - **Step 8.1: Draft Note Content:** Create a detailed verification report including the automated test command, the manual verification steps, and the user's confirmation.
134
+ - **Step 8.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.
130
135
 
131
136
  8. **Get and Record Phase Checkpoint SHA:**
132
- - **Step 7.1: Get Commit Hash:** Obtain the hash of the *just-created checkpoint commit* (`git log -1 --format="%H"`).
133
- - **Step 7.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>]`.
134
- - **Step 7.3: Write Plan:** Write the updated content back to `plan.md`.
137
+ - **Step 7.1: Get Commit Hash:** Obtain the hash of the _just-created checkpoint commit_ (`git log -1 --format="%H"`).
138
+ - **Step 7.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>]`.
139
+ - **Step 7.3: Write Plan:** Write the updated content back to `plan.md`.
135
140
 
136
- 9. **Commit Plan Update:**
141
+ 9. **Commit Plan Update:**
137
142
  - **Action:** Stage the modified `plan.md` file.
138
143
  - **Action:** Commit this change with a descriptive message following the format `conductor(plan): Mark phase '<PHASE NAME>' as complete`.
139
144
 
140
- 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.
145
+ 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.
141
146
 
142
147
  ### Quality Gates
143
148
 
@@ -158,6 +163,7 @@ Before marking any task complete, verify:
158
163
  **AI AGENT INSTRUCTION: This section should be adapted to the project's specific language, framework, and build tools.**
159
164
 
160
165
  ### Setup
166
+
161
167
  ```bash
162
168
  # Example: Commands to set up the development environment (e.g., install dependencies, configure database)
163
169
  # e.g., for a Node.js project: npm install
@@ -165,6 +171,7 @@ Before marking any task complete, verify:
165
171
  ```
166
172
 
167
173
  ### Daily Development
174
+
168
175
  ```bash
169
176
  # Example: Commands for common daily tasks (e.g., start dev server, run tests, lint, format)
170
177
  # e.g., for a Node.js project: npm run dev, npm test, npm run lint
@@ -172,6 +179,7 @@ Before marking any task complete, verify:
172
179
  ```
173
180
 
174
181
  ### Before Committing
182
+
175
183
  ```bash
176
184
  # Example: Commands to run all pre-commit checks (e.g., format, lint, type check, run tests)
177
185
  # e.g., for a Node.js project: npm run check
@@ -181,18 +189,21 @@ Before marking any task complete, verify:
181
189
  ## Testing Requirements
182
190
 
183
191
  ### Unit Testing
192
+
184
193
  - Every module must have corresponding tests.
185
194
  - Use appropriate test setup/teardown mechanisms (e.g., fixtures, beforeEach/afterEach).
186
195
  - Mock external dependencies.
187
196
  - Test both success and failure cases.
188
197
 
189
198
  ### Integration Testing
199
+
190
200
  - Test complete user flows
191
201
  - Verify database transactions
192
202
  - Test authentication and authorization
193
203
  - Check form submissions
194
204
 
195
205
  ### Mobile Testing
206
+
196
207
  - Test on actual iPhone when possible
197
208
  - Use Safari developer tools
198
209
  - Test touch interactions
@@ -202,6 +213,7 @@ Before marking any task complete, verify:
202
213
  ## Code Review Process
203
214
 
204
215
  ### Self-Review Checklist
216
+
205
217
  Before requesting review:
206
218
 
207
219
  1. **Functionality**
@@ -240,6 +252,7 @@ Before requesting review:
240
252
  ## Commit Guidelines
241
253
 
242
254
  ### Message Format
255
+
243
256
  ```
244
257
  <type>(<scope>): <description>
245
258
 
@@ -249,6 +262,7 @@ Before requesting review:
249
262
  ```
250
263
 
251
264
  ### Types
265
+
252
266
  - `feat`: New feature
253
267
  - `fix`: Bug fix
254
268
  - `docs`: Documentation only
@@ -258,6 +272,7 @@ Before requesting review:
258
272
  - `chore`: Maintenance tasks
259
273
 
260
274
  ### Examples
275
+
261
276
  ```bash
262
277
  git commit -m "feat(auth): Add remember me functionality"
263
278
  git commit -m "fix(posts): Correct excerpt generation for short posts"
@@ -282,6 +297,7 @@ A task is complete when:
282
297
  ## Emergency Procedures
283
298
 
284
299
  ### Critical Bug in Production
300
+
285
301
  1. Create hotfix branch from main
286
302
  2. Write failing test for bug
287
303
  3. Implement minimal fix
@@ -290,6 +306,7 @@ A task is complete when:
290
306
  6. Document in plan.md
291
307
 
292
308
  ### Data Loss
309
+
293
310
  1. Stop all write operations
294
311
  2. Restore from latest backup
295
312
  3. Verify data integrity
@@ -297,6 +314,7 @@ A task is complete when:
297
314
  5. Update backup procedures
298
315
 
299
316
  ### Security Breach
317
+
300
318
  1. Rotate all secrets immediately
301
319
  2. Review access logs
302
320
  3. Patch vulnerability
@@ -306,6 +324,7 @@ A task is complete when:
306
324
  ## Deployment Workflow
307
325
 
308
326
  ### Pre-Deployment Checklist
327
+
309
328
  - [ ] All tests passing
310
329
  - [ ] Coverage >80%
311
330
  - [ ] No linting errors
@@ -315,6 +334,7 @@ A task is complete when:
315
334
  - [ ] Backup created
316
335
 
317
336
  ### Deployment Steps
337
+
318
338
  1. Merge feature branch to main
319
339
  2. Tag release with version
320
340
  3. Push to deployment service
@@ -324,6 +344,7 @@ A task is complete when:
324
344
  7. Monitor for errors
325
345
 
326
346
  ### Post-Deployment
347
+
327
348
  1. Monitor analytics
328
349
  2. Check error logs
329
350
  3. Gather user feedback
package/dist/agents.js CHANGED
@@ -7,9 +7,8 @@ class GeminiAgent {
7
7
  name = 'gemini';
8
8
  async run(messages, options = {}) {
9
9
  const { model, mode } = options;
10
- let prompt = messages
11
- .map((m) => `${m.role === 'user' ? 'User' : 'Assistant'}: ${m.content}`)
12
- .join('\n') + '\nAssistant:';
10
+ let prompt = messages.map((m) => `${m.role === 'user' ? 'User' : 'Assistant'}: ${m.content}`).join('\n') +
11
+ '\nAssistant:';
13
12
  if (mode === 'plan') {
14
13
  prompt = `${prompts_1.PLAN_MODE_PROMPT}\n\n${prompt}`;
15
14
  }
@@ -52,14 +51,13 @@ class ClaudeAgent extends GeminiAgent {
52
51
  // Basic implementation for Claude - similar structure, different CLI
53
52
  // Assuming 'claude' CLI accepts similar prompt structure or just a string
54
53
  const { mode } = options;
55
- let prompt = messages
56
- .map((m) => `${m.role === 'user' ? 'User' : 'Assistant'}: ${m.content}`)
57
- .join('\n') + '\nAssistant:';
54
+ let prompt = messages.map((m) => `${m.role === 'user' ? 'User' : 'Assistant'}: ${m.content}`).join('\n') +
55
+ '\nAssistant:';
58
56
  if (mode === 'plan') {
59
57
  prompt = `${prompts_1.PLAN_MODE_PROMPT}\n\n${prompt}`;
60
58
  }
61
59
  const args = [prompt];
62
- // Add specific arguments if Claude CLI requires them, e.g. -p or similar.
60
+ // Add specific arguments if Claude CLI requires them, e.g. -p or similar.
63
61
  // logic here assumes usage: claude "prompt"
64
62
  console.log(`[ClaudeAgent] Spawning claude with args length: ${args.length}`);
65
63
  return this.spawnProcess('claude', args);
@@ -70,9 +68,8 @@ class CursorAgent extends GeminiAgent {
70
68
  name = 'cursor';
71
69
  async run(messages, options = {}) {
72
70
  const { mode } = options;
73
- let prompt = messages
74
- .map((m) => `${m.role === 'user' ? 'User' : 'Assistant'}: ${m.content}`)
75
- .join('\n') + '\nAssistant:';
71
+ let prompt = messages.map((m) => `${m.role === 'user' ? 'User' : 'Assistant'}: ${m.content}`).join('\n') +
72
+ '\nAssistant:';
76
73
  if (mode === 'plan') {
77
74
  prompt = `${prompts_1.PLAN_MODE_PROMPT}\n\n${prompt}`;
78
75
  }