A portable, cross-platform command-line interface for DCYFR AI framework - supported on Windows, macOS, and Linux.
This is a standalone CLI tool extracted from the dcyfr-ai-nodejs starter template, designed to be lightweight, portable, and easy to use across all operating systems.
- 🖥️ Cross-Platform - Works seamlessly on Windows, macOS, and Linux
- 🚀 Portable - Single binary/package installation
- 🤖 DCYFR AI Integration - Full framework support with validation and telemetry
- 📘 TypeScript Strict Mode - Full type safety with strict compiler options
- ⚡ Modern Node.js - ESM modules, Node.js 20+
- 🔧 Developer Experience - Hot reload, source maps, path aliases
- 📊 Structured Logging - JSON-based logging with multiple levels
- ✅ Code Quality - ESLint, Prettier, strict validation
- Node.js ≥ 20.0.0
- npm ≥ 10.0.0
npm install -g @dcyfr/ai-cli
dcyfr --helpnpm install @dcyfr/ai-cli
npx dcyfr --helpgit clone https://github.com/dcyfr/dcyfr-ai-cli.git
cd dcyfr-ai-cli
npm install
npm run build
npm link # Install globally (optional)
dcyfr --help# Global installation (PowerShell as Administrator)
npm install -g @dcyfr/ai-cli
# Or use in your project
npm install @dcyfr/ai-cli
npx dcyfr status# Global installation
npm install -g @dcyfr/ai-cli
# Or use in your project
npm install @dcyfr/ai-cli
npx dcyfr status# Global installation
npm install -g @dcyfr/ai-cli
# Or use in your project
npm install @dcyfr/ai-cli
npx dcyfr statusdcyfr status # Show framework status
dcyfr validate # Run validation checks
dcyfr telemetry # Show telemetry configuration
dcyfr init # Show initialization help
dcyfr --help # Show all commands
dcyfr --version # Show version$ dcyfr status
🚀 DCYFR AI Framework Status
Validation: ✅ Enabled
Telemetry: ✅ Enabled
Node Version: v22.10.0
Platform: darwin (arm64)
Memory: 45MB / 256MB$ dcyfr validate
🔍 Running Validation Checks
Mode: Enabled
Parallel: Yes
✅ Validation framework initialized
✅ Configuration loaded
✅ System checks passed$ dcyfr telemetry
📊 Telemetry Configuration
Status: ✅ Enabled
Storage: file
Path: .dcyfr/telemetryYou can also use @dcyfr/ai-cli as a library in your Node.js/TypeScript applications.
import { runCLI, type CLIResult, type CLIOptions } from '@dcyfr/ai-cli';
// Run CLI with custom arguments
const result: CLIResult = await runCLI(['status'], {
throw: false, // Return errors as values instead of throwing
});
console.log('Exit code:', result.exitCode);
console.log('Output:', result.stdout);
console.log('Errors:', result.stderr);
// With error throwing enabled
try {
const result = await runCLI(['validate'], { throw: true });
console.log('Validation passed!');
} catch (error) {
console.error('Validation failed:', error);
}import { runCLI } from '@dcyfr/ai-cli';
const result = await runCLI(['--version']);
console.log(result.stdout); // "1.0.0"const { runCLI } = require('@dcyfr/ai-cli');
(async () => {
const result = await runCLI(['status']);
if (result.exitCode === 0) {
console.log('Success:', result.stdout);
} else {
console.error('Error:', result.stderr);
}
})();Execute CLI commands programmatically.
Parameters:
args: string[]- Command line arguments (defaults toprocess.argv.slice(2))options?: CLIOptions- Optional configuration
Returns: Promise<CLIResult>
CLIOptions:
interface CLIOptions {
throw?: boolean; // If true, throw errors instead of returning them (default: false)
}CLIResult:
interface CLIResult {
exitCode: number; // 0 for success, non-zero for error
stdout: string; // Standard output captured during execution
stderr: string; // Standard error captured during execution
}The CLI looks for configuration in the following order (first found is used):
.dcyfr.jsonin current directoryconfig.jsonin current directoryconfig.jsonin config directory:- Windows:
%APPDATA%\.dcyfr\ - macOS/Linux:
~/.dcyfr/
- Windows:
{
"telemetry": {
"enabled": true,
"level": "info",
"endpoints": [
{
"type": "console",
"level": "info"
}
]
},
"validation": {
"enabled": true,
"strict": true
},
"cli": {
"verboseLogging": false,
"colorOutput": true
}
}# Install dependencies
npm install
# Build TypeScript
npm run build
# Watch mode
npm run build:watch
# Development
npm run dev# Run tests
npm test
# Watch mode
npm run test:watch
# Coverage
npm run test:coverage
# Lint
npm run lint
npm run lint:fix
# Format code
npm run formatsrc/
├── cli.ts # Main CLI entry point
├── commands/ # Command implementations
│ ├── status.ts # Status command
│ ├── validate.ts # Validation command
│ ├── telemetry.ts # Telemetry command
│ └── init.ts # Initialization command
└── lib/
├── logger.ts # Logging utilities
└── config.ts # Configuration loading (cross-platform)
This CLI is specifically designed for cross-platform support:
- Path Handling: Uses Node.js
pathmodule for proper OS path handling - Home Directory: Uses
os.homedir()for platform-specific home directory resolution - Config Locations: Different config directories for Windows, macOS, and Linux
- Executable Wrapper: Proper shebang (
#!/usr/bin/env node) for Unix-like systems and npm bin wrapper for Windows - Environment Variables: Respects platform-specific env vars (e.g.,
APPDATAon Windows)
- AGENTS.md - AI agent guidance and patterns
- CONTRIBUTING.md - Contribution guidelines
- LICENSE - MIT License
If dcyfr is not found after global installation:
# Check npm global path
npm config get prefix
# Add to PATH if needed
export PATH="$(npm config get prefix)/bin:$PATH"
# Add to ~/.bashrc or ~/.zshrc permanently:
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrcIf you get execution policy errors on Windows PowerShell:
# Use cmd or npm scripts instead
npm install @dcyfr/ai-cli
npx dcyfr status
# Or set execution policy (use with caution)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserCheck configuration paths:
# Windows
echo %APPDATA%
# macOS/Linux
echo ~
# Then verify config file exists in: ~/.dcyfr/config.json
# Or in current directory: .dcyfr.jsonSee CONTRIBUTING.md for contribution guidelines.
MIT - See LICENSE for details.
Built with ❤️ by DCYFR