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
4 changes: 1 addition & 3 deletions docs/HARNESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ When you observe a recurring issue, decide where to encode the fix:

| Observation | Encode it as |
|---|---|
| "Agent keeps using `as any` in production code." | Promote `@typescript-eslint/no-explicit-any` from `warn` to `error` in the relevant `files:` override. The rule is already wired; only the severity changes. |
| "Agent keeps using `as any` in production code." | Already enforced by `eslint` `@typescript-eslint/no-explicit-any` (`error` in production code; relaxed in tests). |
| "Agent reads/writes D1 from a non-server file." | Already enforced by `src/archtest/db-access.test.ts`. Update the test if the allowed-paths list legitimately changes. |
| "Agent reaches for `process.env` on Cloudflare." | Already enforced by `eslint` `no-restricted-globals` + `src/archtest/env.test.ts`. |
| "Agent introduces a new lint failure that ESLint should have caught." | Enable the relevant rule in `eslint.config.js`. |
Expand All @@ -85,8 +85,6 @@ ideally one rule per PR so the diff is reviewable:

| Rule | Why warn today | Promote when |
|---|---|---|
| `@typescript-eslint/no-explicit-any` | ~30 occurrences in Svelte components and routes | Components are typed properly (most are `(p: any) =>` in `.map()`s with a known shape) |
| `@typescript-eslint/no-unused-vars` | ~20 leftover imports | One sweep with manual review |
| `svelte/require-each-key` | ~10 unkeyed `{#each}` blocks | Each route owns its fix |
| `svelte/no-navigation-without-resolve` | ~10 `<a href>` / `goto()` without `resolve()` | Svelte 5 routing migration |
| `svelte/prefer-svelte-reactivity` | `new Set()` instead of `SvelteSet` in 2 files | Replace inline |
Expand Down
18 changes: 9 additions & 9 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,14 @@ export default [
},
rules: {
// AGENTS.md: "Do not use `as any` or `@ts-ignore`; model the type instead".
// Warn for now — full cleanup is tracked separately; `validate`
// fails only on errors so existing call sites don't block.
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/ban-ts-comment': 'error',

// Stop merge of forgotten _-debugging without blocking intentional
// throwaway names. Soft-landed (warn) so existing call sites
// don't block; `npm run lint`, Git hooks, and CI still surface them.
// Stop merge of forgotten variables/imports without blocking
// intentional `_`-prefixed throwaway names.
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
Expand All @@ -63,16 +60,19 @@ export default [
'no-eval': 'error',
'no-implied-eval': 'error',

// Flag dead assignments and redundant string mustaches (while allowing
// string escapes such as `\n` in multiline textarea placeholders).
'no-useless-assignment': 'error',
'svelte/no-useless-mustaches': ['error', { ignoreStringEscape: true }],

// Style/best-practice rules that flag real-but-stylistic issues
// across the existing codebase. Soft-landed as warn so `validate`
// stays green; HARNESS.md documents the path to promote them.
'svelte/require-each-key': 'warn',
'svelte/no-navigation-without-resolve': 'warn',
'svelte/prefer-svelte-reactivity': 'warn',
'svelte/no-useless-mustaches': 'warn',
'svelte/no-at-html-tags': 'warn',
'no-useless-escape': 'warn',
'no-useless-assignment': 'warn',
'prefer-const': 'warn'
}
},
Expand Down
9 changes: 5 additions & 4 deletions src/lib/components/ConfigCard.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import type { PackageInput } from '$lib/packages';
import ContextMenu from './ContextMenu.svelte';

interface Config {
Expand All @@ -9,7 +10,7 @@
base_preset: string;
visibility: string;
alias: string | null;
packages?: any[];
packages?: PackageInput[];
updated_at?: string;
install_count?: number;
}
Expand All @@ -22,14 +23,14 @@

