@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.
🚀 Quick Start
Installation
npm install -g @tensorify.io/cli
npm install --save-dev @tensorify.io/cli
Authentication
tensorify login
tensorify whoami
tensorify logout
Basic Usage
tensorify validate
tensorify publish --access=public
📋 Commands
tensorify login
Authenticate with Tensorify.io using OAuth2 flow.
tensorify login [options]
Features:
- 🔐 Secure OAuth2 authentication
- 🌐 Opens browser for login
- 💾 Stores token securely in system keyring
- ✅ Automatic token validation
Options:
--port <number>
- Custom port for OAuth callback (default: 3000)
--timeout <seconds>
- Authentication timeout (default: 300)
Examples:
tensorify login
tensorify login --port 8080
tensorify login --timeout 600
tensorify whoami
Display current authentication status and user information.
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 details
Examples:
tensorify whoami
tensorify whoami --json
tensorify whoami --token
tensorify logout
Clear authentication tokens and logout.
tensorify logout [options]
Features:
- 🗑️ Removes stored tokens
- 🔒 Secure cleanup
- ✅ Confirmation prompts
Options:
--force
- Skip confirmation prompt
Examples:
tensorify logout
tensorify logout --force
tensorify validate
Validate plugin structure and configuration using SDK rules.
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 <version>
- Check against specific SDK version
--json
- Output results in JSON format
--fix
- Attempt to fix common issues
Validation 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 plugins
Examples:
tensorify validate
tensorify validate ./my-plugin
tensorify validate --verbose
tensorify validate --json
tensorify validate --sdk-version 0.0.1
tensorify publish
Publish plugin to Tensorify registry with comprehensive validation and upload.
tensorify publish [options]
Features:
- 🔍 Pre-publish validation
- 🏗️ Automatic build and bundling
- ✅ Version conflict checking
- 📤 Secure file uploads
- 🔔 Registry notifications
- 🚀 Complete publishing pipeline
Options:
--access <level>
- Access level: public
or private
(default: public
)
--directory <path>
- Plugin directory (default: current directory)
--backend <url>
- Backend API URL (default: https://backend.tensorify.io
)
--frontend <url>
- 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 upload
Publishing Process:
Examples:
tensorify publish --access=public
tensorify publish --access=private
tensorify publish --dry-run
tensorify publish --directory ./my-plugin
tensorify publish --force
tensorify publish --backend https://api.custom.com --frontend https://registry.custom.com
tensorify publish --offline
🔧 Configuration
Environment Variables
export TENSORIFY_BACKEND_URL=https://backend.tensorify.io
export TENSORIFY_FRONTEND_URL=https://plugins.tensorify.io
export TENSORIFY_CLIENT_ID=your_client_id
export TENSORIFY_CLIENT_SECRET=your_client_secret
export TENSORIFY_DEFAULT_ACCESS=public
export TENSORIFY_CLI_LOG_LEVEL=info
Configuration File
Create .tensorifyrc.json
in your project or home directory:
{
"backend": "https://backend.tensorify.io",
"frontend": "https://plugins.tensorify.io",
"defaultAccess": "public",
"autoValidate": true,
"buildTimeout": 300,
"uploadTimeout": 600
}
🔐 Authentication
OAuth2 Flow
The CLI uses secure OAuth2 authentication:
- Login Command: Opens browser to Tensorify.io
- User Authorization: User grants CLI access
- Token Exchange: CLI receives secure access token
- Token Storage: Token stored in system keyring
- Automatic Refresh: Tokens refreshed as needed
Token Storage
Tokens are securely stored using:
- macOS: Keychain
- Windows: Credential Manager
- Linux: Secret Service (libsecret)
Token Security
- 🔒 Tokens encrypted at rest
- ⏰ Automatic expiration
- 🔄 Refresh token rotation
- 🚫 No tokens in environment variables
📦 Plugin Requirements
Required Files
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
package.json Structure
{
"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
}
manifest.json Structure
{
"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"
}
}
Plugin Class Structure
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
GitHub Actions
name: Publish Plugin
on:
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
GitLab CI
stages:
- validate
- publish
validate:
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
Common Issues
Authentication Problems
❌ "Not authenticated"
tensorify login
tensorify whoami
❌ "Token expired"
tensorify logout
tensorify login
Validation Errors
❌ "Plugin validation failed"
tensorify validate --verbose
❌ "SDK version mismatch"
{
"tensorify-settings": {
"sdk-version": "0.0.1"
}
}
❌ "Missing repository URL"
{
"repository": {
"type": "git",
"url": "https://github.com/username/plugin-name"
},
"private": false
}
Publishing Problems
❌ "Version already exists"
❌ "Access level mismatch"
❌ "Build failed"
pnpm run build
❌ "Upload failed"
Debug Mode
Enable detailed logging:
export TENSORIFY_CLI_LOG_LEVEL=debug
tensorify validate --debug
tensorify publish --debug
Getting Help
tensorify --help
tensorify publish --help
tensorify --version
tensorify validate --verbose
📈 Performance Tips
Faster Builds
{
"compilerOptions": {
"incremental": true,
"tsBuildInfoFile": ".tsbuildinfo"
}
}
Faster Uploads
- Keep bundle sizes small (< 10MB recommended)
- Optimize dependencies
- Use
.npmignore
to exclude unnecessary files
Faster Validation
tensorify validate --skip-build
tensorify validate ./plugin-dir
🔗 Integration Examples
Pre-commit Hooks
{
"husky": {
"hooks": {
"pre-commit": "tensorify validate"
}
}
}
NPM Scripts
{
"scripts": {
"validate": "tensorify validate",
"publish:public": "tensorify publish --access=public",
"publish:private": "tensorify publish --access=private",
"publish:dry": "tensorify publish --dry-run"
}
}
📚 Resources
📄 License
MIT License - see LICENSE file for details.
Made with ❤️ by the Tensorify Team