aircana 4.4.0 → 5.0.0.rc1
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 +185 -187
- data/CHANGELOG.md +24 -0
- data/lib/aircana/cli/app.rb +1 -1
- data/lib/aircana/cli/commands/init.rb +0 -1
- data/lib/aircana/cli/commands/kb.rb +17 -211
- data/lib/aircana/contexts/confluence.rb +11 -14
- data/lib/aircana/contexts/confluence_content.rb +2 -3
- data/lib/aircana/contexts/local.rb +1 -1
- data/lib/aircana/contexts/manifest.rb +8 -31
- data/lib/aircana/contexts/web.rb +11 -14
- data/lib/aircana/generators/hooks_generator.rb +0 -2
- data/lib/aircana/version.rb +1 -1
- metadata +2 -3
- data/lib/aircana/templates/hooks/refresh_skills.erb +0 -121
|
@@ -11,7 +11,6 @@ module Aircana
|
|
|
11
11
|
post_tool_use
|
|
12
12
|
user_prompt_submit
|
|
13
13
|
session_start
|
|
14
|
-
refresh_skills
|
|
15
14
|
notification_sqs
|
|
16
15
|
rubocop_pre_commit
|
|
17
16
|
rspec_test
|
|
@@ -21,7 +20,6 @@ module Aircana
|
|
|
21
20
|
# Default hooks that are auto-installed
|
|
22
21
|
DEFAULT_HOOK_TYPES = %w[
|
|
23
22
|
session_start
|
|
24
|
-
refresh_skills
|
|
25
23
|
notification_sqs
|
|
26
24
|
].freeze
|
|
27
25
|
|
data/lib/aircana/version.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: 5.0.0.rc1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Weston Dransfield
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-01-
|
|
10
|
+
date: 2026-01-28 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: httparty
|
|
@@ -163,7 +163,6 @@ files:
|
|
|
163
163
|
- lib/aircana/templates/hooks/notification_sqs.erb
|
|
164
164
|
- lib/aircana/templates/hooks/post_tool_use.erb
|
|
165
165
|
- lib/aircana/templates/hooks/pre_tool_use.erb
|
|
166
|
-
- lib/aircana/templates/hooks/refresh_skills.erb
|
|
167
166
|
- lib/aircana/templates/hooks/rspec_test.erb
|
|
168
167
|
- lib/aircana/templates/hooks/rubocop_pre_commit.erb
|
|
169
168
|
- lib/aircana/templates/hooks/session_start.erb
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Auto-refresh remote knowledge bases on session start
|
|
3
|
-
# Runs at most once per 24 hours to avoid API rate limits
|
|
4
|
-
# Only refreshes remote KBs, skips local KBs
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
# Create log directory if it doesn't exist
|
|
9
|
-
mkdir -p ~/.aircana
|
|
10
|
-
LOG_FILE="$HOME/.aircana/hooks.log"
|
|
11
|
-
|
|
12
|
-
# Claude Code provides this environment variable
|
|
13
|
-
PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT}"
|
|
14
|
-
|
|
15
|
-
if [ -z "$PLUGIN_ROOT" ]; then
|
|
16
|
-
echo "$(date): Warning - CLAUDE_PLUGIN_ROOT not set, skipping KB refresh" >> "$LOG_FILE"
|
|
17
|
-
echo "{}"
|
|
18
|
-
exit 0
|
|
19
|
-
fi
|
|
20
|
-
|
|
21
|
-
TIMESTAMP_FILE="${PLUGIN_ROOT}/.last_refresh"
|
|
22
|
-
REFRESH_INTERVAL_SECONDS=86400 # 24 hours
|
|
23
|
-
|
|
24
|
-
# Check if we've refreshed recently
|
|
25
|
-
if [ -f "$TIMESTAMP_FILE" ]; then
|
|
26
|
-
LAST_REFRESH=$(cat "$TIMESTAMP_FILE")
|
|
27
|
-
CURRENT_TIME=$(date +%s)
|
|
28
|
-
TIME_DIFF=$((CURRENT_TIME - LAST_REFRESH))
|
|
29
|
-
|
|
30
|
-
if [ $TIME_DIFF -lt $REFRESH_INTERVAL_SECONDS ]; then
|
|
31
|
-
HOURS_SINCE=$((TIME_DIFF / 3600))
|
|
32
|
-
echo "$(date): Knowledge bases refreshed ${HOURS_SINCE}h ago, skipping refresh" >> "$LOG_FILE"
|
|
33
|
-
echo "{}"
|
|
34
|
-
exit 0
|
|
35
|
-
fi
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
# Tell aircana where the plugin lives
|
|
39
|
-
export AIRCANA_PLUGIN_ROOT="$PLUGIN_ROOT"
|
|
40
|
-
|
|
41
|
-
echo "$(date): Starting knowledge base refresh from plugin root: $PLUGIN_ROOT" >> "$LOG_FILE"
|
|
42
|
-
|
|
43
|
-
# Find all knowledge bases in agents directory
|
|
44
|
-
AGENTS_DIR="${PLUGIN_ROOT}/agents"
|
|
45
|
-
|
|
46
|
-
if [ ! -d "$AGENTS_DIR" ]; then
|
|
47
|
-
echo "$(date): No agents directory found, skipping refresh" >> "$LOG_FILE"
|
|
48
|
-
echo "{}"
|
|
49
|
-
exit 0
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
# Track if we refreshed any KBs
|
|
53
|
-
REFRESHED_COUNT=0
|
|
54
|
-
SKIPPED_COUNT=0
|
|
55
|
-
|
|
56
|
-
# Iterate through each KB directory
|
|
57
|
-
for kb_dir in "${AGENTS_DIR}"/*/ ; do
|
|
58
|
-
# Skip if no directories found
|
|
59
|
-
[ -d "$kb_dir" ] || continue
|
|
60
|
-
|
|
61
|
-
kb_name=$(basename "$kb_dir")
|
|
62
|
-
manifest_file="${kb_dir}manifest.json"
|
|
63
|
-
|
|
64
|
-
# Skip if no manifest exists
|
|
65
|
-
if [ ! -f "$manifest_file" ]; then
|
|
66
|
-
echo "$(date): No manifest found for KB '$kb_name', skipping" >> "$LOG_FILE"
|
|
67
|
-
continue
|
|
68
|
-
fi
|
|
69
|
-
|
|
70
|
-
# Determine KB type from manifest (default to remote if not specified)
|
|
71
|
-
kb_type="remote"
|
|
72
|
-
|
|
73
|
-
# Try to parse with jq if available, otherwise use grep
|
|
74
|
-
if command -v jq >/dev/null 2>&1; then
|
|
75
|
-
kb_type=$(jq -r '.kb_type // "remote"' "$manifest_file" 2>/dev/null || echo "remote")
|
|
76
|
-
else
|
|
77
|
-
# Fallback: grep for kb_type field
|
|
78
|
-
if grep -q '"kb_type"[[:space:]]*:[[:space:]]*"local"' "$manifest_file" 2>/dev/null; then
|
|
79
|
-
kb_type="local"
|
|
80
|
-
fi
|
|
81
|
-
fi
|
|
82
|
-
|
|
83
|
-
# Only refresh remote KBs
|
|
84
|
-
if [ "$kb_type" = "local" ]; then
|
|
85
|
-
echo "$(date): Skipping local KB '$kb_name'" >> "$LOG_FILE"
|
|
86
|
-
SKIPPED_COUNT=$((SKIPPED_COUNT + 1))
|
|
87
|
-
continue
|
|
88
|
-
fi
|
|
89
|
-
|
|
90
|
-
# Refresh remote KB
|
|
91
|
-
echo "$(date): Refreshing remote KB '$kb_name'" >> "$LOG_FILE"
|
|
92
|
-
if aircana kb refresh "$kb_name" >> "$LOG_FILE" 2>&1; then
|
|
93
|
-
echo "$(date): Successfully refreshed KB '$kb_name'" >> "$LOG_FILE"
|
|
94
|
-
REFRESHED_COUNT=$((REFRESHED_COUNT + 1))
|
|
95
|
-
else
|
|
96
|
-
echo "$(date): Warning - Failed to refresh KB '$kb_name'" >> "$LOG_FILE"
|
|
97
|
-
fi
|
|
98
|
-
done
|
|
99
|
-
|
|
100
|
-
# Update timestamp on completion (even if some refreshes failed)
|
|
101
|
-
date +%s > "$TIMESTAMP_FILE"
|
|
102
|
-
|
|
103
|
-
# Log summary
|
|
104
|
-
echo "$(date): KB refresh completed - refreshed: $REFRESHED_COUNT, skipped (local): $SKIPPED_COUNT" >> "$LOG_FILE"
|
|
105
|
-
|
|
106
|
-
# Return success with context
|
|
107
|
-
if [ $REFRESHED_COUNT -gt 0 ]; then
|
|
108
|
-
CONTEXT="Refreshed $REFRESHED_COUNT remote knowledge base(s)"
|
|
109
|
-
else
|
|
110
|
-
CONTEXT="No remote knowledge bases to refresh"
|
|
111
|
-
fi
|
|
112
|
-
|
|
113
|
-
ESCAPED_CONTEXT=$(echo -n "$CONTEXT" | sed 's/"/\\"/g')
|
|
114
|
-
cat << EOF
|
|
115
|
-
{
|
|
116
|
-
"hookSpecificOutput": {
|
|
117
|
-
"hookEventName": "SessionStart",
|
|
118
|
-
"additionalContext": "$ESCAPED_CONTEXT"
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
EOF
|