Compare commits
16 Commits
performanc
...
matthew-sc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46814ebf5d | ||
|
|
19d189bc6e | ||
|
|
2c71b0a827 | ||
|
|
4745cf8536 | ||
|
|
f4856f48aa | ||
|
|
cc45d9d92e | ||
|
|
d9b168bf2a | ||
|
|
42adfd8174 | ||
|
|
b3cad2cfa1 | ||
|
|
60aa137dab | ||
|
|
e5b622f575 | ||
|
|
a559fd3318 | ||
|
|
4e7dc36ecc | ||
|
|
41142397ec | ||
|
|
fcac13eb7e | ||
|
|
a16f88743a |
@@ -1,310 +0,0 @@
|
||||
# Cursor Markdown Ruleset for TimeSafari Documentation
|
||||
|
||||
## Overview
|
||||
|
||||
This ruleset enforces consistent markdown formatting standards across all project
|
||||
documentation, ensuring readability, maintainability, and compliance with
|
||||
markdownlint best practices.
|
||||
|
||||
## General Formatting Standards
|
||||
|
||||
### Line Length
|
||||
|
||||
- **Maximum line length**: 80 characters
|
||||
- **Exception**: Code blocks (JSON, shell, TypeScript, etc.) - no line length
|
||||
enforcement
|
||||
- **Rationale**: Ensures readability across different screen sizes and terminal
|
||||
widths
|
||||
|
||||
### Blank Lines
|
||||
|
||||
- **Headings**: Must be surrounded by blank lines above and below
|
||||
- **Lists**: Must be surrounded by blank lines above and below
|
||||
- **Code blocks**: Must be surrounded by blank lines above and below
|
||||
- **Maximum consecutive blank lines**: 1 (no multiple blank lines)
|
||||
- **File start**: No blank lines at the beginning of the file
|
||||
- **File end**: Single newline character at the end
|
||||
|
||||
### Whitespace
|
||||
|
||||
- **No trailing spaces**: Remove all trailing whitespace from lines
|
||||
- **No tabs**: Use spaces for indentation
|
||||
- **Consistent indentation**: 2 spaces for list items and nested content
|
||||
|
||||
## Heading Standards
|
||||
|
||||
### Format
|
||||
|
||||
- **Style**: ATX-style headings (`#`, `##`, `###`, etc.)
|
||||
- **Case**: Title case for general headings
|
||||
- **Code references**: Use backticks for file names and technical terms
|
||||
- ✅ `### Current package.json Scripts`
|
||||
- ❌ `### Current Package.json Scripts`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
- **H1 (#)**: Document title only
|
||||
- **H2 (##)**: Major sections
|
||||
- **H3 (###)**: Subsections
|
||||
- **H4 (####)**: Sub-subsections
|
||||
- **H5+**: Avoid deeper nesting
|
||||
|
||||
## List Standards
|
||||
|
||||
### Unordered Lists
|
||||
|
||||
- **Marker**: Use `-` (hyphen) consistently
|
||||
- **Indentation**: 2 spaces for nested items
|
||||
- **Blank lines**: Surround lists with blank lines
|
||||
|
||||
### Ordered Lists
|
||||
|
||||
- **Format**: `1.`, `2.`, `3.` (sequential numbering)
|
||||
- **Indentation**: 2 spaces for nested items
|
||||
- **Blank lines**: Surround lists with blank lines
|
||||
|
||||
### Task Lists
|
||||
|
||||
- **Format**: `- [ ]` for incomplete, `- [x]` for complete
|
||||
- **Use case**: Project planning, checklists, implementation tracking
|
||||
|
||||
## Code Block Standards
|
||||
|
||||
### Fenced Code Blocks
|
||||
|
||||
- **Syntax**: Triple backticks with language specification
|
||||
- **Languages**: `json`, `bash`, `typescript`, `javascript`, `yaml`, `markdown`
|
||||
- **Blank lines**: Must be surrounded by blank lines above and below
|
||||
- **Line length**: No enforcement within code blocks
|
||||
|
||||
### Inline Code
|
||||
|
||||
- **Format**: Single backticks for inline code references
|
||||
- **Use case**: File names, commands, variables, properties
|
||||
|
||||
## Special Content Standards
|
||||
|
||||
### JSON Examples
|
||||
|
||||
```json
|
||||
{
|
||||
"property": "value",
|
||||
"nested": {
|
||||
"property": "value"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Shell Commands
|
||||
|
||||
```bash
|
||||
# Command with comment
|
||||
npm run build:web
|
||||
|
||||
# Multi-line command
|
||||
VITE_GIT_HASH=`git log -1 --pretty=format:%h` \
|
||||
vite build --config vite.config.web.mts
|
||||
```
|
||||
|
||||
### TypeScript Examples
|
||||
|
||||
```typescript
|
||||
// Function with JSDoc
|
||||
/**
|
||||
* Get environment configuration
|
||||
* @param env - Environment name
|
||||
* @returns Environment config object
|
||||
*/
|
||||
const getEnvironmentConfig = (env: string) => {
|
||||
switch (env) {
|
||||
case 'prod':
|
||||
return { /* production settings */ };
|
||||
default:
|
||||
return { /* development settings */ };
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## File Structure Standards
|
||||
|
||||
### Document Header
|
||||
|
||||
```markdown
|
||||
# Document Title
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: YYYY-MM-DD
|
||||
**Status**: 🎯 **STATUS** - Brief description
|
||||
|
||||
## Overview
|
||||
|
||||
Brief description of the document's purpose and scope.
|
||||
```
|
||||
|
||||
### Section Organization
|
||||
|
||||
1. **Overview/Introduction**
|
||||
2. **Current State Analysis**
|
||||
3. **Implementation Plan**
|
||||
4. **Technical Details**
|
||||
5. **Testing & Validation**
|
||||
6. **Next Steps**
|
||||
|
||||
## Markdownlint Configuration
|
||||
|
||||
### Required Rules
|
||||
|
||||
```json
|
||||
{
|
||||
"MD013": { "code_blocks": false },
|
||||
"MD012": true,
|
||||
"MD022": true,
|
||||
"MD031": true,
|
||||
"MD032": true,
|
||||
"MD047": true,
|
||||
"MD009": true
|
||||
}
|
||||
```
|
||||
|
||||
### Rule Explanations
|
||||
|
||||
- **MD013**: Line length (disabled for code blocks)
|
||||
- **MD012**: No multiple consecutive blank lines
|
||||
- **MD022**: Headings should be surrounded by blank lines
|
||||
- **MD031**: Fenced code blocks should be surrounded by blank lines
|
||||
- **MD032**: Lists should be surrounded by blank lines
|
||||
- **MD047**: Files should end with a single newline
|
||||
- **MD009**: No trailing spaces
|
||||
|
||||
## Validation Commands
|
||||
|
||||
### Check Single File
|
||||
|
||||
```bash
|
||||
npx markdownlint docs/filename.md
|
||||
```
|
||||
|
||||
### Check All Documentation
|
||||
|
||||
```bash
|
||||
npx markdownlint docs/
|
||||
```
|
||||
|
||||
### Auto-fix Common Issues
|
||||
|
||||
```bash
|
||||
# Remove trailing spaces
|
||||
sed -i 's/[[:space:]]*$//' docs/filename.md
|
||||
|
||||
# Remove multiple blank lines
|
||||
sed -i '/^$/N;/^\n$/D' docs/filename.md
|
||||
|
||||
# Add newline at end if missing
|
||||
echo "" >> docs/filename.md
|
||||
```
|
||||
|
||||
## Common Patterns
|
||||
|
||||
### Implementation Plans
|
||||
|
||||
```markdown
|
||||
## Implementation Plan
|
||||
|
||||
### Phase 1: Foundation (Day 1)
|
||||
|
||||
#### 1.1 Component Setup
|
||||
|
||||
- [ ] Create new component file
|
||||
- [ ] Add basic structure
|
||||
- [ ] Implement core functionality
|
||||
|
||||
#### 1.2 Configuration
|
||||
|
||||
- [ ] Update configuration files
|
||||
- [ ] Add environment variables
|
||||
- [ ] Test configuration loading
|
||||
```
|
||||
|
||||
### Status Tracking
|
||||
|
||||
```markdown
|
||||
**Status**: ✅ **COMPLETE** - All phases finished
|
||||
**Progress**: 75% (15/20 components)
|
||||
**Next**: Ready for testing phase
|
||||
```
|
||||
|
||||
### Performance Metrics
|
||||
|
||||
```markdown
|
||||
#### 📊 Performance Metrics
|
||||
- **Build Time**: 2.3 seconds (50% faster than baseline)
|
||||
- **Bundle Size**: 1.2MB (30% reduction)
|
||||
- **Success Rate**: 100% (no failures in 50 builds)
|
||||
```
|
||||
|
||||
## Enforcement
|
||||
|
||||
### Pre-commit Hooks
|
||||
|
||||
- Run markdownlint on all changed markdown files
|
||||
- Block commits with linting violations
|
||||
- Auto-fix common issues when possible
|
||||
|
||||
### CI/CD Integration
|
||||
|
||||
- Include markdownlint in build pipeline
|
||||
- Generate reports for documentation quality
|
||||
- Fail builds with critical violations
|
||||
|
||||
### Team Guidelines
|
||||
|
||||
- All documentation PRs must pass markdownlint
|
||||
- Use provided templates for new documents
|
||||
- Follow established patterns for consistency
|
||||
|
||||
## Templates
|
||||
|
||||
### New Document Template
|
||||
|
||||
```markdown
|
||||
# Document Title
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: YYYY-MM-DD
|
||||
**Status**: 🎯 **PLANNING** - Ready for Implementation
|
||||
|
||||
## Overview
|
||||
|
||||
Brief description of the document's purpose and scope.
|
||||
|
||||
## Current State
|
||||
|
||||
Description of current situation or problem.
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
### Phase 1: Foundation
|
||||
|
||||
- [ ] Task 1
|
||||
- [ ] Task 2
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Review and approve plan**
|
||||
2. **Begin implementation**
|
||||
3. **Test and validate**
|
||||
|
||||
---
|
||||
|
||||
**Status**: Ready for implementation
|
||||
**Priority**: Medium
|
||||
**Estimated Effort**: X days
|
||||
**Dependencies**: None
|
||||
**Stakeholders**: Development team
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-07-09
|
||||
**Version**: 1.0
|
||||
**Maintainer**: Matthew Raymer
|
||||
@@ -1,97 +1,77 @@
|
||||
---
|
||||
globs: **/db/databaseUtil.ts, **/interfaces/absurd-sql.d.ts, **/src/registerSQLWorker.js, **/
|
||||
services/AbsurdSqlDatabaseService.ts
|
||||
alwaysApply: false
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
# Absurd SQL - Cursor Development Guide
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-19
|
||||
**Status**: 🎯 **ACTIVE** - Database development guidelines
|
||||
|
||||
## Project Overview
|
||||
|
||||
Absurd SQL is a backend implementation for sql.js that enables persistent
|
||||
SQLite databases in the browser by using IndexedDB as a block storage system.
|
||||
This guide provides rules and best practices for developing with this project
|
||||
in Cursor.
|
||||
Absurd SQL is a backend implementation for sql.js that enables persistent SQLite databases in the browser by using IndexedDB as a block storage system. This guide provides rules and best practices for developing with this project in Cursor.
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
absurd-sql/
|
||||
├── src/ # Place source code here
|
||||
├── dist/ # Place built files here
|
||||
├── package.json # Maintain dependencies and scripts here
|
||||
├── rollup.config.js # Maintain build configuration here
|
||||
└── jest.config.js # Maintain test configuration here
|
||||
├── src/ # Source code
|
||||
├── dist/ # Built files
|
||||
├── package.json # Dependencies and scripts
|
||||
├── rollup.config.js # Build configuration
|
||||
└── jest.config.js # Test configuration
|
||||
```
|
||||
|
||||
## Directives
|
||||
## Development Rules
|
||||
|
||||
### 1. Worker Thread Requirements
|
||||
|
||||
- All SQL operations MUST be performed in a worker thread
|
||||
- Main thread should only handle worker initialization and communication
|
||||
- Never block the main thread with database operations
|
||||
|
||||
### 2. Code Organization
|
||||
|
||||
- Keep worker code in separate files (e.g., `*.worker.js`)
|
||||
- Use ES modules for imports/exports
|
||||
- Follow the project's existing module structure
|
||||
|
||||
### 3. Required Headers
|
||||
|
||||
When developing locally or deploying, ensure these headers are set:
|
||||
|
||||
```
|
||||
Cross-Origin-Opener-Policy: same-origin
|
||||
Cross-Origin-Embedder-Policy: require-corp
|
||||
```
|
||||
|
||||
### 4. Browser Compatibility
|
||||
|
||||
- Primary target: Modern browsers with SharedArrayBuffer support
|
||||
- Fallback mode: Safari (with limitations)
|
||||
- Always test in both modes
|
||||
|
||||
### 5. Database Configuration
|
||||
|
||||
Recommended database settings:
|
||||
|
||||
```sql
|
||||
PRAGMA journal_mode=MEMORY;
|
||||
PRAGMA page_size=8192;
|
||||
PRAGMA page_size=8192; -- Optional, but recommended
|
||||
```
|
||||
|
||||
### 6. Development Workflow
|
||||
|
||||
1. Install dependencies:
|
||||
|
||||
```bash
|
||||
yarn add @jlongster/sql.js absurd-sql
|
||||
```
|
||||
2. Execute commands as follows:
|
||||
- `yarn build` → build the project
|
||||
- `yarn jest` → run all tests
|
||||
- `yarn serve` → launch development server
|
||||
|
||||
2. Development commands:
|
||||
- `yarn build` - Build the project
|
||||
- `yarn jest` - Run tests
|
||||
- `yarn serve` - Start development server
|
||||
|
||||
### 7. Testing Guidelines
|
||||
|
||||
- Write tests for both SharedArrayBuffer and fallback modes
|
||||
- Use Jest for testing
|
||||
- Include performance benchmarks for critical operations
|
||||
|
||||
### 8. Performance Considerations
|
||||
|
||||
- Use bulk operations when possible
|
||||
- Monitor read/write performance
|
||||
- Consider using transactions for multiple operations
|
||||
- Avoid unnecessary database connections
|
||||
|
||||
### 9. Error Handling
|
||||
|
||||
- Implement proper error handling for:
|
||||
- Worker initialization failures
|
||||
- Database connection issues
|
||||
@@ -99,54 +79,51 @@ PRAGMA page_size=8192;
|
||||
- Storage quota exceeded scenarios
|
||||
|
||||
### 10. Security Best Practices
|
||||
|
||||
- Never expose database operations directly to the client
|
||||
- Validate all SQL queries
|
||||
- Implement proper access controls
|
||||
- Handle sensitive data appropriately
|
||||
|
||||
### 11. Code Style
|
||||
|
||||
- Follow ESLint configuration
|
||||
- Use async/await for asynchronous operations
|
||||
- Document complex database operations
|
||||
- Include comments for non-obvious optimizations
|
||||
|
||||
### 12. Debugging
|
||||
|
||||
- Use `jest-debug` for debugging tests
|
||||
- Monitor IndexedDB usage in browser dev tools
|
||||
- Check worker communication in console
|
||||
- Use performance monitoring tools
|
||||
|
||||
## Required Patterns
|
||||
## Common Patterns
|
||||
|
||||
### Worker Initialization
|
||||
|
||||
```javascript
|
||||
// Main thread
|
||||
import { initBackend } from 'absurd-sql/dist/indexeddb-main-thread';
|
||||
|
||||
function init() {
|
||||
const worker = new Worker(new URL('./index.worker.js', import.meta.url));
|
||||
let worker = new Worker(new URL('./index.worker.js', import.meta.url));
|
||||
initBackend(worker);
|
||||
}
|
||||
```
|
||||
|
||||
### Database Setup
|
||||
|
||||
```javascript
|
||||
// Worker thread
|
||||
import initSqlJs from '@jlongster/sql.js';
|
||||
import { SQLiteFS } from 'absurd-sql';
|
||||
import IndexedDBBackend from 'absurd-sql/dist/indexeddb-backend';
|
||||
|
||||
async function setupDatabase() {
|
||||
const SQL = await initSqlJs({ locateFile: f => f });
|
||||
const sqlFS = new SQLiteFS(SQL.FS, new IndexedDBBackend());
|
||||
let SQL = await initSqlJs({ locateFile: file => file });
|
||||
let sqlFS = new SQLiteFS(SQL.FS, new IndexedDBBackend());
|
||||
SQL.register_for_idb(sqlFS);
|
||||
|
||||
|
||||
SQL.FS.mkdir('/sql');
|
||||
SQL.FS.mount(sqlFS, {}, '/sql');
|
||||
|
||||
|
||||
return new SQL.Database('/sql/db.sqlite', { filename: true });
|
||||
}
|
||||
```
|
||||
@@ -154,7 +131,6 @@ async function setupDatabase() {
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. SharedArrayBuffer not available
|
||||
- Check COOP/COEP headers
|
||||
- Verify browser support
|
||||
@@ -171,20 +147,7 @@ async function setupDatabase() {
|
||||
- Verify transaction usage
|
||||
|
||||
## Resources
|
||||
|
||||
- [Project Demo](https://priceless-keller-d097e5.netlify.app/)
|
||||
- [Example Project](https://github.com/jlongster/absurd-example-project)
|
||||
- [Blog Post](https://jlongster.com/future-sql-web)
|
||||
- [SQL.js Documentation](https://github.com/sql-js/sql.js/)
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active database development guidelines
|
||||
**Priority**: High
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: Absurd SQL, SQL.js, IndexedDB
|
||||
**Stakeholders**: Development team, Database team
|
||||
- [Project Demo](https://priceless-keller-d097e5.netlify.app/)
|
||||
- [Example Project](https://github.com/jlongster/absurd-example-project)
|
||||
- [Blog Post](https://jlongster.com/future-sql-web)
|
||||
- [SQL.js Documentation](https://github.com/sql-js/sql.js/)
|
||||
- [SQL.js Documentation](https://github.com/sql-js/sql.js/)
|
||||
@@ -1,65 +0,0 @@
|
||||
# ADR Template
|
||||
|
||||
## ADR-XXXX-YY-ZZ: [Short Title]
|
||||
|
||||
**Date:** YYYY-MM-DD
|
||||
**Status:** [PROPOSED | ACCEPTED | REJECTED | DEPRECATED | SUPERSEDED]
|
||||
**Deciders:** [List of decision makers]
|
||||
**Technical Story:** [Link to issue/PR if applicable]
|
||||
|
||||
## Context
|
||||
|
||||
[Describe the forces at play, including technological, political, social, and
|
||||
project local. These forces are probably in tension, and should be called out as
|
||||
such. The language in this section is value-neutral. It is simply describing facts.]
|
||||
|
||||
## Decision
|
||||
|
||||
[Describe our response to these forces. We will use the past tense ("We will...").]
|
||||
|
||||
## Consequences
|
||||
|
||||
### Positive
|
||||
- [List positive consequences]
|
||||
|
||||
### Negative
|
||||
- [List negative consequences or trade-offs]
|
||||
|
||||
### Neutral
|
||||
- [List neutral consequences or notes]
|
||||
|
||||
## Alternatives Considered
|
||||
|
||||
- **Alternative 1:** [Description] - [Why rejected]
|
||||
- **Alternative 2:** [Description] - [Why rejected]
|
||||
- **Alternative 3:** [Description] - [Why rejected]
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
[Any specific implementation details, migration steps, or technical considerations]
|
||||
|
||||
## References
|
||||
|
||||
- [Link to relevant documentation]
|
||||
- [Link to related ADRs]
|
||||
- [Link to external resources]
|
||||
|
||||
## Related Decisions
|
||||
|
||||
- [List related ADRs or decisions]
|
||||
|
||||
---
|
||||
|
||||
## Usage Guidelines
|
||||
|
||||
1. **Copy this template** for new ADRs
|
||||
2. **Number sequentially** (ADR-001, ADR-002, etc.)
|
||||
3. **Use descriptive titles** that clearly indicate the decision
|
||||
4. **Include all stakeholders** in the deciders list
|
||||
5. **Link to related issues** and documentation
|
||||
6. **Update status** as decisions evolve
|
||||
7. **Store in** `doc/architecture-decisions/` directory
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
@@ -1,352 +0,0 @@
|
||||
---
|
||||
description: when you need to understand the system architecture or make changes that impact the system architecture
|
||||
alwaysApply: false
|
||||
---
|
||||
# TimeSafari Cross-Platform Architecture Guide
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-19
|
||||
**Status**: 🎯 **ACTIVE** - Architecture guidelines
|
||||
|
||||
## 1. Platform Support Matrix
|
||||
|
||||
| Feature | Web (PWA) | Capacitor (Mobile) | Electron (Desktop) |
|
||||
|---------|-----------|--------------------|-------------------|
|
||||
| QR Code Scanning | WebInlineQRScanner | @capacitor-mlkit/barcode-scanning | Not Implemented |
|
||||
| Deep Linking | URL Parameters | App URL Open Events | Not Implemented |
|
||||
| File System | Limited (Browser API) | Capacitor Filesystem | Electron fs |
|
||||
| Camera Access | MediaDevices API | Capacitor Camera | Not Implemented |
|
||||
| Platform Detection | Web APIs | Capacitor.isNativePlatform() | process.env checks |
|
||||
|
||||
## 2. Project Structure
|
||||
|
||||
### Core Directories
|
||||
|
||||
```
|
||||
src/
|
||||
├── components/ # Vue components
|
||||
├── services/ # Platform services and business logic
|
||||
├── views/ # Page components
|
||||
├── router/ # Vue router configuration
|
||||
├── types/ # TypeScript type definitions
|
||||
├── utils/ # Utility functions
|
||||
├── lib/ # Core libraries
|
||||
├── platforms/ # Platform-specific implementations
|
||||
├── electron/ # Electron-specific code
|
||||
├── constants/ # Application constants
|
||||
├── db/ # Database related code
|
||||
├── interfaces/ # TypeScript interfaces
|
||||
└── assets/ # Static assets
|
||||
```
|
||||
|
||||
### Entry Points
|
||||
|
||||
- `main.ts` → Base entry
|
||||
- `main.common.ts` → Shared init
|
||||
- `main.capacitor.ts` → Mobile entry
|
||||
- `main.electron.ts` → Electron entry
|
||||
- `main.web.ts` → Web entry
|
||||
|
||||
## 3. Service Architecture
|
||||
|
||||
### Service Organization
|
||||
|
||||
```tree
|
||||
services/
|
||||
├── QRScanner/
|
||||
│ ├── WebInlineQRScanner.ts
|
||||
│ └── interfaces.ts
|
||||
├── platforms/
|
||||
│ ├── WebPlatformService.ts
|
||||
│ ├── CapacitorPlatformService.ts
|
||||
│ └── ElectronPlatformService.ts
|
||||
└── factory/
|
||||
└── PlatformServiceFactory.ts
|
||||
```
|
||||
|
||||
### Factory Pattern
|
||||
|
||||
Use a **singleton factory** to select platform services via
|
||||
`process.env.VITE_PLATFORM`.
|
||||
|
||||
## 4. Feature Guidelines
|
||||
|
||||
### QR Code Scanning
|
||||
|
||||
- Define `QRScannerService` interface.
|
||||
- Implement platform-specific classes (`WebInlineQRScanner`, Capacitor,
|
||||
etc).
|
||||
- Provide `addListener` and `onStream` hooks for composability.
|
||||
|
||||
### Deep Linking
|
||||
|
||||
- URL format: `timesafari://<route>[/<param>][?query=value]`
|
||||
- Web: `router.beforeEach` → parse query
|
||||
- Capacitor: `App.addListener("appUrlOpen", …)`
|
||||
|
||||
## 5. Build Process
|
||||
|
||||
- `vite.config.common.mts` → shared config
|
||||
- Platform configs: `vite.config.web.mts`, `.capacitor.mts`,
|
||||
`.electron.mts`
|
||||
- Use `process.env.VITE_PLATFORM` for conditional loading.
|
||||
|
||||
```bash
|
||||
npm run build:web
|
||||
npm run build:capacitor
|
||||
npm run build:electron
|
||||
```
|
||||
|
||||
## 6. Testing Strategy
|
||||
|
||||
- **Unit tests** for services.
|
||||
- **Playwright** for Web + Capacitor:
|
||||
- `playwright.config-local.ts` includes web + Pixel 5.
|
||||
- **Electron tests**: add `spectron` or Playwright-Electron.
|
||||
- Mark tests with platform tags:
|
||||
|
||||
```ts
|
||||
test.skip(!process.env.MOBILE_TEST, "Mobile-only test");
|
||||
```
|
||||
|
||||
> 🔗 **Human Hook:** Before merging new tests, hold a short sync (≤15
|
||||
> min) with QA to align on coverage and flaky test risks.
|
||||
|
||||
## 7. Error Handling
|
||||
|
||||
- Global Vue error handler → logs with component name.
|
||||
- Platform-specific wrappers log API errors with platform prefix
|
||||
(`[Capacitor API Error]`, etc).
|
||||
- Use structured logging (not `console.log`).
|
||||
|
||||
## 8. Best Practices
|
||||
|
||||
- Keep platform code **isolated** in `platforms/`.
|
||||
- Always define a **shared interface** first.
|
||||
- Use feature detection, not platform detection, when possible.
|
||||
- Dependency injection for services → improves testability.
|
||||
- Maintain **Competence Hooks** in PRs (2–3 prompts for dev
|
||||
discussion).
|
||||
|
||||
## 9. Dependency Management
|
||||
|
||||
- Key deps: `@capacitor/core`, `electron`, `vue`.
|
||||
- Use conditional `import()` for platform-specific libs.
|
||||
|
||||
## 10. Security Considerations
|
||||
|
||||
- **Permissions**: Always check + request gracefully.
|
||||
- **Storage**: Secure storage for sensitive data; encrypt when possible.
|
||||
- **Audits**: Schedule quarterly security reviews.
|
||||
|
||||
## 11. ADR Process
|
||||
|
||||
- All major architecture choices → log in `doc/adr/`.
|
||||
- Use ADR template with Context, Decision, Consequences, Status.
|
||||
- Link related ADRs in PR descriptions.
|
||||
|
||||
> 🔗 **Human Hook:** When proposing a new ADR, schedule a 30-min
|
||||
> design sync for discussion, not just async review.
|
||||
|
||||
## 12. Collaboration Hooks
|
||||
|
||||
- **QR features**: Sync with Security before merging → permissions &
|
||||
privacy.
|
||||
- **New platform builds**: Demo in team meeting → confirm UX
|
||||
differences.
|
||||
- **Critical ADRs**: Present in guild or architecture review.
|
||||
|
||||
## Self-Check
|
||||
|
||||
- [ ] Does this feature implement a shared interface?
|
||||
- [ ] Are fallbacks + errors handled gracefully?
|
||||
- [ ] Have relevant ADRs been updated/linked?
|
||||
- [ ] Did I add competence hooks or prompts for the team?
|
||||
- [ ] Was human interaction (sync/review/demo) scheduled?
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active architecture guidelines
|
||||
**Priority**: High
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: Vue 3, Capacitor, Electron, Vite
|
||||
**Stakeholders**: Development team, Architecture team
|
||||
|
||||
- [ ] Are fallbacks + errors handled gracefully?
|
||||
- [ ] Have relevant ADRs been updated/linked?
|
||||
- [ ] Did I add competence hooks or prompts for the team?
|
||||
- [ ] Was human interaction (sync/review/demo) scheduled?
|
||||
# TimeSafari Cross-Platform Architecture Guide
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-19
|
||||
**Status**: 🎯 **ACTIVE** - Architecture guidelines
|
||||
|
||||
## 1. Platform Support Matrix
|
||||
|
||||
| Feature | Web (PWA) | Capacitor (Mobile) | Electron (Desktop) |
|
||||
|---------|-----------|--------------------|-------------------|
|
||||
| QR Code Scanning | WebInlineQRScanner | @capacitor-mlkit/barcode-scanning | Not Implemented |
|
||||
| Deep Linking | URL Parameters | App URL Open Events | Not Implemented |
|
||||
| File System | Limited (Browser API) | Capacitor Filesystem | Electron fs |
|
||||
| Camera Access | MediaDevices API | Capacitor Camera | Not Implemented |
|
||||
| Platform Detection | Web APIs | Capacitor.isNativePlatform() | process.env checks |
|
||||
|
||||
## 2. Project Structure
|
||||
|
||||
### Core Directories
|
||||
|
||||
```
|
||||
src/
|
||||
├── components/ # Vue components
|
||||
├── services/ # Platform services and business logic
|
||||
├── views/ # Page components
|
||||
├── router/ # Vue router configuration
|
||||
├── types/ # TypeScript type definitions
|
||||
├── utils/ # Utility functions
|
||||
├── lib/ # Core libraries
|
||||
├── platforms/ # Platform-specific implementations
|
||||
├── electron/ # Electron-specific code
|
||||
├── constants/ # Application constants
|
||||
├── db/ # Database related code
|
||||
├── interfaces/ # TypeScript interfaces
|
||||
└── assets/ # Static assets
|
||||
```
|
||||
|
||||
### Entry Points
|
||||
|
||||
- `main.ts` → Base entry
|
||||
- `main.common.ts` → Shared init
|
||||
- `main.capacitor.ts` → Mobile entry
|
||||
- `main.electron.ts` → Electron entry
|
||||
- `main.web.ts` → Web entry
|
||||
|
||||
## 3. Service Architecture
|
||||
|
||||
### Service Organization
|
||||
|
||||
```tree
|
||||
services/
|
||||
├── QRScanner/
|
||||
│ ├── WebInlineQRScanner.ts
|
||||
│ └── interfaces.ts
|
||||
├── platforms/
|
||||
│ ├── WebPlatformService.ts
|
||||
│ ├── CapacitorPlatformService.ts
|
||||
│ └── ElectronPlatformService.ts
|
||||
└── factory/
|
||||
└── PlatformServiceFactory.ts
|
||||
```
|
||||
|
||||
### Factory Pattern
|
||||
|
||||
Use a **singleton factory** to select platform services via
|
||||
`process.env.VITE_PLATFORM`.
|
||||
|
||||
## 4. Feature Guidelines
|
||||
|
||||
### QR Code Scanning
|
||||
|
||||
- Define `QRScannerService` interface.
|
||||
- Implement platform-specific classes (`WebInlineQRScanner`, Capacitor,
|
||||
etc).
|
||||
- Provide `addListener` and `onStream` hooks for composability.
|
||||
|
||||
### Deep Linking
|
||||
|
||||
- URL format: `timesafari://<route>[/<param>][?query=value]`
|
||||
- Web: `router.beforeEach` → parse query
|
||||
- Capacitor: `App.addListener("appUrlOpen", …)`
|
||||
|
||||
## 5. Build Process
|
||||
|
||||
- `vite.config.common.mts` → shared config
|
||||
- Platform configs: `vite.config.web.mts`, `.capacitor.mts`,
|
||||
`.electron.mts`
|
||||
- Use `process.env.VITE_PLATFORM` for conditional loading.
|
||||
|
||||
```bash
|
||||
npm run build:web
|
||||
npm run build:capacitor
|
||||
npm run build:electron
|
||||
```
|
||||
|
||||
## 6. Testing Strategy
|
||||
|
||||
- **Unit tests** for services.
|
||||
- **Playwright** for Web + Capacitor:
|
||||
- `playwright.config-local.ts` includes web + Pixel 5.
|
||||
- **Electron tests**: add `spectron` or Playwright-Electron.
|
||||
- Mark tests with platform tags:
|
||||
|
||||
```ts
|
||||
test.skip(!process.env.MOBILE_TEST, "Mobile-only test");
|
||||
```
|
||||
|
||||
> 🔗 **Human Hook:** Before merging new tests, hold a short sync (≤15
|
||||
> min) with QA to align on coverage and flaky test risks.
|
||||
|
||||
## 7. Error Handling
|
||||
|
||||
- Global Vue error handler → logs with component name.
|
||||
- Platform-specific wrappers log API errors with platform prefix
|
||||
(`[Capacitor API Error]`, etc).
|
||||
- Use structured logging (not `console.log`).
|
||||
|
||||
## 8. Best Practices
|
||||
|
||||
- Keep platform code **isolated** in `platforms/`.
|
||||
- Always define a **shared interface** first.
|
||||
- Use feature detection, not platform detection, when possible.
|
||||
- Dependency injection for services → improves testability.
|
||||
- Maintain **Competence Hooks** in PRs (2–3 prompts for dev
|
||||
discussion).
|
||||
|
||||
## 9. Dependency Management
|
||||
|
||||
- Key deps: `@capacitor/core`, `electron`, `vue`.
|
||||
- Use conditional `import()` for platform-specific libs.
|
||||
|
||||
## 10. Security Considerations
|
||||
|
||||
- **Permissions**: Always check + request gracefully.
|
||||
- **Storage**: Secure storage for sensitive data; encrypt when possible.
|
||||
- **Audits**: Schedule quarterly security reviews.
|
||||
|
||||
## 11. ADR Process
|
||||
|
||||
- All major architecture choices → log in `doc/adr/`.
|
||||
- Use ADR template with Context, Decision, Consequences, Status.
|
||||
- Link related ADRs in PR descriptions.
|
||||
|
||||
> 🔗 **Human Hook:** When proposing a new ADR, schedule a 30-min
|
||||
> design sync for discussion, not just async review.
|
||||
|
||||
## 12. Collaboration Hooks
|
||||
|
||||
- **QR features**: Sync with Security before merging → permissions &
|
||||
privacy.
|
||||
- **New platform builds**: Demo in team meeting → confirm UX
|
||||
differences.
|
||||
- **Critical ADRs**: Present in guild or architecture review.
|
||||
|
||||
## Self-Check
|
||||
|
||||
- [ ] Does this feature implement a shared interface?
|
||||
- [ ] Are fallbacks + errors handled gracefully?
|
||||
- [ ] Have relevant ADRs been updated/linked?
|
||||
- [ ] Did I add competence hooks or prompts for the team?
|
||||
- [ ] Was human interaction (sync/review/demo) scheduled?
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active architecture guidelines
|
||||
**Priority**: High
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: Vue 3, Capacitor, Electron, Vite
|
||||
**Stakeholders**: Development team, Architecture team
|
||||
|
||||
- [ ] Are fallbacks + errors handled gracefully?
|
||||
- [ ] Have relevant ADRs been updated/linked?
|
||||
- [ ] Did I add competence hooks or prompts for the team?
|
||||
- [ ] Was human interaction (sync/review/demo) scheduled?
|
||||
@@ -1,181 +0,0 @@
|
||||
# Time Safari Context
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-19
|
||||
**Status**: 🎯 **ACTIVE** - Core application context
|
||||
|
||||
## Project Overview
|
||||
|
||||
Time Safari is an application designed to foster community building through
|
||||
gifts, gratitude, and collaborative projects. The app makes it easy and
|
||||
intuitive for users of any age and capability to recognize contributions,
|
||||
build trust networks, and organize collective action. It is built on services
|
||||
that preserve privacy and data sovereignty.
|
||||
|
||||
## Core Goals
|
||||
|
||||
1. **Connect**: Make it easy, rewarding, and non-threatening for people to
|
||||
connect with others who have similar interests, and to initiate activities
|
||||
together.
|
||||
|
||||
2. **Reveal**: Widely advertise the great support and rewards that are being
|
||||
given and accepted freely, especially non-monetary ones, showing the impact
|
||||
gifts make in people's lives.
|
||||
|
||||
## Technical Foundation
|
||||
|
||||
### Architecture
|
||||
|
||||
- **Privacy-preserving claims architecture** via endorser.ch
|
||||
- **Decentralized Identifiers (DIDs)**: User identities based on
|
||||
public/private key pairs stored on devices
|
||||
- **Cryptographic Verification**: All claims and confirmations are
|
||||
cryptographically signed
|
||||
- **User-Controlled Visibility**: Users explicitly control who can see their
|
||||
identifiers and data
|
||||
- **Cross-Platform**: Web (PWA), Mobile (Capacitor), Desktop (Electron)
|
||||
|
||||
### Current Database State
|
||||
|
||||
- **Database**: SQLite via Absurd SQL (browser) and native SQLite
|
||||
(mobile/desktop)
|
||||
- **Legacy Support**: IndexedDB (Dexie) for backward compatibility
|
||||
- **Status**: Modern database architecture fully implemented
|
||||
|
||||
### Core Technologies
|
||||
|
||||
- **Frontend**: Vue 3 + TypeScript + vue-facing-decorator
|
||||
- **Styling**: TailwindCSS
|
||||
- **Build**: Vite with platform-specific configs
|
||||
- **Testing**: Playwright E2E, Jest unit tests
|
||||
- **Database**: SQLite (Absurd SQL in browser), IndexedDB (legacy)
|
||||
- **State**: Pinia stores
|
||||
- **Platform Services**: Abstracted behind interfaces with factory pattern
|
||||
|
||||
## Development Principles
|
||||
|
||||
### Code Organization
|
||||
|
||||
- **Platform Services**: Abstract platform-specific code behind interfaces
|
||||
- **Service Factory**: Use `PlatformServiceFactory` for platform selection
|
||||
- **Type Safety**: Strict TypeScript, no `any` types, use type guards
|
||||
- **Modern Architecture**: Use current platform service patterns
|
||||
|
||||
### Architecture Patterns
|
||||
|
||||
- **Dependency Injection**: Services injected via mixins and factory pattern
|
||||
- **Interface Segregation**: Small, focused interfaces over large ones
|
||||
- **Composition over Inheritance**: Prefer mixins and composition
|
||||
- **Single Responsibility**: Each component/service has one clear purpose
|
||||
|
||||
### Testing Strategy
|
||||
|
||||
- **E2E**: Playwright for critical user journeys
|
||||
- **Unit**: Jest with F.I.R.S.T. principles
|
||||
- **Platform Coverage**: Web + Capacitor (Pixel 5) in CI
|
||||
- **Quality Assurance**: Comprehensive testing and validation
|
||||
|
||||
## Current Development Focus
|
||||
|
||||
### Active Development
|
||||
|
||||
- **Feature Development**: Build new functionality using modern platform
|
||||
services
|
||||
- **Performance Optimization**: Improve app performance and user experience
|
||||
- **Platform Enhancement**: Leverage platform-specific capabilities
|
||||
- **Code Quality**: Maintain high standards and best practices
|
||||
|
||||
### Development Metrics
|
||||
|
||||
- **Code Quality**: High standards maintained across all platforms
|
||||
- **Performance**: Optimized for all target devices
|
||||
- **Testing**: Comprehensive coverage maintained
|
||||
- **User Experience**: Focus on intuitive, accessible interfaces
|
||||
|
||||
## Platform-Specific Considerations
|
||||
|
||||
### Web (PWA)
|
||||
|
||||
- **QR Scanning**: WebInlineQRScanner
|
||||
- **Deep Linking**: URL parameters
|
||||
- **File System**: Limited browser APIs
|
||||
- **Build**: `npm run build:web` (development build)
|
||||
|
||||
### Mobile (Capacitor)
|
||||
|
||||
- **QR Scanning**: @capacitor-mlkit/barcode-scanning
|
||||
- **Deep Linking**: App URL open events
|
||||
- **File System**: Capacitor Filesystem
|
||||
- **Build**: `npm run build:capacitor`
|
||||
|
||||
### Desktop (Electron)
|
||||
|
||||
- **File System**: Node.js fs
|
||||
- **Build**: `npm run build:electron`
|
||||
- **Distribution**: AppImage, DEB, DMG packages
|
||||
|
||||
## Development Workflow
|
||||
|
||||
### Build Commands
|
||||
|
||||
```bash
|
||||
# Web (development)
|
||||
npm run build:web
|
||||
|
||||
# Mobile
|
||||
npm run build:capacitor
|
||||
npm run build:native
|
||||
|
||||
# Desktop
|
||||
npm run build:electron
|
||||
npm run build:electron:appimage
|
||||
npm run build:electron:deb
|
||||
npm run build:electron:dmg
|
||||
```
|
||||
|
||||
### Testing Commands
|
||||
|
||||
```bash
|
||||
# Web E2E
|
||||
npm run test:web
|
||||
|
||||
# Mobile
|
||||
npm run test:mobile
|
||||
npm run test:android
|
||||
npm run test:ios
|
||||
|
||||
# Type checking
|
||||
npm run type-check
|
||||
npm run lint-fix
|
||||
```
|
||||
|
||||
## Key Constraints
|
||||
|
||||
1. **Privacy First**: User identifiers remain private except when explicitly
|
||||
shared
|
||||
2. **Platform Compatibility**: Features must work across all target platforms
|
||||
3. **Performance**: Must remain performant on older/simpler devices
|
||||
4. **Modern Architecture**: New features should use current platform services
|
||||
5. **Offline Capability**: Key functionality should work offline when feasible
|
||||
|
||||
## Use Cases to Support
|
||||
|
||||
1. **Community Building**: Tools for finding others with shared interests
|
||||
2. **Project Coordination**: Easy proposal and collaboration on projects
|
||||
3. **Reputation Building**: Showcasing contributions and reliability
|
||||
4. **Governance**: Facilitating decision-making and collective governance
|
||||
|
||||
## Resources
|
||||
|
||||
- **Testing**: `docs/migration-testing/`
|
||||
- **Architecture**: `docs/architecture-decisions.md`
|
||||
- **Build Context**: `docs/build-modernization-context.md`
|
||||
|
||||
---
|
||||
|
||||
## Status: Active application context
|
||||
|
||||
- **Priority**: Critical
|
||||
- **Estimated Effort**: Ongoing reference
|
||||
- **Dependencies**: Vue 3, TypeScript, SQLite, Capacitor, Electron
|
||||
- **Stakeholders**: Development team, Product team
|
||||
292
.cursor/rules/architectural_decision_record.mdc
Normal file
@@ -0,0 +1,292 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
# TimeSafari Cross-Platform Architecture Guide
|
||||
|
||||
## 1. Platform Support Matrix
|
||||
|
||||
| Feature | Web (PWA) | Capacitor (Mobile) | Electron (Desktop) | PyWebView (Desktop) |
|
||||
|---------|-----------|-------------------|-------------------|-------------------|
|
||||
| QR Code Scanning | WebInlineQRScanner | @capacitor-mlkit/barcode-scanning | Not Implemented | Not Implemented |
|
||||
| Deep Linking | URL Parameters | App URL Open Events | Not Implemented | Not Implemented |
|
||||
| File System | Limited (Browser API) | Capacitor Filesystem | Electron fs | PyWebView Python Bridge |
|
||||
| Camera Access | MediaDevices API | Capacitor Camera | Not Implemented | Not Implemented |
|
||||
| Platform Detection | Web APIs | Capacitor.isNativePlatform() | process.env checks | process.env checks |
|
||||
|
||||
## 2. Project Structure
|
||||
|
||||
### 2.1 Core Directories
|
||||
```
|
||||
src/
|
||||
├── components/ # Vue components
|
||||
├── services/ # Platform services and business logic
|
||||
├── views/ # Page components
|
||||
├── router/ # Vue router configuration
|
||||
├── types/ # TypeScript type definitions
|
||||
├── utils/ # Utility functions
|
||||
├── lib/ # Core libraries
|
||||
├── platforms/ # Platform-specific implementations
|
||||
├── electron/ # Electron-specific code
|
||||
├── constants/ # Application constants
|
||||
├── db/ # Database related code
|
||||
├── interfaces/ # TypeScript interfaces and type definitions
|
||||
└── assets/ # Static assets
|
||||
```
|
||||
|
||||
### 2.2 Entry Points
|
||||
```
|
||||
src/
|
||||
├── main.ts # Base entry
|
||||
├── main.common.ts # Shared initialization
|
||||
├── main.capacitor.ts # Mobile entry
|
||||
├── main.electron.ts # Electron entry
|
||||
├── main.pywebview.ts # PyWebView entry
|
||||
└── main.web.ts # Web/PWA entry
|
||||
```
|
||||
|
||||
### 2.3 Build Configurations
|
||||
```
|
||||
root/
|
||||
├── vite.config.common.mts # Shared config
|
||||
├── vite.config.capacitor.mts # Mobile build
|
||||
├── vite.config.electron.mts # Electron build
|
||||
├── vite.config.pywebview.mts # PyWebView build
|
||||
├── vite.config.web.mts # Web/PWA build
|
||||
└── vite.config.utils.mts # Build utilities
|
||||
```
|
||||
|
||||
## 3. Service Architecture
|
||||
|
||||
### 3.1 Service Organization
|
||||
```
|
||||
services/
|
||||
├── QRScanner/ # QR code scanning service
|
||||
│ ├── WebInlineQRScanner.ts
|
||||
│ └── interfaces.ts
|
||||
├── platforms/ # Platform-specific services
|
||||
│ ├── WebPlatformService.ts
|
||||
│ ├── CapacitorPlatformService.ts
|
||||
│ ├── ElectronPlatformService.ts
|
||||
│ └── PyWebViewPlatformService.ts
|
||||
└── factory/ # Service factories
|
||||
└── PlatformServiceFactory.ts
|
||||
```
|
||||
|
||||
### 3.2 Service Factory Pattern
|
||||
```typescript
|
||||
// PlatformServiceFactory.ts
|
||||
export class PlatformServiceFactory {
|
||||
private static instance: PlatformService | null = null;
|
||||
|
||||
public static getInstance(): PlatformService {
|
||||
if (!PlatformServiceFactory.instance) {
|
||||
const platform = process.env.VITE_PLATFORM || "web";
|
||||
PlatformServiceFactory.instance = createPlatformService(platform);
|
||||
}
|
||||
return PlatformServiceFactory.instance;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 4. Feature Implementation Guidelines
|
||||
|
||||
### 4.1 QR Code Scanning
|
||||
|
||||
1. **Service Interface**
|
||||
```typescript
|
||||
interface QRScannerService {
|
||||
checkPermissions(): Promise<boolean>;
|
||||
requestPermissions(): Promise<boolean>;
|
||||
isSupported(): Promise<boolean>;
|
||||
startScan(): Promise<void>;
|
||||
stopScan(): Promise<void>;
|
||||
addListener(listener: ScanListener): void;
|
||||
onStream(callback: (stream: MediaStream | null) => void): void;
|
||||
cleanup(): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
2. **Platform-Specific Implementation**
|
||||
```typescript
|
||||
// WebInlineQRScanner.ts
|
||||
export class WebInlineQRScanner implements QRScannerService {
|
||||
private scanListener: ScanListener | null = null;
|
||||
private isScanning = false;
|
||||
private stream: MediaStream | null = null;
|
||||
private events = new EventEmitter();
|
||||
|
||||
// Implementation of interface methods
|
||||
}
|
||||
```
|
||||
|
||||
### 4.2 Deep Linking
|
||||
|
||||
1. **URL Structure**
|
||||
```typescript
|
||||
// Format: timesafari://<route>[/<param>][?queryParam1=value1]
|
||||
interface DeepLinkParams {
|
||||
route: string;
|
||||
params?: Record<string, string>;
|
||||
query?: Record<string, string>;
|
||||
}
|
||||
```
|
||||
|
||||
2. **Platform Handlers**
|
||||
```typescript
|
||||
// Capacitor
|
||||
App.addListener("appUrlOpen", handleDeepLink);
|
||||
|
||||
// Web
|
||||
router.beforeEach((to, from, next) => {
|
||||
handleWebDeepLink(to.query);
|
||||
});
|
||||
```
|
||||
|
||||
## 5. Build Process
|
||||
|
||||
### 5.1 Environment Configuration
|
||||
```typescript
|
||||
// vite.config.common.mts
|
||||
export function createBuildConfig(mode: string) {
|
||||
return {
|
||||
define: {
|
||||
'process.env.VITE_PLATFORM': JSON.stringify(mode),
|
||||
'process.env.VITE_PWA_ENABLED': JSON.stringify(!isNative),
|
||||
__IS_MOBILE__: JSON.stringify(isCapacitor),
|
||||
__USE_QR_READER__: JSON.stringify(!isCapacitor)
|
||||
}
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### 5.2 Platform-Specific Builds
|
||||
|
||||
```bash
|
||||
# Build commands from package.json
|
||||
"build:web": "vite build --config vite.config.web.mts",
|
||||
"build:capacitor": "vite build --config vite.config.capacitor.mts",
|
||||
"build:electron": "vite build --config vite.config.electron.mts",
|
||||
"build:pywebview": "vite build --config vite.config.pywebview.mts"
|
||||
```
|
||||
|
||||
## 6. Testing Strategy
|
||||
|
||||
### 6.1 Test Configuration
|
||||
```typescript
|
||||
// playwright.config-local.ts
|
||||
const config: PlaywrightTestConfig = {
|
||||
projects: [
|
||||
{
|
||||
name: 'web',
|
||||
use: { browserName: 'chromium' }
|
||||
},
|
||||
{
|
||||
name: 'mobile',
|
||||
use: { ...devices['Pixel 5'] }
|
||||
}
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
### 6.2 Platform-Specific Tests
|
||||
```typescript
|
||||
test('QR scanning works on mobile', async ({ page }) => {
|
||||
test.skip(!process.env.MOBILE_TEST, 'Mobile-only test');
|
||||
// Test implementation
|
||||
});
|
||||
```
|
||||
|
||||
## 7. Error Handling
|
||||
|
||||
### 7.1 Global Error Handler
|
||||
```typescript
|
||||
function setupGlobalErrorHandler(app: VueApp) {
|
||||
app.config.errorHandler = (err, instance, info) => {
|
||||
logger.error("[App Error]", {
|
||||
error: err,
|
||||
info,
|
||||
component: instance?.$options.name
|
||||
});
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### 7.2 Platform-Specific Error Handling
|
||||
```typescript
|
||||
// API error handling for Capacitor
|
||||
if (process.env.VITE_PLATFORM === 'capacitor') {
|
||||
logger.error(`[Capacitor API Error] ${endpoint}:`, {
|
||||
message: error.message,
|
||||
status: error.response?.status
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
## 8. Best Practices
|
||||
|
||||
### 8.1 Code Organization
|
||||
- Use platform-specific directories for unique implementations
|
||||
- Share common code through service interfaces
|
||||
- Implement feature detection before using platform capabilities
|
||||
- Keep platform-specific code isolated in dedicated directories
|
||||
- Use TypeScript interfaces for cross-platform compatibility
|
||||
|
||||
### 8.2 Platform Detection
|
||||
```typescript
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
const capabilities = platformService.getCapabilities();
|
||||
|
||||
if (capabilities.hasCamera) {
|
||||
// Implement camera features
|
||||
}
|
||||
```
|
||||
|
||||
### 8.3 Feature Implementation
|
||||
1. Define platform-agnostic interface
|
||||
2. Create platform-specific implementations
|
||||
3. Use factory pattern for instantiation
|
||||
4. Implement graceful fallbacks
|
||||
5. Add comprehensive error handling
|
||||
6. Use dependency injection for better testability
|
||||
|
||||
## 9. Dependency Management
|
||||
|
||||
### 9.1 Platform-Specific Dependencies
|
||||
```json
|
||||
{
|
||||
"dependencies": {
|
||||
"@capacitor/core": "^6.2.0",
|
||||
"electron": "^33.2.1",
|
||||
"vue": "^3.4.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 9.2 Conditional Loading
|
||||
```typescript
|
||||
if (process.env.VITE_PLATFORM === 'capacitor') {
|
||||
await import('@capacitor/core');
|
||||
}
|
||||
```
|
||||
|
||||
## 10. Security Considerations
|
||||
|
||||
### 10.1 Permission Handling
|
||||
```typescript
|
||||
async checkPermissions(): Promise<boolean> {
|
||||
if (platformService.isCapacitor()) {
|
||||
return await checkNativePermissions();
|
||||
}
|
||||
return await checkWebPermissions();
|
||||
}
|
||||
```
|
||||
|
||||
### 10.2 Data Storage
|
||||
- Use secure storage mechanisms for sensitive data
|
||||
- Implement proper encryption for stored data
|
||||
- Follow platform-specific security guidelines
|
||||
- Regular security audits and updates
|
||||
|
||||
This document should be updated as new features are added or platform-specific implementations change. Regular reviews ensure it remains current with the codebase.
|
||||
@@ -1,75 +0,0 @@
|
||||
# Architecture Rules Directory
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-20
|
||||
**Status**: 🎯 **ACTIVE** - Architecture protection guidelines
|
||||
|
||||
## Overview
|
||||
|
||||
This directory contains MDC (Model Directive Configuration) rules that protect
|
||||
critical architectural components of the TimeSafari project. These rules ensure
|
||||
that changes to system architecture follow proper review, testing, and
|
||||
documentation procedures.
|
||||
|
||||
## Available Rules
|
||||
|
||||
### Build Architecture Guard (`build_architecture_guard.mdc`)
|
||||
|
||||
Protects the multi-platform build system including:
|
||||
|
||||
- Vite configuration files
|
||||
- Build scripts and automation
|
||||
- Platform-specific configurations (iOS, Android, Electron, Web)
|
||||
- Docker and deployment infrastructure
|
||||
- CI/CD pipeline components
|
||||
|
||||
**When to use**: Any time you're modifying build scripts, configuration files,
|
||||
or deployment processes.
|
||||
|
||||
**Authorization levels**:
|
||||
|
||||
- **Level 1**: Minor changes (review required)
|
||||
- **Level 2**: Moderate changes (testing required)
|
||||
- **Level 3**: Major changes (ADR required)
|
||||
|
||||
## Usage Guidelines
|
||||
|
||||
### For Developers
|
||||
|
||||
1. **Check the rule**: Before making architectural changes, review the relevant
|
||||
rule
|
||||
2. **Follow the process**: Use the appropriate authorization level
|
||||
3. **Complete validation**: Run through the required checklist
|
||||
4. **Update documentation**: Keep BUILDING.md and related docs current
|
||||
|
||||
### For Reviewers
|
||||
|
||||
1. **Verify authorization**: Ensure changes match the required level
|
||||
2. **Check testing**: Confirm appropriate testing has been completed
|
||||
3. **Validate documentation**: Ensure BUILDING.md reflects changes
|
||||
4. **Assess risk**: Consider impact on other platforms and systems
|
||||
|
||||
## Integration with Other Rules
|
||||
|
||||
- **Version Control**: Works with `workflow/version_control.mdc`
|
||||
- **Research & Diagnostic**: Supports `research_diagnostic.mdc` for
|
||||
investigations
|
||||
- **Software Development**: Aligns with development best practices
|
||||
- **Markdown Automation**: Integrates with `docs/markdown-automation.mdc` for
|
||||
consistent documentation formatting
|
||||
|
||||
## Emergency Procedures
|
||||
|
||||
If architectural changes cause system failures:
|
||||
|
||||
1. **Immediate rollback** to last known working state
|
||||
2. **Document the failure** with full error details
|
||||
3. **Investigate root cause** using diagnostic workflows
|
||||
4. **Update procedures** to prevent future failures
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active architecture protection
|
||||
**Priority**: Critical
|
||||
**Maintainer**: Development team
|
||||
**Next Review**: 2025-09-20
|
||||
@@ -1,295 +0,0 @@
|
||||
---
|
||||
description: Guards against unauthorized changes to the TimeSafari building
|
||||
architecture
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Build Architecture Guard Directive
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-20
|
||||
**Status**: 🎯 **ACTIVE** - Build system protection guidelines
|
||||
|
||||
## Purpose
|
||||
|
||||
Protect the TimeSafari building architecture from unauthorized changes that
|
||||
could break the multi-platform build pipeline, deployment processes, or
|
||||
development workflow. This directive ensures all build system modifications
|
||||
follow proper review, testing, and documentation procedures.
|
||||
|
||||
## Protected Architecture Components
|
||||
|
||||
### Core Build Infrastructure
|
||||
|
||||
- **Vite Configuration Files**: `vite.config.*.mts` files
|
||||
- **Build Scripts**: All scripts in `scripts/` directory
|
||||
- **Package Scripts**: `package.json` build-related scripts
|
||||
- **Platform Configs**: `capacitor.config.ts`, `electron/`, `android/`,
|
||||
`ios/`
|
||||
- **Docker Configuration**: `Dockerfile`, `docker-compose.yml`
|
||||
- **Environment Files**: `.env.*`, `.nvmrc`, `.node-version`
|
||||
|
||||
### Critical Build Dependencies
|
||||
|
||||
- **Build Tools**: Vite, Capacitor, Electron, Android SDK, Xcode
|
||||
- **Asset Management**: `capacitor-assets.config.json`, asset scripts
|
||||
- **Testing Infrastructure**: Playwright, Jest, mobile test scripts
|
||||
- **CI/CD Pipeline**: GitHub Actions, build validation scripts
|
||||
- **Service Worker Assembly**: `sw_scripts/`, `sw_combine.js`, WASM copy steps
|
||||
|
||||
## Change Authorization Requirements
|
||||
|
||||
### Level 1: Minor Changes (Requires Review)
|
||||
|
||||
- Documentation updates to `BUILDING.md`
|
||||
- Non-breaking script improvements
|
||||
- Test additions or improvements
|
||||
- Asset configuration updates
|
||||
|
||||
**Process**: Code review + basic testing
|
||||
|
||||
### Level 2: Moderate Changes (Requires Testing)
|
||||
|
||||
- New build script additions
|
||||
- Environment variable changes
|
||||
- Dependency version updates
|
||||
- Platform-specific optimizations
|
||||
|
||||
**Process**: Code review + platform testing + documentation update
|
||||
|
||||
### Level 3: Major Changes (Requires ADR)
|
||||
|
||||
- Build system architecture changes
|
||||
- New platform support
|
||||
- Breaking changes to build scripts
|
||||
- Major dependency migrations
|
||||
|
||||
**Process**: ADR creation + comprehensive testing + team review
|
||||
|
||||
## Prohibited Actions
|
||||
|
||||
### ❌ Never Allow Without ADR
|
||||
|
||||
- **Delete or rename** core build scripts
|
||||
- **Modify** `package.json` build script names
|
||||
- **Change** Vite configuration structure
|
||||
- **Remove** platform-specific build targets
|
||||
- **Alter** Docker build process
|
||||
- **Modify** CI/CD pipeline without testing
|
||||
|
||||
### ❌ Never Allow Without Testing
|
||||
|
||||
- **Update** build dependencies
|
||||
- **Change** environment configurations
|
||||
- **Modify** asset generation scripts
|
||||
- **Alter** test infrastructure
|
||||
- **Update** platform SDK versions
|
||||
|
||||
## Required Validation Checklist
|
||||
|
||||
### Before Any Build System Change
|
||||
|
||||
- [ ] **Impact Assessment**: Which platforms are affected?
|
||||
- [ ] **Testing Plan**: How will this be tested across platforms?
|
||||
- [ ] **Rollback Plan**: How can this be reverted if it breaks?
|
||||
- [ ] **Documentation**: Will `BUILDING.md` need updates?
|
||||
- [ ] **Dependencies**: Are all required tools available?
|
||||
|
||||
### After Build System Change
|
||||
|
||||
- [ ] **Web Platform**: Does `npm run build:web:dev` work?
|
||||
- [ ] **Mobile Platforms**: Do iOS/Android builds succeed?
|
||||
- [ ] **Desktop Platform**: Does Electron build and run?
|
||||
- [ ] **Tests Pass**: Do all build-related tests pass?
|
||||
- [ ] **Documentation Updated**: Is `BUILDING.md` current?
|
||||
|
||||
## Specific Test Commands (Minimum Required)
|
||||
|
||||
### Web Platform
|
||||
|
||||
- **Development**: `npm run build:web:dev` - serve and load app
|
||||
- **Production**: `npm run build:web:prod` - verify SW and WASM present
|
||||
|
||||
### Mobile Platforms
|
||||
|
||||
- **Android**: `npm run build:android:test` or `:prod` - confirm assets copied
|
||||
- **iOS**: `npm run build:ios:test` or `:prod` - verify build succeeds
|
||||
|
||||
### Desktop Platform
|
||||
|
||||
- **Electron**: `npm run build:electron:dev` and packaging for target OS
|
||||
- **Verify**: Single-instance behavior and app boot
|
||||
|
||||
### Auto-run (if affected)
|
||||
|
||||
- **Test Mode**: `npm run auto-run:test` and platform variants
|
||||
- **Production Mode**: `npm run auto-run:prod` and platform variants
|
||||
|
||||
### Clean and Rebuild
|
||||
|
||||
- Run relevant `clean:*` scripts and ensure re-build works
|
||||
|
||||
## Emergency Procedures
|
||||
|
||||
### Build System Broken
|
||||
|
||||
1. **Immediate**: Revert to last known working commit
|
||||
2. **Investigation**: Create issue with full error details
|
||||
3. **Testing**: Verify all platforms work after revert
|
||||
4. **Documentation**: Update `BUILDING.md` with failure notes
|
||||
|
||||
### Platform-Specific Failure
|
||||
|
||||
1. **Isolate**: Identify which platform is affected
|
||||
2. **Test Others**: Verify other platforms still work
|
||||
3. **Rollback**: Revert platform-specific changes
|
||||
4. **Investigation**: Debug in isolated environment
|
||||
|
||||
## Integration Points
|
||||
|
||||
### With Version Control
|
||||
|
||||
- **Branch Protection**: Require reviews for build script changes
|
||||
- **Commit Messages**: Must reference ADR for major changes
|
||||
- **Testing**: All build changes must pass CI/CD pipeline
|
||||
|
||||
### With Documentation
|
||||
|
||||
- **BUILDING.md**: Must be updated for any script changes
|
||||
- **README.md**: Must reflect new build requirements
|
||||
- **CHANGELOG.md**: Must document breaking build changes
|
||||
|
||||
### With Testing
|
||||
|
||||
- **Pre-commit**: Run basic build validation
|
||||
- **CI/CD**: Full platform build testing
|
||||
- **Manual Testing**: Human verification of critical paths
|
||||
|
||||
## Risk Matrix & Required Validation
|
||||
|
||||
### Environment Handling
|
||||
|
||||
- **Trigger**: Change to `.env.*` loading / variable names
|
||||
- **Validation**: Prove `dev/test/prod` builds; show environment echo in logs
|
||||
|
||||
### Script Flow
|
||||
|
||||
- **Trigger**: Reorder steps (prebuild → build → package), new flags
|
||||
- **Validation**: Dry-run + normal run, show exit codes & timing
|
||||
|
||||
### Platform Packaging
|
||||
|
||||
- **Trigger**: Electron NSIS/DMG/AppImage, Android/iOS bundle
|
||||
- **Validation**: Produce installer/artifact and open it; verify single-instance,
|
||||
icons, signing
|
||||
|
||||
### Service Worker / WASM
|
||||
|
||||
- **Trigger**: `sw_combine.js`, WASM copy path
|
||||
- **Validation**: Verify combined SW exists and is injected; page loads offline;
|
||||
WASM present
|
||||
|
||||
### Docker
|
||||
|
||||
- **Trigger**: New base image, build args
|
||||
- **Validation**: Build image locally; run container; list produced `/dist`
|
||||
|
||||
### Signing/Notarization
|
||||
|
||||
- **Trigger**: Cert path/profiles
|
||||
- **Validation**: Show signing logs + verify on target OS
|
||||
|
||||
## PR Template (Paste into Description)
|
||||
|
||||
- [ ] **Level**: L1 / L2 / L3 + justification
|
||||
- [ ] **Files & platforms touched**:
|
||||
- [ ] **Risk triggers & mitigations**:
|
||||
- [ ] **Commands run (paste logs)**:
|
||||
- [ ] **Artifacts (names + sha256)**:
|
||||
- [ ] **Docs updated (sections/links)**:
|
||||
- [ ] **Rollback steps verified**:
|
||||
- [ ] **CI**: Jobs passing and artifacts uploaded
|
||||
|
||||
## Rollback Playbook
|
||||
|
||||
### Immediate Rollback
|
||||
|
||||
1. `git revert` or `git reset --hard <prev>`; restore prior `scripts/` or config
|
||||
files
|
||||
2. Rebuild affected targets; verify old behavior returns
|
||||
3. Post-mortem notes → update this guard and `BUILDING.md` if gaps found
|
||||
|
||||
### Rollback Verification
|
||||
|
||||
- **Web**: `npm run build:web:dev` and `npm run build:web:prod`
|
||||
- **Mobile**: `npm run build:android:test` and `npm run build:ios:test`
|
||||
- **Desktop**: `npm run build:electron:dev` and packaging commands
|
||||
- **Clean**: Run relevant `clean:*` scripts and verify re-build works
|
||||
|
||||
## ADR Trigger List
|
||||
|
||||
Raise an ADR when you propose any of:
|
||||
|
||||
- **New build stage** or reorder of canonical stages
|
||||
- **Replacement of packager** / packaging format
|
||||
- **New environment model** or secure secret handling scheme
|
||||
- **New service worker assembly** strategy or cache policy
|
||||
- **New Docker base** or multi-stage pipeline
|
||||
- **Relocation of build outputs** or directory conventions
|
||||
|
||||
**ADR must include**: motivation, alternatives, risks, validation plan, rollback,
|
||||
doc diffs.
|
||||
|
||||
## Competence Hooks
|
||||
|
||||
### Why This Works
|
||||
|
||||
- **Prevents Build Failures**: Catches issues before they reach production
|
||||
- **Maintains Consistency**: Ensures all platforms build identically
|
||||
- **Reduces Debugging Time**: Prevents build system regressions
|
||||
|
||||
### Common Pitfalls
|
||||
|
||||
- **Silent Failures**: Changes that work on one platform but break others
|
||||
- **Dependency Conflicts**: Updates that create version incompatibilities
|
||||
- **Documentation Drift**: Build scripts that don't match documentation
|
||||
|
||||
### Next Skill Unlock
|
||||
|
||||
- Learn to test build changes across all platforms simultaneously
|
||||
|
||||
### Teach-back
|
||||
|
||||
- "What three platforms must I test before committing a build script change?"
|
||||
|
||||
## Collaboration Hooks
|
||||
|
||||
### Team Review Requirements
|
||||
|
||||
- **Platform Owners**: iOS, Android, Electron, Web specialists
|
||||
- **DevOps**: CI/CD pipeline maintainers
|
||||
- **QA**: Testing infrastructure owners
|
||||
|
||||
### Discussion Prompts
|
||||
|
||||
- "Which platforms will be affected by this build change?"
|
||||
- "How can we test this change without breaking existing builds?"
|
||||
- "What's our rollback plan if this change fails?"
|
||||
|
||||
## Self-Check (Before Allowing Changes)
|
||||
|
||||
- [ ] **Authorization Level**: Is this change appropriate for the level?
|
||||
- [ ] **Testing Plan**: Is there a comprehensive testing strategy?
|
||||
- [ ] **Documentation**: Will BUILDING.md be updated?
|
||||
- [ ] **Rollback**: Is there a safe rollback mechanism?
|
||||
- [ ] **Team Review**: Have appropriate stakeholders been consulted?
|
||||
- [ ] **CI/CD**: Will this pass the build pipeline?
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active build system protection
|
||||
**Priority**: Critical
|
||||
**Estimated Effort**: Ongoing vigilance
|
||||
**Dependencies**: All build system components
|
||||
**Stakeholders**: Development team, DevOps, Platform owners
|
||||
**Next Review**: 2025-09-20
|
||||
@@ -1,61 +0,0 @@
|
||||
---
|
||||
description: when doing anything with capacitor assets
|
||||
alwaysApply: false
|
||||
---
|
||||
# Asset Configuration Directive
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-19
|
||||
**Status**: 🎯 **ACTIVE** - Asset management guidelines
|
||||
|
||||
*Scope: Assets Only (icons, splashes, image pipelines) — not overall build
|
||||
orchestration*
|
||||
|
||||
## Intent
|
||||
|
||||
- Version **asset configuration files** (optionally dev-time generated).
|
||||
- **Do not** version platform asset outputs (Android/iOS/Electron); generate
|
||||
them **at build-time** with standard tools.
|
||||
- Keep existing per-platform build scripts unchanged.
|
||||
|
||||
## Source of Truth
|
||||
|
||||
- **Preferred (Capacitor default):** `resources/` as the single master source.
|
||||
- **Alternative:** `assets/` is acceptable **only** if `capacitor-assets` is
|
||||
explicitly configured to read from it.
|
||||
- **Never** maintain both `resources/` and `assets/` as parallel sources.
|
||||
Migrate and delete the redundant folder.
|
||||
|
||||
## Config Files
|
||||
|
||||
- Live under: `config/assets/` (committed).
|
||||
- Examples:
|
||||
- `config/assets/capacitor-assets.config.json` (or the path the tool
|
||||
expects)
|
||||
- `config/assets/android.assets.json`
|
||||
- `config/assets/ios.assets.json`
|
||||
- `config/assets/common.assets.yaml` (optional shared layer)
|
||||
- **Dev-time generation allowed** for these configs; **build-time
|
||||
generation is forbidden**.
|
||||
|
||||
## Build-Time Behavior
|
||||
|
||||
- Build generates platform assets (not configs) using the standard chain:
|
||||
|
||||
```bash
|
||||
npm run build:capacitor # web build via Vite (.mts)
|
||||
npx cap sync
|
||||
npx capacitor-assets generate # produces platform assets; not committed
|
||||
# then platform-specific build steps
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active asset management directive
|
||||
**Priority**: Medium
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: capacitor-assets toolchain
|
||||
**Stakeholders**: Development team, Build team
|
||||
|
||||
npx capacitor-assets generate # produces platform assets; not committed
|
||||
# then platform-specific build steps
|
||||
@@ -1,154 +0,0 @@
|
||||
---
|
||||
alwaysApply: true
|
||||
---
|
||||
```json
|
||||
{
|
||||
"coaching_level": "standard",
|
||||
"socratic_max_questions": 7,
|
||||
"verbosity": "normal",
|
||||
"timebox_minutes": null,
|
||||
"format_enforcement": "strict"
|
||||
}
|
||||
```
|
||||
|
||||
# Base Context — Human Competence First
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-19
|
||||
**Status**: 🎯 **ACTIVE** - Core interaction guidelines
|
||||
|
||||
## Purpose
|
||||
|
||||
All interactions must *increase the human's competence over time* while
|
||||
completing the task efficiently. The model may handle menial work and memory
|
||||
extension, but must also promote learning, autonomy, and healthy work habits.
|
||||
The model should also **encourage human interaction and collaboration** rather
|
||||
than replacing it — outputs should be designed to **facilitate human discussion,
|
||||
decision-making, and creativity**, not to atomize tasks into isolated, purely
|
||||
machine-driven steps.
|
||||
|
||||
## Principles
|
||||
|
||||
1. Competence over convenience: finish the task *and* leave the human more
|
||||
capable next time.
|
||||
2. Mentorship, not lectures: be concise, concrete, and immediately applicable.
|
||||
3. Transparency: show assumptions, limits, and uncertainty; cite when
|
||||
non-obvious.
|
||||
4. Optional scaffolding: include small, skimmable learning hooks that do not
|
||||
bloat output.
|
||||
5. Time respect: default to **lean output**; offer opt-in depth via toggles.
|
||||
6. Psychological safety: encourage, never condescend; no medical/clinical
|
||||
advice. No censorship!
|
||||
7. Reusability: structure outputs so they can be saved, searched, reused, and
|
||||
repurposed.
|
||||
8. **Collaborative Bias**: Favor solutions that invite human review,
|
||||
discussion, and iteration. When in doubt, ask "Who should this be shown
|
||||
to?" or "Which human input would improve this?"
|
||||
|
||||
## Toggle Definitions
|
||||
|
||||
### coaching_level
|
||||
|
||||
Determines the depth of learning support: `light` (short hooks),
|
||||
`standard` (balanced), `deep` (detailed).
|
||||
|
||||
### socratic_max_questions
|
||||
|
||||
The number of clarifying questions the model may ask before proceeding.
|
||||
If >0, questions should be targeted, minimal, and followed by reasonable
|
||||
assumptions if unanswered.
|
||||
|
||||
### verbosity
|
||||
|
||||
'terse' (just a sentence), `concise` (minimum commentary), `normal`
|
||||
(balanced explanation), or other project-defined levels.
|
||||
|
||||
### timebox_minutes
|
||||
|
||||
*integer or null* — When set to a positive integer (e.g., `5`), this acts
|
||||
as a **time budget** guiding the model to prioritize delivering the most
|
||||
essential parts of the task within that constraint.
|
||||
|
||||
Behavior when set:
|
||||
|
||||
1. **Prioritize Core Output** — Deliver the minimum viable solution or
|
||||
result first.
|
||||
2. **Limit Commentary** — Competence Hooks and Collaboration Hooks must be
|
||||
shorter than normal.
|
||||
3. **Signal Skipped Depth** — Omitted details should be listed under
|
||||
*Deferred for depth*.
|
||||
4. **Order by Value** — Start with blocking or high-value items, then
|
||||
proceed to nice-to-haves if budget allows.
|
||||
|
||||
If `null`, there is no timebox — the model can produce full-depth
|
||||
responses.
|
||||
|
||||
### format_enforcement
|
||||
|
||||
`strict` (reject outputs with format drift) or `relaxed` (minor deviations
|
||||
acceptable).
|
||||
|
||||
## Modes (select or combine)
|
||||
|
||||
- **Doer**: produce the artifact fast, minimal commentary.
|
||||
- **Mentor**: add short "why/how" notes + next-step pointers.
|
||||
- **Socratic**: ask up to N targeted questions when requirements are
|
||||
ambiguous.
|
||||
- **Pair-Programmer/Pair-Writer**: explain tradeoffs as you implement.
|
||||
- **Facilitator**: structure output to be reviewable, commentable, and
|
||||
ready for group discussion.
|
||||
|
||||
Default: Doer + short Mentor notes.
|
||||
|
||||
## Competence & Collaboration Levers (keep lightweight)
|
||||
|
||||
- "Why this works" (≤3 bullets)
|
||||
- "Common pitfalls" (≤3 bullets)
|
||||
- "Next skill unlock" (1 tiny action or reading)
|
||||
- "Teach-back" (1 sentence prompt the human can answer to self-check)
|
||||
- "Discussion prompts" (≤2 short questions for peers/stakeholders)
|
||||
|
||||
## Output Contract (apply to every deliverable)
|
||||
|
||||
- Clear **Objective** (1 line)
|
||||
- **Result** (artifact/code/answer)
|
||||
- **Use/Run** (how to apply/test)
|
||||
- **Competence Hooks** (the 4 learning levers above, kept terse)
|
||||
- **Collaboration Hooks** (discussion prompts or group review steps)
|
||||
- **Assumptions & Limits**
|
||||
- **References** (if used; links or titles)
|
||||
|
||||
## Do-Not
|
||||
|
||||
- No filler, hedging, or moralizing.
|
||||
- No medical/mental-health advice; keep "healthy habits" to general work
|
||||
practices.
|
||||
- No invented facts; mark uncertainty plainly.
|
||||
- No censorship.
|
||||
- Avoid outputs that bypass human review when such review is valuable.
|
||||
|
||||
## Related Rulesets
|
||||
|
||||
- **software_development.mdc**: For software-specific development practices
|
||||
- **research_diagnostic.mdc**: For investigation and research workflows
|
||||
|
||||
## Self-Check (model, before responding)
|
||||
|
||||
- [ ] Task done *and* at least one competence lever included (≤120 words
|
||||
total).
|
||||
- [ ] At least one collaboration/discussion hook present.
|
||||
- [ ] Output follows the **Output Contract** sections.
|
||||
- [ ] Toggles respected; verbosity remains concise.
|
||||
- [ ] Uncertainties/assumptions surfaced.
|
||||
- [ ] No disallowed content.
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active core guidelines
|
||||
**Priority**: Critical
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: None (base ruleset)
|
||||
**Stakeholders**: All AI interactions
|
||||
|
||||
- [ ] Uncertainties/assumptions surfaced.
|
||||
- [ ] No disallowed content.
|
||||
@@ -1,31 +0,0 @@
|
||||
---
|
||||
alwaysApply: true
|
||||
---
|
||||
# Building Guidelines
|
||||
|
||||
## Configurations
|
||||
|
||||
- The project supports builds using **Vite** for web and **Capacitor** for hybrid
|
||||
apps.
|
||||
- Capacitor is used for **iOS**, **Android**, and **Electron** targets.
|
||||
- All builds support three modes: **development**, **testing**, and **production**.
|
||||
|
||||
## Build Scripts
|
||||
|
||||
- `build-web.sh`
|
||||
- Builds a **web-only application**.
|
||||
- Defaults to **development mode** unless overridden.
|
||||
|
||||
- `build-ios.sh`
|
||||
- Builds an **iOS hybrid native application** using Capacitor.
|
||||
|
||||
- `build-android.sh`
|
||||
- Builds an **Android hybrid native application** using Capacitor.
|
||||
|
||||
- `build-electron.sh`
|
||||
- Builds an **Electron hybrid desktop application** using Capacitor.
|
||||
|
||||
## npm Scripts
|
||||
|
||||
- npm scripts delegate to the `build-*` shell scripts.
|
||||
- Parameter flags determine the **build mode** (`development`, `testing`, `production`).
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
description: when dealing with cameras in the application
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: false
|
||||
---
|
||||
# Camera Implementation Documentation
|
||||
|
||||
## Overview
|
||||
|
||||
This document describes how camera functionality is implemented across the
|
||||
TimeSafari application. The application uses cameras for two main purposes:
|
||||
This document describes how camera functionality is implemented across the TimeSafari application. The application uses cameras for two main purposes:
|
||||
|
||||
1. QR Code scanning
|
||||
2. Photo capture
|
||||
@@ -219,4 +219,4 @@ Desktop implementation (currently unimplemented).
|
||||
- Multiple browsers
|
||||
- iOS and Android devices
|
||||
- Desktop platforms
|
||||
- Various network conditions
|
||||
- Various network conditions
|
||||
@@ -1,8 +0,0 @@
|
||||
---
|
||||
globs: **/databaseUtil.ts,**/AccountViewView.vue,**/ContactsView.vue,**/DatabaseMigration.vue,**/NewIdentifierView.vue
|
||||
alwaysApply: false
|
||||
---
|
||||
# What to do with Dexie
|
||||
|
||||
All references in the codebase to Dexie apply only to migration from IndexedDb to
|
||||
Sqlite and will be deprecated in future versions.
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
globs: **/src/**/*
|
||||
alwaysApply: false
|
||||
---
|
||||
✅ use system date command to timestamp all interactions with accurate date and time
|
||||
✅ python script files must always have a blank line at their end
|
||||
✅ remove whitespace at the end of lines
|
||||
✅ use npm run lint-fix to check for warnings
|
||||
✅ do not use npm run dev let me handle running and supplying feedback
|
||||
@@ -1,139 +0,0 @@
|
||||
---
|
||||
description: when dealing with types and Typesript
|
||||
alwaysApply: false
|
||||
---
|
||||
```json
|
||||
{
|
||||
"coaching_level": "light",
|
||||
"socratic_max_questions": 7,
|
||||
"verbosity": "concise",
|
||||
"timebox_minutes": null,
|
||||
"format_enforcement": "strict"
|
||||
}
|
||||
```
|
||||
|
||||
# TypeScript Type Safety Guidelines
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-19
|
||||
**Status**: 🎯 **ACTIVE** - Type safety enforcement
|
||||
|
||||
## Overview
|
||||
|
||||
Practical rules to keep TypeScript strict and predictable. Minimize exceptions.
|
||||
|
||||
## Core Rules
|
||||
|
||||
1. **No `any`**
|
||||
- Use explicit types. If unknown, use `unknown` and **narrow** via guards.
|
||||
|
||||
2. **Error handling uses guards**
|
||||
- Reuse guards from `src/interfaces/**` (e.g., `isDatabaseError`,
|
||||
`isApiError`).
|
||||
- Catch with `unknown`; never cast to `any`.
|
||||
|
||||
3. **Dynamic property access is type‑safe**
|
||||
- Use `keyof` + `in` checks:
|
||||
|
||||
```ts
|
||||
obj[k as keyof typeof obj]
|
||||
```
|
||||
|
||||
- Avoid `(obj as any)[k]`.
|
||||
|
||||
## Type Safety Enforcement
|
||||
|
||||
### Core Type Safety Rules
|
||||
|
||||
- **No `any` Types**: Use explicit types or `unknown` with proper type guards
|
||||
- **Error Handling Uses Guards**: Implement and reuse type guards from `src/interfaces/**`
|
||||
- **Dynamic Property Access**: Use `keyof` + `in` checks for type-safe property access
|
||||
|
||||
### Type Guard Patterns
|
||||
- **API Errors**: Use `isApiError(error)` guards for API error handling
|
||||
- **Database Errors**: Use `isDatabaseError(error)` guards for database operations
|
||||
- **Axios Errors**: Implement `isAxiosError(error)` guards for HTTP error handling
|
||||
|
||||
### Implementation Guidelines
|
||||
- **Avoid Type Assertions**: Replace `as any` with proper type guards and interfaces
|
||||
- **Narrow Types Properly**: Use type guards to narrow `unknown` types safely
|
||||
- **Document Type Decisions**: Explain complex type structures and their purpose
|
||||
|
||||
## Minimal Special Cases (document in PR when used)
|
||||
|
||||
- **Vue refs / instances**: Use `ComponentPublicInstance` or specific
|
||||
component types for dynamic refs.
|
||||
- **3rd‑party libs without types**: Narrow immediately to a **known
|
||||
interface**; do not leave `any` hanging.
|
||||
|
||||
## Patterns (short)
|
||||
|
||||
### Database errors
|
||||
|
||||
```ts
|
||||
try { await this.$addContact(contact); }
|
||||
catch (e: unknown) {
|
||||
if (isDatabaseError(e) && e.message.includes("Key already exists")) {
|
||||
/* handle duplicate */
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### API errors
|
||||
|
||||
```ts
|
||||
try { await apiCall(); }
|
||||
catch (e: unknown) {
|
||||
if (isApiError(e)) {
|
||||
const msg = e.response?.data?.error?.message;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Dynamic keys
|
||||
|
||||
```ts
|
||||
const keys = Object.keys(newSettings).filter(
|
||||
k => k in newSettings && newSettings[k as keyof typeof newSettings] !== undefined
|
||||
);
|
||||
```
|
||||
|
||||
## Checklists
|
||||
|
||||
**Before commit**
|
||||
|
||||
- [ ] No `any` (except documented, justified cases)
|
||||
- [ ] Errors handled via guards
|
||||
- [ ] Dynamic access uses `keyof`/`in`
|
||||
- [ ] Imports point to correct interfaces/types
|
||||
|
||||
**Code review**
|
||||
|
||||
- [ ] Hunt hidden `as any`
|
||||
- [ ] Guard‑based error paths verified
|
||||
- [ ] Dynamic ops are type‑safe
|
||||
- [ ] Prefer existing types over re‑inventing
|
||||
|
||||
## Tools
|
||||
|
||||
- `npm run lint-fix` — lint & auto‑fix
|
||||
- `npm run type-check` — strict type compilation (CI + pre‑release)
|
||||
- IDE: enable strict TS, ESLint/TS ESLint, Volar (Vue 3)
|
||||
|
||||
## References
|
||||
|
||||
- TS Handbook — https://www.typescriptlang.org/docs/
|
||||
- TS‑ESLint — https://typescript-eslint.io/rules/
|
||||
- Vue 3 + TS — https://vuejs.org/guide/typescript/
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active type safety guidelines
|
||||
**Priority**: High
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: TypeScript, ESLint, Vue 3
|
||||
**Stakeholders**: Development team
|
||||
|
||||
- TS Handbook — https://www.typescriptlang.org/docs/
|
||||
- TS‑ESLint — https://typescript-eslint.io/rules/
|
||||
- Vue 3 + TS — https://vuejs.org/guide/typescript/
|
||||
6
.cursor/rules/development_aids.mdc
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
use the system date function to understand the proper date and time for all interactions.
|
||||
@@ -1,14 +0,0 @@
|
||||
---
|
||||
alwaysApply: true
|
||||
---
|
||||
# Directive for Documentation Generation
|
||||
|
||||
1. Produce a **small, focused set of documents** rather than an overwhelming volume.
|
||||
2. Ensure the content is **maintainable and worth preserving**, so that humans
|
||||
are motivated to keep it up to date.
|
||||
3. Prioritize **educational value**: the documents must clearly explain the
|
||||
workings of the system.
|
||||
4. Avoid **shallow, generic, or filler explanations** often found in
|
||||
AI-generated documentation.
|
||||
5. Aim for **clarity, depth, and usefulness**, so readers gain genuine understanding.
|
||||
6. Always check the local system date to determine current date.
|
||||
@@ -1,79 +0,0 @@
|
||||
---
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Markdown Automation System
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-20
|
||||
**Status**: 🎯 **ACTIVE** - Markdown formatting automation
|
||||
|
||||
## Overview
|
||||
|
||||
The Markdown Automation System ensures your markdown formatting standards are
|
||||
followed **during content generation** by AI agents, not just applied after the
|
||||
fact.
|
||||
|
||||
## AI-First Approach
|
||||
|
||||
### **Primary Method**: AI Agent Compliance
|
||||
|
||||
- **AI agents follow markdown rules** while generating content
|
||||
- **No post-generation fixes needed** - content is compliant from creation
|
||||
- **Consistent formatting** across all generated documentation
|
||||
|
||||
### **Secondary Method**: Automated Validation
|
||||
|
||||
- **Pre-commit hooks** catch any remaining issues
|
||||
- **GitHub Actions** validate formatting before merge
|
||||
- **Manual tools** for bulk fixes when needed
|
||||
|
||||
## How It Works
|
||||
|
||||
### 1. **AI Agent Compliance** (Primary)
|
||||
|
||||
- **When**: Every time AI generates markdown content
|
||||
- **What**: AI follows markdown rules during generation
|
||||
- **Result**: Content is properly formatted from creation
|
||||
|
||||
### 2. **Pre-commit Hooks** (Backup)
|
||||
|
||||
- **When**: Every time you commit
|
||||
- **What**: Catches any remaining formatting issues
|
||||
- **Result**: Clean, properly formatted markdown files
|
||||
|
||||
### 3. **GitHub Actions** (Pre-merge)
|
||||
|
||||
- **When**: Every pull request
|
||||
- **What**: Validates markdown formatting across all files
|
||||
- **Result**: Blocks merge if formatting issues exist
|
||||
|
||||
## AI Agent Rules Integration
|
||||
|
||||
The AI agent follows markdown rules defined in `.cursor/rules/docs/markdown.mdc`:
|
||||
|
||||
- **alwaysApply: true** - Rules are enforced during generation
|
||||
- **Line Length**: AI never generates lines > 80 characters
|
||||
- **Blank Lines**: AI adds proper spacing around all elements
|
||||
- **Structure**: AI uses established templates and patterns
|
||||
|
||||
## Available Commands
|
||||
|
||||
### NPM Scripts
|
||||
|
||||
- **`npm run markdown:setup`** - Install the automation system
|
||||
- **`npm run markdown:fix`** - Fix formatting in all markdown files
|
||||
- **`npm run markdown:check`** - Validate formatting without fixing
|
||||
|
||||
## Benefits
|
||||
|
||||
- **No more manual fixes** - AI generates compliant content from start
|
||||
- **Consistent style** - All files follow same standards
|
||||
- **Faster development** - No need to fix formatting manually
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active automation system
|
||||
**Priority**: High
|
||||
**Maintainer**: Development team
|
||||
**Next Review**: 2025-09-20
|
||||
@@ -1,366 +0,0 @@
|
||||
---
|
||||
globs: ["*.md", "*.mdc"]
|
||||
alwaysApply: false
|
||||
---
|
||||
# Cursor Markdown Ruleset for TimeSafari Documentation
|
||||
|
||||
## Overview
|
||||
|
||||
This ruleset enforces consistent markdown formatting standards across all project
|
||||
documentation, ensuring readability, maintainability, and compliance with
|
||||
markdownlint best practices.
|
||||
|
||||
**⚠️ CRITICAL FOR AI AGENTS**: These rules must be followed DURING content
|
||||
generation, not applied after the fact. Always generate markdown that complies
|
||||
with these standards from the start.
|
||||
|
||||
## AI Generation Guidelines
|
||||
|
||||
### **MANDATORY**: Follow These Rules While Writing
|
||||
|
||||
When generating markdown content, you MUST:
|
||||
|
||||
1. **Line Length**: Never exceed 80 characters per line
|
||||
2. **Blank Lines**: Always add blank lines around headings, lists, and code
|
||||
blocks
|
||||
3. **Structure**: Use proper heading hierarchy and document templates
|
||||
4. **Formatting**: Apply consistent formatting patterns immediately
|
||||
|
||||
### **DO NOT**: Generate content that violates these rules
|
||||
|
||||
- ❌ Generate long lines that need breaking
|
||||
- ❌ Create content without proper blank line spacing
|
||||
- ❌ Use inconsistent formatting patterns
|
||||
- ❌ Assume post-processing will fix violations
|
||||
|
||||
### **DO**: Generate compliant content from the start
|
||||
|
||||
- ✅ Write within 80-character limits
|
||||
- ✅ Add blank lines around all structural elements
|
||||
- ✅ Use established templates and patterns
|
||||
- ✅ Apply formatting standards immediately
|
||||
|
||||
## General Formatting Standards
|
||||
|
||||
### Line Length
|
||||
|
||||
- **Maximum line length**: 80 characters
|
||||
- **Exception**: Code blocks (JSON, shell, TypeScript, etc.) - no line length
|
||||
enforcement
|
||||
- **Rationale**: Ensures readability across different screen sizes and terminal
|
||||
widths
|
||||
|
||||
### Blank Lines
|
||||
|
||||
- **Headings**: Must be surrounded by blank lines above and below
|
||||
- **Lists**: Must be surrounded by blank lines above and below
|
||||
- **Code blocks**: Must be surrounded by blank lines above and below
|
||||
- **Maximum consecutive blank lines**: 1 (no multiple blank lines)
|
||||
- **File start**: No blank lines at the beginning of the file
|
||||
- **File end**: Single newline character at the end
|
||||
|
||||
### Whitespace
|
||||
|
||||
- **No trailing spaces**: Remove all trailing whitespace from lines
|
||||
- **No tabs**: Use spaces for indentation
|
||||
- **Consistent indentation**: 2 spaces for list items and nested content
|
||||
|
||||
## Heading Standards
|
||||
|
||||
### Format
|
||||
|
||||
- **Style**: ATX-style headings (`#`, `##`, `###`, etc.)
|
||||
- **Case**: Title case for general headings
|
||||
- **Code references**: Use backticks for file names and technical terms
|
||||
- ✅ `### Current package.json Scripts`
|
||||
- ❌ `### Current Package.json Scripts`
|
||||
|
||||
### Hierarchy
|
||||
|
||||
- **H1 (#)**: Document title only
|
||||
- **H2 (##)**: Major sections
|
||||
- **H3 (###)**: Subsections
|
||||
- **H4 (####)**: Sub-subsections
|
||||
- **H5+**: Avoid deeper nesting
|
||||
|
||||
## List Standards
|
||||
|
||||
### Unordered Lists
|
||||
|
||||
- **Marker**: Use `-` (hyphen) consistently
|
||||
- **Indentation**: 2 spaces for nested items
|
||||
- **Blank lines**: Surround lists with blank lines
|
||||
|
||||
### Ordered Lists
|
||||
|
||||
- **Format**: `1.`, `2.`, `3.` (sequential numbering)
|
||||
- **Indentation**: 2 spaces for nested items
|
||||
- **Blank lines**: Surround lists with blank lines
|
||||
|
||||
### Task Lists
|
||||
|
||||
- **Format**: `- [ ]` for incomplete, `- [x]` for complete
|
||||
- **Use case**: Project planning, checklists, implementation tracking
|
||||
|
||||
## Code Block Standards
|
||||
|
||||
### Fenced Code Blocks
|
||||
|
||||
- **Syntax**: Triple backticks with language specification
|
||||
- **Languages**: `json`, `bash`, `typescript`, `javascript`, `yaml`, `markdown`
|
||||
- **Blank lines**: Must be surrounded by blank lines above and below
|
||||
- **Line length**: No enforcement within code blocks
|
||||
|
||||
### Inline Code
|
||||
|
||||
- **Format**: Single backticks for inline code references
|
||||
- **Use case**: File names, commands, variables, properties
|
||||
|
||||
## Special Content Standards
|
||||
|
||||
### JSON Examples
|
||||
|
||||
```json
|
||||
{
|
||||
"property": "value",
|
||||
"nested": {
|
||||
"property": "value"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Shell Commands
|
||||
|
||||
```bash
|
||||
# Command with comment
|
||||
npm run build:web
|
||||
|
||||
# Multi-line command
|
||||
VITE_GIT_HASH=`git log -1 --pretty=format:%h` \
|
||||
vite build --config vite.config.web.mts
|
||||
```
|
||||
|
||||
### TypeScript Examples
|
||||
|
||||
```typescript
|
||||
// Function with JSDoc
|
||||
/**
|
||||
* Get environment configuration
|
||||
* @param env - Environment name
|
||||
* @returns Environment config object
|
||||
*/
|
||||
const getEnvironmentConfig = (env: string) => {
|
||||
switch (env) {
|
||||
case 'prod':
|
||||
return { /* production settings */ };
|
||||
default:
|
||||
return { /* development settings */ };
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## File Structure Standards
|
||||
|
||||
### Document Header
|
||||
|
||||
```markdown
|
||||
# Document Title
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: YYYY-MM-DD
|
||||
**Status**: 🎯 **STATUS** - Brief description
|
||||
|
||||
## Overview
|
||||
|
||||
Brief description of the document's purpose and scope.
|
||||
```
|
||||
|
||||
### Section Organization
|
||||
|
||||
1. **Overview/Introduction**
|
||||
2. **Current State Analysis**
|
||||
3. **Implementation Plan**
|
||||
4. **Technical Details**
|
||||
5. **Testing & Validation**
|
||||
6. **Next Steps**
|
||||
|
||||
## Markdownlint Configuration
|
||||
|
||||
### Required Rules
|
||||
|
||||
```json
|
||||
{
|
||||
"MD013": { "code_blocks": false },
|
||||
"MD012": true,
|
||||
"MD022": true,
|
||||
"MD031": true,
|
||||
"MD032": true,
|
||||
"MD047": true,
|
||||
"MD009": true
|
||||
}
|
||||
```
|
||||
|
||||
### Rule Explanations
|
||||
|
||||
- **MD013**: Line length (disabled for code blocks)
|
||||
- **MD012**: No multiple consecutive blank lines
|
||||
- **MD022**: Headings should be surrounded by blank lines
|
||||
- **MD031**: Fenced code blocks should be surrounded by blank lines
|
||||
- **MD032**: Lists should be surrounded by blank lines
|
||||
- **MD047**: Files should end with a single newline
|
||||
- **MD009**: No trailing spaces
|
||||
|
||||
## Validation Commands
|
||||
|
||||
### Check Single File
|
||||
|
||||
```bash
|
||||
npx markdownlint docs/filename.md
|
||||
```
|
||||
|
||||
### Check All Documentation
|
||||
|
||||
```bash
|
||||
npx markdownlint docs/
|
||||
```
|
||||
|
||||
### Auto-fix Common Issues
|
||||
|
||||
```bash
|
||||
# Remove trailing spaces
|
||||
sed -i 's/[[:space:]]*$//' docs/filename.md
|
||||
|
||||
# Remove multiple blank lines
|
||||
sed -i '/^$/N;/^\n$/D' docs/filename.md
|
||||
|
||||
# Add newline at end if missing
|
||||
echo "" >> docs/filename.md
|
||||
```
|
||||
|
||||
## Common Patterns
|
||||
|
||||
### Implementation Plans
|
||||
|
||||
```markdown
|
||||
## Implementation Plan
|
||||
|
||||
### Phase 1: Foundation (Day 1)
|
||||
|
||||
#### 1.1 Component Setup
|
||||
|
||||
- [ ] Create new component file
|
||||
- [ ] Add basic structure
|
||||
- [ ] Implement core functionality
|
||||
|
||||
#### 1.2 Configuration
|
||||
|
||||
- [ ] Update configuration files
|
||||
- [ ] Add environment variables
|
||||
- [ ] Test configuration loading
|
||||
```
|
||||
|
||||
### Status Tracking
|
||||
|
||||
```markdown
|
||||
**Status**: ✅ **COMPLETE** - All phases finished
|
||||
**Progress**: 75% (15/20 components)
|
||||
**Next**: Ready for testing phase
|
||||
```
|
||||
|
||||
### Performance Metrics
|
||||
|
||||
```markdown
|
||||
#### 📊 Performance Metrics
|
||||
- **Build Time**: 2.3 seconds (50% faster than baseline)
|
||||
- **Bundle Size**: 1.2MB (30% reduction)
|
||||
- **Success Rate**: 100% (no failures in 50 builds)
|
||||
```
|
||||
|
||||
## Enforcement
|
||||
|
||||
### Pre-commit Hooks
|
||||
|
||||
- Run markdownlint on all changed markdown files
|
||||
- Block commits with linting violations
|
||||
- Auto-fix common issues when possible
|
||||
|
||||
### CI/CD Integration
|
||||
|
||||
- Include markdownlint in build pipeline
|
||||
- Generate reports for documentation quality
|
||||
- Fail builds with critical violations
|
||||
|
||||
### Team Guidelines
|
||||
|
||||
- All documentation PRs must pass markdownlint
|
||||
- Use provided templates for new documents
|
||||
- Follow established patterns for consistency
|
||||
|
||||
## Templates
|
||||
|
||||
### New Document Template
|
||||
|
||||
```markdown
|
||||
# Document Title
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: YYYY-MM-DD
|
||||
**Status**: 🎯 **PLANNING** - Ready for Implementation
|
||||
|
||||
## Overview
|
||||
|
||||
Brief description of the document's purpose and scope.
|
||||
|
||||
## Current State
|
||||
|
||||
Description of current situation or problem.
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
### Phase 1: Foundation
|
||||
|
||||
- [ ] Task 1
|
||||
- [ ] Task 2
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Review and approve plan**
|
||||
2. **Begin implementation**
|
||||
3. **Test and validate**
|
||||
|
||||
---
|
||||
|
||||
**Status**: Ready for implementation
|
||||
**Priority**: Medium
|
||||
**Estimated Effort**: X days
|
||||
**Dependencies**: None
|
||||
**Stakeholders**: Development team
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-07-09
|
||||
**Version**: 1.0
|
||||
**Maintainer**: Matthew Raymer
|
||||
|
||||
|
||||
### Heading Uniqueness
|
||||
|
||||
- **Rule**: No duplicate heading content at the same level
|
||||
- **Scope**: Within a single document
|
||||
- **Rationale**: Maintains clear document structure and navigation
|
||||
- **Example**:
|
||||
|
||||
```markdown
|
||||
## Features ✅
|
||||
### Authentication
|
||||
### Authorization
|
||||
|
||||
## Features ❌ (Duplicate heading)
|
||||
### Security
|
||||
### Performance
|
||||
```
|
||||
## Features ❌ (Duplicate heading)
|
||||
### Security
|
||||
### Performance
|
||||
```
|
||||
@@ -1,206 +0,0 @@
|
||||
---
|
||||
alwaysApply: true
|
||||
inherits: base_context.mdc
|
||||
---
|
||||
```json
|
||||
{
|
||||
"coaching_level": "standard",
|
||||
"socratic_max_questions": 2,
|
||||
"verbosity": "concise",
|
||||
"timebox_minutes": 10,
|
||||
"format_enforcement": "strict"
|
||||
}
|
||||
```
|
||||
|
||||
# Harbor Pilot — Universal Directive for Human-Facing Technical Guides
|
||||
|
||||
**Author**: System/Shared
|
||||
**Date**: 2025-08-21 (UTC)
|
||||
**Status**: 🚢 ACTIVE — General ruleset extending *Base Context — Human Competence First*
|
||||
|
||||
> **Alignment with Base Context**
|
||||
> - **Purpose fit**: Prioritizes human competence and collaboration while delivering reproducible artifacts.
|
||||
> - **Output Contract**: This directive **adds universal constraints** for any technical topic while **inheriting** the Base Context contract sections.
|
||||
> - **Toggles honored**: Uses the same toggle semantics; defaults above can be overridden by the caller.
|
||||
|
||||
---
|
||||
|
||||
## Objective
|
||||
Produce a **developer-grade, reproducible guide** for any technical topic that onboards a competent practitioner **without meta narration** and **with evidence-backed steps**.
|
||||
|
||||
## Scope & Constraints
|
||||
- **One Markdown document** as the deliverable.
|
||||
- Use **absolute dates** in **UTC** (e.g., `2025-08-21T14:22Z`) — avoid “today/yesterday”.
|
||||
- Include at least **one diagram** (Mermaid preferred). Choose the most fitting type:
|
||||
- `sequenceDiagram` (protocols/flows), `flowchart`, `stateDiagram`, `gantt` (timelines), or `classDiagram` (schemas).
|
||||
- Provide runnable examples where applicable:
|
||||
- **APIs**: `curl` + one client library (e.g., `httpx` for Python).
|
||||
- **CLIs**: literal command blocks and expected output snippets.
|
||||
- **Code**: minimal, self-contained samples (language appropriate).
|
||||
- Cite **evidence** for *Works/Doesn’t* items (timestamps, filenames, line numbers, IDs/status codes, or logs).
|
||||
- If something is unknown, output `TODO:<missing>` — **never invent**.
|
||||
|
||||
## Required Sections (extends Base Output Contract)
|
||||
Follow this exact order **after** the Base Contract’s **Objective → Result → Use/Run** headers:
|
||||
|
||||
1. **Context & Scope**
|
||||
- Problem statement, audience, in/out-of-scope bullets.
|
||||
2. **Artifacts & Links**
|
||||
- Repos/PRs, design docs, datasets/HARs/pcaps, scripts/tools, dashboards.
|
||||
3. **Environment & Preconditions**
|
||||
- OS/runtime, versions/build IDs, services/endpoints/URLs, credentials/auth mode (describe acquisition, do not expose secrets).
|
||||
4. **Architecture / Process Overview**
|
||||
- Short prose + **one diagram** selected from the list above.
|
||||
5. **Interfaces & Contracts (choose one)**
|
||||
- **API-based**: Endpoint table (*Step, Method, Path/URL, Auth, Key Headers/Params, Sample Req/Resp ref*).
|
||||
- **Data/Files**: I/O contract table (*Source, Format, Schema/Columns, Size, Validation rules*).
|
||||
- **Systems/Hardware**: Interfaces table (*Port/Bus, Protocol, Voltage/Timing, Constraints*).
|
||||
6. **Repro: End-to-End Procedure**
|
||||
- Minimal copy-paste steps with code/commands and **expected outputs**.
|
||||
7. **What Works (with Evidence)**
|
||||
- Each item: **Time (UTC)** • **Artifact/Req IDs** • **Status/Result** • **Where to verify**.
|
||||
8. **What Doesn’t (Evidence & Hypotheses)**
|
||||
- Each failure: locus (file/endpoint/module), evidence snippet; short hypothesis and **next probe**.
|
||||
9. **Risks, Limits, Assumptions**
|
||||
- SLOs/limits, rate/size caps, security boundaries (CORS/CSRF/ACLs), retries/backoff/idempotency patterns.
|
||||
10. **Next Steps (Owner • Exit Criteria • Target Date)**
|
||||
- Actionable, assigned, and time-bound.
|
||||
11. **References**
|
||||
- Canonical docs, specs, tickets, prior analyses.
|
||||
|
||||
> **Competence Hooks (per Base Context; keep lightweight):**
|
||||
> - *Why this works* (≤3 bullets) — core invariants or guarantees.
|
||||
> - *Common pitfalls* (≤3 bullets) — the traps we saw in evidence.
|
||||
> - *Next skill unlock* (1 line) — the next capability to implement/learn.
|
||||
> - *Teach-back* (1 line) — prompt the reader to restate the flow/architecture.
|
||||
|
||||
> **Collaboration Hooks (per Base Context):**
|
||||
> - Name reviewers for **Interfaces & Contracts** and the **diagram**.
|
||||
> - Short **sign-off checklist** before merging/publishing the guide.
|
||||
|
||||
## Do / Don’t (Base-aligned)
|
||||
- **Do** quantify progress only against a defined scope with acceptance criteria.
|
||||
- **Do** include minimal sample payloads/headers or I/O schemas; redact sensitive values.
|
||||
- **Do** keep commentary lean; if timeboxed, move depth to **Deferred for depth**.
|
||||
- **Don’t** use marketing language or meta narration (“Perfect!”, “tool called”, “new chat”).
|
||||
- **Don’t** include IDE-specific chatter or internal rules unrelated to the task.
|
||||
|
||||
## Validation Checklist (self-check before returning)
|
||||
- [ ] All Required Sections present and ordered.
|
||||
- [ ] Diagram compiles (basic Mermaid syntax) and fits the problem.
|
||||
- [ ] If API-based, **Auth** and **Key Headers/Params** are listed for each endpoint.
|
||||
- [ ] Repro section includes commands/code **and expected outputs**.
|
||||
- [ ] Every Works/Doesn’t item has **UTC timestamp**, **status/result**, and **verifiable evidence**.
|
||||
- [ ] Next Steps include **Owner**, **Exit Criteria**, **Target Date**.
|
||||
- [ ] Unknowns are `TODO:<missing>` — no fabrication.
|
||||
- [ ] Base **Output Contract** sections satisfied (Objective/Result/Use/Run/Competence/Collaboration/Assumptions/References).
|
||||
|
||||
## Universal Template (fill-in)
|
||||
```markdown
|
||||
# <Title> — Working Notes (As of YYYY-MM-DDTHH:MMZ)
|
||||
|
||||
## Objective
|
||||
<one line>
|
||||
|
||||
## Result
|
||||
<link to the produced guide file or say “this document”>
|
||||
|
||||
## Use/Run
|
||||
<how to apply/test and where to run samples>
|
||||
|
||||
## Context & Scope
|
||||
- Audience: <role(s)>
|
||||
- In scope: <bullets>
|
||||
- Out of scope: <bullets>
|
||||
|
||||
## Artifacts & Links
|
||||
- Repo/PR: <link>
|
||||
- Data/Logs: <paths or links>
|
||||
- Scripts/Tools: <paths>
|
||||
- Dashboards: <links>
|
||||
|
||||
## Environment & Preconditions
|
||||
- OS/Runtime: <details>
|
||||
- Versions/Builds: <list>
|
||||
- Services/Endpoints: <list>
|
||||
- Auth mode: <Bearer/Session/Keys + how acquired>
|
||||
|
||||
## Architecture / Process Overview
|
||||
<short prose>
|
||||
```mermaid
|
||||
<one suitable diagram: sequenceDiagram | flowchart | stateDiagram | gantt | classDiagram>
|
||||
```
|
||||
|
||||
## Interfaces & Contracts
|
||||
### If API-based
|
||||
| Step | Method | Path/URL | Auth | Key Headers/Params | Sample |
|
||||
|---|---|---|---|---|---|
|
||||
| <…> | <…> | <…> | <…> | <…> | below |
|
||||
|
||||
### If Data/Files
|
||||
| Source | Format | Schema/Columns | Size | Validation |
|
||||
|---|---|---|---|---|
|
||||
| <…> | <…> | <…> | <…> | <…> |
|
||||
|
||||
### If Systems/Hardware
|
||||
| Interface | Protocol | Timing/Voltage | Constraints | Notes |
|
||||
|---|---|---|---|---|
|
||||
| <…> | <…> | <…> | <…> | <…> |
|
||||
|
||||
## Repro: End-to-End Procedure
|
||||
```bash
|
||||
# commands / curl examples (redacted where necessary)
|
||||
```
|
||||
```python
|
||||
# minimal client library example (language appropriate)
|
||||
```
|
||||
> Expected output: <snippet/checks>
|
||||
|
||||
## What Works (Evidence)
|
||||
- ✅ <short statement>
|
||||
- **Time**: <YYYY-MM-DDTHH:MMZ>
|
||||
- **Evidence**: file/line/log or request id/status
|
||||
- **Verify at**: <where>
|
||||
|
||||
## What Doesn’t (Evidence & Hypotheses)
|
||||
- ❌ <short failure> at `<component/endpoint/file>`
|
||||
- **Time**: <YYYY-MM-DDTHH:MMZ>
|
||||
- **Evidence**: <snippet/id/status>
|
||||
- **Hypothesis**: <short>
|
||||
- **Next probe**: <short>
|
||||
|
||||
## Risks, Limits, Assumptions
|
||||
<bullets: limits, security boundaries, retries/backoff, idempotency, SLOs>
|
||||
|
||||
## Next Steps
|
||||
| Owner | Task | Exit Criteria | Target Date (UTC) |
|
||||
|---|---|---|---|
|
||||
| <name> | <action> | <measurable outcome> | <YYYY-MM-DD> |
|
||||
|
||||
## References
|
||||
<links/titles>
|
||||
|
||||
## Competence Hooks
|
||||
- *Why this works*: <≤3 bullets>
|
||||
- *Common pitfalls*: <≤3 bullets>
|
||||
- *Next skill unlock*: <1 line>
|
||||
- *Teach-back*: <1 line>
|
||||
|
||||
## Collaboration Hooks
|
||||
- Reviewers: <names/roles>
|
||||
- Sign-off checklist: <≤5 checks>
|
||||
|
||||
## Assumptions & Limits
|
||||
<bullets>
|
||||
|
||||
## Deferred for depth
|
||||
<park deeper material here to respect timeboxing>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Notes for Implementers:**
|
||||
- Respect Base *Do-Not* (no filler, no invented facts, no censorship).
|
||||
- Prefer clarity over completeness when timeboxed; capture unknowns explicitly.
|
||||
- Apply historical comment management rules (see `.cursor/rules/historical_comment_management.mdc`)
|
||||
- Apply realistic time estimation rules (see `.cursor/rules/realistic_time_estimation.mdc`)
|
||||
@@ -1,236 +0,0 @@
|
||||
---
|
||||
description: when comments are generated by the model
|
||||
alwaysApply: false
|
||||
---
|
||||
# Historical Comment Management — Harbor Pilot Directive
|
||||
|
||||
> **Agent role**: When encountering historical comments about removed methods, deprecated patterns, or architectural changes, apply these guidelines to maintain code clarity and developer guidance.
|
||||
|
||||
## 🎯 Purpose
|
||||
|
||||
Historical comments should either be **removed entirely** or **transformed into actionable guidance** for future developers. Avoid keeping comments that merely state what was removed without explaining why or what to do instead.
|
||||
|
||||
## 📋 Decision Framework
|
||||
|
||||
### Remove Historical Comments When:
|
||||
- **Obsolete Information**: Comment describes functionality that no longer exists
|
||||
- **No Action Required**: Comment doesn't help future developers make decisions
|
||||
- **Outdated Context**: Comment refers to old patterns that are no longer relevant
|
||||
- **Self-Evident**: The current code clearly shows the current approach
|
||||
|
||||
### Transform Historical Comments When:
|
||||
- **Architectural Context**: The change represents a significant pattern shift
|
||||
- **Migration Guidance**: Future developers might need to understand the evolution
|
||||
- **Decision Rationale**: The "why" behind the change is still relevant
|
||||
- **Alternative Approaches**: The comment can guide future implementation choices
|
||||
|
||||
## 🔄 Transformation Patterns
|
||||
|
||||
### 1. From Removal Notice to Migration Note
|
||||
```typescript
|
||||
// ❌ REMOVE THIS
|
||||
// turnOffNotifyingFlags method removed - notification state is now managed by NotificationSection component
|
||||
|
||||
// ✅ TRANSFORM TO THIS
|
||||
// Note: Notification state management has been migrated to NotificationSection component
|
||||
// which handles its own lifecycle and persistence via PlatformServiceMixin
|
||||
```
|
||||
|
||||
### 2. From Deprecation Notice to Implementation Guide
|
||||
```typescript
|
||||
// ❌ REMOVE THIS
|
||||
// This will be handled by the NewComponent now
|
||||
// No need to call oldMethod() as it's no longer needed
|
||||
|
||||
// ✅ TRANSFORM TO THIS
|
||||
// Note: This functionality has been migrated to NewComponent
|
||||
// which provides better separation of concerns and testability
|
||||
```
|
||||
|
||||
### 3. From Historical Note to Architectural Context
|
||||
```typescript
|
||||
// ❌ REMOVE THIS
|
||||
// Old approach: used direct database calls
|
||||
// New approach: uses service layer
|
||||
|
||||
// ✅ TRANSFORM TO THIS
|
||||
// Note: Database access has been abstracted through service layer
|
||||
// for better testability and platform independence
|
||||
```
|
||||
|
||||
## 🚫 Anti-Patterns to Remove
|
||||
|
||||
- Comments that only state what was removed
|
||||
- Comments that don't explain the current approach
|
||||
- Comments that reference non-existent methods
|
||||
- Comments that are self-evident from the code
|
||||
- Comments that don't help future decision-making
|
||||
|
||||
## ✅ Best Practices
|
||||
|
||||
### When Keeping Historical Context:
|
||||
1. **Explain the "Why"**: Why was the change made?
|
||||
2. **Describe the "What"**: What is the current approach?
|
||||
3. **Provide Context**: When might this information be useful?
|
||||
4. **Use Actionable Language**: Guide future decisions, not just document history
|
||||
|
||||
### When Removing Historical Context:
|
||||
1. **Verify Obsoleteness**: Ensure the information is truly outdated
|
||||
2. **Check for Dependencies**: Ensure no other code references the old approach
|
||||
3. **Update Related Docs**: If removing from code, consider adding to documentation
|
||||
4. **Preserve in Git History**: The change is preserved in version control
|
||||
|
||||
## 🔍 Implementation Checklist
|
||||
|
||||
- [ ] Identify historical comments about removed/deprecated functionality
|
||||
- [ ] Determine if comment provides actionable guidance
|
||||
- [ ] Transform useful comments into migration notes or architectural context
|
||||
- [ ] Remove comments that are purely historical without guidance value
|
||||
- [ ] Ensure remaining comments explain current approach and rationale
|
||||
- [ ] Update related documentation if significant context is removed
|
||||
|
||||
## 📚 Examples
|
||||
|
||||
### Good Historical Comment (Keep & Transform)
|
||||
```typescript
|
||||
// Note: Database access has been migrated from direct IndexedDB calls to PlatformServiceMixin
|
||||
// This provides better platform abstraction and consistent error handling across web/mobile/desktop
|
||||
// When adding new database operations, use this.$getContact(), this.$saveSettings(), etc.
|
||||
```
|
||||
|
||||
### Bad Historical Comment (Remove)
|
||||
```typescript
|
||||
// Old method getContactFromDB() removed - now handled by PlatformServiceMixin
|
||||
// No need to call the old method anymore
|
||||
```
|
||||
|
||||
## 🎯 Integration with Harbor Pilot
|
||||
|
||||
This rule works in conjunction with:
|
||||
- **Component Creation Ideals**: Maintains architectural consistency
|
||||
- **Migration Patterns**: Documents evolution of patterns
|
||||
- **Code Review Guidelines**: Ensures comments provide value
|
||||
|
||||
## 📝 Version History
|
||||
|
||||
### v1.0.0 (2025-08-21)
|
||||
- Initial creation based on notification system cleanup
|
||||
- Established decision framework for historical comment management
|
||||
- Added transformation patterns and anti-patterns
|
||||
- Integrated with existing Harbor Pilot architecture rules
|
||||
# Historical Comment Management — Harbor Pilot Directive
|
||||
|
||||
> **Agent role**: When encountering historical comments about removed methods, deprecated patterns, or architectural changes, apply these guidelines to maintain code clarity and developer guidance.
|
||||
|
||||
## 🎯 Purpose
|
||||
|
||||
Historical comments should either be **removed entirely** or **transformed into actionable guidance** for future developers. Avoid keeping comments that merely state what was removed without explaining why or what to do instead.
|
||||
|
||||
## 📋 Decision Framework
|
||||
|
||||
### Remove Historical Comments When:
|
||||
- **Obsolete Information**: Comment describes functionality that no longer exists
|
||||
- **No Action Required**: Comment doesn't help future developers make decisions
|
||||
- **Outdated Context**: Comment refers to old patterns that are no longer relevant
|
||||
- **Self-Evident**: The current code clearly shows the current approach
|
||||
|
||||
### Transform Historical Comments When:
|
||||
- **Architectural Context**: The change represents a significant pattern shift
|
||||
- **Migration Guidance**: Future developers might need to understand the evolution
|
||||
- **Decision Rationale**: The "why" behind the change is still relevant
|
||||
- **Alternative Approaches**: The comment can guide future implementation choices
|
||||
|
||||
## 🔄 Transformation Patterns
|
||||
|
||||
### 1. From Removal Notice to Migration Note
|
||||
```typescript
|
||||
// ❌ REMOVE THIS
|
||||
// turnOffNotifyingFlags method removed - notification state is now managed by NotificationSection component
|
||||
|
||||
// ✅ TRANSFORM TO THIS
|
||||
// Note: Notification state management has been migrated to NotificationSection component
|
||||
// which handles its own lifecycle and persistence via PlatformServiceMixin
|
||||
```
|
||||
|
||||
### 2. From Deprecation Notice to Implementation Guide
|
||||
```typescript
|
||||
// ❌ REMOVE THIS
|
||||
// This will be handled by the NewComponent now
|
||||
// No need to call oldMethod() as it's no longer needed
|
||||
|
||||
// ✅ TRANSFORM TO THIS
|
||||
// Note: This functionality has been migrated to NewComponent
|
||||
// which provides better separation of concerns and testability
|
||||
```
|
||||
|
||||
### 3. From Historical Note to Architectural Context
|
||||
```typescript
|
||||
// ❌ REMOVE THIS
|
||||
// Old approach: used direct database calls
|
||||
// New approach: uses service layer
|
||||
|
||||
// ✅ TRANSFORM TO THIS
|
||||
// Note: Database access has been abstracted through service layer
|
||||
// for better testability and platform independence
|
||||
```
|
||||
|
||||
## 🚫 Anti-Patterns to Remove
|
||||
|
||||
- Comments that only state what was removed
|
||||
- Comments that don't explain the current approach
|
||||
- Comments that reference non-existent methods
|
||||
- Comments that are self-evident from the code
|
||||
- Comments that don't help future decision-making
|
||||
|
||||
## ✅ Best Practices
|
||||
|
||||
### When Keeping Historical Context:
|
||||
1. **Explain the "Why"**: Why was the change made?
|
||||
2. **Describe the "What"**: What is the current approach?
|
||||
3. **Provide Context**: When might this information be useful?
|
||||
4. **Use Actionable Language**: Guide future decisions, not just document history
|
||||
|
||||
### When Removing Historical Context:
|
||||
1. **Verify Obsoleteness**: Ensure the information is truly outdated
|
||||
2. **Check for Dependencies**: Ensure no other code references the old approach
|
||||
3. **Update Related Docs**: If removing from code, consider adding to documentation
|
||||
4. **Preserve in Git History**: The change is preserved in version control
|
||||
|
||||
## 🔍 Implementation Checklist
|
||||
|
||||
- [ ] Identify historical comments about removed/deprecated functionality
|
||||
- [ ] Determine if comment provides actionable guidance
|
||||
- [ ] Transform useful comments into migration notes or architectural context
|
||||
- [ ] Remove comments that are purely historical without guidance value
|
||||
- [ ] Ensure remaining comments explain current approach and rationale
|
||||
- [ ] Update related documentation if significant context is removed
|
||||
|
||||
## 📚 Examples
|
||||
|
||||
### Good Historical Comment (Keep & Transform)
|
||||
```typescript
|
||||
// Note: Database access has been migrated from direct IndexedDB calls to PlatformServiceMixin
|
||||
// This provides better platform abstraction and consistent error handling across web/mobile/desktop
|
||||
// When adding new database operations, use this.$getContact(), this.$saveSettings(), etc.
|
||||
```
|
||||
|
||||
### Bad Historical Comment (Remove)
|
||||
```typescript
|
||||
// Old method getContactFromDB() removed - now handled by PlatformServiceMixin
|
||||
// No need to call the old method anymore
|
||||
```
|
||||
|
||||
## 🎯 Integration with Harbor Pilot
|
||||
|
||||
This rule works in conjunction with:
|
||||
- **Component Creation Ideals**: Maintains architectural consistency
|
||||
- **Migration Patterns**: Documents evolution of patterns
|
||||
- **Code Review Guidelines**: Ensures comments provide value
|
||||
|
||||
## 📝 Version History
|
||||
|
||||
### v1.0.0 (2025-08-21)
|
||||
- Initial creation based on notification system cleanup
|
||||
- Established decision framework for historical comment management
|
||||
- Added transformation patterns and anti-patterns
|
||||
- Integrated with existing Harbor Pilot architecture rules
|
||||
@@ -1,117 +0,0 @@
|
||||
# Investigation Report Example
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-19
|
||||
**Status**: 🎯 **ACTIVE** - Investigation methodology example
|
||||
|
||||
## Investigation — Registration Dialog Test Flakiness
|
||||
|
||||
## Objective
|
||||
|
||||
Identify root cause of flaky tests related to registration dialogs in contact
|
||||
import scenarios.
|
||||
|
||||
## System Map
|
||||
|
||||
- User action → ContactInputForm → ContactsView.addContact() →
|
||||
handleRegistrationPrompt()
|
||||
- setTimeout(1000ms) → Modal dialog → User response → Registration API call
|
||||
- Test execution → Wait for dialog → Assert dialog content → Click response
|
||||
button
|
||||
|
||||
## Findings (Evidence)
|
||||
|
||||
- **1-second timeout causes flakiness** — evidence:
|
||||
`src/views/ContactsView.vue:971-1000`; setTimeout(..., 1000) in
|
||||
handleRegistrationPrompt()
|
||||
- **Import flow bypasses dialogs** — evidence:
|
||||
`src/views/ContactImportView.vue:500-520`; importContacts() calls
|
||||
$insertContact() directly, no handleRegistrationPrompt()
|
||||
- **Dialog only appears in direct add flow** — evidence:
|
||||
`src/views/ContactsView.vue:774-800`; addContact() calls
|
||||
handleRegistrationPrompt() after database insert
|
||||
|
||||
## Hypotheses & Failure Modes
|
||||
|
||||
- H1: 1-second timeout makes dialog appearance unpredictable; would fail when
|
||||
tests run faster than 1000ms
|
||||
- H2: Test environment timing differs from development; watch for CI vs local
|
||||
test differences
|
||||
|
||||
## Corrections
|
||||
|
||||
- Updated: "Multiple dialogs interfere with imports" → "Import flow never
|
||||
triggers dialogs - they only appear in direct contact addition"
|
||||
- Updated: "Complex batch registration needed" → "Simple timeout removal and
|
||||
test mode flag sufficient"
|
||||
|
||||
## Diagnostics (Next Checks)
|
||||
|
||||
- [ ] Repro on CI environment vs local
|
||||
- [ ] Measure actual dialog appearance timing
|
||||
- [ ] Test with setTimeout removed
|
||||
- [ ] Verify import flow doesn't call handleRegistrationPrompt
|
||||
|
||||
## Risks & Scope
|
||||
|
||||
- Impacted: Contact addition tests, registration workflow tests; Data: None;
|
||||
Users: Test suite reliability
|
||||
|
||||
## Decision / Next Steps
|
||||
|
||||
- Owner: Development Team; By: 2025-01-28
|
||||
- Action: Remove 1-second timeout + add test mode flag; Exit criteria: Tests
|
||||
pass consistently
|
||||
|
||||
## References
|
||||
|
||||
- `src/views/ContactsView.vue:971-1000`
|
||||
- `src/views/ContactImportView.vue:500-520`
|
||||
- `src/views/ContactsView.vue:774-800`
|
||||
|
||||
## Competence Hooks
|
||||
|
||||
- Why this works: Code path tracing revealed separate execution flows,
|
||||
evidence disproved initial assumptions
|
||||
- Common pitfalls: Assuming related functionality without tracing execution
|
||||
paths, over-engineering solutions to imaginary problems
|
||||
- Next skill: Learn to trace code execution before proposing architectural
|
||||
changes
|
||||
- Teach-back: "What evidence shows that contact imports bypass registration
|
||||
dialogs?"
|
||||
|
||||
## Key Learning Points
|
||||
|
||||
### Evidence-First Approach
|
||||
|
||||
This investigation demonstrates the importance of:
|
||||
|
||||
1. **Tracing actual code execution** rather than making assumptions
|
||||
2. **Citing specific evidence** with file:line references
|
||||
3. **Validating problem scope** before proposing solutions
|
||||
4. **Considering simpler alternatives** before complex architectural changes
|
||||
|
||||
### Code Path Tracing Value
|
||||
|
||||
By tracing the execution paths, we discovered:
|
||||
|
||||
- Import flow and direct add flow are completely separate
|
||||
- The "multiple dialog interference" problem didn't exist
|
||||
- A simple timeout removal would solve the actual issue
|
||||
|
||||
### Prevention of Over-Engineering
|
||||
|
||||
The investigation prevented:
|
||||
|
||||
- Unnecessary database schema changes
|
||||
- Complex batch registration systems
|
||||
- Migration scripts for non-existent problems
|
||||
- Architectural changes based on assumptions
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active investigation methodology
|
||||
**Priority**: High
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: software_development.mdc
|
||||
**Stakeholders**: Development team, QA team
|
||||
@@ -1,222 +0,0 @@
|
||||
# Agent Contract — TimeSafari Logging (Unified, MANDATORY)
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-19
|
||||
**Status**: 🎯 **ACTIVE** - Mandatory logging standards
|
||||
|
||||
## Overview
|
||||
|
||||
This document defines unified logging standards for the TimeSafari project,
|
||||
ensuring consistent, rest-parameter logging style using the project logger.
|
||||
No `console.*` methods are allowed in production code.
|
||||
|
||||
## Scope and Goals
|
||||
|
||||
**Scope**: Applies to all diffs and generated code in this workspace unless
|
||||
explicitly exempted below.
|
||||
|
||||
**Goal**: One consistent, rest-parameter logging style using the project
|
||||
logger; no `console.*` in production code.
|
||||
|
||||
## Non‑Negotiables (DO THIS)
|
||||
|
||||
- You **MUST** use the project logger; **DO NOT** use any `console.*`
|
||||
methods.
|
||||
- Import exactly as:
|
||||
- `import { logger } from '@/utils/logger'`
|
||||
- If `@` alias is unavailable, compute the correct relative path (do not
|
||||
fail).
|
||||
- Call signatures use **rest parameters**: `logger.info(message, ...args)`
|
||||
- Prefer primitives/IDs and small objects in `...args`; **never build a
|
||||
throwaway object** just to "wrap context".
|
||||
- Production defaults: Web = `warn+`, Electron = `error`, Dev/Capacitor =
|
||||
`info+` (override via `VITE_LOG_LEVEL`).
|
||||
- **Database persistence**: `info|warn|error` are persisted; `debug` is not.
|
||||
Use `logger.toDb(msg, level?)` for DB-only.
|
||||
|
||||
## Available Logger API (Authoritative)
|
||||
|
||||
- `logger.debug(message, ...args)` — verbose internals, timings, input/output
|
||||
shapes
|
||||
- `logger.log(message, ...args)` — synonym of `info` for general info
|
||||
- `logger.info(message, ...args)` — lifecycle, state changes, success paths
|
||||
- `logger.warn(message, ...args)` — recoverable issues, retries, degraded mode
|
||||
- `logger.error(message, ...args)` — failures, thrown exceptions, aborts
|
||||
- `logger.toDb(message, level?)` — DB-only entry (default level = `info`)
|
||||
- `logger.toConsoleAndDb(message, isError)` — console + DB (use sparingly)
|
||||
- `logger.withContext(componentName)` — returns a scoped logger
|
||||
|
||||
## Level Guidelines (Use These Heuristics)
|
||||
|
||||
### DEBUG
|
||||
|
||||
Use for method entry/exit, computed values, filters, loops, retries, and
|
||||
external call payload sizes.
|
||||
|
||||
```typescript
|
||||
logger.debug('[HomeView] reloadFeedOnChange() called');
|
||||
logger.debug('[HomeView] Current filter settings',
|
||||
settings.filterFeedByVisible,
|
||||
settings.filterFeedByNearby,
|
||||
settings.searchBoxes?.length ?? 0);
|
||||
logger.debug('[FeedFilters] Toggling nearby filter',
|
||||
this.isNearby, this.settingChanged, this.activeDid);
|
||||
```
|
||||
|
||||
**Avoid**: Vague messages (`'Processing data'`).
|
||||
|
||||
### INFO
|
||||
|
||||
Use for user-visible lifecycle and completed operations.
|
||||
|
||||
```typescript
|
||||
logger.info('[StartView] Component mounted', process.env.VITE_PLATFORM);
|
||||
logger.info('[StartView] User selected new seed generation');
|
||||
logger.info('[SearchAreaView] Search box stored',
|
||||
searchBox.name, searchBox.bbox);
|
||||
logger.info('[ContactQRScanShowView] Contact registration OK',
|
||||
contact.did);
|
||||
```
|
||||
|
||||
**Avoid**: Diagnostic details that belong in `debug`.
|
||||
|
||||
### WARN
|
||||
|
||||
Use for recoverable issues, fallbacks, unexpected-but-handled conditions.
|
||||
|
||||
```typescript
|
||||
logger.warn('[ContactQRScanShowView] Invalid scan result – no value',
|
||||
resultType);
|
||||
logger.warn('[ContactQRScanShowView] Invalid QR format – no JWT in URL');
|
||||
logger.warn('[ContactQRScanShowView] JWT missing "own" field');
|
||||
```
|
||||
|
||||
**Avoid**: Hard failures (those are `error`).
|
||||
|
||||
### ERROR
|
||||
|
||||
Use for unrecoverable failures, data integrity issues, and thrown
|
||||
exceptions.
|
||||
|
||||
```typescript
|
||||
logger.error('[HomeView Settings] initializeIdentity() failed', err);
|
||||
logger.error('[StartView] Failed to load initialization data', error);
|
||||
logger.error('[ContactQRScanShowView] Error processing contact QR',
|
||||
error, rawValue);
|
||||
```
|
||||
|
||||
**Avoid**: Expected user cancels (use `info`/`debug`).
|
||||
|
||||
## Context Hygiene (Consistent, Minimal, Helpful)
|
||||
|
||||
- **Component context**: Prefer scoped logger.
|
||||
|
||||
```typescript
|
||||
const log = logger.withContext('UserService');
|
||||
log.info('User created', userId);
|
||||
log.error('Failed to create user', error);
|
||||
```
|
||||
|
||||
If not using `withContext`, prefix message with `[ComponentName]`.
|
||||
|
||||
- **Emojis**: Optional and minimal for visual scanning. Recommended set:
|
||||
- Start/finish: 🚀 / ✅
|
||||
- Retry/loop: 🔄
|
||||
- External call: 📡
|
||||
- Data/metrics: 📊
|
||||
- Inspection: 🔍
|
||||
|
||||
- **Sensitive data**: Never log secrets (tokens, keys, passwords) or
|
||||
payloads >10KB. Prefer IDs over objects; redact/hash when needed.
|
||||
|
||||
## Migration — Auto‑Rewrites (Apply Every Time)
|
||||
|
||||
- Exact transforms:
|
||||
- `console.debug(...)` → `logger.debug(...)`
|
||||
- `console.log(...)` → `logger.log(...)` (or `logger.info(...)` when
|
||||
clearly stateful)
|
||||
- `console.info(...)` → `logger.info(...)`
|
||||
- `console.warn(...)` → `logger.warn(...)`
|
||||
- `console.error(...)` → `logger.error(...)`
|
||||
|
||||
- Multi-arg handling:
|
||||
- First arg becomes `message` (stringify safely if non-string).
|
||||
- Remaining args map 1:1 to `...args`:
|
||||
`console.info(msg, a, b)` → `logger.info(String(msg), a, b)`
|
||||
|
||||
- Sole `Error`:
|
||||
- `console.error(err)` → `logger.error(err.message, err)`
|
||||
|
||||
- **Object-wrapping cleanup**: Replace `{{ userId, meta }}` wrappers with
|
||||
separate args:
|
||||
`logger.info('User signed in', userId, meta)`
|
||||
|
||||
## DB Logging Rules
|
||||
|
||||
- `debug` **never** persists automatically.
|
||||
- `info|warn|error` persist automatically.
|
||||
- For DB-only events (no console), call `logger.toDb('Message',
|
||||
'info'|'warn'|'error')`.
|
||||
|
||||
## Exceptions (Tightly Scoped)
|
||||
|
||||
Allowed paths (still prefer logger):
|
||||
|
||||
- `**/*.test.*`, `**/*.spec.*`
|
||||
- `scripts/dev/**`, `scripts/migrate/**`
|
||||
|
||||
To intentionally keep `console.*`, add a pragma on the previous line:
|
||||
|
||||
```typescript
|
||||
// cursor:allow-console reason="short justification"
|
||||
console.log('temporary output');
|
||||
```
|
||||
|
||||
Without the pragma, rewrite to `logger.*`.
|
||||
|
||||
## CI & Diff Enforcement
|
||||
|
||||
- Do not introduce `console.*` anywhere outside allowed, pragma'd spots.
|
||||
- If an import is missing, insert it and resolve alias/relative path
|
||||
correctly.
|
||||
- Enforce rest-parameter call shape in reviews; replace object-wrapped
|
||||
context.
|
||||
- Ensure environment log level rules remain intact (`VITE_LOG_LEVEL`
|
||||
respected).
|
||||
|
||||
## Quick Before/After
|
||||
|
||||
### **Before**
|
||||
|
||||
```typescript
|
||||
console.log('User signed in', user.id, meta);
|
||||
console.error('Failed to update profile', err);
|
||||
console.info('Filter toggled', this.hasVisibleDid);
|
||||
```
|
||||
|
||||
### **After**
|
||||
|
||||
```typescript
|
||||
import { logger } from '@/utils/logger';
|
||||
|
||||
logger.info('User signed in', user.id, meta);
|
||||
logger.error('Failed to update profile', err);
|
||||
logger.debug('[FeedFilters] Filter toggled', this.hasVisibleDid);
|
||||
```
|
||||
|
||||
## Checklist (for every PR)
|
||||
|
||||
- [ ] No `console.*` (or properly pragma'd in the allowed locations)
|
||||
- [ ] Correct import path for `logger`
|
||||
- [ ] Rest-parameter call shape (`message, ...args`)
|
||||
- [ ] Right level chosen (debug/info/warn/error)
|
||||
- [ ] No secrets / oversized payloads / throwaway context objects
|
||||
- [ ] Component context provided (scoped logger or `[Component]` prefix)
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active and enforced
|
||||
**Priority**: Critical
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: TimeSafari logger utility
|
||||
**Stakeholders**: Development team, Code review team
|
||||
@@ -1,348 +0,0 @@
|
||||
---
|
||||
description: when generating text that has project task work estimates
|
||||
alwaysApply: false
|
||||
---
|
||||
# No Time Estimates — Harbor Pilot Directive
|
||||
|
||||
> **Agent role**: **DO NOT MAKE TIME ESTIMATES**. Instead, use phases, milestones, and complexity levels. Time estimates are consistently wrong and create unrealistic expectations.
|
||||
|
||||
## 🎯 Purpose
|
||||
|
||||
Development time estimates are consistently wrong and create unrealistic expectations. This rule ensures we focus on phases, milestones, and complexity rather than trying to predict specific timeframes.
|
||||
|
||||
## 🚨 Critical Rule
|
||||
|
||||
**DO NOT MAKE TIME ESTIMATES**
|
||||
- **Never provide specific time estimates** - they are always wrong
|
||||
- **Use phases and milestones** instead of days/weeks
|
||||
- **Focus on complexity and dependencies** rather than time
|
||||
- **Set expectations based on progress, not deadlines**
|
||||
|
||||
## 📊 Planning Framework (Not Time Estimates)
|
||||
|
||||
### **Complexity Categories**
|
||||
- **Simple**: Text changes, styling updates, minor bug fixes
|
||||
- **Medium**: New features, refactoring, component updates
|
||||
- **Complex**: Architecture changes, integrations, cross-platform work
|
||||
- **Unknown**: New technologies, APIs, or approaches
|
||||
|
||||
### **Platform Complexity**
|
||||
- **Single platform**: Web-only or mobile-only changes
|
||||
- **Two platforms**: Web + mobile or web + desktop
|
||||
- **Three platforms**: Web + mobile + desktop
|
||||
- **Cross-platform consistency**: Ensuring behavior matches across all platforms
|
||||
|
||||
### **Testing Complexity**
|
||||
- **Basic**: Unit tests for new functionality
|
||||
- **Comprehensive**: Integration tests, cross-platform testing
|
||||
- **User acceptance**: User testing, feedback integration
|
||||
|
||||
## 🔍 Planning Process (No Time Estimates)
|
||||
|
||||
### **Step 1: Break Down the Work**
|
||||
- Identify all subtasks and dependencies
|
||||
- Group related work into logical phases
|
||||
- Identify critical path and blockers
|
||||
|
||||
### **Step 2: Define Phases and Milestones**
|
||||
- **Phase 1**: Foundation work (basic fixes, core functionality)
|
||||
- **Phase 2**: Enhancement work (new features, integrations)
|
||||
- **Phase 3**: Polish work (testing, user experience, edge cases)
|
||||
|
||||
### **Step 3: Identify Dependencies**
|
||||
- **Technical dependencies**: What must be built first
|
||||
- **Platform dependencies**: What works on which platforms
|
||||
- **Testing dependencies**: What can be tested when
|
||||
|
||||
### **Step 4: Set Progress Milestones**
|
||||
- **Milestone 1**: Basic functionality working
|
||||
- **Milestone 2**: All platforms supported
|
||||
- **Milestone 3**: Fully tested and polished
|
||||
|
||||
## 📋 Planning Checklist (No Time Estimates)
|
||||
|
||||
- [ ] Work broken down into logical phases
|
||||
- [ ] Dependencies identified and mapped
|
||||
- [ ] Milestones defined with clear criteria
|
||||
- [ ] Complexity levels assigned to each phase
|
||||
- [ ] Platform requirements identified
|
||||
- [ ] Testing strategy planned
|
||||
- [ ] Risk factors identified
|
||||
- [ ] Success criteria defined
|
||||
|
||||
## 🎯 Example Planning (No Time Estimates)
|
||||
|
||||
### **Example 1: Simple Feature**
|
||||
```
|
||||
Phase 1: Core implementation
|
||||
- Basic functionality
|
||||
- Single platform support
|
||||
- Unit tests
|
||||
|
||||
Phase 2: Platform expansion
|
||||
- Multi-platform support
|
||||
- Integration tests
|
||||
|
||||
Phase 3: Polish
|
||||
- User testing
|
||||
- Edge case handling
|
||||
```
|
||||
|
||||
### **Example 2: Complex Cross-Platform Feature**
|
||||
```
|
||||
Phase 1: Foundation
|
||||
- Architecture design
|
||||
- Core service implementation
|
||||
- Basic web platform support
|
||||
|
||||
Phase 2: Platform Integration
|
||||
- Mobile platform support
|
||||
- Desktop platform support
|
||||
- Cross-platform consistency
|
||||
|
||||
Phase 3: Testing & Polish
|
||||
- Comprehensive testing
|
||||
- Error handling
|
||||
- User experience refinement
|
||||
```
|
||||
|
||||
## 🚫 Anti-Patterns to Avoid
|
||||
|
||||
- **"This should take X days"** - Red flag for time estimation
|
||||
- **"Just a few hours"** - Ignores complexity and testing
|
||||
- **"Similar to X"** - Without considering differences
|
||||
- **"Quick fix"** - Nothing is ever quick in software
|
||||
- **"No testing needed"** - Testing always takes effort
|
||||
|
||||
## ✅ Best Practices
|
||||
|
||||
### **When Planning:**
|
||||
1. **Break down everything** - no work is too small to plan
|
||||
2. **Consider all platforms** - web, mobile, desktop differences
|
||||
3. **Include testing strategy** - unit, integration, and user testing
|
||||
4. **Account for unknowns** - there are always surprises
|
||||
5. **Focus on dependencies** - what blocks what
|
||||
|
||||
### **When Presenting Plans:**
|
||||
1. **Show the phases** - explain the logical progression
|
||||
2. **Highlight dependencies** - what could block progress
|
||||
3. **Define milestones** - clear success criteria
|
||||
4. **Identify risks** - what could go wrong
|
||||
5. **Suggest alternatives** - ways to reduce scope or complexity
|
||||
|
||||
## 🔄 Continuous Improvement
|
||||
|
||||
### **Track Progress**
|
||||
- Record planned vs. actual phases completed
|
||||
- Identify what took longer than expected
|
||||
- Learn from complexity misjudgments
|
||||
- Adjust planning process based on experience
|
||||
|
||||
### **Learn from Experience**
|
||||
- **Underestimated complexity**: Increase complexity categories
|
||||
- **Missed dependencies**: Improve dependency mapping
|
||||
- **Platform surprises**: Better platform research upfront
|
||||
|
||||
## 🎯 Integration with Harbor Pilot
|
||||
|
||||
This rule works in conjunction with:
|
||||
- **Project Planning**: Focuses on phases and milestones
|
||||
- **Resource Allocation**: Based on complexity, not time
|
||||
- **Risk Management**: Identifies blockers and dependencies
|
||||
- **Stakeholder Communication**: Sets progress-based expectations
|
||||
|
||||
## 📝 Version History
|
||||
|
||||
### v2.0.0 (2025-08-21)
|
||||
- **Major Change**: Completely removed time estimation approach
|
||||
- **New Focus**: Phases, milestones, and complexity-based planning
|
||||
- **Eliminated**: All time multipliers, estimates, and calculations
|
||||
- **Added**: Dependency mapping and progress milestone framework
|
||||
|
||||
### v1.0.0 (2025-08-21)
|
||||
- Initial creation based on user feedback about estimation accuracy
|
||||
- ~~Established realistic estimation multipliers and process~~
|
||||
- ~~Added comprehensive estimation checklist and examples~~
|
||||
- Integrated with Harbor Pilot planning and risk management
|
||||
|
||||
---
|
||||
|
||||
## 🚨 Remember
|
||||
|
||||
**DO NOT MAKE TIME ESTIMATES. Use phases, milestones, and complexity instead. Focus on progress, not deadlines.**
|
||||
|
||||
## 🚨 Remember
|
||||
|
||||
**Your first estimate is wrong. Your second estimate is probably still wrong. Focus on progress, not deadlines.**
|
||||
# No Time Estimates — Harbor Pilot Directive
|
||||
|
||||
> **Agent role**: **DO NOT MAKE TIME ESTIMATES**. Instead, use phases, milestones, and complexity levels. Time estimates are consistently wrong and create unrealistic expectations.
|
||||
|
||||
## 🎯 Purpose
|
||||
|
||||
Development time estimates are consistently wrong and create unrealistic expectations. This rule ensures we focus on phases, milestones, and complexity rather than trying to predict specific timeframes.
|
||||
|
||||
## 🚨 Critical Rule
|
||||
|
||||
**DO NOT MAKE TIME ESTIMATES**
|
||||
- **Never provide specific time estimates** - they are always wrong
|
||||
- **Use phases and milestones** instead of days/weeks
|
||||
- **Focus on complexity and dependencies** rather than time
|
||||
- **Set expectations based on progress, not deadlines**
|
||||
|
||||
## 📊 Planning Framework (Not Time Estimates)
|
||||
|
||||
### **Complexity Categories**
|
||||
- **Simple**: Text changes, styling updates, minor bug fixes
|
||||
- **Medium**: New features, refactoring, component updates
|
||||
- **Complex**: Architecture changes, integrations, cross-platform work
|
||||
- **Unknown**: New technologies, APIs, or approaches
|
||||
|
||||
### **Platform Complexity**
|
||||
- **Single platform**: Web-only or mobile-only changes
|
||||
- **Two platforms**: Web + mobile or web + desktop
|
||||
- **Three platforms**: Web + mobile + desktop
|
||||
- **Cross-platform consistency**: Ensuring behavior matches across all platforms
|
||||
|
||||
### **Testing Complexity**
|
||||
- **Basic**: Unit tests for new functionality
|
||||
- **Comprehensive**: Integration tests, cross-platform testing
|
||||
- **User acceptance**: User testing, feedback integration
|
||||
|
||||
## 🔍 Planning Process (No Time Estimates)
|
||||
|
||||
### **Step 1: Break Down the Work**
|
||||
- Identify all subtasks and dependencies
|
||||
- Group related work into logical phases
|
||||
- Identify critical path and blockers
|
||||
|
||||
### **Step 2: Define Phases and Milestones**
|
||||
- **Phase 1**: Foundation work (basic fixes, core functionality)
|
||||
- **Phase 2**: Enhancement work (new features, integrations)
|
||||
- **Phase 3**: Polish work (testing, user experience, edge cases)
|
||||
|
||||
### **Step 3: Identify Dependencies**
|
||||
- **Technical dependencies**: What must be built first
|
||||
- **Platform dependencies**: What works on which platforms
|
||||
- **Testing dependencies**: What can be tested when
|
||||
|
||||
### **Step 4: Set Progress Milestones**
|
||||
- **Milestone 1**: Basic functionality working
|
||||
- **Milestone 2**: All platforms supported
|
||||
- **Milestone 3**: Fully tested and polished
|
||||
|
||||
## 📋 Planning Checklist (No Time Estimates)
|
||||
|
||||
- [ ] Work broken down into logical phases
|
||||
- [ ] Dependencies identified and mapped
|
||||
- [ ] Milestones defined with clear criteria
|
||||
- [ ] Complexity levels assigned to each phase
|
||||
- [ ] Platform requirements identified
|
||||
- [ ] Testing strategy planned
|
||||
- [ ] Risk factors identified
|
||||
- [ ] Success criteria defined
|
||||
|
||||
## 🎯 Example Planning (No Time Estimates)
|
||||
|
||||
### **Example 1: Simple Feature**
|
||||
```
|
||||
Phase 1: Core implementation
|
||||
- Basic functionality
|
||||
- Single platform support
|
||||
- Unit tests
|
||||
|
||||
Phase 2: Platform expansion
|
||||
- Multi-platform support
|
||||
- Integration tests
|
||||
|
||||
Phase 3: Polish
|
||||
- User testing
|
||||
- Edge case handling
|
||||
```
|
||||
|
||||
### **Example 2: Complex Cross-Platform Feature**
|
||||
```
|
||||
Phase 1: Foundation
|
||||
- Architecture design
|
||||
- Core service implementation
|
||||
- Basic web platform support
|
||||
|
||||
Phase 2: Platform Integration
|
||||
- Mobile platform support
|
||||
- Desktop platform support
|
||||
- Cross-platform consistency
|
||||
|
||||
Phase 3: Testing & Polish
|
||||
- Comprehensive testing
|
||||
- Error handling
|
||||
- User experience refinement
|
||||
```
|
||||
|
||||
## 🚫 Anti-Patterns to Avoid
|
||||
|
||||
- **"This should take X days"** - Red flag for time estimation
|
||||
- **"Just a few hours"** - Ignores complexity and testing
|
||||
- **"Similar to X"** - Without considering differences
|
||||
- **"Quick fix"** - Nothing is ever quick in software
|
||||
- **"No testing needed"** - Testing always takes effort
|
||||
|
||||
## ✅ Best Practices
|
||||
|
||||
### **When Planning:**
|
||||
1. **Break down everything** - no work is too small to plan
|
||||
2. **Consider all platforms** - web, mobile, desktop differences
|
||||
3. **Include testing strategy** - unit, integration, and user testing
|
||||
4. **Account for unknowns** - there are always surprises
|
||||
5. **Focus on dependencies** - what blocks what
|
||||
|
||||
### **When Presenting Plans:**
|
||||
1. **Show the phases** - explain the logical progression
|
||||
2. **Highlight dependencies** - what could block progress
|
||||
3. **Define milestones** - clear success criteria
|
||||
4. **Identify risks** - what could go wrong
|
||||
5. **Suggest alternatives** - ways to reduce scope or complexity
|
||||
|
||||
## 🔄 Continuous Improvement
|
||||
|
||||
### **Track Progress**
|
||||
- Record planned vs. actual phases completed
|
||||
- Identify what took longer than expected
|
||||
- Learn from complexity misjudgments
|
||||
- Adjust planning process based on experience
|
||||
|
||||
### **Learn from Experience**
|
||||
- **Underestimated complexity**: Increase complexity categories
|
||||
- **Missed dependencies**: Improve dependency mapping
|
||||
- **Platform surprises**: Better platform research upfront
|
||||
|
||||
## 🎯 Integration with Harbor Pilot
|
||||
|
||||
This rule works in conjunction with:
|
||||
- **Project Planning**: Focuses on phases and milestones
|
||||
- **Resource Allocation**: Based on complexity, not time
|
||||
- **Risk Management**: Identifies blockers and dependencies
|
||||
- **Stakeholder Communication**: Sets progress-based expectations
|
||||
|
||||
## 📝 Version History
|
||||
|
||||
### v2.0.0 (2025-08-21)
|
||||
- **Major Change**: Completely removed time estimation approach
|
||||
- **New Focus**: Phases, milestones, and complexity-based planning
|
||||
- **Eliminated**: All time multipliers, estimates, and calculations
|
||||
- **Added**: Dependency mapping and progress milestone framework
|
||||
|
||||
### v1.0.0 (2025-08-21)
|
||||
- Initial creation based on user feedback about estimation accuracy
|
||||
- ~~Established realistic estimation multipliers and process~~
|
||||
- ~~Added comprehensive estimation checklist and examples~~
|
||||
- Integrated with Harbor Pilot planning and risk management
|
||||
|
||||
---
|
||||
|
||||
## 🚨 Remember
|
||||
|
||||
**DO NOT MAKE TIME ESTIMATES. Use phases, milestones, and complexity instead. Focus on progress, not deadlines.**
|
||||
|
||||
## 🚨 Remember
|
||||
|
||||
**Your first estimate is wrong. Your second estimate is probably still wrong. Focus on progress, not deadlines.**
|
||||
@@ -1,174 +0,0 @@
|
||||
---
|
||||
description: Use this workflow when doing **pre-implementation research, defect investigations with uncertain repros, or clarifying system architecture and behaviors**.
|
||||
alwaysApply: false
|
||||
---
|
||||
```json
|
||||
{
|
||||
"coaching_level": "light",
|
||||
"socratic_max_questions": 2,
|
||||
"verbosity": "concise",
|
||||
"timebox_minutes": null,
|
||||
"format_enforcement": "strict"
|
||||
}
|
||||
```
|
||||
|
||||
# Research & Diagnostic Workflow (R&D)
|
||||
|
||||
## Purpose
|
||||
|
||||
Provide a **repeatable, evidence-first** workflow to investigate features and
|
||||
defects **before coding**. Outputs are concise reports, hypotheses, and next
|
||||
steps—**not** code changes.
|
||||
|
||||
## When to Use
|
||||
|
||||
- Pre-implementation research for new features
|
||||
- Defect investigations (repros uncertain, user-specific failures)
|
||||
- Architecture/behavior clarifications (e.g., auth flows, merges, migrations)
|
||||
|
||||
---
|
||||
|
||||
## Enhanced with Software Development Ruleset
|
||||
|
||||
When investigating software issues, also apply:
|
||||
|
||||
- **Code Path Tracing**: Required for technical investigations
|
||||
- **Evidence Validation**: Ensure claims are code-backed
|
||||
- **Solution Complexity Assessment**: Justify architectural changes
|
||||
|
||||
---
|
||||
|
||||
## Output Contract (strict)
|
||||
|
||||
1) **Objective** — 1–2 lines
|
||||
2) **System Map (if helpful)** — short diagram or bullet flow (≤8 bullets)
|
||||
3) **Findings (Evidence-linked)** — bullets; each with file/function refs
|
||||
4) **Hypotheses & Failure Modes** — short list, each testable
|
||||
5) **Corrections** — explicit deltas from earlier assumptions (if any)
|
||||
6) **Diagnostics** — what to check next (logs, DB, env, repro steps)
|
||||
7) **Risks & Scope** — what could break; affected components
|
||||
8) **Decision/Next Steps** — what we'll do, who's involved, by when
|
||||
9) **References** — code paths, ADRs, docs
|
||||
10) **Competence & Collaboration Hooks** — brief, skimmable
|
||||
|
||||
> Keep total length lean. Prefer links and bullets over prose.
|
||||
|
||||
---
|
||||
|
||||
## Quickstart Template
|
||||
|
||||
Copy/paste and fill:
|
||||
|
||||
```md
|
||||
# Investigation — <short title>
|
||||
|
||||
## Objective
|
||||
<one or two lines>
|
||||
|
||||
## System Map
|
||||
- <module> → <function> → <downstream>
|
||||
- <data path> → <db table> → <api>
|
||||
|
||||
## Findings (Evidence)
|
||||
- <claim> — evidence: `src/path/file.ts:function` (lines X–Y); log snippet/trace id
|
||||
- <claim> — evidence: `...`
|
||||
|
||||
## Hypotheses & Failure Modes
|
||||
- H1: <hypothesis>; would fail when <condition>
|
||||
- H2: <hypothesis>; watch for <signal>
|
||||
|
||||
## Corrections
|
||||
- Updated: <old statement> → <new statement with evidence>
|
||||
|
||||
## Diagnostics (Next Checks)
|
||||
- [ ] Repro on <platform/version>
|
||||
- [ ] Inspect <table/store> for <record>
|
||||
- [ ] Capture <log/trace>
|
||||
|
||||
## Risks & Scope
|
||||
- Impacted: <areas/components>; Data: <tables/keys>; Users: <segments>
|
||||
|
||||
## Decision / Next Steps
|
||||
- Owner: <name>; By: <date> (YYYY-MM-DD)
|
||||
- Action: <spike/bugfix/ADR>; Exit criteria: <binary checks>
|
||||
|
||||
## References
|
||||
- `src/...`
|
||||
- ADR: `docs/adr/xxxx-yy-zz-something.md`
|
||||
- Design: `docs/...`
|
||||
|
||||
## Competence Hooks
|
||||
- Why this works: <≤3 bullets>
|
||||
- Common pitfalls: <≤3 bullets>
|
||||
- Next skill: <≤1 item>
|
||||
- Teach-back: "<one question>"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Evidence Quality Bar
|
||||
|
||||
- **Cite the source** (file:func, line range if possible).
|
||||
- **Prefer primary evidence** (code, logs) over inference.
|
||||
- **Disambiguate platform** (Web/Capacitor/Electron) and **state** (migration, auth).
|
||||
- **Note uncertainty** explicitly.
|
||||
|
||||
---
|
||||
|
||||
## Code Path Tracing (Required for Software Investigations)
|
||||
|
||||
Before proposing solutions, trace the actual execution path:
|
||||
|
||||
- [ ] **Entry Points**: Identify where the flow begins (user action, API call, etc.)
|
||||
- [ ] **Component Flow**: Map which components/methods are involved
|
||||
- [ ] **Data Path**: Track how data moves through the system
|
||||
- [ ] **Exit Points**: Confirm where the flow ends and what results
|
||||
- [ ] **Evidence Collection**: Gather specific code citations for each step
|
||||
|
||||
---
|
||||
|
||||
## Collaboration Hooks
|
||||
|
||||
- **Syncs:** 10–15m with QA/Security/Platform owners for high-risk areas.
|
||||
- **ADR:** Record major decisions; link here.
|
||||
- **Review:** Share repro + diagnostics checklist in PR/issue.
|
||||
|
||||
---
|
||||
|
||||
## Integration with Other Rulesets
|
||||
|
||||
### With software_development.mdc
|
||||
|
||||
- **Enhanced Evidence Validation**: Use code path tracing for technical investigations
|
||||
- **Architecture Assessment**: Apply complexity justification to proposed solutions
|
||||
- **Impact Analysis**: Assess effects on existing systems before recommendations
|
||||
|
||||
### With base_context.mdc
|
||||
|
||||
- **Competence Building**: Focus on technical investigation skills
|
||||
- **Collaboration**: Structure outputs for team review and discussion
|
||||
|
||||
---
|
||||
|
||||
## Self-Check (model, before responding)
|
||||
|
||||
- [ ] Output matches the **Output Contract** sections.
|
||||
- [ ] Each claim has **evidence** or **uncertainty** is flagged.
|
||||
- [ ] Hypotheses are testable; diagnostics are actionable.
|
||||
- [ ] Competence + collaboration hooks present (≤120 words total).
|
||||
- [ ] Respect toggles; keep it concise.
|
||||
- [ ] **Code path traced** (for software investigations).
|
||||
- [ ] **Evidence validated** against actual code execution.
|
||||
|
||||
---
|
||||
|
||||
## Optional Globs (examples)
|
||||
|
||||
> Uncomment `globs` in the header if you want auto-attach behavior.
|
||||
|
||||
- `src/platforms/**`, `src/services/**` — attach during service/feature investigations
|
||||
- `docs/adr/**` — attach when editing ADRs
|
||||
|
||||
## Referenced Files
|
||||
|
||||
- Consider including templates as context: `@adr_template.mdc`, `@investigation_report_example.mdc`
|
||||
@@ -1,225 +0,0 @@
|
||||
|
||||
# Software Development Ruleset
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-19
|
||||
**Status**: 🎯 **ACTIVE** - Core development guidelines
|
||||
|
||||
## Purpose
|
||||
|
||||
Specialized guidelines for software development tasks including code review,
|
||||
debugging, architecture decisions, and testing.
|
||||
|
||||
## Core Principles
|
||||
|
||||
### 1. Evidence-First Development
|
||||
|
||||
- **Code Citations Required**: Always cite specific file:line references when
|
||||
making claims
|
||||
- **Execution Path Tracing**: Trace actual code execution before proposing
|
||||
architectural changes
|
||||
- **Assumption Validation**: Flag assumptions as "assumed" vs "evidence-based"
|
||||
|
||||
### 2. Code Review Standards
|
||||
|
||||
- **Trace Before Proposing**: Always trace execution paths before suggesting
|
||||
changes
|
||||
- **Evidence Over Inference**: Prefer code citations over logical deductions
|
||||
- **Scope Validation**: Confirm the actual scope of problems before proposing
|
||||
solutions
|
||||
|
||||
### 3. Problem-Solution Validation
|
||||
|
||||
- **Problem Scope**: Does the solution address the actual problem?
|
||||
- **Evidence Alignment**: Does the solution match the evidence?
|
||||
- **Complexity Justification**: Is added complexity justified by real needs?
|
||||
- **Alternative Analysis**: What simpler solutions were considered?
|
||||
|
||||
### 4. Dependency Management & Environment Validation
|
||||
|
||||
- **Pre-build Validation**: Always validate critical dependencies before executing
|
||||
build scripts
|
||||
- **Environment Consistency**: Ensure team members have identical development
|
||||
environments
|
||||
- **Dependency Verification**: Check that required packages are installed and
|
||||
accessible
|
||||
- **Path Resolution**: Use `npx` for local dependencies to avoid PATH issues
|
||||
|
||||
## Required Workflows
|
||||
|
||||
### Before Proposing Changes
|
||||
|
||||
- [ ] **Code Path Tracing**: Map execution flow from entry to exit
|
||||
- [ ] **Evidence Collection**: Gather specific code citations and logs
|
||||
- [ ] **Assumption Surfacing**: Identify what's proven vs. inferred
|
||||
- [ ] **Scope Validation**: Confirm the actual extent of the problem
|
||||
- [ ] **Dependency Validation**: Verify all required dependencies are available
|
||||
and accessible
|
||||
|
||||
### During Solution Design
|
||||
|
||||
- [ ] **Evidence Alignment**: Ensure solution addresses proven problems
|
||||
- [ ] **Complexity Assessment**: Justify any added complexity
|
||||
- [ ] **Alternative Evaluation**: Consider simpler approaches first
|
||||
- [ ] **Impact Analysis**: Assess effects on existing systems
|
||||
- [ ] **Environment Impact**: Assess how changes affect team member setups
|
||||
|
||||
## Software-Specific Competence Hooks
|
||||
|
||||
### Evidence Validation
|
||||
|
||||
- **"What code path proves this claim?"**
|
||||
- **"How does data actually flow through the system?"**
|
||||
- **"What am I assuming vs. what can I prove?"**
|
||||
|
||||
### Code Tracing
|
||||
|
||||
- **"What's the execution path from user action to system response?"**
|
||||
- **"Which components actually interact in this scenario?"**
|
||||
- **"Where does the data originate and where does it end up?"**
|
||||
|
||||
### Architecture Decisions
|
||||
|
||||
- **"What evidence shows this change is necessary?"**
|
||||
- **"What simpler solution could achieve the same goal?"**
|
||||
- **"How does this change affect the existing system architecture?"**
|
||||
|
||||
### Dependency & Environment Management
|
||||
|
||||
- **"What dependencies does this feature require and are they properly
|
||||
declared?"**
|
||||
- **"How will this change affect team member development environments?"**
|
||||
- **"What validation can we add to catch dependency issues early?"**
|
||||
|
||||
## Dependency Management Best Practices
|
||||
|
||||
### Pre-build Validation
|
||||
|
||||
- **Check Critical Dependencies**: Validate essential tools before executing build
|
||||
scripts
|
||||
- **Use npx for Local Dependencies**: Prefer `npx tsx` over direct `tsx` to
|
||||
avoid PATH issues
|
||||
- **Environment Consistency**: Ensure all team members have identical dependency
|
||||
versions
|
||||
|
||||
### Common Pitfalls
|
||||
|
||||
- **Missing npm install**: Team members cloning without running `npm install`
|
||||
- **PATH Issues**: Direct command execution vs. npm script execution differences
|
||||
- **Version Mismatches**: Different Node.js/npm versions across team members
|
||||
|
||||
### Validation Strategies
|
||||
|
||||
- **Dependency Check Scripts**: Implement pre-build validation for critical
|
||||
dependencies
|
||||
- **Environment Requirements**: Document and enforce minimum Node.js/npm versions
|
||||
- **Onboarding Checklist**: Standardize team member setup procedures
|
||||
|
||||
### Error Messages and Guidance
|
||||
|
||||
- **Specific Error Context**: Provide clear guidance when dependency issues occur
|
||||
- **Actionable Solutions**: Direct users to specific commands (`npm install`,
|
||||
`npm run check:dependencies`)
|
||||
- **Environment Diagnostics**: Implement comprehensive environment validation
|
||||
tools
|
||||
|
||||
### Build Script Enhancements
|
||||
|
||||
- **Early Validation**: Check dependencies before starting build processes
|
||||
- **Graceful Degradation**: Continue builds when possible but warn about issues
|
||||
- **Helpful Tips**: Remind users about dependency management best practices
|
||||
|
||||
## Integration with Other Rulesets
|
||||
|
||||
### With base_context.mdc
|
||||
|
||||
- Inherits generic competence principles
|
||||
- Adds software-specific evidence requirements
|
||||
- Maintains collaboration and learning focus
|
||||
|
||||
### With research_diagnostic.mdc
|
||||
|
||||
- Enhances investigation with code path tracing
|
||||
- Adds evidence validation to diagnostic workflow
|
||||
- Strengthens problem identification accuracy
|
||||
|
||||
## Usage Guidelines
|
||||
|
||||
### When to Use This Ruleset
|
||||
|
||||
- Code reviews and architectural decisions
|
||||
- Bug investigation and debugging
|
||||
- Performance optimization
|
||||
- Feature implementation planning
|
||||
- Testing strategy development
|
||||
|
||||
### When to Combine with Others
|
||||
|
||||
- **base_context + software_development**: General development tasks
|
||||
- **research_diagnostic + software_development**: Technical investigations
|
||||
- **All three**: Complex architectural decisions or major refactoring
|
||||
|
||||
## Self-Check (model, before responding)
|
||||
|
||||
- [ ] Code path traced and documented
|
||||
- [ ] Evidence cited with specific file:line references
|
||||
- [ ] Assumptions clearly flagged as proven vs. inferred
|
||||
- [ ] Solution complexity justified by evidence
|
||||
- [ ] Simpler alternatives considered and documented
|
||||
- [ ] Impact on existing systems assessed
|
||||
- [ ] Dependencies validated and accessible
|
||||
- [ ] Environment impact assessed for team members
|
||||
- [ ] Pre-build validation implemented where appropriate
|
||||
|
||||
## Additional Core Principles
|
||||
|
||||
### 4. Dependency Management & Environment Validation
|
||||
- **Pre-build Validation**: Always validate critical dependencies before executing build scripts
|
||||
- **Environment Consistency**: Ensure team members have identical development environments
|
||||
- **Dependency Verification**: Check that required packages are installed and accessible
|
||||
- **Path Resolution**: Use `npx` for local dependencies to avoid PATH issues
|
||||
|
||||
## Additional Required Workflows
|
||||
|
||||
### Dependency Validation (Before Proposing Changes)
|
||||
- [ ] **Dependency Validation**: Verify all required dependencies are available and accessible
|
||||
|
||||
### Environment Impact Assessment (During Solution Design)
|
||||
- [ ] **Environment Impact**: Assess how changes affect team member setups
|
||||
|
||||
## Additional Competence Hooks
|
||||
|
||||
### Dependency & Environment Management
|
||||
- **"What dependencies does this feature require and are they properly declared?"**
|
||||
- **"How will this change affect team member development environments?"**
|
||||
- **"What validation can we add to catch dependency issues early?"**
|
||||
|
||||
## Dependency Management Best Practices
|
||||
|
||||
### Pre-build Validation
|
||||
- **Check Critical Dependencies**: Validate essential tools before executing build scripts
|
||||
- **Use npx for Local Dependencies**: Prefer `npx tsx` over direct `tsx` to avoid PATH issues
|
||||
- **Environment Consistency**: Ensure all team members have identical dependency versions
|
||||
|
||||
### Common Pitfalls
|
||||
- **Missing npm install**: Team members cloning without running `npm install`
|
||||
- **PATH Issues**: Direct command execution vs. npm script execution differences
|
||||
- **Version Mismatches**: Different Node.js/npm versions across team members
|
||||
|
||||
### Validation Strategies
|
||||
- **Dependency Check Scripts**: Implement pre-build validation for critical dependencies
|
||||
- **Environment Requirements**: Document and enforce minimum Node.js/npm versions
|
||||
- **Onboarding Checklist**: Standardize team member setup procedures
|
||||
|
||||
### Error Messages and Guidance
|
||||
- **Specific Error Context**: Provide clear guidance when dependency issues occur
|
||||
- **Actionable Solutions**: Direct users to specific commands (`npm install`, `npm run check:dependencies`)
|
||||
- **Environment Diagnostics**: Implement comprehensive environment validation tools
|
||||
|
||||
### Build Script Enhancements
|
||||
- **Early Validation**: Check dependencies before starting build processes
|
||||
- **Graceful Degradation**: Continue builds when possible but warn about issues
|
||||
- **Helpful Tips**: Remind users about dependency management best practices
|
||||
|
||||
- **Narrow Types Properly**: Use type guards to narrow `unknown` types safely
|
||||
- **Document Type Decisions**: Explain complex type structures and their purpose
|
||||
@@ -1,329 +0,0 @@
|
||||
---
|
||||
alwaysApply: true
|
||||
---
|
||||
# Time Handling in Development Workflow
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-17
|
||||
**Status**: 🎯 **ACTIVE** - Production Ready
|
||||
|
||||
## Overview
|
||||
|
||||
This guide establishes **how time should be referenced and used** across the
|
||||
development workflow. It is not tied to any one project, but applies to **all
|
||||
feature development, issue investigations, ADRs, and documentation**.
|
||||
|
||||
## General Principles
|
||||
|
||||
- **Explicit over relative**: Always prefer absolute dates (`2025-08-17`) over
|
||||
relative references like "last week."
|
||||
- **ISO 8601 Standard**: Use `YYYY-MM-DD` format for all date references in
|
||||
docs, issues, ADRs, and commits.
|
||||
- **Time zones**: Default to **UTC** unless explicitly tied to user-facing
|
||||
behavior.
|
||||
- **Precision**: Only specify as much precision as needed (date vs. datetime vs.
|
||||
timestamp).
|
||||
- **Consistency**: Align time references across ADRs, commits, and investigation
|
||||
reports.
|
||||
|
||||
## In Documentation & ADRs
|
||||
|
||||
- Record decision dates using **absolute ISO dates**.
|
||||
- For ongoing timelines, state start and end explicitly (e.g., `2025-08-01` →
|
||||
`2025-08-17`).
|
||||
- Avoid ambiguous terms like *recently*, *last month*, or *soon*.
|
||||
- For time-based experiments (e.g., A/B tests), always include:
|
||||
|
||||
- Start date
|
||||
- Expected duration
|
||||
- Review date checkpoint
|
||||
|
||||
## In Code & Commits
|
||||
|
||||
- Use **UTC timestamps** in logs, DB migrations, and serialized formats.
|
||||
- In commits, link changes to **date-bound ADRs or investigation docs**.
|
||||
- For migrations, include both **applied date** and **intended version window**.
|
||||
- Use constants for known fixed dates; avoid hardcoding arbitrary strings.
|
||||
|
||||
## In Investigations & Research
|
||||
|
||||
- Capture **when** an issue occurred (absolute time or version tag).
|
||||
- When describing failures: note whether they are **time-sensitive** (e.g., after
|
||||
migrations, cache expirations).
|
||||
- Record diagnostic timelines in ISO format (not relative).
|
||||
- For performance regressions, annotate both **baseline timeframe** and
|
||||
**measurement timeframe**.
|
||||
|
||||
## Collaboration Hooks
|
||||
|
||||
- During reviews, verify **time references are clear, absolute, and
|
||||
standardized**.
|
||||
- In syncs, reframe relative terms ("this week") into shared absolute
|
||||
references.
|
||||
- Tag ADRs with both **date created** and **review by** checkpoints.
|
||||
|
||||
## Self-Check Before Submitting
|
||||
|
||||
- [ ] Did I check the time using the **developer's actual system time and
|
||||
timezone**?
|
||||
- [ ] Am I using absolute ISO dates?
|
||||
- [ ] Is UTC assumed unless specified otherwise?
|
||||
- [ ] Did I avoid ambiguous relative terms?
|
||||
- [ ] If duration matters, did I specify both start and end?
|
||||
- [ ] For future work, did I include a review/revisit date?
|
||||
|
||||
## Real-Time Context in Developer Interactions
|
||||
|
||||
- The model must always resolve **"current time"** using the **developer's
|
||||
actual system time and timezone**.
|
||||
- When generating timestamps (e.g., in investigation logs, ADRs, or examples),
|
||||
the model should:
|
||||
|
||||
- Use the **developer's current local time** by default.
|
||||
- Indicate the timezone explicitly (e.g., `2025-08-17T10:32-05:00`).
|
||||
- Optionally provide UTC alongside if context requires cross-team clarity.
|
||||
|
||||
- When interpreting relative terms like *now*, *today*, *last week*:
|
||||
|
||||
- Resolve them against the **developer's current time**.
|
||||
- Convert them into **absolute ISO-8601 values** in the output.
|
||||
|
||||
## LLM Time Checking Instructions
|
||||
|
||||
**CRITICAL**: The LLM must actively query the system for current time rather
|
||||
than assuming or inventing times.
|
||||
|
||||
### How to Check Current Time
|
||||
|
||||
#### 1. **Query System Time (Required)**
|
||||
|
||||
- **Always start** by querying the current system time using available tools
|
||||
- **Never assume** what the current time is
|
||||
- **Never use** placeholder values like "current time" or "now"
|
||||
|
||||
#### 2. **Available Time Query Methods**
|
||||
|
||||
- **System Clock**: Use `date` command or equivalent system time function
|
||||
- **Programming Language**: Use language-specific time functions (e.g.,
|
||||
`Date.now()`, `datetime.now()`)
|
||||
- **Environment Variables**: Check for time-related environment variables
|
||||
- **API Calls**: Use time service APIs if available
|
||||
|
||||
#### 3. **Required Time Information**
|
||||
|
||||
When querying time, always obtain:
|
||||
|
||||
- **Current Date**: YYYY-MM-DD format
|
||||
- **Current Time**: HH:MM:SS format (24-hour)
|
||||
- **Timezone**: Current system timezone or UTC offset
|
||||
- **UTC Equivalent**: Convert local time to UTC for cross-team clarity
|
||||
|
||||
#### 4. **Time Query Examples**
|
||||
|
||||
```bash
|
||||
# Example: Query system time
|
||||
$ date
|
||||
# Expected output: Mon Aug 17 10:32:45 EDT 2025
|
||||
|
||||
# Example: Query UTC time
|
||||
$ date -u
|
||||
# Expected output: Mon Aug 17 14:32:45 UTC 2025
|
||||
```
|
||||
|
||||
```python
|
||||
# Example: Python time query
|
||||
import datetime
|
||||
current_time = datetime.datetime.now()
|
||||
utc_time = datetime.datetime.utcnow()
|
||||
print(f"Local: {current_time}")
|
||||
print(f"UTC: {utc_time}")
|
||||
```
|
||||
|
||||
```javascript
|
||||
// Example: JavaScript time query
|
||||
const now = new Date();
|
||||
const utc = new Date().toISOString();
|
||||
console.log(`Local: ${now}`);
|
||||
console.log(`UTC: ${utc}`);
|
||||
```
|
||||
|
||||
#### 5. **LLM Time Checking Workflow**
|
||||
|
||||
1. **Query**: Actively query system for current time
|
||||
2. **Validate**: Confirm time data is reasonable and current
|
||||
3. **Format**: Convert to ISO 8601 format
|
||||
4. **Context**: Provide both local and UTC times when helpful
|
||||
5. **Document**: Show the source of time information
|
||||
|
||||
#### 6. **Error Handling for Time Queries**
|
||||
|
||||
- **If time query fails**: Ask user for current time or use "unknown time"
|
||||
with explanation
|
||||
- **If timezone unclear**: Default to UTC and ask for clarification
|
||||
- **If time seems wrong**: Verify with user before proceeding
|
||||
- **Always log**: Record when and how time was obtained
|
||||
|
||||
#### 7. **Time Query Verification**
|
||||
|
||||
Before using queried time, verify:
|
||||
|
||||
- [ ] Time is recent (within last few minutes)
|
||||
- [ ] Timezone information is available
|
||||
- [ ] UTC conversion is accurate
|
||||
- [ ] Format follows ISO 8601 standard
|
||||
|
||||
## Model Behavior Rules
|
||||
|
||||
- **Never invent a "fake now"**: All "current time" references must come from
|
||||
the real system clock available at runtime.
|
||||
- **Check developer time zone**: If ambiguous, ask for clarification (e.g.,
|
||||
"Should I use UTC or your local timezone?").
|
||||
- **Format for clarity**:
|
||||
|
||||
- Local time: `YYYY-MM-DDTHH:mm±hh:mm`
|
||||
- UTC equivalent (if needed): `YYYY-MM-DDTHH:mmZ`
|
||||
|
||||
## Examples
|
||||
|
||||
### Good
|
||||
|
||||
- "Feature flag rollout started on `2025-08-01` and will be reviewed on
|
||||
`2025-08-21`."
|
||||
- "Migration applied on `2025-07-15T14:00Z`."
|
||||
- "Issue reproduced on `2025-08-17T09:00-05:00 (local)` /
|
||||
`2025-08-17T14:00Z (UTC)`."
|
||||
|
||||
### Bad
|
||||
|
||||
- "Feature flag rolled out last week."
|
||||
- "Migration applied recently."
|
||||
- "Now is August, so we assume this was last month."
|
||||
|
||||
### More Examples
|
||||
|
||||
#### Issue Reports
|
||||
|
||||
- ✅ **Good**: "User reported login failure at `2025-08-17T14:30:00Z`. Issue
|
||||
persisted until `2025-08-17T15:45:00Z`."
|
||||
- ❌ **Bad**: "User reported login failure earlier today. Issue lasted for a
|
||||
while."
|
||||
|
||||
#### Release Planning
|
||||
|
||||
- ✅ **Good**: "Feature X scheduled for release on `2025-08-25`. Testing
|
||||
window: `2025-08-20` to `2025-08-24`."
|
||||
- ❌ **Bad**: "Feature X will be released next week after testing."
|
||||
|
||||
#### Performance Monitoring
|
||||
|
||||
- ✅ **Good**: "Baseline performance measured on `2025-08-10T09:00:00Z`.
|
||||
Regression detected on `2025-08-15T14:00:00Z`."
|
||||
- ❌ **Bad**: "Performance was good last week but got worse this week."
|
||||
|
||||
## Technical Implementation Notes
|
||||
|
||||
### UTC Storage Principle
|
||||
|
||||
- **Store all timestamps in UTC** in databases, logs, and serialized formats
|
||||
- **Convert to local time only for user display**
|
||||
- **Use ISO 8601 format** for all storage: `YYYY-MM-DDTHH:mm:ss.sssZ`
|
||||
|
||||
### Common Implementation Patterns
|
||||
|
||||
#### Database Storage
|
||||
|
||||
```sql
|
||||
-- ✅ Good: Store in UTC
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
|
||||
-- ❌ Bad: Store in local time
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
```
|
||||
|
||||
#### API Responses
|
||||
|
||||
```json
|
||||
// ✅ Good: Include both UTC and local time
|
||||
{
|
||||
"eventTime": "2025-08-17T14:00:00Z",
|
||||
"localTime": "2025-08-17T10:00:00-04:00",
|
||||
"timezone": "America/New_York"
|
||||
}
|
||||
|
||||
// ❌ Bad: Only local time
|
||||
{
|
||||
"eventTime": "2025-08-17T10:00:00-04:00"
|
||||
}
|
||||
```
|
||||
|
||||
#### Logging
|
||||
|
||||
```python
|
||||
# ✅ Good: Log in UTC with timezone info
|
||||
logger.info(f"User action at {datetime.utcnow().isoformat()}Z (UTC)")
|
||||
|
||||
# ❌ Bad: Log in local time
|
||||
logger.info(f"User action at {datetime.now()}")
|
||||
```
|
||||
|
||||
### Timezone Handling Best Practices
|
||||
|
||||
#### 1. Always Store Timezone Information
|
||||
|
||||
- Include IANA timezone identifier (e.g., `America/New_York`)
|
||||
- Store UTC offset at time of creation
|
||||
- Handle daylight saving time transitions automatically
|
||||
|
||||
#### 2. User Display Considerations
|
||||
|
||||
- Convert UTC to user's preferred timezone
|
||||
- Show timezone abbreviation when helpful
|
||||
- Use relative time for recent events ("2 hours ago")
|
||||
|
||||
#### 3. Edge Case Handling
|
||||
|
||||
- **Daylight Saving Time**: Use timezone-aware libraries
|
||||
- **Leap Seconds**: Handle gracefully (rare but important)
|
||||
- **Invalid Times**: Validate before processing
|
||||
|
||||
### Common Mistakes to Avoid
|
||||
|
||||
#### 1. Timezone Confusion
|
||||
|
||||
- ❌ **Don't**: Assume server timezone is user timezone
|
||||
- ✅ **Do**: Always convert UTC to user's local time for display
|
||||
|
||||
#### 2. Format Inconsistency
|
||||
|
||||
- ❌ **Don't**: Mix different time formats in the same system
|
||||
- ✅ **Do**: Standardize on ISO 8601 for all storage
|
||||
|
||||
#### 3. Relative Time References
|
||||
|
||||
- ❌ **Don't**: Use relative terms in persistent storage
|
||||
- ✅ **Do**: Convert relative terms to absolute timestamps immediately
|
||||
|
||||
## References
|
||||
|
||||
- [ISO 8601 Date and Time Standard](https://en.wikipedia.org/wiki/ISO_8601)
|
||||
- [IANA Timezone Database](https://www.iana.org/time-zones)
|
||||
- [ADR Template](./adr_template.md)
|
||||
- [Research & Diagnostic Workflow](./research_diagnostic.mdc)
|
||||
|
||||
---
|
||||
|
||||
**Rule of Thumb**: Every time reference in development artifacts should be
|
||||
**clear in 6 months without context**, and aligned to the **developer's actual
|
||||
current time**.
|
||||
|
||||
**Technical Rule of Thumb**: **Store in UTC, display in local time, always
|
||||
include timezone context.**
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active
|
||||
**Version**: 1.0
|
||||
**Maintainer**: Matthew Raymer
|
||||
**Next Review**: 2025-09-17
|
||||
276
.cursor/rules/timesafari.mdc
Normal file
@@ -0,0 +1,276 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
# Time Safari Context
|
||||
|
||||
## Project Overview
|
||||
|
||||
Time Safari is an application designed to foster community building through gifts, gratitude, and collaborative projects. The app should make it extremely easy and intuitive for users of any age and capability to recognize contributions, build trust networks, and organize collective action. It is built on services that preserve privacy and data sovereignty.
|
||||
|
||||
The ultimate goals of Time Safari are two-fold:
|
||||
|
||||
1. **Connect** Make it easy, rewarding, and non-threatening for people to connect with others who have similar interests, and to initiate activities together. This helps people accomplish and learn from other individuals in less-structured environments; moreover, it helps them discover who they want to continue to support and with whom they want to maintain relationships.
|
||||
|
||||
2. **Reveal** Widely advertise the great support and rewards that are being given and accepted freely, especially non-monetary ones. Using visuals and text, display the kind of impact that gifts are making in the lives of others. Also show useful and engaging reports of project statistics and personal accomplishments.
|
||||
|
||||
|
||||
## Core Approaches
|
||||
|
||||
Time Safari should help everyday users build meaningful connections and organize collective efforts by:
|
||||
|
||||
1. **Recognizing Contributions**: Creating permanent, verifiable records of gifts and contributions people give to each other and their communities.
|
||||
|
||||
2. **Facilitating Collaboration**: Making it ridiculously easy for people to ask for or propose help on projects and interests that matter to them.
|
||||
|
||||
3. **Building Trust Networks**: Enabling users to maintain their network and activity visibility. Developing reputation through verified contributions and references, which can be selectively shown to others outside the network.
|
||||
|
||||
4. **Preserving Privacy**: Ensuring personal identifiers are only shared with explicitly authorized contacts, allowing private individuals including children to participate safely.
|
||||
|
||||
5. **Engaging Content**: Displaying people's records in compelling stories, and highlighting those projects that are lifting people's lives long-term, both in physical support and in emotional-spiritual-creative thriving.
|
||||
|
||||
|
||||
## Technical Foundation
|
||||
|
||||
This application is built on a privacy-preserving claims architecture (via endorser.ch) with these key characteristics:
|
||||
|
||||
- **Decentralized Identifiers (DIDs)**: User identities are based on public/private key pairs stored on their devices
|
||||
- **Cryptographic Verification**: All claims and confirmations are cryptographically signed
|
||||
- **User-Controlled Visibility**: Users explicitly control who can see their identifiers and data
|
||||
- **Merkle-Chained Claims**: Claims are cryptographically chained for verification and integrity
|
||||
- **Native and Web App**: Works on Capacitor (iOS, Android), Desktop (Electron and CEFPython), and web browsers
|
||||
|
||||
## User Journey
|
||||
|
||||
The typical progression of usage follows these stages:
|
||||
|
||||
1. **Gratitude & Recognition**: Users begin by expressing and recording gratitude for gifts received, building a foundation of acknowledgment.
|
||||
|
||||
2. **Project Proposals**: Users propose projects and ideas, reaching out to connect with others who share similar interests.
|
||||
|
||||
3. **Action Triggers**: Offers of help serve as triggers and motivations to execute proposed projects, moving from ideas to action.
|
||||
|
||||
## Context for LLM Development
|
||||
|
||||
When developing new functionality for Time Safari, consider these design principles:
|
||||
|
||||
1. **Accessibility First**: Features should be usable by non-technical users with minimal learning curve.
|
||||
|
||||
2. **Privacy by Design**: All features must respect user privacy and data sovereignty.
|
||||
|
||||
3. **Progressive Enhancement**: Core functionality should work across all devices, with richer experiences where supported.
|
||||
|
||||
4. **Voluntary Collaboration**: The system should enable but never coerce participation.
|
||||
|
||||
5. **Trust Building**: Features should help build verifiable trust between users.
|
||||
|
||||
6. **Network Effects**: Consider how features scale as more users join the platform.
|
||||
|
||||
7. **Low Resource Requirements**: The system should be lightweight enough to run on inexpensive devices users already own.
|
||||
|
||||
## Use Cases to Support
|
||||
|
||||
LLM development should focus on enhancing these key use cases:
|
||||
|
||||
1. **Community Building**: Tools that help people find others with shared interests and values.
|
||||
|
||||
2. **Project Coordination**: Features that make it easy to propose collaborative projects and to submit suggestions and offers to existing ones.
|
||||
|
||||
3. **Reputation Building**: Methods for users to showcase their contributions and reliability, in contexts where they explicitly reveal that information.
|
||||
|
||||
4. **Governance Experimentation**: Features that facilitate decision-making and collective governance.
|
||||
|
||||
## Constraints
|
||||
|
||||
When developing new features, be mindful of these constraints:
|
||||
|
||||
1. **Privacy Preservation**: User identifiers must remain private except when explicitly shared.
|
||||
|
||||
2. **Platform Limitations**: Features must work within the constraints of the target app platforms, while aiming to leverage the best platform technology available.
|
||||
|
||||
3. **Endorser API Limitations**: Backend features are constrained by the endorser.ch API capabilities.
|
||||
|
||||
4. **Performance on Low-End Devices**: The application should remain performant on older/simpler devices.
|
||||
|
||||
5. **Offline-First When Possible**: Key functionality should work offline when feasible.
|
||||
|
||||
## Project Technologies
|
||||
|
||||
- Typescript using ES6 classes using vue-facing-decorator
|
||||
- TailwindCSS
|
||||
- Vite Build Tool
|
||||
- Playwright E2E testing
|
||||
- IndexDB
|
||||
- Camera, Image uploads, QR Code reader, ...
|
||||
|
||||
## Mobile Features
|
||||
|
||||
- Deep Linking
|
||||
- Local Notifications via a custom Capacitor plugin
|
||||
|
||||
## Project Architecture
|
||||
|
||||
- The application must work on web browser, PWA (Progressive Web Application), desktop via Electron, and mobile via Capacitor
|
||||
- Building for each platform is managed via Vite
|
||||
|
||||
## Core Development Principles
|
||||
|
||||
### DRY development
|
||||
- **Code Reuse**
|
||||
- Extract common functionality into utility functions
|
||||
- Create reusable components for UI patterns
|
||||
- Implement service classes for shared business logic
|
||||
- Use mixins for cross-cutting concerns
|
||||
- Leverage TypeScript interfaces for shared type definitions
|
||||
|
||||
- **Component Patterns**
|
||||
- Create base components for common UI elements
|
||||
- Implement higher-order components for shared behavior
|
||||
- Use slot patterns for flexible component composition
|
||||
- Create composable services for business logic
|
||||
- Implement factory patterns for component creation
|
||||
|
||||
- **State Management**
|
||||
- Centralize state in Pinia stores
|
||||
- Use computed properties for derived state
|
||||
- Implement shared state selectors
|
||||
- Create reusable state mutations
|
||||
- Use action creators for common operations
|
||||
|
||||
- **Error Handling**
|
||||
- Implement centralized error handling
|
||||
- Create reusable error components
|
||||
- Use error boundary components
|
||||
- Implement consistent error logging
|
||||
- Create error type definitions
|
||||
|
||||
- **Type Definitions**
|
||||
- Create shared interfaces for common data structures
|
||||
- Use type aliases for complex types
|
||||
- Implement generic types for reusable components
|
||||
- Create utility types for common patterns
|
||||
- Use discriminated unions for state management
|
||||
|
||||
- **API Integration**
|
||||
- Create reusable API client classes
|
||||
- Implement request/response interceptors
|
||||
- Use consistent error handling patterns
|
||||
- Create type-safe API endpoints
|
||||
- Implement caching strategies
|
||||
|
||||
- **Platform Services**
|
||||
- Abstract platform-specific code behind interfaces
|
||||
- Create platform-agnostic service layers
|
||||
- Implement feature detection
|
||||
- Use dependency injection for services
|
||||
- Create service factories
|
||||
|
||||
- **Testing**
|
||||
- Create reusable test utilities
|
||||
- Implement test factories
|
||||
- Use shared test configurations
|
||||
- Create reusable test helpers
|
||||
- Implement consistent test patterns
|
||||
|
||||
### SOLID Principles
|
||||
- **Single Responsibility**: Each class/component should have only one reason to change
|
||||
- Components should focus on one specific feature (e.g., QR scanning, DID management)
|
||||
- Services should handle one type of functionality (e.g., platform services, crypto services)
|
||||
- Utilities should provide focused helper functions
|
||||
|
||||
- **Open/Closed**: Software entities should be open for extension but closed for modification
|
||||
- Use interfaces for service definitions
|
||||
- Implement plugin architecture for platform-specific features
|
||||
- Allow component behavior extension through props and events
|
||||
|
||||
- **Liskov Substitution**: Objects should be replaceable with their subtypes
|
||||
- Platform services should work consistently across web/mobile
|
||||
- Authentication providers should be interchangeable
|
||||
- Storage implementations should be swappable
|
||||
|
||||
- **Interface Segregation**: Clients shouldn't depend on interfaces they don't use
|
||||
- Break down large service interfaces into smaller, focused ones
|
||||
- Component props should be minimal and purposeful
|
||||
- Event emissions should be specific and targeted
|
||||
|
||||
- **Dependency Inversion**: High-level modules shouldn't depend on low-level modules
|
||||
- Use dependency injection for services
|
||||
- Abstract platform-specific code behind interfaces
|
||||
- Implement factory patterns for component creation
|
||||
|
||||
### Law of Demeter
|
||||
- Components should only communicate with immediate dependencies
|
||||
- Avoid chaining method calls (e.g., `this.service.getUser().getProfile().getName()`)
|
||||
- Use mediator patterns for complex component interactions
|
||||
- Implement facade patterns for subsystem access
|
||||
- Keep component communication through defined events and props
|
||||
|
||||
### Composition over Inheritance
|
||||
- Prefer building components through composition
|
||||
- Use mixins for shared functionality
|
||||
- Implement feature toggles through props
|
||||
- Create higher-order components for common patterns
|
||||
- Use service composition for complex features
|
||||
|
||||
### Interface Segregation
|
||||
- Define clear interfaces for services
|
||||
- Keep component APIs minimal and focused
|
||||
- Split large interfaces into smaller, specific ones
|
||||
- Use TypeScript interfaces for type definitions
|
||||
- Implement role-based interfaces for different use cases
|
||||
|
||||
### Fail Fast
|
||||
- Validate inputs early in the process
|
||||
- Use TypeScript strict mode
|
||||
- Implement comprehensive error handling
|
||||
- Add runtime checks for critical operations
|
||||
- Use assertions for development-time validation
|
||||
|
||||
### Principle of Least Astonishment
|
||||
- Follow Vue.js conventions consistently
|
||||
- Use familiar naming patterns
|
||||
- Implement predictable component behaviors
|
||||
- Maintain consistent error handling
|
||||
- Keep UI interactions intuitive
|
||||
|
||||
### Information Hiding
|
||||
- Encapsulate implementation details
|
||||
- Use private class members
|
||||
- Implement proper access modifiers
|
||||
- Hide complex logic behind simple interfaces
|
||||
- Use TypeScript's access modifiers effectively
|
||||
|
||||
### Single Source of Truth
|
||||
- Use Pinia for state management
|
||||
- Maintain one source for user data
|
||||
- Centralize configuration management
|
||||
- Use computed properties for derived state
|
||||
- Implement proper state synchronization
|
||||
|
||||
### Principle of Least Privilege
|
||||
- Implement proper access control
|
||||
- Use minimal required permissions
|
||||
- Follow privacy-by-design principles
|
||||
- Restrict component access to necessary data
|
||||
- Implement proper authentication/authorization
|
||||
|
||||
### Continuous Integration/Continuous Deployment (CI/CD)
|
||||
- Automated testing on every commit
|
||||
- Consistent build process across platforms
|
||||
- Automated deployment pipelines
|
||||
- Quality gates for code merging
|
||||
- Environment-specific configurations
|
||||
|
||||
This expanded documentation provides:
|
||||
1. Clear principles for development
|
||||
2. Practical implementation guidelines
|
||||
3. Real-world examples
|
||||
4. TypeScript integration
|
||||
5. Best practices for Time Safari
|
||||
|
||||
267
.cursor/rules/wa-sqlite.mdc
Normal file
@@ -0,0 +1,267 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
# wa-sqlite Usage Guide
|
||||
|
||||
## Table of Contents
|
||||
- [1. Overview](#1-overview)
|
||||
- [2. Installation](#2-installation)
|
||||
- [3. Basic Setup](#3-basic-setup)
|
||||
- [3.1 Import and Initialize](#31-import-and-initialize)
|
||||
- [3.2 Basic Database Operations](#32-basic-database-operations)
|
||||
- [4. Virtual File Systems (VFS)](#4-virtual-file-systems-vfs)
|
||||
- [4.1 Available VFS Options](#41-available-vfs-options)
|
||||
- [4.2 Using a VFS](#42-using-a-vfs)
|
||||
- [5. Best Practices](#5-best-practices)
|
||||
- [5.1 Error Handling](#51-error-handling)
|
||||
- [5.2 Transaction Management](#52-transaction-management)
|
||||
- [5.3 Prepared Statements](#53-prepared-statements)
|
||||
- [6. Performance Considerations](#6-performance-considerations)
|
||||
- [7. Common Issues and Solutions](#7-common-issues-and-solutions)
|
||||
- [8. TypeScript Support](#8-typescript-support)
|
||||
|
||||
## 1. Overview
|
||||
wa-sqlite is a WebAssembly build of SQLite that enables SQLite database operations in web browsers and JavaScript environments. It provides both synchronous and asynchronous builds, with support for custom virtual file systems (VFS) for persistent storage.
|
||||
|
||||
## 2. Installation
|
||||
```bash
|
||||
npm install wa-sqlite
|
||||
# or
|
||||
yarn add wa-sqlite
|
||||
```
|
||||
|
||||
## 3. Basic Setup
|
||||
|
||||
### 3.1 Import and Initialize
|
||||
```javascript
|
||||
// Choose one of these imports based on your needs:
|
||||
// - wa-sqlite.mjs: Synchronous build
|
||||
// - wa-sqlite-async.mjs: Asynchronous build (required for async VFS)
|
||||
// - wa-sqlite-jspi.mjs: JSPI-based async build (experimental, Chromium only)
|
||||
import SQLiteESMFactory from 'wa-sqlite/dist/wa-sqlite.mjs';
|
||||
import * as SQLite from 'wa-sqlite';
|
||||
|
||||
async function initDatabase() {
|
||||
// Initialize SQLite module
|
||||
const module = await SQLiteESMFactory();
|
||||
const sqlite3 = SQLite.Factory(module);
|
||||
|
||||
// Open database (returns a Promise)
|
||||
const db = await sqlite3.open_v2('myDatabase');
|
||||
return { sqlite3, db };
|
||||
}
|
||||
```
|
||||
|
||||
### 3.2 Basic Database Operations
|
||||
```javascript
|
||||
async function basicOperations() {
|
||||
const { sqlite3, db } = await initDatabase();
|
||||
|
||||
try {
|
||||
// Create a table
|
||||
await sqlite3.exec(db, `
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
email TEXT UNIQUE
|
||||
)
|
||||
`);
|
||||
|
||||
// Insert data
|
||||
await sqlite3.exec(db, `
|
||||
INSERT INTO users (name, email)
|
||||
VALUES ('John Doe', 'john@example.com')
|
||||
`);
|
||||
|
||||
// Query data
|
||||
const results = [];
|
||||
await sqlite3.exec(db, 'SELECT * FROM users', (row, columns) => {
|
||||
results.push({ row, columns });
|
||||
});
|
||||
|
||||
return results;
|
||||
} finally {
|
||||
// Always close the database when done
|
||||
await sqlite3.close(db);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 4. Virtual File Systems (VFS)
|
||||
|
||||
### 4.1 Available VFS Options
|
||||
wa-sqlite provides several VFS implementations for persistent storage:
|
||||
|
||||
1. **IDBBatchAtomicVFS** (Recommended for general use)
|
||||
- Uses IndexedDB with batch atomic writes
|
||||
- Works in all contexts (Window, Worker, Service Worker)
|
||||
- Supports WAL mode
|
||||
- Best performance with `PRAGMA synchronous=normal`
|
||||
|
||||
2. **IDBMirrorVFS**
|
||||
- Keeps files in memory, persists to IndexedDB
|
||||
- Works in all contexts
|
||||
- Good for smaller databases
|
||||
|
||||
3. **OPFS-based VFS** (Origin Private File System)
|
||||
- Various implementations available:
|
||||
- AccessHandlePoolVFS
|
||||
- OPFSAdaptiveVFS
|
||||
- OPFSCoopSyncVFS
|
||||
- OPFSPermutedVFS
|
||||
- Better performance but limited to Worker contexts
|
||||
|
||||
### 4.2 Using a VFS
|
||||
```javascript
|
||||
import { IDBBatchAtomicVFS } from 'wa-sqlite/src/examples/IDBBatchAtomicVFS.js';
|
||||
import SQLiteESMFactory from 'wa-sqlite/dist/wa-sqlite-async.mjs';
|
||||
import * as SQLite from 'wa-sqlite';
|
||||
|
||||
async function initDatabaseWithVFS() {
|
||||
const module = await SQLiteESMFactory();
|
||||
const sqlite3 = SQLite.Factory(module);
|
||||
|
||||
// Register VFS
|
||||
const vfs = await IDBBatchAtomicVFS.create('myApp', module);
|
||||
sqlite3.vfs_register(vfs, true);
|
||||
|
||||
// Open database with VFS
|
||||
const db = await sqlite3.open_v2('myDatabase');
|
||||
|
||||
// Configure for better performance
|
||||
await sqlite3.exec(db, 'PRAGMA synchronous = normal');
|
||||
await sqlite3.exec(db, 'PRAGMA journal_mode = WAL');
|
||||
|
||||
return { sqlite3, db };
|
||||
}
|
||||
```
|
||||
|
||||
## 5. Best Practices
|
||||
|
||||
### 5.1 Error Handling
|
||||
```javascript
|
||||
async function safeDatabaseOperation() {
|
||||
const { sqlite3, db } = await initDatabase();
|
||||
|
||||
try {
|
||||
await sqlite3.exec(db, 'SELECT * FROM non_existent_table');
|
||||
} catch (error) {
|
||||
if (error.code === SQLite.SQLITE_ERROR) {
|
||||
console.error('SQL error:', error.message);
|
||||
} else {
|
||||
console.error('Database error:', error);
|
||||
}
|
||||
} finally {
|
||||
await sqlite3.close(db);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 5.2 Transaction Management
|
||||
```javascript
|
||||
async function transactionExample() {
|
||||
const { sqlite3, db } = await initDatabase();
|
||||
|
||||
try {
|
||||
await sqlite3.exec(db, 'BEGIN TRANSACTION');
|
||||
|
||||
// Perform multiple operations
|
||||
await sqlite3.exec(db, 'INSERT INTO users (name) VALUES (?)', ['Alice']);
|
||||
await sqlite3.exec(db, 'INSERT INTO users (name) VALUES (?)', ['Bob']);
|
||||
|
||||
await sqlite3.exec(db, 'COMMIT');
|
||||
} catch (error) {
|
||||
await sqlite3.exec(db, 'ROLLBACK');
|
||||
throw error;
|
||||
} finally {
|
||||
await sqlite3.close(db);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 5.3 Prepared Statements
|
||||
```javascript
|
||||
async function preparedStatementExample() {
|
||||
const { sqlite3, db } = await initDatabase();
|
||||
|
||||
try {
|
||||
// Prepare statement
|
||||
const stmt = await sqlite3.prepare(db, 'SELECT * FROM users WHERE id = ?');
|
||||
|
||||
// Execute with different parameters
|
||||
await sqlite3.bind(stmt, 1, 1);
|
||||
while (await sqlite3.step(stmt) === SQLite.SQLITE_ROW) {
|
||||
const row = sqlite3.row(stmt);
|
||||
console.log(row);
|
||||
}
|
||||
|
||||
// Reset and reuse
|
||||
await sqlite3.reset(stmt);
|
||||
await sqlite3.bind(stmt, 1, 2);
|
||||
// ... execute again
|
||||
|
||||
await sqlite3.finalize(stmt);
|
||||
} finally {
|
||||
await sqlite3.close(db);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 6. Performance Considerations
|
||||
|
||||
1. **VFS Selection**
|
||||
- Use IDBBatchAtomicVFS for general-purpose applications
|
||||
- Consider OPFS-based VFS for better performance in Worker contexts
|
||||
- Use MemoryVFS for temporary databases
|
||||
|
||||
2. **Configuration**
|
||||
- Set appropriate page size (default is usually fine)
|
||||
- Use WAL mode for better concurrency
|
||||
- Consider `PRAGMA synchronous=normal` for better performance
|
||||
- Adjust cache size based on your needs
|
||||
|
||||
3. **Concurrency**
|
||||
- Use transactions for multiple operations
|
||||
- Be aware of VFS-specific concurrency limitations
|
||||
- Consider using Web Workers for heavy database operations
|
||||
|
||||
## 7. Common Issues and Solutions
|
||||
|
||||
1. **Database Locking**
|
||||
- Use appropriate transaction isolation levels
|
||||
- Implement retry logic for busy errors
|
||||
- Consider using WAL mode
|
||||
|
||||
2. **Storage Limitations**
|
||||
- Be aware of browser storage quotas
|
||||
- Implement cleanup strategies
|
||||
- Monitor database size
|
||||
|
||||
3. **Cross-Context Access**
|
||||
- Use appropriate VFS for your context
|
||||
- Consider message passing for cross-context communication
|
||||
- Be aware of storage access limitations
|
||||
|
||||
## 8. TypeScript Support
|
||||
wa-sqlite includes TypeScript definitions. The main types are:
|
||||
|
||||
```typescript
|
||||
type SQLiteCompatibleType = number | string | Uint8Array | Array<number> | bigint | null;
|
||||
|
||||
interface SQLiteAPI {
|
||||
open_v2(filename: string, flags?: number, zVfs?: string): Promise<number>;
|
||||
exec(db: number, sql: string, callback?: (row: any[], columns: string[]) => void): Promise<number>;
|
||||
close(db: number): Promise<number>;
|
||||
// ... other methods
|
||||
}
|
||||
```
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [Official GitHub Repository](https://github.com/rhashimoto/wa-sqlite)
|
||||
- [Online Demo](https://rhashimoto.github.io/wa-sqlite/demo/)
|
||||
- [API Reference](https://rhashimoto.github.io/wa-sqlite/docs/)
|
||||
- [FAQ](https://github.com/rhashimoto/wa-sqlite/issues?q=is%3Aissue+label%3Afaq+)
|
||||
- [Discussion Forums](https://github.com/rhashimoto/wa-sqlite/discussions)
|
||||
@@ -1,335 +0,0 @@
|
||||
---
|
||||
description: interacting with git
|
||||
alwaysApply: false
|
||||
---
|
||||
# Directive: Peaceful Co-Existence with Developers
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Date**: 2025-08-19
|
||||
**Status**: 🎯 **ACTIVE** - Version control guidelines
|
||||
|
||||
## 1) Version-Control Ownership
|
||||
|
||||
- **MUST NOT** run `git add`, `git commit`, or any write action.
|
||||
- **MUST** leave staging/committing to the developer.
|
||||
|
||||
## 2) Source of Truth for Commit Text
|
||||
|
||||
- **MUST** derive messages **only** from:
|
||||
- files **staged** for commit (primary), and
|
||||
- files **awaiting staging** (context).
|
||||
- **MUST** use the **diffs** to inform content.
|
||||
- **MUST NOT** invent changes or imply work not present in diffs.
|
||||
|
||||
## 3) Mandatory Preview Flow
|
||||
|
||||
- **ALWAYS** present, before any real commit:
|
||||
- file list + brief per-file notes,
|
||||
- a **draft commit message** (copy-paste ready),
|
||||
- nothing auto-applied.
|
||||
|
||||
## 4) Version Synchronization Requirements
|
||||
|
||||
- **MUST** check for version changes in `package.json` before committing
|
||||
- **MUST** ensure `CHANGELOG.md` is updated when `package.json` version
|
||||
changes
|
||||
- **MUST** validate version format consistency between both files
|
||||
- **MUST** include version bump commits in changelog with proper semantic
|
||||
versioning
|
||||
|
||||
### Version Sync Checklist (Before Commit)
|
||||
|
||||
- [ ] `package.json` version matches latest `CHANGELOG.md` entry
|
||||
- [ ] New version follows semantic versioning
|
||||
(MAJOR.MINOR.PATCH[-PRERELEASE])
|
||||
- [ ] Changelog entry includes all significant changes since last version
|
||||
- [ ] Version bump commit message follows `build(version): bump to X.Y.Z`
|
||||
format
|
||||
- [ ] Breaking changes properly documented with migration notes
|
||||
- [ ] Alert developer in chat message that version has been updated
|
||||
|
||||
### Version Change Detection
|
||||
|
||||
- **Check for version changes** in staged/unstaged `package.json`
|
||||
- **Alert developer** if version changed but changelog not updated
|
||||
- **Suggest changelog update** with proper format and content
|
||||
- **Validate semantic versioning** compliance
|
||||
|
||||
### Implementation Notes
|
||||
|
||||
- **Version Detection**: Compare `package.json` version field with latest
|
||||
changelog entry
|
||||
- **Semantic Validation**: Ensure version follows `X.Y.Z[-PRERELEASE]`
|
||||
format
|
||||
- **Changelog Format**: Follow [Keep a Changelog](https://keepachangelog.com/)
|
||||
standards
|
||||
- **Breaking Changes**: Use `!` in commit message and `BREAKING CHANGE:`
|
||||
in changelog
|
||||
- **Pre-release Versions**: Include beta/alpha/rc suffixes in both files
|
||||
consistently
|
||||
|
||||
## Commit Message Format (Normative)
|
||||
|
||||
### A. Subject Line (required)
|
||||
|
||||
```
|
||||
<type>(<scope>)<!>: <summary>
|
||||
```
|
||||
|
||||
- **type** (lowercase, Conventional Commits):
|
||||
`feat|fix|refactor|perf|docs|test|build|chore|ci|revert`
|
||||
- **scope**: optional module/package/area (e.g., `api`, `ui/login`, `db`)
|
||||
- **!**: include when a breaking change is introduced
|
||||
- **summary**: imperative mood, ≤ 72 chars, no trailing period
|
||||
|
||||
**Examples**
|
||||
|
||||
- `fix(api): handle null token in refresh path`
|
||||
- `feat(ui/login)!: require OTP after 3 failed attempts`
|
||||
|
||||
### B. Body (optional, when it adds non-obvious value)
|
||||
|
||||
- One blank line after subject.
|
||||
- Wrap at ~72 chars.
|
||||
- Explain **what** and **why**, not line-by-line "how".
|
||||
- Include brief notes like tests passing or TS/lint issues resolved
|
||||
**only if material**.
|
||||
|
||||
**Body checklist**
|
||||
|
||||
- [ ] Problem/symptom being addressed
|
||||
- [ ] High-level approach or rationale
|
||||
- [ ] Risks, tradeoffs, or follow-ups (if any)
|
||||
|
||||
### C. Footer (optional)
|
||||
|
||||
- Issue refs: `Closes #123`, `Refs #456`
|
||||
- Breaking change (alternative to `!`):
|
||||
`BREAKING CHANGE: <impact + migration note>`
|
||||
- Authors: `Co-authored-by: Name <email>`
|
||||
- Security: `CVE-XXXX-YYYY: <short note>` (if applicable)
|
||||
|
||||
## Content Guidance
|
||||
|
||||
### Include (when relevant)
|
||||
|
||||
- Specific fixes/features delivered
|
||||
- Symptoms/problems fixed
|
||||
- Brief note that tests passed or TS/lint errors resolved
|
||||
|
||||
### Avoid
|
||||
|
||||
- Vague: *improved, enhanced, better*
|
||||
- Trivialities: tiny docs, one-liners, pure lint cleanups (separate,
|
||||
focused commits if needed)
|
||||
- Redundancy: generic blurbs repeated across files
|
||||
- Multi-purpose dumps: keep commits **narrow and focused**
|
||||
- Long explanations that good inline code comments already cover
|
||||
|
||||
**Guiding Principle:** Let code and inline docs speak. Use commits to
|
||||
highlight what isn't obvious.
|
||||
|
||||
## Copy-Paste Templates
|
||||
|
||||
### Minimal (no body)
|
||||
|
||||
```text
|
||||
<type>(<scope>): <summary>
|
||||
```
|
||||
|
||||
### Standard (with body & footer)
|
||||
|
||||
```text
|
||||
<type>(<scope>)<!>: <summary>
|
||||
|
||||
<why-this-change?>
|
||||
<what-it-does?>
|
||||
<risks-or-follow-ups?>
|
||||
|
||||
Closes #<id>
|
||||
BREAKING CHANGE: <impact + migration>
|
||||
Co-authored-by: <Name> <email>
|
||||
```
|
||||
|
||||
## Assistant Output Checklist (before showing the draft)
|
||||
|
||||
- [ ] List changed files + 1–2 line notes per file
|
||||
- [ ] Provide **one** focused draft message (subject/body/footer)
|
||||
- [ ] Subject ≤ 72 chars, imperative mood, correct `type(scope)!` syntax
|
||||
- [ ] Body only if it adds non-obvious value
|
||||
- [ ] No invented changes; aligns strictly with diffs
|
||||
- [ ] Render as a single copy-paste block for the developer
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active version control guidelines
|
||||
**Priority**: High
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: git, package.json, CHANGELOG.md
|
||||
**Stakeholders**: Development team, AI assistants
|
||||
|
||||
- [ ] No invented changes; aligns strictly with diffs
|
||||
- [ ] Render as a single copy-paste block for the developer
|
||||
|
||||
## 1) Version-Control Ownership
|
||||
|
||||
- **MUST NOT** run `git add`, `git commit`, or any write action.
|
||||
- **MUST** leave staging/committing to the developer.
|
||||
|
||||
## 2) Source of Truth for Commit Text
|
||||
|
||||
- **MUST** derive messages **only** from:
|
||||
- files **staged** for commit (primary), and
|
||||
- files **awaiting staging** (context).
|
||||
- **MUST** use the **diffs** to inform content.
|
||||
- **MUST NOT** invent changes or imply work not present in diffs.
|
||||
|
||||
## 3) Mandatory Preview Flow
|
||||
|
||||
- **ALWAYS** present, before any real commit:
|
||||
- file list + brief per-file notes,
|
||||
- a **draft commit message** (copy-paste ready),
|
||||
- nothing auto-applied.
|
||||
|
||||
## 4) Version Synchronization Requirements
|
||||
|
||||
- **MUST** check for version changes in `package.json` before committing
|
||||
- **MUST** ensure `CHANGELOG.md` is updated when `package.json` version
|
||||
changes
|
||||
- **MUST** validate version format consistency between both files
|
||||
- **MUST** include version bump commits in changelog with proper semantic
|
||||
versioning
|
||||
|
||||
### Version Sync Checklist (Before Commit)
|
||||
|
||||
- [ ] `package.json` version matches latest `CHANGELOG.md` entry
|
||||
- [ ] New version follows semantic versioning
|
||||
(MAJOR.MINOR.PATCH[-PRERELEASE])
|
||||
- [ ] Changelog entry includes all significant changes since last version
|
||||
- [ ] Version bump commit message follows `build(version): bump to X.Y.Z`
|
||||
format
|
||||
- [ ] Breaking changes properly documented with migration notes
|
||||
- [ ] Alert developer in chat message that version has been updated
|
||||
|
||||
### Version Change Detection
|
||||
|
||||
- **Check for version changes** in staged/unstaged `package.json`
|
||||
- **Alert developer** if version changed but changelog not updated
|
||||
- **Suggest changelog update** with proper format and content
|
||||
- **Validate semantic versioning** compliance
|
||||
|
||||
### Implementation Notes
|
||||
|
||||
- **Version Detection**: Compare `package.json` version field with latest
|
||||
changelog entry
|
||||
- **Semantic Validation**: Ensure version follows `X.Y.Z[-PRERELEASE]`
|
||||
format
|
||||
- **Changelog Format**: Follow [Keep a Changelog](https://keepachangelog.com/)
|
||||
standards
|
||||
- **Breaking Changes**: Use `!` in commit message and `BREAKING CHANGE:`
|
||||
in changelog
|
||||
- **Pre-release Versions**: Include beta/alpha/rc suffixes in both files
|
||||
consistently
|
||||
|
||||
## Commit Message Format (Normative)
|
||||
|
||||
### A. Subject Line (required)
|
||||
|
||||
```
|
||||
<type>(<scope>)<!>: <summary>
|
||||
```
|
||||
|
||||
- **type** (lowercase, Conventional Commits):
|
||||
`feat|fix|refactor|perf|docs|test|build|chore|ci|revert`
|
||||
- **scope**: optional module/package/area (e.g., `api`, `ui/login`, `db`)
|
||||
- **!**: include when a breaking change is introduced
|
||||
- **summary**: imperative mood, ≤ 72 chars, no trailing period
|
||||
|
||||
**Examples**
|
||||
|
||||
- `fix(api): handle null token in refresh path`
|
||||
- `feat(ui/login)!: require OTP after 3 failed attempts`
|
||||
|
||||
### B. Body (optional, when it adds non-obvious value)
|
||||
|
||||
- One blank line after subject.
|
||||
- Wrap at ~72 chars.
|
||||
- Explain **what** and **why**, not line-by-line "how".
|
||||
- Include brief notes like tests passing or TS/lint issues resolved
|
||||
**only if material**.
|
||||
|
||||
**Body checklist**
|
||||
|
||||
- [ ] Problem/symptom being addressed
|
||||
- [ ] High-level approach or rationale
|
||||
- [ ] Risks, tradeoffs, or follow-ups (if any)
|
||||
|
||||
### C. Footer (optional)
|
||||
|
||||
- Issue refs: `Closes #123`, `Refs #456`
|
||||
- Breaking change (alternative to `!`):
|
||||
`BREAKING CHANGE: <impact + migration note>`
|
||||
- Authors: `Co-authored-by: Name <email>`
|
||||
- Security: `CVE-XXXX-YYYY: <short note>` (if applicable)
|
||||
|
||||
## Content Guidance
|
||||
|
||||
### Include (when relevant)
|
||||
|
||||
- Specific fixes/features delivered
|
||||
- Symptoms/problems fixed
|
||||
- Brief note that tests passed or TS/lint errors resolved
|
||||
|
||||
### Avoid
|
||||
|
||||
- Vague: *improved, enhanced, better*
|
||||
- Trivialities: tiny docs, one-liners, pure lint cleanups (separate,
|
||||
focused commits if needed)
|
||||
- Redundancy: generic blurbs repeated across files
|
||||
- Multi-purpose dumps: keep commits **narrow and focused**
|
||||
- Long explanations that good inline code comments already cover
|
||||
|
||||
**Guiding Principle:** Let code and inline docs speak. Use commits to
|
||||
highlight what isn't obvious.
|
||||
|
||||
## Copy-Paste Templates
|
||||
|
||||
### Minimal (no body)
|
||||
|
||||
```text
|
||||
<type>(<scope>): <summary>
|
||||
```
|
||||
|
||||
### Standard (with body & footer)
|
||||
|
||||
```text
|
||||
<type>(<scope>)<!>: <summary>
|
||||
|
||||
<why-this-change?>
|
||||
<what-it-does?>
|
||||
<risks-or-follow-ups?>
|
||||
|
||||
Closes #<id>
|
||||
BREAKING CHANGE: <impact + migration>
|
||||
Co-authored-by: <Name> <email>
|
||||
```
|
||||
|
||||
## Assistant Output Checklist (before showing the draft)
|
||||
|
||||
- [ ] List changed files + 1–2 line notes per file
|
||||
- [ ] Provide **one** focused draft message (subject/body/footer)
|
||||
- [ ] Subject ≤ 72 chars, imperative mood, correct `type(scope)!` syntax
|
||||
- [ ] Body only if it adds non-obvious value
|
||||
- [ ] No invented changes; aligns strictly with diffs
|
||||
- [ ] Render as a single copy-paste block for the developer
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active version control guidelines
|
||||
**Priority**: High
|
||||
**Estimated Effort**: Ongoing reference
|
||||
**Dependencies**: git, package.json, CHANGELOG.md
|
||||
**Stakeholders**: Development team, AI assistants
|
||||
|
||||
* [ ] No invented changes; aligns strictly with diffs
|
||||
* [ ] Render as a single copy-paste block for the developer
|
||||
171
.dockerignore
@@ -1,171 +0,0 @@
|
||||
# TimeSafari Docker Ignore File
|
||||
# Author: Matthew Raymer
|
||||
# Description: Excludes unnecessary files from Docker build context
|
||||
#
|
||||
# Benefits:
|
||||
# - Faster build times
|
||||
# - Smaller build context
|
||||
# - Reduced image size
|
||||
# - Better security (excludes sensitive files)
|
||||
|
||||
# Dependencies
|
||||
node_modules
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Build outputs
|
||||
# dist - Allow dist directory for Docker builds (contains pre-built assets)
|
||||
dist-*
|
||||
build
|
||||
*.tsbuildinfo
|
||||
|
||||
# Development files
|
||||
.git
|
||||
.gitignore
|
||||
README.md
|
||||
CHANGELOG.md
|
||||
CONTRIBUTING.md
|
||||
BUILDING.md
|
||||
LICENSE
|
||||
|
||||
# IDE and editor files
|
||||
.vscode
|
||||
.idea
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# OS generated files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Dependency directories
|
||||
jspm_packages/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# nuxt.js build output
|
||||
.nuxt
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# Test files
|
||||
test-playwright
|
||||
test-playwright-results
|
||||
test-results
|
||||
test-scripts
|
||||
|
||||
# Documentation
|
||||
doc
|
||||
|
||||
# Scripts (keep only what's needed for build)
|
||||
scripts/test-*.sh
|
||||
scripts/*.js
|
||||
scripts/README.md
|
||||
|
||||
# Platform-specific files
|
||||
android
|
||||
ios
|
||||
electron
|
||||
|
||||
# Docker files (avoid recursive copying)
|
||||
Dockerfile*
|
||||
docker-compose*
|
||||
.dockerignore
|
||||
|
||||
# CI/CD files
|
||||
|
||||
.gitlab-ci.yml
|
||||
.travis.yml
|
||||
.circleci
|
||||
|
||||
# Temporary files
|
||||
tmp
|
||||
temp
|
||||
|
||||
# Backup files
|
||||
*.bak
|
||||
*.backup
|
||||
|
||||
# Archive files
|
||||
*.tar
|
||||
*.tar.gz
|
||||
*.zip
|
||||
*.rar
|
||||
|
||||
# Certificate files
|
||||
*.pem
|
||||
*.key
|
||||
*.crt
|
||||
*.p12
|
||||
|
||||
# Configuration files that might contain secrets
|
||||
*.secrets
|
||||
secrets.json
|
||||
config.local.json
|
||||
@@ -1,14 +1,9 @@
|
||||
# Only the variables that start with VITE_ are seen in the application import.meta.env in Vue.
|
||||
|
||||
# Logging Configuration - Development environment gets maximum visibility
|
||||
VITE_LOG_LEVEL=debug
|
||||
|
||||
# iOS doesn't like spaces in the app title.
|
||||
TIME_SAFARI_APP_TITLE="TimeSafari_Dev"
|
||||
VITE_APP_SERVER=http://localhost:8080
|
||||
# This is the claim ID for actions in the BVC project, with the JWT ID on this environment (not
|
||||
|
||||
|
||||
# This is the claim ID for actions in the BVC project, with the JWT ID on this environment (not production).
|
||||
VITE_BVC_MEETUPS_PROJECT_CLAIM_ID=https://endorser.ch/entity/01HWE8FWHQ1YGP7GFZYYPS272F
|
||||
VITE_DEFAULT_ENDORSER_API_SERVER=http://localhost:3000
|
||||
# Using shared server by default to ease setup, which works for shared test users.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Only the variables that start with VITE_ are seen in the application import.meta.env in Vue.
|
||||
|
||||
# Logging Configuration - Production environment gets minimal logging for performance
|
||||
VITE_LOG_LEVEL=warn
|
||||
|
||||
|
||||
VITE_APP_SERVER=https://timesafari.app
|
||||
# This is the claim ID for actions in the BVC project.
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
# Only the variables that start with VITE_ are seen in the application import.meta.env in Vue.
|
||||
|
||||
# Logging Configuration - Test environment gets balanced logging for debugging
|
||||
VITE_LOG_LEVEL=info
|
||||
|
||||
# iOS doesn't like spaces in the app title.
|
||||
TIME_SAFARI_APP_TITLE="TimeSafari_Test"
|
||||
VITE_APP_SERVER=https://test.timesafari.app
|
||||
# This is the claim ID for actions in the BVC project, with the JWT ID on this environment (not
|
||||
# This is the claim ID for actions in the BVC project, with the JWT ID on this environment (not production).
|
||||
|
||||
VITE_BVC_MEETUPS_PROJECT_CLAIM_ID=https://endorser.ch/entity/01HWE8FWHQ1YGP7GFZYYPS272F
|
||||
VITE_DEFAULT_ENDORSER_API_SERVER=https://test-api.endorser.ch
|
||||
|
||||
@@ -30,7 +30,7 @@ module.exports = {
|
||||
}],
|
||||
"no-console": process.env.NODE_ENV === "production" ? "error" : "warn",
|
||||
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "warn",
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"@typescript-eslint/no-explicit-any": "warn",
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"@typescript-eslint/no-unnecessary-type-constraint": "off",
|
||||
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
|
||||
|
||||
27
.github/workflows/playwright.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Playwright Tests
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
jobs:
|
||||
test:
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Install Playwright Browsers
|
||||
run: npx playwright install --with-deps
|
||||
- name: Run Playwright tests
|
||||
run: npx playwright test
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
89
.gitignore
vendored
@@ -45,9 +45,6 @@ dist-electron-packages
|
||||
# Test files generated by scripts test-ios.js & test-android.js
|
||||
.generated/
|
||||
|
||||
# Test stability analysis results
|
||||
test-stability-results/
|
||||
|
||||
.env.default
|
||||
vendor/
|
||||
|
||||
@@ -57,90 +54,4 @@ build_logs/
|
||||
# PWA icon files generated by capacitor-assets
|
||||
icons
|
||||
|
||||
*.log
|
||||
|
||||
# Build outputs
|
||||
dist/
|
||||
build/
|
||||
|
||||
# Generated Android assets and resources (should be generated during build)
|
||||
android/app/src/main/assets/public/
|
||||
|
||||
# Generated Android resources (icons, splash screens, etc.)
|
||||
android/app/src/main/res/drawable*/
|
||||
android/app/src/main/res/mipmap*/
|
||||
android/app/src/main/res/values/ic_launcher_background.xml
|
||||
|
||||
# Android generated assets (deny-listed in CI)
|
||||
android/app/src/main/res/mipmap-*/ic_launcher*.png
|
||||
android/app/src/main/res/drawable*/splash*.png
|
||||
|
||||
# iOS generated assets (deny-listed in CI)
|
||||
ios/App/App/Assets.xcassets/**/AppIcon*.png
|
||||
ios/App/App/Assets.xcassets/**/Splash*.png
|
||||
|
||||
# Keep these Android configuration files in version control:
|
||||
# - android/app/src/main/assets/capacitor.plugins.json
|
||||
# - android/app/src/main/res/values/strings.xml
|
||||
# - android/app/src/main/res/values/styles.xml
|
||||
# - android/app/src/main/res/layout/activity_main.xml
|
||||
# - android/app/src/main/res/xml/config.xml
|
||||
# - android/app/src/main/res/xml/file_paths.xml
|
||||
|
||||
sql-wasm.wasm
|
||||
|
||||
# Temporary and generated files
|
||||
temp.*
|
||||
*.tmp
|
||||
*.temp
|
||||
*.bak
|
||||
*.cache
|
||||
git.diff.*
|
||||
*.har
|
||||
|
||||
# Development artifacts
|
||||
dev-dist/
|
||||
*.map
|
||||
|
||||
# OS generated files
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
|
||||
# Capacitor build outputs and generated files
|
||||
android/app/build/
|
||||
android/capacitor-cordova-android-plugins/build/
|
||||
ios/App/App/public/assets/
|
||||
ios/App/App/build/
|
||||
ios/App/build/
|
||||
|
||||
# Capacitor build artifacts (covered by android/app/build/ above)
|
||||
|
||||
# Keep these Capacitor files in version control:
|
||||
# - capacitor.config.json (root, electron, ios)
|
||||
# - src/main.capacitor.ts
|
||||
# - vite.config.capacitor.mts
|
||||
# - android/capacitor.settings.gradle
|
||||
# - android/app/capacitor.build.gradle
|
||||
# - android/app/src/main/assets/capacitor.plugins.json
|
||||
|
||||
# Electron build outputs and generated files
|
||||
electron/build/
|
||||
electron/app/
|
||||
electron/dist/
|
||||
electron/out/
|
||||
|
||||
# Keep these Electron files in version control:
|
||||
# - electron/src/preload.ts (source)
|
||||
# - electron/src/index.ts (source)
|
||||
# - electron/src/setup.ts (source)
|
||||
# - electron/package.json
|
||||
# - electron/electron-builder.config.json
|
||||
# - electron/build-packages.sh
|
||||
# - electron/live-runner.js
|
||||
# - electron/resources/electron-publisher-custom.js
|
||||
|
||||
# Gradle cache files
|
||||
android/.gradle/file-system.probe
|
||||
android/.gradle/caches/
|
||||
coverage
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
#
|
||||
# Husky Helper Script
|
||||
# This file is sourced by all Husky hooks
|
||||
#
|
||||
if [ -z "$husky_skip_init" ]; then
|
||||
debug () {
|
||||
if [ "$HUSKY_DEBUG" = "1" ]; then
|
||||
echo "husky (debug) - $1"
|
||||
fi
|
||||
}
|
||||
|
||||
readonly hook_name="$(basename -- "$0")"
|
||||
debug "starting $hook_name..."
|
||||
|
||||
if [ "$HUSKY" = "0" ]; then
|
||||
debug "HUSKY env variable is set to 0, skipping hook"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f ~/.huskyrc ]; then
|
||||
debug "sourcing ~/.huskyrc"
|
||||
. ~/.huskyrc
|
||||
fi
|
||||
|
||||
readonly husky_skip_init=1
|
||||
export husky_skip_init
|
||||
sh -e "$0" "$@"
|
||||
exitCode="$?"
|
||||
|
||||
if [ $exitCode != 0 ]; then
|
||||
echo "husky - $hook_name hook exited with code $exitCode (error)"
|
||||
fi
|
||||
|
||||
if [ $exitCode = 127 ]; then
|
||||
echo "husky - command not found in PATH=$PATH"
|
||||
fi
|
||||
|
||||
exit $exitCode
|
||||
fi
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Husky Commit Message Hook
|
||||
# Validates commit message format using commitlint
|
||||
#
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
# Run commitlint but don't fail the commit (|| true)
|
||||
# This provides helpful feedback without blocking commits
|
||||
npx commitlint --edit "$1" || true
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Husky Pre-commit Hook
|
||||
# Runs Build Architecture Guard to check staged files
|
||||
#
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
echo "🔍 Running Build Architecture Guard (pre-commit)..."
|
||||
bash ./scripts/build-arch-guard.sh --staged || {
|
||||
echo
|
||||
echo "💡 To bypass this check for emergency commits, use:"
|
||||
echo " git commit --no-verify"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Husky Pre-push Hook
|
||||
# Runs Build Architecture Guard to check commits being pushed
|
||||
#
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
echo "🔍 Running Build Architecture Guard (pre-push)..."
|
||||
|
||||
# Get the remote branch we're pushing to
|
||||
REMOTE_BRANCH="origin/$(git rev-parse --abbrev-ref HEAD)"
|
||||
|
||||
# Check if remote branch exists
|
||||
if git show-ref --verify --quiet "refs/remotes/$REMOTE_BRANCH"; then
|
||||
RANGE="$REMOTE_BRANCH...HEAD"
|
||||
else
|
||||
# If remote branch doesn't exist, check last commit
|
||||
RANGE="HEAD~1..HEAD"
|
||||
fi
|
||||
|
||||
bash ./scripts/build-arch-guard.sh --range "$RANGE" || {
|
||||
echo
|
||||
echo "💡 To bypass this check for emergency pushes, use:"
|
||||
echo " git push --no-verify"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{"MD013": {"code_blocks": false}}
|
||||
@@ -1 +0,0 @@
|
||||
18.19.0
|
||||
2555
BUILDING.md
538
CEFPython-Survey.md
Normal file
@@ -0,0 +1,538 @@
|
||||
# CEFPython Implementation Survey for TimeSafari
|
||||
|
||||
**Author:** Matthew Raymer
|
||||
**Date:** December 2025
|
||||
**Project:** TimeSafari Cross-Platform Desktop Implementation
|
||||
|
||||
## Executive Summary
|
||||
|
||||
This survey evaluates implementing CEFPython as an additional desktop platform for TimeSafari, with full integration into the existing migration system used by Capacitor and native web platforms.
|
||||
|
||||
### Key Findings
|
||||
|
||||
**Feasibility:** ✅ **Highly Feasible** - CEFPython can integrate seamlessly with TimeSafari's existing architecture
|
||||
|
||||
**Migration System Compatibility:** ✅ **Full Compatibility** - Can use the exact same `migration.ts` system as Capacitor and web
|
||||
|
||||
**Performance:** ✅ **Excellent** - Native Python backend with Chromium rendering engine
|
||||
|
||||
**Security:** ✅ **Strong** - Chromium's security model with Python backend isolation
|
||||
|
||||
---
|
||||
|
||||
## 1. Architecture Overview
|
||||
|
||||
### 1.1 Current Platform Architecture
|
||||
|
||||
TimeSafari uses a sophisticated cross-platform architecture with shared codebase and platform-specific implementations:
|
||||
|
||||
```typescript
|
||||
src/
|
||||
├── main.common.ts # Shared initialization
|
||||
├── main.web.ts # Web/PWA entry point
|
||||
├── main.capacitor.ts # Mobile entry point
|
||||
├── main.electron.ts # Electron entry point
|
||||
├── main.pywebview.ts # PyWebView entry point
|
||||
├── main.cefpython.ts # NEW: CEFPython entry point
|
||||
├── services/
|
||||
│ ├── PlatformService.ts # Platform abstraction interface
|
||||
│ ├── PlatformServiceFactory.ts
|
||||
│ └── platforms/
|
||||
│ ├── WebPlatformService.ts
|
||||
│ ├── CapacitorPlatformService.ts
|
||||
│ ├── ElectronPlatformService.ts
|
||||
│ ├── PyWebViewPlatformService.ts
|
||||
│ └── CEFPythonPlatformService.ts # NEW
|
||||
└── cefpython/ # NEW: CEFPython backend
|
||||
├── main.py
|
||||
├── handlers/
|
||||
│ ├── database.py # SQLite with migration support
|
||||
│ ├── crypto.py # Cryptographic operations
|
||||
│ └── api.py # API server integration
|
||||
└── bridge/
|
||||
└── javascript_bridge.py # JS-Python communication
|
||||
```
|
||||
|
||||
### 1.2 Migration System Integration
|
||||
|
||||
**Key Insight:** CEFPython can use the exact same migration system as Capacitor and web platforms:
|
||||
|
||||
```typescript
|
||||
// src/main.cefpython.ts - CEFPython entry point
|
||||
import { initializeApp } from "./main.common";
|
||||
import { runMigrations } from "./db-sql/migration";
|
||||
import { CEFPythonPlatformService } from "./services/platforms/CEFPythonPlatformService";
|
||||
|
||||
const app = initializeApp();
|
||||
|
||||
// Initialize CEFPython platform service
|
||||
const platformService = new CEFPythonPlatformService();
|
||||
|
||||
// Run migrations using the same system as Capacitor
|
||||
async function initializeDatabase() {
|
||||
const sqlExec = (sql: string) => platformService.dbExecute(sql);
|
||||
const sqlQuery = (sql: string) => platformService.dbQuery(sql);
|
||||
const extractMigrationNames = (result: any) => {
|
||||
const names = result.values?.map((row: any) => row.name) || [];
|
||||
return new Set(names);
|
||||
};
|
||||
|
||||
await runMigrations(sqlExec, sqlQuery, extractMigrationNames);
|
||||
}
|
||||
|
||||
// Initialize database before mounting app
|
||||
initializeDatabase().then(() => {
|
||||
app.mount("#app");
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. Python Backend Implementation
|
||||
|
||||
### 2.1 Database Handler with Migration Support
|
||||
|
||||
```python
|
||||
# src/cefpython/handlers/database.py
|
||||
import sqlite3
|
||||
from pathlib import Path
|
||||
from typing import List, Dict, Any
|
||||
|
||||
class DatabaseHandler:
|
||||
def __init__(self):
|
||||
self.db_path = self._get_db_path()
|
||||
self.connection = sqlite3.connect(str(self.db_path))
|
||||
self.connection.row_factory = sqlite3.Row
|
||||
|
||||
# Configure for better performance
|
||||
self.connection.execute("PRAGMA journal_mode=WAL;")
|
||||
self.connection.execute("PRAGMA synchronous=NORMAL;")
|
||||
|
||||
def query(self, sql: str, params: List[Any] = None) -> Dict[str, Any]:
|
||||
"""Execute SQL query and return results in Capacitor-compatible format"""
|
||||
cursor = self.connection.cursor()
|
||||
|
||||
if params:
|
||||
cursor.execute(sql, params)
|
||||
else:
|
||||
cursor.execute(sql)
|
||||
|
||||
if sql.strip().upper().startswith('SELECT'):
|
||||
columns = [description[0] for description in cursor.description]
|
||||
rows = []
|
||||
for row in cursor.fetchall():
|
||||
rows.append(dict(zip(columns, row)))
|
||||
return {'values': rows} # Match Capacitor format
|
||||
else:
|
||||
self.connection.commit()
|
||||
return {'affected_rows': cursor.rowcount}
|
||||
|
||||
def execute(self, sql: string, params: List[Any] = None) -> Dict[str, Any]:
|
||||
"""Execute SQL statement (for INSERT, UPDATE, DELETE, CREATE)"""
|
||||
cursor = self.connection.cursor()
|
||||
|
||||
if params:
|
||||
cursor.execute(sql, params)
|
||||
else:
|
||||
cursor.execute(sql)
|
||||
|
||||
self.connection.commit()
|
||||
|
||||
return {
|
||||
'changes': {
|
||||
'changes': cursor.rowcount,
|
||||
'lastId': cursor.lastrowid
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2.2 Platform Service Implementation
|
||||
|
||||
```typescript
|
||||
// src/services/platforms/CEFPythonPlatformService.ts
|
||||
import { PlatformService } from '../PlatformService';
|
||||
import { runMigrations } from '@/db-sql/migration';
|
||||
|
||||
export class CEFPythonPlatformService implements PlatformService {
|
||||
private bridge: any;
|
||||
|
||||
constructor() {
|
||||
this.bridge = (window as any).cefBridge;
|
||||
if (!this.bridge) {
|
||||
throw new Error('CEFPython bridge not available');
|
||||
}
|
||||
}
|
||||
|
||||
// Database operations using the same interface as Capacitor
|
||||
async dbQuery(sql: string, params?: any[]): Promise<any> {
|
||||
const result = await this.bridge.call('database', 'query', sql, params || []);
|
||||
return result;
|
||||
}
|
||||
|
||||
async dbExecute(sql: string, params?: any[]): Promise<any> {
|
||||
const result = await this.bridge.call('database', 'execute', sql, params || []);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Migration system integration
|
||||
async runMigrations(): Promise<void> {
|
||||
const sqlExec: (sql: string) => Promise<any> = this.dbExecute.bind(this);
|
||||
const sqlQuery: (sql: string) => Promise<any> = this.dbQuery.bind(this);
|
||||
const extractMigrationNames: (result: any) => Set<string> = (result) => {
|
||||
const names = result.values?.map((row: any) => row.name) || [];
|
||||
return new Set(names);
|
||||
};
|
||||
|
||||
await runMigrations(sqlExec, sqlQuery, extractMigrationNames);
|
||||
}
|
||||
|
||||
// Platform detection
|
||||
isCEFPython(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
getCapabilities(): PlatformCapabilities {
|
||||
return {
|
||||
hasCamera: true,
|
||||
hasFileSystem: true,
|
||||
hasNotifications: true,
|
||||
hasSQLite: true,
|
||||
hasCrypto: true
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Migration System Compatibility
|
||||
|
||||
### 3.1 Key Advantage
|
||||
|
||||
**CEFPython can use the exact same migration system as Capacitor:**
|
||||
|
||||
```typescript
|
||||
// Both Capacitor and CEFPython use the same migration.ts
|
||||
import { runMigrations } from '@/db-sql/migration';
|
||||
|
||||
// Capacitor implementation
|
||||
const sqlExec: (sql: string) => Promise<capSQLiteChanges> = this.db.execute.bind(this.db);
|
||||
const sqlQuery: (sql: string) => Promise<DBSQLiteValues> = this.db.query.bind(this.db);
|
||||
|
||||
// CEFPython implementation
|
||||
const sqlExec: (sql: string) => Promise<any> = this.dbExecute.bind(this);
|
||||
const sqlQuery: (sql: string) => Promise<any> = this.dbQuery.bind(this);
|
||||
|
||||
// Both use the same migration runner
|
||||
await runMigrations(sqlExec, sqlQuery, extractMigrationNames);
|
||||
```
|
||||
|
||||
### 3.2 Database Format Compatibility
|
||||
|
||||
The Python database handler returns data in the same format as Capacitor:
|
||||
|
||||
```python
|
||||
# Python returns Capacitor-compatible format
|
||||
def query(self, sql: str, params: List[Any] = None) -> Dict[str, Any]:
|
||||
# ... execute query ...
|
||||
return {
|
||||
'values': [
|
||||
{'name': '001_initial', 'executed_at': '2025-01-01'},
|
||||
{'name': '002_add_contacts', 'executed_at': '2025-01-02'}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
This matches the Capacitor format:
|
||||
```typescript
|
||||
// Capacitor returns same format
|
||||
const result = await this.db.query("SELECT name FROM migrations");
|
||||
// result = { values: [{ name: '001_initial' }, { name: '002_add_contacts' }] }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Build Configuration
|
||||
|
||||
### 4.1 Vite Configuration
|
||||
|
||||
```typescript
|
||||
// vite.config.cefpython.mts
|
||||
import { defineConfig } from 'vite';
|
||||
import { createBuildConfig } from './vite.config.common.mts';
|
||||
|
||||
export default defineConfig({
|
||||
...createBuildConfig('cefpython'),
|
||||
|
||||
define: {
|
||||
'process.env.VITE_PLATFORM': JSON.stringify('cefpython'),
|
||||
'process.env.VITE_PWA_ENABLED': JSON.stringify(false),
|
||||
__IS_MOBILE__: JSON.stringify(false),
|
||||
__USE_QR_READER__: JSON.stringify(true)
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### 4.2 Package.json Scripts
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"build:cefpython": "vite build --config vite.config.cefpython.mts",
|
||||
"dev:cefpython": "concurrently \"npm run dev:web\" \"python src/cefpython/main.py --dev\"",
|
||||
"test:cefpython": "python -m pytest tests/cefpython/"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 4.3 Python Requirements
|
||||
|
||||
```txt
|
||||
# requirements-cefpython.txt
|
||||
cefpython3>=66.1
|
||||
cryptography>=3.4.0
|
||||
requests>=2.25.0
|
||||
pyinstaller>=4.0
|
||||
pytest>=6.0.0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. Platform Service Factory Integration
|
||||
|
||||
### 5.1 Updated Factory
|
||||
|
||||
```typescript
|
||||
// src/services/PlatformServiceFactory.ts
|
||||
import { CEFPythonPlatformService } from './platforms/CEFPythonPlatformService';
|
||||
|
||||
export function createPlatformService(platform: string): PlatformService {
|
||||
switch (platform) {
|
||||
case 'web':
|
||||
return new WebPlatformService();
|
||||
case 'capacitor':
|
||||
return new CapacitorPlatformService();
|
||||
case 'electron':
|
||||
return new ElectronPlatformService();
|
||||
case 'pywebview':
|
||||
return new PyWebViewPlatformService();
|
||||
case 'cefpython':
|
||||
return new CEFPythonPlatformService(); // NEW
|
||||
default:
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Performance and Security Analysis
|
||||
|
||||
### 6.1 Performance Comparison
|
||||
|
||||
| Metric | Electron | PyWebView | CEFPython | Notes |
|
||||
|--------|----------|-----------|-----------|-------|
|
||||
| **Memory Usage** | 150-200MB | 80-120MB | 100-150MB | CEFPython more efficient than Electron |
|
||||
| **Startup Time** | 3-5s | 2-3s | 2-4s | Similar to PyWebView |
|
||||
| **Database Performance** | Good | Good | Excellent | Native SQLite |
|
||||
| **Crypto Performance** | Good | Good | Excellent | Native Python crypto |
|
||||
| **Bundle Size** | 120-150MB | 50-80MB | 80-120MB | Smaller than Electron |
|
||||
|
||||
### 6.2 Security Features
|
||||
|
||||
```python
|
||||
# src/cefpython/utils/security.py
|
||||
class SecurityManager:
|
||||
def __init__(self):
|
||||
self.blocked_domains = set(['malicious-site.com'])
|
||||
self.allowed_schemes = {'https', 'http', 'file'}
|
||||
|
||||
def validate_network_access(self, url: str) -> bool:
|
||||
"""Validate if network access is allowed"""
|
||||
from urllib.parse import urlparse
|
||||
parsed = urlparse(url)
|
||||
|
||||
# Check blocked domains
|
||||
if parsed.hostname in self.blocked_domains:
|
||||
return False
|
||||
|
||||
# Allow HTTPS only for external domains
|
||||
if parsed.scheme != 'https' and parsed.hostname != 'localhost':
|
||||
return False
|
||||
|
||||
return True
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. Migration Strategy
|
||||
|
||||
### 7.1 Phase 1: Foundation (Week 1-2)
|
||||
|
||||
**Objectives:**
|
||||
- Set up CEFPython development environment
|
||||
- Create basic application structure
|
||||
- Implement database handler with migration support
|
||||
- Establish JavaScript-Python bridge
|
||||
|
||||
**Deliverables:**
|
||||
- [ ] Basic CEFPython application that loads TimeSafari web app
|
||||
- [ ] Database handler with SQLite integration
|
||||
- [ ] Migration system integration
|
||||
- [ ] JavaScript bridge for communication
|
||||
|
||||
### 7.2 Phase 2: Platform Integration (Week 3-4)
|
||||
|
||||
**Objectives:**
|
||||
- Implement CEFPython platform service
|
||||
- Integrate with existing migration system
|
||||
- Test database operations with real data
|
||||
- Validate migration compatibility
|
||||
|
||||
**Deliverables:**
|
||||
- [ ] CEFPython platform service implementation
|
||||
- [ ] Migration system integration
|
||||
- [ ] Database compatibility testing
|
||||
- [ ] Performance benchmarking
|
||||
|
||||
### 7.3 Phase 3: Feature Integration (Week 5-6)
|
||||
|
||||
**Objectives:**
|
||||
- Integrate with existing platform features
|
||||
- Implement API server integration
|
||||
- Add security features
|
||||
- Test with real user workflows
|
||||
|
||||
**Deliverables:**
|
||||
- [ ] Full feature compatibility
|
||||
- [ ] API integration
|
||||
- [ ] Security implementation
|
||||
- [ ] User workflow testing
|
||||
|
||||
### 7.4 Phase 4: Polish and Distribution (Week 7-8)
|
||||
|
||||
**Objectives:**
|
||||
- Optimize performance
|
||||
- Add build and distribution scripts
|
||||
- Create documentation
|
||||
- Prepare for release
|
||||
|
||||
**Deliverables:**
|
||||
- [ ] Performance optimization
|
||||
- [ ] Build automation
|
||||
- [ ] Documentation
|
||||
- [ ] Release-ready application
|
||||
|
||||
---
|
||||
|
||||
## 8. Risk Assessment
|
||||
|
||||
### 8.1 Technical Risks
|
||||
|
||||
| Risk | Probability | Impact | Mitigation |
|
||||
|------|-------------|--------|------------|
|
||||
| **CEFPython compatibility issues** | Medium | High | Use stable CEFPython version, test thoroughly |
|
||||
| **Migration system integration** | Low | High | Follow existing patterns, extensive testing |
|
||||
| **Performance issues** | Low | Medium | Benchmark early, optimize as needed |
|
||||
| **Security vulnerabilities** | Low | High | Implement security manager, regular audits |
|
||||
|
||||
### 8.2 Development Risks
|
||||
|
||||
| Risk | Probability | Impact | Mitigation |
|
||||
|------|-------------|--------|------------|
|
||||
| **Python/CEF knowledge gap** | Medium | Medium | Training, documentation, pair programming |
|
||||
| **Integration complexity** | Medium | Medium | Incremental development, extensive testing |
|
||||
| **Build system complexity** | Low | Medium | Automated build scripts, CI/CD |
|
||||
|
||||
---
|
||||
|
||||
## 9. Success Metrics
|
||||
|
||||
### 9.1 Technical Metrics
|
||||
|
||||
- [ ] **Migration Compatibility:** 100% compatibility with existing migration system
|
||||
- [ ] **Performance:** < 150MB memory usage, < 4s startup time
|
||||
- [ ] **Security:** Pass security audit, no critical vulnerabilities
|
||||
- [ ] **Reliability:** 99%+ uptime, < 1% error rate
|
||||
|
||||
### 9.2 Development Metrics
|
||||
|
||||
- [ ] **Code Quality:** 90%+ test coverage, < 5% code duplication
|
||||
- [ ] **Documentation:** Complete API documentation, user guides
|
||||
- [ ] **Build Automation:** Automated builds, CI/CD pipeline
|
||||
- [ ] **Release Readiness:** Production-ready application
|
||||
|
||||
---
|
||||
|
||||
## 10. Conclusion
|
||||
|
||||
### 10.1 Recommendation
|
||||
|
||||
**✅ PROCEED WITH IMPLEMENTATION**
|
||||
|
||||
CEFPython provides an excellent opportunity to add a robust desktop platform to TimeSafari with:
|
||||
|
||||
1. **Full Migration System Compatibility:** Can use the exact same migration system as Capacitor and web
|
||||
2. **Native Performance:** Python backend with Chromium rendering
|
||||
3. **Security:** Chromium's security model with Python backend isolation
|
||||
4. **Development Efficiency:** Follows established patterns and architecture
|
||||
|
||||
### 10.2 Implementation Priority
|
||||
|
||||
**High Priority:**
|
||||
- Database handler with migration support
|
||||
- JavaScript-Python bridge
|
||||
- Platform service integration
|
||||
- Basic application structure
|
||||
|
||||
**Medium Priority:**
|
||||
- Crypto handler integration
|
||||
- API server integration
|
||||
- Security features
|
||||
- Performance optimization
|
||||
|
||||
**Low Priority:**
|
||||
- Advanced features
|
||||
- Build automation
|
||||
- Documentation
|
||||
- Distribution packaging
|
||||
|
||||
### 10.3 Timeline
|
||||
|
||||
**Total Duration:** 8 weeks (2 months)
|
||||
**Team Size:** 1-2 developers
|
||||
**Risk Level:** Medium
|
||||
**Confidence:** 85%
|
||||
|
||||
The implementation leverages TimeSafari's existing architecture and migration system, making it a natural addition to the platform ecosystem while providing users with a high-performance desktop option.
|
||||
|
||||
---
|
||||
|
||||
## 11. Next Steps
|
||||
|
||||
1. **Immediate Actions:**
|
||||
- Set up development environment
|
||||
- Create basic CEFPython application structure
|
||||
- Implement database handler with migration support
|
||||
|
||||
2. **Week 1-2:**
|
||||
- Complete foundation implementation
|
||||
- Test migration system integration
|
||||
- Validate database operations
|
||||
|
||||
3. **Week 3-4:**
|
||||
- Implement platform service
|
||||
- Integrate with existing features
|
||||
- Begin performance testing
|
||||
|
||||
4. **Week 5-6:**
|
||||
- Complete feature integration
|
||||
- Security implementation
|
||||
- User workflow testing
|
||||
|
||||
5. **Week 7-8:**
|
||||
- Performance optimization
|
||||
- Build automation
|
||||
- Documentation and release preparation
|
||||
|
||||
This implementation will provide TimeSafari users with a robust, secure, and high-performance desktop application that seamlessly integrates with the existing ecosystem.
|
||||
72
CHANGELOG.md
@@ -5,90 +5,22 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.0.7] - 2025.08.18
|
||||
|
||||
### Fixed
|
||||
|
||||
- Deep link for onboard-meeting-members
|
||||
|
||||
## [1.0.6] - 2025.08.09
|
||||
|
||||
### Fixed
|
||||
|
||||
- Deep link errors where none would validate
|
||||
|
||||
## [1.0.5] - 2025.07.24
|
||||
|
||||
### Fixed
|
||||
|
||||
- Export & import of contacts corrupted contact methods
|
||||
|
||||
## [1.0.4] - 2025.07.20 - 002f2407208d56cc59c0aa7c880535ae4cbace8b
|
||||
|
||||
### Fixed
|
||||
|
||||
- Deep link for invite-one-accept
|
||||
|
||||
## [1.0.3] - 2025.07.12 - a9a8ba217cd6015321911e98e6843e988dc2c4ae
|
||||
|
||||
### Changed
|
||||
|
||||
- Photo is pinned to profile mode
|
||||
|
||||
### Fixed
|
||||
|
||||
- Deep link URLs (and other prod settings)
|
||||
- Error in BVC begin view
|
||||
|
||||
## [1.0.2] - 2025.06.20 - 276e0a741bc327de3380c4e508cccb7fee58c06d
|
||||
|
||||
### Added
|
||||
|
||||
- Version on feed title
|
||||
|
||||
## [1.0.1] - 2025.06.20
|
||||
|
||||
### Added
|
||||
|
||||
- Allow a user to block someone else's content from view
|
||||
|
||||
## [1.0.0] - 2025.06.20 - 5aa693de6337e5dbb278bfddc6bd39094bc14f73
|
||||
|
||||
### Added
|
||||
|
||||
- Web-oriented migration from IndexedDB to SQLite
|
||||
|
||||
## [0.5.8]
|
||||
|
||||
### Added
|
||||
|
||||
- /deep-link/ path for URLs that are shared with people
|
||||
|
||||
### Changed
|
||||
|
||||
- External links now go to /deep-link/...
|
||||
- Feed visuals now have arrow imagery from giver to receiver
|
||||
|
||||
## [0.4.7]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Cameras everywhere
|
||||
|
||||
### Changed
|
||||
|
||||
- IndexedDB -> SQLite
|
||||
|
||||
|
||||
## [0.4.5] - 2025.02.23
|
||||
|
||||
### Added
|
||||
|
||||
- Total amounts of gives on project page
|
||||
|
||||
### Changed in DB or environment
|
||||
|
||||
- Requires Endorser.ch version 4.2.6+
|
||||
|
||||
|
||||
## [0.4.4] - 2025.02.17
|
||||
|
||||
### Fixed in 0.4.4
|
||||
|
||||
166
Dockerfile
@@ -1,170 +1,36 @@
|
||||
# TimeSafari Docker Build
|
||||
# Author: Matthew Raymer
|
||||
# Description: Multi-stage Docker build for TimeSafari web application
|
||||
#
|
||||
# Build Process:
|
||||
# 1. Base stage: Node.js with build dependencies
|
||||
# 2. Builder stage: Copy pre-built web assets from host
|
||||
# 3. Production stage: Nginx server with optimized assets
|
||||
#
|
||||
# Note: Web assets are built on the host using npm scripts before Docker build
|
||||
#
|
||||
# Security Features:
|
||||
# - Non-root user execution
|
||||
# - Minimal attack surface with Alpine Linux
|
||||
# - Multi-stage build to reduce image size
|
||||
# - No build dependencies in final image
|
||||
#
|
||||
# Usage:
|
||||
# IMPORTANT: Build web assets first, then build Docker image
|
||||
#
|
||||
# Using npm scripts (recommended):
|
||||
# Production: npm run build:web:docker:prod
|
||||
# Test: npm run build:web:docker:test
|
||||
# Development: npm run build:web:docker
|
||||
#
|
||||
# Manual workflow:
|
||||
# 1. Build web assets: npm run build:web:build -- --mode production
|
||||
# 2. Build Docker: docker build -t timesafari:latest .
|
||||
#
|
||||
# Note: For development, use npm run build:web directly (no Docker needed)
|
||||
#
|
||||
# Build Arguments:
|
||||
# BUILD_MODE: development, test, or production (default: production)
|
||||
# NODE_ENV: node environment (default: production)
|
||||
#
|
||||
# Environment Variables:
|
||||
# NODE_ENV: Build environment (development/production)
|
||||
# BUILD_MODE: Build mode for asset selection (development/test/production)
|
||||
#
|
||||
# Build Context:
|
||||
# This Dockerfile is designed to work when the build context is set to
|
||||
# ./crowd-funder-for-time-pwa from the parent directory (where docker-compose.yml is located)
|
||||
# Build stage
|
||||
FROM node:22-alpine3.20 AS builder
|
||||
|
||||
# =============================================================================
|
||||
# BASE STAGE - Common dependencies and setup
|
||||
# =============================================================================
|
||||
FROM node:22-alpine3.20 AS base
|
||||
# Install build dependencies
|
||||
|
||||
# Install system dependencies for build process
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
git \
|
||||
python3 \
|
||||
py3-pip \
|
||||
py3-setuptools \
|
||||
make \
|
||||
g++ \
|
||||
gcc \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
# Create non-root user for security
|
||||
RUN addgroup -g 1001 -S nodejs && \
|
||||
adduser -S nextjs -u 1001
|
||||
RUN apk add --no-cache bash git python3 py3-pip py3-setuptools make g++ gcc
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files for dependency installation
|
||||
# Note: These files are in the project root (crowd-funder-for-time-pwa directory)
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies with security audit
|
||||
RUN npm ci --only=production --audit --fund=false && \
|
||||
npm audit fix --audit-level=moderate || true
|
||||
# Install dependencies
|
||||
RUN npm ci
|
||||
|
||||
# =============================================================================
|
||||
# BUILDER STAGE - Copy pre-built assets
|
||||
# =============================================================================
|
||||
FROM base AS builder
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Define build arguments with defaults
|
||||
ARG BUILD_MODE=production
|
||||
ARG NODE_ENV=production
|
||||
# Build the application
|
||||
RUN npm run build:web
|
||||
|
||||
# Set environment variables from build arguments
|
||||
ENV BUILD_MODE=${BUILD_MODE}
|
||||
ENV NODE_ENV=${NODE_ENV}
|
||||
|
||||
# Copy pre-built assets from host
|
||||
# Note: dist/ directory is in the project root (crowd-funder-for-time-pwa directory)
|
||||
COPY dist/ ./dist/
|
||||
|
||||
# Verify build output exists
|
||||
RUN ls -la dist/ || (echo "Build output not found in dist/ directory" && exit 1)
|
||||
|
||||
# =============================================================================
|
||||
# PRODUCTION STAGE - Nginx server
|
||||
# =============================================================================
|
||||
FROM nginx:alpine AS production
|
||||
|
||||
# Define build arguments for production stage
|
||||
ARG BUILD_MODE=production
|
||||
ARG NODE_ENV=production
|
||||
|
||||
# Set environment variables
|
||||
ENV BUILD_MODE=${BUILD_MODE}
|
||||
ENV NODE_ENV=${NODE_ENV}
|
||||
|
||||
# Install security updates and clean cache
|
||||
RUN apk update && \
|
||||
apk upgrade && \
|
||||
apk add --no-cache \
|
||||
curl \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
# Use existing nginx user from base image (nginx user and group already exist)
|
||||
# No need to create new user as nginx:alpine already has nginx user
|
||||
|
||||
# Copy main nginx configuration
|
||||
COPY docker/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Copy production nginx configuration
|
||||
COPY docker/default.conf /etc/nginx/conf.d/default.conf
|
||||
# Production stage
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy built assets from builder stage
|
||||
COPY --from=builder --chown=nginx:nginx /app/dist /usr/share/nginx/html
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# Create necessary directories with proper permissions
|
||||
RUN mkdir -p /var/cache/nginx /var/log/nginx /tmp && \
|
||||
chown -R nginx:nginx /var/cache/nginx /var/log/nginx /tmp && \
|
||||
chown -R nginx:nginx /usr/share/nginx/html
|
||||
|
||||
# Switch to non-root user
|
||||
USER nginx
|
||||
# Copy nginx configuration if needed
|
||||
# COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost/ || exit 1
|
||||
|
||||
# Start nginx with proper signal handling
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
# =============================================================================
|
||||
# TEST STAGE - For test environment testing
|
||||
# =============================================================================
|
||||
FROM production AS test
|
||||
|
||||
# Define build arguments for test stage
|
||||
ARG BUILD_MODE=test
|
||||
ARG NODE_ENV=test
|
||||
|
||||
# Set environment variables
|
||||
ENV BUILD_MODE=${BUILD_MODE}
|
||||
ENV NODE_ENV=${NODE_ENV}
|
||||
|
||||
# Copy test-specific nginx configuration
|
||||
COPY docker/staging.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Health check for staging
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost/health || exit 1
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
187
Gemfile.lock
@@ -22,7 +22,26 @@ GEM
|
||||
algoliasearch (1.27.5)
|
||||
httpclient (~> 2.8, >= 2.8.3)
|
||||
json (>= 1.5.1)
|
||||
artifactory (3.0.17)
|
||||
atomos (0.1.3)
|
||||
aws-eventstream (1.3.2)
|
||||
aws-partitions (1.1066.0)
|
||||
aws-sdk-core (3.220.1)
|
||||
aws-eventstream (~> 1, >= 1.3.0)
|
||||
aws-partitions (~> 1, >= 1.992.0)
|
||||
aws-sigv4 (~> 1.9)
|
||||
base64
|
||||
jmespath (~> 1, >= 1.6.1)
|
||||
aws-sdk-kms (1.99.0)
|
||||
aws-sdk-core (~> 3, >= 3.216.0)
|
||||
aws-sigv4 (~> 1.5)
|
||||
aws-sdk-s3 (1.182.0)
|
||||
aws-sdk-core (~> 3, >= 3.216.0)
|
||||
aws-sdk-kms (~> 1)
|
||||
aws-sigv4 (~> 1.5)
|
||||
aws-sigv4 (1.11.0)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
babosa (1.0.4)
|
||||
base64 (0.2.0)
|
||||
benchmark (0.4.0)
|
||||
bigdecimal (3.1.9)
|
||||
@@ -64,13 +83,96 @@ GEM
|
||||
nap (>= 0.8, < 2.0)
|
||||
netrc (~> 0.11)
|
||||
cocoapods-try (1.2.0)
|
||||
colored (1.2)
|
||||
colored2 (3.1.2)
|
||||
commander (4.6.0)
|
||||
highline (~> 2.0.0)
|
||||
concurrent-ruby (1.3.5)
|
||||
connection_pool (2.5.0)
|
||||
declarative (0.0.20)
|
||||
digest-crc (0.7.0)
|
||||
rake (>= 12.0.0, < 14.0.0)
|
||||
domain_name (0.6.20240107)
|
||||
dotenv (2.8.1)
|
||||
drb (2.2.1)
|
||||
emoji_regex (3.2.3)
|
||||
escape (0.0.4)
|
||||
ethon (0.16.0)
|
||||
ffi (>= 1.15.0)
|
||||
excon (0.112.0)
|
||||
faraday (1.10.4)
|
||||
faraday-em_http (~> 1.0)
|
||||
faraday-em_synchrony (~> 1.0)
|
||||
faraday-excon (~> 1.1)
|
||||
faraday-httpclient (~> 1.0)
|
||||
faraday-multipart (~> 1.0)
|
||||
faraday-net_http (~> 1.0)
|
||||
faraday-net_http_persistent (~> 1.0)
|
||||
faraday-patron (~> 1.0)
|
||||
faraday-rack (~> 1.0)
|
||||
faraday-retry (~> 1.0)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-cookie_jar (0.0.7)
|
||||
faraday (>= 0.8.0)
|
||||
http-cookie (~> 1.0.0)
|
||||
faraday-em_http (1.0.0)
|
||||
faraday-em_synchrony (1.0.0)
|
||||
faraday-excon (1.1.0)
|
||||
faraday-httpclient (1.0.1)
|
||||
faraday-multipart (1.1.0)
|
||||
multipart-post (~> 2.0)
|
||||
faraday-net_http (1.0.2)
|
||||
faraday-net_http_persistent (1.2.0)
|
||||
faraday-patron (1.0.0)
|
||||
faraday-rack (1.0.0)
|
||||
faraday-retry (1.0.3)
|
||||
faraday_middleware (1.2.1)
|
||||
faraday (~> 1.0)
|
||||
fastimage (2.4.0)
|
||||
fastlane (2.227.0)
|
||||
CFPropertyList (>= 2.3, < 4.0.0)
|
||||
addressable (>= 2.8, < 3.0.0)
|
||||
artifactory (~> 3.0)
|
||||
aws-sdk-s3 (~> 1.0)
|
||||
babosa (>= 1.0.3, < 2.0.0)
|
||||
bundler (>= 1.12.0, < 3.0.0)
|
||||
colored (~> 1.2)
|
||||
commander (~> 4.6)
|
||||
dotenv (>= 2.1.1, < 3.0.0)
|
||||
emoji_regex (>= 0.1, < 4.0)
|
||||
excon (>= 0.71.0, < 1.0.0)
|
||||
faraday (~> 1.0)
|
||||
faraday-cookie_jar (~> 0.0.6)
|
||||
faraday_middleware (~> 1.0)
|
||||
fastimage (>= 2.1.0, < 3.0.0)
|
||||
fastlane-sirp (>= 1.0.0)
|
||||
gh_inspector (>= 1.1.2, < 2.0.0)
|
||||
google-apis-androidpublisher_v3 (~> 0.3)
|
||||
google-apis-playcustomapp_v1 (~> 0.1)
|
||||
google-cloud-env (>= 1.6.0, < 2.0.0)
|
||||
google-cloud-storage (~> 1.31)
|
||||
highline (~> 2.0)
|
||||
http-cookie (~> 1.0.5)
|
||||
json (< 3.0.0)
|
||||
jwt (>= 2.1.0, < 3)
|
||||
mini_magick (>= 4.9.4, < 5.0.0)
|
||||
multipart-post (>= 2.0.0, < 3.0.0)
|
||||
naturally (~> 2.2)
|
||||
optparse (>= 0.1.1, < 1.0.0)
|
||||
plist (>= 3.1.0, < 4.0.0)
|
||||
rubyzip (>= 2.0.0, < 3.0.0)
|
||||
security (= 0.1.5)
|
||||
simctl (~> 1.6.3)
|
||||
terminal-notifier (>= 2.0.0, < 3.0.0)
|
||||
terminal-table (~> 3)
|
||||
tty-screen (>= 0.6.3, < 1.0.0)
|
||||
tty-spinner (>= 0.8.0, < 1.0.0)
|
||||
word_wrap (~> 1.0.0)
|
||||
xcodeproj (>= 1.13.0, < 2.0.0)
|
||||
xcpretty (~> 0.4.0)
|
||||
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
|
||||
fastlane-sirp (1.0.0)
|
||||
sysrandom (~> 1.0)
|
||||
ffi (1.17.1)
|
||||
ffi (1.17.1-aarch64-linux-gnu)
|
||||
ffi (1.17.1-aarch64-linux-musl)
|
||||
@@ -85,27 +187,107 @@ GEM
|
||||
fourflusher (2.3.1)
|
||||
fuzzy_match (2.0.4)
|
||||
gh_inspector (1.1.3)
|
||||
google-apis-androidpublisher_v3 (0.54.0)
|
||||
google-apis-core (>= 0.11.0, < 2.a)
|
||||
google-apis-core (0.11.3)
|
||||
addressable (~> 2.5, >= 2.5.1)
|
||||
googleauth (>= 0.16.2, < 2.a)
|
||||
httpclient (>= 2.8.1, < 3.a)
|
||||
mini_mime (~> 1.0)
|
||||
representable (~> 3.0)
|
||||
retriable (>= 2.0, < 4.a)
|
||||
rexml
|
||||
google-apis-iamcredentials_v1 (0.17.0)
|
||||
google-apis-core (>= 0.11.0, < 2.a)
|
||||
google-apis-playcustomapp_v1 (0.13.0)
|
||||
google-apis-core (>= 0.11.0, < 2.a)
|
||||
google-apis-storage_v1 (0.31.0)
|
||||
google-apis-core (>= 0.11.0, < 2.a)
|
||||
google-cloud-core (1.8.0)
|
||||
google-cloud-env (>= 1.0, < 3.a)
|
||||
google-cloud-errors (~> 1.0)
|
||||
google-cloud-env (1.6.0)
|
||||
faraday (>= 0.17.3, < 3.0)
|
||||
google-cloud-errors (1.5.0)
|
||||
google-cloud-storage (1.47.0)
|
||||
addressable (~> 2.8)
|
||||
digest-crc (~> 0.4)
|
||||
google-apis-iamcredentials_v1 (~> 0.1)
|
||||
google-apis-storage_v1 (~> 0.31.0)
|
||||
google-cloud-core (~> 1.6)
|
||||
googleauth (>= 0.16.2, < 2.a)
|
||||
mini_mime (~> 1.0)
|
||||
googleauth (1.8.1)
|
||||
faraday (>= 0.17.3, < 3.a)
|
||||
jwt (>= 1.4, < 3.0)
|
||||
multi_json (~> 1.11)
|
||||
os (>= 0.9, < 2.0)
|
||||
signet (>= 0.16, < 2.a)
|
||||
highline (2.0.3)
|
||||
http-cookie (1.0.8)
|
||||
domain_name (~> 0.5)
|
||||
httpclient (2.9.0)
|
||||
mutex_m
|
||||
i18n (1.14.7)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jmespath (1.6.2)
|
||||
json (2.10.2)
|
||||
jwt (2.10.1)
|
||||
base64
|
||||
logger (1.6.6)
|
||||
mini_magick (4.13.2)
|
||||
mini_mime (1.1.5)
|
||||
minitest (5.25.5)
|
||||
molinillo (0.8.0)
|
||||
multi_json (1.15.0)
|
||||
multipart-post (2.4.1)
|
||||
mutex_m (0.3.0)
|
||||
nanaimo (0.4.0)
|
||||
nap (1.1.0)
|
||||
naturally (2.2.1)
|
||||
netrc (0.11.0)
|
||||
nkf (0.2.0)
|
||||
optparse (0.6.0)
|
||||
os (1.1.4)
|
||||
plist (3.7.2)
|
||||
public_suffix (4.0.7)
|
||||
rake (13.2.1)
|
||||
representable (3.2.0)
|
||||
declarative (< 0.1.0)
|
||||
trailblazer-option (>= 0.1.1, < 0.2.0)
|
||||
uber (< 0.2.0)
|
||||
retriable (3.1.2)
|
||||
rexml (3.4.1)
|
||||
rouge (3.28.0)
|
||||
ruby-macho (2.5.1)
|
||||
ruby2_keywords (0.0.5)
|
||||
rubyzip (2.4.1)
|
||||
securerandom (0.4.1)
|
||||
security (0.1.5)
|
||||
signet (0.19.0)
|
||||
addressable (~> 2.8)
|
||||
faraday (>= 0.17.5, < 3.a)
|
||||
jwt (>= 1.5, < 3.0)
|
||||
multi_json (~> 1.10)
|
||||
simctl (1.6.10)
|
||||
CFPropertyList
|
||||
naturally
|
||||
sysrandom (1.0.5)
|
||||
terminal-notifier (2.0.0)
|
||||
terminal-table (3.0.2)
|
||||
unicode-display_width (>= 1.1.1, < 3)
|
||||
trailblazer-option (0.1.2)
|
||||
tty-cursor (0.7.1)
|
||||
tty-screen (0.8.2)
|
||||
tty-spinner (0.9.3)
|
||||
tty-cursor (~> 0.7)
|
||||
typhoeus (1.4.1)
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
uber (0.1.0)
|
||||
unicode-display_width (2.6.0)
|
||||
word_wrap (1.0.0)
|
||||
xcodeproj (1.27.0)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
atomos (~> 0.1.3)
|
||||
@@ -113,6 +295,10 @@ GEM
|
||||
colored2 (~> 3.1)
|
||||
nanaimo (~> 0.4.0)
|
||||
rexml (>= 3.3.6, < 4.0)
|
||||
xcpretty (0.4.0)
|
||||
rouge (~> 3.28.0)
|
||||
xcpretty-travis-formatter (1.0.1)
|
||||
xcpretty (~> 0.2, >= 0.0.7)
|
||||
|
||||
PLATFORMS
|
||||
aarch64-linux-gnu
|
||||
@@ -129,6 +315,7 @@ PLATFORMS
|
||||
|
||||
DEPENDENCIES
|
||||
cocoapods
|
||||
fastlane
|
||||
|
||||
BUNDLED WITH
|
||||
2.6.5
|
||||
|
||||
1456
GiftedDialog-Complete-Documentation.md
Normal file
469
GiftedDialog-Decomposition-Plan.md
Normal file
@@ -0,0 +1,469 @@
|
||||
# GiftedDialog Component Decomposition Plan
|
||||
|
||||
## Overview
|
||||
|
||||
This document outlines a comprehensive plan to refactor the GiftedDialog component by breaking it into smaller, more manageable sub-components. This approach will improve maintainability, testability, and reusability while preparing the codebase for future Pinia integration.
|
||||
|
||||
## Current State Analysis
|
||||
|
||||
The GiftedDialog component (1060 lines) is a complex Vue component that handles:
|
||||
|
||||
- **Two-step wizard UI**: Entity selection → Gift details
|
||||
- **Multiple entity types**: Person/Project as giver/recipient
|
||||
- **Complex conditional rendering**: Based on context and entity types
|
||||
- **Form validation and submission**: Gift recording with API integration
|
||||
- **State management**: UI flow, entity selection, form data
|
||||
|
||||
### Key Challenges
|
||||
|
||||
1. **Large single file**: Difficult to navigate and maintain
|
||||
2. **Mixed concerns**: UI logic, business logic, and API calls in one place
|
||||
3. **Complex state**: Multiple interconnected reactive properties
|
||||
4. **Testing difficulty**: Hard to test individual features in isolation
|
||||
5. **Reusability**: Components like entity grids could be reused elsewhere
|
||||
|
||||
## Decomposition Strategy
|
||||
|
||||
### Phase 1: Extract Display Components (✅ COMPLETED)
|
||||
|
||||
These components handle pure presentation with minimal business logic:
|
||||
|
||||
#### 1. PersonCard.vue ✅
|
||||
|
||||
- **Purpose**: Display individual person entities with selection capability
|
||||
- **Features**:
|
||||
- Person avatar using EntityIcon
|
||||
- Selection states (selectable, conflicted, disabled)
|
||||
- Time icon overlay for contacts
|
||||
- Click event handling
|
||||
- **Props**: `person`, `selectable`, `conflicted`, `showTimeIcon`
|
||||
- **Emits**: `person-selected`
|
||||
|
||||
#### 2. ProjectCard.vue ✅
|
||||
|
||||
- **Purpose**: Display individual project entities with selection capability
|
||||
- **Features**:
|
||||
- Project icon using ProjectIcon
|
||||
- Project name and issuer information
|
||||
- Click event handling
|
||||
- **Props**: `project`, `activeDid`, `allMyDids`, `allContacts`
|
||||
- **Emits**: `project-selected`
|
||||
|
||||
#### 3. EntitySummaryButton.vue ✅
|
||||
|
||||
- **Purpose**: Display selected entity with edit capability in step 2
|
||||
- **Features**:
|
||||
- Entity avatar (person or project)
|
||||
- Entity name and role label
|
||||
- Editable vs locked states
|
||||
- Edit button functionality
|
||||
- **Props**: `entity`, `entityType`, `label`, `editable`
|
||||
- **Emits**: `edit-requested`
|
||||
|
||||
#### 4. AmountInput.vue ✅
|
||||
|
||||
- **Purpose**: Specialized numeric input with increment/decrement controls
|
||||
- **Features**:
|
||||
- Increment/decrement buttons with validation
|
||||
- Configurable min/max values and step size
|
||||
- Input validation and formatting
|
||||
- v-model compatibility
|
||||
- **Props**: `value`, `min`, `max`, `step`, `inputId`
|
||||
- **Emits**: `update:value`
|
||||
|
||||
### Phase 2: Extract Layout Components (✅ COMPLETED)
|
||||
|
||||
These components handle layout and entity organization:
|
||||
|
||||
#### 5. EntityGrid.vue ✅
|
||||
|
||||
- **Purpose**: Unified grid layout for displaying people or projects
|
||||
- **Features**:
|
||||
- Responsive grid layout for people/projects
|
||||
- Special entity integration (You, Unnamed)
|
||||
- Conflict detection integration
|
||||
- Empty state messaging
|
||||
- Show All navigation
|
||||
- Event delegation for entity selection
|
||||
- **Props**: `entityType`, `entities`, `maxItems`, `activeDid`, `allMyDids`, `allContacts`, `conflictChecker`, `showYouEntity`, `youSelectable`, `showAllRoute`, `showAllQueryParams`
|
||||
- **Emits**: `entity-selected`
|
||||
|
||||
#### 6. SpecialEntityCard.vue ✅
|
||||
|
||||
- **Purpose**: Handle special entities like "You" and "Unnamed"
|
||||
- **Features**:
|
||||
- Special icon display (hand, question mark)
|
||||
- Conflict state handling
|
||||
- Configurable styling based on entity type
|
||||
- Click event handling
|
||||
- **Props**: `entityType`, `label`, `icon`, `selectable`, `conflicted`, `entityData`
|
||||
- **Emits**: `entity-selected`
|
||||
|
||||
#### 7. ShowAllCard.vue ✅
|
||||
|
||||
- **Purpose**: Handle "Show All" navigation functionality
|
||||
- **Features**:
|
||||
- Router-link integration
|
||||
- Query parameter passing
|
||||
- Consistent visual styling
|
||||
- Hover effects
|
||||
- **Props**: `entityType`, `routeName`, `queryParams`
|
||||
- **Emits**: None (uses router-link)
|
||||
|
||||
### Phase 3: Extract Step Components (✅ COMPLETED)
|
||||
|
||||
These components handle major UI sections:
|
||||
|
||||
#### 8. EntitySelectionStep.vue ✅
|
||||
|
||||
- **Purpose**: Complete step 1 entity selection interface
|
||||
- **Features**:
|
||||
- Dynamic step labeling based on context
|
||||
- EntityGrid integration for unified entity display
|
||||
- Conflict detection and prevention
|
||||
- Special entity handling (You, Unnamed)
|
||||
- Show All navigation with context preservation
|
||||
- Cancel functionality
|
||||
- Event delegation for entity selection
|
||||
- **Props**: `stepType`, `giverEntityType`, `recipientEntityType`, `showProjects`, `isFromProjectView`, `projects`, `allContacts`, `activeDid`, `allMyDids`, `conflictChecker`, `fromProjectId`, `toProjectId`, `giver`, `receiver`
|
||||
- **Emits**: `entity-selected`, `cancel`
|
||||
|
||||
#### 9. GiftDetailsStep.vue ✅
|
||||
|
||||
- **Purpose**: Complete step 2 gift details form interface
|
||||
- **Features**:
|
||||
- Entity summary display with edit capability
|
||||
- Gift description input with placeholder support
|
||||
- Amount input with increment/decrement controls
|
||||
- Unit code selection (HUR, USD, BTC, etc.)
|
||||
- Photo & more options navigation
|
||||
- Conflict detection and warning display
|
||||
- Form validation and submission
|
||||
- Cancel functionality
|
||||
- **Props**: `giver`, `receiver`, `giverEntityType`, `recipientEntityType`, `description`, `amount`, `unitCode`, `prompt`, `isFromProjectView`, `hasConflict`, `offerId`, `fromProjectId`, `toProjectId`
|
||||
- **Emits**: `update:description`, `update:amount`, `update:unitCode`, `edit-entity`, `explain-data`, `submit`, `cancel`
|
||||
|
||||
### Phase 4: Refactor Main Component (FINAL)
|
||||
|
||||
#### 9. GiftedDialog.vue (PLANNED REFACTOR)
|
||||
|
||||
- **Purpose**: Orchestrate sub-components and manage overall state
|
||||
- **Responsibilities**:
|
||||
- Step navigation logic
|
||||
- Entity conflict detection
|
||||
- API integration for gift recording
|
||||
- Success/error handling
|
||||
- Dialog visibility management
|
||||
|
||||
## Implementation Progress
|
||||
|
||||
### ✅ Completed Components
|
||||
|
||||
**Phase 1: Display Components**
|
||||
|
||||
1. **PersonCard.vue** - Individual person display with selection
|
||||
2. **ProjectCard.vue** - Individual project display with selection
|
||||
3. **EntitySummaryButton.vue** - Selected entity display with edit capability
|
||||
4. **AmountInput.vue** - Numeric input with increment/decrement controls
|
||||
|
||||
**Phase 2: Layout Components**
|
||||
5. **EntityGrid.vue** - Unified grid layout for entity selection
|
||||
6. **SpecialEntityCard.vue** - Special entities (You, Unnamed) with conflict handling
|
||||
7. **ShowAllCard.vue** - Show All navigation with router integration
|
||||
|
||||
**Phase 3: Step Components**
|
||||
8. **EntitySelectionStep.vue** - Complete step 1 entity selection interface
|
||||
9. **GiftDetailsStep.vue** - Complete step 2 gift details form interface
|
||||
|
||||
### 🔄 Next Steps
|
||||
|
||||
1. **Update GiftedDialog.vue** - Integrate all Phase 1-3 components
|
||||
2. **Test integration** - Ensure functionality remains intact
|
||||
3. **Create unit tests** - For all new components
|
||||
4. **Performance validation** - Ensure no regression
|
||||
5. **Phase 4 planning** - Refactor main component to orchestration only
|
||||
|
||||
### 📋 Future Phases
|
||||
|
||||
1. **Extract EntitySelectionStep.vue** - Complete step 1 logic
|
||||
2. **Extract GiftDetailsStep.vue** - Complete step 2 logic
|
||||
3. **Refactor main component** - Minimal orchestration logic
|
||||
4. **Add comprehensive tests** - Unit tests for each component
|
||||
5. **Prepare for Pinia** - State management migration
|
||||
|
||||
## Benefits of This Approach
|
||||
|
||||
### 1. Incremental Refactoring
|
||||
|
||||
- Each phase can be implemented and tested independently
|
||||
- Reduces risk of breaking existing functionality
|
||||
- Allows for gradual improvement over time
|
||||
|
||||
### 2. Improved Maintainability
|
||||
- Smaller, focused components are easier to understand
|
||||
- Clear separation of concerns
|
||||
- Easier to locate and fix bugs
|
||||
|
||||
### 3. Enhanced Testability
|
||||
- Individual components can be unit tested in isolation
|
||||
- Easier to mock dependencies
|
||||
- Better test coverage possible
|
||||
|
||||
### 4. Better Reusability
|
||||
- Components like EntityGrid can be used in other views
|
||||
- PersonCard and ProjectCard can be used throughout the app
|
||||
- AmountInput can be reused for other numeric inputs
|
||||
|
||||
### 5. Pinia Preparation
|
||||
- Smaller components make state management migration easier
|
||||
- Clear data flow patterns emerge
|
||||
- Easier to identify what state should be global vs local
|
||||
|
||||
## Integration Examples
|
||||
|
||||
### Using PersonCard in EntityGrid
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<ul class="grid grid-cols-4 sm:grid-cols-5 md:grid-cols-6 gap-x-2 gap-y-4">
|
||||
<PersonCard
|
||||
v-for="person in people"
|
||||
:key="person.did"
|
||||
:person="person"
|
||||
:conflicted="wouldCreateConflict(person.did)"
|
||||
@person-selected="handlePersonSelected"
|
||||
/>
|
||||
</ul>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Using AmountInput in GiftDetailsStep
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<AmountInput
|
||||
:value="amount"
|
||||
:min="0"
|
||||
:max="1000"
|
||||
input-id="gift-amount"
|
||||
@update:value="amount = $event"
|
||||
/>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Using EntitySummaryButton in GiftDetailsStep
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<EntitySummaryButton
|
||||
:entity="giver"
|
||||
entity-type="person"
|
||||
label="Received from:"
|
||||
:editable="canEditGiver"
|
||||
@edit-requested="handleEditGiver"
|
||||
/>
|
||||
<EntitySummaryButton
|
||||
:entity="receiver"
|
||||
entity-type="person"
|
||||
label="Given to:"
|
||||
:editable="canEditReceiver"
|
||||
@edit-requested="handleEditReceiver"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Using EntityGrid in EntitySelectionStep
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<div>
|
||||
<label class="block font-bold mb-4">
|
||||
{{ stepLabel }}
|
||||
</label>
|
||||
|
||||
<EntityGrid
|
||||
:entity-type="shouldShowProjects ? 'projects' : 'people'"
|
||||
:entities="shouldShowProjects ? projects : allContacts"
|
||||
:max-items="10"
|
||||
:active-did="activeDid"
|
||||
:all-my-dids="allMyDids"
|
||||
:all-contacts="allContacts"
|
||||
:conflict-checker="wouldCreateConflict"
|
||||
:show-you-entity="showYouEntity"
|
||||
:you-selectable="youSelectable"
|
||||
:show-all-route="showAllRoute"
|
||||
:show-all-query-params="showAllQueryParams"
|
||||
@entity-selected="handleEntitySelected"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Using SpecialEntityCard Standalone
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<ul class="grid grid-cols-4 gap-2">
|
||||
<SpecialEntityCard
|
||||
entity-type="you"
|
||||
label="You"
|
||||
icon="hand"
|
||||
:conflicted="wouldCreateConflict(activeDid)"
|
||||
:entity-data="{ did: activeDid, name: 'You' }"
|
||||
@entity-selected="handleYouSelected"
|
||||
/>
|
||||
|
||||
<SpecialEntityCard
|
||||
entity-type="unnamed"
|
||||
label="Unnamed"
|
||||
icon="circle-question"
|
||||
:entity-data="{ did: '', name: 'Unnamed' }"
|
||||
@entity-selected="handleUnnamedSelected"
|
||||
/>
|
||||
</ul>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Using EntitySelectionStep in GiftedDialog
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<div v-show="currentStep === 1">
|
||||
<EntitySelectionStep
|
||||
:step-type="stepType"
|
||||
:giver-entity-type="giverEntityType"
|
||||
:recipient-entity-type="recipientEntityType"
|
||||
:show-projects="showProjects"
|
||||
:is-from-project-view="isFromProjectView"
|
||||
:projects="projects"
|
||||
:all-contacts="allContacts"
|
||||
:active-did="activeDid"
|
||||
:all-my-dids="allMyDids"
|
||||
:conflict-checker="wouldCreateConflict"
|
||||
:from-project-id="fromProjectId"
|
||||
:to-project-id="toProjectId"
|
||||
:giver="giver"
|
||||
:receiver="receiver"
|
||||
@entity-selected="handleEntitySelected"
|
||||
@cancel="cancel"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
```
|
||||
|
||||
### Using GiftDetailsStep in GiftedDialog
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<div v-show="currentStep === 2">
|
||||
<GiftDetailsStep
|
||||
:giver="giver"
|
||||
:receiver="receiver"
|
||||
:giver-entity-type="giverEntityType"
|
||||
:recipient-entity-type="recipientEntityType"
|
||||
:description="description"
|
||||
:amount="parseFloat(amountInput)"
|
||||
:unit-code="unitCode"
|
||||
:prompt="prompt"
|
||||
:is-from-project-view="isFromProjectView"
|
||||
:has-conflict="hasPersonConflict"
|
||||
:offer-id="offerId"
|
||||
:from-project-id="fromProjectId"
|
||||
:to-project-id="toProjectId"
|
||||
@update:description="description = $event"
|
||||
@update:amount="amountInput = $event.toString()"
|
||||
@update:unit-code="unitCode = $event"
|
||||
@edit-entity="handleEditEntity"
|
||||
@explain-data="explainData"
|
||||
@submit="handleSubmit"
|
||||
@cancel="cancel"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
```
|
||||
|
||||
## Migration Strategy
|
||||
|
||||
### Backward Compatibility
|
||||
- Maintain existing API and prop interfaces
|
||||
- Ensure all existing functionality works unchanged
|
||||
- Preserve all event emissions and callbacks
|
||||
|
||||
### Testing Strategy
|
||||
- Create unit tests for each new component
|
||||
- Maintain existing integration tests
|
||||
- Add visual regression tests for UI components
|
||||
|
||||
### Performance Considerations
|
||||
- Monitor bundle size impact
|
||||
- Ensure no performance regression
|
||||
- Optimize component loading if needed
|
||||
|
||||
## Security Considerations
|
||||
|
||||
### Input Validation
|
||||
- AmountInput includes proper numeric validation
|
||||
- All user inputs are validated before processing
|
||||
- XSS prevention through proper Vue templating
|
||||
|
||||
### Data Handling
|
||||
- No sensitive data stored in component state
|
||||
- Proper prop validation and type checking
|
||||
- Secure API communication maintained
|
||||
|
||||
## Conclusion
|
||||
|
||||
This decomposition plan provides a structured approach to refactoring the GiftedDialog component while maintaining functionality and preparing for future enhancements. The incremental approach reduces risk and allows for continuous improvement of the codebase.
|
||||
|
||||
The completed Phase 1 components (PersonCard, ProjectCard, EntitySummaryButton, AmountInput) provide a solid foundation for the remaining phases and demonstrate the benefits of component decomposition in terms of maintainability, testability, and reusability.
|
||||
|
||||
---
|
||||
|
||||
## Final Integration Results
|
||||
|
||||
### ✅ **INTEGRATION COMPLETE**
|
||||
|
||||
**Completed on**: 2025-01-28
|
||||
|
||||
**Results:**
|
||||
- **Main GiftedDialog template**: Reduced from ~200 lines to ~20 lines
|
||||
- **Components created**: 9 focused, reusable components
|
||||
- **Lines of code**: ~2,000 lines of well-structured component code
|
||||
- **Backward compatibility**: 100% maintained
|
||||
- **Build status**: ✅ Passing
|
||||
- **Runtime status**: ✅ Working
|
||||
|
||||
**Components Successfully Integrated:**
|
||||
|
||||
1. **PersonCard.vue** - Individual person display with conflict detection
|
||||
2. **ProjectCard.vue** - Individual project display with issuer info
|
||||
3. **EntitySummaryButton.vue** - Selected entity display with edit capability
|
||||
4. **AmountInput.vue** - Numeric input with validation and controls
|
||||
5. **SpecialEntityCard.vue** - "You" and "Unnamed" entity handling
|
||||
6. **ShowAllCard.vue** - Navigation with router integration
|
||||
7. **EntityGrid.vue** - Unified grid layout orchestration
|
||||
8. **EntitySelectionStep.vue** - Complete Step 1 interface
|
||||
9. **GiftDetailsStep.vue** - Complete Step 2 interface
|
||||
|
||||
**Integration Benefits Achieved:**
|
||||
- ✅ **Maintainability**: Each component has single responsibility
|
||||
- ✅ **Testability**: Components can be unit tested in isolation
|
||||
- ✅ **Reusability**: Components can be used across the application
|
||||
- ✅ **Readability**: Clear separation of concerns and focused logic
|
||||
- ✅ **Debugging**: Easier to identify and fix issues
|
||||
- ✅ **Performance**: No performance regression, improved code splitting
|
||||
|
||||
**Next Steps:**
|
||||
1. **Pinia State Management**: Ready for state management migration
|
||||
2. **Component Testing**: Add comprehensive unit tests
|
||||
3. **Visual Testing**: Add Playwright component tests
|
||||
4. **Documentation**: Update component documentation
|
||||
5. **Optimization**: Fine-tune performance if needed
|
||||
|
||||
---
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Last Updated**: 2025-01-28
|
||||
**Status**: ✅ **INTEGRATION COMPLETE - READY FOR PRODUCTION**
|
||||
4508
GiftedDialog-Logic-Flow.md
Normal file
@@ -1,290 +0,0 @@
|
||||
# Build Architecture Guard - Husky Implementation
|
||||
|
||||
## Overview
|
||||
|
||||
The Build Architecture Guard protects your build system by enforcing
|
||||
documentation requirements through **Git hooks**. When you modify
|
||||
build-critical files, the system automatically blocks commits/pushes
|
||||
until you update `BUILDING.md`.
|
||||
|
||||
## 🎯 **Why Husky-Only?**
|
||||
|
||||
**Advantages:**
|
||||
|
||||
- ✅ **Immediate feedback** - Hooks run before commit/push
|
||||
- ✅ **Works everywhere** - No server-side CI/CD required
|
||||
- ✅ **Simple setup** - One tool, one configuration
|
||||
- ✅ **Fast execution** - No network delays or server queues
|
||||
- ✅ **Offline support** - Works without internet connection
|
||||
|
||||
**Trade-offs:**
|
||||
|
||||
- ⚠️ **Can be bypassed** - `git commit --no-verify` or `git push --no-verify`
|
||||
- ⚠️ **Developer discipline** - Relies on team following the rules
|
||||
|
||||
## 🏗️ **Architecture**
|
||||
|
||||
```bash
|
||||
Developer Workflow:
|
||||
1. Modify build files (scripts/, vite.config.*, etc.)
|
||||
2. Try to commit → Husky pre-commit hook runs
|
||||
3. Guard script checks if BUILDING.md was updated
|
||||
4. ✅ Commit succeeds if docs updated
|
||||
5. ❌ Commit blocked if docs missing
|
||||
```
|
||||
|
||||
## 🚀 **Quick Start**
|
||||
|
||||
### 1. Install Dependencies
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run prepare # Sets up Husky hooks
|
||||
```
|
||||
|
||||
### 2. Test the System
|
||||
|
||||
```bash
|
||||
# Modify a build file without updating BUILDING.md
|
||||
echo "# test" >> scripts/test.sh
|
||||
|
||||
# Try to commit (should be blocked)
|
||||
git add scripts/test.sh
|
||||
git commit -m "test: add build script"
|
||||
# ❌ Hook blocks commit with helpful message
|
||||
```
|
||||
|
||||
### 3. Fix and Retry
|
||||
|
||||
```bash
|
||||
# Update BUILDING.md with your changes
|
||||
echo "## New Build Script" >> BUILDING.md
|
||||
echo "Added test.sh for testing purposes" >> BUILDING.md
|
||||
|
||||
# Now commit should succeed
|
||||
git add BUILDING.md
|
||||
git commit -m "feat: add test build script with docs"
|
||||
# ✅ Commit succeeds
|
||||
```
|
||||
|
||||
## 🔧 **How It Works**
|
||||
|
||||
### Pre-commit Hook (`.husky/pre-commit`)
|
||||
|
||||
- **When**: Every `git commit`
|
||||
- **What**: Runs `./scripts/build-arch-guard.sh --staged`
|
||||
- **Result**: Blocks commit if build files changed without BUILDING.md update
|
||||
|
||||
### Pre-push Hook (`.husky/pre-push`)
|
||||
|
||||
- **When**: Every `git push`
|
||||
- **What**: Runs `./scripts/build-arch-guard.sh --range`
|
||||
- **Result**: Blocks push if commits contain undocumented build changes
|
||||
|
||||
### Guard Script (`scripts/build-arch-guard.sh`)
|
||||
|
||||
- **Detects**: Changes to build-sensitive file patterns
|
||||
- **Validates**: BUILDING.md was updated alongside changes
|
||||
- **Reports**: Clear error messages with guidance
|
||||
|
||||
## 📁 **Protected File Patterns**
|
||||
|
||||
The guard script monitors these paths for changes:
|
||||
|
||||
```text
|
||||
Build Configuration:
|
||||
├── vite.config.* # Vite configuration
|
||||
├── capacitor.config.ts # Capacitor configuration
|
||||
├── package.json # Package configuration
|
||||
├── package-lock.json # Lock files
|
||||
├── yarn.lock
|
||||
└── pnpm-lock.yaml
|
||||
|
||||
Build Scripts:
|
||||
├── scripts/** # All build and automation scripts
|
||||
├── electron/** # Electron build files
|
||||
├── android/** # Android build configuration
|
||||
├── ios/** # iOS build configuration
|
||||
├── sw_scripts/** # Service worker scripts
|
||||
└── sw_combine.js # Service worker combination
|
||||
|
||||
Deployment:
|
||||
├── Dockerfile # Docker configuration
|
||||
└── docker/** # Docker services
|
||||
```
|
||||
|
||||
## 🎭 **Usage Scenarios**
|
||||
|
||||
### Scenario 1: Adding a New Build Script
|
||||
|
||||
```bash
|
||||
# ❌ This will be blocked
|
||||
echo '#!/bin/bash' > scripts/new-build.sh
|
||||
git add scripts/new-build.sh
|
||||
git commit -m "feat: add new build script"
|
||||
# Hook blocks: "Build-sensitive files changed but BUILDING.md not updated"
|
||||
|
||||
# ✅ This will succeed
|
||||
echo '#!/bin/bash' > scripts/new-build.sh
|
||||
echo '## New Build Script' >> BUILDING.md
|
||||
echo 'Added new-build.sh for feature X' >> BUILDING.md
|
||||
git add scripts/new-build.sh BUILDING.md
|
||||
git commit -m "feat: add new build script with docs"
|
||||
# ✅ Commit succeeds
|
||||
```
|
||||
|
||||
### Scenario 2: Updating Vite Configuration
|
||||
|
||||
```bash
|
||||
# ❌ This will be blocked
|
||||
echo 'export default { newOption: true }' >> vite.config.ts
|
||||
git add vite.config.ts
|
||||
git commit -m "config: add new vite option"
|
||||
# Hook blocks: "Build-sensitive files changed but BUILDING.md not updated"
|
||||
|
||||
# ✅ This will succeed
|
||||
echo 'export default { newOption: true }' >> vite.config.ts
|
||||
echo '### New Vite Option' >> BUILDING.md
|
||||
echo 'Added newOption for improved performance' >> BUILDING.md
|
||||
git add vite.config.ts BUILDING.md
|
||||
git commit -m "config: add new vite option with docs"
|
||||
# ✅ Commit succeeds
|
||||
```
|
||||
|
||||
## 🚨 **Emergency Bypass**
|
||||
|
||||
**⚠️ Use sparingly and only for emergencies:**
|
||||
|
||||
```bash
|
||||
# Skip pre-commit hook
|
||||
git commit -m "emergency: critical fix" --no-verify
|
||||
|
||||
# Skip pre-push hook
|
||||
git push --no-verify
|
||||
|
||||
# Remember to update BUILDING.md later!
|
||||
```
|
||||
|
||||
## 🔍 **Troubleshooting**
|
||||
|
||||
### Hooks Not Running
|
||||
|
||||
```bash
|
||||
# Reinstall hooks
|
||||
npm run prepare
|
||||
|
||||
# Check hook files exist and are executable
|
||||
ls -la .husky/
|
||||
chmod +x .husky/*
|
||||
|
||||
# Verify Git hooks path
|
||||
git config core.hooksPath
|
||||
# Should show: .husky
|
||||
```
|
||||
|
||||
### Guard Script Issues
|
||||
|
||||
```bash
|
||||
# Test guard script manually
|
||||
./scripts/build-arch-guard.sh --help
|
||||
|
||||
# Check script permissions
|
||||
chmod +x scripts/build-arch-guard.sh
|
||||
|
||||
# Test with specific files
|
||||
./scripts/build-arch-guard.sh --staged
|
||||
```
|
||||
|
||||
### False Positives
|
||||
|
||||
```bash
|
||||
# If guard blocks legitimate changes, check:
|
||||
# 1. Are you modifying a protected file pattern?
|
||||
# 2. Did you update BUILDING.md?
|
||||
# 3. Is BUILDING.md staged for commit?
|
||||
|
||||
# View what the guard sees
|
||||
git diff --name-only --cached
|
||||
```
|
||||
|
||||
## 📋 **Best Practices**
|
||||
|
||||
### For Developers
|
||||
|
||||
1. **Update BUILDING.md first** - Document changes before implementing
|
||||
2. **Test locally** - Run `./scripts/build-arch-guard.sh --staged` before committing
|
||||
3. **Use descriptive commits** - Include context about build changes
|
||||
4. **Don't bypass lightly** - Only use `--no-verify` for true emergencies
|
||||
|
||||
### For Teams
|
||||
|
||||
1. **Document the system** - Ensure everyone understands the guard
|
||||
2. **Review BUILDING.md updates** - Verify documentation quality
|
||||
3. **Monitor bypass usage** - Track when hooks are skipped
|
||||
4. **Regular audits** - Check that BUILDING.md stays current
|
||||
|
||||
### For Maintainers
|
||||
|
||||
1. **Update protected patterns** - Modify `scripts/build-arch-guard.sh` as needed
|
||||
2. **Monitor effectiveness** - Track how often the guard catches issues
|
||||
3. **Team training** - Help developers understand the system
|
||||
4. **Continuous improvement** - Refine patterns and error messages
|
||||
|
||||
## 🔄 **Customization**
|
||||
|
||||
### Adding New Protected Paths
|
||||
|
||||
Edit `scripts/build-arch-guard.sh`:
|
||||
|
||||
```bash
|
||||
SENSITIVE=(
|
||||
# ... existing patterns ...
|
||||
"new-pattern/**" # Add your new pattern
|
||||
"*.config.js" # Add file extensions
|
||||
)
|
||||
```
|
||||
|
||||
### Modifying Error Messages
|
||||
|
||||
Edit the guard script to customize:
|
||||
|
||||
- Error message content
|
||||
- File pattern matching
|
||||
- Documentation requirements
|
||||
- Bypass instructions
|
||||
|
||||
### Adding New Validation Rules
|
||||
|
||||
Extend the guard script to check for:
|
||||
|
||||
- Specific file content patterns
|
||||
- Required documentation sections
|
||||
- Commit message formats
|
||||
- Branch naming conventions
|
||||
|
||||
## 📚 **Integration with PR Template**
|
||||
|
||||
The `pull_request_template.md` works with this system by:
|
||||
|
||||
- **Guiding developers** through required documentation
|
||||
- **Ensuring consistency** across all build changes
|
||||
- **Providing checklist** for comprehensive updates
|
||||
- **Supporting L1/L2/L3** change classification
|
||||
|
||||
## 🎯 **Success Metrics**
|
||||
|
||||
Track the effectiveness of your Build Architecture Guard:
|
||||
|
||||
- **Hook execution rate** - How often hooks run successfully
|
||||
- **Bypass frequency** - How often `--no-verify` is used
|
||||
- **Documentation quality** - BUILDING.md stays current
|
||||
- **Build failures** - Fewer issues from undocumented changes
|
||||
- **Team adoption** - Developers follow the process
|
||||
|
||||
---
|
||||
|
||||
**Status**: Active protection system
|
||||
**Architecture**: Client-side Git hooks only
|
||||
**Dependencies**: Husky, Git, Bash
|
||||
**Maintainer**: Development team
|
||||
**Related**: `pull_request_template.md`, `scripts/build-arch-guard.sh`
|
||||
@@ -1,82 +0,0 @@
|
||||
# Pull Request Template
|
||||
|
||||
## Location
|
||||
|
||||
The Build Architecture Guard PR template is located at:
|
||||
|
||||
- **`pull_request_template.md`** (root directory)
|
||||
|
||||
## Usage
|
||||
|
||||
When creating a pull request in Gitea, this template will automatically populate the PR description with the required checklist.
|
||||
|
||||
## Template Features
|
||||
|
||||
### Change Level Classification
|
||||
|
||||
- **L1**: Minor changes, documentation updates
|
||||
- **L2**: Moderate changes, new features, environment changes
|
||||
- **L3**: Major changes, architecture changes, new platforms
|
||||
|
||||
### Required Fields for All Levels
|
||||
|
||||
- Change level selection
|
||||
- Scope and impact description
|
||||
- Commands executed and their output
|
||||
- Documentation updates (BUILDING.md)
|
||||
- Rollback verification steps
|
||||
|
||||
### Additional Requirements for L3
|
||||
|
||||
- **ADR link**: Must provide URL to Architectural Decision Record
|
||||
- **Artifacts with SHA256**: Must list artifacts with cryptographic hashes
|
||||
|
||||
## Integration
|
||||
|
||||
This template works with:
|
||||
|
||||
- **Gitea Actions**: `.gitea/workflows/build-guard.yml`
|
||||
- **Client-side hooks**: `.husky/` pre-commit and pre-push hooks
|
||||
- **Guard script**: `scripts/build-arch-guard.sh`
|
||||
|
||||
## Example Usage
|
||||
|
||||
```markdown
|
||||
### Change Level
|
||||
- [x] Level: **L2**
|
||||
|
||||
**Why:** Adding new build script for Docker deployment
|
||||
|
||||
### Scope & Impact
|
||||
- [x] Files & platforms touched: scripts/build-docker.sh,
|
||||
BUILDING.md
|
||||
- [x] Risk triggers: Docker build process changes
|
||||
- [x] Mitigations/validation done: Tested on local Docker environment
|
||||
|
||||
### Commands Run
|
||||
- [x] Web: `npm run build:web:docker` ✅
|
||||
- [x] Docker: `docker build -t test-image .` ✅
|
||||
|
||||
### Artifacts
|
||||
- [x] Names + **sha256** of artifacts/installers:
|
||||
|
||||
Artifacts:
|
||||
```text
|
||||
test-image.tar a1b2c3d4e5f6...
|
||||
```
|
||||
|
||||
### Docs
|
||||
- [x] **BUILDING.md** updated (sections): Docker deployment
|
||||
- [x] Troubleshooting updated: Added Docker troubleshooting section
|
||||
|
||||
### Rollback
|
||||
- [x] Verified steps to restore previous behavior:
|
||||
1. `git revert HEAD`
|
||||
2. `docker rmi test-image`
|
||||
3. Restore previous BUILDING.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Note**: This template is enforced by the Build Architecture Guard
|
||||
system. Complete all required fields to ensure your PR can be merged.
|
||||
144
README.md
@@ -1,118 +1,80 @@
|
||||
# Time Safari Application
|
||||
# TimeSafari.app - Crowd-Funder for Time - PWA
|
||||
|
||||
**Author**: Matthew Raymer
|
||||
**Version**: 1.0.8-beta
|
||||
**Description**: Time Safari Application
|
||||
[Time Safari](https://timesafari.org/) allows people to ease into collaboration: start with expressions of gratitude
|
||||
and expand to crowd-fund with time & money, then record and see the impact of contributions.
|
||||
|
||||
## 🛡️ Build Architecture Guard
|
||||
## Roadmap
|
||||
|
||||
This project uses **Husky Git hooks** to protect the build system
|
||||
architecture. When you modify build-critical files, the system
|
||||
automatically blocks commits until you update `BUILDING.md`.
|
||||
See [project.task.yaml](project.task.yaml) for current priorities.
|
||||
(Numbers at the beginning of lines are estimated hours. See [taskyaml.org](https://taskyaml.org/) for details.)
|
||||
|
||||
### Quick Setup
|
||||
## Setup & Building
|
||||
|
||||
```bash
|
||||
npm run guard:setup # Install and activate the guard
|
||||
```
|
||||
Quick start:
|
||||
|
||||
### How It Works
|
||||
|
||||
- **Pre-commit**: Blocks commits if build files changed without
|
||||
BUILDING.md updates
|
||||
- **Pre-push**: Blocks pushes if commits contain undocumented build
|
||||
changes
|
||||
- **Protected paths**: `scripts/`, `vite.config.*`, `electron/`,
|
||||
`android/`, `ios/`, etc.
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
# Test the guard manually
|
||||
npm run guard:test
|
||||
|
||||
# Emergency bypass (use sparingly)
|
||||
git commit --no-verify
|
||||
git push --no-verify
|
||||
```
|
||||
|
||||
**📚 Full documentation**: See `README-BUILD-GUARD.md`
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Node.js 18+
|
||||
- npm, yarn, or pnpm
|
||||
- Git
|
||||
|
||||
### Installation
|
||||
* For setup, we recommend [pkgx](https://pkgx.dev), which installs what you need (either automatically or with the `dev` command). Core dependencies are typescript & npm; when building for other platforms, you'll need other things such as those in the pkgx.yaml & BUILDING.md files.
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run guard:setup # Sets up Build Architecture Guard
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Development
|
||||
See [BUILDING.md](BUILDING.md) for more details.
|
||||
|
||||
```bash
|
||||
npm run build:web:dev # Build web version
|
||||
npm run build:ios:test # Build iOS test version
|
||||
npm run build:android:test # Build Android test version
|
||||
npm run build:electron:dev # Build Electron dev version
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
```bash
|
||||
npm run test:web # Run web tests
|
||||
npm run test:mobile # Run mobile tests
|
||||
npm run test:all # Run all tests
|
||||
```
|
||||
|
||||
## 📁 Project Structure
|
||||
## Tests
|
||||
|
||||
```text
|
||||
timesafari/
|
||||
├── 📁 src/ # Source code
|
||||
├── 📁 scripts/ # Build and automation scripts
|
||||
├── 📁 electron/ # Electron configuration
|
||||
├── 📁 android/ # Android configuration
|
||||
├── 📁 ios/ # iOS configuration
|
||||
├── 📁 .husky/ # Git hooks (Build Architecture Guard)
|
||||
├── 📄 BUILDING.md # Build system documentation
|
||||
├── 📄 pull_request_template.md # PR template
|
||||
└── 📄 README-BUILD-GUARD.md # Guard system documentation
|
||||
```
|
||||
See [TESTING.md](test-playwright/TESTING.md) for detailed test instructions.
|
||||
|
||||
## 🔧 Build System
|
||||
|
||||
This project supports multiple platforms:
|
||||
|
||||
- **Web**: Vite-based build with service worker support
|
||||
- **Mobile**: Capacitor-based iOS and Android builds
|
||||
- **Desktop**: Electron-based cross-platform desktop app
|
||||
- **Docker**: Containerized deployment options
|
||||
|
||||
## 📚 Documentation
|
||||
## Icons
|
||||
|
||||
- **`BUILDING.md`** - Complete build system guide
|
||||
- **`README-BUILD-GUARD.md`** - Build Architecture Guard documentation
|
||||
- **`pull_request_template.md`** - PR template for build changes
|
||||
Application icons are in the `assets` directory, processed by the `capacitor-assets` command.
|
||||
|
||||
## 🤝 Contributing
|
||||
To add a Font Awesome icon, add to main.ts and reference with `font-awesome` element and `icon` attribute with the hyphenated name.
|
||||
|
||||
1. **Follow the Build Architecture Guard** - Update BUILDING.md when modifying build files
|
||||
2. **Use the PR template** - Complete the checklist for build-related changes
|
||||
3. **Test your changes** - Ensure builds work on affected platforms
|
||||
4. **Document updates** - Keep BUILDING.md current and accurate
|
||||
## Other
|
||||
|
||||
## 📄 License
|
||||
### Reference Material
|
||||
|
||||
[Add your license information here]
|
||||
* Notifications can be type of `toast` (self-dismiss), `info`, `success`, `warning`, and `danger`.
|
||||
They are done via [notiwind](https://www.npmjs.com/package/notiwind) and set up in App.vue.
|
||||
|
||||
---
|
||||
* [Customize Vue configuration](https://cli.vuejs.org/config/).
|
||||
|
||||
**Note**: The Build Architecture Guard is active and will block
|
||||
commits/pushes that modify build files without proper documentation
|
||||
updates. See `README-BUILD-GUARD.md` for complete details.
|
||||
* If you are deploying in a subdirectory, add it to `publicPath` in vue.config.js, eg: `publicPath: "/app/time-tracker/",`
|
||||
|
||||
### Code Organization
|
||||
|
||||
The project uses a centralized approach to type definitions and interfaces:
|
||||
|
||||
* `src/interfaces/` - Contains all TypeScript interfaces and type definitions
|
||||
* `deepLinks.ts` - Deep linking type system and Zod validation schemas
|
||||
* `give.ts` - Give-related interfaces and type definitions
|
||||
* `claims.ts` - Claim-related interfaces and verifiable credentials
|
||||
* `common.ts` - Shared interfaces and utility types
|
||||
* Other domain-specific interface files
|
||||
|
||||
Key principles:
|
||||
- All interfaces and types are defined in the interfaces folder
|
||||
- Zod schemas are used for runtime validation and type generation
|
||||
- Domain-specific interfaces are separated into their own files
|
||||
- Common interfaces are shared through `common.ts`
|
||||
- Type definitions are generated from Zod schemas where possible
|
||||
|
||||
### Kudos
|
||||
|
||||
Gifts make the world go 'round!
|
||||
|
||||
* [WebStorm by JetBrains](https://www.jetbrains.com/webstorm/) for the free open-source license
|
||||
* [Máximo Fernández](https://medium.com/@maxfarenas) for the 3D [code](https://github.com/maxfer03/vue-three-ns) and [explanatory post](https://medium.com/nicasource/building-an-interactive-web-portfolio-with-vue-three-js-part-three-implementing-three-js-452cb375ef80)
|
||||
* [Many tools & libraries](https://gitea.anomalistdesign.com/trent_larson/crowd-funder-for-time-pwa/src/branch/master/package.json#L10) such as Nodejs.org, IntelliJ Idea, Veramo.io, Vuejs.org, threejs.org
|
||||
* [Bush 3D model](https://sketchfab.com/3d-models/lupine-plant-bf30f1110c174d4baedda0ed63778439)
|
||||
* [Forest floor image](https://www.goodfreephotos.com/albums/textures/leafy-autumn-forest-floor.jpg)
|
||||
* Time Safari logo assisted by [DALL-E in ChatGPT](https://chat.openai.com/g/g-2fkFE8rbu-dall-e)
|
||||
* [DiceBear](https://www.dicebear.com/licenses/) and [Avataaars](https://www.dicebear.com/styles/avataaars/#details) for human-looking identicons
|
||||
* Some gratitude prompts thanks to [Develop Good Habits](https://www.developgoodhabits.com/gratitude-journal-prompts/)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
# What to do about storage for native apps?
|
||||
|
||||
|
||||
## Problem
|
||||
|
||||
We can't trust iOS IndexedDB to persist. I want to start delivering an app to people now, in preparation for presentations mid-June: Rotary on June 12 and Porcfest on June 17.
|
||||
@@ -13,6 +14,7 @@ We can't trust iOS IndexedDB to persist. I want to start delivering an app to pe
|
||||
|
||||
Also, with sensitive data, the accounts info should be encrypted.
|
||||
|
||||
|
||||
# Options
|
||||
|
||||
* There is a community [SQLite plugin for Capacitor](https://github.com/capacitor-community/sqlite) with encryption by [SQLCipher](https://github.com/sqlcipher/sqlcipher).
|
||||
@@ -27,12 +29,16 @@ Also, with sensitive data, the accounts info should be encrypted.
|
||||
|
||||
* Not an option yet: Dexie may support SQLite in [a future version](https://dexie.org/roadmap/dexie5.0).
|
||||
|
||||
|
||||
|
||||
# Current Plan
|
||||
|
||||
* Implement SQLite for Capacitor & web, with encryption. That will allow us to test quickly and keep the same interface for native & web, but we don't deal with migrations for current web users.
|
||||
|
||||
* After that is delivered, write a migration for current web users from IndexedDB to SQLite.
|
||||
|
||||
|
||||
|
||||
# Current method calls
|
||||
|
||||
... which is not 100% complete because the AI that generated thus claimed no usage of 'temp' DB.
|
||||
@@ -74,3 +80,5 @@ Logs operations:
|
||||
db.logs.get(todayKey) - Gets logs for a specific day
|
||||
db.logs.update(todayKey, { message: fullMessage }) - Updates logs
|
||||
db.logs.clear() - Clears all logs
|
||||
|
||||
|
||||
|
||||
7
android/.gitignore
vendored
@@ -84,6 +84,13 @@ freeline.py
|
||||
freeline/
|
||||
freeline_project_description.json
|
||||
|
||||
# fastlane
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots
|
||||
fastlane/test_output
|
||||
fastlane/readme.md
|
||||
|
||||
# Version control
|
||||
vcs.xml
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ android {
|
||||
applicationId "app.timesafari.app"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 40
|
||||
versionName "1.0.7"
|
||||
versionCode 26
|
||||
versionName "0.5.1"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
aaptOptions {
|
||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||
@@ -64,14 +64,6 @@ android {
|
||||
}
|
||||
}
|
||||
}
|
||||
packagingOptions {
|
||||
jniLibs {
|
||||
pickFirsts += ['**/lib/x86_64/libbarhopper_v3.so', '**/lib/x86_64/libimage_processing_util_jni.so', '**/lib/x86_64/libsqlcipher.so']
|
||||
}
|
||||
}
|
||||
|
||||
// Configure for 16 KB page size compatibility
|
||||
|
||||
|
||||
// Enable bundle builds (without which it doesn't work right for bundleDebug vs bundleRelease)
|
||||
bundle {
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
android:exported="true"
|
||||
android:label="@string/title_activity_main"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.NoActionBarLaunch">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"appId": "app.timesafari",
|
||||
"appName": "TimeSafari",
|
||||
"webDir": "dist",
|
||||
"bundledWebRuntime": false,
|
||||
"server": {
|
||||
"cleartext": true
|
||||
},
|
||||
@@ -16,32 +17,18 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"SplashScreen": {
|
||||
"launchShowDuration": 3000,
|
||||
"launchAutoHide": true,
|
||||
"backgroundColor": "#ffffff",
|
||||
"androidSplashResourceName": "splash",
|
||||
"androidScaleType": "CENTER_CROP",
|
||||
"showSpinner": false,
|
||||
"androidSpinnerStyle": "large",
|
||||
"iosSpinnerStyle": "small",
|
||||
"spinnerColor": "#999999",
|
||||
"splashFullScreen": true,
|
||||
"splashImmersive": true
|
||||
},
|
||||
"CapSQLite": {
|
||||
"SQLite": {
|
||||
"iosDatabaseLocation": "Library/CapacitorDatabase",
|
||||
"iosIsEncryption": false,
|
||||
"iosIsEncryption": true,
|
||||
"iosBiometric": {
|
||||
"biometricAuth": false,
|
||||
"biometricAuth": true,
|
||||
"biometricTitle": "Biometric login for TimeSafari"
|
||||
},
|
||||
"androidIsEncryption": false,
|
||||
"androidIsEncryption": true,
|
||||
"androidBiometric": {
|
||||
"biometricAuth": false,
|
||||
"biometricAuth": true,
|
||||
"biometricTitle": "Biometric login for TimeSafari"
|
||||
},
|
||||
"electronIsEncryption": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"ios": {
|
||||
@@ -57,65 +44,13 @@
|
||||
]
|
||||
},
|
||||
"android": {
|
||||
"allowMixedContent": true,
|
||||
"allowMixedContent": false,
|
||||
"captureInput": true,
|
||||
"webContentsDebuggingEnabled": false,
|
||||
"allowNavigation": [
|
||||
"*.timesafari.app",
|
||||
"*.jsdelivr.net",
|
||||
"api.endorser.ch",
|
||||
"10.0.2.2:3000"
|
||||
"api.endorser.ch"
|
||||
]
|
||||
},
|
||||
"electron": {
|
||||
"deepLinking": {
|
||||
"schemes": [
|
||||
"timesafari"
|
||||
]
|
||||
},
|
||||
"buildOptions": {
|
||||
"appId": "app.timesafari",
|
||||
"productName": "TimeSafari",
|
||||
"directories": {
|
||||
"output": "dist-electron-packages"
|
||||
},
|
||||
"files": [
|
||||
"dist/**/*",
|
||||
"electron/**/*"
|
||||
],
|
||||
"mac": {
|
||||
"category": "public.app-category.productivity",
|
||||
"target": [
|
||||
{
|
||||
"target": "dmg",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"win": {
|
||||
"target": [
|
||||
{
|
||||
"target": "nsis",
|
||||
"arch": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"linux": {
|
||||
"target": [
|
||||
{
|
||||
"target": "AppImage",
|
||||
"arch": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
],
|
||||
"category": "Utility"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
0
android/app/src/main/assets/public/cordova.js
vendored
Normal file
0
android/app/src/main/assets/public/cordova_plugins.js
vendored
Normal file
BIN
android/app/src/main/assets/public/favicon.ico
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 270 KiB |
|
After Width: | Height: | Size: 332 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 463 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 150 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 70 KiB |
BIN
android/app/src/main/assets/public/img/icons/favicon-16x16.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
android/app/src/main/assets/public/img/icons/favicon-32x32.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 46 KiB |
BIN
android/app/src/main/assets/public/img/icons/mstile-150x150.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="512.000000pt" height="512.000000pt" viewBox="0 0 512.000000 512.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
|
||||
<g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M2480 4005 c-25 -7 -58 -20 -75 -29 -16 -9 -40 -16 -52 -16 -17 0
|
||||
-24 -7 -28 -27 -3 -16 -14 -45 -24 -65 -21 -41 -13 -55 18 -38 25 13 67 13 92
|
||||
-1 15 -8 35 -4 87 17 99 39 130 41 197 10 64 -29 77 -31 107 -15 20 11 20 11
|
||||
-3 35 -12 13 -30 24 -38 24 -24 1 -132 38 -148 51 -8 7 -11 20 -7 32 12 37
|
||||
-40 47 -126 22z"/>
|
||||
<path d="M1450 3775 c-7 -8 -18 -15 -24 -15 -7 0 -31 -14 -54 -32 -29 -22 -38
|
||||
-34 -29 -40 17 -11 77 -10 77 1 0 5 16 16 35 25 60 29 220 19 290 -18 17 -9
|
||||
33 -16 37 -16 4 0 31 -15 60 -34 108 -70 224 -215 282 -353 30 -71 53 -190 42
|
||||
-218 -10 -27 -23 -8 -52 75 -30 90 -88 188 -120 202 -13 6 -26 9 -29 6 -3 -2
|
||||
11 -51 30 -108 28 -83 35 -119 35 -179 0 -120 -22 -127 -54 -17 -11 37 -13 21
|
||||
-18 -154 -5 -180 -8 -200 -32 -264 -51 -132 -129 -245 -199 -288 -21 -12 -79
|
||||
-49 -129 -80 -161 -102 -294 -141 -473 -141 -228 0 -384 76 -535 259 -81 99
|
||||
-118 174 -154 312 -31 121 -35 273 -11 437 19 127 19 125 -4 125 -23 0 -51
|
||||
-34 -87 -104 -14 -28 -33 -64 -41 -81 -19 -34 -22 -253 -7 -445 9 -106 12
|
||||
-119 44 -170 19 -30 42 -67 50 -81 64 -113 85 -140 130 -169 28 -18 53 -44 61
|
||||
-62 8 -20 36 -45 83 -76 62 -39 80 -46 151 -54 44 -5 96 -13 115 -18 78 -20
|
||||
238 -31 282 -19 24 6 66 8 95 5 76 -9 169 24 319 114 32 19 80 56 106 82 27
|
||||
26 52 48 58 48 5 0 27 26 50 58 48 66 56 70 132 71 62 1 165 29 238 64 112 55
|
||||
177 121 239 245 37 76 39 113 10 267 -12 61 -23 131 -26 156 -5 46 -5 47 46
|
||||
87 92 73 182 70 263 -8 l51 -49 -6 -61 c-4 -34 -13 -85 -21 -113 -28 -103 -30
|
||||
-161 -4 -228 16 -44 32 -67 55 -83 18 -11 39 -37 47 -58 10 -23 37 -53 73 -81
|
||||
32 -25 69 -57 82 -71 14 -14 34 -26 47 -26 12 0 37 -7 56 -15 20 -8 66 -17
|
||||
104 -20 107 -10 110 -11 150 -71 50 -75 157 -177 197 -187 18 -5 53 -24 78
|
||||
-42 71 -51 176 -82 304 -89 61 -4 127 -12 147 -18 29 -9 45 -8 77 6 23 9 50
|
||||
16 60 16 31 0 163 46 216 76 28 15 75 46 105 69 30 23 69 49 85 58 17 8 46 31
|
||||
64 51 19 20 40 36 47 36 18 0 77 70 100 120 32 66 45 108 55 173 5 32 16 71
|
||||
24 87 43 84 43 376 0 549 -27 105 -43 127 -135 188 -30 21 -65 46 -77 57 -13
|
||||
11 -23 17 -23 14 0 -3 21 -46 47 -94 79 -151 85 -166 115 -263 25 -83 28 -110
|
||||
28 -226 0 -144 -17 -221 -75 -335 -39 -77 -208 -244 -304 -299 -451 -263 -975
|
||||
-67 -1138 426 -23 70 -26 95 -28 254 -1 108 -7 183 -14 196 -6 12 -11 31 -11
|
||||
43 0 32 31 122 52 149 10 13 18 28 18 34 0 5 25 40 56 78 60 73 172 170 219
|
||||
190 30 12 30 13 6 17 -15 2 -29 -2 -37 -12 -6 -9 -16 -16 -22 -16 -6 0 -23
|
||||
-11 -39 -24 -15 -12 -33 -25 -40 -27 -17 -6 -82 -60 -117 -97 -65 -70 -75 -82
|
||||
-107 -133 -23 -34 -35 -46 -37 -35 -3 16 20 87 44 134 6 12 9 34 6 48 -4 22
|
||||
-8 25 -31 19 -14 -3 -38 -15 -53 -26 -34 -24 -34 -21 -6 28 65 112 184 206
|
||||
291 227 15 3 39 9 55 12 l27 6 -24 9 c-90 35 -304 -66 -478 -225 -39 -36 -74
|
||||
-66 -77 -66 -22 0 18 82 72 148 19 23 32 46 28 49 -4 4 -26 13 -49 19 -73 21
|
||||
-161 54 -171 64 -6 6 -20 10 -32 10 -21 0 -21 -1 -8 -40 45 -130 8 -247 -93
|
||||
-299 -25 -13 -31 0 -14 29 15 22 1 33 -22 17 -56 -36 -117 -22 -117 28 0 13
|
||||
-16 47 -35 76 -22 34 -33 60 -29 73 4 16 -3 26 -26 39 -16 10 -30 21 -30 25 1
|
||||
18 54 64 87 76 l38 13 -33 5 c-30 4 -115 -18 -154 -42 -13 -7 -20 -5 -27 8 -9
|
||||
16 -12 16 -53 1 -160 -61 -258 -104 -258 -114 0 -7 10 -20 21 -31 103 -91 217
|
||||
-297 249 -449 28 -135 41 -237 35 -276 -14 -91 -48 -170 -97 -220 -44 -47 -68
|
||||
-60 -68 -40 0 6 4 12 8 15 5 3 24 35 42 72 l33 67 -6 141 c-4 103 -11 158 -26
|
||||
205 -12 35 -21 70 -21 77 0 7 -20 56 -45 108 -82 173 -227 322 -392 401 -67
|
||||
33 -90 39 -163 42 -108 5 -130 10 -130 28 0 20 -63 20 -80 0z"/>
|
||||
<path d="M3710 3765 c0 -20 8 -28 39 -41 22 -8 42 -22 45 -30 5 -14 42 -19 70
|
||||
-8 10 4 -7 21 -58 55 -41 27 -79 49 -85 49 -6 0 -11 -11 -11 -25z"/>
|
||||
<path d="M3173 3734 c-9 -25 10 -36 35 -18 12 8 22 19 22 25 0 16 -50 10 -57
|
||||
-7z"/>
|
||||
<path d="M1982 3728 c6 -16 36 -34 44 -26 3 4 4 14 1 23 -7 17 -51 21 -45 3z"/>
|
||||
<path d="M1540 3620 c0 -5 7 -10 16 -10 8 0 12 5 9 10 -3 6 -10 10 -16 10 -5
|
||||
0 -9 -4 -9 -10z"/>
|
||||
<path d="M4467 3624 c-4 -4 23 -27 60 -50 84 -56 99 -58 67 -9 -28 43 -107 79
|
||||
-127 59z"/>
|
||||
<path d="M655 3552 c-11 -2 -26 -9 -33 -14 -7 -6 -27 -18 -45 -27 -36 -18 -58
|
||||
-64 -39 -83 9 -9 25 1 70 43 53 48 78 78 70 84 -2 1 -12 -1 -23 -3z"/>
|
||||
<path d="M1015 3460 c-112 -24 -247 -98 -303 -165 -53 -65 -118 -214 -136
|
||||
-311 -20 -113 -20 -145 -1 -231 20 -88 49 -153 102 -230 79 -113 186 -182 331
|
||||
-214 108 -24 141 -24 247 1 130 30 202 72 316 181 102 100 153 227 152 384 0
|
||||
142 -58 293 -150 395 -60 67 -180 145 -261 171 -75 23 -232 34 -297 19z m340
|
||||
-214 c91 -43 174 -154 175 -234 0 -18 -9 -51 -21 -73 -19 -37 -19 -42 -5 -64
|
||||
35 -54 12 -121 -48 -142 -22 -7 -47 -19 -55 -27 -9 -8 -41 -27 -71 -42 -50
|
||||
-26 -64 -29 -155 -29 -111 0 -152 14 -206 68 -49 49 -63 85 -64 162 0 59 4 78
|
||||
28 118 31 52 96 105 141 114 23 5 33 17 56 68 46 103 121 130 225 81z"/>
|
||||
<path d="M3985 3464 c-44 -7 -154 -44 -200 -67 -55 -28 -138 -96 -162 -132
|
||||
-10 -16 -39 -75 -64 -130 l-44 -100 0 -160 0 -160 45 -90 c53 -108 152 -214
|
||||
245 -264 59 -31 215 -71 281 -71 53 0 206 40 255 67 98 53 203 161 247 253 53
|
||||
113 74 193 74 280 -1 304 -253 564 -557 575 -49 2 -103 1 -120 -1z m311 -220
|
||||
c129 -68 202 -209 160 -309 -15 -35 -15 -42 -1 -72 26 -55 -3 -118 -59 -129
|
||||
-19 -3 -43 -15 -53 -26 -26 -29 -99 -64 -165 -78 -45 -10 -69 -10 -120 -1 -74
|
||||
15 -113 37 -161 91 -110 120 -50 331 109 385 24 8 44 23 52 39 6 14 18 38 25
|
||||
53 33 72 127 93 213 47z"/>
|
||||
<path d="M487 3394 c-21 -12 -27 -21 -25 -40 2 -14 7 -26 12 -27 14 -3 48 48
|
||||
44 66 -3 14 -6 14 -31 1z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 705 KiB |
@@ -0,0 +1,11 @@
|
||||
Model Information:
|
||||
* title: Lupine Plant
|
||||
* source: https://sketchfab.com/3d-models/lupine-plant-bf30f1110c174d4baedda0ed63778439
|
||||
* author: rufusrockwell (https://sketchfab.com/rufusrockwell)
|
||||
|
||||
Model License:
|
||||
* license type: CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
|
||||
* requirements: Author must be credited. Commercial use is allowed.
|
||||
|
||||
If you use this 3D model in your project be sure to copy paste this credit wherever you share it:
|
||||
This work is based on "Lupine Plant" (https://sketchfab.com/3d-models/lupine-plant-bf30f1110c174d4baedda0ed63778439) by rufusrockwell (https://sketchfab.com/rufusrockwell) licensed under CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
|
||||
BIN
android/app/src/main/assets/public/models/lupine_plant/scene.bin
Normal file
@@ -0,0 +1,229 @@
|
||||
{
|
||||
"accessors": [
|
||||
{
|
||||
"bufferView": 2,
|
||||
"componentType": 5126,
|
||||
"count": 2759,
|
||||
"max": [
|
||||
41.3074951171875,
|
||||
40.37548828125,
|
||||
87.85917663574219
|
||||
],
|
||||
"min": [
|
||||
-35.245540618896484,
|
||||
-36.895416259765625,
|
||||
-0.9094290137290955
|
||||
],
|
||||
"type": "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView": 2,
|
||||
"byteOffset": 33108,
|
||||
"componentType": 5126,
|
||||
"count": 2759,
|
||||
"max": [
|
||||
0.9999382495880127,
|
||||
0.9986748695373535,
|
||||
0.9985831379890442
|
||||
],
|
||||
"min": [
|
||||
-0.9998949766159058,
|
||||
-0.9975876212120056,
|
||||
-0.411094069480896
|
||||
],
|
||||
"type": "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView": 3,
|
||||
"componentType": 5126,
|
||||
"count": 2759,
|
||||
"max": [
|
||||
0.9987699389457703,
|
||||
0.9998998045921326,
|
||||
0.9577858448028564,
|
||||
1.0
|
||||
],
|
||||
"min": [
|
||||
-0.9987726807594299,
|
||||
-0.9990445971488953,
|
||||
-0.999801516532898,
|
||||
1.0
|
||||
],
|
||||
"type": "VEC4"
|
||||
},
|
||||
{
|
||||
"bufferView": 1,
|
||||
"componentType": 5126,
|
||||
"count": 2759,
|
||||
"max": [
|
||||
1.0061479806900024,
|
||||
0.9993550181388855
|
||||
],
|
||||
"min": [
|
||||
0.00279300007969141,
|
||||
0.0011620000004768372
|
||||
],
|
||||
"type": "VEC2"
|
||||
},
|
||||
{
|
||||
"bufferView": 0,
|
||||
"componentType": 5125,
|
||||
"count": 6378,
|
||||
"type": "SCALAR"
|
||||
}
|
||||
],
|
||||
"asset": {
|
||||
"extras": {
|
||||
"author": "rufusrockwell (https://sketchfab.com/rufusrockwell)",
|
||||
"license": "CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)",
|
||||
"source": "https://sketchfab.com/3d-models/lupine-plant-bf30f1110c174d4baedda0ed63778439",
|
||||
"title": "Lupine Plant"
|
||||
},
|
||||
"generator": "Sketchfab-12.68.0",
|
||||
"version": "2.0"
|
||||
},
|
||||
"bufferViews": [
|
||||
{
|
||||
"buffer": 0,
|
||||
"byteLength": 25512,
|
||||
"name": "floatBufferViews",
|
||||
"target": 34963
|
||||
},
|
||||
{
|
||||
"buffer": 0,
|
||||
"byteLength": 22072,
|
||||
"byteOffset": 25512,
|
||||
"byteStride": 8,
|
||||
"name": "floatBufferViews",
|
||||
"target": 34962
|
||||
},
|
||||
{
|
||||
"buffer": 0,
|
||||
"byteLength": 66216,
|
||||
"byteOffset": 47584,
|
||||
"byteStride": 12,
|
||||
"name": "floatBufferViews",
|
||||
"target": 34962
|
||||
},
|
||||
{
|
||||
"buffer": 0,
|
||||
"byteLength": 44144,
|
||||
"byteOffset": 113800,
|
||||
"byteStride": 16,
|
||||
"name": "floatBufferViews",
|
||||
"target": 34962
|
||||
}
|
||||
],
|
||||
"buffers": [
|
||||
{
|
||||
"byteLength": 157944,
|
||||
"uri": "scene.bin"
|
||||
}
|
||||
],
|
||||
"images": [
|
||||
{
|
||||
"uri": "textures/lambert2SG_baseColor.png"
|
||||
},
|
||||
{
|
||||
"uri": "textures/lambert2SG_normal.png"
|
||||
}
|
||||
],
|
||||
"materials": [
|
||||
{
|
||||
"alphaCutoff": 0.2,
|
||||
"alphaMode": "MASK",
|
||||
"doubleSided": true,
|
||||
"name": "lambert2SG",
|
||||
"normalTexture": {
|
||||
"index": 1
|
||||
},
|
||||
"pbrMetallicRoughness": {
|
||||
"baseColorTexture": {
|
||||
"index": 0
|
||||
},
|
||||
"metallicFactor": 0.0
|
||||
}
|
||||
}
|
||||
],
|
||||
"meshes": [
|
||||
{
|
||||
"name": "Object_0",
|
||||
"primitives": [
|
||||
{
|
||||
"attributes": {
|
||||
"NORMAL": 1,
|
||||
"POSITION": 0,
|
||||
"TANGENT": 2,
|
||||
"TEXCOORD_0": 3
|
||||
},
|
||||
"indices": 4,
|
||||
"material": 0,
|
||||
"mode": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"nodes": [
|
||||
{
|
||||
"children": [
|
||||
1
|
||||
],
|
||||
"matrix": [
|
||||
1.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
2.220446049250313e-16,
|
||||
-1.0,
|
||||
0.0,
|
||||
0.0,
|
||||
1.0,
|
||||
2.220446049250313e-16,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
1.0
|
||||
],
|
||||
"name": "Sketchfab_model"
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
2
|
||||
],
|
||||
"name": "LupineSF.obj.cleaner.materialmerger.gles"
|
||||
},
|
||||
{
|
||||
"mesh": 0,
|
||||
"name": "Object_2"
|
||||
}
|
||||
],
|
||||
"samplers": [
|
||||
{
|
||||
"magFilter": 9729,
|
||||
"minFilter": 9987,
|
||||
"wrapS": 10497,
|
||||
"wrapT": 10497
|
||||
}
|
||||
],
|
||||
"scene": 0,
|
||||
"scenes": [
|
||||
{
|
||||
"name": "Sketchfab_Scene",
|
||||
"nodes": [
|
||||
0
|
||||
]
|
||||
}
|
||||
],
|
||||
"textures": [
|
||||
{
|
||||
"sampler": 0,
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"sampler": 0,
|
||||
"source": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.6 MiB |
|
After Width: | Height: | Size: 4.7 MiB |
2
android/app/src/main/assets/public/robots.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow:
|
||||
@@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1" />
|
||||
</vector>
|
||||
170
android/app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillColor="#26A69A"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background>
|
||||
<inset android:drawable="@mipmap/ic_launcher_background" android:inset="16.7%" />
|
||||
</background>
|
||||
<foreground>
|
||||
<inset android:drawable="@mipmap/ic_launcher_foreground" android:inset="16.7%" />
|
||||
</foreground>
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background>
|
||||
<inset android:drawable="@mipmap/ic_launcher_background" android:inset="16.7%" />
|
||||
</background>
|
||||
<foreground>
|
||||
<inset android:drawable="@mipmap/ic_launcher_foreground" android:inset="16.7%" />
|
||||
</foreground>
|
||||
</adaptive-icon>
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="ic_launcher_background">#FFFFFF</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#FFFFFF</color>
|
||||
</resources>
|
||||
@@ -7,7 +7,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.12.1'
|
||||
classpath 'com.android.tools.build:gradle:8.9.1'
|
||||
classpath 'com.google.gms:google-services:4.4.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
||||
@@ -20,4 +20,4 @@ org.gradle.jvmargs=-Xmx1536m
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
android.suppressUnsupportedCompileSdk=36
|
||||
android.suppressUnsupportedCompileSdk=34
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
ext {
|
||||
minSdkVersion = 22
|
||||
compileSdkVersion = 36
|
||||
targetSdkVersion = 36
|
||||
compileSdkVersion = 34
|
||||
targetSdkVersion = 34
|
||||
androidxActivityVersion = '1.8.0'
|
||||
androidxAppCompatVersion = '1.6.1'
|
||||
androidxCoordinatorLayoutVersion = '1.2.0'
|
||||
|
||||