> For the complete documentation index, see [llms.txt](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/sessions/phase31-session01-demo-mode-foundation/tasks.md).

# Task Checklist

**Session ID**: `phase31-session01-demo-mode-foundation` **Total Tasks**: 20 **Estimated Duration**: 3-4 hours **Created**: 2026-06-24

***

Legend: `[x]` completed; `[ ]` pending; `[P]` parallelizable; `[SNNMM]` session ref; `TNNN` task ID.

***

## Progress Summary

| Metric          | Value            |
| --------------- | ---------------- |
| Tasks Completed | 20 / 20          |
| Tasks Remaining | 0                |
| Last Updated    | 2026-06-24 00:50 |

***

## Setup (3 tasks)

* [x] T001 \[S3101] Verify Phase 31 Session 01 requirements, prior Phase 30 prerequisite evidence, and current Worker build assumptions (`.spec_system/PRD/phase_31/PRD_phase_31.md`, `.spec_system/PRD/phase_31/session_01_demo_mode_foundation.md`, `.spec_system/specs/phase30-session10-quality-gates-and-enablement/validation.md`)
* [x] T002 \[S3101] Inventory current public-demo-adjacent code paths for fallback data, extension enablement, TanStack Start config, and Worker plugin registration (`src/lib/use-live-data.ts`, `src/lib/validate-live-data.ts`, `src/extensions/registry.ts`, `src/lib/setup-config.ts`, `vite.config.ts`)
* [x] T003 \[S3101] Create the implementation evidence log for commands, build outputs, assumptions, and residual risk (`.spec_system/specs/phase31-session01-demo-mode-foundation/implementation-notes.md`)

***

## Foundation (6 tasks)

* [x] T004 \[S3101] Create shared public-demo flag parsing and browser helper functions with explicit true-value parsing and invalid-value fallback (`src/lib/public-demo.ts`)
* [x] T005 \[S3101] Add public-demo Vite env typing or module declarations needed by strict TypeScript checks (`src/vite-env.d.ts`)
* [x] T006 \[S3101] \[P] Write focused helper tests for true, false, invalid, missing, whitespace, and no-`isExample` coupling cases (`src/lib/__tests__/public-demo.test.ts`)
* [x] T007 \[S3101] Wire the client extension registry to return every statically registered extension in public demo mode while preserving normal env parsing (`src/extensions/registry.ts`)
* [x] T008 \[S3101] Wire setup env config to expose public-demo forced extension visibility without changing normal env locks (`src/lib/setup-config.ts`)
* [x] T009 \[S3101] \[P] Extend registry and setup-config tests for public-demo all-extension behavior and existing `all`, `none`, empty, and unknown-ID behavior (`src/lib/__tests__/extension-registry.test.ts`, `src/lib/__tests__/setup-config-extensions.test.ts`)

***

## Implementation (6 tasks)

* [x] T010 \[S3101] Refactor Vite config to derive `isDemoPagesMode` from `mode`, `VITE_AI_OS_PUBLIC_DEMO`, and loaded Vite env without affecting local dev middleware (`vite.config.ts`)
* [x] T011 \[S3101] Branch plugin assembly so `cloudflare({ viteEnvironment: { name: "ssr" } })` is skipped for demo-pages builds and retained for normal builds (`vite.config.ts`)
* [x] T012 \[S3101] Configure TanStack Start static SPA output for demo-pages mode while preserving import protection, router test ignores, and Worker server entry outside demo mode (`vite.config.ts`)
* [x] T013 \[S3101] Add demo-only `defaultSsr: false` or equivalent static-output support if required by the installed TanStack Start version while keeping error middleware intact (`src/start.ts`)
* [x] T014 \[S3101] Keep demo-pages output separate from the Worker deployment path and record any build-output follow-up that belongs to Session 05 (`vite.config.ts`, `.spec_system/specs/phase31-session01-demo-mode-foundation/implementation-notes.md`)
* [x] T015 \[S3101] Verify no hosted collection, bridge, setup write, scheduler, admin, upload, chat, source mutation, dynamic loading, analytics, or Pages Functions behavior is introduced by the foundation changes (`src/lib/public-demo.ts`, `src/extensions/registry.ts`, `vite.config.ts`)

***

## Testing (4 tasks)

* [x] T016 \[S3101] Run focused Vitest suites for public-demo helper, extension registry, and setup env config, then repair failures with explicit env-state coverage (`src/lib/__tests__/public-demo.test.ts`, `src/lib/__tests__/extension-registry.test.ts`, `src/lib/__tests__/setup-config-extensions.test.ts`)
* [x] T017 \[S3101] Run `bun run typecheck` and repair TypeScript, import, or Vite env typing failures without loosening strict project contracts (`tsconfig.json`, `src/vite-env.d.ts`, `vite.config.ts`)
* [x] T018 \[S3101] Run normal `bun run build` and verify the Worker/client output shape remains intact with `dist/client` and `dist/server/wrangler.json` (`package.json`, `vite.config.ts`, `dist/`)
* [x] T019 \[S3101] Run the demo-pages build command and verify no Cloudflare Worker environment is emitted plus top-level static HTML exists, or record the concrete prerender fallback required by TanStack Start (`vite.config.ts`, `demo-website/dist`, `dist/`)

***

## Completion Checks (1 task)

* [x] T020 \[S3101] Run formatting or targeted format checks as needed, validate ASCII and LF requirements, and complete the session handoff for `implement -> creview` (`.spec_system/specs/phase31-session01-demo-mode-foundation/implementation-notes.md`, `.spec_system/specs/phase31-session01-demo-mode-foundation/tasks.md`)

***

## Completion Checklist

* [x] All tasks marked `[x]`
* [x] All tests and checks passing
* [x] All session files ASCII-encoded with LF line endings
* [x] implementation-notes.md updated
* [x] Ready for `creview` to start the creview -> validate sequence

***

## Next Steps

Run the `creview` workflow step.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/sessions/phase31-session01-demo-mode-foundation/tasks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
