@2amtech/hai 0.0.1 → 0.0.2

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 (2) hide show
  1. package/README.md +124 -147
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,197 +1,174 @@
1
- # hai-cli
1
+ # @2amtech/hai
2
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.
3
+ **Helper AI (HAI)** is an npm CLI that sets up a standardized AI-assisted development workflow for your project. It syncs tickets and specs from platforms like Jira and Confluence into a local (git ignored) `.ai/` directory and exposes an MCP server to your AI, and installs purpose-built prompts and subagents into your AI coding environment — so your AI assistant can plan, research, and implement work with full project context and easily pull tickets and specification in AI readable MD files.
4
4
 
5
- ## Features
5
+ ## Installation
6
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
7
+ ```bash
8
+ npm install -g @2amtech/hai
9
+ ```
12
10
 
13
11
  ## Quick start
14
12
 
15
13
  ```bash
16
- # Install dependencies
17
- npm install
14
+ hai init # Interactive wizard — pick your AI provider, ticket source, and spec source
15
+ hai pull # Sync tickets and specs to .ai/
16
+ ```
18
17
 
19
- npm run install-cli # Installs hai globally
18
+ That's it. Your AI assistant now has access to your project's tickets, specs, prompts, and agents.
20
19
 
21
- hai init
20
+ MCP server will automatically be added for your provider. If you need add mcp server manually you can add it as:
21
+
22
+ ```bash
23
+ hai mcp .
22
24
  ```
23
25
 
24
26
  ## Commands
25
27
 
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 |
28
+ | Command | Description |
29
+ | --------------- | -------------------------------------------------------------- |
30
+ | `hai init` | Interactive setup wizard — select providers, enter credentials |
31
+ | `hai pull` | Sync tickets and specs to `.ai/` |
32
+ | `hai status` | Show sync status (ticket counts, last sync time) |
33
+ | `hai get <KEY>` | Fetch a specific ticket (e.g. `PROJ-123`) |
34
+ | `hai mcp [dir]` | Start the MCP server over stdio |
34
35
 
35
- ## Project structure
36
+ ### Flags
36
37
 
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
- ```
38
+ | Flag | Commands | Description |
39
+ | ------------------- | -------- | ------------------------------------- |
40
+ | `--tickets`, `-t` | `pull` | Sync tickets only |
41
+ | `--specs`, `-s` | `pull` | Sync specs only |
42
+ | `--dry-run` | `pull` | Preview changes without writing |
43
+ | `--update-local` | `pull` | Remove local files not found remotely |
44
+ | `--recursive`, `-r` | `get` | Also fetch linked issues |
66
45
 
67
- ## Development
46
+ ## Supported AI providers
68
47
 
69
- ### Prerequisites
48
+ HAI integrates with the following AI coding environments:
70
49
 
71
- - Node.js >= 16
72
- - npm
50
+ | Provider | ID | MCP config location | Prompts installed to | Agents installed to |
51
+ | ------------------ | ---------------- | ------------------- | -------------------- | ------------------- |
52
+ | **Claude Code** | `claude-code` | `.mcp.json` | `.claude/commands/` | `.claude/agents/` |
53
+ | **GitHub Copilot** | `vscode-copilot` | `.vscode/mcp.json` | `.github/prompts/` | `.github/agents/` |
54
+ | **Cursor** | `cursor` | `.cursor/mcp.json` | `.cursor/commands/` | `.cursor/agents/` |
55
+ | **Other** | `other` | _(manual setup)_ | `.ai/prompts/` | `.ai/agents/` |
73
56
 
74
- ### Build and run
57
+ All providers register the HAI MCP server and install the full set of prompts and agents into the appropriate directories for that environment.
75
58
 
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
- ```
59
+ ## Supported ticket and spec providers
83
60
 
84
- ### Tech stack
61
+ | Provider | ID | Capabilities | Description |
62
+ | ------------- | ----------- | --------------- | -------------------------------------- |
63
+ | **Atlassian** | `atlassian` | Tickets + Specs | Jira for tickets, Confluence for specs |
64
+ | **Local** | `local` | Tickets + Specs | Read from local filesystem directories |
65
+ | **None** | `none` | Tickets + Specs | Disabled / no-op provider |
85
66
 
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
67
+ ### Atlassian provider
90
68
 
91
- ### Code conventions
69
+ - **Jira**: Fetches active and done tickets by project, supports recursive linked-issue fetching, custom fields, and comments
70
+ - **Confluence**: Fetches pages by space (optionally scoped to an ancestor page), converts Atlassian Document Format (ADF) to Markdown, and preserves page hierarchy
92
71
 
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)
72
+ ## Prompts
99
73
 
100
- ## Adding a plugin
74
+ HAI ships with 7 built-in prompts that are installed into your AI editor as commands:
101
75
 
102
- Plugins let you integrate new ticket sources, spec providers, or AI tools. Each plugin implements the `HaiPlugin` interface.
76
+ | Prompt | Description |
77
+ | ------------------ | ---------------------------------------------------------------------------------------------------------------------- |
78
+ | **implement** | Full implementation workflow — fetches tickets, researches context, plans, and spawns dev agents in parallel by domain |
79
+ | **pull** | Pull both tickets and specs from remote via MCP |
80
+ | **pull-tickets** | Pull only tickets from remote via MCP |
81
+ | **pull-specs** | Pull only specs from remote via MCP |
82
+ | **document** | Generate implementation documentation from recent git changes |
83
+ | **optimize-ai** | Optimize AI agents and prompts for your project needs |
84
+ | **review-changes** | Review recent code changes |
103
85
 
