aircana 3.0.0.rc7 → 3.0.0

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.
data/CLAUDE.md CHANGED
@@ -62,30 +62,60 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
62
62
  Aircana is a Ruby gem that creates and manages Claude Code plugins. The main components:
63
63
 
64
64
  - **CLI Layer** (`lib/aircana/cli/`): Thor-based command line interface with subcommands
65
- - `app.rb`: Main Thor application defining all commands
66
- - `subcommand.rb`: Base class for subcommands
65
+ - `app.rb`: Main Thor application defining all commands and subcommands
66
+ - `subcommand.rb`: Base class for subcommands (agents, hooks, plugin)
67
67
  - `shell_command.rb`: Shell command execution utilities
68
68
  - `commands/`: Individual command implementations
69
69
  - `init.rb`: Plugin initialization
70
70
  - `plugin.rb`: Plugin metadata management
71
71
  - `agents.rb`: Agent CRUD operations
72
72
  - `hooks.rb`: Hook management
73
+ - `doctor.rb`: System health checks with modular check system
74
+ - `generate.rb`: Generates plugin components from templates
75
+ - `dump_context.rb`: Outputs agent knowledge for debugging
76
+
73
77
  - **Plugin Management**:
74
- - `plugin_manifest.rb`: Manages `.claude-plugin/plugin.json`
75
- - `hooks_manifest.rb`: Manages `hooks/hooks.json`
76
- - **Contexts** (`lib/aircana/contexts/`): Manages knowledge sources
77
- - `confluence.rb`: Handles Confluence page fetching and caching
78
- - `confluence_content.rb`: Processes Confluence content
79
- - `web.rb`: Handles web URL fetching and HTML to Markdown conversion
80
- - `manifest.rb`: Tracks knowledge sources per agent
81
- - **Generators** (`lib/aircana/generators/`): Template generation system
82
- - `base_generator.rb`: Base class for all generators
83
- - `agents_generator.rb`: Generates agent configurations
84
- - Command generators: Generate slash commands from templates
85
- - **Configuration** (`lib/aircana/configuration.rb`): Centralized configuration management with plugin-aware paths
78
+ - `plugin_manifest.rb`: Manages `.claude-plugin/plugin.json` with validation
79
+ - `hooks_manifest.rb`: Manages `hooks/hooks.json` with event validation
80
+
81
+ - **Contexts** (`lib/aircana/contexts/`): Knowledge source management
82
+ - `confluence.rb`: Main class composed of modules for separation of concerns:
83
+ - `ConfluenceLogging`: Request/response logging
84
+ - `ConfluenceHttp`: HTTParty integration and API calls
85
+ - `ConfluenceContent`: Content processing and storage
86
+ - `ConfluenceSetup`: Configuration validation
87
+ - `web.rb`: Web URL fetching with:
88
+ - HTML to Markdown conversion (ReverseMarkdown)
89
+ - Main content extraction (removes nav, ads, scripts)
90
+ - Claude API integration for generating meaningful page titles
91
+ - `manifest.rb`: Per-agent manifest system tracking:
92
+ - Knowledge sources (Confluence, web)
93
+ - Source metadata (page IDs, URLs, timestamps)
94
+ - Manifest format version (1.0)
95
+ - `local.rb`: File system operations for storing knowledge
96
+
97
+ - **Generators** (`lib/aircana/generators/`): ERB-based template generation
98
+ - `base_generator.rb`: Base class with ERB rendering and file writing
99
+ - `agents_generator.rb`: Agent file generation with default agent support
100
+ - Default agents: planner, jira, sub-agent-coordinator, executor, reviewer, apply_feedback
101
+ - Command generators: plan, execute, record, review, apply_feedback, ask_expert
102
+ - `hooks_generator.rb`: Hook script generation
103
+ - Templates location: `lib/aircana/templates/`
104
+
105
+ - **Configuration** (`lib/aircana/configuration.rb`): Path resolution system
106
+ - Plugin root detection via environment variables (AIRCANA_PLUGIN_ROOT, CLAUDE_PLUGIN_ROOT)
107
+ - Plugin-aware paths (commands, agents, hooks directories)
108
+ - Global vs plugin-local knowledge storage
109
+ - Automatic plugin name extraction from plugin.json
110
+
111
+ - **LLM Integration**:
112
+ - `llm/claude_client.rb`: Claude API client for web title generation
113
+
86
114
  - **Support Classes**:
