@prmichaelsen/remember-mcp 3.15.3 → 3.15.5
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/AGENT.md +363 -5
- package/CHANGELOG.md +7 -0
- package/agent/commands/acp.clarification-capture.md +386 -0
- package/agent/commands/acp.clarification-create.md +50 -0
- package/agent/commands/acp.command-create.md +60 -0
- package/agent/commands/acp.design-create.md +62 -0
- package/agent/commands/acp.design-reference.md +355 -0
- package/agent/commands/acp.index.md +423 -0
- package/agent/commands/acp.init.md +48 -0
- package/agent/commands/acp.package-create.md +1 -0
- package/agent/commands/acp.package-info.md +1 -0
- package/agent/commands/acp.package-install.md +19 -0
- package/agent/commands/acp.package-list.md +1 -0
- package/agent/commands/acp.package-publish.md +1 -0
- package/agent/commands/acp.package-remove.md +1 -0
- package/agent/commands/acp.package-search.md +1 -0
- package/agent/commands/acp.package-update.md +1 -0
- package/agent/commands/acp.package-validate.md +1 -0
- package/agent/commands/acp.pattern-create.md +60 -0
- package/agent/commands/acp.plan.md +25 -0
- package/agent/commands/acp.proceed.md +621 -75
- package/agent/commands/acp.project-create.md +3 -0
- package/agent/commands/acp.project-info.md +3 -0
- package/agent/commands/acp.project-list.md +3 -1
- package/agent/commands/acp.project-set.md +1 -0
- package/agent/commands/acp.project-update.md +14 -3
- package/agent/commands/acp.projects-restore.md +228 -0
- package/agent/commands/acp.projects-sync.md +347 -0
- package/agent/commands/acp.report.md +13 -0
- package/agent/commands/acp.resume.md +3 -1
- package/agent/commands/acp.sessions.md +301 -0
- package/agent/commands/acp.status.md +13 -0
- package/agent/commands/acp.sync.md +1 -0
- package/agent/commands/acp.task-create.md +105 -3
- package/agent/commands/acp.update.md +1 -0
- package/agent/commands/acp.validate.md +32 -2
- package/agent/commands/acp.version-check-for-updates.md +1 -0
- package/agent/commands/acp.version-check.md +1 -0
- package/agent/commands/acp.version-update.md +1 -0
- package/agent/commands/command.template.md +23 -0
- package/agent/commands/git.commit.md +1 -0
- package/agent/commands/git.init.md +1 -0
- package/agent/design/complete-tool-set.md +157 -233
- package/agent/design/design.template.md +18 -0
- package/agent/design/user-preferences.md +11 -7
- package/agent/milestones/milestone-19-new-search-ghost-tools.md +46 -0
- package/agent/package.template.yaml +50 -0
- package/agent/patterns/pattern.template.md +18 -0
- package/agent/progress.yaml +162 -6
- package/agent/scripts/acp.common.sh +258 -15
- package/agent/scripts/acp.install.sh +91 -4
- package/agent/scripts/acp.package-create.sh +0 -1
- package/agent/scripts/acp.package-info.sh +19 -1
- package/agent/scripts/acp.package-install-optimized.sh +1 -1
- package/agent/scripts/acp.package-install.sh +388 -38
- package/agent/scripts/acp.package-list.sh +52 -4
- package/agent/scripts/acp.package-remove.sh +77 -1
- package/agent/scripts/acp.package-search.sh +2 -2
- package/agent/scripts/acp.package-update.sh +91 -12
- package/agent/scripts/acp.package-validate.sh +136 -1
- package/agent/scripts/acp.project-info.sh +34 -11
- package/agent/scripts/acp.project-list.sh +4 -0
- package/agent/scripts/acp.project-update.sh +66 -19
- package/agent/scripts/acp.projects-restore.sh +170 -0
- package/agent/scripts/acp.projects-sync.sh +155 -0
- package/agent/scripts/acp.sessions.sh +725 -0
- package/agent/scripts/acp.version-update.sh +21 -3
- package/agent/scripts/acp.yaml-parser.sh +20 -6
- package/agent/tasks/milestone-19-new-search-ghost-tools/task-203-create-search-by-tool.md +143 -0
- package/agent/tasks/milestone-19-new-search-ghost-tools/task-204-add-new-filters-existing-tools.md +77 -0
- package/agent/tasks/milestone-19-new-search-ghost-tools/task-205-add-feel-fields-create-update.md +137 -0
- package/agent/tasks/milestone-19-new-search-ghost-tools/task-206-add-byproperty-bysignificance-modes.md +135 -0
- package/agent/tasks/milestone-19-new-search-ghost-tools/task-207-add-emotional-composites-search-results.md +88 -0
- package/agent/tasks/milestone-19-new-search-ghost-tools/task-208-add-bybroad-byrandom-modes.md +115 -0
- package/agent/tasks/milestone-19-new-search-ghost-tools/task-209-create-ghost-memory-tools.md +192 -0
- package/agent/tasks/milestone-19-new-search-ghost-tools/task-210-create-get-core-tool.md +203 -0
- package/agent/tasks/milestone-19-new-search-ghost-tools/task-211-create-search-space-by-tool.md +182 -0
- package/agent/tasks/task-1-{title}.template.md +19 -0
- package/agent/tasks/unassigned/bug-report-remember-core-e2e-findings.md +99 -0
- package/dist/e2e-helpers.d.ts +26 -0
- package/dist/ghost-persona.e2e.d.ts +8 -0
- package/dist/memory-crud.e2e.d.ts +8 -0
- package/dist/preferences.e2e.d.ts +8 -0
- package/dist/relationships.e2e.d.ts +8 -0
- package/dist/search-modes.e2e.d.ts +8 -0
- package/dist/server-factory.js +2158 -45
- package/dist/server.js +1403 -44
- package/dist/shared-spaces.e2e.d.ts +8 -0
- package/dist/tools/create-ghost-memory.d.ts +70 -0
- package/dist/tools/create-memory.d.ts +175 -0
- package/dist/tools/get-core.d.ts +28 -0
- package/dist/tools/get-core.spec.d.ts +2 -0
- package/dist/tools/ghost-tools.spec.d.ts +2 -0
- package/dist/tools/query-ghost-memory.d.ts +34 -0
- package/dist/tools/query-memory.d.ts +4 -0
- package/dist/tools/search-by.d.ts +147 -0
- package/dist/tools/search-by.spec.d.ts +2 -0
- package/dist/tools/search-ghost-memory-by.d.ts +54 -0
- package/dist/tools/search-ghost-memory.d.ts +53 -0
- package/dist/tools/search-memory.d.ts +19 -0
- package/dist/tools/search-space-by.d.ts +78 -0
- package/dist/tools/search-space-by.spec.d.ts +2 -0
- package/dist/tools/search-space.d.ts +2 -0
- package/dist/tools/update-ghost-memory.d.ts +51 -0
- package/dist/tools/update-memory.d.ts +175 -0
- package/jest.e2e.config.js +11 -0
- package/package.json +2 -2
- package/src/e2e-helpers.ts +86 -0
- package/src/ghost-persona.e2e.ts +215 -0
- package/src/memory-crud.e2e.ts +203 -0
- package/src/preferences.e2e.ts +88 -0
- package/src/relationships.e2e.ts +156 -0
- package/src/search-modes.e2e.ts +184 -0
- package/src/server-factory.ts +56 -0
- package/src/shared-spaces.e2e.ts +204 -0
- package/src/tools/create-ghost-memory.ts +103 -0
- package/src/tools/create-memory.ts +45 -1
- package/src/tools/get-core.spec.ts +223 -0
- package/src/tools/get-core.ts +109 -0
- package/src/tools/ghost-tools.spec.ts +361 -0
- package/src/tools/query-ghost-memory.ts +63 -0
- package/src/tools/query-memory.ts +4 -0
- package/src/tools/search-by.spec.ts +325 -0
- package/src/tools/search-by.ts +298 -0
- package/src/tools/search-ghost-memory-by.ts +80 -0
- package/src/tools/search-ghost-memory.ts +73 -0
- package/src/tools/search-memory.ts +23 -0
- package/src/tools/search-space-by.spec.ts +289 -0
- package/src/tools/search-space-by.ts +173 -0
- package/src/tools/search-space.ts +20 -1
- package/src/tools/update-ghost-memory.ts +86 -0
- package/src/tools/update-memory.ts +45 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#!/bin/bash
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
2
|
# acp.project-update.sh - Update project metadata in registry
|
|
3
3
|
# Part of Agent Context Protocol (ACP)
|
|
4
4
|
# Usage: ./acp.project-update.sh <project-name> [options]
|
|
5
5
|
|
|
6
|
-
set -
|
|
6
|
+
set -e
|
|
7
7
|
|
|
8
8
|
# Get script directory
|
|
9
9
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
@@ -20,11 +20,13 @@ parse_args() {
|
|
|
20
20
|
UPDATE_STATUS=""
|
|
21
21
|
UPDATE_DESCRIPTION=""
|
|
22
22
|
UPDATE_TYPE=""
|
|
23
|
+
UPDATE_GIT_ORIGIN=""
|
|
24
|
+
UPDATE_GIT_BRANCH=""
|
|
23
25
|
ADD_TAGS=()
|
|
24
26
|
REMOVE_TAGS=()
|
|
25
27
|
ADD_RELATED=()
|
|
26
28
|
REMOVE_RELATED=()
|
|
27
|
-
|
|
29
|
+
|
|
28
30
|
while [[ $# -gt 0 ]]; do
|
|
29
31
|
case $1 in
|
|
30
32
|
--status)
|
|
@@ -39,6 +41,14 @@ parse_args() {
|
|
|
39
41
|
UPDATE_TYPE="$2"
|
|
40
42
|
shift 2
|
|
41
43
|
;;
|
|
44
|
+
--git-origin)
|
|
45
|
+
UPDATE_GIT_ORIGIN="$2"
|
|
46
|
+
shift 2
|
|
47
|
+
;;
|
|
48
|
+
--git-branch)
|
|
49
|
+
UPDATE_GIT_BRANCH="$2"
|
|
50
|
+
shift 2
|
|
51
|
+
;;
|
|
42
52
|
--add-tag)
|
|
43
53
|
ADD_TAGS+=("$2")
|
|
44
54
|
shift 2
|
|
@@ -87,6 +97,8 @@ main() {
|
|
|
87
97
|
echo " --status <status> Update project status (active|archived|paused)"
|
|
88
98
|
echo " --description <text> Update project description"
|
|
89
99
|
echo " --type <type> Update project type"
|
|
100
|
+
echo " --git-origin <url> Set git remote origin URL"
|
|
101
|
+
echo " --git-branch <branch> Set git branch name"
|
|
90
102
|
echo " --add-tag <tag> Add a tag (can be used multiple times)"
|
|
91
103
|
echo " --remove-tag <tag> Remove a tag (can be used multiple times)"
|
|
92
104
|
echo " --add-related <project> Add related project (can be used multiple times)"
|
|
@@ -101,6 +113,7 @@ main() {
|
|
|
101
113
|
|
|
102
114
|
# Check if any updates specified
|
|
103
115
|
if [ -z "$UPDATE_STATUS" ] && [ -z "$UPDATE_DESCRIPTION" ] && [ -z "$UPDATE_TYPE" ] && \
|
|
116
|
+
[ -z "$UPDATE_GIT_ORIGIN" ] && [ -z "$UPDATE_GIT_BRANCH" ] && \
|
|
104
117
|
[ ${#ADD_TAGS[@]} -eq 0 ] && [ ${#REMOVE_TAGS[@]} -eq 0 ] && \
|
|
105
118
|
[ ${#ADD_RELATED[@]} -eq 0 ] && [ ${#REMOVE_RELATED[@]} -eq 0 ]; then
|
|
106
119
|
echo "Error: No updates specified"
|
|
@@ -121,10 +134,16 @@ main() {
|
|
|
121
134
|
fi
|
|
122
135
|
|
|
123
136
|
# Parse registry
|
|
124
|
-
yaml_parse "$registry_path"
|
|
137
|
+
yaml_parse "$registry_path" || {
|
|
138
|
+
echo "Error: Failed to parse registry"
|
|
139
|
+
return 1
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
# Check if project exists by trying to query it
|
|
143
|
+
local project_type_check
|
|
144
|
+
project_type_check=$(yaml_query ".projects.${PROJECT_NAME}.type" 2>/dev/null || echo "")
|
|
125
145
|
|
|
126
|
-
|
|
127
|
-
if ! yaml_query ".projects.${PROJECT_NAME}" >/dev/null 2>&1 || [ "$(yaml_query ".projects.${PROJECT_NAME}")" = "null" ]; then
|
|
146
|
+
if [ -z "$project_type_check" ] || [ "$project_type_check" = "null" ]; then
|
|
128
147
|
echo "Error: Project '${PROJECT_NAME}' not found in registry"
|
|
129
148
|
echo ""
|
|
130
149
|
echo "Run 'acp.project-list.sh' to see available projects"
|
|
@@ -165,22 +184,47 @@ main() {
|
|
|
165
184
|
echo "✓ Updated type: ${UPDATE_TYPE}"
|
|
166
185
|
updates_made=$((updates_made + 1))
|
|
167
186
|
fi
|
|
168
|
-
|
|
187
|
+
|
|
188
|
+
# Update git origin
|
|
189
|
+
if [ -n "$UPDATE_GIT_ORIGIN" ]; then
|
|
190
|
+
yaml_set "projects.${PROJECT_NAME}.git_origin" "$UPDATE_GIT_ORIGIN"
|
|
191
|
+
echo "✓ Updated git_origin: ${UPDATE_GIT_ORIGIN}"
|
|
192
|
+
updates_made=$((updates_made + 1))
|
|
193
|
+
fi
|
|
194
|
+
|
|
195
|
+
# Update git branch
|
|
196
|
+
if [ -n "$UPDATE_GIT_BRANCH" ]; then
|
|
197
|
+
yaml_set "projects.${PROJECT_NAME}.git_branch" "$UPDATE_GIT_BRANCH"
|
|
198
|
+
echo "✓ Updated git_branch: ${UPDATE_GIT_BRANCH}"
|
|
199
|
+
updates_made=$((updates_made + 1))
|
|
200
|
+
fi
|
|
201
|
+
|
|
169
202
|
# Add tags
|
|
170
203
|
if [ ${#ADD_TAGS[@]} -gt 0 ]; then
|
|
171
204
|
for tag in "${ADD_TAGS[@]}"; do
|
|
172
205
|
# Get current tags
|
|
173
206
|
local current_tags
|
|
174
|
-
current_tags=$(yaml_query ".projects.${PROJECT_NAME}.tags")
|
|
207
|
+
current_tags=$(yaml_query ".projects.${PROJECT_NAME}.tags" 2>/dev/null || echo "")
|
|
175
208
|
|
|
176
209
|
# Check if tag already exists
|
|
177
|
-
if echo "$current_tags" | grep -q "^${tag}$"; then
|
|
210
|
+
if [ -n "$current_tags" ] && [ "$current_tags" != "null" ] && echo "$current_tags" | grep -q "^${tag}$"; then
|
|
178
211
|
echo "⊘ Tag already exists: ${tag}"
|
|
179
212
|
else
|
|
213
|
+
# Ensure tags field exists (create empty array if missing)
|
|
214
|
+
if [ -z "$current_tags" ] || [ "$current_tags" = "null" ]; then
|
|
215
|
+
local registry_path
|
|
216
|
+
registry_path=$(get_projects_registry_path)
|
|
217
|
+
_sed_i "/^ ${PROJECT_NAME}:/a\\ tags: []" "$registry_path"
|
|
218
|
+
yaml_parse "$registry_path"
|
|
219
|
+
fi
|
|
220
|
+
|
|
180
221
|
# Use yaml_array_append to add tag
|
|
181
|
-
yaml_array_append ".projects.${PROJECT_NAME}.tags" "$tag"
|
|
182
|
-
|
|
183
|
-
|
|
222
|
+
if yaml_array_append ".projects.${PROJECT_NAME}.tags" "$tag" 2>/dev/null; then
|
|
223
|
+
echo "✓ Added tag: ${tag}"
|
|
224
|
+
updates_made=$((updates_made + 1))
|
|
225
|
+
else
|
|
226
|
+
echo "⚠️ Warning: Failed to add tag: ${tag}"
|
|
227
|
+
fi
|
|
184
228
|
fi
|
|
185
229
|
done
|
|
186
230
|
fi
|
|
@@ -190,7 +234,7 @@ main() {
|
|
|
190
234
|
for tag in "${REMOVE_TAGS[@]}"; do
|
|
191
235
|
# Get current tags
|
|
192
236
|
local current_tags
|
|
193
|
-
current_tags=$(yaml_query ".projects.${PROJECT_NAME}.tags")
|
|
237
|
+
current_tags=$(yaml_query ".projects.${PROJECT_NAME}.tags" 2>/dev/null || echo "")
|
|
194
238
|
|
|
195
239
|
# Check if tag exists
|
|
196
240
|
if ! echo "$current_tags" | grep -q "^${tag}$"; then
|
|
@@ -223,16 +267,19 @@ main() {
|
|
|
223
267
|
for related in "${ADD_RELATED[@]}"; do
|
|
224
268
|
# Get current related projects
|
|
225
269
|
local current_related
|
|
226
|
-
current_related=$(yaml_query ".projects.${PROJECT_NAME}.related_projects")
|
|
270
|
+
current_related=$(yaml_query ".projects.${PROJECT_NAME}.related_projects" 2>/dev/null || echo "")
|
|
227
271
|
|
|
228
272
|
# Check if already exists
|
|
229
|
-
if echo "$current_related" | grep -q "^${related}$"; then
|
|
273
|
+
if [ -n "$current_related" ] && [ "$current_related" != "null" ] && echo "$current_related" | grep -q "^${related}$"; then
|
|
230
274
|
echo "⊘ Related project already exists: ${related}"
|
|
231
275
|
else
|
|
232
276
|
# Use yaml_array_append to add related project
|
|
233
|
-
yaml_array_append ".projects.${PROJECT_NAME}.related_projects" "$related"
|
|
234
|
-
|
|
235
|
-
|
|
277
|
+
if yaml_array_append ".projects.${PROJECT_NAME}.related_projects" "$related" 2>/dev/null; then
|
|
278
|
+
echo "✓ Added related project: ${related}"
|
|
279
|
+
updates_made=$((updates_made + 1))
|
|
280
|
+
else
|
|
281
|
+
echo "⚠️ Warning: Failed to add related project: ${related}"
|
|
282
|
+
fi
|
|
236
283
|
fi
|
|
237
284
|
done
|
|
238
285
|
fi
|
|
@@ -242,7 +289,7 @@ main() {
|
|
|
242
289
|
for related in "${REMOVE_RELATED[@]}"; do
|
|
243
290
|
# Get current related projects
|
|
244
291
|
local current_related
|
|
245
|
-
current_related=$(yaml_query ".projects.${PROJECT_NAME}.related_projects")
|
|
292
|
+
current_related=$(yaml_query ".projects.${PROJECT_NAME}.related_projects" 2>/dev/null || echo "")
|
|
246
293
|
|
|
247
294
|
# Check if exists
|
|
248
295
|
if ! echo "$current_related" | grep -q "^${related}$"; then
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# acp.projects-restore.sh - Restore/clone projects from registry git origins
|
|
3
|
+
# Part of Agent Context Protocol (ACP)
|
|
4
|
+
# Usage: ./acp.projects-restore.sh [--dry-run] [--install-acp]
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
# Source utilities
|
|
9
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
10
|
+
source "${SCRIPT_DIR}/acp.common.sh"
|
|
11
|
+
|
|
12
|
+
init_colors
|
|
13
|
+
|
|
14
|
+
# Parse arguments
|
|
15
|
+
DRY_RUN=false
|
|
16
|
+
INSTALL_ACP=false
|
|
17
|
+
|
|
18
|
+
while [ $# -gt 0 ]; do
|
|
19
|
+
case "$1" in
|
|
20
|
+
--dry-run)
|
|
21
|
+
DRY_RUN=true
|
|
22
|
+
shift
|
|
23
|
+
;;
|
|
24
|
+
--install-acp)
|
|
25
|
+
INSTALL_ACP=true
|
|
26
|
+
shift
|
|
27
|
+
;;
|
|
28
|
+
*)
|
|
29
|
+
echo "${RED}Error: Unknown option: $1${NC}"
|
|
30
|
+
echo ""
|
|
31
|
+
echo "Usage: $0 [--dry-run] [--install-acp]"
|
|
32
|
+
echo ""
|
|
33
|
+
echo "Options:"
|
|
34
|
+
echo " --dry-run Preview what would be cloned without cloning"
|
|
35
|
+
echo " --install-acp Run ACP install after cloning each project"
|
|
36
|
+
exit 1
|
|
37
|
+
;;
|
|
38
|
+
esac
|
|
39
|
+
done
|
|
40
|
+
|
|
41
|
+
# Get registry path
|
|
42
|
+
REGISTRY_PATH=$(get_projects_registry_path)
|
|
43
|
+
|
|
44
|
+
# Check if registry exists
|
|
45
|
+
if ! projects_registry_exists; then
|
|
46
|
+
echo "${RED}Error: No projects registry found at $REGISTRY_PATH${NC}"
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# Source YAML parser
|
|
51
|
+
source_yaml_parser
|
|
52
|
+
|
|
53
|
+
# Parse registry
|
|
54
|
+
yaml_parse "$REGISTRY_PATH"
|
|
55
|
+
|
|
56
|
+
# Get all project names
|
|
57
|
+
PROJECT_NAMES=$(yaml_query ".projects" 2>/dev/null | grep -E "^[a-z0-9-]+:" | sed 's/:$//' || true)
|
|
58
|
+
|
|
59
|
+
if [ -z "$PROJECT_NAMES" ]; then
|
|
60
|
+
echo "${YELLOW}No projects in registry${NC}"
|
|
61
|
+
exit 0
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
echo ""
|
|
65
|
+
if $DRY_RUN; then
|
|
66
|
+
echo "${BOLD}Restore Preview (dry run)${NC}"
|
|
67
|
+
else
|
|
68
|
+
echo "${BOLD}Restoring projects from registry...${NC}"
|
|
69
|
+
fi
|
|
70
|
+
echo ""
|
|
71
|
+
|
|
72
|
+
CLONE_COUNT=0
|
|
73
|
+
SKIP_COUNT=0
|
|
74
|
+
ERROR_COUNT=0
|
|
75
|
+
|
|
76
|
+
for project_name in $PROJECT_NAMES; do
|
|
77
|
+
project_status=$(yaml_query ".projects.${project_name}.status" 2>/dev/null || echo "active")
|
|
78
|
+
project_path=$(yaml_query ".projects.${project_name}.path" 2>/dev/null || echo "")
|
|
79
|
+
git_origin=$(yaml_query ".projects.${project_name}.git_origin" 2>/dev/null || echo "")
|
|
80
|
+
git_branch=$(yaml_query ".projects.${project_name}.git_branch" 2>/dev/null || echo "")
|
|
81
|
+
|
|
82
|
+
# Expand tilde
|
|
83
|
+
expanded_path="${project_path/#\~/$HOME}"
|
|
84
|
+
|
|
85
|
+
# Skip archived projects
|
|
86
|
+
if [ "$project_status" = "archived" ]; then
|
|
87
|
+
echo "${YELLOW}⊘${NC} ${project_name} (archived, skipping)"
|
|
88
|
+
SKIP_COUNT=$((SKIP_COUNT + 1))
|
|
89
|
+
continue
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
# Skip projects with no git origin
|
|
93
|
+
if [ -z "$git_origin" ] || [ "$git_origin" = "null" ]; then
|
|
94
|
+
echo "${YELLOW}⊘${NC} ${project_name} (no git_origin, skipping)"
|
|
95
|
+
SKIP_COUNT=$((SKIP_COUNT + 1))
|
|
96
|
+
continue
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
# Skip existing directories
|
|
100
|
+
if [ -d "$expanded_path" ]; then
|
|
101
|
+
echo "${GREEN}✓${NC} ${project_name} (already exists)"
|
|
102
|
+
SKIP_COUNT=$((SKIP_COUNT + 1))
|
|
103
|
+
continue
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
# This project needs cloning
|
|
107
|
+
if $DRY_RUN; then
|
|
108
|
+
echo "${BLUE}○${NC} ${project_name}"
|
|
109
|
+
echo " Would clone: ${git_origin}"
|
|
110
|
+
if [ -n "$git_branch" ] && [ "$git_branch" != "null" ]; then
|
|
111
|
+
echo " Branch: ${git_branch}"
|
|
112
|
+
fi
|
|
113
|
+
echo " Into: ${expanded_path}"
|
|
114
|
+
echo ""
|
|
115
|
+
CLONE_COUNT=$((CLONE_COUNT + 1))
|
|
116
|
+
continue
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
echo "${BLUE}○${NC} ${project_name} - cloning..."
|
|
120
|
+
|
|
121
|
+
# Ensure parent directory exists
|
|
122
|
+
mkdir -p "$(dirname "$expanded_path")"
|
|
123
|
+
|
|
124
|
+
# Build clone command
|
|
125
|
+
clone_args=()
|
|
126
|
+
if [ -n "$git_branch" ] && [ "$git_branch" != "null" ]; then
|
|
127
|
+
# Check if branch exists on remote before using it
|
|
128
|
+
if git ls-remote --heads "$git_origin" "$git_branch" 2>/dev/null | grep -q "$git_branch"; then
|
|
129
|
+
clone_args+=(--branch "$git_branch")
|
|
130
|
+
else
|
|
131
|
+
echo " ${YELLOW}Warning: Branch '$git_branch' not found on remote, using default${NC}"
|
|
132
|
+
fi
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
if git clone "${clone_args[@]}" "$git_origin" "$expanded_path" 2>/dev/null; then
|
|
136
|
+
echo " ${GREEN}✓ Cloned${NC}"
|
|
137
|
+
CLONE_COUNT=$((CLONE_COUNT + 1))
|
|
138
|
+
|
|
139
|
+
# Run ACP install if requested
|
|
140
|
+
if $INSTALL_ACP; then
|
|
141
|
+
install_script="${SCRIPT_DIR}/acp.install.sh"
|
|
142
|
+
if [ -f "$install_script" ]; then
|
|
143
|
+
echo " Installing ACP..."
|
|
144
|
+
if (cd "$expanded_path" && bash "$install_script") 2>/dev/null; then
|
|
145
|
+
echo " ${GREEN}✓ ACP installed${NC}"
|
|
146
|
+
else
|
|
147
|
+
echo " ${YELLOW}Warning: ACP install failed${NC}"
|
|
148
|
+
fi
|
|
149
|
+
fi
|
|
150
|
+
fi
|
|
151
|
+
else
|
|
152
|
+
echo " ${RED}✗ Clone failed${NC}"
|
|
153
|
+
ERROR_COUNT=$((ERROR_COUNT + 1))
|
|
154
|
+
fi
|
|
155
|
+
echo ""
|
|
156
|
+
done
|
|
157
|
+
|
|
158
|
+
# Summary
|
|
159
|
+
echo ""
|
|
160
|
+
echo "${BOLD}Restore Complete${NC}"
|
|
161
|
+
if $DRY_RUN; then
|
|
162
|
+
echo " Would clone: $CLONE_COUNT projects"
|
|
163
|
+
else
|
|
164
|
+
echo " Cloned: $CLONE_COUNT projects"
|
|
165
|
+
fi
|
|
166
|
+
echo " Skipped: $SKIP_COUNT projects"
|
|
167
|
+
if [ $ERROR_COUNT -gt 0 ]; then
|
|
168
|
+
echo " ${RED}Errors: $ERROR_COUNT${NC}"
|
|
169
|
+
fi
|
|
170
|
+
echo ""
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Sync registry with filesystem - discover unregistered projects
|
|
3
|
+
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
# Source utilities
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
+
source "${SCRIPT_DIR}/acp.common.sh"
|
|
9
|
+
|
|
10
|
+
init_colors
|
|
11
|
+
|
|
12
|
+
# Get registry path
|
|
13
|
+
REGISTRY_PATH=$(get_projects_registry_path)
|
|
14
|
+
|
|
15
|
+
# Initialize registry if needed
|
|
16
|
+
if ! projects_registry_exists; then
|
|
17
|
+
init_projects_registry
|
|
18
|
+
echo "${GREEN}✓${NC} Initialized projects registry"
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Scan ~/.acp/projects/ directory
|
|
22
|
+
PROJECTS_DIR="$HOME/.acp/projects"
|
|
23
|
+
|
|
24
|
+
if [ ! -d "$PROJECTS_DIR" ]; then
|
|
25
|
+
echo "${YELLOW}No projects directory found: $PROJECTS_DIR${NC}"
|
|
26
|
+
exit 0
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Find all directories with agent/progress.yaml (ACP projects)
|
|
30
|
+
echo ""
|
|
31
|
+
echo "${BOLD}Scanning for ACP projects in $PROJECTS_DIR...${NC}"
|
|
32
|
+
echo ""
|
|
33
|
+
|
|
34
|
+
FOUND_COUNT=0
|
|
35
|
+
REGISTERED_COUNT=0
|
|
36
|
+
|
|
37
|
+
for project_dir in "$PROJECTS_DIR"/*; do
|
|
38
|
+
if [ ! -d "$project_dir" ]; then
|
|
39
|
+
continue
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Check if it's an ACP project
|
|
43
|
+
if [ ! -f "$project_dir/agent/progress.yaml" ]; then
|
|
44
|
+
continue
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
project_name=$(basename "$project_dir")
|
|
48
|
+
FOUND_COUNT=$((FOUND_COUNT + 1))
|
|
49
|
+
|
|
50
|
+
# Check if already registered
|
|
51
|
+
if project_exists "$project_name"; then
|
|
52
|
+
echo "${GREEN}✓${NC} ${project_name} (already registered)"
|
|
53
|
+
continue
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
# Found unregistered project
|
|
57
|
+
echo "${YELLOW}○${NC} ${project_name} (not registered)"
|
|
58
|
+
|
|
59
|
+
# Read project metadata from progress.yaml
|
|
60
|
+
project_type="unknown"
|
|
61
|
+
project_desc="No description"
|
|
62
|
+
|
|
63
|
+
if [ -f "$project_dir/agent/progress.yaml" ]; then
|
|
64
|
+
# Source YAML parser
|
|
65
|
+
source_yaml_parser
|
|
66
|
+
|
|
67
|
+
# Parse the progress.yaml file
|
|
68
|
+
yaml_parse "$project_dir/agent/progress.yaml"
|
|
69
|
+
|
|
70
|
+
# Query metadata
|
|
71
|
+
project_type=$(yaml_query ".project.type" 2>/dev/null || echo "unknown")
|
|
72
|
+
project_desc=$(yaml_query ".project.description" 2>/dev/null || echo "No description")
|
|
73
|
+
|
|
74
|
+
# Clean up multiline descriptions
|
|
75
|
+
project_desc=$(echo "$project_desc" | tr '\n' ' ' | sed 's/ */ /g' | cut -c1-80)
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# Detect git info
|
|
79
|
+
local git_origin git_branch
|
|
80
|
+
git_origin=$(get_git_origin "$project_dir")
|
|
81
|
+
git_branch=$(get_git_branch "$project_dir")
|
|
82
|
+
|
|
83
|
+
# Prompt to register
|
|
84
|
+
echo " Type: $project_type"
|
|
85
|
+
echo " Description: $project_desc"
|
|
86
|
+
if [ -n "$git_origin" ]; then
|
|
87
|
+
echo " Git Origin: $git_origin"
|
|
88
|
+
fi
|
|
89
|
+
echo ""
|
|
90
|
+
read -p " Register this project? (Y/n) " -n 1 -r
|
|
91
|
+
echo ""
|
|
92
|
+
|
|
93
|
+
if [[ $REPLY =~ ^[Yy]$ ]] || [ -z "$REPLY" ]; then
|
|
94
|
+
register_project "$project_name" "$project_dir" "$project_type" "$project_desc" "$git_origin" "$git_branch"
|
|
95
|
+
echo "${GREEN} ✓ Registered${NC}"
|
|
96
|
+
REGISTERED_COUNT=$((REGISTERED_COUNT + 1))
|
|
97
|
+
else
|
|
98
|
+
echo "${YELLOW} ⊘ Skipped${NC}"
|
|
99
|
+
fi
|
|
100
|
+
echo ""
|
|
101
|
+
done
|
|
102
|
+
|
|
103
|
+
# Backfill git_origin/git_branch for already-registered projects missing them
|
|
104
|
+
BACKFILL_COUNT=0
|
|
105
|
+
|
|
106
|
+
source_yaml_parser
|
|
107
|
+
yaml_parse "$REGISTRY_PATH"
|
|
108
|
+
|
|
109
|
+
PROJECT_NAMES=$(yaml_query ".projects" 2>/dev/null | grep -E "^[a-z0-9-]+:" | sed 's/:$//' || true)
|
|
110
|
+
|
|
111
|
+
for project_name in $PROJECT_NAMES; do
|
|
112
|
+
existing_origin=$(yaml_query ".projects.${project_name}.git_origin" 2>/dev/null || echo "")
|
|
113
|
+
if [ -n "$existing_origin" ] && [ "$existing_origin" != "null" ]; then
|
|
114
|
+
continue
|
|
115
|
+
fi
|
|
116
|
+
|
|
117
|
+
# Resolve project path
|
|
118
|
+
project_path=$(yaml_query ".projects.${project_name}.path" 2>/dev/null || echo "")
|
|
119
|
+
expanded_path="${project_path/#\~/$HOME}"
|
|
120
|
+
|
|
121
|
+
if [ ! -d "$expanded_path" ]; then
|
|
122
|
+
continue
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
git_origin=$(get_git_origin "$expanded_path")
|
|
126
|
+
git_branch=$(get_git_branch "$expanded_path")
|
|
127
|
+
|
|
128
|
+
if [ -n "$git_origin" ]; then
|
|
129
|
+
yaml_set "projects.${project_name}.git_origin" "$git_origin"
|
|
130
|
+
if [ -n "$git_branch" ]; then
|
|
131
|
+
yaml_set "projects.${project_name}.git_branch" "$git_branch"
|
|
132
|
+
fi
|
|
133
|
+
BACKFILL_COUNT=$((BACKFILL_COUNT + 1))
|
|
134
|
+
echo "${GREEN}✓${NC} ${project_name} (backfilled git_origin)"
|
|
135
|
+
fi
|
|
136
|
+
done
|
|
137
|
+
|
|
138
|
+
if [ $BACKFILL_COUNT -gt 0 ]; then
|
|
139
|
+
yaml_set "last_updated" "$(get_timestamp)"
|
|
140
|
+
yaml_write "$REGISTRY_PATH"
|
|
141
|
+
echo ""
|
|
142
|
+
echo "${GREEN}✓${NC} Backfilled git info for $BACKFILL_COUNT existing projects"
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
# Summary
|
|
146
|
+
echo ""
|
|
147
|
+
echo "${BOLD}Sync Complete${NC}"
|
|
148
|
+
echo " Found: $FOUND_COUNT projects"
|
|
149
|
+
echo " Registered: $REGISTERED_COUNT new projects"
|
|
150
|
+
echo " Backfilled: $BACKFILL_COUNT git origins"
|
|
151
|
+
echo ""
|
|
152
|
+
|
|
153
|
+
if [ $REGISTERED_COUNT -gt 0 ] || [ $BACKFILL_COUNT -gt 0 ]; then
|
|
154
|
+
echo "Run ${BOLD}@acp.project-list${NC} to see all registered projects"
|
|
155
|
+
fi
|