[repo] Workspace: Scaffold Phase 0 with schema, engine, content, ui and the PWA shell
pnpm + turbo workspace with the commands from CLAUDE.md §3. The contracts from §6 as JSON Schemas with generated types; localDay as the one place a day is computed; the forbidden-word list shared by lint:copy and the library validator, with 13 negative fixtures; a Svelte 5 PWA shell built under /Rosea/ with a meta CSP. E2E and offline suites run against the built bundle; the offline one closes the server rather than emulating. Analysis: .agents/features/phase0-workspace.md
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// Installs the git hooks CLAUDE.md §5.2 relies on. Runs from `pnpm install` via
|
||||
// the root `prepare` script, so a fresh clone is guarded before its first commit.
|
||||
// Adapted from Ludus, including its worktree fix: in a worktree `.git` is a FILE
|
||||
// pointing at the real gitdir, and hooks resolve per worktree.
|
||||
import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from 'node:fs';
|
||||
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const gitPath = join(root, '.git');
|
||||
|
||||
if (!existsSync(gitPath)) {
|
||||
console.log('[hooks] no .git — skipping hook install.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
function resolveGitDir(path) {
|
||||
if (statSync(path).isDirectory()) return path;
|
||||
const target = /^gitdir:\s*(.+)$/.exec(readFileSync(path, 'utf8').trim())?.[1]?.trim();
|
||||
if (target === undefined) {
|
||||
console.log(`[hooks] ${path} is a file but not a gitdir pointer — skipping hook install.`);
|
||||
process.exit(0);
|
||||
}
|
||||
return isAbsolute(target) ? target : resolve(root, target);
|
||||
}
|
||||
|
||||
const hooksDir = join(resolveGitDir(gitPath), 'hooks');
|
||||
mkdirSync(hooksDir, { recursive: true });
|
||||
|
||||
for (const hook of ['pre-commit', 'commit-msg']) {
|
||||
const dest = join(hooksDir, hook);
|
||||
copyFileSync(join(root, 'scripts', hook), dest);
|
||||
chmodSync(dest, 0o755);
|
||||
console.log(`[hooks] installed ${hook}`);
|
||||
}
|
||||
Reference in New Issue
Block a user