@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.
Files changed (94) hide show
  1. package/.env.example +5 -0
  2. package/AGENT.md +1279 -0
  3. package/README.md +78 -0
  4. package/agent/commands/acp.command-create.md +372 -0
  5. package/agent/commands/acp.design-create.md +224 -0
  6. package/agent/commands/acp.init.md +410 -0
  7. package/agent/commands/acp.package-create.md +894 -0
  8. package/agent/commands/acp.package-info.md +211 -0
  9. package/agent/commands/acp.package-install.md +461 -0
  10. package/agent/commands/acp.package-list.md +279 -0
  11. package/agent/commands/acp.package-publish.md +540 -0
  12. package/agent/commands/acp.package-remove.md +292 -0
  13. package/agent/commands/acp.package-search.md +306 -0
  14. package/agent/commands/acp.package-update.md +310 -0
  15. package/agent/commands/acp.package-validate.md +535 -0
  16. package/agent/commands/acp.pattern-create.md +326 -0
  17. package/agent/commands/acp.plan.md +552 -0
  18. package/agent/commands/acp.proceed.md +336 -0
  19. package/agent/commands/acp.project-create.md +672 -0
  20. package/agent/commands/acp.report.md +394 -0
  21. package/agent/commands/acp.resume.md +237 -0
  22. package/agent/commands/acp.status.md +280 -0
  23. package/agent/commands/acp.sync.md +363 -0
  24. package/agent/commands/acp.task-create.md +390 -0
  25. package/agent/commands/acp.update.md +301 -0
  26. package/agent/commands/acp.validate.md +436 -0
  27. package/agent/commands/acp.version-check-for-updates.md +275 -0
  28. package/agent/commands/acp.version-check.md +190 -0
  29. package/agent/commands/acp.version-update.md +288 -0
  30. package/agent/commands/command.template.md +316 -0
  31. package/agent/commands/git.commit.md +513 -0
  32. package/agent/commands/git.init.md +513 -0
  33. package/agent/commands/mcp-server-starter.add-tool.md +677 -0
  34. package/agent/commands/mcp-server-starter.init.md +894 -0
  35. package/agent/design/.gitkeep +0 -0
  36. package/agent/design/design.template.md +136 -0
  37. package/agent/design/remember-mcp-analysis.md +987 -0
  38. package/agent/design/requirements.template.md +387 -0
  39. package/agent/manifest.template.yaml +13 -0
  40. package/agent/manifest.yaml +109 -0
  41. package/agent/milestones/.gitkeep +0 -0
  42. package/agent/milestones/milestone-1-{title}.template.md +206 -0
  43. package/agent/package.template.yaml +36 -0
  44. package/agent/patterns/.gitkeep +0 -0
  45. package/agent/patterns/bootstrap.template.md +1237 -0
  46. package/agent/patterns/mcp-server-starter.bootstrap.md +597 -0
  47. package/agent/patterns/mcp-server-starter.build-config.md +554 -0
  48. package/agent/patterns/mcp-server-starter.config-management.md +525 -0
  49. package/agent/patterns/mcp-server-starter.server-factory.md +616 -0
  50. package/agent/patterns/mcp-server-starter.server-standalone.md +642 -0
  51. package/agent/patterns/mcp-server-starter.test-config.md +558 -0
  52. package/agent/patterns/mcp-server-starter.tool-creation.md +653 -0
  53. package/agent/patterns/pattern.template.md +364 -0
  54. package/agent/progress.template.yaml +161 -0
  55. package/agent/progress.yaml +33 -0
  56. package/agent/schemas/package.schema.yaml +161 -0
  57. package/agent/scripts/acp.common.sh +1362 -0
  58. package/agent/scripts/acp.install.sh +213 -0
  59. package/agent/scripts/acp.package-create.sh +925 -0
  60. package/agent/scripts/acp.package-info.sh +270 -0
  61. package/agent/scripts/acp.package-install.sh +550 -0
  62. package/agent/scripts/acp.package-list.sh +263 -0
  63. package/agent/scripts/acp.package-publish.sh +420 -0
  64. package/agent/scripts/acp.package-remove.sh +272 -0
  65. package/agent/scripts/acp.package-search.sh +156 -0
  66. package/agent/scripts/acp.package-update.sh +356 -0
  67. package/agent/scripts/acp.package-validate.sh +766 -0
  68. package/agent/scripts/acp.uninstall.sh +85 -0
  69. package/agent/scripts/acp.version-check-for-updates.sh +98 -0
  70. package/agent/scripts/acp.version-check.sh +47 -0
  71. package/agent/scripts/acp.version-update.sh +158 -0
  72. package/agent/scripts/acp.yaml-parser.sh +736 -0
  73. package/agent/scripts/acp.yaml-validate.sh +205 -0
  74. package/agent/tasks/.gitkeep +0 -0
  75. package/agent/tasks/task-1-{title}.template.md +225 -0
  76. package/dist/config.d.ts +4 -0
  77. package/dist/server-factory.d.ts +9 -0
  78. package/dist/server-factory.js +99 -0
  79. package/dist/server-factory.js.map +7 -0
  80. package/dist/server.d.ts +2 -0
  81. package/dist/server.js +106 -0
  82. package/dist/server.js.map +7 -0
  83. package/dist/tools/acp-remote-list-files.d.ts +15 -0
  84. package/dist/types/ssh-config.d.ts +16 -0
  85. package/esbuild.build.js +34 -0
  86. package/esbuild.watch.js +31 -0
  87. package/jest.config.js +31 -0
  88. package/package.json +54 -0
  89. package/src/config.ts +16 -0
  90. package/src/server-factory.ts +43 -0
  91. package/src/server.ts +46 -0
  92. package/src/tools/acp-remote-list-files.ts +89 -0
  93. package/src/types/ssh-config.ts +17 -0
  94. package/tsconfig.json +22 -0
