Skip to content

[Claude Design adoption] PR-A: designs hub + multi-type create wizard#51

Merged
hqhq1025 merged 7 commits intomainfrom
wt/cd-adopt-a-designs-hub
Apr 19, 2026
Merged

[Claude Design adoption] PR-A: designs hub + multi-type create wizard#51
hqhq1025 merged 7 commits intomainfrom
wt/cd-adopt-a-designs-hub

Conversation

@hqhq1025
Copy link
Copy Markdown
Collaborator

Summary

Implements PR-A from docs/research/28-claude-design-ux-adoption.md — adopts Claude Design's hub navigation and typed project creation flow.

  • Designs hub (HubView) with four sibling tabs: Recent / Your designs / Examples / Design systems. Recent and Your designs are wired to a local project list; Examples and Design systems render placeholders that PR-B and PR-C will populate.
  • Create modal with four type tabs (Prototype / Slide deck / From template / Other). Each tab shows only its own fields; the CTA stays disabled until the project name is non-empty (and a template is picked, for the From-template tab).
  • Project schema lives in packages/shared (Project, ProjectDraft, PROJECT_SCHEMA_VERSION = 1). Persisted to localStorage for now; PR-C will move it to SQLite without a public API change.
  • App shell: default view is now hub; the workspace gains a small "All designs" breadcrumb so users can return; ESC walks settings → workspace → hub.
  • i18n: full coverage for both en and zh-CN under hub.* and create.*.
  • Tokens: every value comes from packages/ui tokens — no hard-coded colors / spacing / typography.

What was deferred (and why)

  • Wireframe vs high-fidelity cards — owned by PR-F per the doc; the Prototype form leaves a labeled slot with helper copy.
  • Examples gallery contents — owned by PR-B.
  • Design systems CRUD + SQLite tables — owned by PR-C; main process untouched here per the file-ownership constraint.
  • Auto-suggest project name button — listed as optional in the doc; deferred to keep the PR lean.
  • TopBar / global search / status footer — owned by PR-D; left untouched.

PRINCIPLES §5b

  • Compatibility: green — no IPC / main / on-disk schema changes; existing 144-test suite passes unchanged.
  • Upgradeability: green — Project carries schemaVersion: 1; localStorage payloads validated on read.
  • No bloat: green — zero new dependencies; reuses lucide-react + zustand + tokens.
  • Elegance: green — single store action per intent; per-type forms < 40 LOC; pure buildDraft helper makes the form testable without DOM.

Test plan

  • pnpm typecheck clean
  • pnpm lint clean (only pre-existing complexity warnings remain)
  • pnpm test — 144 / 144 pass, including new CreateProjectModal.test.ts (6 cases)
  • Manual: launch app, land on hub, click "+ New design", create one of each type, confirm it appears in Recent + Your designs and the workspace opens with the correct breadcrumb
  • Manual: switch language to zh-CN and re-walk the create flow

Notes for reviewers

  • Branch base is main; wt/projects-management was not yet pushed to origin when this branch was cut, so the Project schema is owned here per the doc's fallback clause.
  • Modal uses role="dialog" on a <div> (rather than native <dialog>) so that the existing --color-overlay token + click-to-dismiss backdrop continue to behave consistently across themes; suppressed locally with a biome-ignore and a justification.

@hqhq1025 hqhq1025 force-pushed the wt/cd-adopt-a-designs-hub branch from 0c5a082 to a7a1ece Compare April 18, 2026 19:21
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Blocker] Silent fallback on project storage read/write errors violates repo constraint and hides data issues from users — catches return [] or no-op without surfacing context in apps/desktop/src/renderer/src/store.ts:147, apps/desktop/src/renderer/src/store.ts:156
    Suggested fix:

    function readStoredProjects(): Project[] {
      if (typeof window === 'undefined') return [];
      const raw = window.localStorage.getItem(PROJECTS_STORAGE_KEY);
      if (!raw) return [];
      const parsed = JSON.parse(raw) as unknown;
      if (!Array.isArray(parsed)) {
        throw new Error('Invalid projects storage payload: expected array');
      }
      return parsed.flatMap((item) => {
        const result = Project.safeParse(item);
        if (!result.success) {
          throw new Error(`Invalid project record in storage: ${result.error.message}`);
        }
        return [result.data];
      });
    }
    
    function persistProjects(projects: Project[]): void {
      if (typeof window === 'undefined') return;
      window.localStorage.setItem(PROJECTS_STORAGE_KEY, JSON.stringify(projects));
    }
  • [Blocker] New UI introduces hardcoded sizing values instead of tokenized values, conflicting with the project’s UI-token hard constraint — apps/desktop/src/renderer/src/views/create/SlideDeckForm.tsx:27 (also appears in other added UI lines)
    Suggested fix:

    <input
      type="checkbox"
      checked={speakerNotes}
      onChange={(e) => setSpeakerNotes(e.target.checked)}
      className="mt-[var(--space-1)] w-[var(--size-control-sm)] h-[var(--size-control-sm)] accent-[var(--color-accent)]"
    />
  • [Major] Persisted project records are only filtered by schemaVersion and not schema-validated, so malformed local data can pass through and later break hub rendering/sorting — apps/desktop/src/renderer/src/store.ts:141
    Suggested fix:

    return parsed.flatMap((item) => {
      const r = Project.safeParse(item);
      return r.success ? [r.data] : [];
    });
  • [Major] Opening an existing project does not reset/load project-scoped workspace state, so users can see stale prompt/preview/messages from a different project (cross-project state leakage) — apps/desktop/src/renderer/src/store.ts:699
    Suggested fix:

    openProject(id) {
      const project = get().projects.find((p) => p.id === id);
      if (!project) return;
      set({
        currentProjectId: id,
        view: 'workspace',
        messages: [],
        previewHtml: null,
        prompt: '',
        generationStage: 'idle',
        isGenerating: false,
        activeGenerationId: null,
      });
    },

Summary

  • Review mode: initial
  • 4 issues found in the latest diff: 2 blocker, 2 major.
  • docs/VISION.md and docs/PRINCIPLES.md were referenced but are unavailable in this checkout (Not found in repo/docs), so constraint checks were based on CLAUDE.md and changed files only.
  • Additional residual risk: test coverage in this PR validates buildDraft logic only; there is no coverage for project storage error paths, storage validation, or project switching state isolation.

Testing

  • Not run (automation)

open-codesign Bot

Comment thread apps/desktop/src/renderer/src/store.ts Outdated
p !== null &&
(p as { schemaVersion?: unknown }).schemaVersion === PROJECT_SCHEMA_VERSION,
);
} catch {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Blocker] This catch { return [] } is a silent fallback for corrupted/unreadable persisted project data, which conflicts with the repo constraint to surface errors with context.

Suggested fix:

} catch (error) {
  throw new Error(`Failed to read persisted projects: ${String(error)}`);
}