87
- - `human_logger.rb`: User-friendly logging output
88
- - `system_checker.rb`: Dependency validation
115
+ - `human_logger.rb`: User-friendly, non-technical logging output
116
+ - `progress_tracker.rb`: Batch operations and spinner utilities
117
+ - `system_checker.rb`: Dependency validation (fzf required, bat/fd optional)
118
+ - `fzf_helper.rb`: Interactive fuzzy selection
89
119
 
90
120
  ### Key Concepts
91
121
  - **Plugins**: Distributable Claude Code extensions with manifests, agents, commands, and hooks
@@ -98,44 +128,146 @@ Aircana is a Ruby gem that creates and manages Claude Code plugins. The main com
98
128
  ### File Organization
99
129
  - **Plugin Structure**:
100
130
  - `.claude-plugin/plugin.json` - Plugin manifest with metadata and versioning
101
- - `agents/` - Agent markdown files and their knowledge directories
131
+ - `agents/` - Agent markdown files (agent definitions)
132
+ - `agents/<agent_name>/manifest.json` - Tracks knowledge sources per agent
102
133
  - `commands/` - Slash command markdown files
103
134
  - `hooks/` - hooks.json manifest defining hook configurations
104
135
  - `scripts/` - Hook scripts and utility scripts
105
- - **Configuration**:
106
- - `~/.aircana` - Global Aircana configuration
107
- - `~/.aircana/aircana.out` - Generated templates output directory
108
- - **Agent Knowledge**:
109
- - `agents/<agent_name>/knowledge/` - Cached knowledge base content
110
- - `agents/<agent_name>/manifest.json` - Tracks knowledge sources
136
+
137
+ - **Global Configuration**:
138
+ - `~/.aircana/` - Global Aircana configuration directory
139
+ - `~/.aircana/aircana.out/` - Generated templates output directory
140
+
141
+ - **Knowledge Storage Architecture**:
142
+ - **Global (not version controlled)**: `~/.claude/agents/<plugin-name>-<agent-name>/knowledge/`
143
+ - Actual knowledge base content (Markdown files)
144
+ - Refreshed via `aircana agents refresh`
145
+ - Excluded from version control to avoid bloat/sensitivity
146
+ - **Plugin-local (version controlled)**: `agents/<agent_name>/manifest.json`
147
+ - Tracks knowledge sources (Confluence labels, web URLs)
148
+ - Team members can refresh knowledge independently
149
+ - Format:
150
+ ```json
151
+ {
152
+ "version": "1.0",
153
+ "agent": "agent-name",
154
+ "sources": [
155
+ {
156
+ "type": "confluence",
157
+ "label": "agent-name",
158
+ "pages": [{"id": "123456"}]
159
+ },
160
+ {
161
+ "type": "web",
162
+ "urls": [{"url": "https://example.com"}]
163
+ }
164
+ ]
165
+ }
166
+ ```
167
+
168
+ - **Path Resolution**:
169
+ - Environment variables override defaults:
170
+ - `AIRCANA_PLUGIN_ROOT` or `CLAUDE_PLUGIN_ROOT`: Override plugin root directory
171
+ - Configuration class resolves paths dynamically based on plugin.json presence
111
172
 
112
173
  ### Dependencies
113
174
  - Thor (~> 0.19.1) for CLI framework
114
175
  - tty-prompt (~> 0.23.1) for interactive prompts
176
+ - tty-progressbar (~> 0.18) for progress indicators
177
+ - tty-spinner (~> 0.9) for loading spinners
178
+ - HTTParty (~> 0.21) for HTTP requests
179
+ - ReverseMarkdown (~> 2.1) for HTML to Markdown conversion
115
180
  - Ruby >= 3.3.0 required
