@2amtech/hai 0.0.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 (239) hide show
  1. package/README.md +212 -0
  2. package/dist/ai/agent-info.d.ts +1 -0
  3. package/dist/ai/agent-info.js +42 -0
  4. package/dist/ai/agent-info.js.map +1 -0
  5. package/dist/ai/agents/architect.d.ts +3 -0
  6. package/dist/ai/agents/architect.js +107 -0
  7. package/dist/ai/agents/architect.js.map +1 -0
  8. package/dist/ai/agents/backend-dev.d.ts +3 -0
  9. package/dist/ai/agents/backend-dev.js +33 -0
  10. package/dist/ai/agents/backend-dev.js.map +1 -0
  11. package/dist/ai/agents/frontend-dev.d.ts +3 -0
  12. package/dist/ai/agents/frontend-dev.js +31 -0
  13. package/dist/ai/agents/frontend-dev.js.map +1 -0
  14. package/dist/ai/agents/index.d.ts +3 -0
  15. package/dist/ai/agents/index.js +17 -0
  16. package/dist/ai/agents/index.js.map +1 -0
  17. package/dist/ai/agents/refactorer.d.ts +3 -0
  18. package/dist/ai/agents/refactorer.js +38 -0
  19. package/dist/ai/agents/refactorer.js.map +1 -0
  20. package/dist/ai/agents/researcher.d.ts +3 -0
  21. package/dist/ai/agents/researcher.js +28 -0
  22. package/dist/ai/agents/researcher.js.map +1 -0
  23. package/dist/ai/agents/security-reviewer.d.ts +3 -0
  24. package/dist/ai/agents/security-reviewer.js +99 -0
  25. package/dist/ai/agents/security-reviewer.js.map +1 -0
  26. package/dist/ai/agents/types.d.ts +6 -0
  27. package/dist/ai/agents/types.js +2 -0
  28. package/dist/ai/agents/types.js.map +1 -0
  29. package/dist/ai/agents/verifier.d.ts +3 -0
  30. package/dist/ai/agents/verifier.js +28 -0
  31. package/dist/ai/agents/verifier.js.map +1 -0
  32. package/dist/ai/prompts/document.d.ts +3 -0
  33. package/dist/ai/prompts/document.js +57 -0
  34. package/dist/ai/prompts/document.js.map +1 -0
  35. package/dist/ai/prompts/implement.d.ts +3 -0
  36. package/dist/ai/prompts/implement.js +128 -0
  37. package/dist/ai/prompts/implement.js.map +1 -0
  38. package/dist/ai/prompts/index.d.ts +3 -0
  39. package/dist/ai/prompts/index.js +17 -0
  40. package/dist/ai/prompts/index.js.map +1 -0
  41. package/dist/ai/prompts/optimize-ai.d.ts +3 -0
  42. package/dist/ai/prompts/optimize-ai.js +104 -0
  43. package/dist/ai/prompts/optimize-ai.js.map +1 -0
  44. package/dist/ai/prompts/pull-specs.d.ts +3 -0
  45. package/dist/ai/prompts/pull-specs.js +10 -0
  46. package/dist/ai/prompts/pull-specs.js.map +1 -0
  47. package/dist/ai/prompts/pull-tickets.d.ts +3 -0
  48. package/dist/ai/prompts/pull-tickets.js +11 -0
  49. package/dist/ai/prompts/pull-tickets.js.map +1 -0
  50. package/dist/ai/prompts/pull.d.ts +3 -0
  51. package/dist/ai/prompts/pull.js +9 -0
  52. package/dist/ai/prompts/pull.js.map +1 -0
  53. package/dist/ai/prompts/review-changes.d.ts +3 -0
  54. package/dist/ai/prompts/review-changes.js +88 -0
  55. package/dist/ai/prompts/review-changes.js.map +1 -0
  56. package/dist/ai/prompts/types.d.ts +6 -0
  57. package/dist/ai/prompts/types.js +2 -0
  58. package/dist/ai/prompts/types.js.map +1 -0
  59. package/dist/app.d.ts +14 -0
  60. package/dist/app.js +40 -0
  61. package/dist/app.js.map +1 -0
  62. package/dist/cli.d.ts +2 -0
  63. package/dist/cli.js +79 -0
  64. package/dist/cli.js.map +1 -0
  65. package/dist/commands/get.d.ts +8 -0
  66. package/dist/commands/get.js +73 -0
  67. package/dist/commands/get.js.map +1 -0
  68. package/dist/commands/init.d.ts +3 -0
  69. package/dist/commands/init.js +113 -0
  70. package/dist/commands/init.js.map +1 -0
  71. package/dist/commands/mcp/helpers.d.ts +15 -0
  72. package/dist/commands/mcp/helpers.js +21 -0
  73. package/dist/commands/mcp/helpers.js.map +1 -0
  74. package/dist/commands/mcp/pull.d.ts +3 -0
  75. package/dist/commands/mcp/pull.js +85 -0
  76. package/dist/commands/mcp/pull.js.map +1 -0
  77. package/dist/commands/mcp/server.d.ts +2 -0
  78. package/dist/commands/mcp/server.js +80 -0
  79. package/dist/commands/mcp/server.js.map +1 -0
  80. package/dist/commands/mcp/specs.d.ts +2 -0
  81. package/dist/commands/mcp/specs.js +325 -0
  82. package/dist/commands/mcp/specs.js.map +1 -0
  83. package/dist/commands/mcp/tickets.d.ts +3 -0
  84. package/dist/commands/mcp/tickets.js +77 -0
  85. package/dist/commands/mcp/tickets.js.map +1 -0
  86. package/dist/commands/pull.d.ts +10 -0
  87. package/dist/commands/pull.js +61 -0
  88. package/dist/commands/pull.js.map +1 -0
  89. package/dist/commands/status.d.ts +2 -0
  90. package/dist/commands/status.js +102 -0
  91. package/dist/commands/status.js.map +1 -0
  92. package/dist/components/ticket-renderer.d.ts +5 -0
  93. package/dist/components/ticket-renderer.js +89 -0
  94. package/dist/components/ticket-renderer.js.map +1 -0
  95. package/dist/contexts/config-context.d.ts +17 -0
  96. package/dist/contexts/config-context.js +77 -0
  97. package/dist/contexts/config-context.js.map +1 -0
  98. package/dist/contexts/error-context.d.ts +12 -0
  99. package/dist/contexts/error-context.js +28 -0
  100. package/dist/contexts/error-context.js.map +1 -0
  101. package/dist/helpers/config.d.ts +4 -0
  102. package/dist/helpers/config.js +29 -0
  103. package/dist/helpers/config.js.map +1 -0
  104. package/dist/helpers/fs.d.ts +8 -0
  105. package/dist/helpers/fs.js +83 -0
  106. package/dist/helpers/fs.js.map +1 -0
  107. package/dist/helpers/init.d.ts +2 -0
  108. package/dist/helpers/init.js +18 -0
  109. package/dist/helpers/init.js.map +1 -0
  110. package/dist/helpers/preflight.d.ts +8 -0
  111. package/dist/helpers/preflight.js +77 -0
  112. package/dist/helpers/preflight.js.map +1 -0
  113. package/dist/helpers/pull.d.ts +9 -0
  114. package/dist/helpers/pull.js +79 -0
  115. package/dist/helpers/pull.js.map +1 -0
  116. package/dist/helpers/symlink.d.ts +9 -0
  117. package/dist/helpers/symlink.js +104 -0
  118. package/dist/helpers/symlink.js.map +1 -0
  119. package/dist/helpers/tickets.d.ts +4 -0
  120. package/dist/helpers/tickets.js +56 -0
  121. package/dist/helpers/tickets.js.map +1 -0
  122. package/dist/hooks/use-async.d.ts +6 -0
  123. package/dist/hooks/use-async.js +37 -0
  124. package/dist/hooks/use-async.js.map +1 -0
  125. package/dist/plugins/atlassian/adf-to-markdown.d.ts +11 -0
  126. package/dist/plugins/atlassian/adf-to-markdown.js +121 -0
  127. package/dist/plugins/atlassian/adf-to-markdown.js.map +1 -0
  128. package/dist/plugins/atlassian/auth-step.d.ts +10 -0
  129. package/dist/plugins/atlassian/auth-step.js +59 -0
  130. package/dist/plugins/atlassian/auth-step.js.map +1 -0
  131. package/dist/plugins/atlassian/confluence-client.d.ts +24 -0
  132. package/dist/plugins/atlassian/confluence-client.js +250 -0
  133. package/dist/plugins/atlassian/confluence-client.js.map +1 -0
  134. package/dist/plugins/atlassian/data.d.ts +18 -0
  135. package/dist/plugins/atlassian/data.js +12 -0
  136. package/dist/plugins/atlassian/data.js.map +1 -0
  137. package/dist/plugins/atlassian/index.d.ts +2 -0
  138. package/dist/plugins/atlassian/index.js +57 -0
  139. package/dist/plugins/atlassian/index.js.map +1 -0
  140. package/dist/plugins/atlassian/init-step.d.ts +11 -0
  141. package/dist/plugins/atlassian/init-step.js +54 -0
  142. package/dist/plugins/atlassian/init-step.js.map +1 -0
  143. package/dist/plugins/atlassian/jira-client.d.ts +38 -0
  144. package/dist/plugins/atlassian/jira-client.js +308 -0
  145. package/dist/plugins/atlassian/jira-client.js.map +1 -0
  146. package/dist/plugins/atlassian/specs-step.d.ts +13 -0
  147. package/dist/plugins/atlassian/specs-step.js +71 -0
  148. package/dist/plugins/atlassian/specs-step.js.map +1 -0
  149. package/dist/plugins/atlassian/tickets-step.d.ts +8 -0
  150. package/dist/plugins/atlassian/tickets-step.js +45 -0
  151. package/dist/plugins/atlassian/tickets-step.js.map +1 -0
  152. package/dist/plugins/claude-code/agents.d.ts +4 -0
  153. package/dist/plugins/claude-code/agents.js +56 -0
  154. package/dist/plugins/claude-code/agents.js.map +1 -0
  155. package/dist/plugins/claude-code/commands.d.ts +4 -0
  156. package/dist/plugins/claude-code/commands.js +54 -0
  157. package/dist/plugins/claude-code/commands.js.map +1 -0
  158. package/dist/plugins/claude-code/index.d.ts +2 -0
  159. package/dist/plugins/claude-code/index.js +57 -0
  160. package/dist/plugins/claude-code/index.js.map +1 -0
  161. package/dist/plugins/cursor/index.d.ts +2 -0
  162. package/dist/plugins/cursor/index.js +60 -0
  163. package/dist/plugins/cursor/index.js.map +1 -0
  164. package/dist/plugins/index.d.ts +1 -0
  165. package/dist/plugins/index.js +16 -0
  166. package/dist/plugins/index.js.map +1 -0
  167. package/dist/plugins/local/index.d.ts +2 -0
  168. package/dist/plugins/local/index.js +53 -0
  169. package/dist/plugins/local/index.js.map +1 -0
  170. package/dist/plugins/local/init-step.d.ts +9 -0
  171. package/dist/plugins/local/init-step.js +24 -0
  172. package/dist/plugins/local/init-step.js.map +1 -0
  173. package/dist/plugins/local/local-spec-provider.d.ts +9 -0
  174. package/dist/plugins/local/local-spec-provider.js +66 -0
  175. package/dist/plugins/local/local-spec-provider.js.map +1 -0
  176. package/dist/plugins/local/local-ticket-provider.d.ts +24 -0
  177. package/dist/plugins/local/local-ticket-provider.js +89 -0
  178. package/dist/plugins/local/local-ticket-provider.js.map +1 -0
  179. package/dist/plugins/none/index.d.ts +2 -0
  180. package/dist/plugins/none/index.js +78 -0
  181. package/dist/plugins/none/index.js.map +1 -0
  182. package/dist/plugins/other-ai/index.d.ts +2 -0
  183. package/dist/plugins/other-ai/index.js +48 -0
  184. package/dist/plugins/other-ai/index.js.map +1 -0
  185. package/dist/plugins/registry.d.ts +4 -0
  186. package/dist/plugins/registry.js +18 -0
  187. package/dist/plugins/registry.js.map +1 -0
  188. package/dist/plugins/resolve.d.ts +8 -0
  189. package/dist/plugins/resolve.js +23 -0
  190. package/dist/plugins/resolve.js.map +1 -0
  191. package/dist/plugins/types.d.ts +36 -0
  192. package/dist/plugins/types.js +2 -0
  193. package/dist/plugins/types.js.map +1 -0
  194. package/dist/plugins/vscode-copilot/agents.d.ts +4 -0
  195. package/dist/plugins/vscode-copilot/agents.js +51 -0
  196. package/dist/plugins/vscode-copilot/agents.js.map +1 -0
  197. package/dist/plugins/vscode-copilot/index.d.ts +2 -0
  198. package/dist/plugins/vscode-copilot/index.js +59 -0
  199. package/dist/plugins/vscode-copilot/index.js.map +1 -0
  200. package/dist/plugins/vscode-copilot/prompts.d.ts +4 -0
  201. package/dist/plugins/vscode-copilot/prompts.js +60 -0
  202. package/dist/plugins/vscode-copilot/prompts.js.map +1 -0
  203. package/dist/schemas/config.d.ts +24 -0
  204. package/dist/schemas/config.js +38 -0
  205. package/dist/schemas/config.js.map +1 -0
  206. package/dist/types.d.ts +84 -0
  207. package/dist/types.js +2 -0
  208. package/dist/types.js.map +1 -0
  209. package/dist/ui/confirm.d.ts +7 -0
  210. package/dist/ui/confirm.js +19 -0
  211. package/dist/ui/confirm.js.map +1 -0
  212. package/dist/ui/error-display.d.ts +6 -0
  213. package/dist/ui/error-display.js +23 -0
  214. package/dist/ui/error-display.js.map +1 -0
  215. package/dist/ui/masked-input.d.ts +9 -0
  216. package/dist/ui/masked-input.js +25 -0
  217. package/dist/ui/masked-input.js.map +1 -0
  218. package/dist/ui/multi-select.d.ts +13 -0
  219. package/dist/ui/multi-select.js +127 -0
  220. package/dist/ui/multi-select.js.map +1 -0
  221. package/dist/ui/select-input.d.ts +12 -0
  222. package/dist/ui/select-input.js +81 -0
  223. package/dist/ui/select-input.js.map +1 -0
  224. package/dist/ui/spinner.d.ts +6 -0
  225. package/dist/ui/spinner.js +18 -0
  226. package/dist/ui/spinner.js.map +1 -0
  227. package/dist/ui/text-input.d.ts +9 -0
  228. package/dist/ui/text-input.js +23 -0
  229. package/dist/ui/text-input.js.map +1 -0
  230. package/dist/wizard/passthrough-step.d.ts +6 -0
  231. package/dist/wizard/passthrough-step.js +8 -0
  232. package/dist/wizard/passthrough-step.js.map +1 -0
  233. package/dist/wizard/plugin-select-step.d.ts +10 -0
  234. package/dist/wizard/plugin-select-step.js +31 -0
  235. package/dist/wizard/plugin-select-step.js.map +1 -0
  236. package/dist/wizard/summary-step.d.ts +2 -0
  237. package/dist/wizard/summary-step.js +97 -0
  238. package/dist/wizard/summary-step.js.map +1 -0
  239. package/package.json +79 -0
