dank-ai 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/dank ADDED
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Dank CLI - Agent Orchestration Command Line Interface
5
+ */
6
+
7
+ const { program } = require('commander');
8
+ const chalk = require('chalk');
9
+ const pkg = require('../package.json');
10
+
11
+ // Import command handlers
12
+ const { runCommand } = require('../lib/cli/run');
13
+ const { initCommand } = require('../lib/cli/init');
14
+ const { statusCommand } = require('../lib/cli/status');
15
+ const { stopCommand } = require('../lib/cli/stop');
16
+ const { logsCommand } = require('../lib/cli/logs');
17
+
18
+ program
19
+ .name('dank')
20
+ .description('🚀 Dank Agent Service - Docker-based AI agent orchestration')
21
+ .version(pkg.version);
22
+
23
+ // Run command - main orchestration command
24
+ program
25
+ .command('run')
26
+ .description('Start all defined agents in Docker containers (rebuilds images by default)')
27
+ .option('-c, --config <file>', 'Configuration file path', 'dank.config.js')
28
+ .option('-d, --detached', 'Run containers in detached mode')
29
+ .option('--no-build', 'Skip rebuilding Docker images (use existing images)')
30
+ .option('--pull', 'Pull latest base image before building')
31
+ .option('--parallel <number>', 'Number of agents to start in parallel', '3')
32
+ .action(runCommand);
33
+
34
+ // Init command - initialize new project
35
+ program
36
+ .command('init [name]')
37
+ .description('Initialize a new Dank agent project')
38
+ .option('-t, --template <template>', 'Project template to use', 'basic')
39
+ .option('--force', 'Overwrite existing files')
40
+ .action(initCommand);
41
+
42
+ // Status command - show agent status
43
+ program
44
+ .command('status')
45
+ .description('Show status of all agents')
46
+ .option('-w, --watch', 'Watch for status changes')
47
+ .option('--json', 'Output in JSON format')
48
+ .action(statusCommand);
49
+
50
+ // Stop command - stop agents
51
+ program
52
+ .command('stop [agents...]')
53
+ .description('Stop running agents')
54
+ .option('-a, --all', 'Stop all agents')
55
+ .option('-f, --force', 'Force stop (kill containers)')
56
+ .action(stopCommand);
57
+
58
+ // Logs command - view agent logs
59
+ program
60
+ .command('logs [agent]')
61
+ .description('View logs from agents')
62
+ .option('-f, --follow', 'Follow log output')
63
+ .option('-t, --tail <lines>', 'Number of lines to show from end of logs', '100')
64
+ .option('--since <timestamp>', 'Show logs since timestamp')
65
+ .action(logsCommand);
66
+
67
+ // Build command - build Docker images
68
+ program
69
+ .command('build')
70
+ .description('Build Docker images for agents')
71
+ .option('--base', 'Build only the base image')
72
+ .option('--force', 'Force rebuild without cache')
73
+ .action(async (options) => {
74
+ const { buildCommand } = require('../lib/cli/build');
75
+ await buildCommand(options);
76
+ });
77
+
78
+ // Clean command - cleanup Docker resources
79
+ program
80
+ .command('clean')
81
+ .description('Clean up Docker containers and images')
82
+ .option('--all', 'Remove all Dank-related Docker resources')
83
+ .option('--containers', 'Remove only containers')
84
+ .option('--images', 'Remove only images')
85
+ .action(async (options) => {
86
+ const { cleanCommand } = require('../lib/cli/clean');
87
+ await cleanCommand(options);
88
+ });
89
+
90
+ // Global error handler
91
+ program.exitOverride();
92
+
93
+ try {
94
+ program.parse();
95
+ } catch (err) {
96
+ if (err.code === 'commander.help') {
97
+ process.exit(0);
98
+ } else if (err.code === 'commander.version') {
99
+ process.exit(0);
100
+ } else {
101
+ console.error(chalk.red('❌ Error:'), err.message);
102
+ process.exit(1);
103
+ }
104
+ }
105
+
106
+ // Show help if no command provided
107
+ if (!process.argv.slice(2).length) {
108
+ console.log(chalk.yellow('🚀 Dank Agent Service'));
109
+ console.log(chalk.gray('Docker-based AI agent orchestration platform\\n'));
110
+ program.outputHelp();
111
+
112
+ console.log(chalk.cyan('\\nQuick Start:'));
113
+ console.log(chalk.gray(' dank init my-project # Initialize new project'));
114
+ console.log(chalk.gray(' cd my-project'));
115
+ console.log(chalk.gray(' dank run # Start all agents'));
116
+ console.log(chalk.gray(' dank status # Check agent status'));
117
+ console.log(chalk.gray(' dank logs # View agent logs'));
118
+ }
@@ -0,0 +1,57 @@
1
+ # Dank Agent Base Image
2
+ # This is the base Docker image that all agents will extend
3
+
4
+ FROM node:22-alpine
5
+
6
+ # Install system dependencies
7
+ RUN apk add --no-cache \
8
+ curl \
9
+ wget \
10
+ git \
11
+ python3 \
12
+ make \
13
+ g++ \
14
+ && rm -rf /var/cache/apk/*
15
+
16
+ # Set working directory
17
+ WORKDIR /app
18
+
19
+ # Create agent code drop-off directory
20
+ RUN mkdir -p /app/agent-code
21
+
22
+ # Install global npm packages that agents might need
23
+ RUN npm install -g \
24
+ axios \
25
+ lodash \
26
+ moment \
27
+ uuid
28
+
29
+ # Copy agent entrypoint
30
+ COPY entrypoint.js /app/entrypoint.js
31
+
32
+ # Make entrypoint executable
33
+ RUN chmod +x /app/entrypoint.js
34
+
35
+ # Install runtime dependencies
36
+ COPY package.json /app/package.json
37
+ RUN npm install --production
38
+
39
+ # Create non-root user for security
40
+ RUN addgroup -g 1001 -S dankuser && \
41
+ adduser -S dankuser -u 1001 -G dankuser
42
+
43
+ # Set ownership
44
+ RUN chown -R dankuser:dankuser /app
45
+
46
+ # Switch to non-root user
47
+ USER dankuser
48
+
49
+ # Health check
50
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
51
+ CMD curl -f http://localhost:3001/health || exit 1
52
+
53
+ # Expose port for health checks and communication
54
+ EXPOSE 3001
55
+
56
+ # Default entrypoint
57
+ ENTRYPOINT ["node", "/app/entrypoint.js"]