Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"root": true,
"extends": ["eslint:recommended", "prettier"],
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2020
},
"env": {
"browser": true,
"es2017": true,
"node": true
},
"overrides": [
{
"files": ["*.svelte"],
"parser": "svelte-eslint-parser",
"extends": ["plugin:svelte/recommended"],
"parserOptions": {
"parser": "@typescript-eslint/parser"
}
}
],
"rules": {
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
}
}
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI/CD Pipeline

on:
push:
branches: [main, develop]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run check
- run: npm run test
- run: npm run build

security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- run: npm ci
- run: npm audit --audit-level moderate

deploy:
needs: [test, security]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-project-id: ${{ secrets.PROJECT_ID }}
148 changes: 148 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Dependency directories
node_modules/

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
public

# Storybook build outputs
.out
.storybook-out
storybook-static

# Rollup.js default build output
dist/

# Uncomment the public line if your project uses Gatsby
# https://nextjs.org/blog/next-9-1#public-directory-support
# https://create-react-app.dev/docs/using-the-public-folder/#docsNav
# public

# Storybook build outputs
.out
.storybook-out

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# SvelteKit
.svelte-kit

# Vercel
.vercel

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

# Environment variables
.env
.env.local
.env.*.local

# IDEs
.vscode
.idea

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Testing
coverage/
.nyc_output

# Temporary files
/tmp

# Build artifacts
dist/
build/
15 changes: 15 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}
97 changes: 97 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Petalytics API Documentation

## AI Analysis Integration

Petalytics integrates directly with OpenRouter API for AI-powered pet insights.

### Authentication
Users provide their own OpenRouter API key through the Guardian Panel.

### Analysis Request Format
```typescript
interface AnalysisRequest {
pet: {
name: string;
breed: string;
age: number;
gender: 'male' | 'female';
};
entry: {
content: string;
date: string;
mood?: string;
activityLevel?: string;
};
recentHistory: JournalEntry[];
}
```

### Analysis Response Format

```typescript
interface AnalysisResult {
summary: string;
moodTrend: 'improving' | 'stable' | 'concerning';
activityLevel: 'low' | 'normal' | 'high';
healthConcerns: string[];
recommendations: string[];
nextCheckupSuggestion?: string;
}
```

### Example Usage

```javascript
import { AIAnalyzer } from '$lib/utils/ai-analysis';

const analyzer = new AIAnalyzer(apiKey);
const result = await analyzer.analyzeJournalEntry(pet, entry);
```

## Data Export/Import

### Export Format (JSONL)

Each line contains a JSON object:

```jsonl
{"version": "1.0.0"}
{"exportDate": "2025-01-01T00:00:00.000Z"}
{"pet": {"id": "123", "name": "Buddy", ...}}
{"aiAnalyses": {"entry-1": {"summary": "...", ...}}}
```

### Import Validation

* File must have `.jsonl` extension
* Version compatibility checking
* Data structure validation
* Duplicate handling

## LocalStorage Schema

### Pet Data

```javascript
localStorage.setItem('petalytics-pets', JSON.stringify([
{
id: string,
name: string,
breed: string,
age: number,
profileImageUrl?: string,
journalEntries: JournalEntry[]
}
]));
```

### Guardian Data

```javascript
localStorage.setItem('petalytics-guardian', JSON.stringify({
name: string,
apiKey: string,
preferences: object,
apiKeyValid: boolean
}));
```
Loading
Loading