package/README.md ADDED
@@ -0,0 +1,212 @@
1
+ # hai-cli
2
+
3
+ A TypeScript CLI that bridges ticket management, specification systems, and AI tools. hai syncs tickets and specs from platforms like Jira and Confluence to a local `.ai/` directory and exposes them via an [MCP](https://modelcontextprotocol.io/) server so AI coding assistants can access project context natively.
4
+
5
+ ## Features
6
+
7
+ - **Ticket sync** — pull active and completed tickets from Jira (or other providers) into `.ai/tickets/`
8
+ - **Spec sync** — pull Confluence pages (or other sources) into `.ai/specs/`
9
+ - **MCP server** — expose tickets and specs as tools over stdio for AI assistants like Claude Code and GitHub Copilot
10
+ - **Plugin architecture** — add new integrations without touching core code
11
+ - **Interactive setup** — guided wizard for first-time configuration
12
+
13
+ ## Quick start
14
+
15
+ ```bash
16
+ # Install dependencies
17
+ npm install
18
+
19
+ npm run install-cli # Installs hai globally
20
+
21
+ hai init
22
+ ```
23
+
24
+ ## Commands
25
+
26
+ | Command | Description |
27
+ | --------------- | --------------------------------------------------------- |
28
+ | `hai init` | Interactive setup wizard — select plugins, enter creds |
29
+ | `hai configure` | Update existing credentials and settings |
30
+ | `hai pull` | Sync tickets and specs to the `.ai/` directory |
31
+ | `hai status` | Show current contents of `.ai/` |
32
+ | `hai get <KEY>` | Fetch a specific ticket (`--recursive` for linked issues) |
33
+ | `hai mcp` | Start MCP server over stdio |
34
+
35
+ ## Project structure
36
+
37
+ ```
38
+ source/
39
+ ├── cli.tsx # Entry point (meow CLI setup)
40
+ ├── app.tsx # Command router
41
+ ├── types.ts # Core domain types (Ticket, SpecPage, providers)
42
+ ├── commands/ # Command implementations
43
+ │ ├── init.tsx # hai init
44
+ │ ├── configure.tsx # hai configure
45
+ │ ├── pull.tsx # hai pull
46
+ │ ├── status.tsx # hai status
47
+ │ ├── get.tsx # hai get
48
+ │ └── mcp/ # MCP server (runs outside Ink, raw stdio)
49
+ ├── plugins/ # Plugin system
50
+ │ ├── types.ts # HaiPlugin interface
51
+ │ ├── registry.ts # Plugin registration and lookup
52
+ │ ├── resolve.ts # Provider resolution from config
53
+ │ ├── atlassian/ # Jira + Confluence provider
54
+ │ ├── claude-code/ # Claude Code AI provider
55
+ │ ├── vscode-copilot/ # GitHub Copilot AI provider
56
+ │ ├── local/ # Local provider
57
+ │ ├── none/ # No-op provider
58
+ │ └── other-ai/ # Generic AI provider
59
+ ├── wizard/ # Wizard step components
60
+ ├── ui/ # Reusable UI components (select, text-input, spinner)
61
+ ├── components/ # Business logic (sync-engine, spec-engine)
62
+ ├── hooks/ # React hooks (use-config, use-async)
63
+ ├── helpers/ # Utilities (config I/O, preflight checks, fs helpers)
64
+ └── schemas/ # Zod config schema
65
+ ```
66
+
67
+ ## Development
68
+
69
+ ### Prerequisites
70
+
71
+ - Node.js >= 16
72
+ - npm
73
+
74
+ ### Build and run
75
+
76
+ ```bash
77
+ npm run build # Compile TypeScript to dist/
78
+ npm run dev # Watch mode — recompiles on change
79
+ npm run cli # Build and run in one step
80
+ npm test # Run Prettier check + XO lint + AVA tests
81
+ npm run format # Auto-format with Prettier
82
+ ```
83
+
84
+ ### Tech stack
85
+
86
+ - **TypeScript 5** — strict mode, ESM-only (`"type": "module"`)
87
+ - **Ink 4** — React 18 for terminal UIs
88
+ - **Meow** — CLI argument parsing
89
+ - **Zod 4** — runtime config validation
90
+
91
+ ### Code conventions
92
+
93
+ - **Indentation**: tabs (see `.editorconfig`)
94
+ - **Imports**: use `.js` extensions in all relative imports (ESM requirement)
95
+ - **Types**: use the `type` keyword for type-only imports (`import type {Foo} from ...`)
96
+ - **Props**: define inline with `type Props = { ... }` — no `interface`, no `prop-types`
97
+ - **Components**: default exports for page-level, named exports for UI components
98
+ - **Formatting**: Prettier via `@vdemedes/prettier-config` (tabs, single quotes, trailing commas)
99
+
100
+ ## Adding a plugin
101
+
102
+ Plugins let you integrate new ticket sources, spec providers, or AI tools. Each plugin implements the `HaiPlugin` interface.
103
+
104
+ ### 1. Create the plugin directory
105
+
106
+ ```
107
+ source/plugins/my-plugin/
108
+ ├── index.ts # Plugin definition (exports the HaiPlugin object)
109
+ └── provider.ts # Provider implementation(s)
110
+ ```
111
+
112
+ ### 2. Implement the `HaiPlugin` interface
113
+
114
+ ```typescript
115
+ import type {ComponentType} from 'react';
116
+ import type {HaiPlugin, CapabilityType, PluginData} from '../types.js';
117
+
118
+ export const myPlugin: HaiPlugin = {
119
+ id: 'my-plugin',
120
+ name: 'My Plugin',
121
+
122
+ getCapabilities(): CapabilityType[] {
123
+ // Declare what this plugin provides: 'tickets', 'specs', 'ai', or any combination
124
+ return ['tickets'];
125
+ },
126
+
127
+ // React component rendered during `hai init` to collect user config
128
+ InitStep: ({capability, existingData, onComplete}) => {
129
+ // Collect credentials or settings, then call:
130
+ // onComplete({ host: '...', token: '...' })
131
+ },
132
+
133
+ createProvider(capability, data) {
134
+ // Return a TicketProvider, SpecProvider, or AiProvider
135
+ // based on the requested capability
136
+ return new MyTicketProvider(data);
137
+ },
138
+
139
+ // Optional: return project keys for ticket syncing
140
+ getTicketProjects(data) {
141
+ return data.projects as string[];
142
+ },
143
+
144
+ // Optional: return a human-readable summary for the wizard
145
+ summarize(capability, data) {
146
+ return `My Plugin (${(data as {host: string}).host})`;
147
+ },
148
+ };
149
+ ```
150
+
151
+ A plugin can provide one or more capabilities:
152
+
153
+ | Capability | Provider interface | Purpose |
154
+ | ---------- | ------------------ | ----------------------------- |
155
+ | `tickets` | `TicketProvider` | Fetch and sync tickets |
156
+ | `specs` | `SpecProvider` | Fetch and sync spec pages |
157
+ | `ai` | `AiProvider` | Install AI tool configuration |
158
+
159
+ See [source/types.ts](source/types.ts) for the full provider interfaces.
160
+
161
+ ### 3. Register the plugin
162
+
163
+ Add your plugin to [source/plugins/index.ts](source/plugins/index.ts):
164
+
165
+ ```typescript
166
+ import {myPlugin} from './my-plugin/index.js';
167
+
168
+ registerPlugin(myPlugin);
169
+ ```
170
+
171
+ That's it. The plugin will now appear in the `hai init` wizard and be available for configuration.
172
+
173
+ ### Configuration
174
+
175
+ Plugin configuration is stored in `hai.json` at the project root (gitignored). Each entry specifies the plugin ID, the capabilities it provides, and any plugin-specific fields collected during init:
176
+
177
+ ```json
178
+ {
179
+ "plugins": [
180
+ {
181
+ "plugin": "my-plugin",
182
+ "provides": ["tickets"],
183
+ "host": "https://my-service.example.com",
184
+ "token": "..."
185
+ }
186
+ ]
187
+ }
188
+ ```
189
+
190
+ ## Data flow
191
+
192
+ 1. **Init** — the wizard collects plugin configs and writes `hai.json`
193
+ 2. **Pull** — reads config, resolves providers, syncs tickets/specs to `.ai/`
194
+ 3. **MCP** — reads config, starts a stdio server, exposes ticket and spec tools to AI assistants
195
+
196
+ ## License
197
+
198
+ ```
199
+ Copyright 2026 2am.tech
200
+
201
+ Licensed under the Apache License, Version 2.0 (the "License");
202
+ you may not use this file except in compliance with the License.
203
+ You may obtain a copy of the License at
204
+
205
+ http://www.apache.org/licenses/LICENSE-2.0
206
+
207
+ Unless required by applicable law or agreed to in writing, software
208
+ distributed under the License is distributed on an "AS IS" BASIS,
209
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
210
+ See the License for the specific language governing permissions and
211
+ limitations under the License.
212
+ ```
@@ -0,0 +1 @@
1
+ export declare function generateAgentInfo(): string;
@@ -0,0 +1,42 @@
1
+ export function generateAgentInfo() {
2
+ return `# .ai — Project Context
3
+
4
+ This directory is managed by **hai** and provides AI-readable context for the project.
5
+ It is gitignored and should not be committed.
6
+
7
+ ## Tickets (\`.ai/tickets/\`)
8
+
9
+ This folder contains markdown files synced from the project's ticket tracker (e.g. Jira).
10
+ Each file represents a work item and includes:
11
+
12
+ - **Key** — the ticket identifier (e.g. \`PROJ-123\`)
13
+ - **Summary** — short description of the work
14
+ - **Status** — current workflow state (e.g. To Do, In Progress, Done)
15
+ - **Priority** — urgency level
16
+ - **Description** — full details of the requirement or bug
17
+ - **Comments** — discussion thread from team members
18
+ - **Links** — related tickets (blockers, subtasks, etc.)
19
+
20
+ Files are organized by project: \`.ai/tickets/<PROJECT>/<KEY>.md\`.
21
+
22
+ When implementing a ticket, read the corresponding file to understand the requirements.
23
+ Use linked tickets for additional context.
24
+
25
+ ## Specs (\`.ai/specs/\`)
26
+
27
+ This folder contains markdown files synced from the project's specification system.
28
+ Each file represents a documentation page and includes:
29
+
30
+ - **Title** — the page title
31
+ - **Last updated** — when the spec was last modified
32
+ - **Body** — the full specification content in markdown
33
+
34
+ Files are organized by space and may be nested following the original page hierarchy.
35
+
36
+ Specs provide design context, architecture decisions, and detailed requirements
37
+ that complement the tickets.
38
+
39
+ IMPORTANT: Review and reference them when planning implementations.
40
+ `;
41
+ }
42
+ //# sourceMappingURL=agent-info.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-info.js","sourceRoot":"","sources":["../../source/ai/agent-info.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB;IAChC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCP,CAAC;AACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from './types.js';
2
+ declare const architect: AgentDefinition;
3
+ export default architect;
@@ -0,0 +1,107 @@
1
+ const architect = {
2
+ name: 'architect',
3
+ description: 'Software architect agent for designing detailed implementation plans. Uses spec files and researcher findings to produce holistic task files with full vertical coverage. Does NOT write code — only plans.',
4
+ shortDescription: 'Design implementation plans from specs and tickets',
5
+ body: `# Architect Agent
6
+
7
+ You are a very meticulous software architect agent for this project. Your sole job is to produce **detailed implementation plan** for the implementation from one or more specified tickets. You NEVER write code — only plan.
8
+
9
+ ## Inputs
10
+
11
+ You work with exactly two sources of information:
12
+
13
+ 1. **Spec files** (\`.ai/specs\` and \`.ai/specification-index.md\`) — the source of truth for product behavior. Always read \`.ai/specification-index.md\` first.
14
+ 2. **Researcher findings** — use the \`researcher\` subagent to gather codebase context, existing tasks, decisions, and implementation details you need.
15
+
16
+ ## Workflow
17
+
18
+ ### Step 1: Understand the Request
19
+
20
+ Read the user's request. Identify which spec file(s) are relevant. If the user didn't specify spec files, read \`.ai/specification-index.md\` and ask which spec(s) to use.
21
+
22
+ ### Step 2: Research
23
+
24
+ Spawn a **researcher** subagent to gather all necessary context:
25
+ - Read ALL specified AND relevant spec file(s) thoroughly.
26
+ - Read any provided ticket files, decisions, or code that inform the plan.
27
+ - Return a summary of: current task numbering, spec contents, relevant existing work, architecture/package map, and any gaps or ambiguities.
28
+
29
+ ### Step 3: Deep Clarification — ALWAYS ASK
30
+
31
+ > **NON-NEGOTIABLE: You MUST ask the user questions extensively before writing any plan.**
32
+ > Never assume. Never guess. Never fill in gaps yourself. If there is ANY ambiguity, ANY choice to be made, ANY edge case not fully specified — ASK THE USER.
33
+
34
+ Regardless of task complexity, **always** go through a thorough clarification phase. Your goal is to eliminate every ambiguity before writing a single line of the plan.
35
+
36
+ **What to ask about — go through ALL of these categories systematically:**
37
+
38
+ 1. **Scope & boundaries**: What's in scope vs out of scope? Which layers are affected?
39
+ 2. **Design decisions**: When there are multiple valid approaches, present 2–4 concrete options with pros/cons for each. Never pick one silently.
40
+ 3. **Data model & API shape**: How should data be structured? What fields, types, endpoints? Present alternatives when the spec doesn't fully prescribe them.
41
+ 4. **UI/UX behavior**: Exact interaction flows, loading states, error states, empty states. What happens on edge cases?
42
+ 5. **Edge cases & error handling**: What happens when things go wrong? Invalid input, network errors, concurrent access, empty data?
43
+ 6. **Integration points**: How does this feature connect with existing features? Are there ordering dependencies?
44
+ 7. **Spec ambiguities**: Anything the researcher flagged as unclear or underspecified.
45
+ 8. **Performance & limits**: Any size limits, pagination needs, caching strategies?
46
+ 9. **Migration & backwards compatibility**: Does this change existing behavior? How to handle existing data?
47
+
48
+ **How to ask:**
49
+ - Provide clear, specific options — not vague "what do you think?" questions. Each option should be a concrete, implementable choice.
50
+ - After each round of answers, assess whether more questions are needed. Keep asking until you have zero remaining ambiguities.
51
+ - **Multiple rounds are expected and encouraged.** Do NOT rush to writing the plan.
52
+
53
+ **When code context is needed to ask better questions:**
54
+ - Spawn a **researcher** subagent to investigate the current codebase (existing types, function signatures, component structure, API patterns) so your questions reference real code, not hypotheticals.
55
+ - Example: before asking "should we add a new field to X?", have the researcher find what X currently looks like so you can present the exact struct/interface in your question.
56
+
57
+ ### Step 4: Write the Plan
58
+
59
+ Produce task files following the **four-section format** exactly:
60
+
61
+ #### Section 1: Specifications
62
+ List all spec files related to the task with linked references:
63
+ \`\`\`
64
+ ## Specifications
65
+
66
+ - [04-requests](.ai/specs/04-requests.md)
67
+ - [05-scripting-runtime](.ai/spec/05-scripting-runtime.md)
68
+ \`\`\`
69
+
70
+ #### Section 2: Plan
71
+ Comprehensive prose description organized by **feature slice, NOT technology layer**. Cover:
72
+ - Overall approach, rationale, and constraints
73
+ - Key decisions and their rationale
74
+ - File paths, package names, function signatures where known
75
+ - Dependencies between slices
76
+
77
+ #### Section 3: Tasks
78
+ Detailed \`- [ ]\` checklist items grouped under \`###\` sub-headers by feature concern:
79
+ - Each item is a single, independently implementable unit
80
+ - Items reference specific technology, packages, file paths, function names
81
+ - Ordered by dependency — foundational work first
82
+ - Follow all naming and structure conventions from specifications.
83
+
84
+ #### Section 4: Verification
85
+ For each task group, write specific verification steps:
86
+ - State that a **verifier** subagent must perform verification
87
+ - The verifier has NO memory — provide full file paths and concrete checks
88
+ - Include a final checklist item to mark all tasks \`[x]\` after verification
89
+
90
+ ## Plan Quality Checklist
91
+
92
+ Before finalizing, verify your plan meets these criteria:
93
+
94
+ - [ ] Every task item is actionable by a developer without needing to make design decisions
95
+ - [ ] File paths and function names are specific, not vague
96
+ - [ ] No task item combines work across unrelated concerns
97
+ - [ ] Dependencies between items are clear from ordering and grouping
98
+ - [ ] Edge cases from the spec are covered as specific task items
99
+ - [ ] Verification steps are concrete and testable
100
+
101
+ ## Key Locations
102
+
103
+ - **Specs:** \`.ai/specs/\` (start with \`.ai/specification-index.md\`)
104
+ - **Tickets:** \`.ai/tickets/\` (start with \`.ai/ticket-index.md\`)`,
105
+ };
106
+ export default architect;
107
+ //# sourceMappingURL=architect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"architect.js","sourceRoot":"","sources":["../../../source/ai/agents/architect.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAoB;IAClC,IAAI,EAAE,WAAW;IACjB,WAAW,EACV,6MAA6M;IAC9M,gBAAgB,EAAE,oDAAoD;IACtE,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEAmG8D;CACpE,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from './types.js';
2
+ declare const backendDev: AgentDefinition;
3
+ export default backendDev;
@@ -0,0 +1,33 @@
1
+ const backendDev = {
2
+ name: 'backend-dev',
3
+ description: 'Backend development agent for implementing backend tasks. Use when backend task or part of the task needs to be implemented. Knows the layered architecture, package structure, and backend code style rules.',
4
+ shortDescription: 'Implement backend tasks',
5
+ body: `# Backend Development Agent
6
+
7
+ You are a senior backend development agent for this project. You produce clean and well architected code following the
8
+ established layers for this project.
9
+
10
+ Do not assume knowledge, ask user clarifying questions if there is missing information during implementation.
11
+
12
+ ## Before Starting
13
+
14
+ 1. **Spawn a \`researcher\` subagent first** to explore the codebase and understand the code you need to change. Provide the researcher with:
15
+ - The task items you've been assigned
16
+ - The spec file paths
17
+ - Ask it to find the exact files and functions you'll need to modify, their current implementations, related patterns in the codebase, and any relevant types or interfaces.
18
+ 2. Read the relevant spec files in \`.ai/specs\` for the feature you're implementing.
19
+
20
+ ## Code Standards
21
+
22
+ Follow coding standards, outlined in \`.ai/specs\` for the feature you're implementing.
23
+
24
+ ## Build & Test Commands
25
+
26
+ Follow build commands specified in the project.
27
+
28
+ ## After Implementation
29
+
30
+ Report back the full list of files you created or modified, a summary of what was implemented for each task item, and a list of all decisions recorded.`,
31
+ };
32
+ export default backendDev;
33
+ //# sourceMappingURL=backend-dev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-dev.js","sourceRoot":"","sources":["../../../source/ai/agents/backend-dev.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAoB;IACnC,IAAI,EAAE,aAAa;IACnB,WAAW,EACV,+MAA+M;IAChN,gBAAgB,EAAE,yBAAyB;IAC3C,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;wJAyBiJ;CACvJ,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from './types.js';
2
+ declare const frontendDev: AgentDefinition;
3
+ export default frontendDev;
@@ -0,0 +1,31 @@
1
+ const frontendDev = {
2
+ name: 'frontend-dev',
3
+ description: 'Frontend development agent for implementing UI tasks. Use when task requires frontend work. Knows the component architecture, state management patterns, and frontend code style rules.',
4
+ shortDescription: 'Implement frontend and UI tasks',
5
+ body: `# Frontend Development Agent
6
+
7
+ You are a senior frontend development agent for this project. You follow clean design and proper and clean component
8
+ design and separation of concerns in components.
9
+
10
+ ## Before Starting
11
+
12
+ 1. **Spawn a \`researcher\` subagent first** to explore the codebase and understand the code you need to change. Provide the researcher with:
13
+ - The task items you've been assigned
14
+ - The spec file paths
15
+ - Ask it to find the exact files and components you'll need to modify, their current implementations, related patterns in the codebase, and any relevant types or hooks.
16
+ 2. Read the relevant spec files in \`.ai/specs\` for the feature you're implementing.
17
+
18
+ ## Code Standards
19
+
20
+ Follow coding standards, outlined in \`.ai/specs\` for the feature you're implementing.
21
+
22
+ ## Build & Lint Commands
23
+
24
+ Follow build commands specified in the project.
25
+
26
+ ## After Implementation
27
+
28
+ Report back the full list of files you created or modified, a summary of what was implemented for each task item, and a list of all decisions recorded.`,
29
+ };
30
+ export default frontendDev;
31
+ //# sourceMappingURL=frontend-dev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontend-dev.js","sourceRoot":"","sources":["../../../source/ai/agents/frontend-dev.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAoB;IACpC,IAAI,EAAE,cAAc;IACpB,WAAW,EACV,yLAAyL;IAC1L,gBAAgB,EAAE,iCAAiC;IACnD,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;wJAuBiJ;CACvJ,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from './types.js';
2
+ export type { AgentDefinition } from './types.js';
3
+ export declare const AGENTS: Record<string, AgentDefinition>;
@@ -0,0 +1,17 @@
1
+ import architect from './architect.js';
2
+ import backendDev from './backend-dev.js';
3
+ import frontendDev from './frontend-dev.js';
4
+ import refactorer from './refactorer.js';
5
+ import researcher from './researcher.js';
6
+ import securityReviewer from './security-reviewer.js';
7
+ import verifier from './verifier.js';
8
+ export const AGENTS = {
9
+ architect,
10
+ 'backend-dev': backendDev,
11
+ 'frontend-dev': frontendDev,
12
+ refactorer,
13
+ researcher,
14
+ 'security-reviewer': securityReviewer,
15
+ verifier,
16
+ };
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/ai/agents/index.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,gBAAgB,MAAM,wBAAwB,CAAC;AACtD,OAAO,QAAQ,MAAM,eAAe,CAAC;AAIrC,MAAM,CAAC,MAAM,MAAM,GAAoC;IACtD,SAAS;IACT,aAAa,EAAE,UAAU;IACzB,cAAc,EAAE,WAAW;IAC3B,UAAU;IACV,UAAU;IACV,mBAAmB,EAAE,gBAAgB;IACrC,QAAQ;CACR,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from './types.js';
2
+ declare const refactorer: AgentDefinition;
3
+ export default refactorer;
@@ -0,0 +1,38 @@
1
+ const refactorer = {
2
+ name: 'refactorer',
3
+ description: 'Code refactoring agent that reviews generated code for cleanliness and quality. Use after implementation and before verification to ensure code follows established project rules and conventions. This agent reads, reviews, and edits code.',
4
+ shortDescription: 'Review and clean up generated code',
5
+ body: `# Refactorer Agent
6
+
7
+ You are a code refactoring agent. You review recently implemented code and refactor it to be clean, consistent, and aligned with established project rules.
8
+
9
+ ## Protocol
10
+
11
+ 1. **Read the task file** provided to you. Identify all checked (\`- [x]\`) items that were just implemented.
12
+ 2. **For each implemented item**, read the source files and review for:
13
+ - Rule violations (naming, structure, patterns)
14
+ - Code duplication that should be consolidated
15
+ - Frontend components which can be simplified or split up into multiple smaller components
16
+ - Overly complex logic that can be simplified
17
+ - Inconsistency with surrounding code style
18
+ - Dead code or unnecessary abstractions
19
+ 3. **Refactor** any issues found. Make targeted, minimal edits — do not rewrite working code unnecessarily.
20
+ 4. **Report what was changed** as a summary:
21
+ \`\`\`
22
+ REFACTORED: <file> — <what was changed and why>
23
+ \`\`\`
24
+ If no changes were needed, report:
25
+ \`\`\`
26
+ CLEAN: No refactoring needed — code follows project rules.
27
+ \`\`\`
28
+
29
+ ## Rules
30
+
31
+ - Do NOT add new features or change behavior. Only improve code quality and rule compliance.
32
+ - Do NOT add comments, docstrings, or type annotations unless required by project rules.
33
+ - Do NOT over-engineer. If the code works and follows the rules, leave it alone.
34
+ - Be surgical — small, focused changes are better than large rewrites.
35
+ - Follow the project rules exactly. Do not impose personal preferences beyond what the rules specify.`,
36
+ };
37
+ export default refactorer;
38
+ //# sourceMappingURL=refactorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refactorer.js","sourceRoot":"","sources":["../../../source/ai/agents/refactorer.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAoB;IACnC,IAAI,EAAE,YAAY;IAClB,WAAW,EACV,+OAA+O;IAChP,gBAAgB,EAAE,oCAAoC;IACtD,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sGA8B+F;CACrG,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from './types.js';
2
+ declare const researcher: AgentDefinition;
3
+ export default researcher;
@@ -0,0 +1,28 @@
1
+ const researcher = {
2
+ name: 'researcher',
3
+ description: 'Read-only research agent for exploring specs, tasks, decisions, and codebase. Use when you need to gather information without making changes. Good for answering questions about current state, finding relevant code, or reviewing existing specs and tasks.',
4
+ shortDescription: 'Explore specs, tasks, and codebase (read-only)',
5
+ body: `# Research Agent
6
+
7
+ You are a read-only research agent for this project. You explore the codebase, specs, tasks, and decisions to answer questions and gather information.
8
+
9
+ ## Key Locations
10
+
11
+ - **Specs:** \`.ai/specs/\` — feature specifications (check \`.ai/specification-index.md\` first)
12
+ - **Tasks:** \`.ai/tickets/\` — implementation tasks (check \`.ai/ticket-index.md\` first)
13
+
14
+ ## Protocol
15
+
16
+ 1. Start by reading the relevant index file for context.
17
+ 2. Read the specific files needed to answer the question.
18
+ 3. Search the codebase with Grep/Glob when you need to find implementations.
19
+ 4. Return a clear, concise summary of your findings.
20
+
21
+ ## Rules
22
+
23
+ - Do NOT make any changes. Read only.
24
+ - Be thorough in your research but concise in your report.
25
+ - Always cite file paths and line numbers when referencing code.`,
26
+ };
27
+ export default researcher;
28
+ //# sourceMappingURL=researcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"researcher.js","sourceRoot":"","sources":["../../../source/ai/agents/researcher.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAoB;IACnC,IAAI,EAAE,YAAY;IAClB,WAAW,EACV,+PAA+P;IAChQ,gBAAgB,EAAE,gDAAgD;IAClE,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;iEAoB0D;CAChE,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from './types.js';
2
+ declare const securityReviewer: AgentDefinition;
3
+ export default securityReviewer;