telo3-ai 5.0.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.
@@ -0,0 +1,164 @@
1
+ #!/usr/bin/env bash
2
+
3
+ #
4
+ # Project Context System Validation Script
5
+ #
6
+ # Validates project context documents for common issues.
7
+ # Usage: ./validate-project-context.sh [context-directory]
8
+ #
9
+
10
+ set -e
11
+
12
+ # Colors for output
13
+ GREEN='\033[0;32m'
14
+ YELLOW='\033[1;33m'
15
+ RED='\033[0;31m'
16
+ NC='\033[0m'
17
+
18
+ # Target directory
19
+ TARGET_DIR="${1:-.}"
20
+
21
+ # Find context directory
22
+ CONTEXT_DIRS=(
23
+ "$TARGET_DIR/project-context"
24
+ "$TARGET_DIR/docs/project-context"
25
+ "$TARGET_DIR"
26
+ )
27
+
28
+ CONTEXT_DIR=""
29
+ for dir in "${CONTEXT_DIRS[@]}"; do
30
+ if [ -f "$dir/prd.md" ] || [ -f "$dir/architecture.md" ]; then
31
+ CONTEXT_DIR="$dir"
32
+ break
33
+ fi
34
+ done
35
+
36
+ if [ -z "$CONTEXT_DIR" ]; then
37
+ echo -e "${RED}Error: Could not find project context directory${NC}"
38
+ echo "Looked in:"
39
+ for dir in "${CONTEXT_DIRS[@]}"; do
40
+ echo " - $dir"
41
+ done
42
+ exit 1
43
+ fi
44
+
45
+ echo "======================================"
46
+ echo "Project Context Validation"
47
+ echo "======================================"
48
+ echo ""
49
+ echo "Context directory: $CONTEXT_DIR"
50
+ echo ""
51
+
52
+ # Required files
53
+ REQUIRED_FILES=(
54
+ "prd.md"
55
+ "architecture.md"
56
+ "rules.md"
57
+ "design.md"
58
+ "tasks.md"
59
+ "memory.md"
60
+ )
61
+
62
+ ERRORS=0
63
+ WARNINGS=0
64
+
65
+ # Check for required files
66
+ echo "Checking required files..."
67
+ for file in "${REQUIRED_FILES[@]}"; do
68
+ if [ -f "$CONTEXT_DIR/$file" ]; then
69
+ echo -e "${GREEN}✓ Found: $file${NC}"
70
+ else
71
+ echo -e "${RED}✗ Missing: $file${NC}"
72
+ ERRORS=$((ERRORS + 1))
73
+ fi
74
+ done
75
+ echo ""
76
+
77
+ # Check for secret patterns
78
+ echo "Checking for accidental secrets..."
79
+ SECRET_PATTERNS=(
80
+ "api_key"
81
+ "API_KEY"
82
+ "apiKey"
83
+ "secret_key"
84
+ "SECRET_KEY"
85
+ "secretKey"
86
+ "password.*=.*['\"]"
87
+ "token.*=.*['\"]"
88
+ "-----BEGIN.*PRIVATE KEY-----"
89
+ )
90
+
91
+ for file in "${REQUIRED_FILES[@]}"; do
92
+ if [ -f "$CONTEXT_DIR/$file" ]; then
93
+ for pattern in "${SECRET_PATTERNS[@]}"; do
94
+ if grep -i -q "$pattern" "$CONTEXT_DIR/$file" 2>/dev/null; then
95
+ echo -e "${YELLOW}⚠ Potential secret pattern in $file: $pattern${NC}"
96
+ WARNINGS=$((WARNINGS + 1))
97
+ fi
98
+ done
99
+ fi
100
+ done
101
+
102
+ if [ $WARNINGS -eq 0 ]; then
103
+ echo -e "${GREEN}✓ No obvious secret patterns found${NC}"
104
+ fi
105
+ echo ""
106
+
107
+ # Check for placeholder content
108
+ echo "Checking for placeholders..."
109
+ PLACEHOLDER_COUNT=0
110
+ for file in "${REQUIRED_FILES[@]}"; do
111
+ if [ -f "$CONTEXT_DIR/$file" ]; then
112
+ COUNT=$(grep -c "\[.*\]" "$CONTEXT_DIR/$file" 2>/dev/null || true)
113
+ if [ $COUNT -gt 5 ]; then
114
+ echo -e "${YELLOW}⚠ $file has $COUNT placeholder sections${NC}"
115
+ PLACEHOLDER_COUNT=$((PLACEHOLDER_COUNT + 1))
116
+ fi
117
+ fi
118
+ done
119
+
120
+ if [ $PLACEHOLDER_COUNT -eq 0 ]; then
121
+ echo -e "${GREEN}✓ Files appear customized${NC}"
122
+ else
123
+ echo -e "${YELLOW}Note: Some files have many placeholders. Consider customizing them.${NC}"
124
+ fi
125
+ echo ""
126
+
127
+ # Check file sizes (detect if they're still mostly template)
128
+ echo "Checking file sizes..."
129
+ for file in "${REQUIRED_FILES[@]}"; do
130
+ if [ -f "$CONTEXT_DIR/$file" ]; then
131
+ SIZE=$(wc -l < "$CONTEXT_DIR/$file")
132
+ if [ $SIZE -lt 10 ]; then
133
+ echo -e "${YELLOW}⚠ $file seems very short ($SIZE lines)${NC}"
134
+ WARNINGS=$((WARNINGS + 1))
135
+ fi
136
+ fi
137
+ done
138
+ echo ""
139
+
140
+ # Summary
141
+ echo "======================================"
142
+ echo "Validation Summary"
143
+ echo "======================================"
144
+ echo ""
145
+
146
+ if [ $ERRORS -eq 0 ] && [ $WARNINGS -eq 0 ]; then
147
+ echo -e "${GREEN}✓ All checks passed!${NC}"
148
+ echo ""
149
+ echo "Your project context appears valid."
150
+ exit 0
151
+ elif [ $ERRORS -eq 0 ]; then
152
+ echo -e "${YELLOW}⚠ Warnings: $WARNINGS${NC}"
153
+ echo -e "${GREEN}✓ Errors: 0${NC}"
154
+ echo ""
155
+ echo "Your project context is valid but has some warnings."
156
+ echo "Review the warnings above and address if needed."
157
+ exit 0
158
+ else
159
+ echo -e "${RED}✗ Errors: $ERRORS${NC}"
160
+ echo -e "${YELLOW}⚠ Warnings: $WARNINGS${NC}"
161
+ echo ""
162
+ echo "Please address the errors above."
163
+ exit 1
164
+ fi
@@ -0,0 +1,418 @@
1
+ # Architecture Documentation
2
+
3
+ > **Purpose:** Define HOW the system works — tech stack, structure, data flow, and technical decisions.
4
+ > **Last Updated:** [Date]
5
+
6
+ ---
7
+
8
+ ## Architecture Overview
9
+
10
+ ### System Summary
11
+ [High-level description of the architecture. Is this a monolith, microservices, JAMstack, serverless, client-server, etc.?]
12
+
13
+ ### Architecture Diagram
14
+ ```
15
+ [ASCII diagram or reference to visual architecture diagram]
16
+
17
+ Example:
18
+ ┌─────────────┐ ┌──────────────┐ ┌──────────────┐
19
+ │ Browser │─────▶│ Frontend │─────▶│ Backend │
20
+ │ (Client) │◀─────│ (Next.js) │◀─────│ (API) │
21
+ └─────────────┘ └──────────────┘ └──────────────┘
22
+ │ │
23
+ ▼ ▼
24
+ ┌──────────────┐ ┌──────────────┐
25
+ │ Vercel │ │ PostgreSQL │
26
+ └──────────────┘ └──────────────┘
27
+ ```
28
+
29
+ ### Core Principles
30
+ [What are the guiding architectural principles?]
31
+
32
+ - [Principle 1: e.g., "API-first design"]
33
+ - [Principle 2: e.g., "Stateless services"]
34
+
35
+ ---
36
+
37
+ ## Technology Stack
38
+
39
+ ### Runtime & Language
40
+ - **Language:** [e.g., TypeScript, Python, Go]
41
+ - **Runtime:** [e.g., Node.js 20, Python 3.11, Go 1.21]
42
+ - **Package Manager:** [e.g., npm, pnpm, yarn, pip, cargo]
43
+
44
+ ### Frontend
45
+ - **Framework:** [e.g., React 18, Vue 3, Svelte, Solid]
46
+ - **Meta-framework:** [e.g., Next.js 14, Nuxt 3, SvelteKit, none]
47
+ - **Styling:** [e.g., Tailwind CSS, CSS Modules, Styled Components]
48
+ - **UI Library:** [e.g., shadcn/ui, Radix, Headless UI, custom]
49
+ - **State Management:** [e.g., React Context, Zustand, Redux, Pinia, none]
50
+ - **Form Handling:** [e.g., React Hook Form, Formik, native]
51
+ - **Routing:** [e.g., Next.js App Router, React Router, Vue Router]
52
+
53
+ ### Backend
54
+ - **Framework:** [e.g., Express, Fastify, FastAPI, Django, Rails, none]
55
+ - **API Style:** [e.g., REST, GraphQL, tRPC, gRPC]
56
+ - **API Documentation:** [e.g., OpenAPI/Swagger, GraphQL introspection]
57
+
58
+ ### Database
59
+ - **Primary Database:** [e.g., PostgreSQL 16, MySQL, MongoDB, SQLite]
60
+ - **ORM/Query Builder:** [e.g., Prisma, Drizzle, SQLAlchemy, none]
61
+ - **Migrations:** [e.g., Prisma Migrate, Alembic, manual SQL]
62
+ - **Caching:** [e.g., Redis, in-memory, none]
63
+
64
+ ### Authentication & Authorization
65
+ - **Authentication Provider:** [e.g., NextAuth.js, Auth0, Clerk, Supabase Auth, custom]
66
+ - **Session Management:** [e.g., JWT, cookies, sessions]
67
+ - **Authorization Pattern:** [e.g., RBAC, ABAC, simple ownership]
68
+
69
+ ### External Services
70
+ - **Email:** [e.g., Resend, SendGrid, AWS SES, none]
71
+ - **File Storage:** [e.g., AWS S3, Cloudflare R2, local filesystem]
72
+ - **Payment Processing:** [e.g., Stripe, none]
73
+ - **Analytics:** [e.g., Vercel Analytics, Plausible, none]
74
+ - **Error Tracking:** [e.g., Sentry, none]
75
+ - **[Other services]:** [e.g., Algolia for search, Twilio for SMS]
76
+
77
+ ### Deployment & Infrastructure
78
+ - **Hosting:** [e.g., Vercel, AWS, Railway, self-hosted]
79
+ - **Database Hosting:** [e.g., Vercel Postgres, Neon, AWS RDS, self-hosted]
80
+ - **CI/CD:** [e.g., GitHub Actions, none]
81
+ - **Monitoring:** [e.g., Vercel Monitoring, Datadog, none]
82
+
83
+ ### Development Tools
84
+ - **TypeScript:** [Yes/No]
85
+ - **Linting:** [e.g., ESLint, Biome, none]
86
+ - **Formatting:** [e.g., Prettier, Biome, none]
87
+ - **Testing:** [e.g., Vitest, Jest, Playwright, Cypress, none]
88
+ - **Git Hooks:** [e.g., Husky, lint-staged, none]
89
+
90
+ ---
91
+
92
+ ## Project Structure
93
+
94
+ ### Directory Organization
95
+
96
+ ```
97
+ project-root/
98
+ ├── project-context/ # Project context documents (Telo3)
99
+ ├── src/ # Source code
100
+ │ ├── app/ # [Framework-specific structure]
101
+ │ ├── components/ # React/Vue/Svelte components
102
+ │ ├── lib/ # Shared utilities
103
+ │ ├── styles/ # Global styles
104
+ │ └── types/ # TypeScript type definitions
105
+ ├── public/ # Static assets
106
+ ├── tests/ # Test files
107
+ ├── docs/ # Additional documentation
108
+ ├── package.json # Dependencies
109
+ ├── tsconfig.json # TypeScript configuration
110
+ └── [Other config files]
111
+ ```
112
+
113
+ ### Key Directories
114
+
115
+ | Directory | Purpose | Naming Convention |
116
+ |-----------|---------|-------------------|
117
+ | `/src/app` | [e.g., Next.js App Router pages] | [e.g., kebab-case] |
118
+ | `/src/components` | [e.g., Reusable React components] | [e.g., PascalCase] |
119
+ | `/src/lib` | [e.g., Utility functions, API clients] | [e.g., camelCase] |
120
+ | `/src/types` | [e.g., TypeScript interfaces and types] | [e.g., PascalCase] |
121
+
122
+ ---
123
+
124
+ ## Data Architecture
125
+
126
+ ### Data Model
127
+ [High-level description of core entities and relationships]
128
+
129
+ ```
130
+ User ──< Posts ──< Comments
131
+ │
132
+ └──< Profile (1:1)
133
+ ```
134
+
135
+ ### Key Entities
136
+
137
+ #### User
138
+ - **Purpose:** [What this entity represents]
139
+ - **Key Fields:** id, email, passwordHash, createdAt
140
+ - **Relationships:** hasMany Posts, hasOne Profile
141
+ - **Access Control:** [Who can read/write]
142
+
143
+ #### [Entity Name]
144
+ - **Purpose:**
145
+ - **Key Fields:**
146
+ - **Relationships:**
147
+ - **Access Control:**
148
+
149
+ ### Data Flow
150
+
151
+ #### Read Operations
152
+ [How does data flow from database to user?]
153
+
154
+ 1. Client requests data via API
155
+ 2. API handler validates request
156
+ 3. Database query executed
157
+ 4. Data transformed/serialized
158
+ 5. Response returned to client
159
+
160
+ #### Write Operations
161
+ [How does data flow from user to database?]
162
+
163
+ 1. Client submits data via API
164
+ 2. API handler validates input
165
+ 3. Business logic executed
166
+ 4. Database transaction committed
167
+ 5. Response returned to client
168
+
169
+ ---
170
+
171
+ ## API Architecture
172
+
173
+ ### API Style
174
+ [REST, GraphQL, tRPC, etc.]
175
+
176
+ ### Base URL
177
+ - **Production:** `https://api.example.com`
178
+ - **Development:** `http://localhost:3000/api`
179
+
180
+ ### API Structure
181
+
182
+ #### REST Endpoints (if applicable)
183
+ | Endpoint | Method | Purpose | Auth Required |
184
+ |----------|--------|---------|---------------|
185
+ | `/api/users` | GET | List users | Yes |
186
+ | `/api/users/:id` | GET | Get user | Yes |
187
+ | `/api/users` | POST | Create user | No |
188
+
189
+ #### GraphQL Schema (if applicable)
190
+ [Reference to schema file or high-level schema description]
191
+
192
+ #### tRPC Routers (if applicable)
193
+ [List of tRPC routers and their purposes]
194
+
195
+ ### API Conventions
196
+ - **Authentication:** [Bearer token, cookies, etc.]
197
+ - **Error Format:** [Standard error response structure]
198
+ - **Pagination:** [Cursor-based, offset-based, etc.]
199
+ - **Rate Limiting:** [Policy if implemented]
200
+
201
+ ---
202
+
203
+ ## Authentication & Authorization
204
+
205
+ ### Authentication Flow
206
+
207
+ ```
208
+ 1. User submits credentials
209
+ 2. Server validates credentials
210
+ 3. Server generates session/token
211
+ 4. Client stores session/token
212
+ 5. Client includes token in subsequent requests
213
+ ```
214
+
215
+ ### Session Management
216
+ - **Storage:** [Where are sessions stored?]
217
+ - **Lifetime:** [How long are sessions valid?]
218
+ - **Refresh:** [How are sessions refreshed?]
219
+
220
+ ### Authorization Strategy
221
+ [How are permissions enforced?]
222
+
223
+ - **Public routes:** [List or criteria]
224
+ - **Authenticated routes:** [List or criteria]
225
+ - **Role-based access:** [Roles and permissions]
226
+
227
+ ### Security Boundaries
228
+ [What are the security zones in the system?]
229
+
230
+ - **Public:** [What is accessible without authentication?]
231
+ - **Authenticated:** [What requires login?]
232
+ - **Admin:** [What requires elevated privileges?]
233
+
234
+ ---
235
+
236
+ ## State Management
237
+
238
+ ### Client-Side State
239
+ [How is state managed in the frontend?]
240
+
241
+ - **Global State:** [Tool/pattern used]
242
+ - **Server State:** [How is server data cached/synchronized?]
243
+ - **Form State:** [How are forms managed?]
244
+ - **URL State:** [Is state stored in URL params?]
245
+
246
+ ### Server-Side State
247
+ [How is state managed on the backend?]
248
+
249
+ - **Session State:** [Where/how stored]
250
+ - **Application State:** [Any in-memory state?]
251
+ - **Database State:** [How is consistency maintained?]
252
+
253
+ ---
254
+
255
+ ## External Service Integration
256
+
257
+ ### [Service Name]
258
+ - **Purpose:** [Why is this service used?]
259
+ - **Integration Method:** [API, SDK, webhook, etc.]
260
+ - **Configuration:** [Environment variables required]
261
+ - **Data Sharing:** [What data is sent to this service?]
262
+ - **Fallback:** [What happens if service is unavailable?]
263
+
264
+ ---
265
+
266
+ ## Environment Configuration
267
+
268
+ ### Environment Variables
269
+
270
+ | Variable | Purpose | Required | Default |
271
+ |----------|---------|----------|---------|
272
+ | `DATABASE_URL` | PostgreSQL connection string | Yes | - |
273
+ | `NEXTAUTH_SECRET` | NextAuth.js session secret | Yes | - |
274
+ | `NEXTAUTH_URL` | Application URL | Yes | - |
275
+ | `[OTHER]` | [Description] | Yes/No | [Value] |
276
+
277
+ ### Configuration Files
278
+ - `package.json` — Dependencies and scripts
279
+ - `tsconfig.json` — TypeScript compiler configuration
280
+ - `.env.local` — Local environment variables (not committed)
281
+ - `.env.example` — Environment variable template
282
+ - `[Other config files]`
283
+
284
+ ---
285
+
286
+ ## Build & Deployment
287
+
288
+ ### Build Process
289
+
290
+ ```bash
291
+ # Development
292
+ npm run dev
293
+
294
+ # Production build
295
+ npm run build
296
+
297
+ # Start production server
298
+ npm start
299
+ ```
300
+
301
+ ### Deployment Strategy
302
+ [How is the application deployed?]
303
+
304
+ - **Environments:** Development, Staging, Production
305
+ - **Deployment Method:** [Git-based, CI/CD pipeline, manual]
306
+ - **Rollback Strategy:** [How to revert if deployment fails]
307
+
308
+ ### Database Migrations
309
+ [How are database schema changes managed?]
310
+
311
+ ```bash
312
+ # Create migration
313
+ npm run db:migrate:create
314
+
315
+ # Run migrations
316
+ npm run db:migrate
317
+
318
+ # Rollback migration
319
+ npm run db:migrate:rollback
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Performance Considerations
325
+
326
+ ### Frontend Performance
327
+ - **Code Splitting:** [Strategy used]
328
+ - **Image Optimization:** [How images are optimized]
329
+ - **Lazy Loading:** [What is lazy loaded]
330
+ - **Caching Strategy:** [Browser caching, service workers]
331
+
332
+ ### Backend Performance
333
+ - **Database Indexing:** [Key indexes]
334
+ - **Query Optimization:** [Strategies used]
335
+ - **Caching:** [What is cached and where]
336
+ - **Rate Limiting:** [If implemented]
337
+
338
+ ---
339
+
340
+ ## Security Architecture
341
+
342
+ ### Security Layers
343
+ 1. **Network Security:** [HTTPS, CORS, rate limiting]
344
+ 2. **Authentication:** [How users are authenticated]
345
+ 3. **Authorization:** [How access is controlled]
346
+ 4. **Input Validation:** [Where/how validation occurs]
347
+ 5. **Output Encoding:** [How XSS is prevented]
348
+ 6. **Secrets Management:** [How secrets are stored]
349
+
350
+ ### Known Security Boundaries
351
+ [What are the trust boundaries in the system?]
352
+
353
+ - [Boundary 1: e.g., "Client code cannot be trusted"]
354
+ - [Boundary 2: e.g., "API validates all inputs"]
355
+
356
+ ---
357
+
358
+ ## Architectural Decisions
359
+
360
+ [Document important architectural decisions here. Include the decision, rationale, alternatives, and trade-offs.]
361
+
362
+ ### [Decision Date]: [Decision Title]
363
+ **Decision:** [What was decided?]
364
+ **Context:** [What was the situation?]
365
+ **Rationale:** [Why was this decided?]
366
+ **Alternatives Considered:** [What else was considered?]
367
+ **Trade-offs:** [What are the downsides?]
368
+ **Status:** [Accepted / Superseded / Deprecated]
369
+
370
+ ---
371
+
372
+ ## Technical Debt
373
+
374
+ [Document known technical debt that should be addressed]
375
+
376
+ ### High Priority
377
+ - [ ] [Debt item 1] — Impact: [Description]
378
+
379
+ ### Medium Priority
380
+ - [ ] [Debt item 2] — Impact: [Description]
381
+
382
+ ### Low Priority
383
+ - [ ] [Debt item 3] — Impact: [Description]
384
+
385
+ ---
386
+
387
+ ## Known Limitations
388
+
389
+ [Document known limitations of the current architecture]
390
+
391
+ - **[Limitation 1]:** [Description and impact]
392
+ - **[Limitation 2]:** [Description and impact]
393
+
394
+ ---
395
+
396
+ ## Future Architectural Considerations
397
+
398
+ [Things to consider for future scaling or evolution]
399
+
400
+ - [Consideration 1: e.g., "May need to split into microservices at 10x scale"]
401
+ - [Consideration 2]
402
+
403
+ ---
404
+
405
+ ## References
406
+
407
+ - [Link to API documentation]
408
+ - [Link to database schema]
409
+ - [Link to deployment documentation]
410
+ - [Link to third-party service documentation]
411
+
412
+ ---
413
+
414
+ ## Document History
415
+
416
+ | Date | Author | Changes |
417
+ |------|--------|---------|
418
+ | [Date] | [Name] | Initial version |