type="checkbox"
checked={speakerNotes}
onChange={(e) => setSpeakerNotes(e.target.checked)}
className="mt-[var(--space-1)] w-4 h-4 accent-[var(--color-accent)]"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Blocker] Hardcoded w-4 h-4 introduces non-tokenized UI sizing in newly added UI code.

Suggested fix:

className="mt-[var(--space-1)] w-[var(--size-control-sm)] h-[var(--size-control-sm)] accent-[var(--color-accent)]"

Comment thread apps/desktop/src/renderer/src/store.ts Outdated
if (!raw) return [];
const parsed = JSON.parse(raw) as unknown;
if (!Array.isArray(parsed)) return [];
return parsed.filter(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Major] Filtering by schemaVersion alone is not enough to guarantee shape correctness; malformed records can still enter state and fail later during render/sort.

Suggested fix:

return parsed.flatMap((item) => {
  const r = Project.safeParse(item);
  return r.success ? [r.data] : [];
});

Comment thread apps/desktop/src/renderer/src/store.ts Outdated
openProject(id) {
const project = get().projects.find((p) => p.id === id);
if (!project) return;
set({ currentProjectId: id, view: 'workspace' });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Major] openProject only switches currentProjectId/view, leaving prior workspace data active; this can show stale content from a different project.

Suggested fix:

set({
  currentProjectId: id,
  view: workspace,
  messages: [],
  previewHtml: null,
  prompt: ,
  generationStage: idle,
  isGenerating: false,
  activeGenerationId: null,
});

hqhq1025 added a commit that referenced this pull request Apr 18, 2026
…ent fallback)

- readStoredProjects/persistProjects now console.warn and return an error
  string instead of swallowing exceptions; createProject pushes an error
  toast on persist failure while keeping in-memory state consistent.
- Validate stored projects with the Project zod schema (safeParse) and
  count rejected records so corrupted entries surface a toast instead of
  silently disappearing.
- openProject resets project-scoped workspace state (messages, preview,
  inputs, generation flags) to prevent cross-project state leakage.
- Add errors.projectStorageFailed i18n key (en + zh-CN).
- Vitest: mock localStorage.setItem to throw, assert toast pushed and the
  new project is still added to in-memory state.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>
@hqhq1025 hqhq1025 force-pushed the wt/cd-adopt-a-designs-hub branch from a7a1ece to 79c22f6 Compare April 18, 2026 20:24
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Blocker] Hardcoded control sizing in new UI violates the token-only UI constraint and can drift from centralized theming/scaling, evidence apps/desktop/src/renderer/src/views/create/SlideDeckForm.tsx:27.
    Suggested fix:
    className="mt-[var(--space-1)] w-[var(--size-control-sm)] h-[var(--size-control-sm)] accent-[var(--color-accent)]"

Summary

  • Review mode: follow-up after new commits
  • 1 issue found in the latest head diff.
  • docs/VISION.md and docs/PRINCIPLES.md: Not found in repo/docs.
  • Residual risk/testing gap: coverage still does not exercise readStoredProjects() invalid JSON/non-array payload handling or the deferred startup toast path.

Testing

  • Not run (automation)

open-codesign Bot

type="checkbox"
checked={speakerNotes}
onChange={(e) => setSpeakerNotes(e.target.checked)}
className="mt-[var(--space-1)] w-4 h-4 accent-[var(--color-accent)]"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Blocker] Hardcoded w-4 h-4 bypasses design tokens and violates the repo UI-token constraint for newly added UI values.

Suggested fix:

className="mt-[var(--space-1)] w-[var(--size-control-sm)] h-[var(--size-control-sm)] accent-[var(--color-accent)]"

hqhq1025 added a commit that referenced this pull request Apr 18, 2026
…eview/inline-comment

Codex has flagged this exact pattern as a Blocker on PRs #50 and #51 ("hardcoded
pixel font size violates token-only UI constraint"). Sweeps the chat-adjacent
surface that is not covered by any in-flight worktree.

Mappings:
- text-[11px] -> text-[var(--text-xs)] (12px, closest token)
- text-[12px] -> text-[var(--text-xs)]
- text-[13px] -> text-[var(--text-sm)]

Files touched: InlineCommentComposer.tsx, PreviewToolbar.tsx, PreviewPane.tsx.
The bg-[rgba(255,255,255,0.88)] frosted pill in PreviewPane is left for a
follow-up because it requires a new translucent surface token.
hqhq1025 added a commit that referenced this pull request Apr 18, 2026
…eview/inline-comment (#57)

Codex has flagged this exact pattern as a Blocker on PRs #50 and #51 ("hardcoded
pixel font size violates token-only UI constraint"). Sweeps the chat-adjacent
surface that is not covered by any in-flight worktree.

Mappings:
- text-[11px] -> text-[var(--text-xs)] (12px, closest token)
- text-[12px] -> text-[var(--text-xs)]
- text-[13px] -> text-[var(--text-sm)]

Files touched: InlineCommentComposer.tsx, PreviewToolbar.tsx, PreviewPane.tsx.
The bg-[rgba(255,255,255,0.88)] frosted pill in PreviewPane is left for a
follow-up because it requires a new translucent surface token.
hqhq1025 added a commit that referenced this pull request Apr 18, 2026
…ent fallback)

- readStoredProjects/persistProjects now console.warn and return an error
  string instead of swallowing exceptions; createProject pushes an error
  toast on persist failure while keeping in-memory state consistent.
- Validate stored projects with the Project zod schema (safeParse) and
  count rejected records so corrupted entries surface a toast instead of
  silently disappearing.
- openProject resets project-scoped workspace state (messages, preview,
  inputs, generation flags) to prevent cross-project state leakage.
- Add errors.projectStorageFailed i18n key (en + zh-CN).
- Vitest: mock localStorage.setItem to throw, assert toast pushed and the
  new project is still added to in-memory state.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>
hqhq1025 added a commit that referenced this pull request Apr 18, 2026
…oken

SlideDeckForm checkbox used `w-4 h-4` literals which violate the
token-only UI constraint. Swap to `var(--size-icon-md)` (16px) so the
control scales with centralized theming.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>
@hqhq1025 hqhq1025 force-pushed the wt/cd-adopt-a-designs-hub branch from 79c22f6 to 9d7591b Compare April 18, 2026 20:58
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Major] New project creation does not clear prior workspace input context — this can carry previous project attachments/reference URL/selected element into a newly created project, causing unintended prompt context and potential data leakage across projects, evidence apps/desktop/src/renderer/src/store.ts:718 and contrast with the reset done in apps/desktop/src/renderer/src/store.ts:740.
    Suggested fix:
    set({
      projects: next,
      currentProjectId: project.id,
      view: 'workspace',
      createProjectModalOpen: false,
      messages: [],
      previewHtml: null,
      inputFiles: [],
      referenceUrl: '',
      selectedElement: null,
      lastPromptInput: null,
      generationStage: 'idle' as GenerationStage,
      isGenerating: false,
      activeGenerationId: null,
      errorMessage: null,
      lastError: null,
    });

