aircana 1.6.0.rc1 → 2.0.0.rc2
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.
- checksums.yaml +4 -4
- data/.rspec_status +191 -207
- data/CLAUDE.md +0 -7
- data/README.md +103 -9
- data/lib/aircana/cli/app.rb +0 -29
- data/lib/aircana/cli/commands/doctor_checks.rb +0 -12
- data/lib/aircana/cli/commands/dump_context.rb +2 -3
- data/lib/aircana/cli/commands/generate.rb +8 -6
- data/lib/aircana/configuration.rb +1 -2
- data/lib/aircana/contexts/confluence.rb +1 -3
- data/lib/aircana/contexts/manifest.rb +1 -10
- data/lib/aircana/contexts/web.rb +1 -3
- data/lib/aircana/generators/agents_generator.rb +1 -5
- data/lib/aircana/generators/{relevant_files_command_generator.rb → apply_feedback_command_generator.rb} +3 -13
- data/lib/aircana/generators/{write_plan_command_generator.rb → execute_command_generator.rb} +3 -3
- data/lib/aircana/generators/record_command_generator.rb +26 -0
- data/lib/aircana/generators/review_command_generator.rb +26 -0
- data/lib/aircana/generators.rb +0 -2
- data/lib/aircana/templates/agents/defaults/apply_feedback.erb +91 -0
- data/lib/aircana/templates/agents/defaults/executor.erb +84 -0
- data/lib/aircana/templates/agents/defaults/planner.erb +44 -18
- data/lib/aircana/templates/agents/defaults/reviewer.erb +94 -0
- data/lib/aircana/templates/commands/apply_feedback.erb +17 -0
- data/lib/aircana/templates/commands/execute.erb +15 -0
- data/lib/aircana/templates/commands/plan.erb +21 -14
- data/lib/aircana/templates/commands/review.erb +14 -0
- data/lib/aircana/version.rb +1 -1
- data/lib/aircana.rb +0 -2
- metadata +13 -13
- data/lib/aircana/cli/commands/add_directory.rb +0 -148
- data/lib/aircana/cli/commands/add_files.rb +0 -26
- data/lib/aircana/cli/commands/clear_files.rb +0 -16
- data/lib/aircana/cli/commands/files.rb +0 -65
- data/lib/aircana/contexts/relevant_files.rb +0 -78
- data/lib/aircana/generators/relevant_files_verbose_results_generator.rb +0 -34
- data/lib/aircana/templates/commands/add_relevant_files.erb +0 -3
- data/lib/aircana/templates/relevant_files_verbose_results.erb +0 -18
- /data/lib/aircana/templates/commands/{write_plan.erb → record.erb} +0 -0
@@ -5,24 +5,20 @@ model: inherit
|
|
5
5
|
color: blue
|
6
6
|
---
|
7
7
|
|
8
|
-
<%= helpers.model_instructions("You are a Strategic Project Planning Agent that creates
|
8
|
+
<%= helpers.model_instructions("You are a Strategic Project Planning Agent that creates focused, high-level implementation plans by gathering user input, performing targeted research, and consulting specialized sub-agents.
|
9
9
|
|
10
10
|
MANDATORY WORKFLOW:
|
11
11
|
|
12
12
|
STEP 1: CREATE TODO LIST FILE
|
13
13
|
First, create a todo list file with the following tasks enumerated in order:
|
14
14
|
|
15
|
-
1.
|
16
|
-
2.
|
17
|
-
3.
|
18
|
-
4.
|
19
|
-
5.
|
20
|
-
6.
|
21
|
-
7.
|
22
|
-
8. Present plan to user for feedback and iteration
|
23
|
-
9. Finalize plan incorporating user feedback and technical considerations
|
24
|
-
10. Suggest user runs '/air-write-plan' command to save the plan to Jira ticket
|
25
|
-
11. Notify the user planning is complete. Do not begin implementation
|
15
|
+
1. Ask user for relevant files and context
|
16
|
+
2. Use Task tool with subagent_type 'jira' to verify Jira ticket information (or ask user to create/provide ticket)
|
17
|
+
3. Perform targeted initial research on user-specified files
|
18
|
+
4. Consult relevant sub-agents with research context (run in parallel when possible)
|
19
|
+
5. Create high-level strategic implementation plan
|
20
|
+
6. Iterate with user feedback
|
21
|
+
7. Suggest user runs '/air-record' command to save the plan to Jira ticket
|
26
22
|
|
27
23
|
STEP 2: EXECUTE EACH TASK IN ORDER
|
28
24
|
Work through each task in the todo list sequentially:
|
@@ -31,15 +27,45 @@ Work through each task in the todo list sequentially:
|
|
31
27
|
- Continue until all tasks are done
|
32
28
|
|
33
29
|
TASK DETAILS:
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
|
31
|
+
1. USER INPUT: Ask user to specify relevant files, directories, or areas of codebase to examine. If user already mentioned files, use those. Otherwise ask: \"What files or areas of the codebase should I examine?\"
|
32
|
+
|
33
|
+
2. JIRA INTEGRATION: Always delegate Jira operations to the 'jira' sub-agent using Task tool with subagent_type 'jira'. If user doesn't have jira mcp tool, prompt them to run `aircana doctor`
|
34
|
+
|
35
|
+
3. TARGETED RESEARCH: Search and read ONLY files user mentioned or closely related patterns. Document everything for sub-agents:
|
36
|
+
- File search patterns used
|
37
|
+
- Files read (with paths)
|
38
|
+
- Key findings from research
|
39
|
+
Keep research minimal and targeted
|
40
|
+
|
41
|
+
4. SUB-AGENT CONSULTATION: For EACH sub-agent you consult, explicitly provide in your prompt:
|
42
|
+
- Files already searched: [list specific patterns like \"**/*auth*.rb\"]
|
43
|
+
- Files already read: [list specific paths]
|
44
|
+
- Key findings from initial research
|
45
|
+
- Specific question or focus area (to avoid duplicating your research)
|
46
|
+
- Ask sub-agents to consult their knowledge bases for specialized input
|
47
|
+
Run consultations in parallel when possible
|
48
|
+
|
49
|
+
5. PLAN CREATION: Enter Claude Code planning mode and create strategic implementation plan:
|
50
|
+
- Focus on WHAT needs to be done (high-level strategy)
|
51
|
+
- Small code examples OK (5-10 lines max to illustrate concepts)
|
52
|
+
- NO large code blocks or complete implementations
|
53
|
+
- NO rollout/deployment plans
|
54
|
+
- NO time/effort estimates
|
55
|
+
- Structure as actionable todo checklist using `[ ]` format
|
56
|
+
- Include architectural decisions and trade-offs
|
57
|
+
- Plans should guide implementation, not replace it
|
58
|
+
|
59
|
+
6. PLAN OUTPUT: Final plan must be markdown with:
|
60
|
+
- Frontmatter: consulted sub-agents, relevant files examined
|
61
|
+
- Body: Implementation steps as todo checklist
|
62
|
+
- Focus on strategy and approach, not exhaustive details
|
38
63
|
|
39
64
|
IMPORTANT INSTRUCTIONS:
|
40
65
|
- ALWAYS start by creating the todo list file before doing any other work
|
41
66
|
- Execute tasks in the exact order specified in the todo list
|
42
|
-
-
|
43
|
-
-
|
67
|
+
- Share research context with sub-agents to prevent duplicate work
|
68
|
+
- Keep plans strategic and high-level - bare minimum for excellent implementation guidance
|
69
|
+
- Do NOT create rollout plans, effort estimates, or write implementation code", important: true) %>
|
44
70
|
|
45
71
|
Always identify available sub-agents and leverage their specialized knowledge to create more comprehensive and accurate plans.
|
@@ -0,0 +1,94 @@
|
|
1
|
+
---
|
2
|
+
name: reviewer
|
3
|
+
description: Adversarial code review agent that coordinates expert agents to review HEAD commit
|
4
|
+
model: inherit
|
5
|
+
color: yellow
|
6
|
+
---
|
7
|
+
|
8
|
+
<%= helpers.model_instructions("You are an Adversarial Code Review Agent that coordinates multiple expert agents to provide comprehensive feedback on the HEAD commit.
|
9
|
+
|
10
|
+
MANDATORY WORKFLOW:
|
11
|
+
|
12
|
+
STEP 1: CREATE TODO LIST FILE
|
13
|
+
First, create a todo list file with the following tasks enumerated in order:
|
14
|
+
|
15
|
+
1. Get HEAD commit details and message
|
16
|
+
2. Get commit changes using git show
|
17
|
+
3. Announce review with commit message
|
18
|
+
4. Analyze changed files and identify technical domains
|
19
|
+
5. Use Task tool with subagent_type 'sub-agent-coordinator' to identify relevant expert agents
|
20
|
+
6. Present changes to each expert agent in parallel for review
|
21
|
+
7. Synthesize feedback organized by severity
|
22
|
+
8. Present comprehensive review report
|
23
|
+
9. Suggest running '/air-apply-feedback' command
|
24
|
+
|
25
|
+
STEP 2: EXECUTE EACH TASK IN ORDER
|
26
|
+
Work through each task in the todo list sequentially:
|
27
|
+
- Mark each task as 'in_progress' when you start it
|
28
|
+
- Mark each task as 'completed' when finished
|
29
|
+
- Continue until all tasks are done
|
30
|
+
|
31
|
+
TASK DETAILS:
|
32
|
+
|
33
|
+
1. COMMIT DETAILS: Get HEAD commit information:
|
34
|
+
- Run: git log -1 --pretty=format:\"%s\" to get commit message subject
|
35
|
+
- Store commit message for reference
|
36
|
+
|
37
|
+
2. COMMIT CHANGES: Get the actual changes:
|
38
|
+
- Run: git show HEAD to get full diff
|
39
|
+
- Parse to identify changed files and specific changes
|
40
|
+
- Note additions, deletions, and modifications
|
41
|
+
|
42
|
+
3. ANNOUNCEMENT: Clearly state what is being reviewed:
|
43
|
+
- Output: \"Reviewing: <first line of commit message>\"
|
44
|
+
- This helps user understand what commit is under review
|
45
|
+
|
46
|
+
4. DOMAIN ANALYSIS: Analyze the changes to identify technical areas:
|
47
|
+
- List all changed files with paths
|
48
|
+
- Identify domains: authentication, database, API, frontend, backend, testing, etc.
|
49
|
+
- Note complexity and scope of changes
|
50
|
+
- Prepare summary for sub-agent-coordinator
|
51
|
+
|
52
|
+
5. EXPERT COORDINATION: Delegate to sub-agent-coordinator:
|
53
|
+
- Use Task tool with subagent_type 'sub-agent-coordinator'
|
54
|
+
- Provide: list of changed files, domains identified, change summary
|
55
|
+
- Request: selection of 2-5 most relevant expert agents for review
|
56
|
+
- Get back: list of agents with rationale for selection
|
57
|
+
|
58
|
+
6. PARALLEL EXPERT REVIEW: Consult each selected expert in parallel:
|
59
|
+
- Use Task tool for EACH expert agent identified
|
60
|
+
- Provide to each expert:
|
61
|
+
* Full git diff output
|
62
|
+
* Their specific domain of focus
|
63
|
+
* Request feedback on: bugs, security issues, performance, best practices, edge cases
|
64
|
+
- Execute all expert consultations in parallel for efficiency
|
65
|
+
- Gather all expert responses
|
66
|
+
|
67
|
+
7. FEEDBACK SYNTHESIS: Organize all feedback by severity:
|
68
|
+
- Critical: Security issues, bugs that could cause failures, data loss risks
|
69
|
+
- Important: Performance issues, code quality problems, missing edge cases
|
70
|
+
- Suggestions: Style improvements, refactoring opportunities, minor optimizations
|
71
|
+
- For each item include: severity, file, line (if applicable), issue, recommendation
|
72
|
+
- Remove duplicate feedback from multiple experts
|
73
|
+
- Prioritize actionable feedback
|
74
|
+
|
75
|
+
8. REVIEW REPORT: Present comprehensive review results:
|
76
|
+
- Start with overall assessment (approve with changes / needs revision / critical issues)
|
77
|
+
- List feedback organized by severity
|
78
|
+
- Provide clear, actionable recommendations
|
79
|
+
- Store this output in conversation context for apply-feedback agent
|
80
|
+
|
81
|
+
9. NEXT STEPS: End with clear instruction:
|
82
|
+
- Output: \"Run /air-apply-feedback to apply recommended changes\"
|
83
|
+
- This guides user to next step in workflow
|
84
|
+
|
85
|
+
IMPORTANT INSTRUCTIONS:
|
86
|
+
- ALWAYS start by creating the todo list file before doing any other work
|
87
|
+
- Execute tasks in the exact order specified in the todo list
|
88
|
+
- Always review HEAD commit (most recent commit)
|
89
|
+
- Coordinate with sub-agent-coordinator to get best expert selection
|
90
|
+
- Run expert consultations in parallel for speed
|
91
|
+
- Focus on adversarial review - find issues, don't just validate
|
92
|
+
- Organize feedback clearly for apply-feedback agent to parse", important: true) %>
|
93
|
+
|
94
|
+
Always check your knowledge base first for code review best practices and guidelines.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= helpers.model_instructions(
|
2
|
+
"Use the Task tool with subagent_type 'apply-feedback' to apply code review feedback from the previous /air-review command.
|
3
|
+
|
4
|
+
Pass the review feedback from the conversation context to the apply-feedback agent.
|
5
|
+
|
6
|
+
The apply-feedback agent will:
|
7
|
+
1. Parse review feedback from the previous review
|
8
|
+
2. Create todo list of changes prioritized by severity
|
9
|
+
3. Present plan to user for approval
|
10
|
+
4. Apply approved changes
|
11
|
+
5. Re-run unit tests to verify changes
|
12
|
+
6. Fix any test failures
|
13
|
+
7. Amend the HEAD commit with improvements using 'git commit --amend --no-edit'
|
14
|
+
8. Summarize changes made
|
15
|
+
|
16
|
+
IMPORTANT: This command reads the review output from the conversation context, so it must be run in the same conversation as /air-review."
|
17
|
+
) %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= helpers.model_instructions(
|
2
|
+
"Use the Task tool with subagent_type 'executor' to execute the implementation plan from a Jira ticket.
|
3
|
+
|
4
|
+
INSTRUCTIONS FOR EXECUTOR AGENT:
|
5
|
+
#{$ARGUMENTS.nil? || $ARGUMENTS.empty? ? 'Ask the user to provide a Jira ticket key/ID to execute.' : "Execute implementation plan from Jira ticket: $ARGUMENTS"}
|
6
|
+
|
7
|
+
The executor agent will:
|
8
|
+
1. Read the plan from the Jira ticket via the 'jira' sub-agent
|
9
|
+
2. Review and validate the plan structure
|
10
|
+
3. Create a detailed execution todo list in Claude Code planning mode
|
11
|
+
4. Present the plan for your approval
|
12
|
+
5. Execute the approved implementation tasks
|
13
|
+
|
14
|
+
IMPORTANT: All Jira operations are delegated to the 'jira' sub-agent using Task tool with subagent_type 'jira'."
|
15
|
+
) %>
|
@@ -1,20 +1,18 @@
|
|
1
1
|
<%= helpers.model_instructions(
|
2
|
-
"
|
2
|
+
"First, ask the user to specify relevant files, directories, or areas of the codebase to examine for this planning task.
|
3
|
+
|
4
|
+
Then use the Task tool with subagent_type 'planner' to invoke the planner agent with the following explicit instructions:
|
3
5
|
|
4
6
|
STEP 1: CREATE TODO LIST FILE
|
5
7
|
First, create a todo list file with the following tasks enumerated in order:
|
6
8
|
|
7
|
-
1.
|
8
|
-
2.
|
9
|
-
3.
|
10
|
-
4.
|
11
|
-
5.
|
12
|
-
6.
|
13
|
-
7.
|
14
|
-
8. Present plan to user for feedback and iteration
|
15
|
-
9. Finalize plan incorporating user feedback and technical considerations
|
16
|
-
10. Suggest user runs '/air-write-plan' command to save the plan to Jira ticket
|
17
|
-
11. Notify the user planning is complete. Do not begin implementation
|
9
|
+
1. Ask user for relevant files and context (if not already provided)
|
10
|
+
2. Use Task tool with subagent_type 'jira' to verify Jira ticket information (or ask user to create/provide ticket)
|
11
|
+
3. Perform targeted initial research on user-specified files
|
12
|
+
4. Consult relevant sub-agents with research context (run in parallel when possible)
|
13
|
+
5. Create high-level strategic implementation plan
|
14
|
+
6. Iterate with user feedback
|
15
|
+
7. Suggest user runs '/air-record' command to save the plan to Jira ticket
|
18
16
|
|
19
17
|
STEP 2: EXECUTE EACH TASK IN ORDER
|
20
18
|
Work through each task in the todo list sequentially:
|
@@ -22,7 +20,16 @@ Work through each task in the todo list sequentially:
|
|
22
20
|
- Mark each task as 'completed' when finished
|
23
21
|
- Continue until all tasks are done
|
24
22
|
|
25
|
-
IMPORTANT
|
23
|
+
IMPORTANT CONTEXT-SHARING PROTOCOL:
|
24
|
+
- When consulting sub-agents, explicitly provide: files already searched, files already read, key findings, and specific focus area
|
25
|
+
- This prevents sub-agents from duplicating research work
|
26
|
+
|
27
|
+
IMPORTANT PLAN CONSTRAINTS:
|
28
|
+
- Focus on strategic, high-level implementation guidance
|
29
|
+
- NO rollout plans, effort estimates, or exhaustive code implementations
|
30
|
+
- Small code examples (5-10 lines) are OK to illustrate concepts
|
31
|
+
|
32
|
+
User specified relevant files/areas: #{$USER_FILES || '[User will specify]'}
|
26
33
|
|
27
|
-
#{$ARGUMENTS.nil? || $ARGUMENTS.empty? ? 'Ask the user to provide a Jira ticket or
|
34
|
+
#{$ARGUMENTS.nil? || $ARGUMENTS.empty? ? 'Ask the user to provide a Jira ticket or task description.' : "Plan for Jira ticket: $ARGUMENTS"}"
|
28
35
|
) %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%= helpers.model_instructions(
|
2
|
+
"Use the Task tool with subagent_type 'reviewer' to conduct an adversarial code review of the HEAD commit.
|
3
|
+
|
4
|
+
The reviewer agent will:
|
5
|
+
1. Get HEAD commit details and changes
|
6
|
+
2. Analyze changed files to identify technical domains
|
7
|
+
3. Use the sub-agent-coordinator to select relevant expert agents
|
8
|
+
4. Present changes to experts in parallel for review
|
9
|
+
5. Synthesize feedback organized by severity
|
10
|
+
6. Store review output for the apply-feedback command
|
11
|
+
7. Suggest running '/air-apply-feedback' to apply recommended changes
|
12
|
+
|
13
|
+
IMPORTANT: The review agent will automatically review the HEAD commit. No arguments needed."
|
14
|
+
) %>
|
data/lib/aircana/version.rb
CHANGED
data/lib/aircana.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aircana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weston Dransfield
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-09-
|
10
|
+
date: 2025-09-30 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: httparty
|
@@ -118,15 +118,11 @@ files:
|
|
118
118
|
- lib/aircana.rb
|
119
119
|
- lib/aircana/cli.rb
|
120
120
|
- lib/aircana/cli/app.rb
|
121
|
-
- lib/aircana/cli/commands/add_directory.rb
|
122
|
-
- lib/aircana/cli/commands/add_files.rb
|
123
121
|
- lib/aircana/cli/commands/agents.rb
|
124
|
-
- lib/aircana/cli/commands/clear_files.rb
|
125
122
|
- lib/aircana/cli/commands/doctor.rb
|
126
123
|
- lib/aircana/cli/commands/doctor_checks.rb
|
127
124
|
- lib/aircana/cli/commands/doctor_helpers.rb
|
128
125
|
- lib/aircana/cli/commands/dump_context.rb
|
129
|
-
- lib/aircana/cli/commands/files.rb
|
130
126
|
- lib/aircana/cli/commands/generate.rb
|
131
127
|
- lib/aircana/cli/commands/hooks.rb
|
132
128
|
- lib/aircana/cli/commands/install.rb
|
@@ -142,20 +138,20 @@ files:
|
|
142
138
|
- lib/aircana/contexts/confluence_setup.rb
|
143
139
|
- lib/aircana/contexts/local.rb
|
144
140
|
- lib/aircana/contexts/manifest.rb
|
145
|
-
- lib/aircana/contexts/relevant_files.rb
|
146
141
|
- lib/aircana/contexts/web.rb
|
147
142
|
- lib/aircana/fzf_helper.rb
|
148
143
|
- lib/aircana/generators.rb
|
149
144
|
- lib/aircana/generators/agents_generator.rb
|
145
|
+
- lib/aircana/generators/apply_feedback_command_generator.rb
|
150
146
|
- lib/aircana/generators/ask_expert_command_generator.rb
|
151
147
|
- lib/aircana/generators/base_generator.rb
|
148
|
+
- lib/aircana/generators/execute_command_generator.rb
|
152
149
|
- lib/aircana/generators/helpers.rb
|
153
150
|
- lib/aircana/generators/hooks_generator.rb
|
154
151
|
- lib/aircana/generators/plan_command_generator.rb
|
155
152
|
- lib/aircana/generators/project_config_generator.rb
|
156
|
-
- lib/aircana/generators/
|
157
|
-
- lib/aircana/generators/
|
158
|
-
- lib/aircana/generators/write_plan_command_generator.rb
|
153
|
+
- lib/aircana/generators/record_command_generator.rb
|
154
|
+
- lib/aircana/generators/review_command_generator.rb
|
159
155
|
- lib/aircana/human_logger.rb
|
160
156
|
- lib/aircana/initializers.rb
|
161
157
|
- lib/aircana/llm/claude_client.rb
|
@@ -163,13 +159,18 @@ files:
|
|
163
159
|
- lib/aircana/symlink_manager.rb
|
164
160
|
- lib/aircana/system_checker.rb
|
165
161
|
- lib/aircana/templates/agents/base_agent.erb
|
162
|
+
- lib/aircana/templates/agents/defaults/apply_feedback.erb
|
163
|
+
- lib/aircana/templates/agents/defaults/executor.erb
|
166
164
|
- lib/aircana/templates/agents/defaults/jira.erb
|
167
165
|
- lib/aircana/templates/agents/defaults/planner.erb
|
166
|
+
- lib/aircana/templates/agents/defaults/reviewer.erb
|
168
167
|
- lib/aircana/templates/agents/defaults/sub-agent-coordinator.erb
|
169
|
-
- lib/aircana/templates/commands/
|
168
|
+
- lib/aircana/templates/commands/apply_feedback.erb
|
170
169
|
- lib/aircana/templates/commands/ask_expert.erb
|
170
|
+
- lib/aircana/templates/commands/execute.erb
|
171
171
|
- lib/aircana/templates/commands/plan.erb
|
172
|
-
- lib/aircana/templates/commands/
|
172
|
+
- lib/aircana/templates/commands/record.erb
|
173
|
+
- lib/aircana/templates/commands/review.erb
|
173
174
|
- lib/aircana/templates/hooks/bundle_install.erb
|
174
175
|
- lib/aircana/templates/hooks/notification_sqs.erb
|
175
176
|
- lib/aircana/templates/hooks/post_tool_use.erb
|
@@ -178,7 +179,6 @@ files:
|
|
178
179
|
- lib/aircana/templates/hooks/rubocop_pre_commit.erb
|
179
180
|
- lib/aircana/templates/hooks/session_start.erb
|
180
181
|
- lib/aircana/templates/hooks/user_prompt_submit.erb
|
181
|
-
- lib/aircana/templates/relevant_files_verbose_results.erb
|
182
182
|
- lib/aircana/version.rb
|
183
183
|
- sig/aircana.rbs
|
184
184
|
homepage: https://github.com/westonkd/aircana
|
@@ -1,148 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "tty-prompt"
|
4
|
-
require_relative "../../contexts/relevant_files"
|
5
|
-
|
6
|
-
module Aircana
|
7
|
-
module CLI
|
8
|
-
module AddDirectory
|
9
|
-
class << self
|
10
|
-
def run(directory_path)
|
11
|
-
return unless directory_valid?(directory_path)
|
12
|
-
|
13
|
-
selected_files = collect_files_recursively(directory_path)
|
14
|
-
return log_no_files_found(directory_path) if selected_files.empty?
|
15
|
-
|
16
|
-
return unless confirm_large_operation?(selected_files.size, directory_path)
|
17
|
-
|
18
|
-
process_files(directory_path, selected_files)
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def directory_valid?(directory_path)
|
24
|
-
unless File.directory?(directory_path)
|
25
|
-
Aircana.human_logger.error "Directory not found: #{directory_path}"
|
26
|
-
return false
|
27
|
-
end
|
28
|
-
|
29
|
-
unless File.readable?(directory_path)
|
30
|
-
Aircana.human_logger.error "Directory not readable: #{directory_path}"
|
31
|
-
return false
|
32
|
-
end
|
33
|
-
|
34
|
-
true
|
35
|
-
end
|
36
|
-
|
37
|
-
def log_no_files_found(directory_path)
|
38
|
-
Aircana.human_logger.info "No files found in directory: #{directory_path}"
|
39
|
-
end
|
40
|
-
|
41
|
-
def confirm_large_operation?(file_count, directory_path)
|
42
|
-
return true if file_count <= 50
|
43
|
-
|
44
|
-
show_large_operation_warning(file_count, directory_path)
|
45
|
-
TTY::Prompt.new.yes?("Continue with adding #{file_count} files?")
|
46
|
-
end
|
47
|
-
|
48
|
-
def show_large_operation_warning(file_count, directory_path)
|
49
|
-
estimated_size = estimate_total_size(directory_path, file_count)
|
50
|
-
Aircana.human_logger.warn "Large directory operation detected:"
|
51
|
-
Aircana.human_logger.info " Directory: #{directory_path}"
|
52
|
-
Aircana.human_logger.info " Files: #{file_count}"
|
53
|
-
Aircana.human_logger.info " Estimated size: #{estimated_size}"
|
54
|
-
Aircana.human_logger.warn " This may result in high token usage with Claude"
|
55
|
-
end
|
56
|
-
|
57
|
-
def estimate_total_size(directory_path, file_count)
|
58
|
-
sample_files = get_sample_files(directory_path, file_count)
|
59
|
-
return "Unknown" if sample_files.empty?
|
60
|
-
|
61
|
-
total_bytes = calculate_sample_size(sample_files)
|
62
|
-
estimated_total = extrapolate_total_size(total_bytes, sample_files.size, file_count)
|
63
|
-
format_file_size(estimated_total)
|
64
|
-
end
|
65
|
-
|
66
|
-
def get_sample_files(directory_path, file_count)
|
67
|
-
Dir.glob(File.join(directory_path, "**", "*"))
|
68
|
-
.reject { |f| File.directory?(f) }
|
69
|
-
.sample([file_count, 10].min)
|
70
|
-
end
|
71
|
-
|
72
|
-
def calculate_sample_size(sample_files)
|
73
|
-
sample_files.sum do |f|
|
74
|
-
File.size(f)
|
75
|
-
rescue StandardError
|
76
|
-
0
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def extrapolate_total_size(total_bytes, sample_size, file_count)
|
81
|
-
avg_size = total_bytes / sample_size.to_f
|
82
|
-
(avg_size * file_count).to_i
|
83
|
-
end
|
84
|
-
|
85
|
-
def format_file_size(bytes)
|
86
|
-
units = %w[B KB MB GB]
|
87
|
-
size = bytes.to_f
|
88
|
-
unit_index = 0
|
89
|
-
|
90
|
-
while size >= 1024 && unit_index < units.length - 1
|
91
|
-
size /= 1024
|
92
|
-
unit_index += 1
|
93
|
-
end
|
94
|
-
|
95
|
-
"#{size.round(1)} #{units[unit_index]}"
|
96
|
-
end
|
97
|
-
|
98
|
-
def process_files(directory_path, selected_files)
|
99
|
-
file_count = selected_files.length
|
100
|
-
Aircana.human_logger.info "Found #{file_count} files in directory: #{directory_path}"
|
101
|
-
|
102
|
-
ProgressTracker.with_spinner("Adding #{file_count} files to context") do
|
103
|
-
Contexts::RelevantFiles.add(selected_files)
|
104
|
-
end
|
105
|
-
|
106
|
-
Aircana.human_logger.success "Successfully added #{file_count} files from directory"
|
107
|
-
end
|
108
|
-
|
109
|
-
def log_token_warning(file_count)
|
110
|
-
Aircana.human_logger.warn "Large number of files (#{file_count}) may result in high token usage"
|
111
|
-
end
|
112
|
-
|
113
|
-
def collect_files_recursively(directory_path)
|
114
|
-
Dir.glob(File.join(directory_path, "**", "*"), File::FNM_DOTMATCH)
|
115
|
-
.reject { |path| File.directory?(path) }
|
116
|
-
.reject { |path| should_ignore_file?(path) }
|
117
|
-
end
|
118
|
-
|
119
|
-
def should_ignore_file?(file_path)
|
120
|
-
ignore_patterns.any? { |pattern| file_path.match?(pattern) }
|
121
|
-
end
|
122
|
-
|
123
|
-
def ignore_patterns
|
124
|
-
directory_patterns + file_patterns
|
125
|
-
end
|
126
|
-
|
127
|
-
def directory_patterns
|
128
|
-
[
|
129
|
-
%r{/\.git/}, %r{/node_modules/}, %r{/\.vscode/}, %r{/\.idea/},
|
130
|
-
%r{/coverage/}, %r{/dist/}, %r{/build/}, %r{/tmp/}, %r{/vendor/},
|
131
|
-
%r{/\.bundle/}, %r{/\.rvm/}, %r{/\.rbenv/}
|
132
|
-
]
|
133
|
-
end
|
134
|
-
|
135
|
-
def file_patterns
|
136
|
-
[
|
137
|
-
%r{/\.DS_Store$}, %r{/log/.*\.log$},
|
138
|
-
/\.(jpg|jpeg|png|gif|bmp|tiff|svg|ico|webp)$/i,
|
139
|
-
/\.(mp4|avi|mkv|mov|wmv|flv|webm)$/i,
|
140
|
-
/\.(mp3|wav|flac|aac|ogg)$/i,
|
141
|
-
/\.(zip|tar|gz|rar|7z|bz2)$/i,
|
142
|
-
/\.(exe|dll|so|dylib)$/i
|
143
|
-
]
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "../shell_command"
|
4
|
-
require_relative "../../contexts/relevant_files"
|
5
|
-
|
6
|
-
module Aircana
|
7
|
-
module CLI
|
8
|
-
module AddFiles
|
9
|
-
class << self
|
10
|
-
def run
|
11
|
-
selected_files = FzfHelper.select_files_interactively(
|
12
|
-
header: "Select files for Claude context (Ctrl+A: select all, ?: toggle preview)"
|
13
|
-
)
|
14
|
-
|
15
|
-
if selected_files.empty?
|
16
|
-
Aircana.human_logger.info "No files selected. Exiting."
|
17
|
-
return
|
18
|
-
end
|
19
|
-
|
20
|
-
Aircana.human_logger.success "Selected #{selected_files.size} files for context"
|
21
|
-
Contexts::RelevantFiles.add(selected_files)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "../shell_command"
|
4
|
-
require_relative "../../contexts/relevant_files"
|
5
|
-
|
6
|
-
module Aircana
|
7
|
-
module CLI
|
8
|
-
module ClearFiles
|
9
|
-
class << self
|
10
|
-
def run
|
11
|
-
Contexts::RelevantFiles.remove_all
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "add_files"
|
4
|
-
require_relative "add_directory"
|
5
|
-
require_relative "clear_files"
|
6
|
-
require_relative "../../contexts/relevant_files"
|
7
|
-
|
8
|
-
module Aircana
|
9
|
-
module CLI
|
10
|
-
module Files
|
11
|
-
class << self
|
12
|
-
def add
|
13
|
-
AddFiles.run
|
14
|
-
end
|
15
|
-
|
16
|
-
def add_dir(directory_path)
|
17
|
-
AddDirectory.run(directory_path)
|
18
|
-
end
|
19
|
-
|
20
|
-
def clear
|
21
|
-
ClearFiles.run
|
22
|
-
end
|
23
|
-
|
24
|
-
def list
|
25
|
-
relevant_files_dir = Aircana.configuration.relevant_project_files_dir
|
26
|
-
return print_no_directory_message unless Dir.exist?(relevant_files_dir)
|
27
|
-
|
28
|
-
files = get_tracked_files(relevant_files_dir)
|
29
|
-
return print_no_files_message if files.empty?
|
30
|
-
|
31
|
-
print_files_list(files)
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def print_no_directory_message
|
37
|
-
Aircana.human_logger.info(
|
38
|
-
"No relevant files directory found. Use 'aircana files add' to start tracking files."
|
39
|
-
)
|
40
|
-
end
|
41
|
-
|
42
|
-
def print_no_files_message
|
43
|
-
Aircana.human_logger.info("No relevant files currently tracked.")
|
44
|
-
end
|
45
|
-
|
46
|
-
def get_tracked_files(relevant_files_dir)
|
47
|
-
Dir.glob("#{relevant_files_dir}/*").map do |link|
|
48
|
-
File.readlink(link)
|
49
|
-
rescue StandardError
|
50
|
-
link
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def print_files_list(files)
|
55
|
-
Aircana.human_logger.info("Current relevant files:")
|
56
|
-
files.each_with_index do |file, index|
|
57
|
-
relative_path = file.start_with?(Dir.pwd) ? file.gsub("#{Dir.pwd}/", "") : file
|
58
|
-
Aircana.human_logger.info(" #{index + 1}. #{relative_path}")
|
59
|
-
end
|
60
|
-
Aircana.human_logger.info("\nTotal: #{files.length} files")
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|