Skip to content

feat: independent project creation + canvas filtering#11

Merged
StatPan merged 2 commits intomainfrom
feat/issue-10-project-hierarchy
Apr 10, 2026
Merged

feat: independent project creation + canvas filtering#11
StatPan merged 2 commits intomainfrom
feat/issue-10-project-hierarchy

Conversation

@StatPan
Copy link
Copy Markdown
Owner

@StatPan StatPan commented Apr 10, 2026

Closes #10

What

  • Schema: project.directory_key nullable, user_created column (0=auto, 1=user)
  • API: POST /api/project for explicit creation, POST /api/session accepts projectId
  • Store: extract rebuildGraph helper (replaces 9 duplicate buildGraph calls), filter by activeProjectKey, setActiveProjectKey triggers rebuild, createProject action
  • HomeScreen: "+ New Project" input/button, improved empty state
  • Canvas: passes activeProjectKey as projectId on session creation

Why

Fresh installs show an empty HomeScreen with no way to create projects — projects were auto-derived from sessions. Now projects are first-class entities (Figma-like). Auto-grouping kept as fallback for CLI-originated sessions.

Test plan

  • pnpm test passes (72 tests)
  • pnpm exec tsc --noEmit passes
  • pnpm exec tsc --noEmit -p tsconfig.client.json passes
  • Create project from empty HomeScreen → enter → create session → only that session visible
  • "View All" shows all sessions across projects

StatPan added 2 commits April 10, 2026 23:38
- Schema: project.directory_key nullable, add user_created column
- Migration 0006: rename-recreate for SQLite
- POST /api/project: create project with name + optional directory
- POST /api/session: accept optional projectId for assignment
- Store: extract rebuildGraph helper (replaces 9 duplicate buildGraph calls),
  filter sessions by activeProjectKey, setActiveProjectKey triggers rebuild,
  add createProject action
- HomeScreen: + New Project input/button, improved empty state CTA
- Canvas: pass activeProjectKey as projectId on session creation
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enables manual project creation and session association by updating the database schema, adding a creation UI to the Home Screen, and implementing the necessary backend routes. Feedback suggests improving the user experience by providing UI feedback for failed project creations and handling database unique constraint violations on the server to prevent internal errors.

Comment thread src/client/HomeScreen.tsx
Comment on lines +152 to +154
} catch (err) {
console.error('[HomeScreen] create project failed', err)
} finally {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The error handling for project creation only logs to the console. If the API call fails (e.g., due to a network issue or a duplicate directory key on the server), the user will see the button stop loading but won't know why the project wasn't created. Consider adding a simple error state or a toast notification to inform the user.

if (typeof body.name !== 'string' || !body.name.trim()) {
return c.json({ error: 'name is required' }, 400)
}
const proj = createProject(body.name.trim(), body.directory?.trim() || null)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The createProject call can throw a SqliteError if the provided directory key already exists in the database (due to the UNIQUE constraint). This would result in a 500 Internal Server Error. It's better to check for existence first or catch the error and return a 409 Conflict or 400 Bad Request with a descriptive message.

@StatPan StatPan merged commit a1d09e3 into main Apr 10, 2026
1 check passed
@StatPan StatPan deleted the feat/issue-10-project-hierarchy branch April 10, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: independent project creation + canvas filtering

1 participant