@aifabrix/builder 2.56.0 → 2.58.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/lib/agent-kit/session-report.js +76 -0
- package/lib/agent-kit/start.js +124 -57
- package/lib/agent-kit/tmux-sessions.js +163 -0
- package/lib/api/environments.api.js +38 -0
- package/lib/api/marketplace-bootstrap.api.js +31 -0
- package/lib/app/push.js +98 -41
- package/lib/build/standard-docker-build.js +13 -11
- package/lib/cli/setup-app.js +16 -5
- package/lib/cli/setup-dev-path-commands.js +49 -2
- package/lib/cli/setup-environment.js +89 -19
- package/lib/commands/agent-kit-help.js +32 -15
- package/lib/commands/agent-kit.js +90 -8
- package/lib/commands/dev-registry.js +155 -0
- package/lib/commands/dev-show-display.js +10 -2
- package/lib/commands/setup-image-refresh.js +26 -0
- package/lib/core/config-attach-extensions.js +4 -1
- package/lib/deployment/installation/azure-infra-stage.js +191 -0
- package/lib/deployment/installation/azure-preflight.js +147 -0
- package/lib/deployment/installation/azure-readiness.js +101 -0
- package/lib/deployment/installation/docker-register.js +112 -0
- package/lib/deployment/installation/environment-auth.js +76 -0
- package/lib/deployment/installation/environment-manifest.js +165 -0
- package/lib/deployment/installation/environment-stage.js +191 -0
- package/lib/deployment/installation/index.js +39 -0
- package/lib/deployment/installation/infra-catalog.js +211 -0
- package/lib/deployment/installation/infra-manifest.js +176 -0
- package/lib/deployment/installation/infra-projection.js +97 -0
- package/lib/deployment/installation/public-ip.js +65 -0
- package/lib/deployment/installation/registry-auth-mode.js +98 -0
- package/lib/deployment/installation/stage-input.js +184 -0
- package/lib/deployment/installation/stage-output.js +53 -0
- package/lib/deployment/installation/workspace-env.js +76 -0
- package/lib/deployment/installation/workspace-files.js +178 -0
- package/lib/deployment/installation/workspace-schema.js +40 -0
- package/lib/deployment/installation/workspace-secrets.js +66 -0
- package/lib/deployment/installation/workspace.js +128 -0
- package/lib/deployment/marketplace-environment.js +305 -0
- package/lib/generator/builders.js +12 -9
- package/lib/generator/helpers.js +55 -56
- package/lib/generator/split-variables.js +11 -5
- package/lib/internal/fs-real-sync.js +29 -0
- package/lib/role-assistant/package-validate.js +4 -0
- package/lib/role-assistant/test-runner-clarification-resubmit.js +149 -0
- package/lib/role-assistant/test-runner.js +14 -17
- package/lib/schema/application-schema.json +20 -2
- package/lib/schema/infra-parameter.schema.json +7 -0
- package/lib/schema/infra.parameter.yaml +26 -36
- package/lib/schema/infrastructure-schema.json +1531 -397
- package/lib/schema/installation-environment.schema.json +601 -0
- package/lib/utils/app-register-config.js +2 -4
- package/lib/utils/build-resolve-image.js +2 -21
- package/lib/utils/cli-utils.js +8 -1
- package/lib/utils/config-registry-preference.js +106 -0
- package/lib/utils/docker-build.js +53 -19
- package/lib/utils/env-map.js +23 -6
- package/lib/utils/image-tags.js +88 -0
- package/lib/utils/promote-dev-docker-image.js +6 -0
- package/lib/utils/registry-credentials.js +236 -0
- package/lib/utils/resolve-docker-image-ref.js +78 -9
- package/lib/utils/secrets-helpers.js +9 -1
- package/lib/utils/variable-transformer.js +5 -4
- package/lib/validation/required-variables.js +41 -0
- package/lib/validation/validator.js +8 -5
- package/package.json +6 -1
- package/templates/README.md +4 -0
- package/templates/agent-kit/instructions/AGENTKIT.md +6 -6
- package/templates/agent-kit/skills/shared/hosts.md +10 -10
- package/templates/applications/dataplane/application.yaml +1 -1
- package/templates/applications/dataplane/env.template +1 -1
- package/templates/applications/miso-controller/application.yaml +3 -2
- package/templates/applications/miso-controller/env.template +15 -6
- package/templates/marketplace/createUiDefinition.json +77 -0
- package/templates/marketplace/install.parameters.example.json +9 -0
- package/templates/marketplace/main.json +4087 -0
package/lib/app/push.js
CHANGED
|
@@ -93,23 +93,24 @@ function extractImageName(config, appName) {
|
|
|
93
93
|
*/
|
|
94
94
|
async function loadPushConfig(appName, options) {
|
|
95
95
|
const { loadConfigFile } = require('../utils/config-format');
|
|
96
|
+
const { resolveEffectiveRegistry, stripRegistryHostFromRepository } = require('../utils/resolve-docker-image-ref');
|
|
97
|
+
let config;
|
|
96
98
|
try {
|
|
97
99
|
const { appPath } = await paths.detectAppType(appName);
|
|
98
|
-
|
|
99
|
-
const config = loadConfigFile(configPath);
|
|
100
|
-
const effective = getEffectiveConfig(config);
|
|
101
|
-
const registry = options.registry || effective.image?.registry;
|
|
102
|
-
if (!registry) {
|
|
103
|
-
throw new Error('Registry URL is required. Provide via --registry flag or configure in application config under image.registry');
|
|
104
|
-
}
|
|
105
|
-
const imageName = extractImageName(config, appName);
|
|
106
|
-
return { registry, imageName };
|
|
100
|
+
config = loadConfigFile(paths.resolveApplicationConfigPath(appPath));
|
|
107
101
|
} catch (error) {
|
|
108
|
-
if (error.message.includes('Registry URL')) {
|
|
109
|
-
throw error;
|
|
110
|
-
}
|
|
111
102
|
throw new Error(`Failed to load configuration: ${error.message}\nRun 'aifabrix create ${appName}' first`);
|
|
112
103
|
}
|
|
104
|
+
const effective = getEffectiveConfig(config);
|
|
105
|
+
const { registry } = resolveEffectiveRegistry(effective, { registry: options.registry });
|
|
106
|
+
if (!registry) {
|
|
107
|
+
throw new Error(
|
|
108
|
+
'Registry URL is required. Provide --registry, run "aifabrix dev set-registry <registry>", ' +
|
|
109
|
+
'or configure image.registry in the application config'
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
const imageName = stripRegistryHostFromRepository(extractImageName(config, appName));
|
|
113
|
+
return { registry, imageName, appVersion: require('../utils/image-tags').readAppVersion(effective) };
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
/**
|
|
@@ -129,10 +130,43 @@ async function validatePushConfig(registry, imageName, appName) {
|
|
|
129
130
|
throw new Error(`Invalid registry URL format: ${registry}. Expected format: *.azurecr.io`);
|
|
130
131
|
}
|
|
131
132
|
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
const sourceRef = await resolveLocalSourceRef(registry, imageName);
|
|
134
|
+
if (!sourceRef) {
|
|
135
|
+
throw new Error(`Docker image ${registry}/${imageName}:latest or ${imageName}:latest not found locally.\nRun 'aifabrix build ${appName}' first`);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const { getRegistryCredentialStatus } = require('../utils/registry-credentials');
|
|
139
|
+
const credentialStatus = getRegistryCredentialStatus(registry);
|
|
140
|
+
if (credentialStatus === 'partial') {
|
|
141
|
+
await require('../utils/registry-credentials').loadRegistryCredentials(registry);
|
|
142
|
+
}
|
|
143
|
+
if (credentialStatus === 'complete') {
|
|
144
|
+
return sourceRef;
|
|
145
|
+
}
|
|
146
|
+
await validateAzureCli();
|
|
147
|
+
return sourceRef;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Local image to push from: the registry-qualified build output first, else the plain repository.
|
|
152
|
+
* @param {string} registry - Registry host
|
|
153
|
+
* @param {string} imageName - Repository without host
|
|
154
|
+
* @returns {Promise<string|null>} `repository:latest` or null
|
|
155
|
+
*/
|
|
156
|
+
async function resolveLocalSourceRef(registry, imageName) {
|
|
157
|
+
for (const repository of [`${registry}/${imageName}`, imageName]) {
|
|
158
|
+
if (await pushUtils.checkLocalImageExists(repository, 'latest')) {
|
|
159
|
+
return `${repository}:latest`;
|
|
160
|
+
}
|
|
134
161
|
}
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
135
164
|
|
|
165
|
+
/**
|
|
166
|
+
* Azure CLI prerequisites for the ACR login fallback (no stored registry credentials).
|
|
167
|
+
* @returns {Promise<void>}
|
|
168
|
+
*/
|
|
169
|
+
async function validateAzureCli() {
|
|
136
170
|
if (!await pushUtils.checkAzureCLIInstalled()) {
|
|
137
171
|
throw new Error('Azure CLI is not installed. Install from: https://docs.microsoft.com/cli/azure/install-azure-cli');
|
|
138
172
|
}
|
|
@@ -149,7 +183,7 @@ async function validatePushConfig(registry, imageName, appName) {
|
|
|
149
183
|
* @async
|
|
150
184
|
* @param {string} registry - Registry URL
|
|
151
185
|
*/
|
|
152
|
-
async function
|
|
186
|
+
async function authenticateWithAzureCli(registry) {
|
|
153
187
|
if (await pushUtils.checkACRAuthentication(registry)) {
|
|
154
188
|
logger.log(formatSuccessLine(`Already authenticated with ${registry}`));
|
|
155
189
|
} else {
|
|
@@ -157,6 +191,16 @@ async function authenticateWithRegistry(registry) {
|
|
|
157
191
|
}
|
|
158
192
|
}
|
|
159
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Stored host-scoped credentials first (stdin login), else Azure CLI. Once per command.
|
|
196
|
+
* @param {string} registry - Registry host
|
|
197
|
+
* @returns {Promise<void>}
|
|
198
|
+
*/
|
|
199
|
+
async function authenticateWithRegistry(registry) {
|
|
200
|
+
const { ensureRegistryLogin } = require('../utils/registry-credentials');
|
|
201
|
+
await ensureRegistryLogin(registry, { fallback: authenticateWithAzureCli });
|
|
202
|
+
}
|
|
203
|
+
|
|
160
204
|
/**
|
|
161
205
|
* Layout-aligned notice when push is skipped for external integrations.
|
|
162
206
|
* @param {string} appName
|
|
@@ -191,30 +235,43 @@ function logPushCommandHeader(appName, registry, imageName) {
|
|
|
191
235
|
* @param {string} registry - Registry URL
|
|
192
236
|
* @param {Array<string>} tags - Image tags
|
|
193
237
|
*/
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
238
|
+
function isAuthenticationError(error) {
|
|
239
|
+
const message = (error && error.message) || String(error);
|
|
240
|
+
return message.includes('Authentication required') ||
|
|
241
|
+
message.includes('authentication required') ||
|
|
242
|
+
(message.includes('authentication') && message.includes('401'));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async function tagAndPushOne(sourceRef, targetRef, registry) {
|
|
246
|
+
if (sourceRef !== targetRef) {
|
|
247
|
+
await pushUtils.tagImage(sourceRef, targetRef);
|
|
248
|
+
}
|
|
249
|
+
await pushUtils.pushImage(targetRef, registry);
|
|
250
|
+
}
|
|
206
251
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
252
|
+
/**
|
|
253
|
+
* Tags and pushes every unique target once, re-authenticating once on an auth failure.
|
|
254
|
+
* @async
|
|
255
|
+
* @param {string} sourceRef - Local source image
|
|
256
|
+
* @param {string} imageName - Repository without host
|
|
257
|
+
* @param {string} registry - Registry host
|
|
258
|
+
* @param {Array<string>} tags - Resolved tags
|
|
259
|
+
*/
|
|
260
|
+
async function pushImageTags(sourceRef, imageName, registry, tags) {
|
|
261
|
+
let reauthenticated = false;
|
|
262
|
+
for (const tag of tags) {
|
|
263
|
+
const targetRef = `${registry}/${imageName}:${tag}`;
|
|
264
|
+
try {
|
|
265
|
+
await tagAndPushOne(sourceRef, targetRef, registry);
|
|
266
|
+
} catch (error) {
|
|
267
|
+
if (reauthenticated || !isAuthenticationError(error)) {
|
|
268
|
+
throw new Error(`Push failed for ${targetRef}: ${error.message}`);
|
|
269
|
+
}
|
|
270
|
+
logger.log(formatWarningLine('Registry authentication expired; re-authenticating, then retrying push.'));
|
|
271
|
+
require('../utils/registry-credentials').resetRegistryLoginCache(registry);
|
|
211
272
|
await authenticateWithRegistry(registry);
|
|
212
|
-
|
|
213
|
-
await
|
|
214
|
-
await pushUtils.pushImage(`${registry}/${imageName}:${tag}`, registry);
|
|
215
|
-
}));
|
|
216
|
-
} else {
|
|
217
|
-
throw error;
|
|
273
|
+
reauthenticated = true;
|
|
274
|
+
await tagAndPushOne(sourceRef, targetRef, registry);
|
|
218
275
|
}
|
|
219
276
|
}
|
|
220
277
|
}
|
|
@@ -252,12 +309,12 @@ async function pushApp(appName, options = {}) {
|
|
|
252
309
|
}
|
|
253
310
|
try {
|
|
254
311
|
validateAppName(appName);
|
|
255
|
-
const { registry, imageName } = await loadPushConfig(appName, options);
|
|
256
|
-
|
|
312
|
+
const { registry, imageName, appVersion } = await loadPushConfig(appName, options);
|
|
313
|
+
const tags = require('../utils/image-tags').resolveImageTags(options.tag, appVersion);
|
|
314
|
+
const sourceRef = await validatePushConfig(registry, imageName, appName);
|
|
257
315
|
logPushCommandHeader(appName, registry, imageName);
|
|
258
316
|
await authenticateWithRegistry(registry);
|
|
259
|
-
|
|
260
|
-
await pushImageTags(imageName, registry, tags);
|
|
317
|
+
await pushImageTags(sourceRef, imageName, registry, tags);
|
|
261
318
|
displayPushResults(registry, imageName, tags);
|
|
262
319
|
} catch (error) {
|
|
263
320
|
throw new Error(`Failed to push application: ${error.message}`);
|
|
@@ -80,21 +80,18 @@ async function executeDockerImageBuild(appName, options, buildConfig) {
|
|
|
80
80
|
);
|
|
81
81
|
await ensureRunSecretsForApp(appName);
|
|
82
82
|
const buildArgs = await resolveDockerBuildArgsForApp(appName, contextPath);
|
|
83
|
-
const
|
|
84
|
-
if (typeof tag === 'string' && tag.includes(',')) {
|
|
85
|
-
throw new Error('Use a single image tag per build (comma-separated multiple tags are not supported).');
|
|
86
|
-
}
|
|
83
|
+
const { primary, aliases, tags } = options.tagPlan;
|
|
87
84
|
await dockerBuild.executeDockerBuildWithTag(
|
|
88
85
|
effectiveImageName,
|
|
89
86
|
imageName,
|
|
90
87
|
dockerfilePath,
|
|
91
88
|
contextPath,
|
|
92
|
-
|
|
93
|
-
{ ...options, buildArgs }
|
|
89
|
+
primary,
|
|
90
|
+
{ ...options, buildArgs, tagAliases: aliases }
|
|
94
91
|
);
|
|
95
92
|
await postBuildTasks(appName, buildConfig);
|
|
96
93
|
logger.log(formatSuccessParagraph('Build completed successfully!'));
|
|
97
|
-
return `${effectiveImageName}:${tag}
|
|
94
|
+
return tags.map((tag) => `${effectiveImageName}:${tag}`).join(', ');
|
|
98
95
|
}
|
|
99
96
|
|
|
100
97
|
/**
|
|
@@ -104,12 +101,17 @@ async function executeDockerImageBuild(appName, options, buildConfig) {
|
|
|
104
101
|
* @returns {Promise<string>} Built image ref e.g. name:tag
|
|
105
102
|
*/
|
|
106
103
|
async function runStandardDockerBuild(appName, options) {
|
|
107
|
-
const
|
|
104
|
+
const { resolveBuildTagPlan, readAppVersion } = require('../utils/image-tags');
|
|
105
|
+
const { buildConfig, config: appConfig } = await buildHelpers.loadAndValidateConfig(appName);
|
|
106
|
+
// Resolve and validate every tag before any Docker build, tag, login or promote.
|
|
107
|
+
const planned = { ...options, tagPlan: resolveBuildTagPlan(options.tag, readAppVersion(appConfig)) };
|
|
108
|
+
const promotedRef = await tryCompleteDevPromoteBuild(appName, planned);
|
|
108
109
|
if (promotedRef) {
|
|
109
|
-
|
|
110
|
+
const { resolvePromoteBaseTags } = require('../utils/promote-dev-docker-image');
|
|
111
|
+
const baseName = promotedRef.slice(0, promotedRef.lastIndexOf(':'));
|
|
112
|
+
return resolvePromoteBaseTags(planned).map((tag) => `${baseName}:${tag}`).join(', ');
|
|
110
113
|
}
|
|
111
|
-
|
|
112
|
-
return executeDockerImageBuild(appName, options, buildConfig);
|
|
114
|
+
return executeDockerImageBuild(appName, planned, buildConfig);
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
module.exports = { runStandardDockerBuild };
|
package/lib/cli/setup-app.js
CHANGED
|
@@ -208,6 +208,7 @@ Examples:
|
|
|
208
208
|
.option('-p, --port <port>', 'Override local port')
|
|
209
209
|
.option('-d, --debug', 'Enable debug output with detailed container information')
|
|
210
210
|
.option('-t, --tag <tag>', 'Image tag to run (e.g. v1.0.0); overrides application.yaml image.tag')
|
|
211
|
+
.option('-r, --registry <registry>', 'Registry host for the image (overrides dev set-registry and application.yaml)')
|
|
211
212
|
.option('-e, --env <env>', 'Environment: dev (default), tst, or pro', 'dev')
|
|
212
213
|
.option('--base', 'Use manifest base image only (skip local developer-scoped tag preference)')
|
|
213
214
|
.option('--reload', 'In dev: mount workspace into container (Mutagen only if docker-endpoint is a remote host)')
|
|
@@ -237,7 +238,11 @@ function registerBuildCommand(program) {
|
|
|
237
238
|
.option('-l, --language <lang>', 'Override language detection')
|
|
238
239
|
.option('-f, --force-template', 'Force rebuild from template')
|
|
239
240
|
.option('--no-cache', 'Full Docker rebuild (disable layer cache); use after Dockerfile or context fixes')
|
|
240
|
-
.option(
|
|
241
|
+
.option(
|
|
242
|
+
'-t, --tag <tags>',
|
|
243
|
+
'Image tag or comma-separated tags (default: latest); {version} expands to app.version, e.g. "latest,{version}"'
|
|
244
|
+
)
|
|
245
|
+
.option('-r, --registry <registry>', 'Registry host for the image name (overrides dev set-registry and application.yaml)')
|
|
241
246
|
.option(
|
|
242
247
|
'--base',
|
|
243
248
|
'Build/run the manifest base image (no -devN suffix). Default local build uses a developer-scoped repository when developer-id > 0.'
|
|
@@ -246,10 +251,16 @@ function registerBuildCommand(program) {
|
|
|
246
251
|
'--from-dev',
|
|
247
252
|
'With --base: tag the existing developer-scoped image as the base image instead of rebuilding when possible'
|
|
248
253
|
)
|
|
254
|
+
.addHelpText('after', `
|
|
255
|
+
Examples:
|
|
256
|
+
$ aifabrix build myapp
|
|
257
|
+
$ aifabrix build myapp --tag v1.0.0 # also tags latest
|
|
258
|
+
$ aifabrix build myapp --base --from-dev --tag 'latest,{version}'
|
|
259
|
+
$ aifabrix build myapp --registry myregistry.azurecr.io`)
|
|
249
260
|
.action(async(appName, options) => {
|
|
250
261
|
try {
|
|
251
|
-
const
|
|
252
|
-
logger.log(`✔ Built image: ${
|
|
262
|
+
const imageRefs = await app.buildApp(appName, options);
|
|
263
|
+
logger.log(`✔ Built image: ${imageRefs}`);
|
|
253
264
|
} catch (error) {
|
|
254
265
|
handleCommandError(error, 'build');
|
|
255
266
|
process.exit(1);
|
|
@@ -403,8 +414,8 @@ function setupPushDeployDockerfileCommands(program) {
|
|
|
403
414
|
program.command('push <appKey>')
|
|
404
415
|
.description('Push builder appKey image to Azure Container Registry')
|
|
405
416
|
.addHelpText('after', PUSH_HELP_AFTER)
|
|
406
|
-
.option('-r, --registry <registry>', '
|
|
407
|
-
.option('-t, --tag <
|
|
417
|
+
.option('-r, --registry <registry>', 'Registry host (overrides dev set-registry and application.yaml)')
|
|
418
|
+
.option('-t, --tag <tags>', 'Image tag or comma-separated tags (default: latest); {version} expands to app.version')
|
|
408
419
|
.action(async(appName, options) => {
|
|
409
420
|
try {
|
|
410
421
|
await app.pushApp(appName, options);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dev subcommands: set-home, set-work, print-home, print-work, shell-env, set-format
|
|
2
|
+
* Dev subcommands: set-home, set-work, print-home, print-work, shell-env, set-format,
|
|
3
|
+
* set-registry, print-registry.
|
|
3
4
|
*
|
|
4
5
|
* @fileoverview Path and format CLI registration for `aifabrix dev`
|
|
5
6
|
* @author AI Fabrix Team
|
|
@@ -178,8 +179,53 @@ function addSetFormatCommand(dev, handleSetFormat) {
|
|
|
178
179
|
});
|
|
179
180
|
}
|
|
180
181
|
|
|
182
|
+
const SET_REGISTRY_HELP = `
|
|
183
|
+
Examples:
|
|
184
|
+
$ aifabrix dev set-registry myregistry.azurecr.io
|
|
185
|
+
$ printf '%s' "$TOKEN" | aifabrix dev set-registry myregistry.azurecr.io --username puller --password-stdin
|
|
186
|
+
$ aifabrix dev set-registry myregistry.azurecr.io --clear-credentials
|
|
187
|
+
$ aifabrix dev set-registry --clear
|
|
188
|
+
|
|
189
|
+
Registry precedence for build, run, push and deploy: --registry, then this value, then the
|
|
190
|
+
application image.registry. Credentials are stored encrypted in your local secrets file as
|
|
191
|
+
<registry>-username and <registry>-password and are used for docker login (password on stdin).`;
|
|
192
|
+
|
|
193
|
+
function addRegistryCommands(dev) {
|
|
194
|
+
const { runSetRegistry, runPrintRegistry } = require('../commands/dev-registry');
|
|
195
|
+
dev
|
|
196
|
+
.command('set-registry [registry]')
|
|
197
|
+
.description('Set, clear or add credentials for the default container registry of this CLI installation')
|
|
198
|
+
.option('--username <username>', 'Registry username (requires a password option)')
|
|
199
|
+
.option('--password <password>', 'Registry password or token (visible in shell history; prefer --password-stdin)')
|
|
200
|
+
.option('--password-stdin', 'Read the registry password or token from stdin')
|
|
201
|
+
.option('--clear', 'Remove the saved default registry (credentials are kept)')
|
|
202
|
+
.option('--clear-credentials', 'Remove only the stored credentials for <registry>')
|
|
203
|
+
.addHelpText('after', SET_REGISTRY_HELP)
|
|
204
|
+
.action(async(registry, cmdOpts) => {
|
|
205
|
+
try {
|
|
206
|
+
await runSetRegistry(registry, cmdOpts);
|
|
207
|
+
} catch (error) {
|
|
208
|
+
handleCommandError(error, 'dev set-registry');
|
|
209
|
+
process.exit(1);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
dev
|
|
214
|
+
.command('print-registry')
|
|
215
|
+
.description('Print the saved default registry or an empty line (stdout only; for scripts)')
|
|
216
|
+
.addHelpText('after', '\nExamples:\n $ aifabrix dev print-registry\n')
|
|
217
|
+
.action(async() => {
|
|
218
|
+
try {
|
|
219
|
+
await runPrintRegistry();
|
|
220
|
+
} catch (error) {
|
|
221
|
+
handleCommandError(error, 'dev print-registry');
|
|
222
|
+
process.exit(1);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
181
227
|
/**
|
|
182
|
-
* Register dev set-home, set-work, print-*, set-format.
|
|
228
|
+
* Register dev set-home, set-work, print-*, set-format, set-registry, print-registry.
|
|
183
229
|
* @param {import('commander').Command} dev - dev subcommand group
|
|
184
230
|
* @param {function(string): Promise<void>} handleSetFormat - handler that updates format and refreshes display
|
|
185
231
|
* @returns {void}
|
|
@@ -190,6 +236,7 @@ function setupDevPathAndFormatCommands(dev, handleSetFormat) {
|
|
|
190
236
|
addSetWorkCommand(dev);
|
|
191
237
|
addPrintHomeWorkCommands(dev);
|
|
192
238
|
addSetFormatCommand(dev, handleSetFormat);
|
|
239
|
+
addRegistryCommands(dev);
|
|
193
240
|
}
|
|
194
241
|
|
|
195
242
|
module.exports = { setupDevPathAndFormatCommands };
|
|
@@ -7,39 +7,108 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const { handleCommandError } = require('../utils/cli-utils');
|
|
10
|
+
const { formatWarningLine } = require('../utils/cli-test-layout-chalk');
|
|
11
|
+
const { isWorkspaceMode, isLegacyMarketplaceMode } = require('../deployment/installation/stage-input');
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @param {Command}
|
|
14
|
+
* Adds installation workspace and deprecated explicit Marketplace options.
|
|
15
|
+
* @param {Command} command - Commander command
|
|
16
|
+
* @returns {Command} The command
|
|
14
17
|
*/
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
function addMarketplaceOptions(command) {
|
|
19
|
+
return command
|
|
20
|
+
.option('--stage <stage>', 'Installation workspace stage: register, infra, dev, tst or pro (<env> is then the resource group)')
|
|
21
|
+
.option('--vendor <vendor>', 'Installation vendor: AZURE (default) or DOCKER (register only)')
|
|
22
|
+
.option('--allow-my-ip', 'Allow the caller public IPv4 /32 to reach PostgreSQL, Key Vault and Storage (infra only; default off)')
|
|
23
|
+
.option('--license-edition <edition>', 'License requested at activation: COMMUNITY, STANDARD, ENTERPRISE or a Marketplace subscription ID (infra only; saved in the workspace)')
|
|
24
|
+
.option('--location <region>', 'Azure region for infra (saved to the workspace; dev, tst and pro inherit it)')
|
|
25
|
+
.option(
|
|
26
|
+
'--acr-auth <mode>',
|
|
27
|
+
'Image pull auth for infra: auto (default: saved dev set-registry pair, else managed identity), mi, or credentials (admin is a deprecated alias)'
|
|
28
|
+
)
|
|
29
|
+
.option('--miso-api-key-env <name>', 'Environment variable holding a temporary Miso API key (dev, tst, pro)')
|
|
30
|
+
.option(
|
|
31
|
+
'--controller-url <url>',
|
|
32
|
+
'Controller endpoint override for dev, tst or pro (normally recorded by infra); does not authenticate'
|
|
33
|
+
)
|
|
34
|
+
.option('--marketplace-json <file>', 'Deprecated explicit mode: ARM Marketplace infrastructure template')
|
|
35
|
+
.option('--parameters <file>', 'Deprecated explicit mode: secure ARM deploymentParameters JSON file')
|
|
36
|
+
.option('--subscription <id>', 'Deprecated explicit mode: Azure subscription ID')
|
|
37
|
+
.option('--resource-group <name>', 'Deprecated explicit mode: new isolated Azure resource group')
|
|
38
|
+
.option('--install-id <id>', 'Deprecated explicit mode: installation ID and resume-journal key');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function runLegacyMarketplace(envKey, options) {
|
|
42
|
+
process.stderr.write(`${formatWarningLine('Explicit Marketplace flags are deprecated; use af env deploy <resource-group> --stage infra')}\n`);
|
|
43
|
+
const installer = require('../deployment/marketplace-environment');
|
|
44
|
+
const result = await installer.deployMarketplaceEnvironment(envKey, options);
|
|
45
|
+
if (result.platformComplete) {
|
|
46
|
+
process.stdout.write(`Platform ready: ${result.publicControllerUrl}\n`);
|
|
47
|
+
} else {
|
|
48
|
+
process.stdout.write(`Infrastructure deployed: ${result.outputs.webAppUrl} (deployment ${result.deploymentId})\n`);
|
|
49
|
+
process.stdout.write(`Resume after controller login and wizard activation: af env deploy ${envKey} --install-id ${result.installId} --controller-url https://<ready-public-host>/miso --stage platform\n`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function runInstallationStage(resourceGroup, options) {
|
|
54
|
+
const { deployInstallationStage } = require('../deployment/installation');
|
|
55
|
+
const { formatStageResult } = require('../deployment/installation/stage-output');
|
|
56
|
+
const result = await deployInstallationStage(resourceGroup, options);
|
|
57
|
+
process.stdout.write(formatStageResult(result, resourceGroup));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function deployEnvHandler(envKey, options) {
|
|
61
|
+
try {
|
|
62
|
+
if (isWorkspaceMode(options)) {
|
|
63
|
+
await runInstallationStage(envKey, options);
|
|
64
|
+
} else if (isLegacyMarketplaceMode(options)) {
|
|
65
|
+
await runLegacyMarketplace(envKey, options);
|
|
66
|
+
} else {
|
|
18
67
|
const environmentDeploy = require('../deployment/environment');
|
|
19
68
|
await environmentDeploy.deployEnvironment(envKey, options);
|
|
20
|
-
} catch (error) {
|
|
21
|
-
handleCommandError(error, 'env deploy');
|
|
22
|
-
process.exit(1);
|
|
23
69
|
}
|
|
24
|
-
}
|
|
70
|
+
} catch (error) {
|
|
71
|
+
handleCommandError(error, 'env deploy');
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
25
75
|
|
|
26
|
-
|
|
76
|
+
const DEPLOY_EXAMPLES = `
|
|
27
77
|
Examples:
|
|
28
78
|
$ aifabrix env deploy dev
|
|
29
79
|
$ aifabrix env deploy tst
|
|
30
80
|
$ aifabrix env deploy pro --preset m
|
|
31
|
-
$ aifabrix env deploy dev --preset xl
|
|
32
81
|
$ aifabrix env deploy dev --config ./env-config.json
|
|
33
82
|
$ aifabrix env deploy dev --no-poll
|
|
34
83
|
|
|
35
|
-
|
|
84
|
+
Installation workspace (<env> is the resource group; files under infrastructure/<resource-group>/):
|
|
85
|
+
$ af env deploy <resource-group> --stage infra
|
|
86
|
+
$ af env deploy <resource-group> --stage infra --allow-my-ip
|
|
87
|
+
$ af env deploy <resource-group> --stage infra --license-edition ENTERPRISE
|
|
88
|
+
$ af env deploy <resource-group> --stage infra --location swedencentral
|
|
89
|
+
$ af env deploy <resource-group> --stage infra --acr-auth credentials
|
|
90
|
+
$ af env deploy <resource-group> --stage dev
|
|
91
|
+
$ af env deploy <resource-group> --stage pro --preset m
|
|
92
|
+
$ af env deploy <resource-group> --stage register --vendor DOCKER
|
|
93
|
+
|
|
94
|
+
Vendor/stage matrix:
|
|
95
|
+
AZURE infra, dev, tst, pro (Mori bootstrap runs inside the Marketplace template)
|
|
96
|
+
DOCKER register only (deploy with aifabrix setup)
|
|
97
|
+
|
|
98
|
+
Prerequisites: aifabrix login or MISO_API_KEY / --miso-api-key-env (controller permission controller:deploy);
|
|
99
|
+
infra also needs az login. --controller-url only selects the endpoint; it never replaces authentication.
|
|
100
|
+
Registry pull auth for infra: save a pair once with aifabrix dev set-registry <acr-login-server> --username <user> --password-stdin.
|
|
101
|
+
Deprecated explicit Marketplace flags: --marketplace-json, --parameters, --subscription, --resource-group, --install-id
|
|
102
|
+
(that route also accepts --location).
|
|
36
103
|
Environment keys: miso, dev, tst, pro. Default size preset: s (use --preset s|m|l|xl).
|
|
104
|
+
Tenant activation after infra is a manual step in the Miso web application.
|
|
37
105
|
Run this before aifabrix deploy <app> — the environment must exist first.`;
|
|
38
106
|
|
|
39
|
-
|
|
107
|
+
const ENV_GROUP_HELP_AFTER = `
|
|
40
108
|
Examples:
|
|
41
109
|
$ aifabrix env deploy dev
|
|
42
110
|
$ aifabrix env deploy dev --preset m
|
|
111
|
+
$ af env deploy <resource-group> --stage infra
|
|
43
112
|
$ aifabrix env deploy dev --help
|
|
44
113
|
|
|
45
114
|
Typical workflow:
|
|
@@ -51,21 +120,22 @@ Subcommands:
|
|
|
51
120
|
deploy <env> Provision/update environment in Miso Controller (see env deploy --help)
|
|
52
121
|
`;
|
|
53
122
|
|
|
123
|
+
function setupEnvironmentCommands(program) {
|
|
54
124
|
const env = program
|
|
55
125
|
.command('env')
|
|
56
126
|
.description('Miso Controller environments (primary: env deploy <env>)')
|
|
57
127
|
.addHelpText('after', ENV_GROUP_HELP_AFTER);
|
|
58
128
|
|
|
59
|
-
env
|
|
129
|
+
addMarketplaceOptions(env
|
|
60
130
|
.command('deploy <env>')
|
|
61
|
-
.description('Deploy environment infrastructure in Miso Controller
|
|
131
|
+
.description('Deploy environment infrastructure in Miso Controller, or an installation workspace stage with --stage')
|
|
62
132
|
.option('--config <file>', 'Environment configuration file (optional if --preset is used)')
|
|
63
|
-
.option('--preset <size>', 'Environment size preset: s, m, l, xl (default: s
|
|
133
|
+
.option('--preset <size>', 'Environment size preset: s, m, l, xl (default: s, or the workspace file value)')
|
|
64
134
|
.option('--skip-validation', 'Skip environment validation')
|
|
65
135
|
.option('--poll', 'Poll for deployment status', true)
|
|
66
|
-
.option('--no-poll', 'Do not poll for status')
|
|
67
|
-
.addHelpText('after',
|
|
136
|
+
.option('--no-poll', 'Do not poll for status'))
|
|
137
|
+
.addHelpText('after', DEPLOY_EXAMPLES)
|
|
68
138
|
.action(deployEnvHandler);
|
|
69
139
|
}
|
|
70
140
|
|
|
71
|
-
module.exports = { setupEnvironmentCommands };
|
|
141
|
+
module.exports = { setupEnvironmentCommands, deployEnvHandler, addMarketplaceOptions };
|
|
@@ -21,9 +21,10 @@ Examples:
|
|
|
21
21
|
$ aifabrix agent-kit install --host all --approve-all claude --yes
|
|
22
22
|
$ aifabrix agent-kit update --host all --approve-all --yes
|
|
23
23
|
$ aifabrix agent-kit remote create --org my-org --yes
|
|
24
|
-
$ aifabrix agent-kit start claude
|
|
25
|
-
$ aifabrix agent-kit start
|
|
26
|
-
$ aifabrix agent-kit
|
|
24
|
+
$ aifabrix agent-kit start claude
|
|
25
|
+
$ aifabrix agent-kit start codex
|
|
26
|
+
$ aifabrix agent-kit list
|
|
27
|
+
$ aifabrix agent-kit kill aifabrix-docs
|
|
27
28
|
$ aifabrix agent-kit status
|
|
28
29
|
$ aifabrix agent-kit validate
|
|
29
30
|
`;
|
|
@@ -117,23 +118,37 @@ Interactive (TTY): omit flags to be prompted. Silent: --org <owner> --yes
|
|
|
117
118
|
const START_HELP = `
|
|
118
119
|
Does not install Agent Kit skills. Starts claude or codex in tmux in this git
|
|
119
120
|
workspace so closing the terminal does not kill the session. Detach: Ctrl-b then
|
|
120
|
-
d.
|
|
121
|
-
tmux session (default: last folder, e.g. aifabrix-docs).
|
|
122
|
-
--name and
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
d. The defaults enable that app's Remote Control and workspace auto-approval.
|
|
122
|
+
--name is the tmux session (default: last git-root folder, e.g. aifabrix-docs).
|
|
123
|
+
Claude gets --name and hostname-user-folder Remote Control. Codex uses its native
|
|
124
|
+
remote-control daemon. Use --no-remote-control and/or --skip-approve-all to opt
|
|
125
|
+
out. Claude --tmux is for worktrees, not this wrapper.
|
|
125
126
|
|
|
126
127
|
Examples:
|
|
127
|
-
$ aifabrix agent-kit start claude --remote-control --approve-all --yes
|
|
128
|
-
$ aifabrix agent-kit start claude --name aifabrix-docs --remote-control --approve-all --yes
|
|
129
|
-
$ aifabrix agent-kit start claude --name aifabrix-miso --remote-control --approve-all --yes
|
|
130
|
-
$ aifabrix agent-kit start claude --remote-control --detach
|
|
131
128
|
$ aifabrix agent-kit start claude
|
|
132
|
-
$ aifabrix agent-kit start
|
|
133
|
-
$ aifabrix agent-kit start
|
|
129
|
+
$ aifabrix agent-kit start codex
|
|
130
|
+
$ aifabrix agent-kit start claude --name aifabrix-miso
|
|
131
|
+
$ aifabrix agent-kit start codex --no-remote-control --skip-approve-all
|
|
132
|
+
$ aifabrix agent-kit start claude --detach
|
|
134
133
|
$ aifabrix agent-kit start claude --dry-run --json
|
|
135
134
|
`;
|
|
136
135
|
|
|
136
|
+
const LIST_HELP = `
|
|
137
|
+
Lists every active tmux session visible to the current Unix user.
|
|
138
|
+
|
|
139
|
+
Examples:
|
|
140
|
+
$ aifabrix agent-kit list
|
|
141
|
+
$ aifabrix agent-kit list --json
|
|
142
|
+
`;
|
|
143
|
+
|
|
144
|
+
const KILL_HELP = `
|
|
145
|
+
Stops exactly one tmux session. Use agent-kit list to find its name.
|
|
146
|
+
|
|
147
|
+
Examples:
|
|
148
|
+
$ aifabrix agent-kit kill aifabrix-miso
|
|
149
|
+
$ aifabrix agent-kit kill aifabrix-miso --json
|
|
150
|
+
`;
|
|
151
|
+
|
|
137
152
|
module.exports = {
|
|
138
153
|
HOST_OPTION_HELP,
|
|
139
154
|
APPROVE_ALL_OPTION_HELP,
|
|
@@ -145,5 +160,7 @@ module.exports = {
|
|
|
145
160
|
INIT_HELP,
|
|
146
161
|
REMOTE_GROUP_HELP,
|
|
147
162
|
REMOTE_HELP,
|
|
148
|
-
START_HELP
|
|
163
|
+
START_HELP,
|
|
164
|
+
LIST_HELP,
|
|
165
|
+
KILL_HELP
|
|
149
166
|
};
|