Skip to content

dgadd init

Initialize installer configuration before adding registry items.

Usage

bash
pnpm exec dgadd init
Info:

Before publication: Diffgazer packages are not yet published to npm, so there is no dgadd bin until you install one. Follow the canonical Copy-first mode procedure to build and pack @diffgazer/add, then install that packed tarball in the target app. The target-app install is what puts dgadd on pnpm exec.

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