@prmichaelsen/remember-mcp 3.0.0 → 3.13.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 (208) hide show
  1. package/AGENT.md +296 -250
  2. package/CHANGELOG.md +358 -0
  3. package/README.md +68 -45
  4. package/agent/commands/acp.clarification-create.md +382 -0
  5. package/agent/commands/acp.project-info.md +309 -0
  6. package/agent/commands/acp.project-remove.md +379 -0
  7. package/agent/commands/acp.project-update.md +296 -0
  8. package/agent/commands/acp.task-create.md +17 -9
  9. package/agent/commands/git.commit.md +13 -1
  10. package/agent/design/comment-memory-type.md +2 -2
  11. package/agent/design/local.collaborative-memory-sync.md +265 -0
  12. package/agent/design/local.content-flags.md +210 -0
  13. package/agent/design/local.ghost-persona-system.md +273 -0
  14. package/agent/design/local.group-acl-integration.md +338 -0
  15. package/agent/design/local.memory-acl-schema.md +352 -0
  16. package/agent/design/local.memory-collection-pattern-v2.md +348 -0
  17. package/agent/design/local.moderation-and-space-config.md +257 -0
  18. package/agent/design/local.v2-api-reference.md +621 -0
  19. package/agent/design/local.v2-migration-guide.md +191 -0
  20. package/agent/design/local.v2-usage-examples.md +265 -0
  21. package/agent/design/permissions-storage-architecture.md +11 -3
  22. package/agent/design/trust-escalation-prevention.md +9 -2
  23. package/agent/design/trust-system-implementation.md +12 -3
  24. package/agent/milestones/milestone-14-memory-collection-v2.md +182 -0
  25. package/agent/milestones/milestone-15-moderation-space-config.md +126 -0
  26. package/agent/progress.yaml +628 -49
  27. package/agent/scripts/acp.common.sh +2 -0
  28. package/agent/scripts/acp.install.sh +11 -1
  29. package/agent/scripts/acp.package-install-optimized.sh +454 -0
  30. package/agent/scripts/acp.package-install.sh +247 -300
  31. package/agent/scripts/acp.project-info.sh +218 -0
  32. package/agent/scripts/acp.project-remove.sh +302 -0
  33. package/agent/scripts/acp.project-update.sh +296 -0
  34. package/agent/scripts/acp.yaml-parser.sh +128 -10
  35. package/agent/tasks/milestone-14-memory-collection-v2/task-165-core-infrastructure-setup.md +171 -0
  36. package/agent/tasks/milestone-14-memory-collection-v2/task-166-update-remember-publish.md +191 -0
  37. package/agent/tasks/milestone-14-memory-collection-v2/task-167-update-remember-retract.md +186 -0
  38. package/agent/tasks/milestone-14-memory-collection-v2/task-168-implement-remember-revise.md +184 -0
  39. package/agent/tasks/milestone-14-memory-collection-v2/task-169-update-remember-search-space.md +179 -0
  40. package/agent/tasks/milestone-14-memory-collection-v2/task-170-update-remember-create-update.md +139 -0
  41. package/agent/tasks/milestone-14-memory-collection-v2/task-172-performance-testing-optimization.md +161 -0
  42. package/agent/tasks/milestone-14-memory-collection-v2/task-173-documentation-examples.md +258 -0
  43. package/agent/tasks/milestone-15-moderation-space-config/task-174-add-moderation-schema-fields.md +57 -0
  44. package/agent/tasks/milestone-15-moderation-space-config/task-175-create-space-config-service.md +64 -0
  45. package/agent/tasks/milestone-15-moderation-space-config/task-176-wire-moderation-publish-flow.md +45 -0
  46. package/agent/tasks/milestone-15-moderation-space-config/task-177-add-moderation-search-filters.md +70 -0
  47. package/agent/tasks/milestone-15-moderation-space-config/task-178-create-remember-moderate-tool.md +69 -0
  48. package/agent/tasks/milestone-15-moderation-space-config/task-179-documentation-integration-tests.md +58 -0
  49. package/agent/tasks/milestone-16-ghost-system/task-187-ghost-config-firestore.md +41 -0
  50. package/agent/tasks/milestone-16-ghost-system/task-188-trust-filter-integration.md +44 -0
  51. package/agent/tasks/milestone-16-ghost-system/task-189-ghost-memory-filtering.md +43 -0
  52. package/agent/tasks/milestone-16-ghost-system/task-190-ghost-config-tools.md +45 -0
  53. package/agent/tasks/milestone-16-ghost-system/task-191-escalation-firestore.md +38 -0
  54. package/agent/tasks/milestone-16-ghost-system/task-192-documentation-verification.md +39 -0
  55. package/agent/tasks/milestone-7-trust-permissions/task-180-access-result-permission-types.md +69 -0
  56. package/agent/tasks/milestone-7-trust-permissions/task-181-firestore-permissions-access-logs.md +56 -0
  57. package/agent/tasks/milestone-7-trust-permissions/task-182-trust-enforcement-service.md +68 -0
  58. package/agent/tasks/milestone-7-trust-permissions/task-183-access-control-service.md +70 -0
  59. package/agent/tasks/milestone-7-trust-permissions/task-184-permission-tools.md +79 -0
  60. package/agent/tasks/milestone-7-trust-permissions/task-185-wire-trust-into-search-query.md +55 -0
  61. package/agent/tasks/milestone-7-trust-permissions/task-186-documentation-verification.md +56 -0
  62. package/agent/tasks/task-76-fix-indexnullstate-schema-bug.md +197 -0
  63. package/dist/collections/composite-ids.d.ts +106 -0
  64. package/dist/collections/core-infrastructure.spec.d.ts +11 -0
  65. package/dist/collections/dot-notation.d.ts +106 -0
  66. package/dist/collections/tracking-arrays.d.ts +176 -0
  67. package/dist/constants/content-types.d.ts +1 -0
  68. package/dist/schema/v2-collections-comments.spec.d.ts +8 -0
  69. package/dist/schema/v2-collections.d.ts +210 -0
  70. package/dist/server-factory.d.ts +15 -0
  71. package/dist/server-factory.js +2798 -1029
  72. package/dist/server.js +2526 -1012
  73. package/dist/services/access-control.d.ts +103 -0
  74. package/dist/services/access-control.spec.d.ts +2 -0
  75. package/dist/services/credentials-provider.d.ts +24 -0
  76. package/dist/services/credentials-provider.spec.d.ts +2 -0
  77. package/dist/services/escalation.service.d.ts +22 -0
  78. package/dist/services/escalation.service.spec.d.ts +2 -0
  79. package/dist/services/ghost-config.service.d.ts +55 -0
  80. package/dist/services/ghost-config.service.spec.d.ts +2 -0
  81. package/dist/services/space-config.service.d.ts +23 -0
  82. package/dist/services/space-config.service.spec.d.ts +2 -0
  83. package/dist/services/trust-enforcement.d.ts +83 -0
  84. package/dist/services/trust-enforcement.spec.d.ts +2 -0
  85. package/dist/services/trust-validator.d.ts +43 -0
  86. package/dist/services/trust-validator.spec.d.ts +2 -0
  87. package/dist/tools/confirm-publish-moderation.spec.d.ts +8 -0
  88. package/dist/tools/confirm.d.ts +8 -1
  89. package/dist/tools/create-memory.d.ts +2 -1
  90. package/dist/tools/create-memory.spec.d.ts +10 -0
  91. package/dist/tools/create-relationship.d.ts +2 -1
  92. package/dist/tools/delete-memory.d.ts +2 -1
  93. package/dist/tools/delete-relationship.d.ts +2 -1
  94. package/dist/tools/deny.d.ts +2 -1
  95. package/dist/tools/find-similar.d.ts +2 -1
  96. package/dist/tools/get-preferences.d.ts +2 -1
  97. package/dist/tools/ghost-config.d.ts +27 -0
  98. package/dist/tools/ghost-config.spec.d.ts +2 -0
  99. package/dist/tools/moderate.d.ts +20 -0
  100. package/dist/tools/moderate.spec.d.ts +5 -0
  101. package/dist/tools/publish.d.ts +11 -3
  102. package/dist/tools/query-memory.d.ts +3 -1
  103. package/dist/tools/query-space.d.ts +4 -1
  104. package/dist/tools/retract.d.ts +29 -0
  105. package/dist/tools/revise.d.ts +45 -0
  106. package/dist/tools/revise.spec.d.ts +8 -0
  107. package/dist/tools/search-memory.d.ts +2 -1
  108. package/dist/tools/search-relationship.d.ts +2 -1
  109. package/dist/tools/search-space.d.ts +25 -5
  110. package/dist/tools/search-space.spec.d.ts +9 -0
  111. package/dist/tools/set-preference.d.ts +2 -1
  112. package/dist/tools/update-memory.d.ts +2 -1
  113. package/dist/tools/update-relationship.d.ts +2 -1
  114. package/dist/types/access-result.d.ts +48 -0
  115. package/dist/types/access-result.spec.d.ts +2 -0
  116. package/dist/types/auth.d.ts +46 -0
  117. package/dist/types/ghost-config.d.ts +36 -0
  118. package/dist/types/memory.d.ts +3 -1
  119. package/dist/types/preferences.d.ts +1 -1
  120. package/dist/utils/auth-helpers.d.ts +14 -0
  121. package/dist/utils/auth-helpers.spec.d.ts +2 -0
  122. package/dist/utils/test-data-generator.d.ts +124 -0
  123. package/dist/utils/test-data-generator.spec.d.ts +12 -0
  124. package/dist/v2-performance.e2e.d.ts +17 -0
  125. package/dist/v2-smoke.e2e.d.ts +14 -0
  126. package/dist/weaviate/client.d.ts +5 -8
  127. package/dist/weaviate/space-schema.d.ts +2 -2
  128. package/docs/performance/v2-benchmarks.md +80 -0
  129. package/jest.e2e.config.js +14 -3
  130. package/package.json +1 -1
  131. package/scripts/.collection-recreation-state.yaml +16 -0
  132. package/scripts/.gitkeep +5 -0
  133. package/scripts/README-collection-recreation.md +224 -0
  134. package/scripts/README.md +51 -0
  135. package/scripts/backup-collections.ts +543 -0
  136. package/scripts/delete-collection.ts +137 -0
  137. package/scripts/migrate-recreate-collections.ts +578 -0
  138. package/scripts/migrate-v1-to-v2.ts +1094 -0
  139. package/scripts/package-lock.json +1113 -0
  140. package/scripts/package.json +27 -0
  141. package/src/collections/composite-ids.ts +193 -0
  142. package/src/collections/core-infrastructure.spec.ts +353 -0
  143. package/src/collections/dot-notation.ts +212 -0
  144. package/src/collections/tracking-arrays.ts +298 -0
  145. package/src/constants/content-types.ts +20 -0
  146. package/src/schema/v2-collections-comments.spec.ts +141 -0
  147. package/src/schema/v2-collections.ts +433 -0
  148. package/src/server-factory.ts +89 -20
  149. package/src/server.ts +45 -17
  150. package/src/services/access-control.spec.ts +383 -0
  151. package/src/services/access-control.ts +291 -0
  152. package/src/services/credentials-provider.spec.ts +22 -0
  153. package/src/services/credentials-provider.ts +34 -0
  154. package/src/services/escalation.service.spec.ts +183 -0
  155. package/src/services/escalation.service.ts +150 -0
  156. package/src/services/ghost-config.service.spec.ts +339 -0
  157. package/src/services/ghost-config.service.ts +219 -0
  158. package/src/services/space-config.service.spec.ts +102 -0
  159. package/src/services/space-config.service.ts +79 -0
  160. package/src/services/trust-enforcement.spec.ts +309 -0
  161. package/src/services/trust-enforcement.ts +197 -0
  162. package/src/services/trust-validator.spec.ts +108 -0
  163. package/src/services/trust-validator.ts +105 -0
  164. package/src/tools/confirm-publish-moderation.spec.ts +240 -0
  165. package/src/tools/confirm.ts +869 -135
  166. package/src/tools/create-memory.spec.ts +126 -0
  167. package/src/tools/create-memory.ts +20 -27
  168. package/src/tools/create-relationship.ts +17 -8
  169. package/src/tools/delete-memory.ts +13 -6
  170. package/src/tools/delete-relationship.ts +15 -6
  171. package/src/tools/deny.ts +8 -1
  172. package/src/tools/find-similar.ts +21 -8
  173. package/src/tools/get-preferences.ts +10 -1
  174. package/src/tools/ghost-config.spec.ts +180 -0
  175. package/src/tools/ghost-config.ts +230 -0
  176. package/src/tools/moderate.spec.ts +277 -0
  177. package/src/tools/moderate.ts +219 -0
  178. package/src/tools/publish.ts +99 -41
  179. package/src/tools/query-memory.ts +28 -6
  180. package/src/tools/query-space.ts +39 -4
  181. package/src/tools/retract.ts +292 -0
  182. package/src/tools/revise.spec.ts +146 -0
  183. package/src/tools/revise.ts +283 -0
  184. package/src/tools/search-memory.ts +30 -7
  185. package/src/tools/search-relationship.ts +11 -2
  186. package/src/tools/search-space.spec.ts +341 -0
  187. package/src/tools/search-space.ts +323 -99
  188. package/src/tools/set-preference.ts +10 -1
  189. package/src/tools/update-memory.ts +16 -5
  190. package/src/tools/update-relationship.ts +10 -1
  191. package/src/types/access-result.spec.ts +193 -0
  192. package/src/types/access-result.ts +62 -0
  193. package/src/types/auth.ts +52 -0
  194. package/src/types/ghost-config.ts +46 -0
  195. package/src/types/memory.ts +9 -1
  196. package/src/types/preferences.ts +2 -2
  197. package/src/utils/auth-helpers.spec.ts +75 -0
  198. package/src/utils/auth-helpers.ts +25 -0
  199. package/src/utils/test-data-generator.spec.ts +317 -0
  200. package/src/utils/test-data-generator.ts +292 -0
  201. package/src/utils/weaviate-filters.ts +4 -4
  202. package/src/v2-performance.e2e.ts +173 -0
  203. package/src/v2-smoke.e2e.ts +401 -0
  204. package/src/weaviate/client.spec.ts +5 -5
  205. package/src/weaviate/client.ts +51 -36
  206. package/src/weaviate/schema.ts +11 -256
  207. package/src/weaviate/space-schema.spec.ts +24 -24
  208. package/src/weaviate/space-schema.ts +18 -6
