dank-ai 1.0.22 → 1.0.24

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/README.md CHANGED
@@ -138,6 +138,9 @@ dank build:prod --push
138
138
 
139
139
  # Build with custom tag and registry
140
140
  dank build:prod --tag v1.0.0 --registry ghcr.io --namespace myorg --push
141
+
142
+ # Use a common image name and tag by agent
143
+ dank build:prod --registry ghcr.io --namespace myorg --tag-by-agent --push
141
144
  ```
142
145
 
143
146
  ## šŸ“‹ CLI Commands
@@ -181,11 +184,12 @@ dank logs --follow # Follow log output
181
184
 
182
185
  ### Production Build Options
183
186
  ```bash
184
- dank build:prod --push # Build and push to registry
185
- dank build:prod --tag v1.0.0 # Build with custom tag
186
- dank build:prod --registry ghcr.io # Build for GitHub Container Registry
187
- dank build:prod --namespace mycompany # Build with custom namespace
188
- dank build:prod --force # Force rebuild without cache
187
+ dank build:prod --push # Build and push to registry
188
+ dank build:prod --tag v1.0.0 # Build with custom tag
189
+ dank build:prod --registry ghcr.io # Build for GitHub Container Registry
190
+ dank build:prod --namespace mycompany # Build with custom namespace
191
+ dank build:prod --tag-by-agent # Use agent name as tag (common repo)
192
+ dank build:prod --force # Force rebuild without cache
189
193
  ```
190
194
 
191
195
  ## šŸ¤– Agent Configuration
@@ -717,13 +721,15 @@ dank build:prod --tag release-2024.1 --push
717
721
 
718
722
  #### šŸ·ļø **Image Naming Convention**
719
723
 
720
- **With Agent Configuration:**
724
+ **Default (Per-Agent Repository):**
721
725
  - Format: `{registry}/{namespace}/{agent-name}:{tag}`
722
726
  - Example: `ghcr.io/mycompany/customer-service:v1.2.0`
723
727
 
724
- **With CLI Override:**
725
- - CLI options override agent configuration
726
- - Example: `dank build:prod --tag v2.0.0` overrides agent's tag
728
+ **Tag By Agent (Common Repository):**
729
+ - Enabled with `--tag-by-agent` or `agent.config.agentImage.tagByAgent = true`
730
+ - Repository: `{registry}/{namespace}/dank-agent`
731
+ - Tag: normalized agent name (lowercase, [a-z0-9_.-], max 128 chars)
732
+ - Example: `ghcr.io/myorg/dank-agent:customer-service`
727
733
 
728
734
  **Without Configuration:**
729
735
  - Format: `{agent-name}:{tag}`
package/bin/dank CHANGED
@@ -89,6 +89,7 @@ program
89
89
  .option('--tag <tag>', 'Custom tag for images (default: latest)')
90
90
  .option('--registry <registry>', 'Docker registry URL (e.g., docker.io, ghcr.io)')
91
91
  .option('--namespace <namespace>', 'Docker namespace/organization')
92
+ .option('--tag-by-agent', 'Use agent name as the image tag (common image name)')
92
93
  .option('--force', 'Force rebuild without cache')
93
94
  .action(async (options) => {
94
95
  const { productionBuildCommand } = require('../lib/cli/production-build');
package/lib/cli/build.js CHANGED
@@ -20,7 +20,7 @@ async function buildCommand(options) {
20
20
 
21
21
  console.log(chalk.green('\\nāœ… Pull completed successfully!'));
22
22
  }
23
- process.exit(0);
23
+
24
24
 
25
25
  } catch (error) {
26
26
  console.error(chalk.red('āŒ Pull failed:'), error.message);
@@ -45,6 +45,7 @@ async function productionBuildCommand(options) {
45
45
  tag: options.tag || agentImageConfig.tag || 'latest',
46
46
  registry: options.registry || agentImageConfig.registry,
47
47
  namespace: options.namespace || agentImageConfig.namespace,
48
+ tagByAgent: Boolean(options.tagByAgent || agentImageConfig.tagByAgent),
48
49
  force: options.force || false,
49
50
  push: options.push || false
50
51
  };
@@ -115,6 +116,7 @@ async function productionBuildCommand(options) {
115
116
  }
116
117
 
117
118
  console.log(chalk.green('\nšŸŽ‰ Production build completed successfully!'));
119
+ process.exit(0);
118
120
 
119
121
  } catch (error) {
120
122
  console.error(chalk.red('āŒ Production build failed:'), error.message);
@@ -1157,25 +1157,39 @@ class DockerManager {
1157
1157
  tag = "latest",
1158
1158
  registry,
1159
1159
  namespace,
1160
+ tagByAgent = false,
1160
1161
  force = false,
1161
1162
  push = false,
1162
1163
  } = options;
1163
1164
 
1164
- // Construct production image name
1165
- let imageName = agent.name.toLowerCase();
1166
-
1167
- // Add namespace if provided
1168
- if (namespace) {
1169
- imageName = `${namespace}/${imageName}`;
1165
+ // Normalize a Docker tag from agent name when tagByAgent is enabled
1166
+ const normalizeTag = (name) => {
1167
+ const lower = String(name || '').toLowerCase();
1168
+ let sanitized = lower.replace(/[^a-z0-9_.-]/g, '-');
1169
+ sanitized = sanitized.replace(/^-+/, '').replace(/-+$/, '');
1170
+ if (!sanitized || !/^[a-z0-9]/.test(sanitized)) sanitized = `a${sanitized || ''}`;
1171
+ if (sanitized.length > 128) sanitized = sanitized.slice(0, 128);
1172
+ return sanitized;
1173
+ };
1174
+
1175
+ // Base repository name logic
1176
+ let repoName;
1177
+ if (tagByAgent) {
1178
+ // Use a common repository for all agents; differentiate by tag
1179
+ repoName = 'dank-agent';
1180
+ } else {
1181
+ // Default: per-agent repository name
1182
+ repoName = agent.name.toLowerCase();
1170
1183
  }
1171
1184
 
1172
- // Add registry if provided
1173
- if (registry) {
1174
- imageName = `${registry}/${imageName}`;
1175
- }
1185
+ // Compose full repository path
1186
+ let fullRepo = repoName;
1187
+ if (namespace) fullRepo = `${namespace}/${fullRepo}`;
1188
+ if (registry) fullRepo = `${registry}/${fullRepo}`;
1176
1189
 
1177
- // Add tag
1178
- imageName = `${imageName}:${tag}`;
1190
+ // Final tag selection
1191
+ const finalTag = tagByAgent ? normalizeTag(agent.name) : tag;
1192
+ const imageName = `${fullRepo}:${finalTag}`;
1179
1193
 
1180
1194
  this.logger.info(
1181
1195
  `Building production image for agent: ${agent.name} -> ${imageName}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dank-ai",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Dank Agent Service - Docker-based AI agent orchestration platform",
5
5
  "main": "lib/index.js",
6
6
  "exports": {