@fire-shield/cli
v2.2.1
Published
Fire Shield RBAC CLI tool for validation and permission management
Downloads
197
Maintainers
Readme
o# @fire-shield/cli
Command-line interface for Fire Shield RBAC.
Installation
# npm
npm install -g @fire-shield/cli
# yarn
yarn global add @fire-shield/cli
# pnpm
pnpm add -g @fire-shield/cliUsage
Validate Configuration
Validate an RBAC configuration file:
fire-shield validate ./fire-shield.config.jsonWith options:
fire-shield validate ./config.json --strict --verboseOptions:
-s, --strict- Enable strict mode validation-v, --verbose- Show detailed validation output
Check Permission
Check if a user has a specific permission:
fire-shield check ./config.json \
--user john123 \
--roles admin editor \
--permission user:writeOptions:
-u, --user <userId>- User ID to check-r, --roles <roles...>- User roles (space-separated)-p, --permission <permission>- Permission to check-v, --verbose- Show detailed check output
CLI Information
Display CLI information:
fire-shield infoInitialize Configuration (Coming Soon)
Initialize a new Fire Shield configuration:
fire-shield initExamples
Basic Validation
fire-shield validate ./rbac-config.jsonOutput:
🔍 Validating RBAC configuration...
✓ Configuration is valid
Validated in 12msVerbose Validation
fire-shield validate ./rbac-config.json --verboseOutput:
🔍 Validating RBAC configuration...
File: /path/to/rbac-config.json
Strict mode: disabled
✓ Configuration is valid
Configuration details:
• Name: my-rbac
• Version: 1.0.0
• Permissions: 10
• Roles: 4
Permissions:
• user:read [bit: 1]
• user:write [bit: 2]
• user:delete [bit: 4]
...
Roles:
• viewer [level: 1]
Permissions: user:read, post:read
• editor [level: 5]
Permissions: user:read, user:write, post:read, post:write
...
Validated in 15msPermission Check
fire-shield check ./config.json \
--user alice \
--roles editor \
--permission user:write \
--verboseOutput:
🔍 Checking permission...
Config file: /path/to/config.json
User: alice
Roles: editor
Permission: user:write
✓ User has permission "user:write"
User: alice
Roles: editor
Permission: user:write
Result: ALLOWED
Granted by: editorConfiguration File Format
Fire Shield CLI expects a JSON configuration file with this structure:
{
"name": "my-rbac",
"version": "1.0.0",
"permissions": [
{ "name": "user:read", "bit": 1 },
{ "name": "user:write", "bit": 2 },
{ "name": "user:delete", "bit": 4 }
],
"roles": [
{
"name": "viewer",
"permissions": ["user:read"],
"level": 1
},
{
"name": "editor",
"permissions": ["user:read", "user:write"],
"level": 5
}
]
}Exit Codes
0- Success1- Validation/check failed or error occurred
License
DIB © khapu2906
