Skip to content

dgadd init

Initialize installer configuration before adding registry items.

Usage

bash
pnpm exec dgadd init
Info:

npm packages: @diffgazer/add is on npm. pnpm add -D @diffgazer/add puts dgadd on pnpm exec, and npx @diffgazer/add <command> runs it without the install. Components also install without dgadd from the hosted registry: npx shadcn add https://r.b4r7.dev/r/ui/<item>.json.

What it does

  1. Detects your project configuration:

    • Package manager
    • Tailwind CSS version
    • TypeScript path aliases
    • Source directory (src/ or root)
  2. Creates diffgazer.json with aliases for components, hooks, and utilities.

  3. Creates install directories:

    • src/components/ui/ for UI components
    • src/hooks/ for copied hooks
    • src/lib/ for shared utilities
  4. Installs required dependencies.

  5. Copies src/styles/theme.css and src/styles/styles.css.

It does not edit tsconfig.json, Vite, Next, or your app CSS entrypoint. Configure a TypeScript or Vite source alias such as @/* or ~/* in the app before running init, or pass --allow-missing-alias only when your tooling already resolves source aliases.

Options

FlagDescriptionDefault
--cwd <path>Working directory.
--components-dir <path>Component install directorysrc/components/ui
--allow-missing-aliasContinue when no source alias is detectedfalse
--reset-manifestRecovery only: discard the installed-component ownership ledger, orphaning previously installed filesfalse
--forceOverwrite existing configurationfalse
--dry-runPreview initialization without writing filesfalse
--skip-installWrite files without installing npm dependenciesfalse
--yesSkip confirmation promptsfalse

--reset-manifest is a destructive recovery operation. It removes the ownership ledger from diffgazer.json without deleting previously installed files, so subsequent dgadd diff and dgadd remove commands can no longer track those orphaned files.

Example

bash
$ pnpm exec dgadd init

  Creating diffgazer.json
  Creating src/components/ui/
  Creating src/hooks/
  Creating src/lib/utils.ts
  Copying src/styles/theme.css
  Copying src/styles/styles.css

  Done. Add items with: pnpm exec dgadd add ui/button