Official CLI for Tensorify.io - Build, test, and deploy machine learning plugins
npm install @tensorify.io/cli> Official CLI for Tensorify.io - Build, test, and deploy machine learning plugins
The Tensorify CLI provides powerful tools for developing, validating, and publishing machine learning plugins to the Tensorify ecosystem.
``bashInstall globally
npm install -g @tensorify.io/cli
$3
`bash
Login to your Tensorify account
tensorify loginCheck your authentication status
tensorify whoamiLogout when needed
tensorify logout
`$3
`bash
Validate your plugin structure
tensorify validatePublish your plugin
tensorify publish --access=public
`š Commands
$3
Authenticate with Tensorify.io using OAuth2 flow.
`bash
tensorify login [options]
`Features:
- š Secure OAuth2 authentication
- š Opens browser for login
- š¾ Stores token securely in system keyring
- ā
Automatic token validation
Options:
-
--port - Custom port for OAuth callback (default: 3000)
- --timeout - Authentication timeout (default: 300)Examples:
`bash
Standard login
tensorify loginLogin with custom port
tensorify login --port 8080Login with timeout
tensorify login --timeout 600
`$3
Display current authentication status and user information.
`bash
tensorify whoami [options]
`Features:
- š¤ Shows logged-in user details
- š Displays token status
- ā° Shows token expiration
- š User account information
Options:
-
--json - Output in JSON format
- --token - Show token detailsExamples:
`bash
Basic user info
tensorify whoamiJSON output
tensorify whoami --jsonInclude token details
tensorify whoami --token
`$3
Clear authentication tokens and logout.
`bash
tensorify logout [options]
`Features:
- šļø Removes stored tokens
- š Secure cleanup
- ā
Confirmation prompts
Options:
-
--force - Skip confirmation promptExamples:
`bash
Standard logout
tensorify logoutForce logout without confirmation
tensorify logout --force
`$3
Validate plugin structure and configuration using SDK rules.
`bash
tensorify validate [directory] [options]
`Features:
- š Complete plugin validation
- š File structure checks
- š Schema validation
- šļø Class interface validation
- š Detailed error reporting
Arguments:
-
directory - Plugin directory path (default: current directory)Options:
-
--verbose - Show detailed validation output
- --sdk-version - Check against specific SDK version
- --json - Output results in JSON format
- --fix - Attempt to fix common issuesValidation Checks:
- ā
Required files exist (
index.ts, manifest.json, icon.svg, package.json)
- ā
manifest.json schema validation
- ā
package.json structure validation
- ā
Class implements INode interface
- ā
Class name matches manifest entrypointClassName
- ā
SDK version compatibility
- ā
Repository URL for public pluginsExamples:
`bash
Validate current directory
tensorify validateValidate specific directory
tensorify validate ./my-pluginVerbose validation output
tensorify validate --verboseJSON output for CI/CD
tensorify validate --jsonCheck against specific SDK version
tensorify validate --sdk-version 0.0.1
`$3
Publish plugin to Tensorify registry with comprehensive validation and upload.
`bash
tensorify publish [options]
`Features:
- š Pre-publish validation
- šļø Automatic build and bundling
- ā
Version conflict checking
- š¤ Secure file uploads
- š Registry notifications
- š Complete publishing pipeline
Options:
-
--access - Access level: public or private (default: public)
- --directory - Plugin directory (default: current directory)
- --backend - Backend API URL (default: https://backend.tensorify.io)
- --frontend - Frontend API URL (default: https://plugins.tensorify.io)
- --dry-run - Validate and build without publishing
- --skip-build - Skip build step (use existing dist/)
- --force - Force publish (skip confirmations)
- --offline - Offline development mode (implies --dev): save artifacts to local offline-plugins/ dir and notify backend without S3 uploadPublishing Process:
1. š Authentication Check
- Verifies valid login token
- Checks token expiration
2. š Plugin Validation
- Runs complete SDK validation
- Checks file structure
- Validates schemas
3. š Access Level Validation
- Ensures
package.json private flag matches --access
- Validates repository URL for public plugins
- Checks access consistency with previous versions4. ā
Version Conflict Check
- Queries registry for existing versions
- Prevents duplicate version publishing
- Validates access level consistency
5. šļø Build and Bundle
- Runs TypeScript compilation (
pnpm run build)
- Creates optimized bundle with ESBuild
- Generates production-ready artifacts6. š¤ File Upload
- Uploads
bundle.js, manifest.json, icon.svg (online)
- OR saves them to local offline-plugins/@ (offline)
- Provides upload/save progress7. š Registry Notification
- Sends webhook to registry
- Updates plugin database
- Triggers indexing
Examples:
`bash
Publish public plugin
tensorify publish --access=publicPublish private plugin
tensorify publish --access=privateDry run (validate without publishing)
tensorify publish --dry-runPublish from specific directory
tensorify publish --directory ./my-pluginForce publish without confirmations
tensorify publish --forceCustom backend/frontend URLs
tensorify publish --backend https://api.custom.com --frontend https://registry.custom.comOffline development (no S3 upload, implies --dev)
tensorify publish --offline
`š§ Configuration
$3
`bash
Backend API URL
export TENSORIFY_BACKEND_URL=https://backend.tensorify.ioFrontend registry URL
export TENSORIFY_FRONTEND_URL=https://plugins.tensorify.ioOAuth configuration
export TENSORIFY_CLIENT_ID=your_client_id
export TENSORIFY_CLIENT_SECRET=your_client_secretCLI configuration
export TENSORIFY_DEFAULT_ACCESS=public
export TENSORIFY_CLI_LOG_LEVEL=info
`$3
Create
.tensorifyrc.json in your project or home directory:`json
{
"backend": "https://backend.tensorify.io",
"frontend": "https://plugins.tensorify.io",
"defaultAccess": "public",
"autoValidate": true,
"buildTimeout": 300,
"uploadTimeout": 600
}
`š Authentication
$3
The CLI uses secure OAuth2 authentication:
1. Login Command: Opens browser to Tensorify.io
2. User Authorization: User grants CLI access
3. Token Exchange: CLI receives secure access token
4. Token Storage: Token stored in system keyring
5. Automatic Refresh: Tokens refreshed as needed
$3
Tokens are securely stored using:
- macOS: Keychain
- Windows: Credential Manager
- Linux: Secret Service (libsecret)
$3
- š Tokens encrypted at rest
- ā° Automatic expiration
- š Refresh token rotation
- š« No tokens in environment variables
š¦ Plugin Requirements
$3
`
my-plugin/
āāā package.json # NPM package configuration
āāā manifest.json # Plugin metadata
āāā icon.svg # Plugin icon (SVG format)
āāā index.ts # Main plugin class
āāā tsconfig.json # TypeScript configuration
āāā dist/ # Build output directory
`$3
`json
{
"name": "@namespace/plugin-name",
"version": "1.0.0",
"main": "dist/index.js",
"scripts": {
"build": "tsc"
},
"tensorify-settings": {
"sdk-version": "0.0.1"
},
"keywords": ["tensorify", "plugin"],
"author": "Your Name",
"repository": {
"type": "git",
"url": "https://github.com/username/plugin-name"
},
"private": false
}
`$3
`json
{
"name": "@namespace/plugin-name",
"version": "1.0.0",
"description": "Plugin description",
"author": "Your Name",
"main": "dist/index.js",
"entrypointClassName": "MyPluginClass",
"keywords": ["tensorify", "plugin"],
"scripts": {
"build": "tsc"
},
"tensorifySettings": {
"sdkVersion": "0.0.1"
}
}
`$3
`typescript
import { INode, NodeType, LayerSettings } from "@tensorify.io/sdk";export default class MyPluginClass implements INode {
readonly name = "My Plugin";
readonly nodeType = NodeType.CUSTOM;
readonly inputLines = 1;
readonly outputLinesCount = 1;
readonly secondaryInputLinesCount = 0;
readonly translationTemplate = "my_template";
readonly settings: LayerSettings = {};
getTranslationCode(settings: LayerSettings): string {
return "# Generated code";
}
validateSettings(settings: LayerSettings): boolean {
return true;
}
getDependencies(): string[] {
return ["numpy", "torch"];
}
getImports(): string[] {
return ["import torch"];
}
}
`š CI/CD Integration
$3
`yaml
name: Publish Pluginon:
push:
tags: ["v*"]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install dependencies
run: npm install
- name: Install Tensorify CLI
run: npm install -g @tensorify.io/cli
- name: Authenticate
run: tensorify login --token ${{ secrets.TENSORIFY_TOKEN }}
- name: Validate plugin
run: tensorify validate --json
- name: Publish plugin
run: tensorify publish --access=public
`$3
`yaml
stages:
- validate
- publishvalidate:
stage: validate
script:
- npm install -g @tensorify.io/cli
- tensorify validate --json
only:
- merge_requests
publish:
stage: publish
script:
- npm install -g @tensorify.io/cli
- echo $TENSORIFY_TOKEN | tensorify login --stdin
- tensorify publish --access=public
only:
- tags
`š Troubleshooting
$3
#### Authentication Problems
ā "Not authenticated"
`bash
Solution: Login first
tensorify loginCheck authentication status
tensorify whoami
`ā "Token expired"
`bash
Solution: Re-login
tensorify logout
tensorify login
`#### Validation Errors
ā "Plugin validation failed"
`bash
Get detailed validation info
tensorify validate --verboseCommon fixes:
1. Check file names (index.ts, manifest.json, icon.svg)
2. Verify class name matches manifest entrypointClassName
3. Ensure class implements INode interface
4. Check SDK version compatibility
`ā "SDK version mismatch"
`json
// Update package.json
{
"tensorify-settings": {
"sdk-version": "0.0.1" // Use current SDK version
}
}
`ā "Missing repository URL"
`json
// For public plugins, add repository
{
"repository": {
"type": "git",
"url": "https://github.com/username/plugin-name"
},
"private": false
}
`#### Publishing Problems
ā "Version already exists"
`bash
Solution: Increment version in package.json and manifest.json
Cannot republish existing versions
`ā "Access level mismatch"
`bash
Solution: Use consistent access level
Cannot change from public to private or vice versa
`ā "Build failed"
`bash
Check TypeScript compilation
pnpm run buildVerify tsconfig.json exists
Ensure all dependencies installed
`ā "Upload failed"
`bash
Check network connection
Verify file sizes (< 100MB each)
Ensure backend is accessible
`$3
Enable detailed logging:
`bash
Set log level
export TENSORIFY_CLI_LOG_LEVEL=debugOr use debug flag
tensorify validate --debug
tensorify publish --debug
`$3
`bash
Command help
tensorify --help
tensorify publish --helpVersion information
tensorify --versionValidate with verbose output
tensorify validate --verbose
`š Performance Tips
$3
`json
// tsconfig.json optimization
{
"compilerOptions": {
"incremental": true,
"tsBuildInfoFile": ".tsbuildinfo"
}
}
`$3
- Keep bundle sizes small (< 10MB recommended)
- Optimize dependencies
- Use
.npmignore to exclude unnecessary files$3
`bash
Skip build for validation-only
tensorify validate --skip-buildUse specific directory
tensorify validate ./plugin-dir
`š Integration Examples
$3
`json
// package.json
{
"husky": {
"hooks": {
"pre-commit": "tensorify validate"
}
}
}
`$3
`json
// package.json
{
"scripts": {
"validate": "tensorify validate",
"publish:public": "tensorify publish --access=public",
"publish:private": "tensorify publish --access=private",
"publish:dry": "tensorify publish --dry-run"
}
}
``- š Documentation: docs.tensorify.io
- š Plugin Development Guide: docs.tensorify.io/plugins
- š§ SDK Documentation: @tensorify.io/sdk
- š¬ Community Discord: discord.gg/tensorify
- š Issue Tracker: github.com/tensorify/cli/issues
- š§ Support: support@tensorify.io
MIT License - see LICENSE file for details.
---
Made with ā¤ļø by the Tensorify Team