Summary

  • Review mode: follow-up after new commits
  • 1 issue found in the latest head diff.
  • docs/VISION.md and docs/PRINCIPLES.md: Not found in repo/docs.

Testing

  • Not run (automation)

open-codesign Bot

};
const next = [project, ...get().projects];
const persist = persistProjects(next);
set({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Major] createProject() resets only part of workspace state; previous inputFiles, referenceUrl, and selectedElement can leak into the new project context. Mirror the full reset already used in openProject() to ensure project isolation.

Suggested fix:

set({
  projects: next,
  currentProjectId: project.id,
  view: 'workspace',
  createProjectModalOpen: false,
  messages: [],
  previewHtml: null,
  inputFiles: [],
  referenceUrl: '',
  selectedElement: null,
  lastPromptInput: null,
  generationStage: 'idle' as GenerationStage,
  isGenerating: false,
  activeGenerationId: null,
  errorMessage: null,
  lastError: null,
});

hqhq1025 added a commit that referenced this pull request Apr 18, 2026
…ent fallback)

- readStoredProjects/persistProjects now console.warn and return an error
  string instead of swallowing exceptions; createProject pushes an error
  toast on persist failure while keeping in-memory state consistent.
- Validate stored projects with the Project zod schema (safeParse) and
  count rejected records so corrupted entries surface a toast instead of
  silently disappearing.
- openProject resets project-scoped workspace state (messages, preview,
  inputs, generation flags) to prevent cross-project state leakage.
- Add errors.projectStorageFailed i18n key (en + zh-CN).
- Vitest: mock localStorage.setItem to throw, assert toast pushed and the
  new project is still added to in-memory state.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>
hqhq1025 added a commit that referenced this pull request Apr 18, 2026
…oken

SlideDeckForm checkbox used `w-4 h-4` literals which violate the
token-only UI constraint. Swap to `var(--size-icon-md)` (16px) so the
control scales with centralized theming.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>
@hqhq1025 hqhq1025 force-pushed the wt/cd-adopt-a-designs-hub branch from 9d7591b to a09e3e0 Compare April 18, 2026 23:40
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Major] createProject does not reset project-scoped workspace inputs — a newly created project can inherit inputFiles, referenceUrl, selectedElement, and generation/error flags from the previously open project, which risks cross-project context leakage and incorrect prompt context, evidence apps/desktop/src/renderer/src/store.ts:718 (partial reset) vs apps/desktop/src/renderer/src/store.ts:740 (full reset used by openProject).
    Suggested fix:
    set({
      projects: next,
      currentProjectId: project.id,
      view: 'workspace',
      createProjectModalOpen: false,
      messages: [],
      previewHtml: null,
      inputFiles: [],
      referenceUrl: '',
      selectedElement: null,
      lastPromptInput: null,
      generationStage: 'idle' as GenerationStage,
      isGenerating: false,
      activeGenerationId: null,
      errorMessage: null,
      lastError: null,
    });

Summary

  • Review mode: follow-up after new commits
  • 1 issue found in the latest PR diff.
  • docs/VISION.md: Not found in repo/docs.
  • docs/PRINCIPLES.md: Not found in repo/docs.

Testing

  • Not run (automation)

open-codesign Bot

};
const next = [project, ...get().projects];
const persist = persistProjects(next);
set({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Major] createProject() currently performs only a partial state reset. This lets previous project context (inputFiles, referenceUrl, selectedElement, generation/error flags) leak into the newly created project. Mirror the full reset already used in openProject() to preserve project isolation.

Suggested fix:

set({
  projects: next,
  currentProjectId: project.id,
  view: workspace,
  createProjectModalOpen: false,
  messages: [],
  previewHtml: null,
  inputFiles: [],
  referenceUrl: ,
  selectedElement: null,
  lastPromptInput: null,
  generationStage: idle as GenerationStage,
  isGenerating: false,
  activeGenerationId: null,
  errorMessage: null,
  lastError: null,
});

hqhq1025 added a commit that referenced this pull request Apr 19, 2026
…ent fallback)

- readStoredProjects/persistProjects now console.warn and return an error
  string instead of swallowing exceptions; createProject pushes an error
  toast on persist failure while keeping in-memory state consistent.
- Validate stored projects with the Project zod schema (safeParse) and
  count rejected records so corrupted entries surface a toast instead of
  silently disappearing.
- openProject resets project-scoped workspace state (messages, preview,
  inputs, generation flags) to prevent cross-project state leakage.
- Add errors.projectStorageFailed i18n key (en + zh-CN).
- Vitest: mock localStorage.setItem to throw, assert toast pushed and the
  new project is still added to in-memory state.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>
hqhq1025 added a commit that referenced this pull request Apr 19, 2026
…oken

SlideDeckForm checkbox used `w-4 h-4` literals which violate the
token-only UI constraint. Swap to `var(--size-icon-md)` (16px) so the
control scales with centralized theming.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>
hqhq1025 added a commit that referenced this pull request Apr 19, 2026
createProject was only clearing messages/previewHtml/generationStage,
leaving inputFiles, referenceUrl, selectedElement, lastPromptInput,
and generation/error flags inherited from the previously open project.
Mirror openProject's full reset so a freshly created project starts
with a clean workspace and prompt context.

Adds vitest coverage for the reset.

Refs codex review on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>
@hqhq1025 hqhq1025 force-pushed the wt/cd-adopt-a-designs-hub branch from a09e3e0 to 85f7474 Compare April 19, 2026 00:39
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Blocker] Hardcoded UI values added in renderer components violate the token-only UI constraint (CI-enforced), which can fail policy checks and reintroduce inconsistent sizing contracts, evidence apps/desktop/src/renderer/src/views/create/CreateProjectModal.tsx:86, apps/desktop/src/renderer/src/views/hub/ProjectGrid.tsx:22, apps/desktop/src/renderer/src/App.tsx:138, apps/desktop/src/renderer/src/views/create/fields.tsx:25.
    Suggested fix:
    // 1) Define semantic size tokens in packages/ui (example names)
    :root {
      --layout-sidebar-width: var(--size-panel-sidebar);
      --size-modal-create-max: var(--size-modal-lg);
      --size-card-min: var(--size-card-min);
      --focus-ring-width: var(--size-focus-ring);
    }
    
    // 2) Consume tokens instead of literal px/ch values
    <div className="max-w-[var(--size-modal-create-max)] ..." />
    <div className="... grid grid-cols-[var(--layout-sidebar-width)_1fr]" />
    <ul className="... grid-cols-[repeat(auto-fill,minmax(var(--size-card-min),1fr))]" />
    className="... focus:shadow-[0_0_0_var(--focus-ring-width)_var(--color-focus-ring)]"

