@adpharm/bit
v0.1.7
Published
A lightweight CLI for pulling shared files from a bit-compatible host directly into your project.
Readme
@adpharm/bit
A lightweight CLI for pulling shared files from a bit-compatible host directly into your project.
Installation
npm install -g @adpharm/bit
# or
bunx @adpharm/bit@latest import ...Usage
bit import <slug> --host <url> --to <path>
bit status <slug> --host <url> --path <file>bit import
Pull a file from the registry into your project.
| | Description |
|---|---|
| <slug> | The file's unique slug — <project>/<file> (as shown in the web app) |
| --host <url> | Base URL of the host (e.g. https://yourapp.com) |
| --to <path> | Output destination — a file path or a directory |
--to behaviour
| Value | Result |
|---|---|
| ./src/components/ | Writes to ./src/components/<filename> using the file's original name |
| ./src/components/MyButton.tsx | Writes directly to that path |
Examples
# Write to a directory — filename comes from the registry
bit import my-project/ui-button --host https://yourapp.com --to ./src/components/
# Write to an explicit file path
bit import my-project/ui-button --host https://yourapp.com --to ./src/components/Button.tsxbit status
Check whether your local copy of a file is in sync with the registry. Prints a coloured unified diff if it differs, or a confirmation message if it matches. Exits 1 when out of sync (useful in CI).
| | Description |
|---|---|
| <slug> | The file's unique slug — <project>/<file> (as shown in the web app) |
| --host <url> | Base URL of the host (e.g. https://yourapp.com) |
| --path <file\|dir> | Local file or directory to compare against the registry |
| --check | Silent mode — no output, just exit 0 (in sync) or 1 (out of sync) |
--path behaviour
| Value | Resolves to |
|---|---|
| ./src/components/ | ./src/components/<filename> using the file's original name |
| ./src/components/MyButton.tsx | That exact path |
Examples
# Compare by directory — filename comes from the registry
bit status my-project/ui-button --host https://yourapp.com --path ./src/components/
# Compare an explicit file path
bit status my-project/ui-button --host https://yourapp.com --path ./src/components/Button.tsx
# Silent check — useful for programmatic/typechecker use
bit status my-project/ui-button --host https://yourapp.com --path ./src/components/ --checkAPI
The CLI expects the host to expose:
GET /api/bit/:projectSlug/:fileSlugResponse shape:
{
"name": "Button.tsx",
"slug": "my-project/ui-button",
"content": "..."
}Returns 404 if the slug doesn't exist, 429 if rate-limited.
