Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Docs are local at `node_modules/vite-plus/docs` or online at https://viteplus.de
## Review Checklist

- [ ] Run `vp install` after pulling remote changes and before getting started.
- [ ] Before commit (and after large / high-impact edits), run the **Validation** loop; fix failures before continuing.
- [ ] Run `vp check` and `vp test` to format, lint, type check and test changes.
- [ ] Check if there are `vite.config.ts` tasks or `package.json` scripts necessary for validation, run via `vp run <script>`.

<!--VITE PLUS END-->
Expand All @@ -34,7 +34,7 @@ Living conventions for this repo. Order and wording can evolve—ask whether new

## Imports

- **`@/*` → `./src/*`** in `tsconfig` `paths`. Import every `src/` module via `@/` (`@/lib/projects`, `@/hub.css`); no relative paths between `src/` files.
- **`@/*` → `./src/*`** in `tsconfig` `paths`. Import every `src/` module via `@/` (`@/lib/projects`, `@/hub/HubApp`); no relative paths between `src/` files.
- No **`.ts` / `.tsx`** suffixes on import paths (`allowImportingTsExtensions: false`).

## File layout (section comments)
Expand All @@ -43,15 +43,20 @@ Use `/* Section name. */` blocks. Read top-down: main entry first, **Helpers.**

**Order** (omit unused sections; never add empty **Types.** / **Helpers.** blocks):

1. **Schemas.** · **Runtime types.** · **Types.** · **Constants.** — Zod files: **Schemas.** → **Runtime types.** → **Constants.** (`parse` / `safeParse`); use **Types.** when the file defines hand-written top-level types
2. **Route.** · **API.** · **Script.** — file entry (`worker.ts` → **API.**; `hub-app.ts` → **Script.**; `routing.ts` → **API.**)
3. **Helpers.** — functions other modules import (`lib/project-search.ts`, `lib/slug-fuzzy.ts`) and private helpers (always last)
1. **Schemas.** · **Runtime types.** · **Types.** · **Constants.** — Zod/data: **Schemas.** → **Runtime types.** → **Constants.** (`parse` / `safeParse`); hand-written top-level types use **Types.** (e.g. `routing.ts`)
2. Entry surface (one per file — pick what matches):
- **API.** — Hono worker HTTP entry only (`worker.ts` default export)
- **Script.** — browser bootstrap (`hub-app.tsx`)
- **Component.** — Preact UI (`Hub*.tsx`)
- **Styles.** — Vanilla Extract (`*.css.ts`, including `global.css.ts`)
- **Config.** — tooling default export (`vite.config.ts`)
3. **Helpers.** — functions other modules import (`routing.ts`, `lib/project-search.ts`, `lib/slug-fuzzy.ts`) and private helpers in the same file (always last)

**Constants.** — module-level `const` / `export const`. Do not label `export const` **API.** or cross-module helper files **API.**
**Constants.** — module-level `const` / `export const` (e.g. `lib/github.ts`, `hub/tokens.ts`). Do not use **API.** for constants, shared libraries, or UI.

**Scripts** (`vite.config.ts`): **Constants.** → **API.** (default export). Module-level `const` above the entry; only `function` helpers may follow (hoisting).
**Config** (`vite.config.ts`): **Constants.** → **Config.** (default export). Module-level `const` above the entry; only `function` helpers may follow (hoisting).

**Lean files** (one export, few lines): a single **API.** or **Script.** block is enough.
**Lean files** (one export, few lines): one matching entry block (**API.**, **Script.**, **Component.**, **Config.**, etc.) is enough.

**Tests:** one `{module}.test.ts` per module under test (`routing.test.ts` → `routing.ts`, `lib/slug-fuzzy.test.ts` → `lib/slug-fuzzy.ts`). **Constants.** (fixtures) → **Tests.** (`describe` / `test`).

Expand Down Expand Up @@ -90,7 +95,7 @@ Blank line before and after each section block, and between the comment and the
2. `vp test`
3. `bun run fallow:audit` — dead code, unused exports, baselines (CI passes `--base`; see workflow)

**Findings:** fix—wire code, add `.fallowrc.jsonc` `entry` (`src/worker.ts`, `src/hub-app.ts`), or delete. Do not suppress to greenwash.
**Findings:** fix—wire code, add `.fallowrc.jsonc` `entry` (`src/worker.ts`, `src/hub-app.tsx`), or delete. Do not suppress to greenwash.

**Must ignore?** Ask the human first; aim for a healthy codebase, not a quiet audit.

Expand Down
216 changes: 215 additions & 1 deletion bun.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Bun project config — https://bun.sh/docs/runtime/bunfig
[install]
# Only install versions published at least 7 days ago (supply-chain mitigation).
# https://bun.sh/docs/runtime/bunfig#install-minimumreleaseage
minimumReleaseAge = 604_800
25 changes: 2 additions & 23 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,7 @@
<title>vilos92</title>
</head>
<body>
<main>
<h1>
<a class="site-title" href="#" target="_blank" rel="noopener noreferrer">
vilos92<span class="visually-hidden"> on GitHub (opens in new tab)</span>
</a>
</h1>
<div class="search">
<form id="go">
<input
id="slug"
name="slug"
type="search"
placeholder="project slug"
autocomplete="off"
spellcheck="false"
autofocus
/>
<button type="submit">Go</button>
</form>
<ul id="results"></ul>
</div>
</main>
<script type="module" src="/src/hub-app.ts"></script>
<div id="root"></div>
<script type="module" src="/src/hub-app.tsx"></script>
</body>
</html>
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@
"dependencies": {
"fuzzysort": "^3.1.0",
"hono": "^4.11.4",
"preact": "^10.29.2",
"zod": "^4.4.3"
},
"devDependencies": {
"@cloudflare/vite-plugin": "^1.35.0",
"@cloudflare/workers-types": "^4.20250525.0",
"@preact/preset-vite": "^2.10.5",
"@vanilla-extract/css": "^1.20.1",
"@vanilla-extract/vite-plugin": "^5.2.2",
"fallow": "^2.66.1",
"typescript": "~6.0.2",
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
Expand Down
86 changes: 0 additions & 86 deletions src/hub-app.ts

This file was deleted.

16 changes: 16 additions & 0 deletions src/hub-app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {render} from 'preact';

import {HubApp} from '@/hub/HubApp';

import '@/hub/global.css';

/*
* Script.
*/

const root = document.getElementById('root');
if (!root) {
throw new Error('hub markup missing #root');
}

render(<HubApp />, root);
Loading
Loading