joycraft 0.7.5 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/upgrade.ts","../src/migration.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync, mkdirSync, rmSync, rmdirSync, readdirSync, chmodSync } from 'node:fs';\nimport { join, dirname, resolve } from 'node:path';\nimport { createInterface } from 'node:readline';\nimport { execFileSync, spawnSync } from 'node:child_process';\nimport { readVersion, writeVersion, hashContent, truncateHash, LEGACY_VERSION_FILE, LEGACY_CLAUDE_STATE_PATH, parseGitignoreProfile } from './version.js';\nimport { applyGitignoreProfile, resolveGitignoreProfile, validateGitignoreFlag, PRIVATE_PROFILE_IGNORES, PRIVATE_UNTRACK_COMMAND } from './gitignore.js';\nimport { applyGitattributes } from './gitattributes.js';\nimport { SKILLS, TEMPLATES, CODEX_SKILLS, PI_SKILLS, PI_SCRIPTS, PI_EXTENSIONS, PI_AGENTS, COPILOT_SKILLS } from './bundled-files.js';\nimport { getPackageVersion } from './package-version.js';\nimport { planMigration, applyMigration, type MigrationPlan } from './migration.js';\nimport { HARNESSES, sanitizeHarnesses, type Harness } from './harness.js';\nimport { ensureExecutionProfileSection, defaultExecutionProfile } from './execution-profile.js';\n\n/**\n * Read-only check for harness files git is still tracking. Used to decide\n * whether to surface the `git rm --cached` untrack hint on a re-run already on\n * the `private` profile (the easy-to-miss case): only show it when files are\n * actually tracked, so it isn't noise. Never runs a mutating git command, and\n * fails closed to `[]` outside a git repo or when git is unavailable.\n */\nfunction listTrackedHarnessFiles(targetDir: string): string[] {\n const dirs = PRIVATE_PROFILE_IGNORES.map((d) => d.replace(/\\/$/, ''));\n try {\n const out = execFileSync('git', ['ls-files', '-z', '--', ...dirs], {\n cwd: targetDir,\n encoding: 'utf-8',\n stdio: ['ignore', 'pipe', 'ignore'],\n });\n return out.split('\\0').filter((line) => line.length > 0);\n } catch {\n return [];\n }\n}\n\nfunction isStaleVersion(current: string, latest: string): boolean {\n const currentParts = current.split('.').map(Number);\n const latestParts = latest.split('.').map(Number);\n const len = Math.max(currentParts.length, latestParts.length);\n for (let i = 0; i < len; i++) {\n const c = currentParts[i] ?? 0;\n const l = latestParts[i] ?? 0;\n if (c < l) return true;\n if (c > l) return false;\n }\n return false;\n}\n\nasync function checkCliVersion(): Promise<{ stale: boolean; latest?: string }> {\n try {\n const pkgVersion = getPackageVersion();\n const res = await fetch('https://registry.npmjs.org/joycraft/latest', {\n signal: AbortSignal.timeout(3000)\n });\n if (!res.ok) return { stale: false };\n const data = (await res.json()) as { version: string };\n if (isStaleVersion(pkgVersion, data.version)) {\n return { stale: true, latest: data.version };\n }\n } catch {\n // Silent fallback on network errors or missing version\n }\n return { stale: false };\n}\n\nexport interface UpgradeOptions {\n yes: boolean;\n /** Raw --gitignore value from the CLI, if provided. Validated in upgrade(). */\n gitignore?: string;\n /** Test seam for the stale-CLI re-exec; defaults to child_process.spawnSync. */\n spawnForReexec?: (\n cmd: string,\n args: string[],\n opts: { stdio: 'inherit' }\n ) => { status: number | null; error?: Error };\n}\n\n/**\n * Re-run the upgrade through the latest published CLI. Pinning the exact\n * version bypasses npx's cache, which is what leaves a bare `npx joycraft`\n * stale in the first place. Returns false if the spawn itself failed.\n */\nfunction reexecLatestUpgrade(targetDir: string, opts: UpgradeOptions, latest: string): boolean {\n const args = ['-y', `joycraft@${latest}`, 'upgrade', targetDir];\n if (opts.yes) args.push('--yes');\n if (opts.gitignore !== undefined) args.push('--gitignore', opts.gitignore);\n const spawn = opts.spawnForReexec ?? spawnSync;\n const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx';\n const result = spawn(npx, args, { stdio: 'inherit' });\n if (result.error) return false;\n if (typeof result.status === 'number' && result.status !== 0) {\n process.exitCode = result.status;\n }\n return true;\n}\n\ninterface FileChange {\n relativePath: string;\n absolutePath: string;\n newContent: string;\n kind: 'new' | 'updated' | 'customized';\n}\n\n/**\n * Build the managed-file map for the diff/apply loop, scoped to the installed\n * harnesses. A Codex-only project must not have Claude/Pi files added back on\n * upgrade. `harnesses` comes from persisted state; callers pass all available for\n * back-compat when the project predates harness selection. Templates are\n * harness-agnostic and always included.\n */\nfunction getManagedFiles(harnesses: readonly Harness[]): Record<string, string> {\n const files: Record<string, string> = {};\n const wants = (h: Harness): boolean => harnesses.includes(h);\n\n if (wants('claude')) {\n for (const [name, content] of Object.entries(SKILLS)) {\n const skillName = name.replace(/\\.md$/, '');\n files[join('.claude', 'skills', skillName, 'SKILL.md')] = content;\n }\n }\n for (const [name, content] of Object.entries(TEMPLATES)) {\n files[join('docs', 'templates', name)] = content;\n }\n if (wants('codex')) {\n for (const [name, content] of Object.entries(CODEX_SKILLS)) {\n const skillName = name.replace(/\\.md$/, '');\n files[join('.agents', 'skills', skillName, 'SKILL.md')] = content;\n }\n }\n if (wants('pi')) {\n for (const [name, content] of Object.entries(PI_SKILLS)) {\n const skillName = name.replace(/\\.md$/, '');\n files[join('.pi', 'skills', skillName, 'SKILL.md')] = content;\n }\n for (const [name, content] of Object.entries(PI_SCRIPTS)) {\n files[join('.pi', 'scripts', 'joycraft', name)] = content;\n }\n for (const [name, content] of Object.entries(PI_EXTENSIONS)) {\n files[join('.pi', 'extensions', name)] = content;\n }\n for (const [name, content] of Object.entries(PI_AGENTS)) {\n files[join('.pi', 'agents', name)] = content;\n }\n }\n if (wants('copilot')) {\n for (const [name, content] of Object.entries(COPILOT_SKILLS)) {\n const skillName = name.replace(/\\.md$/, '');\n files[join('.github', 'skills', skillName, 'SKILL.md')] = content;\n }\n }\n return files;\n}\n\n// Deprecated skill names from previous versions of Joycraft.\n// These get removed during upgrade to prevent stale slash commands.\nconst DEPRECATED_SKILL_DIRS = [\n // Pre-rebrand names\n 'joysmith', // pre-rebrand main skill\n 'joysmith-assess', // merged into joycraft-tune\n 'joysmith-upgrade', // merged into joycraft-tune\n // Pre-namespace names (bare names without joycraft- prefix)\n 'tune', // now /joycraft-tune\n 'tune-assess', // merged into joycraft-tune\n 'tune-upgrade', // merged into joycraft-tune\n 'joy', // merged into joycraft-tune\n 'interview', // now /joycraft-interview\n 'new-feature', // now /joycraft-new-feature\n 'decompose', // now /joycraft-decompose\n 'session-end', // now /joycraft-session-end\n];\n\n// Flat .md files from the pre-directory skill format\nconst DEPRECATED_SKILL_FILES = [\n 'tune.md',\n 'joy.md',\n 'joysmith.md',\n 'joysmith-assess.md',\n 'joysmith-upgrade.md',\n 'tune-assess.md',\n 'tune-upgrade.md',\n 'interview.md',\n 'new-feature.md',\n 'decompose.md',\n 'session-end.md',\n];\n\nfunction cleanupDeprecatedSkills(targetDir: string): number {\n const skillsDir = join(targetDir, '.claude', 'skills');\n if (!existsSync(skillsDir)) return 0;\n\n let removed = 0;\n\n // Remove deprecated directories\n for (const name of DEPRECATED_SKILL_DIRS) {\n const dir = join(skillsDir, name);\n if (existsSync(dir)) {\n rmSync(dir, { recursive: true, force: true });\n removed++;\n }\n }\n\n // Remove flat .md files from pre-directory format\n for (const name of DEPRECATED_SKILL_FILES) {\n const file = join(skillsDir, name);\n if (existsSync(file)) {\n rmSync(file);\n removed++;\n }\n }\n\n return removed;\n}\n\n/**\n * Self-heal projects inited by an older Joycraft that wrote state to a now-legacy\n * location, relocating it to the current harness-neutral `docs/.joycraft/state.json`.\n * Two legacy homes are handled, in precedence order:\n * 1. `.claude/.joycraft/state.json` — the interim Claude-nested location.\n * 2. `.joycraft-version` — the original repo-root file.\n * The newer (Claude-nested) source wins when both somehow exist. Returns true\n * if any legacy file was found (and removed), false when there's nothing to do.\n *\n * Beyond moving the data, this also clears the foreign-harness footprint: after\n * migrating away from `.claude/.joycraft/`, the emptied `.joycraft/` (and an\n * emptied `.claude/`) are removed so a Codex/Pi-only project stops carrying a\n * stray `.claude/` it never asked for.\n *\n * Gitignore handling is deliberately NOT done here: the profile isn't resolved\n * yet at this point in upgrade(), and applyGitignoreProfile later in the same\n * run covers the state entry (shared) or the whole harness trees (private) —\n * writing the state entry here would leave a dead line under `private`.\n *\n * Runs BEFORE the managed-file diff so the recorded-original hashes are\n * available at the new location for the same run's 3-way comparison. The hidden\n * state's own write truncates the (possibly full-length legacy) hashes, so the\n * comparison stays consistent — see the truncateHash() call in the diff loop.\n */\nfunction migrateLegacyVersionFile(targetDir: string): boolean {\n // Prefer the newer Claude-nested state, then the original root file.\n const claudeStatePath = join(targetDir, LEGACY_CLAUDE_STATE_PATH);\n const rootStatePath = join(targetDir, LEGACY_VERSION_FILE);\n const legacyPath = existsSync(claudeStatePath)\n ? claudeStatePath\n : existsSync(rootStatePath)\n ? rootStatePath\n : null;\n if (legacyPath === null) return false;\n\n let parsed: { version?: unknown; files?: unknown; gitignoreProfile?: unknown; harnesses?: unknown };\n try {\n parsed = JSON.parse(readFileSync(legacyPath, 'utf-8'));\n } catch {\n // Corrupt legacy file: treat as no usable baseline. Remove it so the old\n // location stops being polluted; upgrade then proceeds with no\n // recorded-original (every changed file becomes \"customized\" — safe, never\n // silently wrong).\n rmSync(legacyPath, { force: true });\n cleanupEmptyClaudeState(targetDir);\n return true;\n }\n\n const version = typeof parsed.version === 'string' ? parsed.version : getPackageVersion();\n const files =\n parsed.files && typeof parsed.files === 'object'\n ? (parsed.files as Record<string, string>)\n : {};\n // Carry forward the profile and harness selection recorded in the legacy\n // state. (The root-file format predates both fields, so they're typically\n // absent there — harmless.) Passing them explicitly matters here: the new\n // docs/ state doesn't exist yet, so writeVersion has nothing to preserve them\n // from. Dropping harnesses would make the later getManagedFiles() fall back to\n // all available and resurrect a .claude/ on a Codex/Pi-only project.\n const profile = parseGitignoreProfile(parsed.gitignoreProfile) ?? undefined;\n const harnesses = sanitizeHarnesses(parsed.harnesses) ?? undefined;\n\n // writeVersion targets the new docs/ path and truncates the hashes.\n writeVersion(targetDir, version, files, profile, harnesses);\n rmSync(legacyPath, { force: true });\n cleanupEmptyClaudeState(targetDir);\n return true;\n}\n\n/**\n * After migrating away from `.claude/.joycraft/state.json`, remove the now-empty\n * `.claude/.joycraft/` directory — and `.claude/` itself if Joycraft's state was\n * the only thing in it (a Codex/Pi-only install that should never have had a\n * `.claude/`). Best-effort: a `.claude/` holding skills, hooks, or settings is\n * left untouched. rmdir on a non-empty dir throws, which we swallow.\n */\nfunction cleanupEmptyClaudeState(targetDir: string): void {\n const joycraftDir = join(targetDir, '.claude', '.joycraft');\n const claudeDir = join(targetDir, '.claude');\n try { rmdirSync(joycraftDir); } catch { /* non-empty or absent — leave it */ }\n try { rmdirSync(claudeDir); } catch { /* non-empty or absent — leave it */ }\n}\n\nfunction countLines(content: string): number {\n return content.split('\\n').length;\n}\n\nfunction ensureScriptExecutable(absolutePath: string): void {\n // Joycraft shell scripts in .pi/scripts/joycraft/ must be executable.\n // README.md is the only file in that directory that should stay 644.\n if (absolutePath.includes('.pi/scripts/joycraft/') && !absolutePath.endsWith('README.md')) {\n try {\n chmodSync(absolutePath, 0o755);\n } catch {\n // non-fatal — permissions may be restricted\n }\n }\n}\n\nasync function askUser(question: string): Promise<boolean> {\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n return new Promise((resolve) => {\n rl.question(`${question} [y/N] `, (answer) => {\n rl.close();\n resolve(answer.trim().toLowerCase() === 'y');\n });\n });\n}\n\nfunction printMigrationSummary(plan: MigrationPlan, projectDir: string): void {\n console.log('');\n console.log('Joycraft is migrating your docs/ to the new per-feature layout:');\n console.log('');\n\n const relTo = (p: string) => (p.startsWith(projectDir) ? p.slice(projectDir.length + 1) : p);\n\n // Group per-feature moves by feature folder for readability.\n // Bugfix-area moves are listed separately below.\n const featureMoves = plan.moves.filter(m => m.kind !== 'bugfix-dir');\n const bugfixMoves = plan.moves.filter(m => m.kind === 'bugfix-dir');\n\n const bySlug = new Map<string, typeof plan.moves>();\n for (const move of featureMoves) {\n const parts = relTo(move.to).split(/[\\\\/]/);\n // docs/features/<slug>/...\n const slug = parts.length >= 3 ? parts[2] : '(root)';\n if (!bySlug.has(slug)) bySlug.set(slug, []);\n bySlug.get(slug)!.push(move);\n }\n for (const [slug, moves] of bySlug) {\n console.log(` ${slug}/`);\n for (const move of moves) {\n console.log(` ${relTo(move.from)} → ${relTo(move.to)}`);\n }\n }\n\n if (bugfixMoves.length > 0) {\n console.log('');\n console.log(' Migrating bugfix areas:');\n for (const move of bugfixMoves) {\n console.log(` ${relTo(move.from)} → ${relTo(move.to)}`);\n }\n }\n console.log('');\n}\n\nfunction printMigrationBanner(): void {\n console.log('');\n console.log('Migration complete. See the README section \"Migration: Flat → Per-Feature Layout\"');\n console.log('for context on what changed and why. If your project is a git repo, run');\n console.log('`git status` to inspect the moves before committing.');\n console.log('');\n}\n\nfunction runForcedMigration(projectDir: string): void {\n const plan = planMigration(projectDir);\n if (plan.moves.length === 0 && plan.orphans.specsDirs.length === 0) {\n return; // No flat layout — silent no-op.\n }\n\n printMigrationSummary(plan, projectDir);\n const result = applyMigration(plan);\n\n // Abort threshold: if more than 50% of attempted moves failed, bail loudly.\n const attempted = result.applied + result.errors.length;\n if (attempted > 0 && result.errors.length / attempted > 0.5) {\n console.error('Migration failed for more than half of attempted moves. Aborting upgrade.');\n for (const e of result.errors) {\n console.error(` ${e.move.from} → ${e.move.to}: ${e.error}`);\n }\n throw new Error('Migration aborted: too many failures');\n }\n\n if (result.errors.length > 0) {\n console.log('Some moves had errors but upgrade will continue:');\n for (const e of result.errors) {\n console.log(` warn: ${e.move.from} → ${e.move.to}: ${e.error}`);\n }\n }\n\n printMigrationBanner();\n}\n\nexport async function upgrade(dir: string, opts: UpgradeOptions): Promise<void> {\n const targetDir = resolve(dir);\n\n // Validate the --gitignore flag before any side effects (network check,\n // legacy migration, docs migration) so a typo'd value changes nothing.\n if (opts.gitignore !== undefined) validateGitignoreFlag(opts.gitignore);\n\n // Guard: if the CLI itself is out of date, never compare project files\n // against stale bundled content. With --yes or an interactive confirmation,\n // re-exec the pinned latest version via npx so upgrade stays one command;\n // otherwise (or if the spawn fails) tell the user the one-liner.\n const cliCheck = await checkCliVersion();\n if (cliCheck.stale && cliCheck.latest) {\n const pkgVersion = getPackageVersion();\n console.log(`Joycraft CLI is out of date (you have ${pkgVersion}, latest is ${cliCheck.latest}).`);\n const rerun =\n opts.yes ||\n (process.stdin.isTTY === true &&\n (await askUser(`Run joycraft@${cliCheck.latest} via npx now?`)));\n if (rerun && reexecLatestUpgrade(targetDir, opts, cliCheck.latest)) return;\n console.log('Update and re-run in one step with: npx joycraft@latest upgrade');\n return;\n }\n\n // Check if project was initialized. A project is \"initialized\" if it has the\n // hidden state, OR a known skill, OR a legacy root state file (pre-relocation).\n const hasLegacyState =\n existsSync(join(targetDir, LEGACY_VERSION_FILE)) ||\n existsSync(join(targetDir, LEGACY_CLAUDE_STATE_PATH));\n const hasSkill = existsSync(join(targetDir, '.claude', 'skills', 'joycraft-tune', 'SKILL.md'))\n || existsSync(join(targetDir, '.claude', 'skills', 'tune', 'SKILL.md'))\n || existsSync(join(targetDir, '.claude', 'skills', 'joy', 'SKILL.md'))\n || existsSync(join(targetDir, '.claude', 'skills', 'joysmith', 'SKILL.md'));\n\n if (!readVersion(targetDir) && !hasLegacyState && !hasSkill) {\n console.log('This project has not been initialized with Joycraft.');\n console.log('Run `npx joycraft init` first.');\n return;\n }\n\n // Relocate any legacy state (root .joycraft-version or the interim\n // .claude/.joycraft/state.json) → docs/.joycraft/state.json, BEFORE the diff\n // loop so the migrated recorded-original is used on this same run. No-op when\n // no legacy file exists.\n migrateLegacyVersionFile(targetDir);\n\n // Clean up deprecated skill directories/files from older versions\n const deprecatedRemoved = cleanupDeprecatedSkills(targetDir);\n if (deprecatedRemoved > 0) {\n console.log(`Removed ${deprecatedRemoved} deprecated skill(s) from previous Joycraft versions.`);\n }\n\n // Forced migration: flat docs/{briefs,research,designs,specs/<feature>}/\n // → docs/features/<slug>/{brief,research,design,specs/}/\n // Runs before the managed-file diff loop so any new managed files end up\n // correctly placed in an already-migrated tree.\n runForcedMigration(targetDir);\n\n // Get current package version\n const pkgVersion = getPackageVersion();\n\n // If version matches exactly, check if any file content actually changed.\n // Re-read state AFTER migration so a just-migrated project's recorded-original\n // hashes (now at the new path) feed the comparison below.\n const installed = readVersion(targetDir);\n const installedHashes = installed?.files ?? {};\n\n // Scope the upgrade to the harnesses this project installed. State written\n // before harness selection has no `harnesses` field → fall back to all available\n // so existing projects keep getting every harness refreshed (back-compat).\n const harnesses: readonly Harness[] = installed?.harnesses ?? HARNESSES;\n const managedFiles = getManagedFiles(harnesses);\n\n // Resolve the project's gitignore profile.\n // - --gitignore flag: explicit choice — the non-interactive way to set or\n // switch the profile on an existing project.\n // - Already chosen (init, or a prior upgrade): honor it silently.\n // - Never chosen (pre-feature project) + interactive: ask once, then persist\n // so this prompt never recurs. --yes suppresses the prompt — it promises\n // a fully unattended run.\n // - Never chosen + non-interactive: fall back to shared for this run only;\n // decided=false means it is never persisted, so the project stays\n // undecided and will be asked next time someone runs upgrade in a TTY.\n const resolvedProfile = await resolveGitignoreProfile({\n flag: opts.gitignore,\n persisted: installed?.gitignoreProfile,\n interactive: process.stdin.isTTY === true && !opts.yes,\n promptIntro: '\\nJoycraft can now control how much of the harness is tracked in git.',\n });\n const gitignoreProfile = resolvedProfile.profile;\n applyGitignoreProfile(targetDir, gitignoreProfile);\n // Bring pre-existing projects up to the init behavior: collapse\n // workflow-exhaust docs in PR review. Append-only + idempotent.\n applyGitattributes(targetDir);\n\n // Bring pre-profile projects up to the init behavior: insert the\n // sentinel-delimited Execution Profile into AGENTS.md when it has none.\n // Insert-only — a project that already has a profile (hand-edited or not)\n // comes back byte-identical, because the region is user-owned data (D7).\n // Upgrade can't ask questions here (it may be running --yes/non-interactive),\n // so it writes the explicit-no default; /joycraft-tune offers the real\n // questions.\n const agentsMdPath = join(targetDir, 'AGENTS.md');\n if (existsSync(agentsMdPath)) {\n const existingAgents = readFileSync(agentsMdPath, 'utf-8');\n const withProfile = ensureExecutionProfileSection(\n existingAgents,\n defaultExecutionProfile(harnesses)\n );\n if (withProfile !== existingAgents) {\n writeFileSync(agentsMdPath, withProfile, 'utf-8');\n console.log(' ~ AGENTS.md (added Execution Profile — run /joycraft-tune to fill it in)');\n }\n }\n\n if (gitignoreProfile === 'private') {\n // On a fresh switch to private, always surface the untrack hint. On a\n // re-run where private is already persisted (the easy-to-miss case), only\n // surface it when harness files are actually still tracked — otherwise it's\n // noise. `git ls-files` is read-only; we never run git for the user.\n const switchingToPrivate = installed?.gitignoreProfile !== 'private';\n const trackedHarnessFiles = switchingToPrivate ? [] : listTrackedHarnessFiles(targetDir);\n if (switchingToPrivate || trackedHarnessFiles.length > 0) {\n console.log('');\n console.log(' ⚠ Private profile: harness dirs are gitignored, but git only stops');\n console.log(' tracking files you untrack. If any harness files were already');\n console.log(` committed${trackedHarnessFiles.length > 0 ? ` (${trackedHarnessFiles.length} still tracked)` : ''}, untrack them with:`);\n console.log('');\n console.log(` ${PRIVATE_UNTRACK_COMMAND}`);\n console.log('');\n console.log(' (advisory — Joycraft never runs git for you)');\n }\n }\n\n const changes: FileChange[] = [];\n let upToDate = 0;\n\n for (const [relPath, newContent] of Object.entries(managedFiles)) {\n const absPath = join(targetDir, relPath);\n const newHash = hashContent(newContent);\n\n if (!existsSync(absPath)) {\n // File doesn't exist locally — new file\n changes.push({ relativePath: relPath, absolutePath: absPath, newContent, kind: 'new' });\n continue;\n }\n\n const currentContent = readFileSync(absPath, 'utf-8');\n const currentHash = hashContent(currentContent);\n\n if (currentHash === newHash) {\n // Already matches the latest version\n upToDate++;\n continue;\n }\n\n // installedHashes are stored truncated; truncate the fresh hash to match.\n const originalHash = installedHashes[relPath];\n\n if (originalHash && truncateHash(currentHash) === originalHash) {\n // User hasn't modified the file — safe to auto-update\n changes.push({ relativePath: relPath, absolutePath: absPath, newContent, kind: 'updated' });\n } else {\n // User has customized this file (or no original hash recorded)\n changes.push({ relativePath: relPath, absolutePath: absPath, newContent, kind: 'customized' });\n }\n }\n\n if (changes.length === 0) {\n // Persist a freshly-decided profile (prompt answer or --gitignore switch)\n // even when no files changed, so the decision sticks. Never persist the\n // non-interactive fallback — an undecided project must stay undecided.\n if (resolvedProfile.decided && installed && installed.gitignoreProfile !== gitignoreProfile) {\n writeVersion(targetDir, installed.version, installedHashes, gitignoreProfile);\n }\n console.log('Already up to date.');\n return;\n }\n\n // Process changes\n let updated = 0;\n let skipped = 0;\n let added = 0;\n\n for (const change of changes) {\n if (change.kind === 'new') {\n // New Joycraft files are always auto-added — no prompt needed\n mkdirSync(dirname(change.absolutePath), { recursive: true });\n writeFileSync(change.absolutePath, change.newContent, 'utf-8');\n ensureScriptExecutable(change.absolutePath);\n added++;\n console.log(` + ${change.relativePath}`);\n } else if (change.kind === 'updated') {\n // Safe to auto-update — user hasn't touched the file\n writeFileSync(change.absolutePath, change.newContent, 'utf-8');\n ensureScriptExecutable(change.absolutePath);\n updated++;\n } else if (change.kind === 'customized') {\n const currentContent = readFileSync(change.absolutePath, 'utf-8');\n const currentLines = countLines(currentContent);\n const newLines = countLines(change.newContent);\n const diff = newLines - currentLines;\n const diffLabel = diff > 0 ? `+${diff} lines` : diff < 0 ? `${diff} lines` : 'same length';\n const label = `Customized: ${change.relativePath} (local: ${currentLines} lines, latest: ${newLines} lines, ${diffLabel})`;\n\n if (opts.yes) {\n writeFileSync(change.absolutePath, change.newContent, 'utf-8');\n updated++;\n } else {\n const accept = await askUser(`${label} — overwrite with latest?`);\n if (accept) {\n writeFileSync(change.absolutePath, change.newContent, 'utf-8');\n ensureScriptExecutable(change.absolutePath);\n updated++;\n } else {\n skipped++;\n }\n }\n }\n }\n\n // Write new version file with updated hashes\n const newHashes: Record<string, string> = {};\n for (const [relPath, content] of Object.entries(managedFiles)) {\n const absPath = join(targetDir, relPath);\n if (existsSync(absPath)) {\n const current = readFileSync(absPath, 'utf-8');\n newHashes[relPath] = hashContent(current);\n }\n }\n // Record the profile only when this run actually decided it; writeVersion\n // preserves an already-persisted profile when the argument is omitted, and an\n // undecided project stays undecided (so the one-time prompt can still fire).\n writeVersion(targetDir, pkgVersion, newHashes, resolvedProfile.decided ? gitignoreProfile : undefined);\n\n // Print summary\n const parts: string[] = [];\n if (updated > 0) parts.push(`Updated ${updated}`);\n if (skipped > 0) parts.push(`skipped ${skipped} (customized)`);\n if (added > 0) parts.push(`added ${added} new`);\n if (upToDate > 0) parts.push(`${upToDate} already up to date`);\n console.log(`\\nUpgrade complete: ${parts.join(', ')}.`);\n}\n\n","// Migration module — moves flat docs/{briefs,research,designs,specs/<feature>} layouts\n// into per-feature folders at docs/features/<slug>/{brief,research,design,specs/}.\n// Plan-then-apply split so callers can render a summary before mutating the filesystem.\n\nimport {\n cpSync,\n existsSync,\n mkdirSync,\n readdirSync,\n renameSync,\n rmSync,\n statSync,\n} from 'node:fs';\nimport { join } from 'node:path';\n\nexport type MoveKind = 'brief' | 'research' | 'design' | 'specs-dir' | 'bugfix-dir';\n\nexport interface Move {\n from: string;\n to: string;\n kind: MoveKind;\n}\n\nexport interface MigrationPlan {\n moves: Move[];\n slugs: string[];\n orphans: { specsDirs: string[] };\n skipped?: Move[];\n}\n\nexport interface MigrationResult {\n applied: number;\n skipped: number;\n errors: Array<{ move: Move; error: string }>;\n}\n\nconst DATE_PREFIX_RE = /^\\d{4}-\\d{2}-\\d{2}-(.+)$/;\n\nfunction deriveSlug(filename: string): string {\n return filename.replace(/\\.md$/, '');\n}\n\nfunction slugWithoutDate(slug: string): string | null {\n const m = slug.match(DATE_PREFIX_RE);\n return m ? m[1] : null;\n}\n\nfunction listMdFiles(dir: string): string[] {\n if (!existsSync(dir)) return [];\n try {\n return readdirSync(dir).filter(f => f.endsWith('.md'));\n } catch {\n return [];\n }\n}\n\nfunction listSubdirs(dir: string): string[] {\n if (!existsSync(dir)) return [];\n try {\n return readdirSync(dir).filter(name => {\n try {\n return statSync(join(dir, name)).isDirectory();\n } catch {\n return false;\n }\n });\n } catch {\n return [];\n }\n}\n\nexport function planMigration(projectDir: string): MigrationPlan {\n const briefsDir = join(projectDir, 'docs', 'briefs');\n const researchDir = join(projectDir, 'docs', 'research');\n const designsDir = join(projectDir, 'docs', 'designs');\n const specsDir = join(projectDir, 'docs', 'specs');\n\n const moves: Move[] = [];\n const skipped: Move[] = [];\n const slugSet = new Set<string>();\n\n // Briefs\n for (const file of listMdFiles(briefsDir)) {\n const slug = deriveSlug(file);\n slugSet.add(slug);\n const move: Move = {\n from: join(briefsDir, file),\n to: join(projectDir, 'docs', 'features', slug, 'brief.md'),\n kind: 'brief',\n };\n if (existsSync(move.to)) skipped.push(move);\n else moves.push(move);\n }\n\n // Research\n for (const file of listMdFiles(researchDir)) {\n const slug = deriveSlug(file);\n slugSet.add(slug);\n const move: Move = {\n from: join(researchDir, file),\n to: join(projectDir, 'docs', 'features', slug, 'research.md'),\n kind: 'research',\n };\n if (existsSync(move.to)) skipped.push(move);\n else moves.push(move);\n }\n\n // Designs\n for (const file of listMdFiles(designsDir)) {\n const slug = deriveSlug(file);\n slugSet.add(slug);\n const move: Move = {\n from: join(designsDir, file),\n to: join(projectDir, 'docs', 'features', slug, 'design.md'),\n kind: 'design',\n };\n if (existsSync(move.to)) skipped.push(move);\n else moves.push(move);\n }\n\n // Spec dirs — match by exact slug or date-stripped slug\n const briefSlugs = Array.from(slugSet);\n const orphanSpecsDirs: string[] = [];\n\n for (const subdir of listSubdirs(specsDir)) {\n let matchedSlug: string | null = null;\n\n if (briefSlugs.includes(subdir)) {\n matchedSlug = subdir;\n } else {\n // Look for a brief slug whose date-stripped form matches this subdir\n for (const slug of briefSlugs) {\n if (slugWithoutDate(slug) === subdir) {\n matchedSlug = slug;\n break;\n }\n }\n }\n\n if (matchedSlug) {\n const move: Move = {\n from: join(specsDir, subdir),\n to: join(projectDir, 'docs', 'features', matchedSlug, 'specs'),\n kind: 'specs-dir',\n };\n if (existsSync(move.to)) skipped.push(move);\n else moves.push(move);\n } else {\n // No matching brief slug → this is an area-level (bugfix) spec dir.\n // Reclassify it as a forced move into docs/bugfixes/<area>/.\n orphanSpecsDirs.push(subdir);\n const move: Move = {\n from: join(specsDir, subdir),\n to: join(projectDir, 'docs', 'bugfixes', subdir),\n kind: 'bugfix-dir',\n };\n if (existsSync(move.to)) skipped.push(move);\n else moves.push(move);\n }\n }\n\n const plan: MigrationPlan = {\n moves,\n slugs: Array.from(slugSet),\n orphans: { specsDirs: orphanSpecsDirs },\n };\n if (skipped.length > 0) plan.skipped = skipped;\n return plan;\n}\n\nfunction moveFsItem(from: string, to: string): void {\n mkdirSync(join(to, '..'), { recursive: true });\n try {\n renameSync(from, to);\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code;\n if (code === 'EXDEV') {\n cpSync(from, to, { recursive: true });\n rmSync(from, { recursive: true, force: true });\n } else {\n throw err;\n }\n }\n}\n\nexport function applyMigration(plan: MigrationPlan): MigrationResult {\n let applied = 0;\n let skipped = (plan.skipped?.length) ?? 0;\n const errors: Array<{ move: Move; error: string }> = [];\n\n for (const move of plan.moves) {\n if (existsSync(move.to)) {\n skipped++;\n continue;\n }\n if (!existsSync(move.from)) {\n errors.push({ move, error: `Source missing: ${move.from}` });\n continue;\n }\n try {\n moveFsItem(move.from, move.to);\n applied++;\n } catch (err) {\n errors.push({ move, error: (err as Error).message });\n }\n }\n\n return { applied, skipped, errors };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAAA,aAAY,cAAc,eAAe,aAAAC,YAAW,UAAAC,SAAQ,WAAwB,iBAAiB;AAC9G,SAAS,QAAAC,OAAM,SAAS,eAAe;AACvC,SAAS,uBAAuB;AAChC,SAAS,cAAc,iBAAiB;;;ACCxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,YAAY;AAuBrB,IAAM,iBAAiB;AAEvB,SAAS,WAAW,UAA0B;AAC5C,SAAO,SAAS,QAAQ,SAAS,EAAE;AACrC;AAEA,SAAS,gBAAgB,MAA6B;AACpD,QAAM,IAAI,KAAK,MAAM,cAAc;AACnC,SAAO,IAAI,EAA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,KAAK,MAAM;AAC9C,MAAI,WAAW,EAAG,OAAM,KAAK,GAAG,QAAQ,qBAAqB;AAC7D,UAAQ,IAAI;AAAA,oBAAuB,MAAM,KAAK,IAAI,CAAC,GAAG;AACxD;","names":["existsSync","mkdirSync","rmSync","join","join","existsSync","rmSync","resolve","pkgVersion","mkdirSync"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joycraft",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "description": "CLI + Claude Code plugin that scaffolds and upgrades AI development harnesses",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/gitattributes.ts
4
- import { existsSync, readFileSync, writeFileSync } from "fs";
5
- import { join } from "path";
6
- var GITATTRIBUTES_COMMENT = "# Joycraft: collapse generated workflow docs in PR review (expand with one click)";
7
- var GITATTRIBUTES_ENTRIES = [
8
- "docs/features/** linguist-generated=true",
9
- "docs/bugfixes/** linguist-generated=true",
10
- "docs/discoveries/** linguist-generated=true",
11
- "docs/templates/** linguist-generated=true"
12
- ];
13
- function applyGitattributes(targetDir) {
14
- const gitattributesPath = join(targetDir, ".gitattributes");
15
- const current = existsSync(gitattributesPath) ? readFileSync(gitattributesPath, "utf-8") : "";
16
- const present = new Set(current.split("\n").map((l) => l.trim()));
17
- const missing = GITATTRIBUTES_ENTRIES.filter((e) => !present.has(e.trim()));
18
- if (missing.length === 0) return [];
19
- const lines = present.has(GITATTRIBUTES_COMMENT) ? missing : [GITATTRIBUTES_COMMENT, ...missing];
20
- const sep = current.length > 0 && !current.endsWith("\n") ? "\n" : "";
21
- writeFileSync(gitattributesPath, current + sep + lines.join("\n") + "\n", "utf-8");
22
- return missing;
23
- }
24
-
25
- // src/package-version.ts
26
- import { readFileSync as readFileSync2 } from "fs";
27
- import { fileURLToPath } from "url";
28
- import { dirname, join as join2 } from "path";
29
- var __dirname = dirname(fileURLToPath(import.meta.url));
30
- function getPackageVersion() {
31
- const pkgPath = join2(__dirname, "..", "package.json");
32
- const raw = readFileSync2(pkgPath, "utf-8");
33
- const pkg = JSON.parse(raw);
34
- if (typeof pkg.version !== "string" || pkg.version.length === 0) {
35
- throw new Error(`Joycraft package.json at ${pkgPath} is missing a version field`);
36
- }
37
- return pkg.version;
38
- }
39
-
40
- export {
41
- applyGitattributes,
42
- getPackageVersion
43
- };
44
- //# sourceMappingURL=chunk-EBOHEHSG.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/gitattributes.ts","../src/package-version.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/**\n * Paths Joycraft marks `linguist-generated=true` so GitHub collapses them in\n * PR review and drops them from diff stats. These are workflow exhaust —\n * briefs, specs, discoveries, installed templates — historical artifacts by\n * the time a PR is opened (the spec was reviewed conversationally when it was\n * written). Reviewers can still expand any of them with one click.\n *\n * Deliberately NOT listed (durable knowledge that deserves review eyes):\n * CLAUDE.md, AGENTS.md, docs/context/ (steers every future agent run), and\n * docs/backlog/ (human-authored idea capture).\n */\nexport const GITATTRIBUTES_COMMENT =\n '# Joycraft: collapse generated workflow docs in PR review (expand with one click)';\n\nexport const GITATTRIBUTES_ENTRIES = [\n 'docs/features/** linguist-generated=true',\n 'docs/bugfixes/** linguist-generated=true',\n 'docs/discoveries/** linguist-generated=true',\n 'docs/templates/** linguist-generated=true',\n];\n\n/**\n * Append-only, create-if-absent, idempotent .gitattributes writer — the same\n * contract as ensureGitignoreEntries: never rewrites, reorders, or removes\n * existing lines; only appends entries not already present (matched exactly,\n * after trimming). The comment header is only added when at least one entry\n * is missing, so a fully-applied file is never touched. Returns the entries\n * actually added (empty when everything was already present).\n */\nexport function applyGitattributes(targetDir: string): string[] {\n const gitattributesPath = join(targetDir, '.gitattributes');\n const current = existsSync(gitattributesPath) ? readFileSync(gitattributesPath, 'utf-8') : '';\n const present = new Set(current.split('\\n').map((l) => l.trim()));\n const missing = GITATTRIBUTES_ENTRIES.filter((e) => !present.has(e.trim()));\n if (missing.length === 0) return [];\n\n const lines = present.has(GITATTRIBUTES_COMMENT) ? missing : [GITATTRIBUTES_COMMENT, ...missing];\n const sep = current.length > 0 && !current.endsWith('\\n') ? '\\n' : '';\n writeFileSync(gitattributesPath, current + sep + lines.join('\\n') + '\\n', 'utf-8');\n return missing;\n}\n","import { readFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport { dirname, join } from 'node:path';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport function getPackageVersion(): string {\n const pkgPath = join(__dirname, '..', 'package.json');\n const raw = readFileSync(pkgPath, 'utf-8');\n const pkg = JSON.parse(raw) as { version?: unknown };\n if (typeof pkg.version !== 'string' || pkg.version.length === 0) {\n throw new Error(`Joycraft package.json at ${pkgPath} is missing a version field`);\n }\n return pkg.version;\n}\n"],"mappings":";;;AAAA,SAAS,YAAY,cAAc,qBAAqB;AACxD,SAAS,YAAY;AAad,IAAM,wBACX;AAEK,IAAM,wBAAwB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAUO,SAAS,mBAAmB,WAA6B;AAC9D,QAAM,oBAAoB,KAAK,WAAW,gBAAgB;AAC1D,QAAM,UAAU,WAAW,iBAAiB,IAAI,aAAa,mBAAmB,OAAO,IAAI;AAC3F,QAAM,UAAU,IAAI,IAAI,QAAQ,MAAM,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAChE,QAAM,UAAU,sBAAsB,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1E,MAAI,QAAQ,WAAW,EAAG,QAAO,CAAC;AAElC,QAAM,QAAQ,QAAQ,IAAI,qBAAqB,IAAI,UAAU,CAAC,uBAAuB,GAAG,OAAO;AAC/F,QAAM,MAAM,QAAQ,SAAS,KAAK,CAAC,QAAQ,SAAS,IAAI,IAAI,OAAO;AACnE,gBA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