@reditui/cli
v0.1.1
Published
Local development CLI for REditUI - receives generated source code from Redit
Readme
@reditui/cli
Local development CLI for REditUI - receives generated source code sent from Redit (レヂツイ).
Installation
You can use the CLI without installation using npx:
npx @reditui/cli drop-inboxOr install globally:
npm install -g @reditui/cli
reditui drop-inboxCommands
drop-inbox
Start the DropInbox service to receive generated source code.
npx @reditui/cli drop-inboxThis will start an Express-based API server on port 4545 (by default) that listens for incoming source code drops.
Options:
--check: Check configuration without starting the server
npx @reditui/cli drop-inbox --checkConfiguration
Create a drop-inbox.config.json file in your project root:
{
"port": 4545,
"targetDir": "./src/inbox",
"maxPayloadMB": 50,
"auth": {
"enabled": false,
"token": ""
},
"cors": {
"enabled": true,
"origin": true,
"credentials": false
}
}Configuration Options
- port (number): Port number for the API server (default: 4545)
- targetDir (string): Directory where received files will be saved (default: "./src/inbox")
- maxPayloadMB (number): Maximum payload size in MB (default: 50)
- auth (object): Authentication configuration
- enabled (boolean): Enable bearer token authentication
- token (string): Bearer token for authentication
- cors (object): CORS (Cross-Origin Resource Sharing) configuration
- enabled (boolean): Enable CORS (default: true)
- origin (string | string[] | boolean): Allowed origins. Can be:
true: Allow all origins (default, most permissive)false: Disable CORS"https://example.com": Allow a specific origin["https://example.com", "https://another.com"]: Allow multiple specific origins
- credentials (boolean): Allow credentials (cookies, authorization headers) (default: false)
- postDropHook (string): Path to a module that exports a post-drop hook function
Environment Variables
You can override configuration using environment variables:
DROP_INBOX_PORT: Override port numberDROP_INBOX_TARGET_DIR: Override target directoryDROP_INBOX_MAX_PAYLOAD_MB: Override max payload sizeDROP_INBOX_AUTH_ENABLED: Enable/disable authentication (true/false)DROP_INBOX_AUTH_TOKEN: Override authentication tokenDROP_INBOX_CORS_ENABLED: Enable/disable CORS (true/false)DROP_INBOX_CORS_ORIGIN: Override allowed origins (use "true", "false", a URL, or comma-separated URLs)DROP_INBOX_CORS_CREDENTIALS: Allow credentials (true/false)
API Endpoints
POST /drop
Receive and extract a ZIP file containing source code.
Request Body:
{
"zipBase64": "base64-encoded-zip-content",
"clearBeforeDrop": true,
"subDir": "optional/subdirectory",
"dryRun": false,
"options": ["optional", "array", "of", "strings"]
}Response:
{
"requestId": "uuid",
"droppedPath": "path/to/target",
"files": 10,
"bytes": 12345,
"cleared": true,
"dryRun": false,
"tookMs": 123,
"hookExecuted": false
}GET /health
Check service health and configuration.
Response:
{
"status": "ok",
"port": 4545,
"targetDir": "./src/inbox"
}Post-Drop Hook
You can configure a post-drop hook to execute custom logic after files are dropped:
- Create a JavaScript/TypeScript module that exports a
postDropHookfunction:
// hooks/post-drop.js
export async function postDropHook(options) {
console.log('Files dropped with options:', options);
// Your custom logic here
}- Add the hook path to your configuration:
{
"postDropHook": "./hooks/post-drop.js"
}License
MIT
Publishing to npm
This package is published to npm registry as a scoped package @reditui/cli.
📖 詳細な日本語ガイド: PUBLISHING.md をご覧ください
Prerequisites
- npm account with publish permissions for
@redituiscope NPM_TOKENsecret configured in GitHub repository settings
Publishing Process
The package is automatically published to npm when a new tag is pushed:
# Update version in packages/cli/package.json first
cd packages/cli
npm version patch # or minor, major
# Create and push a git tag
git tag cli-v0.1.1
git push origin cli-v0.1.1The GitHub Actions workflow .github/workflows/publish-cli.yml will automatically:
- Build the package
- Publish to npm registry with provenance
Manual Publishing (if needed)
cd packages/cli
npm run build
npm publish --access publicNote: Make sure you're logged in with npm login first.