@@ -0,0 +1,356 @@
1
+ #!/bin/bash
2
+
3
+ # Agent Context Protocol (ACP) Package Update Script
4
+ # Updates installed ACP packages to their latest versions
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
+ CHECK_ONLY=false
18
+ SKIP_MODIFIED=false
19
+ FORCE=false
20
+ AUTO_CONFIRM=false
21
+ GLOBAL_MODE=false
22
+
23
+ while [[ $# -gt 0 ]]; do
24
+ case $1 in
25
+ --global|-g)
26
+ GLOBAL_MODE=true
27
+ shift
28
+ ;;
29
+ --check)
30
+ CHECK_ONLY=true
31
+ shift
32
+ ;;
33
+ --skip-modified)
34
+ SKIP_MODIFIED=true
35
+ shift
36
+ ;;
37
+ --force)
38
+ FORCE=true
39
+ shift
40
+ ;;
41
+ -y|--yes)
42
+ AUTO_CONFIRM=true
43
+ shift
44
+ ;;
45
+ *)
46
+ PACKAGE_NAME="$1"
47
+ shift
48
+ ;;
49
+ esac
50
+ done
51
+
52
+ # Check for updates for a package
53
+ # Usage: check_package_for_updates "package_name"
54
+ # Returns: 0 if updates available, 1 if up to date
55
+ check_package_for_updates() {
56
+ local package_name="$1"
57
+
58
+ # Get current version and source from manifest
59
+ local current_version
60
+ current_version=$(awk -v pkg="$package_name" '
61
+ $0 ~ "^ " pkg ":" { in_pkg=1; next }
62
+ in_pkg && /^ [a-z]/ { in_pkg=0 }
63
+ in_pkg && /^ package_version:/ { print $2; exit }
64
+ ' "$MANIFEST_FILE")
65
+
66
+ local source_url
67
+ source_url=$(awk -v pkg="$package_name" '
68
+ $0 ~ "^ " pkg ":" { in_pkg=1; next }
69
+ in_pkg && /^ [a-z]/ { in_pkg=0 }
70
+ in_pkg && /^ source:/ { print $2; exit }
71
+ ' "$MANIFEST_FILE")
72
+
73
+ if [ -z "$current_version" ] || [ -z "$source_url" ]; then
74
+ warn "Could not read package metadata for $package_name"
75
+ return 1
76
+ fi
77
+
78
+ info "Checking $package_name ($current_version)..."
79
+
80
+ # Clone repository to temp location
81
+ local temp_dir
82
+ temp_dir=$(mktemp -d)
83
+ trap "rm -rf $temp_dir" RETURN
84
+
85
+ if ! git clone --depth 1 "$source_url" "$temp_dir" &>/dev/null; then
86
+ warn "Failed to clone repository for $package_name"
87
+ return 1
88
+ fi
89
+
90
+ # Get remote version
91
+ local remote_version
92
+ if [ -f "$temp_dir/package.yaml" ]; then
93
+ remote_version=$(awk '/^version:/ {print $2; exit}' "$temp_dir/package.yaml")
94
+ else
95
+ warn "No package.yaml found in repository"
96
+ return 1
97
+ fi
98
+
99
+ # Compare versions
100
+ local comparison
101
+ comparison=$(compare_versions "$current_version" "$remote_version")
102
+
103
+ if [ "$comparison" = "newer" ]; then
104
+ echo " ${GREEN}✓${NC} Update available: $current_version → $remote_version"
105
+ return 0
106
+ else
107
+ echo " ${GREEN}✓${NC} Up to date: $current_version"
108
+ return 1
109
+ fi
110
+ }
111
+
112
+ # Update a package
113
+ # Usage: update_package "package_name"
114
+ update_package() {
115
+ local package_name="$1"
116
+
117
+ echo "${BLUE}Updating $package_name...${NC}"
118
+
119
+ # Get package info from manifest
120
+ local source_url
121
+ source_url=$(awk -v pkg="$package_name" '
122
+ $0 ~ "^ " pkg ":" { in_pkg=1; next }
123
+ in_pkg && /^ [a-z]/ { in_pkg=0 }
124
+ in_pkg && /^ source:/ { print $2; exit }
125
+ ' "$MANIFEST_FILE")
126
+
127
+ # Clone latest version
128
+ local temp_dir
129
+ temp_dir=$(mktemp -d)
130
+ trap "rm -rf $temp_dir" RETURN
131
+
132
+ if ! git clone --depth 1 "$source_url" "$temp_dir" &>/dev/null; then
133
+ die "Failed to clone repository"
134
+ fi
135
+
136
+ # Parse new package metadata
137
+ parse_package_metadata "$temp_dir"
138
+ local new_commit
139
+ new_commit=$(get_commit_hash "$temp_dir")
140
+
141
+ # Get list of installed files from manifest
142
+ local updated_count=0
143
+ local skipped_count=0
144
+ local modified_files=()
145
+
146
+ # Check for modified files first
147
+ for file_type in patterns commands design; do
148
+ local files
149
+ files=$(awk -v pkg="$package_name" -v type="$file_type" '
150
+ BEGIN { in_pkg=0; in_type=0 }
151
+ $0 ~ "^ " pkg ":" { in_pkg=1; next }
152
+ in_pkg && /^ [a-z]/ { in_pkg=0 }
153
+ in_pkg && $0 ~ "^ " type ":" { in_type=1; next }
154
+ in_type && /^ [a-z]/ { in_type=0 }
155
+ in_type && /^ - name:/ { print $3 }
156
+ ' "$MANIFEST_FILE")
157
+
158
+ for file_name in $files; do
159
+ if is_file_modified "$package_name" "$file_type" "$file_name"; then
160
+ modified_files+=("$file_type/$file_name")
161
+ fi
162
+ done
163
+ done
164
+
165
+ # Handle modified files
166
+ if [ ${#modified_files[@]} -gt 0 ] && [ "$FORCE" = false ]; then
167
+ echo ""
168
+ echo "${YELLOW}⚠️ Modified files detected:${NC}"
169
+ for file in "${modified_files[@]}"; do
170
+ echo " - $file"
171
+ done
172
+ echo ""
173
+
174
+ if [ "$SKIP_MODIFIED" = true ]; then
175
+ echo "Will skip modified files (--skip-modified)"
176
+ elif [ "$AUTO_CONFIRM" = false ]; then
177
+ read -p "Overwrite modified files? (y/N) " -n 1 -r
178
+ echo
179
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
180
+ SKIP_MODIFIED=true
181
+ echo "Skipping modified files"
182
+ fi
183
+ fi
184
+ echo ""
185
+ fi
186
+
187
+ # Update files
188
+ for file_type in patterns commands design; do
189
+ local files
190
+ files=$(awk -v pkg="$package_name" -v type="$file_type" '
191
+ BEGIN { in_pkg=0; in_type=0 }
192
+ $0 ~ "^ " pkg ":" { in_pkg=1; next }
193
+ in_pkg && /^ [a-z]/ { in_pkg=0 }
194
+ in_pkg && $0 ~ "^ " type ":" { in_type=1; next }
195
+ in_type && /^ [a-z]/ { in_type=0 }
196
+ in_type && /^ - name:/ { print $3 }
197
+ ' "$MANIFEST_FILE")
198
+
199
+ for file_name in $files; do
200
+ # Check if file should be skipped
201
+ if [ "$SKIP_MODIFIED" = true ]; then
202
+ if printf '%s\n' "${modified_files[@]}" | grep -q "^${file_type}/${file_name}$"; then
203
+ echo " ${YELLOW}⊘${NC} Skipped $file_type/$file_name (modified locally)"
204
+ ((skipped_count++))
205
+ continue
206
+ fi
207
+ fi
208
+
209
+ # Check if file exists in new version
210
+ if [ ! -f "$temp_dir/agent/$file_type/$file_name" ]; then
211
+ warn "File no longer exists in package: $file_type/$file_name"
212
+ ((skipped_count++))
213
+ continue
214
+ fi
215
+
216
+ # Copy file
217
+ cp "$temp_dir/agent/$file_type/$file_name" "agent/$file_type/"
218
+
219
+ # Get new version and checksum
220
+ local new_version
221
+ new_version=$(get_file_version "$temp_dir/package.yaml" "$file_type" "$file_name")
222
+ local new_checksum
223
+ new_checksum=$(calculate_checksum "agent/$file_type/$file_name")
224
+
225
+ # Update manifest
226
+ update_file_in_manifest "$package_name" "$file_type" "$file_name" "$new_version" "$new_checksum"
227
+
228
+ echo " ${GREEN}✓${NC} Updated $file_type/$file_name (v$new_version)"
229
+ ((updated_count++))
230
+ done
231
+ done
232
+
233
+ # Update package metadata in manifest
234
+ local timestamp
235
+ timestamp=$(get_timestamp)
236
+
237
+ # Update using awk
238
+ local temp_file
239
+ temp_file=$(mktemp)
240
+
241
+ awk -v pkg="$package_name" -v ver="$PACKAGE_VERSION" -v commit="$new_commit" -v ts="$timestamp" '
242
+ BEGIN { in_pkg=0 }
243
+ $0 ~ "^ " pkg ":" { in_pkg=1; print; next }
244
+ in_pkg && /^ [a-z]/ { in_pkg=0; print; next }
245
+ in_pkg && /^ package_version:/ { print " package_version: " ver; next }
246
+ in_pkg && /^ commit:/ { print " commit: " commit; next }
247
+ in_pkg && /^ updated_at:/ { print " updated_at: " ts; next }
248
+ { print }
249
+ ' "$MANIFEST_FILE" > "$temp_file"
250
+
251
+ mv "$temp_file" "$MANIFEST_FILE"
252
+
253
+ # Update manifest timestamp
254
+ update_manifest_timestamp
255
+
256
+ echo ""
257
+ success "Updated $package_name: $updated_count file(s)"
258
+ if [ $skipped_count -gt 0 ]; then
259
+ echo " Skipped: $skipped_count file(s)"
260
+ fi
261
+ }
262
+
263
+ # Main script execution
264
+ echo "${BLUE}📦 ACP Package Updater${NC}"
265
+ echo "========================================"
266
+ echo ""
267
+
268
+ # Determine manifest file based on mode
269
+ if [ "$GLOBAL_MODE" = true ]; then
270
+ MANIFEST_FILE="$HOME/.acp/manifest.yaml"
271
+ echo "${BLUE}Updating global packages...${NC}"
272
+ echo ""
273
+ else
274
+ MANIFEST_FILE="./agent/manifest.yaml"
275
+ echo "${BLUE}Updating packages...${NC}"
276
+ echo ""
277
+ fi
278
+
279
+ # Check if manifest exists
280
+ if [ ! -f "$MANIFEST_FILE" ]; then
281
+ if [ "$GLOBAL_MODE" = true ]; then
282
+ die "No global manifest found. No global packages installed."
283
+ else
284
+ die "No manifest found. No packages installed."
285
+ fi
286
+ fi
287
+
288
+ # Source YAML parser
289
+ source_yaml_parser
290
+
291
+ # Get list of installed packages
292
+ INSTALLED_PACKAGES=$(awk '/^ [a-z]/ && !/^ / && /:$/ {gsub(/:/, ""); print $1}' "$MANIFEST_FILE")
293
+
294
+ if [ -z "$INSTALLED_PACKAGES" ]; then
295
+ echo "${YELLOW}No packages installed${NC}"
296
+ exit 0
297
+ fi
298
+
299
+ # If no package specified, update all
300
+ if [ -z "$PACKAGE_NAME" ]; then
301
+ echo "Checking all packages for updates..."
302
+ echo ""
303
+
304
+ UPDATES_AVAILABLE=false
305
+ for pkg in $INSTALLED_PACKAGES; do
306
+ if check_package_for_updates "$pkg"; then
307
+ UPDATES_AVAILABLE=true
308
+ fi
309
+ done
310
+
311
+ if [ "$UPDATES_AVAILABLE" = false ]; then
312
+ echo "${GREEN}✓${NC} All packages are up to date"
313
+ exit 0
314
+ fi
315
+
316
+ if [ "$CHECK_ONLY" = true ]; then
317
+ echo ""
318
+ echo "To update all packages: $0"
319
+ echo "To update specific package: $0 <package-name>"
320
+ exit 0
321
+ fi
322
+
323
+ # Update all packages
324
+ echo ""
325
+ if [ "$AUTO_CONFIRM" = false ]; then
326
+ read -p "Update all packages? (y/N) " -n 1 -r
327
+ echo
328
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
329
+ echo "Update cancelled"
330
+ exit 0
331
+ fi
332
+ fi
333
+
334
+ echo ""
335
+ for pkg in $INSTALLED_PACKAGES; do
336
+ update_package "$pkg"
337
+ echo ""
338
+ done
339
+ else
340
+ # Update specific package
341
+ if ! echo "$INSTALLED_PACKAGES" | grep -q "^${PACKAGE_NAME}$"; then
342
+ die "Package not installed: $PACKAGE_NAME"
343
+ fi
344
+
345
+ if check_package_for_updates "$PACKAGE_NAME"; then
346
+ if [ "$CHECK_ONLY" = false ]; then
347
+ echo ""
348
+ update_package "$PACKAGE_NAME"
349
+ fi
350
+ else
351
+ echo "${GREEN}✓${NC} Package is up to date"
352
+ fi
353
+ fi
354
+
355
+ echo ""
356
+ echo "${GREEN}✅ Update complete!${NC}"