@@ -0,0 +1,218 @@
1
+ #!/bin/bash
2
+ # acp.project-info.sh - Display detailed project information from registry
3
+ # Part of Agent Context Protocol (ACP)
4
+ # Usage: ./acp.project-info.sh <project-name>
5
+
6
+ set -euo pipefail
7
+
8
+ # Get script directory
9
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
+
11
+ # Source common utilities
12
+ source "${SCRIPT_DIR}/acp.common.sh"
13
+
14
+ # Source YAML parser
15
+ source_yaml_parser
16
+
17
+ # Main function
18
+ main() {
19
+ local project_name="${1:-}"
20
+
21
+ # Validate argument
22
+ if [ -z "$project_name" ]; then
23
+ echo "Error: Project name required"
24
+ echo ""
25
+ echo "Usage: $0 <project-name>"
26
+ echo ""
27
+ echo "Example:"
28
+ echo " $0 remember-mcp-server"
29
+ echo ""
30
+ echo "Run 'acp.project-list.sh' to see available projects"
31
+ return 1
32
+ fi
33
+
34
+ # Get registry path
35
+ local registry_path
36
+ registry_path=$(get_projects_registry_path)
37
+
38
+ # Check if registry exists
39
+ if [ ! -f "$registry_path" ]; then
40
+ echo "Error: Project registry not found at: $registry_path"
41
+ echo ""
42
+ echo "The registry may not be initialized yet."
43
+ echo "Create a project with '@acp.project-create' to initialize the registry."
44
+ return 1
45
+ fi
46
+
47
+ # Parse registry
48
+ yaml_parse "$registry_path"
49
+
50
+ # Check if project exists
51
+ if ! yaml_query ".projects.${project_name}" >/dev/null 2>&1 || [ "$(yaml_query ".projects.${project_name}")" = "null" ]; then
52
+ echo "Error: Project '${project_name}' not found in registry"
53
+ echo ""
54
+ echo "Available projects:"
55
+
56
+ # List available projects
57
+ local projects
58
+ projects=$(yaml_query ".projects")
59
+
60
+ if [ -z "$projects" ] || [ "$projects" = "null" ]; then
61
+ echo " (none)"
62
+ else
63
+ echo "$projects" | grep -E "^[a-zA-Z0-9_-]+:" | sed 's/:$//' | while read -r proj; do
64
+ echo " - $proj"
65
+ done
66
+ fi
67
+
68
+ return 1
69
+ fi
70
+
71
+ # Extract project metadata
72
+ local path type description status created last_modified last_accessed
73
+ path=$(yaml_query ".projects.${project_name}.path")
74
+ type=$(yaml_query ".projects.${project_name}.type")
75
+ description=$(yaml_query ".projects.${project_name}.description")
76
+ status=$(yaml_query ".projects.${project_name}.status")
77
+ created=$(yaml_query ".projects.${project_name}.created")
78
+ last_modified=$(yaml_query ".projects.${project_name}.last_modified")
79
+ last_accessed=$(yaml_query ".projects.${project_name}.last_accessed")
80
+
81
+ # Get optional fields
82
+ local tags related_projects dependencies
83
+ tags=$(yaml_query ".projects.${project_name}.tags")
84
+ related_projects=$(yaml_query ".projects.${project_name}.related_projects")
85
+ dependencies=$(yaml_query ".projects.${project_name}.dependencies")
86
+
87
+ # Check if this is the current project
88
+ local current_project
89
+ current_project=$(yaml_query ".current_project")
90
+ local is_current=""
91
+ if [ "$current_project" = "$project_name" ]; then
92
+ is_current=" ⭐ Current"
93
+ fi
94
+
95
+ # Display project information
96
+ echo ""
97
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
98
+ echo ""
99
+ echo "📦 ${project_name}${is_current}"
100
+ echo ""
101
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
102
+ echo ""
103
+
104
+ # Basic information
105
+ echo "Type: ${type}"
106
+ echo "Status: ${status}"
107
+ echo "Path: ${path}"
108
+ echo ""
109
+ echo "Description:"
110
+ echo " ${description}"
111
+ echo ""
112
+
113
+ # Timestamps
114
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
115
+ echo ""
116
+ echo "Timestamps:"
117
+ echo " Created: ${created}"
118
+ echo " Last Modified: ${last_modified}"
119
+ echo " Last Accessed: ${last_accessed}"
120
+ echo ""
121
+
122
+ # Tags (if present)
123
+ if [ -n "$tags" ] && [ "$tags" != "null" ]; then
124
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
125
+ echo ""
126
+ echo "Tags:"
127
+ echo "$tags" | grep -v "^$" | sed 's/^/ - /'
128
+ echo ""
129
+ fi
130
+
131
+ # Related projects (if present)
132
+ if [ -n "$related_projects" ] && [ "$related_projects" != "null" ]; then
133
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
134
+ echo ""
135
+ echo "Related Projects:"
136
+ echo "$related_projects" | grep -v "^$" | sed 's/^/ - /'
137
+ echo ""
138
+ fi
139
+
140
+ # Dependencies (if present)
141
+ if [ -n "$dependencies" ] && [ "$dependencies" != "null" ]; then
142
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
143
+ echo ""
144
+ echo "Dependencies:"
145
+
146
+ # Check for npm dependencies
147
+ local npm_deps
148
+ npm_deps=$(yaml_query ".projects.${project_name}.dependencies.npm")
149
+ if [ -n "$npm_deps" ] && [ "$npm_deps" != "null" ]; then
150
+ echo " npm:"
151
+ echo "$npm_deps" | grep -v "^$" | sed 's/^/ - /'
152
+ fi
153
+
154
+ # Check for pip dependencies
155
+ local pip_deps
156
+ pip_deps=$(yaml_query ".projects.${project_name}.dependencies.pip")
157
+ if [ -n "$pip_deps" ] && [ "$pip_deps" != "null" ]; then
158
+ echo " pip:"
159
+ echo "$pip_deps" | grep -v "^$" | sed 's/^/ - /'
160
+ fi
161
+
162
+ # Check for cargo dependencies
163
+ local cargo_deps
164
+ cargo_deps=$(yaml_query ".projects.${project_name}.dependencies.cargo")
165
+ if [ -n "$cargo_deps" ] && [ "$cargo_deps" != "null" ]; then
166
+ echo " cargo:"
167
+ echo "$cargo_deps" | grep -v "^$" | sed 's/^/ - /'
168
+ fi
169
+
170
+ # Check for go dependencies
171
+ local go_deps
172
+ go_deps=$(yaml_query ".projects.${project_name}.dependencies.go")
173
+ if [ -n "$go_deps" ] && [ "$go_deps" != "null" ]; then
174
+ echo " go:"
175
+ echo "$go_deps" | grep -v "^$" | sed 's/^/ - /'
176
+ fi
177
+
178
+ echo ""
179
+ fi
180
+
181
+ # Directory status
182
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
183
+ echo ""
184
+
185
+ # Expand tilde in path
186
+ local expanded_path="${path/#\~/$HOME}"
187
+
188
+ if [ -d "$expanded_path" ]; then
189
+ echo "✅ Project directory exists"
190
+
191
+ # Check if it's an ACP project
192
+ if [ -f "${expanded_path}/AGENT.md" ]; then
193
+ echo "✅ ACP project (AGENT.md found)"
194
+
195
+ # Try to read version from AGENT.md
196
+ if [ -f "${expanded_path}/agent/progress.yaml" ]; then
197
+ local project_version
198
+ yaml_parse "${expanded_path}/agent/progress.yaml"
199
+ project_version=$(yaml_query ".project.version")
200
+ if [ -n "$project_version" ] && [ "$project_version" != "null" ]; then
201
+ echo " Version: ${project_version}"
202
+ fi
203
+ fi
204
+ else
205
+ echo "⚠️ Not an ACP project (AGENT.md not found)"
206
+ fi
207
+ else
208
+ echo "❌ Project directory not found: ${expanded_path}"
209
+ echo " The project may have been moved or deleted"
210
+ fi
211
+
212
+ echo ""
213
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
214
+ echo ""
215
+ }
216
+
217
+ # Execute main function
218
+ main "$@"
@@ -0,0 +1,302 @@
1
+ #!/usr/bin/env bash
2
+ # ACP Project Remove - Remove project from registry
3
+ # Optionally delete project directory from filesystem
4
+
5
+ set -euo pipefail
6
+
7
+ # Get script directory
8
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
+
10
+ # Source common utilities
11
+ source "${SCRIPT_DIR}/acp.common.sh"
12
+
13
+ # Source YAML parser
14
+ source_yaml_parser
15
+
16
+ # Default flags
17
+ DELETE_FILES=false
18
+ AUTO_CONFIRM=false
19
+
20
+ # Usage information
21
+ usage() {
22
+ cat << EOF
23
+ Usage: acp.project-remove.sh <project-name> [options]
24
+
25
+ Remove a project from the global registry.
26
+
27
+ Arguments:
28
+ project-name Name of the project to remove
29
+
30
+ Options:
31
+ --delete-files Also delete the project directory from filesystem
32
+ -y, --yes Auto-confirm without prompting
33
+ -h, --help Show this help message
34
+
35
+ Examples:
36
+ acp.project-remove.sh old-project
37
+ acp.project-remove.sh old-project --delete-files
38
+ acp.project-remove.sh old-project --delete-files -y
39
+
40
+ EOF
41
+ exit 1
42
+ }
43
+
44
+ # Main function
45
+ main() {
46
+ local project_name="$1"
47
+
48
+ # Get registry path
49
+ local registry_path=$(get_projects_registry_path)
50
+
51
+ # Check if registry exists
52
+ if [ ! -f "$registry_path" ]; then
53
+ echo "Error: Project registry not found at: $registry_path"
54
+ echo "No projects to remove"
55
+ exit 1
56
+ fi
57
+
58
+ # Parse registry (sets global AST)
59
+ yaml_parse "$registry_path"
60
+
61
+ # Check if project exists in registry
62
+ local project_path=$(yaml_query ".projects.${project_name}.path" 2>/dev/null || echo "")
63
+
64
+ if [ -z "$project_path" ]; then
65
+ echo "Error: Project '${project_name}' not found in registry"
66
+ echo ""
67
+ echo "Available projects:"
68
+
69
+ # List available projects
70
+ local projects=$(yaml_query ".projects" 2>/dev/null | grep -E "^[a-zA-Z0-9_-]+:" | sed 's/:$//' || echo "")
71
+
72
+ if [ -n "$projects" ]; then
73
+ echo "$projects" | while read -r proj; do
74
+ echo " - $proj"
75
+ done
76
+ else
77
+ echo " (none)"
78
+ fi
79
+
80
+ echo ""
81
+ echo "Run '@acp.project-list' to see all projects"
82
+ exit 1
83
+ fi
84
+
85
+ # Expand tilde in path
86
+ project_path="${project_path/#\~/$HOME}"
87
+
88
+ # Get current project
89
+ local current_project=$(yaml_query ".current_project" 2>/dev/null || echo "")
90
+ local is_current=false
91
+
92
+ if [ "$current_project" = "$project_name" ]; then
93
+ is_current=true
94
+ fi
95
+
96
+ # Get project metadata for display
97
+ local project_type=$(yaml_query ".projects.${project_name}.type" 2>/dev/null || echo "unknown")
98
+ local project_description=$(yaml_query ".projects.${project_name}.description" 2>/dev/null || echo "")
99
+ local dir_exists=false
100
+
101
+ if [ -d "$project_path" ]; then
102
+ dir_exists=true
103
+ fi
104
+
105
+ # Display what will be removed
106
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
107
+ echo "Project to Remove"
108
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
109
+ echo ""
110
+ echo "Name: ${project_name}"
111
+ echo "Type: ${project_type}"
112
+ if [ -n "$project_description" ]; then
113
+ echo "Description: ${project_description}"
114
+ fi
115
+ echo "Path: ${project_path}"
116
+
117
+ if [ "$is_current" = true ]; then
118
+ echo ""
119
+ echo "⚠️ WARNING: This is the CURRENT project"
120
+ fi
121
+
122
+ if [ "$dir_exists" = true ]; then
123
+ echo ""
124
+ if [ "$DELETE_FILES" = true ]; then
125
+ echo "⚠️ WARNING: Project directory will be DELETED from filesystem"
126
+ else
127
+ echo "ℹ️ Project directory will be kept (use --delete-files to remove)"
128
+ fi
129
+ else
130
+ echo ""
131
+ echo "ℹ️ Project directory not found (already deleted or moved)"
132
+ fi
133
+
134
+ echo ""
135
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
136
+ echo ""
137
+
138
+ # Confirm removal
139
+ if [ "$AUTO_CONFIRM" = false ]; then
140
+ echo -n "Remove this project from registry? [y/N] "
141
+ read -r response
142
+
143
+ if [[ ! "$response" =~ ^[Yy]$ ]]; then
144
+ echo "Cancelled"
145
+ exit 0
146
+ fi
147
+
148
+ # Additional confirmation for file deletion
149
+ if [ "$DELETE_FILES" = true ] && [ "$dir_exists" = true ]; then
150
+ echo ""
151
+ echo "⚠️ DANGER: You are about to DELETE the project directory:"
152
+ echo " ${project_path}"
153
+ echo ""
154
+ echo -n "Are you ABSOLUTELY SURE? Type 'DELETE' to confirm: "
155
+ read -r confirm_delete
156
+
157
+ if [ "$confirm_delete" != "DELETE" ]; then
158
+ echo "Cancelled - directory will not be deleted"
159
+ DELETE_FILES=false
160
+ fi
161
+ fi
162
+ fi
163
+
164
+ # Delete project directory if requested
165
+ if [ "$DELETE_FILES" = true ] && [ "$dir_exists" = true ]; then
166
+ echo ""
167
+ echo "Deleting project directory..."
168
+ rm -rf "$project_path"
169
+ echo "✓ Deleted: ${project_path}"
170
+ fi
171
+
172
+ # Re-parse registry for removal operations
173
+ yaml_parse "$registry_path"
174
+
175
+ # Remove project from registry using sed (yaml_set doesn't support deletion)
176
+ # We'll use a temporary file approach
177
+ local temp_file=$(mktemp)
178
+
179
+ # Use awk to remove the project section
180
+ awk -v proj="$project_name" '
181
+ BEGIN { in_project = 0; indent_level = 0 }
182
+
183
+ # Detect project start
184
+ /^ [a-zA-Z0-9_-]+:/ {
185
+ # Extract project name from line
186
+ match($0, /^ ([a-zA-Z0-9_-]+):/, arr)
187
+ if (arr[1] == proj) {
188
+ in_project = 1
189
+ indent_level = 2
190
+ next
191
+ } else {
192
+ in_project = 0
193
+ }
194
+ }
195
+
196
+ # Skip lines that are part of the project being removed
197
+ in_project == 1 {
198
+ # Check if this line is still part of the project (indented more than 2 spaces)
199
+ if (match($0, /^ /)) {
200
+ next
201
+ } else if (match($0, /^ [a-zA-Z0-9_-]+:/)) {
202
+ # New project started, stop skipping
203
+ in_project = 0
204
+ } else if (match($0, /^[a-zA-Z]/)) {
205
+ # New top-level key, stop skipping
206
+ in_project = 0
207
+ }
208
+ }
209
+
210
+ # Print all other lines
211
+ in_project == 0 { print }
212
+ ' "$registry_path" > "$temp_file"
213
+
214
+ # Replace registry with updated version
215
+ mv "$temp_file" "$registry_path"
216
+
217
+ # Update current_project if we removed the current project
218
+ if [ "$is_current" = true ]; then
219
+ yaml_parse "$registry_path"
220
+ yaml_set "current_project" ""
221
+
222
+ # Update timestamp
223
+ local timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
224
+ yaml_set "last_updated" "$timestamp"
225
+
226
+ yaml_write "$registry_path"
227
+ else
228
+ # Just update timestamp
229
+ yaml_parse "$registry_path"
230
+ local timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
231
+ yaml_set "last_updated" "$timestamp"
232
+ yaml_write "$registry_path"
233
+ fi
234
+
235
+ # Report success
236
+ echo ""
237
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
238
+ echo "✅ Project Removed"
239
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
240
+ echo ""
241
+ echo "Removed from registry: ${project_name}"
242
+
243
+ if [ "$DELETE_FILES" = true ] && [ "$dir_exists" = true ]; then
244
+ echo "Deleted from filesystem: ${project_path}"
245
+ elif [ "$dir_exists" = true ]; then
246
+ echo "Directory preserved: ${project_path}"
247
+ fi
248
+
249
+ if [ "$is_current" = true ]; then
250
+ echo ""
251
+ echo "⚠️ This was the current project"
252
+ echo "Run '@acp.project-set <name>' to switch to another project"
253
+ fi
254
+
255
+ echo ""
256
+ echo "Run '@acp.project-list' to see remaining projects"
257
+ }
258
+
259
+ # Parse arguments
260
+ if [ $# -eq 0 ]; then
261
+ usage
262
+ fi
263
+
264
+ PROJECT_NAME=""
265
+
266
+ while [ $# -gt 0 ]; do
267
+ case "$1" in
268
+ -h|--help)
269
+ usage
270
+ ;;
271
+ --delete-files)
272
+ DELETE_FILES=true
273
+ shift
274
+ ;;
275
+ -y|--yes)
276
+ AUTO_CONFIRM=true
277
+ shift
278
+ ;;
279
+ -*)
280
+ echo "Error: Unknown option: $1"
281
+ usage
282
+ ;;
283
+ *)
284
+ if [ -z "$PROJECT_NAME" ]; then
285
+ PROJECT_NAME="$1"
286
+ else
287
+ echo "Error: Multiple project names provided"
288
+ usage
289
+ fi
290
+ shift
291
+ ;;
292
+ esac
293
+ done
294
+
295
+ # Validate project name provided
296
+ if [ -z "$PROJECT_NAME" ]; then
297
+ echo "Error: Project name required"
298
+ usage
299
+ fi
300
+
301
+ # Run main function
302
+ main "$PROJECT_NAME"