universal-agent-memory 6.1.1 → 6.2.1

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/scripts/setup.sh DELETED
@@ -1,337 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # Colors
5
- GREEN='\033[0;32m'
6
- YELLOW='\033[1;33m'
7
- RED='\033[0;31m'
8
- BLUE='\033[0;34m'
9
- NC='\033[0m' # No Color
10
-
11
- # Configuration
12
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13
- PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
14
- HOOKS_DIR="${PROJECT_ROOT}/.git/hooks"
15
-
16
- echo -e "${BLUE}🔧 Universal Agent Memory - Complete Setup${NC}"
17
- echo "================================================"
18
- echo ""
19
-
20
- # ============================================================================
21
- # DEPENDENCY CHECKS
22
- # ============================================================================
23
-
24
- echo -e "${BLUE}Checking dependencies...${NC}"
25
- echo ""
26
-
27
- MISSING_DEPS=()
28
- RECOMMENDED_DEPS=()
29
-
30
- # Required dependencies
31
- echo -e "${YELLOW}Required dependencies:${NC}"
32
-
33
- if ! command -v node &> /dev/null; then
34
- echo -e " ${RED}✗${NC} Node.js (>= 18.0.0)"
35
- MISSING_DEPS+=("Node.js >= 18.0.0")
36
- else
37
- NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
38
- if [ "$NODE_VERSION" -lt 18 ]; then
39
- echo -e " ${RED}✗${NC} Node.js (>= 18.0.0, found $(node -v))"
40
- MISSING_DEPS+=("Node.js >= 18.0.0")
41
- else
42
- echo -e " ${GREEN}✓${NC} Node.js $(node -v)"
43
- fi
44
- fi
45
-
46
- if ! command -v npm &> /dev/null; then
47
- echo -e " ${RED}✗${NC} npm"
48
- MISSING_DEPS+=("npm")
49
- else
50
- echo -e " ${GREEN}✓${NC} npm $(npm -v)"
51
- fi
52
-
53
- if ! command -v git &> /dev/null; then
54
- echo -e " ${RED}✗${NC} git"
55
- MISSING_DEPS+=("git")
56
- else
57
- echo -e " ${GREEN}✓${NC} git $(git --version | cut -d' ' -f3)"
58
- fi
59
-
60
- if ! command -v npx &> /dev/null; then
61
- echo -e " ${RED}✗${NC} npx"
62
- MISSING_DEPS+=("npx")
63
- else
64
- echo -e " ${GREEN}✓${NC} npx"
65
- fi
66
-
67
- echo ""
68
- echo -e "${YELLOW}Recommended dependencies (optional but useful):${NC}"
69
-
70
- if command -v docker &> /dev/null; then
71
- echo -e " ${GREEN}✓${NC} Docker (enables local Qdrant for semantic search)"
72
- else
73
- echo -e " ${YELLOW}⚠${NC} Docker (install for local Qdrant: `curl -fsSL https://get.docker.com | sh`)"
74
- RECOMMENDED_DEPS+=("Docker")
75
- fi
76
-
77
- if command -v python3 &> /dev/null; then
78
- PYTHON_VERSION=$(python3 --version | cut -d' ' -f2)
79
- echo -e " ${GREEN}✓${NC} Python 3 (${PYTHON_VERSION}) (enables Pattern RAG)"
80
- else
81
- echo -e " ${YELLOW}⚠${NC} Python 3 (install for Pattern RAG: `brew install python` or `apt install python3`)"
82
- RECOMMENDED_DEPS+=("Python 3")
83
- fi
84
-
85
- if command -v pre-commit &> /dev/null; then
86
- echo -e " ${GREEN}✓${NC} pre-commit (enables advanced git hooks)"
87
- else
88
- echo -e " ${YELLOW}⚠${NC} pre-commit (install for advanced hooks: `pip install pre-commit`)"
89
- fi
90
-
91
- echo ""
92
-
93
- # ============================================================================
94
- # INSTALLATION
95
- # ============================================================================
96
-
97
- if [ ${#MISSING_DEPS[@]} -gt 0 ]; then
98
- echo -e "${RED}❌ Missing required dependencies:${NC}"
99
- for dep in "${MISSING_DEPS[@]}"; do
100
- echo -e " - ${dep}"
101
- done
102
- echo ""
103
- echo "Please install the missing dependencies and run this script again."
104
- echo ""
105
- echo "Quick install commands:"
106
- echo " # macOS:"
107
- echo " brew install node git python docker"
108
- echo ""
109
- echo " # Ubuntu/Debian:"
110
- echo " curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -"
111
- echo " sudo apt-get install -y nodejs python3 docker.io"
112
- echo ""
113
- echo " # Windows (using winget):"
114
- echo " winget install OpenJS.NodeJS.LTS"
115
- echo " winget install Git.Git"
116
- echo " winget install Python.Python.3.12"
117
- echo " winget install Docker.DockerDesktop"
118
- echo ""
119
- exit 1
120
- fi
121
-
122
- # Install npm dependencies
123
- echo -e "${BLUE}Installing npm dependencies...${NC}"
124
- cd "$PROJECT_ROOT"
125
-
126
- if [ ! -d "node_modules" ]; then
127
- npm install
128
- echo -e "${GREEN}✓${NC} npm dependencies installed"
129
- else
130
- echo -e "${GREEN}✓${NC} npm dependencies already installed (skipping)"
131
- fi
132
-
133
- # Build TypeScript
134
- echo ""
135
- echo -e "${BLUE}Building TypeScript...${NC}"
136
- npm run build
137
- if [ $? -eq 0 ]; then
138
- echo -e "${GREEN}✓${NC} TypeScript build completed"
139
- else
140
- echo -e "${RED}✗${NC} TypeScript build failed"
141
- exit 1
142
- fi
143
-
144
- # ============================================================================
145
- # GIT HOOKS SETUP
146
- # ============================================================================
147
-
148
- echo ""
149
- echo -e "${BLUE}Setting up git hooks...${NC}"
150
-
151
- # Create hooks directory if it doesn't exist
152
- if [ ! -d "$HOOKS_DIR" ]; then
153
- echo -e " ${YELLOW}⚠${NC} Not a git repository, skipping hooks setup"
154
- else
155
- # Create hooks directory
156
- mkdir -p "$HOOKS_DIR"
157
-
158
- # Pre-commit hook - ensures worktree usage and code quality
159
- cat > "${HOOKS_DIR}/pre-commit" << 'EOF'
160
- #!/bin/bash
161
- #
162
- # UAM Pre-commit Hook
163
- #
164
- # Ensures:
165
- # 1. No secrets are committed
166
- # 2. Code passes linting
167
- # 3. Tests pass (if modified files include tests)
168
- #
169
-
170
- # Check for secrets
171
- if grep -rE "(api_key|apikey|password|secret|token)\s*=\s*['\"][^'\"]+['\"]" --include="*.ts" --include="*.js" --include="*.json" . 2>/dev/null | grep -v node_modules | grep -v ".worktrees" | grep -v dist; then
172
- echo "Error: Potential secrets detected in committed files!"
173
- echo "Please use environment variables for sensitive data."
174
- exit 1
175
- fi
176
-
177
- # Run linter
178
- if npm run lint -- --max-warnings=0 2>/dev/null; then
179
- echo "✓ Linting passed"
180
- else
181
- echo "Error: Linting failed. Run 'npm run lint:fix' to fix automatically."
182
- exit 1
183
- fi
184
-
185
- echo "Pre-commit checks passed"
186
- exit 0
187
- EOF
188
- chmod +x "${HOOKS_DIR}/pre-commit"
189
- echo " ✓ Created pre-commit hook"
190
-
191
- # Commit-msg hook - validates commit messages
192
- cat > "${HOOKS_DIR}/commit-msg" << 'EOF'
193
- #!/bin/bash
194
- #
195
- # UAM Commit-msg Hook
196
- #
197
- # Ensures commit messages follow conventional commits format:
198
- # - feat: New feature
199
- # - fix: Bug fix
200
- # - docs: Documentation
201
- # - style: Formatting
202
- # - refactor: Code refactoring
203
- # - test: Tests
204
- # - chore: Maintenance
205
- #
206
-
207
- COMMIT_MSG_FILE=$1
208
- COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
209
-
210
- # Skip if commit is empty or merge commit
211
- if [[ -z "$COMMIT_MSG" ]] || [[ "$COMMIT_MSG" == "Merge"* ]]; then
212
- exit 0
213
- fi
214
-
215
- # Check for conventional commit format
216
- if echo "$COMMIT_MSG" | grep -qE "^(feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert)(\([a-z-]+\))?: .+"; then
217
- echo "✓ Commit message format valid"
218
- exit 0
219
- else
220
- echo "Warning: Commit message doesn't follow conventional commits format."
221
- echo "Recommended format: type(scope): description"
222
- echo "Types: feat, fix, docs, style, refactor, test, chore, perf, ci, build, revert"
223
- echo ""
224
- echo "Examples:"
225
- echo " feat: Add worktree creation command"
226
- echo " fix(api): Resolve memory database path issue"
227
- echo " docs: Update README with setup instructions"
228
- echo ""
229
- echo "Continue with commit? [y/N] "
230
- read -r response
231
- if [[ "$response" =~ ^(yes|y|Y)$ ]]; then
232
- exit 0
233
- else
234
- echo "Commit aborted. Please edit your commit message."
235
- exit 1
236
- fi
237
- fi
238
- EOF
239
- chmod +x "${HOOKS_DIR}/commit-msg"
240
- echo " ✓ Created commit-msg hook"
241
-
242
- # Pre-push hook - runs tests before pushing
243
- cat > "${HOOKS_DIR}/pre-push" << 'EOF'
244
- #!/bin/bash
245
- #
246
- # UAM Pre-push Hook
247
- #
248
- # Runs tests before pushing to remote
249
- #
250
-
251
- echo "Running tests before push..."
252
- if npm test 2>&1 | tail -5; then
253
- if [ ${PIPESTATUS[0]} -eq 0 ]; then
254
- echo "✓ All tests passed"
255
- exit 0
256
- fi
257
- fi
258
-
259
- echo "Error: Tests failed. Fix tests before pushing."
260
- exit 1
261
- EOF
262
- chmod +x "${HOOKS_DIR}/pre-push"
263
- echo " ✓ Created pre-push hook"
264
-
265
- echo ""
266
- echo -e "${GREEN}✓${NC} Git hooks configured successfully"
267
- fi
268
-
269
- # ============================================================================
270
- # OPTIONAL: CREATE .GITCHRCL (for GitHub CLI)
271
- # ============================================================================
272
-
273
- if command -v gh &> /dev/null; then
274
- echo ""
275
- echo -e "${BLUE}GitHub CLI detected. Setting up default PR template...${NC}"
276
-
277
- if [ ! -f "${PROJECT_ROOT}/.github/pull_request_template.md" ]; then
278
- mkdir -p "${PROJECT_ROOT}/.github"
279
- cat > "${PROJECT_ROOT}/.github/pull_request_template.md" << 'EOF'
280
- <!-- UAM Worktree PR Template -->
281
- ## Summary
282
- <!-- Describe what this PR does -->
283
-
284
- ## Changes
285
- <!-- List key changes -->
286
- -
287
-
288
- ## Testing
289
- <!-- How did you test this? -->
290
- - [ ] Tests pass: `npm test`
291
- - [ ] Linting passes: `npm run lint`
292
- - [ ] Manually tested (if applicable)
293
-
294
- ## Related Issue
295
- <!-- Link to related issue if any -->
296
- Closes #
297
-
298
- ---
299
- <!-- UAM - Created via worktree: uam worktree pr -->
300
- EOF
301
- echo " ✓ Created PR template"
302
- fi
303
- fi
304
-
305
- # ============================================================================
306
- # SETUP COMPLETE
307
- # ============================================================================
308
-
309
- echo ""
310
- echo -e "${GREEN}✅ Setup complete!${NC}"
311
- echo ""
312
-
313
- if [ ${#RECOMMENDED_DEPS[@]} -gt 0 ]; then
314
- echo -e "${YELLOW}Recommended: Install missing optional dependencies${NC}"
315
- for dep in "${RECOMMENDED_DEPS[@]}"; do
316
- echo " - ${dep}"
317
- done
318
- echo ""
319
- echo "You can install these later. Core functionality will work without them."
320
- echo ""
321
- fi
322
-
323
- echo -e "${BLUE}Next steps:${NC}"
324
- echo ""
325
- echo "1. Initialize UAM in your project:"
326
- echo " npx universal-agent-memory init"
327
- echo ""
328
- echo "2. Review the generated CLAUDE.md"
329
- echo ""
330
- echo "3. Start working - your AI assistant will follow the workflows!"
331
- echo ""
332
- echo "Optional: Set up cloud memory backends"
333
- echo " export GITHUB_TOKEN=your_token"
334
- echo " export QDRANT_API_KEY=your_key"
335
- echo " export QDRANT_URL=your_url"
336
- echo ""
337
- echo "Documentation: https://github.com/DammianMiller/universal-agent-memory"