🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
checkpoint: File edit:
rUv0ecded3469c9
diff --git a/v3/@claude-flow/deployment/src/index.ts b/v3/@claude-flow/deployment/src/index.tsindex affcf34647..c2ac867cdf 100644--- a/v3/@claude-flow/deployment/src/index.ts+++ b/v3/@claude-flow/deployment/src/index.ts@@ -3,6 +3,42 @@* Release management, CI/CD, and versioning module*/+// Export types+export type {+ VersionBumpType,+ ReleaseChannel,+ ReleaseOptions,+ ReleaseResult,+ PublishOptions,+ PublishResult,+ ValidationOptions,+ ValidationResult,+ PackageInfo,+ GitCommit,+ ChangelogEntry+} from './types.js';++// Export classes+export { ReleaseManager } from './release-manager.js';+export { Publisher } from './publisher.js';+export { Validator } from './validator.js';++// Export convenience functions+export {+ prepareRelease+} from './release-manager.js';++export {+ publishToNpm,+ checkVersionExists,+ getLatestVersion+} from './publisher.js';++export {+ validate+} from './validator.js';++// Legacy exports for backward compatibilityexport interface ReleaseConfig {version: string;channel: 'alpha' | 'beta' | 'stable';@@ -16,14 +52,37 @@ export interface DeploymentTarget {config: Record<string, unknown>;}-export async function prepareRelease(config: ReleaseConfig): Promise<void> {- // Release preparation logic- console.log(`Preparing release ${config.version} on ${config.channel} channel`);+/**+ * Legacy prepare release function+ * @deprecated Use prepareRelease from release-manager instead+ */+export async function prepare(config: ReleaseConfig): Promise<void> {+ const { ReleaseManager } = await import('./release-manager.js');+ const manager = new ReleaseManager();++ await manager.prepareRelease({+ version: config.version,+ channel: config.channel as any,+ generateChangelog: config.changelog,+ dryRun: config.dryRun+ });}+/**+ * Legacy deploy function+ * @deprecated Use publishToNpm from publisher instead+ */export async function deploy(target: DeploymentTarget): Promise<void> {- // Deployment logic- console.log(`Deploying to ${target.name} (${target.type})`);-}+ if (target.type === 'npm') {+ const { Publisher } = await import('./publisher.js');+ const publisher = new Publisher();-export { ReleaseConfig, DeploymentTarget };+ await publisher.publishToNpm({+ tag: (target.config.tag as string) || 'latest',+ dryRun: (target.config.dryRun as boolean) || false+ });+ } else {+ console.log(`Deploying to ${target.name} (${target.type})`);+ throw new Error(`Deployment type ${target.type} not yet implemented`);+ }+}diff --git a/v3/@claude-flow/deployment/src/validator.ts b/v3/@claude-flow/deployment/src/validator.tsnew file mode 100644index 0000000000..4e3d66fa8c--- /dev/null+++ b/v3/@claude-flow/deployment/src/validator.ts@@ -0,0 +1,285 @@+/**+ * Pre-Release Validator+ * Validates package before release (lint, test, build, dependencies)+ */++import { execSync } from 'child_process';+import { readFileSync, existsSync } from 'fs';+import { join } from 'path';+import type { ValidationOptions, ValidationResult, PackageInfo } from './types.js';++export class Validator {+ private cwd: string;++ constructor(cwd: string = process.cwd()) {+ this.cwd = cwd;+ }++ /**+ * Run all validation checks+ */+ async validate(options: ValidationOptions = {}): Promise<ValidationResult> {+ const {+ lint = true,+ test = true,+ build = true,+ checkDependencies = true,+ checkGitStatus = true,+ lintCommand = 'npm run lint',+ testCommand = 'npm test',+ buildCommand = 'npm run build'+ } = options;++ const result: ValidationResult = {+ valid: true,+ checks: {},+ errors: [],+ warnings: []+ };++ // Validate package.json+ console.log('Validating package.json...');+ result.checks.packageJson = await this.validatePackageJson();+ if (!result.checks.packageJson.passed) {+ result.valid = false;+ result.errors.push(...(result.checks.packageJson.errors || []));+ }++ // Check git status+ if (checkGitStatus) {+ console.log('Checking git status...');+ result.checks.gitStatus = await this.checkGitStatus();+ if (!result.checks.gitStatus.passed) {+ result.warnings.push(...(result.checks.gitStatus.errors || []));+ }+ }++ // Check dependencies+ if (checkDependencies) {+ console.log('Checking dependencies...');+ result.checks.dependencies = await this.checkDependencies();+ if (!result.checks.dependencies.passed) {+ result.valid = false;+ result.errors.push(...(result.checks.dependencies.errors || []));+ }+ }++ // Run linter+ if (lint) {+ console.log('Running linter...');+ result.checks.lint = await this.runLint(lintCommand);+ if (!result.checks.lint.passed) {+ result.valid = false;+ result.errors.push(...(result.checks.lint.errors || []));+ }+ }++ // Run tests+ if (test) {+ console.log('Running tests...');+ result.checks.test = await this.runTests(testCommand);+ if (!result.checks.test.passed) {+ result.valid = false;+ result.errors.push(...(result.checks.test.errors || []));+ }+ }++ // Run build+ if (build) {+ console.log('Running build...');+ result.checks.build = await this.runBuild(buildCommand);+ if (!result.checks.build.passed) {+ result.valid = false;+ result.errors.push(...(result.checks.build.errors || []));+ }+ }++ return result;+ }++ /**+ * Validate package.json structure and required fields+ */+ private async validatePackageJson(): Promise<{ passed: boolean; errors?: string[] }> {+ const errors: string[] = [];++ try {+ const pkgPath = join(this.cwd, 'package.json');+ if (!existsSync(pkgPath)) {+ errors.push('package.json not found');+ return { passed: false, errors };+ }++ const pkg: PackageInfo = JSON.parse(readFileSync(pkgPath, 'utf-8'));++ // Check required fields+ if (!pkg.name) {+ errors.push('package.json missing "name" field');+ }+ if (!pkg.version) {+ errors.push('package.json missing "version" field');+ }+ if (!pkg.description) {+ errors.push('package.json missing "description" field (warning)');+ }++ // Validate version format+ if (pkg.version && !/^\d+\.\d+\.\d+(?:-[a-z]+\.\d+)?$/.test(pkg.version)) {+ errors.push(`Invalid version format: ${pkg.version}`);+ }++ // Check for repository field+ if (!pkg.repository) {+ errors.push('package.json missing "repository" field (recommended)');+ }++ // Warn about private package+ if (pkg.private) {+ errors.push('Package is marked as private - cannot be published');+ }++ return {+ passed: errors.length === 0,+ errors: errors.length > 0 ? errors : undefined+ };++ } catch (error) {+ errors.push(`Failed to parse package.json: ${error}`);+ return { passed: false, errors };+ }+ }++ /**+ * Check git status for uncommitted changes+ */+ private async checkGitStatus(): Promise<{ passed: boolean; errors?: string[] }> {+ try {+ const status = this.execCommand('git status --porcelain', true);++ if (status.trim()) {+ return {+ passed: false,+ errors: ['Uncommitted changes detected. Commit or stash changes before release.']+ };+ }++ return { passed: true };+ } catch (error) {+ return {+ passed: false,+ errors: [`Git status check failed: ${error}`]+ };+ }+ }++ /**+ * Check for dependency issues+ */+ private async checkDependencies(): Promise<{ passed: boolean; errors?: string[] }> {+ const errors: string[] = [];++ try {+ // Check for npm audit issues+ try {+ this.execCommand('npm audit --audit-level moderate', false);+ } catch (error) {+ errors.push('npm audit found security vulnerabilities');+ }++ // Check for outdated dependencies (non-critical)+ try {+ const outdated = this.execCommand('npm outdated --json', true);+ if (outdated.trim()) {+ const outdatedPkgs = JSON.parse(outdated);+ const count = Object.keys(outdatedPkgs).length;+ if (count > 0) {+ errors.push(`${count} outdated dependencies found (warning)`);+ }+ }+ } catch {+ // Outdated check is non-critical+ }++ return {+ passed: errors.length === 0,+ errors: errors.length > 0 ? errors : undefined+ };++ } catch (error) {+ errors.push(`Dependency check failed: ${error}`);+ return { passed: false, errors };+ }+ }++ /**+ * Run linter+ */+ private async runLint(command: string): Promise<{ passed: boolean; errors?: string[] }> {+ try {+ this.execCommand(command, false);+ return { passed: true };+ } catch (error) {+ return {+ passed: false,+ errors: [`Linting failed: ${error}`]+ };+ }+ }++ /**+ * Run tests+ */+ private async runTests(command: string): Promise<{ passed: boolean; errors?: string[] }> {+ try {+ this.execCommand(command, false);+ return { passed: true };+ } catch (error) {+ return {+ passed: false,+ errors: [`Tests failed: ${error}`]+ };+ }+ }++ /**+ * Run build+ */+ private async runBuild(command: string): Promise<{ passed: boolean; errors?: string[] }> {+ try {+ this.execCommand(command, false);+ return { passed: true };+ } catch (error) {+ return {+ passed: false,+ errors: [`Build failed: ${error}`]+ };+ }+ }++ /**+ * Execute command+ */+ private execCommand(cmd: string, returnOutput = false): string {+ try {+ const output = execSync(cmd, {+ cwd: this.cwd,+ encoding: 'utf-8',+ stdio: returnOutput ? 'pipe' : 'inherit'+ });+ return returnOutput ? output : '';+ } catch (error) {+ if (returnOutput && error instanceof Error) {+ throw error;+ }+ throw error;+ }+ }+}++/**+ * Convenience function to validate package+ */+export async function validate(options: ValidationOptions = {}): Promise<ValidationResult> {+ const validator = new Validator();+ return validator.validate(options);+}