Summary

  • Review mode: follow-up after new commits
  • 1 issue found in the latest PR diff.
  • docs/VISION.md: Not found in repo/docs.
  • docs/PRINCIPLES.md: Not found in repo/docs.
  • Direct provider SDK imports in changed files: Not found.
  • New dependencies/license/install-size impact from this diff: Not found.

Testing

  • Not run (automation). Added unit tests cover draft-building and project state reset/persist-error paths, but no UI integration coverage for hub/create modal keyboard and accessibility flows.

open-codesign Bot

className="absolute inset-0 bg-[var(--color-overlay)]"
/>
<div className="relative w-full max-w-[560px] max-h-[calc(100vh-var(--space-12))] overflow-y-auto rounded-[var(--radius-2xl)] border border-[var(--color-border)] bg-[var(--color-surface)] shadow-[var(--shadow-elevated)]">
<header className="flex items-start justify-between gap-[var(--space-4)] px-[var(--space-6)] pt-[var(--space-6)] pb-[var(--space-3)]">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Blocker] This introduces a literal 560px size in renderer UI, which violates the repo's CI-enforced token-only UI rule (packages/ui tokens only, no hardcoded UI values).

Suggested fix:

// add semantic size token in packages/ui, then consume it here
<div className="... max-w-[var(--size-modal-create-max)] ...">

…adoption PR-A)

Replaces the straight-to-composer launch flow with a designs hub modeled on
Claude Design's Recent / Your designs / Examples / Design systems navigation
plus a typed create wizard (Prototype / Slide deck / From template / Other).

- Hub view with four sibling tabs and a primary "New design" CTA
- Modal create flow; CTA stays disabled until a project name is provided
- Per-type forms; PR-F will fill in the wireframe vs high-fidelity cards
- Examples and Design systems tabs ship as placeholders for PR-B / PR-C
- Project schema lives in shared with schemaVersion=1; persisted to
  localStorage for now (SQLite migration arrives with PR-C)
- Full en + zh-CN coverage; tokens from packages/ui (no hardcoded values)
- Vitest covering the create-draft logic; existing 144-test suite untouched

Compatibility: green - no IPC/main changes, no schema breaks.
Upgradeability: green - schemaVersion field on every Project payload.
No bloat: green - no new dependencies; reuses lucide-react + zustand.
Elegance: green - single store action per intent; per-type forms < 40 LOC.

Signed-off-by: hqhq1025 <1506751656@qq.com>
…ent fallback)

- readStoredProjects/persistProjects now console.warn and return an error
  string instead of swallowing exceptions; createProject pushes an error
  toast on persist failure while keeping in-memory state consistent.
- Validate stored projects with the Project zod schema (safeParse) and
  count rejected records so corrupted entries surface a toast instead of
  silently disappearing.
- openProject resets project-scoped workspace state (messages, preview,
  inputs, generation flags) to prevent cross-project state leakage.
- Add errors.projectStorageFailed i18n key (en + zh-CN).
- Vitest: mock localStorage.setItem to throw, assert toast pushed and the
  new project is still added to in-memory state.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>
…oken

SlideDeckForm checkbox used `w-4 h-4` literals which violate the
token-only UI constraint. Swap to `var(--size-icon-md)` (16px) so the
control scales with centralized theming.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>
- tailwindExtractor: replace non-null assertion with safe cast
- InlineCommentComposer: apply formatter

Signed-off-by: hqhq1025 <1506751656@qq.com>
PR-B merged ExamplesTab as a real component requiring an onUsePrompt
callback. After rebase, surface that prop through HubView and have App
prefill the workspace prompt + switch view.

Signed-off-by: hqhq1025 <1506751656@qq.com>
createProject was only clearing messages/previewHtml/generationStage,
leaving inputFiles, referenceUrl, selectedElement, lastPromptInput,
and generation/error flags inherited from the previously open project.
Mirror openProject's full reset so a freshly created project starts
with a clean workspace and prompt context.

Adds vitest coverage for the reset.

Refs codex review on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>
PR-A introduced raw arbitrary-value Tailwind classes (360px sidebar,
560px modal, 60ch prose, 240px card minimum, 1px hover lift) that
violate the token-only constraint in CLAUDE.md. Add five tokens to
packages/ui/src/tokens.css and route every call site through them so
themes and density tweaks stay centralized.
@hqhq1025 hqhq1025 force-pushed the wt/cd-adopt-a-designs-hub branch from 85f7474 to e73e6a3 Compare April 19, 2026 01:23
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • No new high-confidence issues found in added/modified lines of the latest diff.

Summary

  • Review mode: follow-up after new commits
  • No blocking/major/minor/nit issues identified in this pass.
  • docs/VISION.md: Not found in repo/docs.
  • docs/PRINCIPLES.md: Not found in repo/docs.
  • Residual risk: no UI integration coverage for hub/create modal keyboard flows (focus behavior and ESC handling) in this PR.

Testing

  • Not run (automation).

open-codesign Bot

@hqhq1025 hqhq1025 merged commit ab0a8c3 into main Apr 19, 2026
6 checks passed
@hqhq1025 hqhq1025 deleted the wt/cd-adopt-a-designs-hub branch April 19, 2026 01:46
hqhq1025 added a commit that referenced this pull request Apr 19, 2026
…eview/inline-comment (#57)

Codex has flagged this exact pattern as a Blocker on PRs #50 and #51 ("hardcoded
pixel font size violates token-only UI constraint"). Sweeps the chat-adjacent
surface that is not covered by any in-flight worktree.

Mappings:
- text-[11px] -> text-[var(--text-xs)] (12px, closest token)
- text-[12px] -> text-[var(--text-xs)]
- text-[13px] -> text-[var(--text-sm)]

Files touched: InlineCommentComposer.tsx, PreviewToolbar.tsx, PreviewPane.tsx.
The bg-[rgba(255,255,255,0.88)] frosted pill in PreviewPane is left for a
follow-up because it requires a new translucent surface token.
hqhq1025 added a commit that referenced this pull request Apr 19, 2026
…#51)

* feat(desktop): designs hub + multi-type create wizard (Claude Design adoption PR-A)

Replaces the straight-to-composer launch flow with a designs hub modeled on
Claude Design's Recent / Your designs / Examples / Design systems navigation
plus a typed create wizard (Prototype / Slide deck / From template / Other).

- Hub view with four sibling tabs and a primary "New design" CTA
- Modal create flow; CTA stays disabled until a project name is provided
- Per-type forms; PR-F will fill in the wireframe vs high-fidelity cards
- Examples and Design systems tabs ship as placeholders for PR-B / PR-C
- Project schema lives in shared with schemaVersion=1; persisted to
  localStorage for now (SQLite migration arrives with PR-C)
- Full en + zh-CN coverage; tokens from packages/ui (no hardcoded values)
- Vitest covering the create-draft logic; existing 144-test suite untouched

Compatibility: green - no IPC/main changes, no schema breaks.
Upgradeability: green - schemaVersion field on every Project payload.
No bloat: green - no new dependencies; reuses lucide-react + zustand.
Elegance: green - single store action per intent; per-type forms < 40 LOC.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): surface project storage errors via toast + warn (no silent fallback)

