@codiac.io/codiac-cli 1.3.253 → 1.3.255

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.
Files changed (44) hide show
  1. package/README.md +556 -165
  2. package/dist/apis/codiac-relay/gen/client.d.ts +12 -1
  3. package/dist/apis/codiac-relay/gen/client.js +23 -0
  4. package/dist/apis/codiac-relay/gen/client.js.map +1 -1
  5. package/dist/apis/codiac-relay/gen/contracts/types.gen.d.ts +120 -0
  6. package/dist/apis/codiac-relay/gen/contracts/types.gen.js.map +1 -1
  7. package/dist/apis/codiac-relay/i-client.d.ts +11 -0
  8. package/dist/apis/codiac-relay-nats/gen/client.d.ts +15 -0
  9. package/dist/apis/codiac-relay-nats/gen/client.js +27 -0
  10. package/dist/apis/codiac-relay-nats/gen/client.js.map +1 -1
  11. package/dist/apis/codiac-relay-nats/gen/contracts/types.gen.d.ts +49 -0
  12. package/dist/commands/ai/model/attach.d.ts +37 -0
  13. package/dist/commands/ai/model/attach.js +173 -0
  14. package/dist/commands/ai/model/attach.js.map +1 -0
  15. package/dist/commands/ai/model/install.d.ts +105 -0
  16. package/dist/commands/ai/model/install.js +655 -0
  17. package/dist/commands/ai/model/install.js.map +1 -0
  18. package/dist/commands/ai/model/list.d.ts +37 -0
  19. package/dist/commands/ai/model/list.js +160 -0
  20. package/dist/commands/ai/model/list.js.map +1 -0
  21. package/dist/commands/ai/model/uninstall.d.ts +40 -0
  22. package/dist/commands/ai/model/uninstall.js +144 -0
  23. package/dist/commands/ai/model/uninstall.js.map +1 -0
  24. package/dist/commands/ai/model/view.d.ts +35 -0
  25. package/dist/commands/ai/model/view.js +143 -0
  26. package/dist/commands/ai/model/view.js.map +1 -0
  27. package/dist/commands/asset/create.js +5 -4
  28. package/dist/commands/asset/create.js.map +1 -1
  29. package/dist/commands/asset/edit.d.ts +9 -0
  30. package/dist/commands/asset/edit.js +38 -0
  31. package/dist/commands/asset/edit.js.map +1 -1
  32. package/dist/commands/imageRegistry/edit.d.ts +47 -0
  33. package/dist/commands/imageRegistry/edit.js +163 -0
  34. package/dist/commands/imageRegistry/edit.js.map +1 -0
  35. package/dist/uilogic/model-spec.d.ts +40 -0
  36. package/dist/uilogic/model-spec.js +71 -0
  37. package/dist/uilogic/model-spec.js.map +1 -0
  38. package/dist/uilogic/registry-resolver.d.ts +21 -0
  39. package/dist/uilogic/registry-resolver.js +42 -0
  40. package/dist/uilogic/registry-resolver.js.map +1 -0
  41. package/oclif.manifest.json +670 -1
  42. package/package.json +1 -1
  43. package/skill/references/cli-reference.md +1 -1
  44. package/skill/references/concepts.md +26 -3
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@oclif/core");
5
+ const contracts_1 = require("../../apis/codiac-api/contracts");
6
+ const command_base_exec_tenant_1 = require("../../command-base-exec-tenant");
7
+ const prettify_1 = require("../../prettify");
8
+ const cloud_resource_configurator_factory_1 = require("../../uilogic/cloud-resource-configurator-factory");
9
+ const cloud_provider_contextualizer_1 = require("../../uilogic/cloud-provider-contextualizer");
10
+ const image_registry_contextualizer_1 = require("../../uilogic/image-registry-contextualizer");
11
+ const image_contextualizer_1 = require("../../uilogic/image-contextualizer");
12
+ const registry_resolver_1 = require("../../uilogic/registry-resolver");
13
+ /**
14
+ * Edits the mutable attributes of an existing container-registry reference.
15
+ *
16
+ * WHY this exists: `imageRegistry capture` is create-only (it throws if the code already
17
+ * exists), so a fat-fingered registry url had no in-CLI fix — you had to `forget` and
18
+ * re-`capture`, which orphans every asset that referenced the old code. This command
19
+ * updates the record in place, keeping the code (the join key assets resolve against)
20
+ * stable so those assets keep resolving.
21
+ *
22
+ * The `code`, `provider`, and `type` are the record's identity and the relay's client
23
+ * selector, so they are immutable here; a change to any of those is a different registry
24
+ * (capture a new one). Only `url` and the private/public flag are editable.
25
+ *
26
+ * NOTE: assets carry a denormalized copy of `image.registry` from create time, and the
27
+ * deploy path reads that copy — so after fixing a registry url here, existing assets also
28
+ * need `cod asset edit --registry <code>` to re-resolve their embedded reference.
29
+ */
30
+ class ImageRegistryEdit extends command_base_exec_tenant_1.CommandBaseExecTenant {
31
+ bootstrap() {
32
+ super.bootstrap();
33
+ cloud_provider_contextualizer_1.CloudProviderContextualizer.bootstrap(this.ioc);
34
+ this.ioc.bind(image_registry_contextualizer_1.ImageRegistryContextualizer).toSelf();
35
+ this.ioc.bind(image_contextualizer_1.ImageContextualizer).toSelf();
36
+ }
37
+ // --------------------------------------------------------------------
38
+ // Lazy-loaded properties
39
+ get uiRegistry() {
40
+ if (this._uiRegistry_backer === undefined) {
41
+ this._uiRegistry_backer = this.ioc.get(image_registry_contextualizer_1.ImageRegistryContextualizer);
42
+ }
43
+ return this._uiRegistry_backer;
44
+ }
45
+ // --------------------------------------------------------------------
46
+ captureArgs() {
47
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
48
+ const { flags } = yield this.parse(ImageRegistryEdit);
49
+ // partial.code identifies WHICH registry (immutable); partial.url / pullRequiresAuth
50
+ // carry the requested edits. private is only assigned when the user passed a --private
51
+ // or --no-private, so an omitted flag leaves the stored value untouched.
52
+ let partial = {};
53
+ if (flags.registry)
54
+ partial.code = flags.registry;
55
+ if (flags.url)
56
+ partial.url = flags.url.trim();
57
+ if (flags.private !== undefined)
58
+ partial.pullRequiresAuth = flags.private;
59
+ return [partial, false];
60
+ });
61
+ }
62
+ buildCandidate_silently(partial, _rootMap) {
63
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
64
+ if (!partial.code)
65
+ throw new Error("A registry code must be set (use --registry <code> to identify the registry to edit; run `cod imageRegistry list` for codes).");
66
+ const all = yield this._codiacApi.ImageRegistry.readMany({ all: true }, { throwNotFound: false });
67
+ const existing = (0, registry_resolver_1.resolveRegistryByCodeOrThrow)(all !== null && all !== void 0 ? all : [], partial.code, "--registry");
68
+ return this.applyEdits(existing, partial);
69
+ });
70
+ }
71
+ buildCandidate_interactively(partial, _takeDefaults, _rootMap) {
72
+ var _a;
73
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
74
+ cloud_resource_configurator_factory_1.RegistryConfiguratorFactory.bootstrap(this.ioc);
75
+ const all = yield this._codiacApi.ImageRegistry.readMany({ all: true }, { throwNotFound: false });
76
+ if (!all || all.length === 0)
77
+ throw new Error("Cannot edit: no image registries are defined yet.");
78
+ // Resolve the target: honor --registry if given & valid, otherwise let the user pick.
79
+ let existing = partial.code ? all.find(r => r.code === partial.code) : undefined;
80
+ if (!existing) {
81
+ existing = yield this.uiRegistry.promptForExistingRegistry(contracts_1.PackageType.container, false, all);
82
+ }
83
+ if (!existing)
84
+ throw new Error("No registry selected.");
85
+ this._ui.userMessage(`Editing ${existing.type} image registry ${this._styler.bold(this._styler.hilite(existing.code))} ${this._styler.dim(`(current url: ${existing.url})`)}`);
86
+ // URL — default to the current value so pressing enter leaves it unchanged.
87
+ if (partial.url === undefined) {
88
+ partial.url = yield this._ui.prompt("url", "Registry url:", true, existing.url);
89
+ }
90
+ // Private/public — default to the current value.
91
+ if (partial.pullRequiresAuth === undefined) {
92
+ partial.pullRequiresAuth = yield this._ui.promptConfirm("private", "Requires authentication to pull (private)?", (_a = existing.pullRequiresAuth) !== null && _a !== void 0 ? _a : true);
93
+ }
94
+ const candidate = this.applyEdits(existing, partial);
95
+ this._ui.userMessage("About to save:");
96
+ this._ui.userMessage((0, prettify_1.prettify)(candidate));
97
+ const confirmed = yield this._ui.promptConfirm("confirm", "Save changes?", false);
98
+ if (!confirmed)
99
+ return undefined;
100
+ return candidate;
101
+ });
102
+ }
103
+ /** Overlays the requested edits onto the existing record, keeping every other field intact.
104
+ * Throws if the caller asked for no change at all. */
105
+ applyEdits(existing, partial) {
106
+ const candidate = Object.assign({}, existing);
107
+ let changed = false;
108
+ if (partial.url !== undefined && partial.url.length > 0 && partial.url !== existing.url) {
109
+ candidate.url = partial.url;
110
+ changed = true;
111
+ }
112
+ if (partial.pullRequiresAuth !== undefined && partial.pullRequiresAuth !== existing.pullRequiresAuth) {
113
+ candidate.pullRequiresAuth = partial.pullRequiresAuth;
114
+ changed = true;
115
+ }
116
+ if (!changed)
117
+ throw new Error(`Nothing to edit for [${existing.code}]. Provide --url and/or --private/--no-private with a value different from the current one.`);
118
+ return candidate;
119
+ }
120
+ buildCommandString(candidate, cmd) {
121
+ cmd.push("--registry", candidate.code);
122
+ cmd.push("--url", candidate.url);
123
+ cmd.push(candidate.pullRequiresAuth === false ? "--no-private" : "--private");
124
+ cmd.push("--silent");
125
+ return cmd;
126
+ }
127
+ executeTask(candidate) {
128
+ var _a;
129
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
130
+ const result = yield this._codiacApi.ImageRegistry.tryUpdate(candidate);
131
+ if (result.success) {
132
+ this._ui.userMessage(`Successfully updated ${candidate.type} image registry [${this._styler.hilite(candidate.code)}] — url: ${this._styler.hilite(candidate.url)}`);
133
+ }
134
+ else if (result.error) {
135
+ this._ui.userMessage(`${this._styler.colorCritical("Error")} updating ${candidate.type} image registry [${candidate.code}]: ${result.error.name} ${(_a = result.error.message) !== null && _a !== void 0 ? _a : result.error.stack}`);
136
+ throw result.error;
137
+ }
138
+ else {
139
+ this._ui.userMessage(`Failed to update image registry [${candidate.code}]. Check logs for details.`);
140
+ }
141
+ });
142
+ }
143
+ }
144
+ exports.default = ImageRegistryEdit;
145
+ ImageRegistryEdit.description = 'Changes the mutable attributes (url, private/public) of an existing container registry reference. The code, provider, and type are immutable.';
146
+ ImageRegistryEdit.aliases = [];
147
+ ImageRegistryEdit.examples = [
148
+ { description: "Edit a registry interactively (select it, then change its url).", command: "<%= config.bin %> <%= command.id %>" },
149
+ { description: "Correct a registry's url (identified by its Codiac code, not its url).", command: "<%= config.bin %> <%= command.id %> --registry devCodiacContainers --url newname.azurecr.io --silent" },
150
+ { description: "Flip a registry to public (no pull authentication).", command: "<%= config.bin %> <%= command.id %> --registry 'Other|ghcr' --no-private --silent" },
151
+ { description: "Render the equivalent silent command without executing it.", command: "<%= config.bin %> <%= command.id %> --registry devCodiacContainers --url newname.azurecr.io --to-script" },
152
+ ];
153
+ ImageRegistryEdit.flags = {
154
+ help: core_1.Flags.help({ char: 'h' }),
155
+ registry: core_1.Flags.string({ char: 'r', required: false, description: "The Codiac code identifying the registry to edit (NOT its url). Run `cod imageRegistry list` to see codes." }),
156
+ url: core_1.Flags.string({ char: 'u', required: false, description: "The corrected container registry url." }),
157
+ private: core_1.Flags.boolean({ allowNo: true, description: 'Whether pulling from this registry requires authentication. Pass --private or --no-private only to change it; omit to leave it unchanged.' }),
158
+ silent: core_1.Flags.boolean({ exclusive: ["echo", "to-script"], description: 'Executes without any user interaction; fails on missing or invalid arguments.' }),
159
+ echo: core_1.Flags.boolean({ exclusive: ["to-script", "silent"], description: 'Renders the equivalent non-interactive command for future use before executing.' }),
160
+ "to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Renders the equivalent non-interactive command without executing it.' }),
161
+ };
162
+ ImageRegistryEdit.args = {};
163
+ //# sourceMappingURL=edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../src/commands/imageRegistry/edit.ts"],"names":[],"mappings":";;;AAAA,sCAA6C;AAE7C,+DAAyG;AAEzG,6EAAuE;AACvE,6CAA0C;AAC1C,2GAAgG;AAChG,+FAA0F;AAC1F,+FAA0F;AAC1F,6EAAyE;AACzE,uEAA+E;AAE/E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAqB,iBAAkB,SAAQ,gDAAoC;IAyBvE,SAAS;QACjB,KAAK,CAAC,SAAS,EAAE,CAAC;QAClB,2DAA2B,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,2DAA2B,CAAC,CAAC,MAAM,EAAE,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,0CAAmB,CAAC,CAAC,MAAM,EAAE,CAAC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AAC,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,+EAA+E,EAAE,CAAC;IACzJ,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,iFAAiF,EAAE,CAAC;IAC3J,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,sEAAsE,EAAE,CAAC;CACnJ,CAAC;AAEK,sBAAI,GAAG,EAAE,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Centralizes the license-clean, in-cluster-servable LLM catalog plus the BYO
3
+ * (bring-your-own OpenAI-compatible endpoint) option. Pure function — no `this`,
4
+ * no I/O, no `_ui`. Callers (silent and interactive install flows alike) use this
5
+ * as the single source of truth so the two flows cannot drift on the default
6
+ * Ollama tag, natural runtime tier, or license of a given model kind.
7
+ *
8
+ * Catalog policy (see plan 22, Global Constraints): Apache/MIT-first, and
9
+ * **never Llama** (its 700M-MAU cap makes it not license-clean for this product).
10
+ */
11
+ export type ModelKind = 'qwen3' | 'gpt-oss' | 'glm' | 'deepseek-r1' | 'byo';
12
+ export type RuntimeTier = 'cpu' | 'gpu';
13
+ export interface ModelSpec {
14
+ /** The catalog identifier the CLI/relay key everything off of. */
15
+ kind: ModelKind;
16
+ /** Ollama tag pulled + served for this catalog entry. Absent for `byo` — a BYO
17
+ * endpoint is registered, not served, so there is no image to pull. */
18
+ defaultTag?: string;
19
+ /** The sizing the served catalog picks by default: `cpu` for models that run
20
+ * acceptably CPU-only, `gpu` for models that really want an accelerator. */
21
+ runtimeTier: RuntimeTier;
22
+ /** True when the model is impractical CPU-only and effectively needs a GPU node
23
+ * pool — surfaced so the install flow can steer `--runtime gpu`. */
24
+ minGpu?: boolean;
25
+ /** SPDX-ish license identifier, or `"varies"` when it differs per tag
26
+ * (DeepSeek-R1 distills carry the license of their base model). */
27
+ license: string;
28
+ /** Whether this kind is installable in this slice. */
29
+ supported: boolean;
30
+ }
31
+ /**
32
+ * Resolves a catalog entry for a model kind. Mirrors `resolveFrameworkSpec`:
33
+ * throws for an unknown kind rather than returning an unsupported placeholder.
34
+ */
35
+ export declare function resolveModelSpec(kind: string): ModelSpec;
36
+ /** True when `kind` is a servable catalog model (excludes `byo`, which is
37
+ * registered via `--source byo`, not chosen from the served catalog). */
38
+ export declare function isServedModelKind(kind: string): boolean;
39
+ /** The served catalog kinds, in a stable order, for interactive model selection. */
40
+ export declare function supportedModelKinds(): Exclude<ModelKind, 'byo'>[];
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.supportedModelKinds = exports.isServedModelKind = exports.resolveModelSpec = void 0;
4
+ /** The served catalog (everything except `byo`), keyed by kind. */
5
+ const SERVED_CATALOG = {
6
+ 'qwen3': {
7
+ kind: 'qwen3',
8
+ defaultTag: 'qwen3:8b',
9
+ runtimeTier: 'cpu',
10
+ license: 'Apache-2.0',
11
+ supported: true,
12
+ },
13
+ 'gpt-oss': {
14
+ kind: 'gpt-oss',
15
+ defaultTag: 'gpt-oss:20b',
16
+ runtimeTier: 'gpu',
17
+ minGpu: true,
18
+ license: 'Apache-2.0',
19
+ supported: true,
20
+ },
21
+ 'glm': {
22
+ kind: 'glm',
23
+ defaultTag: 'glm4:9b',
24
+ runtimeTier: 'gpu',
25
+ minGpu: true,
26
+ license: 'MIT',
27
+ supported: true,
28
+ },
29
+ 'deepseek-r1': {
30
+ kind: 'deepseek-r1',
31
+ defaultTag: 'deepseek-r1:8b',
32
+ runtimeTier: 'cpu',
33
+ license: 'varies',
34
+ supported: true,
35
+ },
36
+ };
37
+ /** The BYO pseudo-kind: a registered OpenAI-compatible endpoint. No served tag,
38
+ * so runtime tier is not meaningful (defaulted to `cpu` purely to satisfy the
39
+ * shape — nothing is scheduled for a BYO model). */
40
+ const BYO_SPEC = {
41
+ kind: 'byo',
42
+ runtimeTier: 'cpu',
43
+ license: 'n/a',
44
+ supported: true,
45
+ };
46
+ /**
47
+ * Resolves a catalog entry for a model kind. Mirrors `resolveFrameworkSpec`:
48
+ * throws for an unknown kind rather than returning an unsupported placeholder.
49
+ */
50
+ function resolveModelSpec(kind) {
51
+ if (kind === 'byo')
52
+ return Object.assign({}, BYO_SPEC);
53
+ const spec = SERVED_CATALOG[kind];
54
+ if (spec == undefined)
55
+ throw new Error(`Unknown model kind: ${kind}`);
56
+ return Object.assign({}, spec);
57
+ }
58
+ exports.resolveModelSpec = resolveModelSpec;
59
+ /** True when `kind` is a servable catalog model (excludes `byo`, which is
60
+ * registered via `--source byo`, not chosen from the served catalog). */
61
+ function isServedModelKind(kind) {
62
+ return Object.prototype.hasOwnProperty.call(SERVED_CATALOG, kind);
63
+ }
64
+ exports.isServedModelKind = isServedModelKind;
65
+ /** The served catalog kinds, in a stable order, for interactive model selection. */
66
+ function supportedModelKinds() {
67
+ return Object.keys(SERVED_CATALOG)
68
+ .filter(k => SERVED_CATALOG[k].supported);
69
+ }
70
+ exports.supportedModelKinds = supportedModelKinds;
71
+ //# sourceMappingURL=model-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-spec.js","sourceRoot":"","sources":["../../src/uilogic/model-spec.ts"],"names":[],"mappings":";;;AAiCA,mEAAmE;AACnE,MAAM,cAAc,GAAiD;IACnE,OAAO,EAAE;QACP,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,UAAU;QACtB,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE,IAAI;KAChB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,SAAS;QACf,UAAU,EAAE,aAAa;QACzB,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE,IAAI;KAChB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,KAAK;QACX,UAAU,EAAE,SAAS;QACrB,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,IAAI;KAChB;IACD,aAAa,EAAE;QACb,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE,gBAAgB;QAC5B,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,QAAQ;QACjB,SAAS,EAAE,IAAI;KAChB;CACF,CAAC;AAEF;;qDAEqD;AACrD,MAAM,QAAQ,GAAc;IAC1B,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;CAChB,CAAC;AAEF;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,IAAI,IAAI,KAAK,KAAK;QAAE,yBAAY,QAAQ,EAAG;IAC3C,MAAM,IAAI,GAAI,cAA4C,CAAC,IAAI,CAAC,CAAC;IACjE,IAAI,IAAI,IAAI,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;IACtE,yBAAY,IAAI,EAAG;AACrB,CAAC;AALD,4CAKC;AAED;0EAC0E;AAC1E,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AACpE,CAAC;AAFD,8CAEC;AAED,oFAAoF;AACpF,SAAgB,mBAAmB;IACjC,OAAQ,MAAM,CAAC,IAAI,CAAC,cAAc,CAAiC;SAChE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAC9C,CAAC;AAHD,kDAGC"}
@@ -0,0 +1,21 @@
1
+ import { ImageRegistry } from '../apis/codiac-api/contracts';
2
+ /**
3
+ * Resolves an image registry from a pre-fetched list by its Codiac **code**, throwing a
4
+ * message that steers the user back on track when the lookup fails.
5
+ *
6
+ * WHY this exists: `-r`/`--registry` (and `--chart-repo`) match `ImageRegistry.code`
7
+ * (e.g. `devCodiacContainers`, `DockerHub|codiacimages`), NOT the registry URL. Users
8
+ * routinely paste the URL (`devcodiaccontainers.azurecr.io`) and get a bare "not found"
9
+ * that reads like the registry was never registered at all. When the miss looks like a
10
+ * pasted URL, we detect the registry it actually belongs to and name its code instead.
11
+ *
12
+ * Callers pass the full registry list (a single `readMany({ all: true })`) so the by-URL
13
+ * suggestion can be computed without a second round-trip.
14
+ *
15
+ * @param all Every registry reference for the tenant (from `ImageRegistry.readMany`).
16
+ * @param codeHint The value the user supplied to `--registry` / `--chart-repo`.
17
+ * @param flagLabel The flag name to name in the error (e.g. `--registry`, `--chart-repo`).
18
+ * @returns The matching `ImageRegistry`.
19
+ * @throws If no registry has that code (message suggests the right code when the hint is a URL).
20
+ */
21
+ export declare function resolveRegistryByCodeOrThrow(all: ImageRegistry[], codeHint: string, flagLabel: string): ImageRegistry;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveRegistryByCodeOrThrow = void 0;
4
+ /**
5
+ * Resolves an image registry from a pre-fetched list by its Codiac **code**, throwing a
6
+ * message that steers the user back on track when the lookup fails.
7
+ *
8
+ * WHY this exists: `-r`/`--registry` (and `--chart-repo`) match `ImageRegistry.code`
9
+ * (e.g. `devCodiacContainers`, `DockerHub|codiacimages`), NOT the registry URL. Users
10
+ * routinely paste the URL (`devcodiaccontainers.azurecr.io`) and get a bare "not found"
11
+ * that reads like the registry was never registered at all. When the miss looks like a
12
+ * pasted URL, we detect the registry it actually belongs to and name its code instead.
13
+ *
14
+ * Callers pass the full registry list (a single `readMany({ all: true })`) so the by-URL
15
+ * suggestion can be computed without a second round-trip.
16
+ *
17
+ * @param all Every registry reference for the tenant (from `ImageRegistry.readMany`).
18
+ * @param codeHint The value the user supplied to `--registry` / `--chart-repo`.
19
+ * @param flagLabel The flag name to name in the error (e.g. `--registry`, `--chart-repo`).
20
+ * @returns The matching `ImageRegistry`.
21
+ * @throws If no registry has that code (message suggests the right code when the hint is a URL).
22
+ */
23
+ function resolveRegistryByCodeOrThrow(all, codeHint, flagLabel) {
24
+ const found = (all !== null && all !== void 0 ? all : []).find(r => r.code === codeHint);
25
+ if (found)
26
+ return found;
27
+ // Miss. Did they paste a URL instead of a code? Match against known registry urls,
28
+ // tolerating a missing scheme (index.docker.io vs https://index.docker.io).
29
+ const bare = codeHint.replace(/^[a-z]+:\/\//i, "");
30
+ const byUrl = (all !== null && all !== void 0 ? all : []).find(r => {
31
+ var _a;
32
+ const rBare = ((_a = r.url) !== null && _a !== void 0 ? _a : "").replace(/^[a-z]+:\/\//i, "");
33
+ return r.url === codeHint || rBare === bare || (bare.length > 3 && rBare.includes(bare));
34
+ });
35
+ const lead = `No image registry has code [${codeHint}]. The ${flagLabel} flag takes the registry CODE, not its URL.`;
36
+ const tail = byUrl
37
+ ? ` That looks like a URL — did you mean code [${byUrl.code}] (its url is ${byUrl.url})?`
38
+ : ` Run \`cod imageRegistry list\` to see the available codes (e.g. 'devCodiacContainers', not 'devcodiaccontainers.azurecr.io').`;
39
+ throw new Error(lead + tail);
40
+ }
41
+ exports.resolveRegistryByCodeOrThrow = resolveRegistryByCodeOrThrow;
42
+ //# sourceMappingURL=registry-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-resolver.js","sourceRoot":"","sources":["../../src/uilogic/registry-resolver.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,4BAA4B,CAAC,GAAoB,EAAE,QAAgB,EAAE,SAAiB;IACpG,MAAM,KAAK,GAAG,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;IACzD,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IAExB,mF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