@prmichaelsen/acp-mcp 0.1.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.
- package/.env.example +5 -0
- package/AGENT.md +1279 -0
- package/README.md +78 -0
- package/agent/commands/acp.command-create.md +372 -0
- package/agent/commands/acp.design-create.md +224 -0
- package/agent/commands/acp.init.md +410 -0
- package/agent/commands/acp.package-create.md +894 -0
- package/agent/commands/acp.package-info.md +211 -0
- package/agent/commands/acp.package-install.md +461 -0
- package/agent/commands/acp.package-list.md +279 -0
- package/agent/commands/acp.package-publish.md +540 -0
- package/agent/commands/acp.package-remove.md +292 -0
- package/agent/commands/acp.package-search.md +306 -0
- package/agent/commands/acp.package-update.md +310 -0
- package/agent/commands/acp.package-validate.md +535 -0
- package/agent/commands/acp.pattern-create.md +326 -0
- package/agent/commands/acp.plan.md +552 -0
- package/agent/commands/acp.proceed.md +336 -0
- package/agent/commands/acp.project-create.md +672 -0
- package/agent/commands/acp.report.md +394 -0
- package/agent/commands/acp.resume.md +237 -0
- package/agent/commands/acp.status.md +280 -0
- package/agent/commands/acp.sync.md +363 -0
- package/agent/commands/acp.task-create.md +390 -0
- package/agent/commands/acp.update.md +301 -0
- package/agent/commands/acp.validate.md +436 -0
- package/agent/commands/acp.version-check-for-updates.md +275 -0
- package/agent/commands/acp.version-check.md +190 -0
- package/agent/commands/acp.version-update.md +288 -0
- package/agent/commands/command.template.md +316 -0
- package/agent/commands/git.commit.md +513 -0
- package/agent/commands/git.init.md +513 -0
- package/agent/commands/mcp-server-starter.add-tool.md +677 -0
- package/agent/commands/mcp-server-starter.init.md +894 -0
- package/agent/design/.gitkeep +0 -0
- package/agent/design/design.template.md +136 -0
- package/agent/design/remember-mcp-analysis.md +987 -0
- package/agent/design/requirements.template.md +387 -0
- package/agent/manifest.template.yaml +13 -0
- package/agent/manifest.yaml +109 -0
- package/agent/milestones/.gitkeep +0 -0
- package/agent/milestones/milestone-1-{title}.template.md +206 -0
- package/agent/package.template.yaml +36 -0
- package/agent/patterns/.gitkeep +0 -0
- package/agent/patterns/bootstrap.template.md +1237 -0
- package/agent/patterns/mcp-server-starter.bootstrap.md +597 -0
- package/agent/patterns/mcp-server-starter.build-config.md +554 -0
- package/agent/patterns/mcp-server-starter.config-management.md +525 -0
- package/agent/patterns/mcp-server-starter.server-factory.md +616 -0
- package/agent/patterns/mcp-server-starter.server-standalone.md +642 -0
- package/agent/patterns/mcp-server-starter.test-config.md +558 -0
- package/agent/patterns/mcp-server-starter.tool-creation.md +653 -0
- package/agent/patterns/pattern.template.md +364 -0
- package/agent/progress.template.yaml +161 -0
- package/agent/progress.yaml +33 -0
- package/agent/schemas/package.schema.yaml +161 -0
- package/agent/scripts/acp.common.sh +1362 -0
- package/agent/scripts/acp.install.sh +213 -0
- package/agent/scripts/acp.package-create.sh +925 -0
- package/agent/scripts/acp.package-info.sh +270 -0
- package/agent/scripts/acp.package-install.sh +550 -0
- package/agent/scripts/acp.package-list.sh +263 -0
- package/agent/scripts/acp.package-publish.sh +420 -0
- package/agent/scripts/acp.package-remove.sh +272 -0
- package/agent/scripts/acp.package-search.sh +156 -0
- package/agent/scripts/acp.package-update.sh +356 -0
- package/agent/scripts/acp.package-validate.sh +766 -0
- package/agent/scripts/acp.uninstall.sh +85 -0
- package/agent/scripts/acp.version-check-for-updates.sh +98 -0
- package/agent/scripts/acp.version-check.sh +47 -0
- package/agent/scripts/acp.version-update.sh +158 -0
- package/agent/scripts/acp.yaml-parser.sh +736 -0
- package/agent/scripts/acp.yaml-validate.sh +205 -0
- package/agent/tasks/.gitkeep +0 -0
- package/agent/tasks/task-1-{title}.template.md +225 -0
- package/dist/config.d.ts +4 -0
- package/dist/server-factory.d.ts +9 -0
- package/dist/server-factory.js +99 -0
- package/dist/server-factory.js.map +7 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +106 -0
- package/dist/server.js.map +7 -0
- package/dist/tools/acp-remote-list-files.d.ts +15 -0
- package/dist/types/ssh-config.d.ts +16 -0
- package/esbuild.build.js +34 -0
- package/esbuild.watch.js +31 -0
- package/jest.config.js +31 -0
- package/package.json +54 -0
- package/src/config.ts +16 -0
- package/src/server-factory.ts +43 -0
- package/src/server.ts +46 -0
- package/src/tools/acp-remote-list-files.ts +89 -0
- package/src/types/ssh-config.ts +17 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Agent Context Protocol (ACP) Package Remove Script
|
|
4
|
+
# Removes installed ACP packages and updates manifest
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
# Source common utilities
|
|
9
|
+
SCRIPT_DIR="$(dirname "$0")"
|
|
10
|
+
. "${SCRIPT_DIR}/acp.common.sh"
|
|
11
|
+
|
|
12
|
+
# Initialize colors
|
|
13
|
+
init_colors
|
|
14
|
+
|
|
15
|
+
# Parse arguments
|
|
16
|
+
PACKAGE_NAME=""
|
|
17
|
+
AUTO_CONFIRM=false
|
|
18
|
+
KEEP_MODIFIED=false
|
|
19
|
+
GLOBAL_MODE=false
|
|
20
|
+
|
|
21
|
+
while [[ $# -gt 0 ]]; do
|
|
22
|
+
case $1 in
|
|
23
|
+
--global|-g)
|
|
24
|
+
GLOBAL_MODE=true
|
|
25
|
+
shift
|
|
26
|
+
;;
|
|
27
|
+
-y|--yes)
|
|
28
|
+
AUTO_CONFIRM=true
|
|
29
|
+
shift
|
|
30
|
+
;;
|
|
31
|
+
--keep-modified)
|
|
32
|
+
KEEP_MODIFIED=true
|
|
33
|
+
shift
|
|
34
|
+
;;
|
|
35
|
+
*)
|
|
36
|
+
PACKAGE_NAME="$1"
|
|
37
|
+
shift
|
|
38
|
+
;;
|
|
39
|
+
esac
|
|
40
|
+
done
|
|
41
|
+
|
|
42
|
+
# Check if package name provided
|
|
43
|
+
if [ -z "$PACKAGE_NAME" ]; then
|
|
44
|
+
echo "${RED}Error: Package name required${NC}"
|
|
45
|
+
echo "Usage: $0 [options] <package-name>"
|
|
46
|
+
echo ""
|
|
47
|
+
echo "Options:"
|
|
48
|
+
echo " --global, -g Remove global package"
|
|
49
|
+
echo " -y, --yes Skip confirmation prompts"
|
|
50
|
+
echo " --keep-modified Keep locally modified files"
|
|
51
|
+
echo ""
|
|
52
|
+
echo "Example: $0 firebase"
|
|
53
|
+
echo "Example: $0 --global firebase"
|
|
54
|
+
echo "Example: $0 --keep-modified firebase"
|
|
55
|
+
exit 1
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
echo "${BLUE}📦 ACP Package Remover${NC}"
|
|
59
|
+
echo "========================================"
|
|
60
|
+
echo ""
|
|
61
|
+
|
|
62
|
+
# Determine manifest file based on mode
|
|
63
|
+
if [ "$GLOBAL_MODE" = true ]; then
|
|
64
|
+
MANIFEST_FILE="$HOME/.acp/manifest.yaml"
|
|
65
|
+
echo "${BLUE}Removing global package: $PACKAGE_NAME${NC}"
|
|
66
|
+
echo ""
|
|
67
|
+
else
|
|
68
|
+
MANIFEST_FILE="./agent/manifest.yaml"
|
|
69
|
+
echo "${BLUE}Removing package: $PACKAGE_NAME${NC}"
|
|
70
|
+
echo ""
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# Check if manifest exists
|
|
74
|
+
if [ ! -f "$MANIFEST_FILE" ]; then
|
|
75
|
+
if [ "$GLOBAL_MODE" = true ]; then
|
|
76
|
+
die "No global manifest found. No global packages installed."
|
|
77
|
+
else
|
|
78
|
+
die "No manifest found. No packages installed."
|
|
79
|
+
fi
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
# Source YAML parser
|
|
83
|
+
source_yaml_parser
|
|
84
|
+
|
|
85
|
+
# Check if package is installed
|
|
86
|
+
if ! package_exists "$PACKAGE_NAME"; then
|
|
87
|
+
die "Package not installed: $PACKAGE_NAME"
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# Get package info
|
|
91
|
+
version=$(awk -v pkg="$PACKAGE_NAME" '
|
|
92
|
+
$0 ~ "^ " pkg ":" { in_pkg=1; next }
|
|
93
|
+
in_pkg && /^ [a-z]/ { in_pkg=0 }
|
|
94
|
+
in_pkg && /^ package_version:/ { print $2; exit }
|
|
95
|
+
' "$MANIFEST_FILE")
|
|
96
|
+
|
|
97
|
+
echo "Package: ${GREEN}$PACKAGE_NAME${NC} ($version)"
|
|
98
|
+
echo ""
|
|
99
|
+
|
|
100
|
+
# Get installed files
|
|
101
|
+
patterns_files=$(awk -v pkg="$PACKAGE_NAME" '
|
|
102
|
+
BEGIN { in_pkg=0; in_patterns=0 }
|
|
103
|
+
$0 ~ "^ " pkg ":" { in_pkg=1; next }
|
|
104
|
+
in_pkg && /^ [a-z]/ { in_pkg=0 }
|
|
105
|
+
in_pkg && /^ patterns:/ { in_patterns=1; next }
|
|
106
|
+
in_patterns && /^ [a-z]/ { in_patterns=0 }
|
|
107
|
+
in_patterns && /^ - name:/ { print $3 }
|
|
108
|
+
' "$MANIFEST_FILE")
|
|
109
|
+
|
|
110
|
+
commands_files=$(awk -v pkg="$PACKAGE_NAME" '
|
|
111
|
+
BEGIN { in_pkg=0; in_commands=0 }
|
|
112
|
+
$0 ~ "^ " pkg ":" { in_pkg=1; next }
|
|
113
|
+
in_pkg && /^ [a-z]/ { in_pkg=0 }
|
|
114
|
+
in_pkg && /^ commands:/ { in_commands=1; next }
|
|
115
|
+
in_commands && /^ [a-z]/ { in_commands=0 }
|
|
116
|
+
in_commands && /^ - name:/ { print $3 }
|
|
117
|
+
' "$MANIFEST_FILE")
|
|
118
|
+
|
|
119
|
+
designs_files=$(awk -v pkg="$PACKAGE_NAME" '
|
|
120
|
+
BEGIN { in_pkg=0; in_designs=0 }
|
|
121
|
+
$0 ~ "^ " pkg ":" { in_pkg=1; next }
|
|
122
|
+
in_pkg && /^ [a-z]/ { in_pkg=0 }
|
|
123
|
+
in_pkg && /^ designs:/ { in_designs=1; next }
|
|
124
|
+
in_designs && /^ [a-z]/ { in_designs=0 }
|
|
125
|
+
in_designs && /^ - name:/ { print $3 }
|
|
126
|
+
' "$MANIFEST_FILE")
|
|
127
|
+
|
|
128
|
+
# Count files (handle empty strings properly)
|
|
129
|
+
if [ -n "$patterns_files" ]; then
|
|
130
|
+
patterns_count=$(echo "$patterns_files" | wc -l)
|
|
131
|
+
else
|
|
132
|
+
patterns_count=0
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
if [ -n "$commands_files" ]; then
|
|
136
|
+
commands_count=$(echo "$commands_files" | wc -l)
|
|
137
|
+
else
|
|
138
|
+
commands_count=0
|
|
139
|
+
fi
|
|
140
|
+
|
|
141
|
+
if [ -n "$designs_files" ]; then
|
|
142
|
+
designs_count=$(echo "$designs_files" | wc -l)
|
|
143
|
+
else
|
|
144
|
+
designs_count=0
|
|
145
|
+
fi
|
|
146
|
+
|
|
147
|
+
total_files=$((patterns_count + commands_count + designs_count))
|
|
148
|
+
|
|
149
|
+
echo "${YELLOW}⚠️ This will remove:${NC}"
|
|
150
|
+
[ "$patterns_count" -gt 0 ] && echo " - $patterns_count pattern(s)"
|
|
151
|
+
[ "$commands_count" -gt 0 ] && echo " - $commands_count command(s)"
|
|
152
|
+
[ "$designs_count" -gt 0 ] && echo " - $designs_count design(s)"
|
|
153
|
+
echo ""
|
|
154
|
+
echo "Total: $total_files file(s)"
|
|
155
|
+
echo ""
|
|
156
|
+
|
|
157
|
+
# Check for modified files
|
|
158
|
+
modified_files=()
|
|
159
|
+
for file in $patterns_files; do
|
|
160
|
+
if is_file_modified "$PACKAGE_NAME" "patterns" "$file"; then
|
|
161
|
+
modified_files+=("patterns/$file")
|
|
162
|
+
fi
|
|
163
|
+
done
|
|
164
|
+
|
|
165
|
+
for file in $commands_files; do
|
|
166
|
+
if is_file_modified "$PACKAGE_NAME" "commands" "$file"; then
|
|
167
|
+
modified_files+=("commands/$file")
|
|
168
|
+
fi
|
|
169
|
+
done
|
|
170
|
+
|
|
171
|
+
for file in $designs_files; do
|
|
172
|
+
if is_file_modified "$PACKAGE_NAME" "design" "$file"; then
|
|
173
|
+
modified_files+=("design/$file")
|
|
174
|
+
fi
|
|
175
|
+
done
|
|
176
|
+
|
|
177
|
+
if [ ${#modified_files[@]} -gt 0 ]; then
|
|
178
|
+
echo "${YELLOW}⚠️ Modified files detected:${NC}"
|
|
179
|
+
for file in "${modified_files[@]}"; do
|
|
180
|
+
echo " - $file"
|
|
181
|
+
done
|
|
182
|
+
echo ""
|
|
183
|
+
|
|
184
|
+
if [ "$KEEP_MODIFIED" = true ]; then
|
|
185
|
+
echo "Modified files will be kept (--keep-modified)"
|
|
186
|
+
echo ""
|
|
187
|
+
fi
|
|
188
|
+
fi
|
|
189
|
+
|
|
190
|
+
# Confirm removal
|
|
191
|
+
if [ "$AUTO_CONFIRM" = false ]; then
|
|
192
|
+
read -p "Remove package '$PACKAGE_NAME'? (y/N) " -n 1 -r
|
|
193
|
+
echo
|
|
194
|
+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
195
|
+
echo "Removal cancelled"
|
|
196
|
+
exit 0
|
|
197
|
+
fi
|
|
198
|
+
fi
|
|
199
|
+
|
|
200
|
+
echo ""
|
|
201
|
+
echo "Removing files..."
|
|
202
|
+
|
|
203
|
+
# Remove files
|
|
204
|
+
removed_count=0
|
|
205
|
+
kept_count=0
|
|
206
|
+
|
|
207
|
+
for file in $patterns_files; do
|
|
208
|
+
if printf '%s\n' "${modified_files[@]}" | grep -q "^patterns/$file$" && [ "$KEEP_MODIFIED" = true ]; then
|
|
209
|
+
echo " ${YELLOW}⊙${NC} Kept patterns/$file (modified)"
|
|
210
|
+
kept_count=$((kept_count + 1))
|
|
211
|
+
else
|
|
212
|
+
if [ -f "agent/patterns/$file" ]; then
|
|
213
|
+
rm "agent/patterns/$file"
|
|
214
|
+
echo " ${GREEN}✓${NC} Removed patterns/$file"
|
|
215
|
+
removed_count=$((removed_count + 1))
|
|
216
|
+
fi
|
|
217
|
+
fi
|
|
218
|
+
done
|
|
219
|
+
|
|
220
|
+
for file in $commands_files; do
|
|
221
|
+
if printf '%s\n' "${modified_files[@]}" | grep -q "^commands/$file$" && [ "$KEEP_MODIFIED" = true ]; then
|
|
222
|
+
echo " ${YELLOW}⊙${NC} Kept commands/$file (modified)"
|
|
223
|
+
kept_count=$((kept_count + 1))
|
|
224
|
+
else
|
|
225
|
+
if [ -f "agent/commands/$file" ]; then
|
|
226
|
+
rm "agent/commands/$file"
|
|
227
|
+
echo " ${GREEN}✓${NC} Removed commands/$file"
|
|
228
|
+
removed_count=$((removed_count + 1))
|
|
229
|
+
fi
|
|
230
|
+
fi
|
|
231
|
+
done
|
|
232
|
+
|
|
233
|
+
for file in $designs_files; do
|
|
234
|
+
if printf '%s\n' "${modified_files[@]}" | grep -q "^design/$file$" && [ "$KEEP_MODIFIED" = true ]; then
|
|
235
|
+
echo " ${YELLOW}⊙${NC} Kept design/$file (modified)"
|
|
236
|
+
kept_count=$((kept_count + 1))
|
|
237
|
+
else
|
|
238
|
+
if [ -f "agent/design/$file" ]; then
|
|
239
|
+
rm "agent/design/$file"
|
|
240
|
+
echo " ${GREEN}✓${NC} Removed design/$file"
|
|
241
|
+
removed_count=$((removed_count + 1))
|
|
242
|
+
fi
|
|
243
|
+
fi
|
|
244
|
+
done
|
|
245
|
+
|
|
246
|
+
# Remove package from manifest
|
|
247
|
+
echo ""
|
|
248
|
+
echo "Updating manifest..."
|
|
249
|
+
|
|
250
|
+
temp_file=$(mktemp)
|
|
251
|
+
awk -v pkg="$PACKAGE_NAME" '
|
|
252
|
+
BEGIN { in_pkg=0; skip=0 }
|
|
253
|
+
$0 ~ "^ " pkg ":" { in_pkg=1; skip=1; next }
|
|
254
|
+
in_pkg && /^ [a-z]/ && /:$/ { in_pkg=0; skip=0 }
|
|
255
|
+
in_pkg { next }
|
|
256
|
+
!skip { print }
|
|
257
|
+
' "$MANIFEST_FILE" > "$temp_file"
|
|
258
|
+
|
|
259
|
+
mv "$temp_file" "$MANIFEST_FILE"
|
|
260
|
+
|
|
261
|
+
# Update manifest timestamp
|
|
262
|
+
update_manifest_timestamp
|
|
263
|
+
|
|
264
|
+
echo "${GREEN}✓${NC} Manifest updated"
|
|
265
|
+
echo ""
|
|
266
|
+
echo "${GREEN}✅ Removal complete!${NC}"
|
|
267
|
+
echo ""
|
|
268
|
+
echo "Removed: $removed_count file(s)"
|
|
269
|
+
if [ $kept_count -gt 0 ]; then
|
|
270
|
+
echo "Kept: $kept_count file(s) (modified)"
|
|
271
|
+
fi
|
|
272
|
+
echo ""
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Agent Context Protocol (ACP) Package Search Script
|
|
4
|
+
# Search for ACP packages on GitHub using the GitHub API
|
|
5
|
+
|
|
6
|
+
# Note: set -e disabled because while loop runs in subshell
|
|
7
|
+
# and some commands may return non-zero without being errors
|
|
8
|
+
# set -e
|
|
9
|
+
|
|
10
|
+
# Source common utilities
|
|
11
|
+
SCRIPT_DIR="$(dirname "$0")"
|
|
12
|
+
. "${SCRIPT_DIR}/acp.common.sh"
|
|
13
|
+
|
|
14
|
+
# Initialize colors
|
|
15
|
+
init_colors
|
|
16
|
+
|
|
17
|
+
# Parse arguments
|
|
18
|
+
QUERY=""
|
|
19
|
+
TAG=""
|
|
20
|
+
USER=""
|
|
21
|
+
ORG=""
|
|
22
|
+
SORT="stars"
|
|
23
|
+
LIMIT=10
|
|
24
|
+
|
|
25
|
+
while [[ $# -gt 0 ]]; do
|
|
26
|
+
case $1 in
|
|
27
|
+
--tag)
|
|
28
|
+
TAG="$2"
|
|
29
|
+
shift 2
|
|
30
|
+
;;
|
|
31
|
+
--user)
|
|
32
|
+
USER="$2"
|
|
33
|
+
shift 2
|
|
34
|
+
;;
|
|
35
|
+
--org)
|
|
36
|
+
ORG="$2"
|
|
37
|
+
shift 2
|
|
38
|
+
;;
|
|
39
|
+
--sort)
|
|
40
|
+
SORT="$2"
|
|
41
|
+
shift 2
|
|
42
|
+
;;
|
|
43
|
+
--limit)
|
|
44
|
+
LIMIT="$2"
|
|
45
|
+
shift 2
|
|
46
|
+
;;
|
|
47
|
+
*)
|
|
48
|
+
QUERY="$1"
|
|
49
|
+
shift
|
|
50
|
+
;;
|
|
51
|
+
esac
|
|
52
|
+
done
|
|
53
|
+
|
|
54
|
+
echo "${BLUE}🔍 ACP Package Search${NC}"
|
|
55
|
+
echo "========================================"
|
|
56
|
+
echo ""
|
|
57
|
+
|
|
58
|
+
# Build search query
|
|
59
|
+
# Always filter by topic:acp-package to ensure only actual ACP packages are returned
|
|
60
|
+
if [ -n "$QUERY" ]; then
|
|
61
|
+
SEARCH_QUERY="${QUERY}+topic:acp-package"
|
|
62
|
+
else
|
|
63
|
+
SEARCH_QUERY="topic:acp-package"
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
if [ -n "$TAG" ]; then
|
|
67
|
+
SEARCH_QUERY="$SEARCH_QUERY+topic:$TAG"
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
if [ -n "$USER" ]; then
|
|
71
|
+
SEARCH_QUERY="$SEARCH_QUERY+user:$USER"
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
if [ -n "$ORG" ]; then
|
|
75
|
+
SEARCH_QUERY="$SEARCH_QUERY+org:$ORG"
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
info "Searching GitHub for: $SEARCH_QUERY"
|
|
79
|
+
info "Sort by: $SORT"
|
|
80
|
+
info "Limit: $LIMIT"
|
|
81
|
+
echo ""
|
|
82
|
+
|
|
83
|
+
# Search GitHub repositories
|
|
84
|
+
GITHUB_API="https://api.github.com/search/repositories"
|
|
85
|
+
SEARCH_URL="${GITHUB_API}?q=${SEARCH_QUERY}&sort=${SORT}&per_page=${LIMIT}"
|
|
86
|
+
|
|
87
|
+
# Make API request
|
|
88
|
+
RESPONSE=$(curl -s -H "Accept: application/vnd.github+json" "$SEARCH_URL")
|
|
89
|
+
|
|
90
|
+
# Check for API errors
|
|
91
|
+
if echo "$RESPONSE" | grep -q '"message"'; then
|
|
92
|
+
ERROR_MSG=$(echo "$RESPONSE" | grep -o '"message":"[^"]*"' | cut -d'"' -f4)
|
|
93
|
+
die "GitHub API error: $ERROR_MSG"
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
# Parse results (handle spaces in JSON)
|
|
97
|
+
TOTAL_COUNT=$(echo "$RESPONSE" | grep -o '"total_count"[: ]*[0-9]*' | grep -o '[0-9]*$')
|
|
98
|
+
|
|
99
|
+
if [ -z "$TOTAL_COUNT" ] || [ "$TOTAL_COUNT" -eq 0 ]; then
|
|
100
|
+
echo "${YELLOW}No packages found matching your search${NC}"
|
|
101
|
+
echo ""
|
|
102
|
+
echo "Try:"
|
|
103
|
+
echo " - Broader search terms"
|
|
104
|
+
echo " - Different tags"
|
|
105
|
+
echo " - Removing filters"
|
|
106
|
+
exit 0
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
echo "${GREEN}📦 Found $TOTAL_COUNT package(s)${NC}"
|
|
110
|
+
echo ""
|
|
111
|
+
|
|
112
|
+
# Parse and display each result
|
|
113
|
+
REPO_COUNT=0
|
|
114
|
+
|
|
115
|
+
echo "$RESPONSE" | grep -o '"full_name": "[^"]*"' | cut -d'"' -f4 | while read -r full_name; do
|
|
116
|
+
REPO_COUNT=$((REPO_COUNT + 1))
|
|
117
|
+
|
|
118
|
+
# Extract repo info from response
|
|
119
|
+
REPO_DATA=$(echo "$RESPONSE" | grep -A 20 "\"full_name\":\"$full_name\"")
|
|
120
|
+
|
|
121
|
+
DESCRIPTION=$(echo "$REPO_DATA" | grep -o '"description"[: ]*"[^"]*"' | head -1 | sed 's/"description"[: ]*"//' | sed 's/"$//')
|
|
122
|
+
STARS=$(echo "$REPO_DATA" | grep -o '"stargazers_count"[: ]*[0-9]*' | head -1 | grep -o '[0-9]*$')
|
|
123
|
+
URL="https://github.com/$full_name"
|
|
124
|
+
|
|
125
|
+
# Fetch package.yaml to get version and tags
|
|
126
|
+
PACKAGE_YAML_URL="https://raw.githubusercontent.com/$full_name/main/package.yaml"
|
|
127
|
+
PACKAGE_YAML=$(curl -s "$PACKAGE_YAML_URL" 2>/dev/null)
|
|
128
|
+
|
|
129
|
+
if [ -n "$PACKAGE_YAML" ]; then
|
|
130
|
+
VERSION=$(echo "$PACKAGE_YAML" | awk '/^version:/ {print $2; exit}')
|
|
131
|
+
PACKAGE_NAME=$(echo "$PACKAGE_YAML" | awk '/^name:/ {print $2; exit}')
|
|
132
|
+
TAGS=$(echo "$PACKAGE_YAML" | awk '/^tags:/,/^[a-z]/ {if (/^ - /) {gsub(/^ - /, ""); print}}' | tr '\n' ', ' | sed 's/,$//')
|
|
133
|
+
else
|
|
134
|
+
VERSION="unknown"
|
|
135
|
+
PACKAGE_NAME=$(echo "$full_name" | cut -d'/' -f2)
|
|
136
|
+
TAGS=""
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
# Display result
|
|
140
|
+
echo "${GREEN}$REPO_COUNT. $PACKAGE_NAME${NC} (${BLUE}$VERSION${NC}) ⭐ $STARS"
|
|
141
|
+
echo " $URL"
|
|
142
|
+
if [ -n "$DESCRIPTION" ] && [ "$DESCRIPTION" != "null" ]; then
|
|
143
|
+
echo " $DESCRIPTION"
|
|
144
|
+
fi
|
|
145
|
+
if [ -n "$TAGS" ]; then
|
|
146
|
+
echo " Tags: $TAGS"
|
|
147
|
+
fi
|
|
148
|
+
echo " Install: ./agent/scripts/acp.package-install.sh $URL.git"
|
|
149
|
+
echo ""
|
|
150
|
+
done
|
|
151
|
+
|
|
152
|
+
echo "Showing $REPO_COUNT of $TOTAL_COUNT result(s)"
|
|
153
|
+
echo ""
|
|
154
|
+
echo "To install a package:"
|
|
155
|
+
echo " ./agent/scripts/acp.package-install.sh <repository-url>"
|
|
156
|
+
echo ""
|