- readStoredProjects/persistProjects now console.warn and return an error
  string instead of swallowing exceptions; createProject pushes an error
  toast on persist failure while keeping in-memory state consistent.
- Validate stored projects with the Project zod schema (safeParse) and
  count rejected records so corrupted entries surface a toast instead of
  silently disappearing.
- openProject resets project-scoped workspace state (messages, preview,
  inputs, generation flags) to prevent cross-project state leakage.
- Add errors.projectStorageFailed i18n key (en + zh-CN).
- Vitest: mock localStorage.setItem to throw, assert toast pushed and the
  new project is still added to in-memory state.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): replace hardcoded checkbox sizing with --size-icon-md token

SlideDeckForm checkbox used `w-4 h-4` literals which violate the
token-only UI constraint. Swap to `var(--size-icon-md)` (16px) so the
control scales with centralized theming.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* chore: clear pre-existing biome errors blocking pre-push hook

- tailwindExtractor: replace non-null assertion with safe cast
- InlineCommentComposer: apply formatter

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): wire ExamplesTab onUsePrompt after rebase onto PR-B

PR-B merged ExamplesTab as a real component requiring an onUsePrompt
callback. After rebase, surface that prop through HubView and have App
prefill the workspace prompt + switch view.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): reset project-scoped workspace state in createProject

createProject was only clearing messages/previewHtml/generationStage,
leaving inputFiles, referenceUrl, selectedElement, lastPromptInput,
and generation/error flags inherited from the previously open project.
Mirror openProject's full reset so a freshly created project starts
with a clean workspace and prompt context.

Adds vitest coverage for the reset.

Refs codex review on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(ui): replace hardcoded sizing in hub/create with new tokens

PR-A introduced raw arbitrary-value Tailwind classes (360px sidebar,
560px modal, 60ch prose, 240px card minimum, 1px hover lift) that
violate the token-only constraint in CLAUDE.md. Add five tokens to
packages/ui/src/tokens.css and route every call site through them so
themes and density tweaks stay centralized.

---------

Signed-off-by: hqhq1025 <1506751656@qq.com>
hqhq1025 added a commit that referenced this pull request Apr 19, 2026
* feat(core): system prompt — adopt Claude Design patterns

Adds a new prompt section that embeds high-leverage craft directives
paraphrased from patterns observed in the publicly leaked Claude Design
system prompt. Direct response to feedback that generated designs are
sparse, generic, and monotone.

The new section sits between tweaks-protocol and anti-slop in the
composer, applies to all create/revise/tweak modes, and codifies:

- silent artifact-type classification (landing / dashboard / case study /
  pricing / deck / etc.) controlling section ladder and density target
- density floor — default to "rich", drop only on explicit "minimal"
- real, specific content — concrete bans on common placeholder strings
- before/after side-by-side rendering when comparison is implied
- big-number visual blocks (display weight + label + delta + sparkline)
- three-family typography ladder (display + sans + mono)
- dark-theme warmth requirements (accent + gradient + transparent borders)
- SVG monogram/wordmark for logos (no emoji, no flat circles)
- distinguished customer-quote treatment
- single-page structure ladder (hero → trust → 3-5 sections → focal →
  closing CTA), with dashboard and slide deck substitutions

Directives are independently authored — no original Claude Design text is
reproduced verbatim. Attribution and the underlying structural analysis
live in docs/research/15-claude-design-prompts.md (gitignored, internal).

Vitest coverage:
- new test asserts all ten directive headers appear in the create-mode
  composed prompt
- existing drift test ensures the new .txt and the inlined TS constant
  stay byte-identical

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(core): rename 'Claude-Design-style' → 'Craft directives' to remove provenance comment per codex review

Signed-off-by: hqhq1025 <1506751656@qq.com>

