LifeMate — Personal, Family & Learning Companion
test/personal-notification-settings
chore/phase1-repository-cleanup
deploy/stable-web-apk
deployment-static
design/mobile-accessibility-v2
design/mobile-navigation-review
docs/child-education-access-decision
docs/offline-data-rescue-options
docs/owner-guide-and-delivery-plan
docs/phase1-policy-options
docs/public-review-live-2026-10-15
feat/aparat-learning-library
feat/child-device-safety
feat/child-identity-schema
feat/flutter-mobile-navigation
feat/learning-content-operations
feat/local-signing-preflight
feat/online-family-stage0
feat/personal-encrypted-recovery
feat/private-planner-series-api
feat/public-review-page
feat/standalone-weekly-planner
feat/weekly-planner-android
final-feature-1/iran-family-school
fix/auth-abuse-expiry-safety
fix/auth-expiry-after-lock
fix/backend-request-safety
fix/lifeguide-bootstrap-naming-ci
fix/lifeguide-pages-qa-base-preflight
fix/lifeguide-qa-pages-env-deployment
fix/local-task-persistence
fix/managed-child-session-boundary
fix/personal-jalali-dates
fix/personal-notification-controls
fix/personal-upgrade-delivery-guard
fix/sms-approval-gates
fix/study-duration-display
infra/cloudflare-neon-migration
infra/lifeguide-cloudflare-qa
infra/lifeguide-github-pages-qa
infra/lifeguide-supabase-qa
main
phase-1/foundation-completion
phase-2/product-foundation-identity
phase-3/planner-school-family-core
phase-4/ai-learning-wellbeing
phase-5/hardening-observability-release
test/android-reminder-acceptance
test/personal-notification-settings
test/personal-recovery-acceptance
test/role-entry-apk
| 1 | // This command does not contact video providers, AI, email or live services. |
| 2 | import fs from 'node:fs/promises'; |
| 3 | import pg from 'pg'; |
| 4 | import {localContentReviewConnection,inspectLearningContent,reviewLearningContent,ContentPublicationError} from '../src/content_publication.js'; |
| 5 | |
| 6 | const [action,first,second,...extra]=process.argv.slice(2); |
| 7 | let client; |
| 8 | async function operationFile(filename) { |
| 9 | const maximum=1024*1024,file=await fs.open(filename,'r'); |
| 10 | try { |
| 11 | const details=await file.stat(); |
| 12 | if(!details.isFile()||details.size>maximum) throw new ContentPublicationError('invalid_operation_file'); |
| 13 | const buffer=Buffer.alloc(maximum+1);let length=0; |
| 14 | while(length<buffer.length) { |
| 15 | const {bytesRead}=await file.read(buffer,length,buffer.length-length,null); |
| 16 | if(!bytesRead) break;length+=bytesRead; |
| 17 | } |
| 18 | if(length>maximum) throw new ContentPublicationError('invalid_operation_file'); |
| 19 | return JSON.parse(buffer.subarray(0,length).toString('utf8')); |
| 20 | } finally {await file.close();} |
| 21 | } |
| 22 | try { |
| 23 | if(extra.length||!['inspect','dry-run','apply'].includes(action)||!first|| |
| 24 | (action==='inspect'?!second:second!==undefined)) throw new ContentPublicationError('invalid_command'); |
| 25 | const connection=localContentReviewConnection(process.env); |
| 26 | const body=action==='inspect'?null:await operationFile(first); |
| 27 | client=new pg.Client({connectionString:connection});await client.connect(); |
| 28 | const result=action==='inspect'?await inspectLearningContent(client,first,second): |
| 29 | await reviewLearningContent(client,body,{apply:action==='apply'}); |
| 30 | console.log(JSON.stringify(result)); |
| 31 | } catch(error) { |
| 32 | // Do not print database URLs, raw driver errors or the chosen JSON payload. |
| 33 | console.error(JSON.stringify({status:'rejected',code:error instanceof ContentPublicationError?error.code:'content_operation_rejected'})); |
| 34 | process.exitCode=1; |
| 35 | } finally {if(client) await client.end().catch(()=>{});} |