slicejs-cli
v4.1.0
Published
Command client for developing web applications with Slice.js framework
Maintainers
Readme
About this repository
This repository contains the Slice.js CLI (slicejs-cli), the command-line tool for developing applications with the Slice.js framework. It includes a development server, build system, component management, and more.
Prerequisites
- Node.js >= 20
- npm or pnpm
Local development
Clone the repository
git clone https://github.com/VKneider/slicejs-cli.git cd slicejs-cliInstall dependencies (the repo pins pnpm via the
packageManagerfield)pnpm install --frozen-lockfileTest changes locally
node client.js --helpTo bypass delegation to a global installation:
SLICE_NO_LOCAL_DELEGATION=1 node client.js --helpRun tests
npm test
Installation (for users)
For a new project you don't install anything manually — slice init (see Quick
start below) installs the CLI locally in the project it creates.
Local in an existing project (Recommended)
npm install slicejs-cli --save-dev # or: pnpm add -D slicejs-cliGlobal launcher (optional)
npm install -g slicejs-cli # or: pnpm add -g slicejs-cliThe launcher delegates to the nearest project-local node_modules/slicejs-cli,
so each project keeps its pinned CLI version.
Main commands
Inside initialized projects, prefer package scripts (pnpm run ..., npm run ...)
over direct binary calls.
Common script workflow:
pnpm run dev
pnpm run build
pnpm run start
pnpm run browse
pnpm run get -- Button
pnpm run syncAlternative with local devDependency resolution:
pnpm exec slice devIf slicejs-cli is installed globally, slice can be executed directly from PATH.
For pnpm v10+, if build scripts are restricted, configure allowBuilds in
pnpm-workspace.yaml:
allowBuilds:
slicejs-cli: trueslice init --pm pnpm now writes this automatically.
| Command | Description |
|---------|-------------|
| slice init | Initialize a Slice.js project |
| slice dev | Development server with hot reload |
| slice build | Build for production |
| slice start | Serve production build |
| slice get <component> | Install components from the official registry |
| slice browse | Browse available components |
| slice component create | Create a local component |
| slice skill add | Install the Slice.js Claude Code skill into .claude/skills/ |
| slice doctor | Run project diagnostics |
| slice postinstall | Configure npm scripts (alternative to postinstall) |
Claude Code skill (slice skill)
Installs the slice-js-developer skill — the guide Claude Code uses to build Slice.js
apps correctly — into your project by fetching it from the official docs repo
(VKneider/slicejs_docs), which is the single source of truth. A manifest.json
there pins the skill version, its framework-compatibility range, and the exact file
list, so the install never drifts.
| Command | Description |
|---------|-------------|
| slice skill add | Install the skill (prompts before overwriting an existing copy; --force skips the prompt) |
| slice skill update | Update the installed skill to the latest compatible version |
| slice skill status | Show the installed version vs. the latest available |
The skill is written to .claude/skills/slice-js-developer/ at the project
root — inside Claude Code's standard skills path, not a loose folder next to src/:
my-app/
├── .claude/skills/slice-js-developer/ ← installed here
├── api/
├── src/ ← untouched
└── package.jsonRun
slice skillcommands from the project root. All three subcommands (add,update,status) resolve the target fromINIT_CWD/ the current working directory, so running from a subfolder can place.claude/somewhere unexpected. The install path itself is configurable via theinstallPathfield in the docs repo'smanifest.json. After installing, reload Claude Code to pick up the skill.
Postinstall Scripts
When you install slicejs-cli, the postinstall script automatically configures slice:* npm scripts in your package.json:
{
"scripts": {
"slice:init": "node ./node_modules/slicejs-cli/client.js init",
"slice:dev": "node ./node_modules/slicejs-cli/client.js dev",
"slice:build": "node ./node_modules/slicejs-cli/client.js build",
"slice:start": "node ./node_modules/slicejs-cli/client.js start",
"slice:create": "node ./node_modules/slicejs-cli/client.js component create",
"slice:list": "node ./node_modules/slicejs-cli/client.js component list",
"slice:delete": "node ./node_modules/slicejs-cli/client.js component delete",
"slice:get": "node ./node_modules/slicejs-cli/client.js get",
"slice:browse": "node ./node_modules/slicejs-cli/client.js browse",
"slice:sync": "node ./node_modules/slicejs-cli/client.js sync",
"slice:doctor": "node ./node_modules/slicejs-cli/client.js doctor",
"slice:version": "node ./node_modules/slicejs-cli/client.js version",
"slice:help": "node ./node_modules/slicejs-cli/client.js --help",
"slice:types": "node ./node_modules/slicejs-cli/client.js types generate"
}
}If you installed with --ignore-scripts, run manually:
npx slicejs-cli postinstallQuick start
slice init creates the project folder itself — no mkdir or npm init needed.
Everything (package.json, node_modules, lockfile, src/, api/) lives inside the new folder.
# With npm
npx slicejs-cli init
cd my-app
npm run dev# With pnpm
pnpm dlx slicejs-cli init
cd my-app
pnpm run devNon-interactive (for scripts/CI):
npx slicejs-cli init -y my-app --pm pnpminit pins the chosen package manager in the packageManager field, installs
slicejs-web-framework as a dependency and slicejs-cli as a devDependency of
the new project. Versions are never hard-pinned at install time, so hardened pnpm
setups (minimumReleaseAge quarantine, ignore-scripts) work out of the box.
Tests
The CLI uses Node.js native test runner:
# All tests
node --test
# Specific tests
node --test tests/postinstall-command.test.jsProject structure
slicejs-cli/
├── client.js # CLI entry point
├── commands/ # Command implementations
│ ├── init/ # slice init
│ ├── build/ # slice build
│ ├── startServer/ # slice dev / slice start
│ ├── createComponent/ # slice component create
│ └── utils/ # PathHelper, VersionChecker, etc.
├── tests/ # Tests
└── post.js # Postinstall hookLocal delegation
When the slice command is globally available, it automatically delegates to the project-local CLI (node_modules/slicejs-cli). To disable:
SLICE_NO_LOCAL_DELEGATION=1 slice versionContributing
We welcome contributions. Please review the guidelines in CODE_OF_CONDUCT.md before submitting changes.
License
Distributed under the ISC License. See LICENSE for more information.
Links
- 📘 Documentation: https://slice-js-docs.vercel.app/Documentation/CLI
- 🐙 GitHub: https://github.com/VKneider/slicejs-cli
- 📦 npm: https://www.npmjs.com/package/slicejs-cli