* test(core): cover revise mode for craft directives (PR #43 codex Minor)

* fix(desktop): replace hardcoded text-[Npx] with --text-* tokens in preview/inline-comment (#57)

Codex has flagged this exact pattern as a Blocker on PRs #50 and #51 ("hardcoded
pixel font size violates token-only UI constraint"). Sweeps the chat-adjacent
surface that is not covered by any in-flight worktree.

Mappings:
- text-[11px] -> text-[var(--text-xs)] (12px, closest token)
- text-[12px] -> text-[var(--text-xs)]
- text-[13px] -> text-[var(--text-sm)]

Files touched: InlineCommentComposer.tsx, PreviewToolbar.tsx, PreviewPane.tsx.
The bg-[rgba(255,255,255,0.88)] frosted pill in PreviewPane is left for a
follow-up because it requires a new translucent surface token.

* fix(desktop): localize Toast dismiss button aria-label (#56)

Codex flagged a recurring i18n violation pattern across PRs #48 and #49: hardcoded
English ARIA strings bypass the i18n layer and ship inconsistent screen-reader
output to localized users. The toast close button was the last remaining
hardcoded aria-label outside the onboarding flow.

- Add common.dismissNotification key (en + zh-CN)
- Wire useT() into ToastItem and consume the new key

* fix(desktop): tokenize ConnectionStatusDot tooltip values (#58)

* chore(desktop): biome auto-format InlineCommentComposer (unblock pre-push)

* fix(desktop): tokenize ConnectionStatusDot tooltip hardcoded values

* fix(desktop): tokenize LanguageToggle hardcoded sizes/spacing (#60)

* fix(desktop): tokenize LanguageToggle hardcoded sizes/spacing

* chore(desktop): biome format InlineCommentComposer (drive-by, unblocks pre-push)

* [Claude Design adoption] PR-B: examples gallery (#50)

* feat(hub): examples gallery as first-class section

PR-B from doc 28 (Claude Design adoption). Ships eight curated examples
(cosmic animation, organic loaders, landing page, case study, dashboard,
pitch slide, welcome email, mobile habit tracker) with stylised inline
SVG thumbnails, an `ExamplesTab` view component, and full en + zh-CN
translations for every title, description, category label, and surrounding
chrome.

The tab is self-contained: a single `onUsePrompt` prop hands the chosen
example back to the host so PR-A can wire it into the hub without further
plumbing. No App.tsx changes here — independent of PR-A landing first.

Compatibility ✅  Upgradeability ✅  No bloat ✅  Elegance ✅

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(hub): use --font-size-body-xs token for example card category badge

Replaces hardcoded text-[10px] with the existing --font-size-body-xs
typography token (11px). Resolves Codex token-only UI constraint blocker
on PR #50.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(templates): throw on missing locale content for examples (no silent fallback)

Codex blocker on PR #50: getExamples returned `{ title: id, description: '' }`
when both the requested locale and the en fallback lacked an entry, shipping
degraded UI without surfacing the bug.

- Throw a descriptive Error when no registry has the example id
- Add vitest case asserting the throw path
- Drive-by: biome format apps/desktop/src/renderer/src/components/InlineCommentComposer.tsx
  (pre-existing format drift on main blocking pre-push)

Signed-off-by: hqhq1025 <1506751656@qq.com>

---------

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): tokenize PreviewToolbar values missed by #57 (#62)

* fix(desktop): tokenize remaining PreviewToolbar hardcoded values missed by #57

Replaces three remaining hardcoded px values in PreviewToolbar with design
tokens to keep the export menu aligned with the token system:
- h-[30px] → h-[var(--size-control-sm)]
- w-[14px] h-[14px] → w-[var(--size-icon-sm)] h-[var(--size-icon-sm)]
- min-w-[200px] → min-w-[var(--size-stage-min)]

Adds a new --size-stage-min (200px) token to packages/ui for menu/popover
minimum widths. The other three font-size values noted in the original
audit were already tokenized by #57.

* chore: format Download icon and silence pre-existing core complexity lint

- Wrap PreviewToolbar Download icon across multiple lines per Biome formatter
- Add biome-ignore for pre-existing noExcessiveCognitiveComplexity in
  packages/core/src/index.ts runModel (blocks pre-push hook; refactor
  tracked separately, mirrors the precedent set in 9051fae)

* fix(desktop): drop unused fileURLToPath import in main entry (#63)

* fix(desktop): PreviewPane hint pill + iframe respect dark mode (#69)

Co-authored-by: Claude <noreply@anthropic.com>

* fix(desktop): i18n ThemeToggle aria/tooltip strings (#70)

Replace hardcoded English with t() calls; add theme.{toggleAria,switchToLight,switchToDark} to en.json and zh-CN.json.

Co-authored-by: Claude <noreply@anthropic.com>

* fix(desktop): tokenize raw utilities in preview Loading/Error states (#64)

* fix(desktop): tokenize raw utilities in preview Loading/Error states

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): tokenize space-y-3 in LoadingState skeleton header

Signed-off-by: hqhq1025 <1506751656@qq.com>

---------

Signed-off-by: hqhq1025 <1506751656@qq.com>

* feat(desktop): Snapshots SQLite schema + IPC handlers (PR-A) (#29)

* feat(desktop): snapshots SQLite + IPC foundation (PR-A of version history)

- packages/shared: DesignSnapshotV1 + DesignV1 Zod schemas, SnapshotCreateInput interface
- apps/desktop: better-sqlite3 persistence (designs + design_snapshots tables, WAL, FK cascade)
  initSnapshotsDb(path) for production, initInMemoryDb() for tests
- snapshots:v1:* IPC handlers: list-designs, create-design, list, get, create, delete
  All reject malformed payloads with CodesignError('IPC_BAD_INPUT')
- preload: window.codesign.snapshots namespace bridged to renderer
- Vitest: 26 new tests across snapshots-db + snapshots-ipc (111 pass total)

New dep: better-sqlite3@^11 (MIT, native, already in CLAUDE.md stack)
No ulid added — using crypto.randomUUID() instead.

PR-B will wire auto-snapshot-on-sendPrompt + history sidebar UI.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* style(desktop): fix biome formatting in snapshots-db.test.ts

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): address codex snapshots cascade/parent/sort findings

- Enable PRAGMA foreign_keys = ON in applySchema so ON DELETE CASCADE
  / SET NULL fire in production (previously only the test enabled it
  manually, hiding the regression).
- Constrain design_snapshots.parent_id with a self-referential FK
  (ON DELETE SET NULL) and validate in the IPC layer that parentId
  resolves to a snapshot in the same design — prevents silent history
  corruption from stale or cross-design ids.
- Sort listDesigns by updated_at DESC, created_at DESC so designs
  bubble after new snapshots are added (createSnapshot already bumps
  updated_at).
- Drop the now-redundant manual pragma in the cascade test and add
  coverage for parent SET NULL, cross-design parent rejection, and
  the activity-based design sort.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): reject invalid create-design input instead of silent default

The snapshots:v1:create-design IPC handler coerced empty/non-string payloads to 'Untitled design', hiding caller bugs and violating the no-silent-fallback rule. Reject with IPC_BAD_INPUT instead, drop the matching preload coercion, and update tests to cover the new contract.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): translate SQLite errors to typed IPC contract in snapshots-ipc

Wraps every snapshot DB call in a translateSqliteError helper that maps
better-sqlite3 SqliteError codes to typed CodesignError instances:

- SQLITE_CONSTRAINT_FOREIGNKEY -> IPC_BAD_INPUT
- SQLITE_BUSY / SQLITE_LOCKED  -> IPC_DB_BUSY
- SQLITE_FULL                  -> IPC_DB_FULL
- other                        -> IPC_DB_ERROR (full details logged server-side)

Renderer no longer sees raw provider error strings. Adds vitest cases that
stub better-sqlite3 prepare() to throw each code and assert the right
CodesignError is surfaced.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(snapshots-ipc): map SQLite constraint subcodes individually

Bare SQLITE_CONSTRAINT also covers UNIQUE / NOT NULL / CHECK violations,
so translating it as "Parent snapshot does not exist" misled the UI on
unrelated failures. Match each subcode explicitly:

- SQLITE_CONSTRAINT_FOREIGNKEY  -> IPC_BAD_INPUT, parent-snapshot message
- SQLITE_CONSTRAINT_UNIQUE/PK   -> IPC_CONFLICT, "Snapshot already exists"
- SQLITE_CONSTRAINT_NOTNULL/CHECK -> IPC_BAD_INPUT, neutral constraint message
- bare SQLITE_CONSTRAINT (no suffix) -> generic IPC_DB_ERROR

Adds vitest coverage for each new branch.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(snapshots-ipc): clarify FK error covers design and parent

SQLITE_CONSTRAINT_FOREIGNKEY fires for both a missing design_id and a
missing parent_id, but the previous translation always reported "Parent
snapshot does not exist" — leading contributors to look for the wrong
cause. Key the FK message by call-site context and use a message that
names both columns ("Referenced design or parent snapshot does not
exist"); fall back to a generic "Referenced item does not exist" for
unmapped contexts.

Also extracts the static SQLite-code lookup into a small helper to keep
translateSqliteError below the cognitive-complexity threshold.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): schema-version snapshots:v1 IPC payloads

Every snapshots:v1:* object payload now carries `schemaVersion: 1`, both
on the wire (preload bridge) and in the main-process parser. Mismatched
or missing versions throw IPC_BAD_INPUT so future handler revisions can
break cleanly instead of silently mis-parsing legacy callers.

- snapshots-ipc.ts: requireSchemaV1() helper applied to list-designs,
  list, get, create, delete, create-design (now object-shaped).
- preload/index.ts: every snapshots invoke wraps the payload with
  { schemaVersion: 1, ... }.
- snapshots-ipc.test.ts: updated existing fixtures via a v1() helper and
  added a parameterised gating suite that asserts every channel rejects
  missing and mismatched schemaVersion values.

Addresses Codex Major review on PR #29.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): degrade gracefully when snapshots DB init fails

Previously initSnapshotsDb() ran inside app.whenReady() without a guard,
so any open/migration/native-binding failure rejected the boot promise
and prevented createWindow() from ever firing — the user got a silent
no-window app.

Add safeInitSnapshotsDb() wrapper that captures the error, then in main
boot: log it with full stack via electron-log, surface it through
dialog.showErrorBox, skip registerSnapshotsIpc, and continue to open
the window. Snapshot-dependent renderer features will fail loudly via
their IPC channels, but the rest of the app stays usable.

Also reset the singleton if applySchema throws so a retry can recover
instead of returning a half-open DB handle.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): typed SNAPSHOTS_UNAVAILABLE stub when snapshots DB init fails

When safeInitSnapshotsDb fails at boot, main/index.ts previously skipped
registerSnapshotsIpc entirely. Renderer calls to window.codesign.snapshots.*
then surfaced as Electron's opaque "No handler registered" rejection,
violating the no-silent-fallback / error-context requirement (PR #29 codex
Major).

Install registerSnapshotsUnavailableIpc stubs for the same channel set so
every renderer call rejects with a typed CodesignError carrying code
SNAPSHOTS_UNAVAILABLE and a message pointing the user at Settings → Storage.
The channel list is exported (SNAPSHOTS_CHANNELS_V1) so the test can pin
it to the live registration set and prevent drift.

Adds vitest coverage that asserts SNAPSHOTS_UNAVAILABLE is thrown for every
channel and that the stub set matches registerSnapshotsIpc exactly.

Signed-off-by: hqhq1025 <1506751656@qq.com>

---------

Signed-off-by: hqhq1025 <1506751656@qq.com>

* feat(exporters): Markdown export of generated artifact (#66)

* feat(exporters): add Markdown export with simple HTML→MD conversion

Adds a tier-1 Markdown exporter (.md with YAML frontmatter carrying
schemaVersion: 1). Conversion is a small set of regex passes covering
h1..h6, p, a, img, ul/ol, strong/em, code/pre — anything else is
stripped. Zero new runtime deps.

Wired through the existing exporter IPC + Preview toolbar Export menu,
with en + zh-CN i18n strings.

Compatibility ✅  Upgradeability ✅  No bloat ✅  Elegance ✅

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(exporters): allowlist URL schemes in markdown export

Sanitize <a href> and <img src> during htmlToMarkdown so unsafe schemes
(javascript:, vbscript:, file:, non-image data:, etc.) cannot ride into
the exported .md and execute via downstream renderers. Allow http(s),
mailto, relative URLs, fragments; permit data:image/* only on <img>.
Unsafe links collapse to plain text, unsafe images are dropped.

Also fix the IPC default extension for the markdown format (`design.md`
instead of `design.markdown`) when no defaultFilename is provided.

Addresses codex review on PR #66.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(exporters): close encoded-scheme bypass in markdown sanitizeUrl

Decode HTML entities (named, hex, decimal), URL %escapes, and strip
control characters (TAB/CR/LF/etc.) before scheme allowlisting so
payloads like &#x6A;avascript:, %6Aavascript:, JavaScript:, and tab-
prefixed schemes can no longer slip through the link/image sanitizer.

Adds regression tests covering each bypass vector.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(exporters): only decode scheme prefix in sanitizeUrl

The previous follow-up ran decodeURIComponent on the entire URL which
both threw on legitimate inputs containing literal `%` (dropping the
link entirely) and rewrote percent-escaped path/query characters such
as %2F or %C3%A9. Restrict entity + percent decoding to the scheme
portion (before the first colon) used solely for the safety check, and
emit the original (control-stripped, trimmed) URL when the scheme is
allowlisted.

Adds regression tests for %2F in query, UTF-8 percent-escapes in path,
literal trailing %, and confirms the existing entity / %-encoded
javascript bypass guards still strip dangerous schemes.

Signed-off-by: hqhq1025 <1506751656@qq.com>

---------

Signed-off-by: hqhq1025 <1506751656@qq.com>

* [Claude Design adoption] PR-A: designs hub + multi-type create wizard (#51)

* feat(desktop): designs hub + multi-type create wizard (Claude Design adoption PR-A)

Replaces the straight-to-composer launch flow with a designs hub modeled on
Claude Design's Recent / Your designs / Examples / Design systems navigation
plus a typed create wizard (Prototype / Slide deck / From template / Other).

- Hub view with four sibling tabs and a primary "New design" CTA
- Modal create flow; CTA stays disabled until a project name is provided
- Per-type forms; PR-F will fill in the wireframe vs high-fidelity cards
- Examples and Design systems tabs ship as placeholders for PR-B / PR-C
- Project schema lives in shared with schemaVersion=1; persisted to
  localStorage for now (SQLite migration arrives with PR-C)
- Full en + zh-CN coverage; tokens from packages/ui (no hardcoded values)
- Vitest covering the create-draft logic; existing 144-test suite untouched

Compatibility: green - no IPC/main changes, no schema breaks.
Upgradeability: green - schemaVersion field on every Project payload.
No bloat: green - no new dependencies; reuses lucide-react + zustand.
Elegance: green - single store action per intent; per-type forms < 40 LOC.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): surface project storage errors via toast + warn (no silent fallback)

- readStoredProjects/persistProjects now console.warn and return an error
  string instead of swallowing exceptions; createProject pushes an error
  toast on persist failure while keeping in-memory state consistent.
- Validate stored projects with the Project zod schema (safeParse) and
  count rejected records so corrupted entries surface a toast instead of
  silently disappearing.
- openProject resets project-scoped workspace state (messages, preview,
  inputs, generation flags) to prevent cross-project state leakage.
- Add errors.projectStorageFailed i18n key (en + zh-CN).
- Vitest: mock localStorage.setItem to throw, assert toast pushed and the
  new project is still added to in-memory state.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): replace hardcoded checkbox sizing with --size-icon-md token

SlideDeckForm checkbox used `w-4 h-4` literals which violate the
token-only UI constraint. Swap to `var(--size-icon-md)` (16px) so the
control scales with centralized theming.

Addresses Codex blocker on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* chore: clear pre-existing biome errors blocking pre-push hook

- tailwindExtractor: replace non-null assertion with safe cast
- InlineCommentComposer: apply formatter

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): wire ExamplesTab onUsePrompt after rebase onto PR-B

PR-B merged ExamplesTab as a real component requiring an onUsePrompt
callback. After rebase, surface that prop through HubView and have App
prefill the workspace prompt + switch view.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): reset project-scoped workspace state in createProject

createProject was only clearing messages/previewHtml/generationStage,
leaving inputFiles, referenceUrl, selectedElement, lastPromptInput,
and generation/error flags inherited from the previously open project.
Mirror openProject's full reset so a freshly created project starts
with a clean workspace and prompt context.

Adds vitest coverage for the reset.

Refs codex review on PR #51.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(ui): replace hardcoded sizing in hub/create with new tokens

PR-A introduced raw arbitrary-value Tailwind classes (360px sidebar,
560px modal, 60ch prose, 240px card minimum, 1px hover lift) that
violate the token-only constraint in CLAUDE.md. Add five tokens to
packages/ui/src/tokens.css and route every call site through them so
themes and density tweaks stay centralized.

---------

Signed-off-by: hqhq1025 <1506751656@qq.com>

* feat(core): Skills system foundation — loader + 4 starter skills (#33)

* feat(core): skills loader + 4 starter skills + provider injector (PR-A)

- packages/shared/src/skills.ts: SkillFrontmatterV1 zod schema + LoadedSkill
  interface (canonical location; avoids core→providers circular dep)
- packages/core/src/skills/: inline YAML frontmatter parser, loadSkillsFromDir,
  loadAllSkills with 3-tier priority (project > user > builtin), loader tests
- packages/core/src/skills/builtin/: 4 starter skills (frontend-design-anti-slop,
  pitch-deck, data-viz-recharts, mobile-mock) — self-written, Apache-2.0, no
  Anthropic SKILL.md text copied
- packages/providers/src/skill-injector.ts: injectSkillsIntoMessages, pure,
  supports system and prefix scope, provider-wildcard matching, injector tests

No new runtime deps added. Inline YAML parser (~100 lines) handles folded
scalars, nested mappings, inline + block sequences.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(core): skills loader collects errors and throws instead of silent drop

Replace the three silent continue/console.warn paths in loadSkillsFromDir
with error collection; after processing all files, throw CodesignError
'SKILL_LOAD_FAILED' if any errors were accumulated. Update tests to
expect the throw, and add a new loadAllSkills test for a broken skill
(missing description field).

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(core): propagate non-ENOENT errors in skills loader

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(providers): sort skills into canonical order before injection

Mixed-scope skill injection was order-dependent: whichever skill
appeared first in the caller's array decided whether the block went
into the system prompt or the first user message. That made
prompt-shaping behaviour a function of loader iteration order rather
than the active skill set.

Sort skills by source precedence (project > user > builtin) and then
alphabetical name before building the block. The chosen scope, the
concatenated body, and the resulting prompt blob are now byte-identical
across runs regardless of input order, which also stabilises prompt
caching and snapshot tests.

Adds a vitest case that feeds three random permutations of a five-skill
fixture and asserts the resulting system content is byte-identical to
the canonical sort, plus a mixed system/prefix scope test that confirms
the higher-precedence skill picks the channel.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(providers): inject mixed-scope skills into separate channels

Previously a mixed system/prefix skill set was concatenated into a single
block and injected via the highest-precedence skill's channel, silently
routing the rest into the wrong channel and violating each skill's
trigger.scope contract. Now we partition active skills by scope and
inject system-scope skills into the system message and prefix-scope
skills into the first user message, preserving canonical order within
each channel.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(core): preserve newlines in YAML literal block scalar (PR #33 codex Minor)

---------

Signed-off-by: hqhq1025 <1506751656@qq.com>

* feat(desktop): viewport switcher (desktop / tablet / mobile with phone bezel) (#32)

* feat(desktop): mobile/tablet/desktop viewport preview with phone bezel

- Add PreviewViewport type and previewViewport/setPreviewViewport to store
- Add PhoneFrame component (CSS-only iPhone bezel, fully tokenised)
- Add viewport switcher (Desktop/Tablet/Mobile) to PreviewToolbar
- PreviewPane renders iframe inside PhoneFrame at 375x812 for mobile,
  centred 768px container for tablet, and full-width for desktop
- Add preview.viewport i18n keys (en + zh-CN)
- Add 4 unit tests for setPreviewViewport in store.test.ts

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(ui): tokenize phone frame dimensions + give tablet wrapper a height

Replace hard-coded px values in PhoneFrame with CSS custom properties from
packages/ui tokens.css. Add --size-preview-mobile-*, --size-preview-tablet-width,
--radius-phone, and --border-width-strong tokens. Fix tablet branch in
PreviewPane to propagate h-full so the iframe is no longer zero-height.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(ui): tokenize preview viewport sizes (mobile/tablet/desktop)

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(ui): tokenize preview hint badge color/size

Address Codex blocker re-flagged on PR #32:
- Replace hardcoded values in PreviewPane hint badge (left-5/top-5,
  bg-[rgba(255,255,255,0.88)], px-3/py-1, text-[11px]) with
  --space-5/--space-3/--space-1, --color-surface-elevated, --text-xs.
- Replace hardcoded sizes/motion in PreviewToolbar viewport controls
  and Download button (w-[14px], w-[30px], h-[30px], duration-150,
  literal cubic-bezier) with --size-icon-sm, --size-control-xs,
  --duration-fast, --ease-out.
- Add tokens: --color-surface-elevated (light + dark),
  --size-control-xs (30px), --size-icon-sm (14px).

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(ui): tokenize PhoneFrame border + remaining hardcoded values

Replace hard-coded `outline: '1px solid ...'` with the existing `--shadow-inset-soft` token composed into boxShadow. Removes the last non-tokenized value in PhoneFrame so the component is fully driven by packages/ui tokens.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(ui): make PhoneFrame notch overlay click-through (pointer-events: none)

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): add aria-label to viewport switcher buttons

title alone is not a reliable accessible name for screen readers;
add aria-label using the same i18n string so assistive tech announces
Mobile/Tablet/Desktop instead of a generic button.

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(desktop): tokenize iframe background in mobile preview (PR #32 codex Major)

* fix(desktop): tokenize desktop preview iframe bg + dedup icon size tokens (PR #32 codex follow-up)

---------

Signed-off-by: hqhq1025 <1506751656@qq.com>

* fix(core): exclude craft-directives from tweak mode (PR #43 codex Major)

---------

Signed-off-by: hqhq1025 <1506751656@qq.com>
Co-authored-by: Claude <noreply@anthropic.com>
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.

1 participant