116
- - External tools: git, fzf (required), bat, fd (optional)
181
+ - External tools:
182
+ - git (required)
183
+ - fzf (required) - used for interactive selection
184
+ - bat (optional) - enhanced file viewing
185
+ - fd (optional) - faster file finding
186
+ - aws-cli (optional) - for SQS notifications integration
187
+
188
+ ### Key Implementation Patterns
189
+
190
+ **Module-Based Composition**:
191
+ The Confluence class demonstrates module-based composition for separation of concerns:
192
+ ```ruby
193
+ class Confluence
194
+ include ConfluenceLogging # Request/response logging
195
+ include ConfluenceHttp # HTTParty integration
196
+ include ConfluenceContent # Content processing
197
+ include ConfluenceSetup # Configuration validation
198
+ end
199
+ ```
200
+ This pattern keeps each module focused on a single responsibility while composing full functionality.
201
+
202
+ **ERB Template Generation**:
203
+ All plugin components are generated from ERB templates in `lib/aircana/templates/`:
204
+ - `agents/` - Agent templates (base_agent.erb, defaults/)
205
+ - `commands/` - Slash command templates
206
+ - `hooks/` - Hook script templates
207
+
208
+ Generators inherit from `BaseGenerator` which handles:
209
+ - ERB rendering with `locals` hash
210
+ - File system operations
211
+ - Output directory preparation
212
+
213
+ **Progress Tracking**:
214
+ User-facing operations use `ProgressTracker` for consistent UX:
215
+ ```ruby
216
+ ProgressTracker.with_spinner("Searching pages") do
217
+ # Long-running operation
218
+ end
219
+
220
+ ProgressTracker.with_batch_progress(items, "Processing") do |item, index|
221
+ # Process each item
222
+ end
223
+ ```
224
+
225
+ **Manifest-Based Knowledge Tracking**:
226
+ Each agent has a `manifest.json` that tracks knowledge sources without storing content:
227
+ - Version controlled: manifest.json (sources metadata)
228
+ - Not version controlled: actual knowledge content in ~/.claude/agents/
229
+ - Team members run `aircana agents refresh` to sync knowledge locally
230
+
231
+ **Plugin-Aware Path Resolution**:
232
+ Configuration class detects plugin mode and resolves paths accordingly:
233
+ - Checks for `.claude-plugin/plugin.json` presence
234
+ - Respects environment variable overrides (AIRCANA_PLUGIN_ROOT)
235
+ - Extracts plugin name from plugin.json for prefixing knowledge paths
117
236
 
118
237
  ### Testing
119
238
  - Uses RSpec for testing with specs in `spec/` directory
120
239
  - Test files follow naming convention: `spec/<path>/<file>_spec.rb`
121
240
  - Rubocop configured with custom rules in `.rubocop.yml`
122
241
  - String style enforced as double quotes
242
+ - Run specific test: `bundle exec rspec spec/path/to/file_spec.rb:15`
123
243
 
124
244
  ### Knowledge Sources
125
245
  Agents can sync knowledge from multiple sources:
126
246
 
127
247
  **Confluence Integration:**
128
- - Set environment variables: `CONFLUENCE_BASE_URL`, `CONFLUENCE_USERNAME`, `CONFLUENCE_API_TOKEN`
129
- - Pages are fetched based on agent name as label
130
- - Content cached locally for offline access
248
+ - Environment variables: `CONFLUENCE_BASE_URL`, `CONFLUENCE_USERNAME`, `CONFLUENCE_API_TOKEN`
249
+ - Pages fetched via Confluence REST API v2 using HTTParty
250
+ - Label-based discovery: searches for pages labeled with agent name under "global" prefix
251
+ - Pagination support for large result sets
252
+ - HTML content converted to Markdown via ReverseMarkdown
253
+ - Page metadata (ID) tracked in manifest for refresh operations
131
254
 
132
255
  **Web URL Integration:**
133
- - Add URLs directly to agent knowledge bases
134
- - HTML content is automatically converted to Markdown
135
- - Interactive URL collection during agent creation
136
- - Add individual URLs: `aircana agents add-url <agent> <url>`
256
+ - Accepts any HTTP/HTTPS URL
257
+ - HTML content extraction with smart filtering:
258
+ - Removes navigation, headers, footers, ads, scripts
259
+ - Targets main content areas (main, article, .content selectors)
260
+ - Converts to clean Markdown
261
+ - Automatic title generation:
262
+ - Extracts HTML `<title>` tag
263
+ - Falls back to Claude API for meaningful titles if HTML title is generic/truncated
264
+ - Uses URL path as final fallback
265
+ - URL metadata tracked in manifest
137
266
 
138
267
  **Unified Management:**
139
- - Both sources tracked in manifest.json for each agent
140
- - Refresh all sources with `aircana agents refresh <agent>`
141
- - Content stored as Markdown files in `.claude/agents/<agent>/knowledge/`
268
+ - Both source types tracked in manifest.json per agent
269
+ - Manifest schema version 1.0
270
+ - `aircana agents refresh <agent>` refreshes all sources (Confluence + web)
271
+ - `aircana agents refresh-all` refreshes all configured agents
272
+ - Content stored as Markdown in `~/.claude/agents/<plugin-name>-<agent-name>/knowledge/`
273
+ - Knowledge paths referenced in agent files use tilde notation: `~/.claude/agents/.../knowledge/`