104
- ### 1. Create the plugin directory
86
+ ### The `implement` workflow
105
87
 
106
- ```
107
- source/plugins/my-plugin/
108
- ├── index.ts # Plugin definition (exports the HaiPlugin object)
109
- └── provider.ts # Provider implementation(s)
110
- ```
88
+ The `implement` prompt orchestrates a multi-phase, domain-parallel coding workflow:
111
89
 
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
- ```
90
+ 1. **Fetch** — pulls the target ticket(s) via MCP with recursive linking
91
+ 2. **Research** — spawns a `researcher` subagent to read tickets, specs, and codebase patterns
92
+ 3. **Plan** — enters plan mode, creates structured TODOs grouped by domain (backend, frontend, etc.)
93
+ 4. **Implement** spawns `backend-dev` and `frontend-dev` subagents **in parallel** for each domain
94
+ 5. **Verify** validates each subagent's output and collects implementation decisions
95
+
96
+ ## Agents
150
97
 
151
- A plugin can provide one or more capabilities:
98
+ HAI installs 7 specialized subagents that prompts can orchestrate:
152
99
 
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 |
100
+ | Agent | Role | Writes code? |
101
+ | --------------------- | ----------------------------------------------------- | ------------ |
102
+ | **researcher** | Read-only exploration of specs, tickets, and codebase | No |
103
+ | **architect** | Designs detailed implementation plans from research | No |
104
+ | **backend-dev** | Implements backend tasks | Yes |
105
+ | **frontend-dev** | Implements frontend tasks | Yes |
106
+ | **refactorer** | Refactors existing code | Yes |
107
+ | **security-reviewer** | Reviews code for security issues | No |
108
+ | **verifier** | Verification and QA | No |
158
109
 
159
- See [source/types.ts](source/types.ts) for the full provider interfaces.
110
+ Dev agents (`backend-dev`, `frontend-dev`) automatically spawn a `researcher` subagent first to gather context before writing code.
160
111
 
161
- ### 3. Register the plugin
112
+ ## MCP server
162
113
 
163
- Add your plugin to [source/plugins/index.ts](source/plugins/index.ts):
114
+ The MCP server (`hai mcp`) exposes project context to AI assistants over stdio. It provides two tools:
164
115
 
165
- ```typescript
166
- import {myPlugin} from './my-plugin/index.js';
116
+ | Tool | Description |
117
+ | --------------- | -------------------------------------------------------------- |
118
+ | **pull** | Sync tickets and/or specs from remote to `.ai/` |
119
+ | **ticket_pull** | Pull a specific ticket by key, with optional recursive linking |
167
120
 
168
- registerPlugin(myPlugin);
121
+ The server also provides instructions that direct AI assistants to read `.ai/specification-index.md` and `.ai/ticket-index.md` for discovering available project context.
122
+
123
+ ## The `.ai/` directory
124
+
125
+ After running `hai pull`, your project contains:
126
+
127
+ ```
128
+ .ai/
129
+ ├── ticket-index.md # Index of all synced tickets
130
+ ├── specification-index.md # Index of all synced specs
131
+ ├── AGENTS.md # Auto-generated agent info
132
+ ├── tickets/ # Provider dependent structure (example is for Atlassian)
133
+ │ └── <PROJECT>/
134
+ │ ├── PROJ-101.md
135
+ │ ├── PROJ-102.md
136
+ │ └── ...
137
+ └── specs/ # Provider dependent structure (example is for Atlassian)
138
+ └── <SPACE>/
139
+ ├── page-title.md
140
+ └── subfolder/
141
+ └── nested-page.md
169
142
  ```
170
143
 
171
- That's it. The plugin will now appear in the `hai init` wizard and be available for configuration.
144
+ Ticket files include: summary, status, assignee, priority, description, comments, and links. Spec files contain the page content converted to Markdown with hierarchy preserved.
172
145
 
173
- ### Configuration
146
+ ## Configuration
174
147
 
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:
148
+ Running `hai init` creates a `hai.json` at the project root (should be gitignored) that stores provider configuration:
176
149
 
177
150
  ```json
178
151
  {
179
- "plugins": [
180
- {
181
- "plugin": "my-plugin",
182
- "provides": ["tickets"],
183
- "host": "https://my-service.example.com",
184
- "token": "..."
185
- }
186
- ]
152
+ "plugins": [
153
+ {
154
+ "plugin": "atlassian",
155
+ "provides": ["tickets", "specs"],
156
+ "host": "https://your-org.atlassian.net",
157
+ "email": "you@example.com",
158
+ "token": "...",
159
+ "projects": ["PROJ"],
160
+ "spaces": ["TEAM"]
161
+ },
162
+ {
163
+ "plugin": "claude-code",
164
+ "provides": ["ai"]
165
+ }
166
+ ]
187
167
  }
188
168
  ```
189
169
 
190
- ## Data flow
170
+ Use `hai init` again to reconfigure at any time.
191
171
 
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
172
 
196
173
  ## License
197
174
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2amtech/hai",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Helper AI (HAI) is an AI environment initializer setting up a standardized AI workflow supporting multiple AI providers.",
6
6
  "author": "Aleksandar Panic",