@confik/cli
v1.0.10
Published
Stage .config files into the project root while running a command
Downloads
802
Readme
confik
confik is a small CLI that temporarily stages files from .config/ into the project root while a command runs, then cleans them up afterward.
Install
npm install -D @confik/cli
# or
yarn add -D @confik/cli
# or
pnpm add -D @confik/cli
# or
bun add -D @confik/cliUsage
confik
confik yarn dev
confik -- vite build
confik --dry-run npm run test
confik --cleanBehavior
- Looks for
.config/in the current working directory. - Copies eligible files into the project root before running your command.
- If no command is provided, enters standalone mode and keeps files staged until interrupted (
Ctrl+C). - Never overwrites existing root files (they are skipped).
- Removes staged files on exit (including
SIGINT,SIGTERM,SIGHUP). - Adds a temporary block to
.git/info/excludeso staged files are not accidentally committed. - Uses a lock file in
.config/to serialize concurrent runs in the same directory.
Config
Create .config/confik.json:
{
"$schema": "https://raw.githubusercontent.com/l-mbert/confik/refs/heads/main/confik.schema.json",
"exclude": ["**/*.local", "private/**"],
"registry": true,
"registryOverride": ["vite.config.ts"],
"gitignore": true,
"vscodeExclude": false
}exclude: glob patterns (relative to.config/) to skip.registry: enable the built-in registry skip list.registryOverride: force-copy patterns that would otherwise be skipped by the registry.gitignore: enable temporary.git/info/excludehandling (defaulttrue).vscodeExclude: temporarily add staged files to.vscode/settings.jsonfiles.exclude(defaultfalse). JSONC is supported and comments are preserved.
Registry
The built-in registry lives in registry.json and contains filenames that are considered safe to leave in .config/ without copying. You can disable it with --no-registry or override with registryOverride.
Cleanup
If the process crashes, you can run:
confik --cleanThis removes any leftover staged files from .config/.confik-manifest.json and clears any confik blocks in .git/info/exclude.
Build (local dev)
go build -o dist/confikBuild platform packages (for publishing)
pnpm run build:binariesThis produces native binaries in packages/ for darwin/arm64, darwin/x64, linux/x64, and win32/x64.
