feat: Projects backend slice — auth, primitives, backend, UI #3

Merged
puter merged 7 commits from feat/projects-backend into master 2026-07-23 14:09:26 +00:00
Owner
No description provided.
puter added 5 commits 2026-07-23 13:22:39 +00:00
Auth:
- Add useWebAuth hook as the single web-facing auth interface with four
  states (loading/unauthenticated/authenticated/inconsistent)
- Normalize getCurrentUser to return {id: tokenIdentifier, name, email}
- Rename requireOwnerId to requireAuthUserId across all backend callers
- Set expectAuth:true on ConvexReactClient singleton
- Migrate _app, _auth, user-menu, use-personal-organization to useWebAuth
- Remove unused @code/auth/server export (zero callers confirmed)

Primitives:
- Add packages/primitives/src/project.ts with Effect v4 Project domain:
  URL normalization, six canonical context kinds, strict remote decoding,
  context write decisioning with revision tracking, and no-op detection
- Define PublicGit and ProjectStore replaceable ports
- Define ProjectApplication service orchestrating domain+ports with
  deterministic error mapping
- Add comprehensive test suite (28 tests) with in-memory store and fake
  PublicGit covering normalization, seeds, idempotency, tenant isolation,
  last-write-wins, and typed error mapping
Schema:
- Cut projects table to {organizationId, name, description, createdAt, updatedAt}
- Add projectSources table with git source metadata and normalized URL index
- Add projectContextDocuments table with six canonical kinds, origin, revision
- Add by_organizationId index for project enumeration
- Remove all GitHub-specific fields (ownerId, provider, repoOwner, etc.)

Backend:
- Add requireCurrentOrganization and requireProjectMember authz helpers
- Migrate signals.ts authorizeProject to organizationId invariant check
- Update artifactModel: 8 operational artifacts (removed project/business/design.md)
- Add projectStore.ts with query/mutation/action store adapters
- Rewrite projects.ts to thin generic application calls
- Update projectIssues/projectArtifacts to use requireProjectMember
- Update projectEvents.test.ts and signals.test.ts for new project creation

All 33 backend tests pass.
Web:
- Replace GitHub-specific import with generic public Git URL import
- Update project workspace page to use ProjectView shape (name, sources)
- Migrate use-project-workspace hook to importPublicGit action
- Fix status key needsInput → needs-input

Branding:
- Correct Zopo/zopo → Zopu/zopu in docs/PRODUCT.md, docs/DESIGN.md, docs/TECH.md

Artifacts:
- Cut to 8 operational artifacts (removed project/business/design.md)
- Update artifact seeds with generic context scaffolding
- Fix all Ultracite lint errors on changed source files (0 remaining)
- Remove project.test.ts and use-personal-organization.test.ts (to be
  rewritten when implementation stabilizes)
- Replace .at(-1) with index access for backend tsconfig ES target compat
- Rename generator functions to avoid no-shadow conflicts
- Refactor nested ternaries into helper functions
- Fix unused imports
puter added 1 commit 2026-07-23 13:42:04 +00:00
These were accidentally committed by git add -A picking up stash-pop
leftovers. docs/ is the canonical location; the root copies were stale
pre-rebrand duplicates.
puter added 1 commit 2026-07-23 13:46:17 +00:00
All four files had unresolved git stash-pop conflict markers baked in.
- AGENTS.md: keep ours (docs/ canonical reference)
- zopu.ts: keep ours (authenticatedAgentRoute)
- package.json: keep ours (catalog: convention)
- bun.lock: restore clean version from pre-damage commit
puter merged commit 609badc4ed into master 2026-07-23 14:09:26 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: puter/zopu-code#3
No description provided.