const packages = $derived(
Array.isArray(config.packages)
? config.packages.map((p: any) =>
? config.packages.map((p) =>
typeof p === 'string' ? { name: p, type: 'formula' } : p
)
: []
);

const cli = $derived(packages.filter((p: any) => p.type !== 'cask' && p.type !== 'npm').length);
const apps = $derived(packages.filter((p: any) => p.type === 'cask').length);
const cli = $derived(packages.filter((p) => p.type !== 'cask' && p.type !== 'npm').length);
const apps = $derived(packages.filter((p) => p.type === 'cask').length);

const installUrl = $derived(
config.alias ? `openboot.dev/${config.alias}` : `openboot.dev/${username}/${config.slug}`
Expand Down
28 changes: 23 additions & 5 deletions src/lib/components/ConfigDetail.svelte
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { normalizePackages, resolvePackages } from '$lib/packages';
import { normalizePackages, resolvePackages, type PackageInput } from '$lib/packages';
import type { ConfigSnapshot, SnapshotMacOSPref } from '$lib/types';
import { getCatalogItem } from '$lib/macos-prefs-catalog';
import ShareModal from '$lib/components/ShareModal.svelte';
import MacOSPreferencesDisplay from '$lib/components/MacOSPreferencesDisplay.svelte';
import PackageFingerprint from '$lib/components/PackageFingerprint.svelte';

interface ConfigDetailData {
id: string;
slug: string;
name: string;
description?: string | null;
base_preset?: string | null;
visibility?: string | null;
alias?: string | null;
custom_script?: string | null;
dotfiles_repo?: string | null;
install_count?: number;
updated_at?: string | number | null;
snapshot_at?: string | null;
packages?: PackageInput[];
snapshot?: ConfigSnapshot | null;
}

let {
configUser,
config,
packageDescriptions = {}
}: {
configUser: { username: string; avatar_url: string | null };
config: any;
config: ConfigDetailData;
packageDescriptions: Record<string, string>;
} = $props();

Expand Down Expand Up @@ -147,15 +165,15 @@

const visibility = $derived((config.visibility || 'public') as string);

const snapshot = $derived(config.snapshot || {});
const snapshot = $derived<ConfigSnapshot>(config.snapshot || {});
const macosPrefs = $derived(snapshot.macos_prefs || []);
const shell = $derived(snapshot.shell || {});
const git = $derived(snapshot.git || {});
const devToolsRaw = $derived(snapshot.dev_tools || []);
const devTools = $derived(devToolsRaw.map((t: any) => (typeof t === 'string' ? t : t?.name || String(t))));
const devTools = $derived(devToolsRaw.map((t) => (typeof t === 'string' ? t : t?.name || String(t))));

const prefsByCategory = $derived.by(() => {
const map: Record<string, { pref: any; catalogItem: ReturnType<typeof getCatalogItem> }[]> = {};
const map: Record<string, { pref: SnapshotMacOSPref; catalogItem: ReturnType<typeof getCatalogItem> }[]> = {};
for (const pref of macosPrefs) {
const catalogItem = getCatalogItem(pref.domain, pref.key);
const category = catalogItem?.category ?? 'Custom';
Expand Down
42 changes: 32 additions & 10 deletions src/lib/components/ConfigEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,39 @@
import PackageManager from './PackageManager.svelte';
import MacOSPreferencesEditor from './MacOSPreferencesEditor.svelte';
import { PRESET_PACKAGES } from '$lib/presets';
import { normalizePackages, resolvePackages, syncSnapshotTaps } from '$lib/packages';
import { normalizePackages, resolvePackages, syncSnapshotTaps, type PackageInput } from '$lib/packages';
import type { ConfigSnapshot } from '$lib/types';

interface RawMacOSPref {
domain?: string;
key?: string;
type?: string;
value?: unknown;
desc?: string;
host?: unknown;
}

interface EditableConfig {
name?: string;
description?: string;
base_preset?: string;
visibility?: string;
alias?: string | null;
custom_script?: string;
dotfiles_repo?: string;
packages?: PackageInput[];
snapshot?: ConfigSnapshot | null;
}

let { slug, skipAuth = false }: { slug?: string; skipAuth?: boolean } = $props();
const isNew = !slug;
const isNew = $derived(!slug);

let loading = $state(true);
let saving = $state(false);
let error = $state('');
let editingConfig = $state<any>(null);
let editingConfig = $state<EditableConfig | null>(null);
let initialSnapshot = $state('');
let initialPayload: any = null;
let initialPayload: EditableConfig | null = null;
let rawMode = $state(false);
let rawJson = $state('');
let scriptTextarea = $state<HTMLTextAreaElement | null>(null);
Expand Down Expand Up @@ -113,8 +135,8 @@
return value;
}

function mapPrefs(raw: any[]): MacOSPref[] {
return raw.map((p: any) => {
function mapPrefs(raw: readonly RawMacOSPref[]): MacOSPref[] {
return raw.map((p) => {
const type = p.type || '';
const out: MacOSPref = {
domain: p.domain || '',
Expand Down Expand Up @@ -235,7 +257,7 @@
};
}

function applyParsed(parsed: any) {
function applyParsed(parsed: EditableConfig) {
formData = {
name: parsed.name || '',
description: parsed.description || '',
Expand Down Expand Up @@ -285,15 +307,15 @@
}

async function save() {
let payload: any;
let payload: EditableConfig;
if (rawMode) {
try {
payload = JSON.parse(rawJson);
payload = JSON.parse(rawJson) as EditableConfig;
} catch {
error = 'Invalid JSON';
return;
}
if (!payload.name) {
if (!payload?.name) {
error = 'Name is required';
return;
}
Expand Down
11 changes: 6 additions & 5 deletions src/lib/components/ConfigRow.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { resolve } from '$app/paths';
import type { PackageInput } from '$lib/packages';
import ContextMenu from './ContextMenu.svelte';
import PackageFingerprint from './PackageFingerprint.svelte';

Expand All @@ -11,7 +12,7 @@
base_preset: string;
visibility: string;
alias: string | null;
packages?: any[];
packages?: PackageInput[];
updated_at?: string;
install_count?: number;
}
Expand All @@ -24,15 +25,15 @@

const packages = $derived(
Array.isArray(config.packages)
? config.packages.map((p: any) =>
? config.packages.map((p) =>
typeof p === 'string' ? { name: p, type: 'formula' } : p
)
: []
);

const cli = $derived(packages.filter((p: any) => p.type !== 'cask' && p.type !== 'npm').length);
const apps = $derived(packages.filter((p: any) => p.type === 'cask').length);
const npm = $derived(packages.filter((p: any) => p.type === 'npm').length);
const cli = $derived(packages.filter((p) => p.type !== 'cask' && p.type !== 'npm').length);
const apps = $derived(packages.filter((p) => p.type === 'cask').length);
const npm = $derived(packages.filter((p) => p.type === 'npm').length);

const installUrl = $derived(
config.alias ? `openboot.dev/${config.alias}` : `openboot.dev/${username}/${config.slug}`
Expand Down
3 changes: 2 additions & 1 deletion src/lib/components/MacOSPreferencesDisplay.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script lang="ts">
import { getCatalogItem } from '$lib/macos-prefs-catalog';
import type { SnapshotMacOSPref } from '$lib/types';

let {
prefsByCategory,
prefCategoryNames
}: {
prefsByCategory: Record<string, { pref: any; catalogItem: ReturnType<typeof getCatalogItem> }[]>;
prefsByCategory: Record<string, { pref: SnapshotMacOSPref; catalogItem: ReturnType<typeof getCatalogItem> }[]>;
prefCategoryNames: string[];
} = $props();
</script>
Expand Down
12 changes: 7 additions & 5 deletions src/lib/components/PackageManager.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@
searchLoading = true;
try {
const [brewRes, npmRes] = await Promise.allSettled([
fetch(`/api/homebrew/search?q=${encodeURIComponent(query)}`).then((r) => r.json()),
fetch(`/api/npm/search?q=${encodeURIComponent(query)}`).then((r) => r.json())
fetch(`/api/homebrew/search?q=${encodeURIComponent(query)}`).then(
(r) => r.json() as Promise<{ results?: SearchResult[] }>
),
fetch(`/api/npm/search?q=${encodeURIComponent(query)}`).then(
(r) => r.json() as Promise<{ results?: Omit<SearchResult, 'type'>[] }>
)
]);
const brew: SearchResult[] = brewRes.status === 'fulfilled' ? brewRes.value.results || [] : [];
const npm: SearchResult[] =
npmRes.status === 'fulfilled'
? (npmRes.value.results || []).map((r: any) => ({ ...r, type: 'npm' as const }))
: [];
npmRes.status === 'fulfilled' ? (npmRes.value.results || []).map((r) => ({ ...r, type: 'npm' as const })) : [];
searchResults = [...brew, ...npm];
if (isTapPackage(query) && !searchResults.some((r) => r.name === query)) {
searchResults.unshift(
Expand Down
20 changes: 10 additions & 10 deletions src/lib/components/SiteHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
<div class="header-right">
{#if children}{@render children()}{/if}
<GitHubStarBadge />
{#if $auth.loading}

{:else if $auth.user}
<span class="header-auth">
<a href="/dashboard" class="header-dashboard-link">Dashboard</a>
<span class="header-separator">/</span>
<form method="POST" action="/api/auth/logout" style="display:inline"><button type="submit" class="header-logout-link">Logout</button></form>
</span>
{:else}
<a href="/login" class="header-login-link">Sign in</a>
{#if !$auth.loading}
{#if $auth.user}
<span class="header-auth">
<a href="/dashboard" class="header-dashboard-link">Dashboard</a>
<span class="header-separator">/</span>
<form method="POST" action="/api/auth/logout" style="display:inline"><button type="submit" class="header-logout-link">Logout</button></form>
</span>
{:else}
<a href="/login" class="header-login-link">Sign in</a>
{/if}
{/if}
<ThemeToggle />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stores/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface AuthState {
}

function createAuthStore() {
const { subscribe, set, update } = writable<AuthState>({
const { subscribe, set } = writable<AuthState>({
user: null,
loading: true
});
Expand Down
25 changes: 25 additions & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { SnapshotPackages } from './packages';

export interface SnapshotMacOSPref {
domain: string;
key: string;
value: string;
type?: string;
desc?: string;
host?: string;
unset?: boolean;
}

export interface ConfigSnapshot {
packages?: SnapshotPackages;
macos_prefs?: SnapshotMacOSPref[] | null;
shell?: {
default?: string;
oh_my_zsh?: boolean;
theme?: string;
plugins?: string[];
};
git?: Record<string, string>;
dev_tools?: Array<string | { name?: string; version?: string }> | null;
[key: string]: unknown;
}
Loading
Loading