mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-28 15:26:53 +05:00
feat(ipuaro): add working demo project examples
Added comprehensive demo project showcasing ipuaro capabilities: New Files: - examples/demo-project/: Complete TypeScript demo application - src/: User management, auth, validation, logging (336 LOC) - tests/: Vitest unit tests for UserService - Configuration: package.json, tsconfig.json, .ipuaro.json Demo Features: - UserService with CRUD operations - AuthService with login/logout/verify - Validation utilities (email, password) - Logger utility with multiple log levels - TypeScript types and interfaces - Intentional TODOs (2) and FIXMEs (1) for tool demonstration Documentation: - README.md: Detailed usage guide with example queries - EXAMPLE_CONVERSATIONS.md: Realistic conversation scenarios - Tool demonstration scenarios (bug fix, refactoring, features) - Workflow examples (security audit, optimization, code review) Updated: - packages/ipuaro/README.md: Added Quick Start section linking to examples Project Statistics: - 12 files total - 336 lines of TypeScript code - 7 source modules demonstrating various patterns - Full test coverage examples - Demonstrates all 18 tools capabilities This completes the "Examples working" requirement for v1.0.0
This commit is contained in:
41
packages/ipuaro/examples/demo-project/src/utils/logger.ts
Normal file
41
packages/ipuaro/examples/demo-project/src/utils/logger.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Simple logging utility
|
||||
*/
|
||||
|
||||
export type LogLevel = "debug" | "info" | "warn" | "error"
|
||||
|
||||
export class Logger {
|
||||
constructor(private context: string) {}
|
||||
|
||||
debug(message: string, meta?: Record<string, unknown>): void {
|
||||
this.log("debug", message, meta)
|
||||
}
|
||||
|
||||
info(message: string, meta?: Record<string, unknown>): void {
|
||||
this.log("info", message, meta)
|
||||
}
|
||||
|
||||
warn(message: string, meta?: Record<string, unknown>): void {
|
||||
this.log("warn", message, meta)
|
||||
}
|
||||
|
||||
error(message: string, error?: Error, meta?: Record<string, unknown>): void {
|
||||
this.log("error", message, { ...meta, error: error?.message })
|
||||
}
|
||||
|
||||
private log(level: LogLevel, message: string, meta?: Record<string, unknown>): void {
|
||||
const timestamp = new Date().toISOString()
|
||||
const logEntry = {
|
||||
timestamp,
|
||||
level,
|
||||
context: this.context,
|
||||
message,
|
||||
...(meta && { meta })
|
||||
}
|
||||
console.log(JSON.stringify(logEntry))
|
||||
}
|
||||
}
|
||||
|
||||
export function createLogger(context: string): Logger {
|
||||
return new Logger(context)
|
||||
}
|
||||
Reference in New Issue
Block a user