@codemieai/cdk 0.2.2-rc2 → 0.2.2
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 +45 -31
- package/dist/cli/index.js +144 -25
- package/dist/index.d.ts +2 -1
- package/dist/index.js +135 -16
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -78,13 +78,22 @@ The `.env` file is already added to `.gitignore` and should never be committed t
|
|
|
78
78
|
**Substitution in `codemie.yaml`:**
|
|
79
79
|
- `${VAR}` and `${VAR:-default}` are substituted in every string value of the configuration, including values nested inside lists such as `resources.skills` or `resources.datasources`.
|
|
80
80
|
- A `${VAR}` without a default whose variable is not set fails the load with an error naming the configuration path, for example `resources.datasources[0].name`. Use `${VAR:-default}` where a value is optional, or `${VAR:-}` to substitute an empty string.
|
|
81
|
-
-
|
|
81
|
+
- Escape a placeholder with an extra `$`: `$${VAR}` produces literal `${VAR}` without looking up the variable, even if it is set locally. This also preserves default expressions: `$${VAR:-default}` produces `${VAR:-default}`.
|
|
82
|
+
- Escaped placeholders and ordinary substitutions can appear in the same string. Substitution happens once; emitted placeholders and environment variable values are not expanded again. Dollar signs outside placeholder expressions are unchanged.
|
|
83
|
+
|
|
84
|
+
For example, an MCP server can receive a placeholder for CodeMie to resolve later, without requiring a local npm token:
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
config:
|
|
88
|
+
env:
|
|
89
|
+
NPM_TOKEN: '$${NPM_TOKEN}'
|
|
90
|
+
```
|
|
82
91
|
|
|
83
92
|
## Quick Start
|
|
84
93
|
|
|
85
94
|
```bash
|
|
86
95
|
# Initialize a new Codemie IaC project (creates .env and codemie.yaml via wizard)
|
|
87
|
-
codemie init
|
|
96
|
+
codemie-cdk init
|
|
88
97
|
|
|
89
98
|
# Full validation with API connectivity check (default, recommended)
|
|
90
99
|
npm run validate
|
|
@@ -112,12 +121,12 @@ npm run <command> --config codemie/iac.json
|
|
|
112
121
|
```
|
|
113
122
|
**Note:** All commands work identically whether you use monolithic configuration or modular imports - the `$import` directives are automatically resolved during config loading.
|
|
114
123
|
|
|
115
|
-
### Project Initialization (`codemie init`)
|
|
124
|
+
### Project Initialization (`codemie-cdk init`)
|
|
116
125
|
|
|
117
126
|
Use the interactive wizard to scaffold a project:
|
|
118
127
|
|
|
119
128
|
```bash
|
|
120
|
-
codemie init
|
|
129
|
+
codemie-cdk init
|
|
121
130
|
```
|
|
122
131
|
|
|
123
132
|
What it does:
|
|
@@ -165,57 +174,62 @@ It is not mandatory to provide all fields - any missing fields will use default
|
|
|
165
174
|
|
|
166
175
|
### CLI Usage
|
|
167
176
|
|
|
168
|
-
The tool provides a unified `codemie` command for all operations:
|
|
177
|
+
The tool provides a unified `codemie-cdk` command for all operations:
|
|
178
|
+
|
|
179
|
+
> **Renamed from `codemie`.** Earlier releases installed the command as `codemie`. That name is
|
|
180
|
+
> also used by the CodeMie agent CLI (`@codemieai/code`), so a global install of both packages
|
|
181
|
+
> made one overwrite the other. Replace `codemie <command>` with `codemie-cdk <command>` in your
|
|
182
|
+
> scripts and CI jobs.
|
|
169
183
|
|
|
170
184
|
```bash
|
|
171
185
|
# Show help and available commands
|
|
172
|
-
codemie --help
|
|
186
|
+
codemie-cdk --help
|
|
173
187
|
|
|
174
188
|
# Deploy resources
|
|
175
|
-
codemie deploy
|
|
176
|
-
codemie deploy --prune
|
|
177
|
-
codemie deploy --skip-datasources
|
|
189
|
+
codemie-cdk deploy
|
|
190
|
+
codemie-cdk deploy --prune
|
|
191
|
+
codemie-cdk deploy --skip-datasources
|
|
178
192
|
|
|
179
193
|
# Other commands
|
|
180
|
-
codemie backup
|
|
181
|
-
codemie destroy --force
|
|
182
|
-
codemie preview
|
|
183
|
-
codemie validate --check-api
|
|
194
|
+
codemie-cdk backup
|
|
195
|
+
codemie-cdk destroy --force
|
|
196
|
+
codemie-cdk preview
|
|
197
|
+
codemie-cdk validate --check-api
|
|
184
198
|
|
|
185
199
|
# Import a single resource from the Codemie platform
|
|
186
|
-
codemie import <type> <slug>
|
|
187
|
-
codemie import assistant my-assistant
|
|
188
|
-
codemie import workflow 11111111-1111-1111-1111-111111111111
|
|
189
|
-
codemie import assistant my-assistant --update # refresh an already-managed resource in place
|
|
190
|
-
codemie import assistant my-assistant --with-skills # also import the project-owned skills it references
|
|
200
|
+
codemie-cdk import <type> <slug>
|
|
201
|
+
codemie-cdk import assistant my-assistant
|
|
202
|
+
codemie-cdk import workflow 11111111-1111-1111-1111-111111111111
|
|
203
|
+
codemie-cdk import assistant my-assistant --update # refresh an already-managed resource in place
|
|
204
|
+
codemie-cdk import assistant my-assistant --with-skills # also import the project-owned skills it references
|
|
191
205
|
# <type> is one of: assistant, datasource, workflow, skill
|
|
192
206
|
# <slug> is a resource slug or name; for assistant and workflow it may also be a platform UUID
|
|
193
207
|
|
|
194
208
|
# Run a command from a subdirectory of the project, or against another project entirely
|
|
195
|
-
codemie validate --root-dir ../another-project
|
|
209
|
+
codemie-cdk validate --root-dir ../another-project
|
|
196
210
|
```
|
|
197
211
|
|
|
198
212
|
**`--with-skills` (assistants only).** An imported assistant references its skills by name, so a
|
|
199
213
|
deploy fails if one of those skills belongs to this project but is not in `resources.skills` yet.
|
|
200
214
|
With `--with-skills`, each referenced skill that the project owns and does not manage yet is
|
|
201
215
|
imported too - `skills/<name>.skill.md` plus a `resources.skills` entry, exactly as
|
|
202
|
-
`codemie import skill` would write it - so the assistant deploys with no manual skill import.
|
|
216
|
+
`codemie-cdk import skill` would write it - so the assistant deploys with no manual skill import.
|
|
203
217
|
Skills owned by other projects keep landing in `imported.skills` as references, and a skill the
|
|
204
218
|
configuration already names is left untouched (also under `--update`, which refreshes the
|
|
205
219
|
assistant only). On any other resource type the flag is ignored with a warning.
|
|
206
220
|
|
|
207
221
|
**Note:** Every command finds the project root automatically by walking up from the current
|
|
208
|
-
directory looking for `codemie.yaml`, so you can run `codemie` from any subdirectory of your
|
|
209
|
-
project. Pass `-d, --root-dir <path>` to point at a different project root instead. `codemie init`
|
|
222
|
+
directory looking for `codemie.yaml`, so you can run `codemie-cdk` from any subdirectory of your
|
|
223
|
+
project. Pass `-d, --root-dir <path>` to point at a different project root instead. `codemie-cdk init`
|
|
210
224
|
never auto-detects an existing project - it always scaffolds in the current directory unless
|
|
211
225
|
`-d` is given. `-c, --config` and `-d, --root-dir` are independent: a `-c` file wins only where it
|
|
212
226
|
declares `rootDir` itself, otherwise an explicit `-d` still applies.
|
|
213
227
|
|
|
214
228
|
**For local development**, npm scripts provide convenient shortcuts:
|
|
215
229
|
```bash
|
|
216
|
-
npm run deploy # → codemie deploy
|
|
217
|
-
npm run backup # → codemie backup
|
|
218
|
-
npm run destroy # → codemie destroy --force
|
|
230
|
+
npm run deploy # → codemie-cdk deploy
|
|
231
|
+
npm run backup # → codemie-cdk backup
|
|
232
|
+
npm run destroy # → codemie-cdk destroy --force
|
|
219
233
|
```
|
|
220
234
|
|
|
221
235
|
## 🔄 Migrating Existing Resources to IaC
|
|
@@ -858,17 +872,17 @@ Blank lines are ignored, and every other character is literal (the `.` in `file.
|
|
|
858
872
|
|
|
859
873
|
**Companion files are tracked in state by checksum.** `.codemie/state.json` records one content hash per companion file plus one aggregate checksum — never the file bodies. Adding, editing or removing a companion file therefore marks the skill as changed in `preview` (which names the files added, removed and modified) and triggers an update in `deploy`, even when `SKILL.md` itself is untouched. Removing the last companion file clears the skill's companion files on the platform. When state cannot say what the platform holds — a skill recovered by name after an "already exists" create, or a state entry written before companion files were tracked — the platform's own list is read first, so stale companions are cleared rather than left behind.
|
|
860
874
|
|
|
861
|
-
**`backup` and `import` keep the layout.** For a skill that has companion files, `codemie backup` writes `skills/<name>/SKILL.md` with the companion files beside it under their original relative paths, decoding base64 ones back to bytes; a skill with no companion files keeps the flat `skills/<name>.skill.md` layout (content files are written for project-owned skills only). `codemie import` fetches a skill's companion files as well and writes those same two layouts, so a backed-up or imported skill redeploys with its companions intact.
|
|
875
|
+
**`backup` and `import` keep the layout.** For a skill that has companion files, `codemie-cdk backup` writes `skills/<name>/SKILL.md` with the companion files beside it under their original relative paths, decoding base64 ones back to bytes; a skill with no companion files keeps the flat `skills/<name>.skill.md` layout (content files are written for project-owned skills only). `codemie-cdk import` fetches a skill's companion files as well and writes those same two layouts, so a backed-up or imported skill redeploys with its companions intact.
|
|
862
876
|
|
|
863
877
|
**A failed companion lookup never touches the platform's files.** When that lookup cannot be answered — a timeout, a server error, or a platform without the companion-files endpoint — `deploy` warns, naming the skill and the reason, and updates the skill without the `companion_files` field, leaving whatever the platform holds untouched instead of failing the skill.
|
|
864
878
|
|
|
865
|
-
**Only the `SKILL.md` layout manages companion files.** If a managed entry points at a flat `skills/<name>.skill.md` while the platform skill has companion files, `codemie import --update` refreshes the content file, warns, and deliberately records no companion hashes in state: those files stay on the platform, unmanaged locally. Point the entry at a `skills/<name>/SKILL.md` layout to manage them.
|
|
879
|
+
**Only the `SKILL.md` layout manages companion files.** If a managed entry points at a flat `skills/<name>.skill.md` while the platform skill has companion files, `codemie-cdk import --update` refreshes the content file, warns, and deliberately records no companion hashes in state: those files stay on the platform, unmanaged locally. Point the entry at a `skills/<name>/SKILL.md` layout to manage them.
|
|
866
880
|
|
|
867
881
|
#### Description Length Validation
|
|
868
882
|
|
|
869
883
|
**Behavior change:** a skill description outside **10-1000 characters** now fails locally — in `validate`, `preview` and `deploy` — naming the skill, its actual length and the allowed range. Previously an out-of-range description reached the platform and failed there with an opaque API error. There is no placeholder description and no truncation: an out-of-range description is always an error, for both shapes above.
|
|
870
884
|
|
|
871
|
-
Running `codemie validate --check-api` additionally checks each skill's *content* length against the platform's own configured limits, which are read live from the API rather than hard-coded in the CLI.
|
|
885
|
+
Running `codemie-cdk validate --check-api` additionally checks each skill's *content* length against the platform's own configured limits, which are read live from the API rather than hard-coded in the CLI.
|
|
872
886
|
|
|
873
887
|
#### Replacing a Whole Skill Group (`--replace-skill-group`)
|
|
874
888
|
|
|
@@ -876,10 +890,10 @@ Some skill sets are regenerated as a whole — a large skill split differently,
|
|
|
876
890
|
|
|
877
891
|
```bash
|
|
878
892
|
# See what would happen first
|
|
879
|
-
codemie preview --replace-skill-group github-copilot
|
|
893
|
+
codemie-cdk preview --replace-skill-group github-copilot
|
|
880
894
|
|
|
881
895
|
# Then run it (the confirmation flag is mandatory)
|
|
882
|
-
codemie deploy --replace-skill-group github-copilot --yes-replace-skills
|
|
896
|
+
codemie-cdk deploy --replace-skill-group github-copilot --yes-replace-skills
|
|
883
897
|
```
|
|
884
898
|
|
|
885
899
|
**Group membership comes only from the `group` field** — the label persisted in `.codemie/state.json` or the one on the `resources.skills` entry (including a `group` inherited from a `source_dir` entry). Skill names are never pattern-matched against the group name: a skill called `github-copilot--body-1` is not part of the group unless it carries the label.
|
|
@@ -976,7 +990,7 @@ Changes to prompts and configuration are detected via SHA256 checksums, ensuring
|
|
|
976
990
|
|
|
977
991
|
After upgrading to the release that normalizes MCP configuration, MCP server configuration is normalized before it is hashed: keys with no value (`null`) and an empty top-level `mcp_connect_url` no longer contribute to the hash, and the remaining keys are hashed in a fixed order at every depth, so the order the platform or your YAML uses for MCP fields never affects the checksum. Every assistant that has `mcp_servers` therefore gets a new `configChecksum` once - and only once.
|
|
978
992
|
|
|
979
|
-
The first `npm run preview` (or `codemie preview`) and `npm run deploy` after the upgrade list each such assistant under `⚠️ UPDATE:` as `- assistant:<name>` followed by `Prompt or configuration changed`, with no per-field diff. This is expected and is not a configuration error - nothing in your `codemie.yaml` changed. `deploy` writes the new `configChecksum` back to `.codemie/state.json`, and the second run reports the same assistants as unchanged.
|
|
993
|
+
The first `npm run preview` (or `codemie-cdk preview`) and `npm run deploy` after the upgrade list each such assistant under `⚠️ UPDATE:` as `- assistant:<name>` followed by `Prompt or configuration changed`, with no per-field diff. This is expected and is not a configuration error - nothing in your `codemie.yaml` changed. `deploy` writes the new `configChecksum` back to `.codemie/state.json`, and the second run reports the same assistants as unchanged.
|
|
980
994
|
|
|
981
995
|
### Orphaned Resource Cleanup
|
|
982
996
|
|
package/dist/cli/index.js
CHANGED
|
@@ -1309,7 +1309,7 @@ var init_backupTransformers = __esm({
|
|
|
1309
1309
|
|
|
1310
1310
|
// package.json
|
|
1311
1311
|
var package_default = {
|
|
1312
|
-
version: "0.2.2
|
|
1312
|
+
version: "0.2.2"};
|
|
1313
1313
|
var appConfigSchema = z.object({
|
|
1314
1314
|
rootDir: z.string(),
|
|
1315
1315
|
codemieConfig: z.string(),
|
|
@@ -2485,6 +2485,7 @@ var CodemieConfigLoader = class {
|
|
|
2485
2485
|
/**
|
|
2486
2486
|
* Substitute environment variables in configuration
|
|
2487
2487
|
* Supports syntax:
|
|
2488
|
+
* - $${VAR_NAME} - literal placeholder (not read from the environment)
|
|
2488
2489
|
* - ${VAR_NAME} - required variable (throws if not set)
|
|
2489
2490
|
* - ${VAR_NAME:-default} - optional with default value (shell-style)
|
|
2490
2491
|
* - ${VAR_NAME:default} - optional with default value (simplified)
|
|
@@ -2496,8 +2497,11 @@ var CodemieConfigLoader = class {
|
|
|
2496
2497
|
const childPath = isArray ? `${configPath}[${key}]` : configPath ? `${configPath}.${key}` : key;
|
|
2497
2498
|
if (typeof obj[key] === "string") {
|
|
2498
2499
|
obj[key] = obj[key].replaceAll(
|
|
2499
|
-
|
|
2500
|
-
(match, varName, defaultValue) => {
|
|
2500
|
+
/\$(\$)?\{([^:}]+)(?::-?([^}]*))?\}/g,
|
|
2501
|
+
(match, escaped, varName, defaultValue) => {
|
|
2502
|
+
if (escaped) {
|
|
2503
|
+
return match.slice(1);
|
|
2504
|
+
}
|
|
2501
2505
|
const value = process.env[varName];
|
|
2502
2506
|
if (value === void 0) {
|
|
2503
2507
|
if (defaultValue !== void 0) {
|
|
@@ -3036,23 +3040,47 @@ async function main(options) {
|
|
|
3036
3040
|
|
|
3037
3041
|
// src/lib/apiErrorLogger.ts
|
|
3038
3042
|
init_logger();
|
|
3043
|
+
function diagnosticJson(value) {
|
|
3044
|
+
return JSON.stringify(
|
|
3045
|
+
value,
|
|
3046
|
+
(key, entry) => /authorization|cookie|password|passwd|secret|api[_-]?key|access[_-]?token|refresh[_-]?token/i.test(key) ? "[REDACTED]" : entry,
|
|
3047
|
+
2
|
|
3048
|
+
);
|
|
3049
|
+
}
|
|
3039
3050
|
function logApiErrorDetails(error) {
|
|
3040
3051
|
if (error instanceof Error) {
|
|
3041
3052
|
logger.error(` ${error.message}`);
|
|
3042
3053
|
logger.debug(` Stack:`, error.stack);
|
|
3043
3054
|
if ("statusCode" in error) {
|
|
3044
|
-
|
|
3045
|
-
|
|
3055
|
+
if (error.statusCode !== void 0) {
|
|
3056
|
+
logger.error(` Status: ${String(error.statusCode)}`);
|
|
3057
|
+
}
|
|
3058
|
+
logger.error(` Data: ${diagnosticJson("response" in error ? error.response : void 0)}`);
|
|
3059
|
+
if ("request" in error && typeof error.request === "object" && error.request !== null) {
|
|
3060
|
+
const request = error.request;
|
|
3061
|
+
if (typeof request.method === "string" && typeof request.path === "string") {
|
|
3062
|
+
logger.error(` Request: ${request.method} ${request.path}`);
|
|
3063
|
+
}
|
|
3064
|
+
if (typeof request.requestId === "string") {
|
|
3065
|
+
logger.error(` Request ID: ${request.requestId}`);
|
|
3066
|
+
}
|
|
3067
|
+
if (typeof request.code === "string") {
|
|
3068
|
+
logger.error(` Code: ${request.code}`);
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3046
3071
|
} else if ("response" in error) {
|
|
3047
3072
|
const axiosError = error;
|
|
3048
3073
|
logger.error(` Status: ${axiosError.response?.status}`);
|
|
3049
|
-
logger.error(` Data: ${
|
|
3074
|
+
logger.error(` Data: ${diagnosticJson(axiosError.response?.data)}`);
|
|
3050
3075
|
}
|
|
3051
3076
|
} else {
|
|
3052
3077
|
logger.error(` ${String(error)}`);
|
|
3053
3078
|
}
|
|
3054
3079
|
}
|
|
3055
3080
|
|
|
3081
|
+
// src/lib/assistantHelpers.ts
|
|
3082
|
+
init_logger();
|
|
3083
|
+
|
|
3056
3084
|
// src/lib/paginationUtils.ts
|
|
3057
3085
|
init_logger();
|
|
3058
3086
|
async function findResourceByName(listFn, name, resourceType, options) {
|
|
@@ -3200,18 +3228,97 @@ function findSkillByName(index, name) {
|
|
|
3200
3228
|
}
|
|
3201
3229
|
|
|
3202
3230
|
// src/lib/assistantHelpers.ts
|
|
3231
|
+
var ASSISTANT_LOOKUP_RETRY_DELAYS_MS = [250, 500, 1e3, 2e3, 2e3];
|
|
3232
|
+
function isRecord(value) {
|
|
3233
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3234
|
+
}
|
|
3235
|
+
var AssistantValidationError = class extends Error {
|
|
3236
|
+
constructor(operation, assistantName, response) {
|
|
3237
|
+
const message = isRecord(response) ? validationMessage(response) : "Missing integrations";
|
|
3238
|
+
super(`Assistant ${operation} validation failed for "${assistantName}": ${message}`);
|
|
3239
|
+
this.response = response;
|
|
3240
|
+
this.name = "AssistantValidationError";
|
|
3241
|
+
}
|
|
3242
|
+
response;
|
|
3243
|
+
statusCode = 200;
|
|
3244
|
+
};
|
|
3245
|
+
function hasMissingIntegrations(response) {
|
|
3246
|
+
return isRecord(response) && isRecord(response.validation) && response.validation.has_missing_integrations === true;
|
|
3247
|
+
}
|
|
3248
|
+
function validationMessage(response) {
|
|
3249
|
+
const validation = isRecord(response.validation) ? response.validation : {};
|
|
3250
|
+
return typeof validation.message === "string" ? validation.message : "Missing integrations";
|
|
3251
|
+
}
|
|
3252
|
+
function warnOnMissingIntegrations(response, assistantName) {
|
|
3253
|
+
if (hasMissingIntegrations(response)) {
|
|
3254
|
+
logger.warn(` \u26A0\uFE0F Assistant "${assistantName}" saved with missing integrations: ${validationMessage(response)}`);
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
function extractAssistantId(response) {
|
|
3258
|
+
if (!isRecord(response)) {
|
|
3259
|
+
return null;
|
|
3260
|
+
}
|
|
3261
|
+
for (const key of ["assistant_id", "assistantId", "id"]) {
|
|
3262
|
+
const id = response[key];
|
|
3263
|
+
if (typeof id === "string" && id.trim().length > 0) {
|
|
3264
|
+
return id.trim();
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
return null;
|
|
3268
|
+
}
|
|
3269
|
+
function shouldRecoverAssistantCreateError(error) {
|
|
3270
|
+
if (error instanceof AssistantValidationError) {
|
|
3271
|
+
return false;
|
|
3272
|
+
}
|
|
3273
|
+
if (isRecord(error) && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500) {
|
|
3274
|
+
return error.statusCode === 409 || error instanceof Error && /already exists/i.test(error.message);
|
|
3275
|
+
}
|
|
3276
|
+
return true;
|
|
3277
|
+
}
|
|
3278
|
+
async function findAssistantIdWithRetry(lookup) {
|
|
3279
|
+
for (let attempt = 0; attempt <= ASSISTANT_LOOKUP_RETRY_DELAYS_MS.length; attempt++) {
|
|
3280
|
+
try {
|
|
3281
|
+
const id = await lookup();
|
|
3282
|
+
if (id) {
|
|
3283
|
+
return id;
|
|
3284
|
+
}
|
|
3285
|
+
} catch (error) {
|
|
3286
|
+
if (!isRecord(error) || error.statusCode !== 404) {
|
|
3287
|
+
throw error;
|
|
3288
|
+
}
|
|
3289
|
+
}
|
|
3290
|
+
const delay = ASSISTANT_LOOKUP_RETRY_DELAYS_MS[attempt];
|
|
3291
|
+
if (delay !== void 0) {
|
|
3292
|
+
await new Promise((resolve7) => setTimeout(resolve7, delay));
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
return null;
|
|
3296
|
+
}
|
|
3203
3297
|
async function createAssistantAndGetId(client, params, slug) {
|
|
3204
|
-
await client.assistants.create(params);
|
|
3298
|
+
const response = await client.assistants.create(params);
|
|
3299
|
+
const returnedId = extractAssistantId(response);
|
|
3300
|
+
if (hasMissingIntegrations(response)) {
|
|
3301
|
+
if (!returnedId) {
|
|
3302
|
+
throw new AssistantValidationError("create", params.name, response);
|
|
3303
|
+
}
|
|
3304
|
+
warnOnMissingIntegrations(response, params.name);
|
|
3305
|
+
}
|
|
3306
|
+
if (returnedId) {
|
|
3307
|
+
return returnedId;
|
|
3308
|
+
}
|
|
3205
3309
|
if (slug) {
|
|
3206
|
-
const
|
|
3207
|
-
|
|
3310
|
+
const id = await findAssistantIdWithRetry(async () => {
|
|
3311
|
+
const created = await client.assistants.getBySlug(slug);
|
|
3312
|
+
return created?.id || null;
|
|
3313
|
+
});
|
|
3314
|
+
if (!id) {
|
|
3208
3315
|
throw new Error(`Assistant created but not found by slug: ${slug}`);
|
|
3209
3316
|
}
|
|
3210
|
-
return
|
|
3317
|
+
return id;
|
|
3211
3318
|
}
|
|
3212
|
-
const assistantId = await
|
|
3213
|
-
isGlobal: params.is_global === true
|
|
3214
|
-
|
|
3319
|
+
const assistantId = await findAssistantIdWithRetry(
|
|
3320
|
+
() => findAssistantByName(client, params.name, { isGlobal: params.is_global === true })
|
|
3321
|
+
);
|
|
3215
3322
|
if (!assistantId) {
|
|
3216
3323
|
throw new Error(`Assistant created but not found by name: ${params.name}`);
|
|
3217
3324
|
}
|
|
@@ -3235,6 +3342,9 @@ var CleanupManager = class {
|
|
|
3235
3342
|
* Handles both proper 404 responses
|
|
3236
3343
|
*/
|
|
3237
3344
|
isNotFoundError(error) {
|
|
3345
|
+
if (typeof error === "object" && error !== null && "statusCode" in error && typeof error.statusCode === "number") {
|
|
3346
|
+
return error.statusCode === 404;
|
|
3347
|
+
}
|
|
3238
3348
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
3239
3349
|
if (errorMessage.includes("404") || errorMessage.includes("not found") || errorMessage.includes("Not Found")) {
|
|
3240
3350
|
return true;
|
|
@@ -4030,7 +4140,8 @@ async function deployAssistants(config, client, loader, stateManager) {
|
|
|
4030
4140
|
logger.debug(JSON.stringify(apiParams, null, 2));
|
|
4031
4141
|
logger.debug("================================\n");
|
|
4032
4142
|
}
|
|
4033
|
-
await client.assistants.update(existingState.id, apiParams);
|
|
4143
|
+
const updateResponse = await client.assistants.update(existingState.id, apiParams);
|
|
4144
|
+
warnOnMissingIntegrations(updateResponse, assistant.name);
|
|
4034
4145
|
logger.info(`\u2713 Updated assistant: ${assistant.name} (${existingState.id})`);
|
|
4035
4146
|
stateManager.updateAssistantState(assistant.name, existingState.id, promptContent, assistant, buildConfig);
|
|
4036
4147
|
deployedAssistantId = existingState.id;
|
|
@@ -4054,6 +4165,9 @@ async function deployAssistants(config, client, loader, stateManager) {
|
|
|
4054
4165
|
logger.info(`\u2713 Created assistant: ${assistant.name} (${assistantId})`);
|
|
4055
4166
|
stats.created++;
|
|
4056
4167
|
} catch (createError) {
|
|
4168
|
+
if (!shouldRecoverAssistantCreateError(createError)) {
|
|
4169
|
+
throw createError;
|
|
4170
|
+
}
|
|
4057
4171
|
logger.warn(` \u26A0\uFE0F Assistant create failed. Checking if it already exists on platform...`);
|
|
4058
4172
|
let existingId = null;
|
|
4059
4173
|
if (assistant.slug) {
|
|
@@ -4072,7 +4186,8 @@ async function deployAssistants(config, client, loader, stateManager) {
|
|
|
4072
4186
|
throw createError;
|
|
4073
4187
|
}
|
|
4074
4188
|
logger.info(` Found existing assistant ID: ${existingId}. Updating...`);
|
|
4075
|
-
await client.assistants.update(existingId, apiParams);
|
|
4189
|
+
const updateResponse = await client.assistants.update(existingId, apiParams);
|
|
4190
|
+
warnOnMissingIntegrations(updateResponse, assistant.name);
|
|
4076
4191
|
assistantId = existingId;
|
|
4077
4192
|
logger.info(`\u2713 Recovered and updated assistant: ${assistant.name} (${assistantId})`);
|
|
4078
4193
|
stats.updated++;
|
|
@@ -4093,6 +4208,9 @@ async function deployAssistants(config, client, loader, stateManager) {
|
|
|
4093
4208
|
logger.info(`\u2713 Created assistant: ${assistant.name} (${assistantId})`);
|
|
4094
4209
|
stats.created++;
|
|
4095
4210
|
} catch (createError) {
|
|
4211
|
+
if (!shouldRecoverAssistantCreateError(createError)) {
|
|
4212
|
+
throw createError;
|
|
4213
|
+
}
|
|
4096
4214
|
logger.warn(` \u26A0\uFE0F Assistant create failed. Checking if it already exists on platform...`);
|
|
4097
4215
|
let existingId = null;
|
|
4098
4216
|
if (assistant.slug) {
|
|
@@ -4111,7 +4229,8 @@ async function deployAssistants(config, client, loader, stateManager) {
|
|
|
4111
4229
|
throw createError;
|
|
4112
4230
|
}
|
|
4113
4231
|
logger.info(` Found existing assistant ID: ${existingId}. Updating...`);
|
|
4114
|
-
await client.assistants.update(existingId, apiParams);
|
|
4232
|
+
const updateResponse = await client.assistants.update(existingId, apiParams);
|
|
4233
|
+
warnOnMissingIntegrations(updateResponse, assistant.name);
|
|
4115
4234
|
assistantId = existingId;
|
|
4116
4235
|
logger.info(`\u2713 Recovered and updated assistant: ${assistant.name} (${assistantId})`);
|
|
4117
4236
|
stats.updated++;
|
|
@@ -5577,7 +5696,7 @@ async function importResource(options) {
|
|
|
5577
5696
|
const managedSkillName = findManagedNameById(stateManager, "skill", skill.id);
|
|
5578
5697
|
if (managedSkillName !== void 0) {
|
|
5579
5698
|
logger.warn(
|
|
5580
|
-
` \u26A0\uFE0F Skill "${skill.name}" is already managed under the name "${managedSkillName}" \u2014 not imported. Run \`codemie import skill ${skill.id} --update\` to refresh it.`
|
|
5699
|
+
` \u26A0\uFE0F Skill "${skill.name}" is already managed under the name "${managedSkillName}" \u2014 not imported. Run \`codemie-cdk import skill ${skill.id} --update\` to refresh it.`
|
|
5581
5700
|
);
|
|
5582
5701
|
continue;
|
|
5583
5702
|
}
|
|
@@ -5794,11 +5913,11 @@ async function saveConfigFile(config, defaultFilename = "config.json") {
|
|
|
5794
5913
|
}
|
|
5795
5914
|
function suggestConfigUsage(configFileName) {
|
|
5796
5915
|
logger.info("\n\u{1F4CB} To use this configuration with other commands, add the `-c` flag:\n");
|
|
5797
|
-
logger.info(` codemie deploy -c ${configFileName}`);
|
|
5798
|
-
logger.info(` codemie validate -c ${configFileName}`);
|
|
5799
|
-
logger.info(` codemie preview -c ${configFileName}`);
|
|
5800
|
-
logger.info(` codemie backup -c ${configFileName}`);
|
|
5801
|
-
logger.info(` codemie destroy -c ${configFileName}
|
|
5916
|
+
logger.info(` codemie-cdk deploy -c ${configFileName}`);
|
|
5917
|
+
logger.info(` codemie-cdk validate -c ${configFileName}`);
|
|
5918
|
+
logger.info(` codemie-cdk preview -c ${configFileName}`);
|
|
5919
|
+
logger.info(` codemie-cdk backup -c ${configFileName}`);
|
|
5920
|
+
logger.info(` codemie-cdk destroy -c ${configFileName}
|
|
5802
5921
|
`);
|
|
5803
5922
|
}
|
|
5804
5923
|
|
|
@@ -5880,8 +5999,8 @@ async function initProject(options) {
|
|
|
5880
5999
|
logger.info("Next steps:");
|
|
5881
6000
|
logger.info(" 1. Edit .env and add your Codemie API credentials");
|
|
5882
6001
|
logger.info(` 2. Edit ${appConfig.codemieConfig} and add your resources`);
|
|
5883
|
-
logger.info(' 3. Run "codemie validate" to check your configuration');
|
|
5884
|
-
logger.info(' 4. Run "codemie deploy" to deploy your resources\n');
|
|
6002
|
+
logger.info(' 3. Run "codemie-cdk validate" to check your configuration');
|
|
6003
|
+
logger.info(' 4. Run "codemie-cdk deploy" to deploy your resources\n');
|
|
5885
6004
|
if (configFileName) {
|
|
5886
6005
|
suggestConfigUsage(configFileName);
|
|
5887
6006
|
}
|
|
@@ -6648,7 +6767,7 @@ async function main7(options) {
|
|
|
6648
6767
|
}
|
|
6649
6768
|
|
|
6650
6769
|
// src/cli/index.ts
|
|
6651
|
-
program.name("codemie").description("Infrastructure as Code for Codemie platform").version(package_default.version);
|
|
6770
|
+
program.name("codemie-cdk").description("Infrastructure as Code for Codemie platform").version(package_default.version);
|
|
6652
6771
|
program.command("init").description("Initialize a new Codemie IaC project").option("-d, --root-dir <path>", "Project root directory (containing codemie.yaml)").action((options) => {
|
|
6653
6772
|
const rootDir = options.rootDir ? path13__default.resolve(options.rootDir) : void 0;
|
|
6654
6773
|
const appConfig = loadAppConfig(void 0, rootDir ?? process.cwd());
|
package/dist/index.d.ts
CHANGED
|
@@ -373,6 +373,7 @@ declare class CodemieConfigLoader {
|
|
|
373
373
|
/**
|
|
374
374
|
* Substitute environment variables in configuration
|
|
375
375
|
* Supports syntax:
|
|
376
|
+
* - $${VAR_NAME} - literal placeholder (not read from the environment)
|
|
376
377
|
* - ${VAR_NAME} - required variable (throws if not set)
|
|
377
378
|
* - ${VAR_NAME:-default} - optional with default value (shell-style)
|
|
378
379
|
* - ${VAR_NAME:default} - optional with default value (simplified)
|
|
@@ -632,7 +633,7 @@ declare function backupResources(options: {
|
|
|
632
633
|
}): Promise<void>;
|
|
633
634
|
|
|
634
635
|
/**
|
|
635
|
-
* The resource kinds `codemie import` knows how to import from the platform.
|
|
636
|
+
* The resource kinds `codemie-cdk import` knows how to import from the platform.
|
|
636
637
|
*/
|
|
637
638
|
type ImportResourceType = 'assistant' | 'datasource' | 'workflow' | 'skill';
|
|
638
639
|
|
package/dist/index.js
CHANGED
|
@@ -1916,6 +1916,7 @@ var CodemieConfigLoader = class {
|
|
|
1916
1916
|
/**
|
|
1917
1917
|
* Substitute environment variables in configuration
|
|
1918
1918
|
* Supports syntax:
|
|
1919
|
+
* - $${VAR_NAME} - literal placeholder (not read from the environment)
|
|
1919
1920
|
* - ${VAR_NAME} - required variable (throws if not set)
|
|
1920
1921
|
* - ${VAR_NAME:-default} - optional with default value (shell-style)
|
|
1921
1922
|
* - ${VAR_NAME:default} - optional with default value (simplified)
|
|
@@ -1927,8 +1928,11 @@ var CodemieConfigLoader = class {
|
|
|
1927
1928
|
const childPath = isArray ? `${configPath}[${key}]` : configPath ? `${configPath}.${key}` : key;
|
|
1928
1929
|
if (typeof obj[key] === "string") {
|
|
1929
1930
|
obj[key] = obj[key].replaceAll(
|
|
1930
|
-
|
|
1931
|
-
(match, varName, defaultValue) => {
|
|
1931
|
+
/\$(\$)?\{([^:}]+)(?::-?([^}]*))?\}/g,
|
|
1932
|
+
(match, escaped, varName, defaultValue) => {
|
|
1933
|
+
if (escaped) {
|
|
1934
|
+
return match.slice(1);
|
|
1935
|
+
}
|
|
1932
1936
|
const value = process.env[varName];
|
|
1933
1937
|
if (value === void 0) {
|
|
1934
1938
|
if (defaultValue !== void 0) {
|
|
@@ -2239,6 +2243,9 @@ var CleanupManager = class {
|
|
|
2239
2243
|
* Handles both proper 404 responses
|
|
2240
2244
|
*/
|
|
2241
2245
|
isNotFoundError(error) {
|
|
2246
|
+
if (typeof error === "object" && error !== null && "statusCode" in error && typeof error.statusCode === "number") {
|
|
2247
|
+
return error.statusCode === 404;
|
|
2248
|
+
}
|
|
2242
2249
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
2243
2250
|
if (errorMessage.includes("404") || errorMessage.includes("not found") || errorMessage.includes("Not Found")) {
|
|
2244
2251
|
return true;
|
|
@@ -2428,23 +2435,47 @@ init_logger();
|
|
|
2428
2435
|
|
|
2429
2436
|
// src/lib/apiErrorLogger.ts
|
|
2430
2437
|
init_logger();
|
|
2438
|
+
function diagnosticJson(value) {
|
|
2439
|
+
return JSON.stringify(
|
|
2440
|
+
value,
|
|
2441
|
+
(key, entry) => /authorization|cookie|password|passwd|secret|api[_-]?key|access[_-]?token|refresh[_-]?token/i.test(key) ? "[REDACTED]" : entry,
|
|
2442
|
+
2
|
|
2443
|
+
);
|
|
2444
|
+
}
|
|
2431
2445
|
function logApiErrorDetails(error) {
|
|
2432
2446
|
if (error instanceof Error) {
|
|
2433
2447
|
logger.error(` ${error.message}`);
|
|
2434
2448
|
logger.debug(` Stack:`, error.stack);
|
|
2435
2449
|
if ("statusCode" in error) {
|
|
2436
|
-
|
|
2437
|
-
|
|
2450
|
+
if (error.statusCode !== void 0) {
|
|
2451
|
+
logger.error(` Status: ${String(error.statusCode)}`);
|
|
2452
|
+
}
|
|
2453
|
+
logger.error(` Data: ${diagnosticJson("response" in error ? error.response : void 0)}`);
|
|
2454
|
+
if ("request" in error && typeof error.request === "object" && error.request !== null) {
|
|
2455
|
+
const request = error.request;
|
|
2456
|
+
if (typeof request.method === "string" && typeof request.path === "string") {
|
|
2457
|
+
logger.error(` Request: ${request.method} ${request.path}`);
|
|
2458
|
+
}
|
|
2459
|
+
if (typeof request.requestId === "string") {
|
|
2460
|
+
logger.error(` Request ID: ${request.requestId}`);
|
|
2461
|
+
}
|
|
2462
|
+
if (typeof request.code === "string") {
|
|
2463
|
+
logger.error(` Code: ${request.code}`);
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2438
2466
|
} else if ("response" in error) {
|
|
2439
2467
|
const axiosError = error;
|
|
2440
2468
|
logger.error(` Status: ${axiosError.response?.status}`);
|
|
2441
|
-
logger.error(` Data: ${
|
|
2469
|
+
logger.error(` Data: ${diagnosticJson(axiosError.response?.data)}`);
|
|
2442
2470
|
}
|
|
2443
2471
|
} else {
|
|
2444
2472
|
logger.error(` ${String(error)}`);
|
|
2445
2473
|
}
|
|
2446
2474
|
}
|
|
2447
2475
|
|
|
2476
|
+
// src/lib/assistantHelpers.ts
|
|
2477
|
+
init_logger();
|
|
2478
|
+
|
|
2448
2479
|
// src/lib/paginationUtils.ts
|
|
2449
2480
|
init_logger();
|
|
2450
2481
|
async function findResourceByName(listFn, name, resourceType, options) {
|
|
@@ -2592,18 +2623,97 @@ function findSkillByName(index, name) {
|
|
|
2592
2623
|
}
|
|
2593
2624
|
|
|
2594
2625
|
// src/lib/assistantHelpers.ts
|
|
2626
|
+
var ASSISTANT_LOOKUP_RETRY_DELAYS_MS = [250, 500, 1e3, 2e3, 2e3];
|
|
2627
|
+
function isRecord(value) {
|
|
2628
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2629
|
+
}
|
|
2630
|
+
var AssistantValidationError = class extends Error {
|
|
2631
|
+
constructor(operation, assistantName, response) {
|
|
2632
|
+
const message = isRecord(response) ? validationMessage(response) : "Missing integrations";
|
|
2633
|
+
super(`Assistant ${operation} validation failed for "${assistantName}": ${message}`);
|
|
2634
|
+
this.response = response;
|
|
2635
|
+
this.name = "AssistantValidationError";
|
|
2636
|
+
}
|
|
2637
|
+
response;
|
|
2638
|
+
statusCode = 200;
|
|
2639
|
+
};
|
|
2640
|
+
function hasMissingIntegrations(response) {
|
|
2641
|
+
return isRecord(response) && isRecord(response.validation) && response.validation.has_missing_integrations === true;
|
|
2642
|
+
}
|
|
2643
|
+
function validationMessage(response) {
|
|
2644
|
+
const validation = isRecord(response.validation) ? response.validation : {};
|
|
2645
|
+
return typeof validation.message === "string" ? validation.message : "Missing integrations";
|
|
2646
|
+
}
|
|
2647
|
+
function warnOnMissingIntegrations(response, assistantName) {
|
|
2648
|
+
if (hasMissingIntegrations(response)) {
|
|
2649
|
+
logger.warn(` \u26A0\uFE0F Assistant "${assistantName}" saved with missing integrations: ${validationMessage(response)}`);
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
function extractAssistantId(response) {
|
|
2653
|
+
if (!isRecord(response)) {
|
|
2654
|
+
return null;
|
|
2655
|
+
}
|
|
2656
|
+
for (const key of ["assistant_id", "assistantId", "id"]) {
|
|
2657
|
+
const id = response[key];
|
|
2658
|
+
if (typeof id === "string" && id.trim().length > 0) {
|
|
2659
|
+
return id.trim();
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
return null;
|
|
2663
|
+
}
|
|
2664
|
+
function shouldRecoverAssistantCreateError(error) {
|
|
2665
|
+
if (error instanceof AssistantValidationError) {
|
|
2666
|
+
return false;
|
|
2667
|
+
}
|
|
2668
|
+
if (isRecord(error) && typeof error.statusCode === "number" && error.statusCode >= 400 && error.statusCode < 500) {
|
|
2669
|
+
return error.statusCode === 409 || error instanceof Error && /already exists/i.test(error.message);
|
|
2670
|
+
}
|
|
2671
|
+
return true;
|
|
2672
|
+
}
|
|
2673
|
+
async function findAssistantIdWithRetry(lookup) {
|
|
2674
|
+
for (let attempt = 0; attempt <= ASSISTANT_LOOKUP_RETRY_DELAYS_MS.length; attempt++) {
|
|
2675
|
+
try {
|
|
2676
|
+
const id = await lookup();
|
|
2677
|
+
if (id) {
|
|
2678
|
+
return id;
|
|
2679
|
+
}
|
|
2680
|
+
} catch (error) {
|
|
2681
|
+
if (!isRecord(error) || error.statusCode !== 404) {
|
|
2682
|
+
throw error;
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
const delay = ASSISTANT_LOOKUP_RETRY_DELAYS_MS[attempt];
|
|
2686
|
+
if (delay !== void 0) {
|
|
2687
|
+
await new Promise((resolve4) => setTimeout(resolve4, delay));
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
return null;
|
|
2691
|
+
}
|
|
2595
2692
|
async function createAssistantAndGetId(client, params, slug) {
|
|
2596
|
-
await client.assistants.create(params);
|
|
2693
|
+
const response = await client.assistants.create(params);
|
|
2694
|
+
const returnedId = extractAssistantId(response);
|
|
2695
|
+
if (hasMissingIntegrations(response)) {
|
|
2696
|
+
if (!returnedId) {
|
|
2697
|
+
throw new AssistantValidationError("create", params.name, response);
|
|
2698
|
+
}
|
|
2699
|
+
warnOnMissingIntegrations(response, params.name);
|
|
2700
|
+
}
|
|
2701
|
+
if (returnedId) {
|
|
2702
|
+
return returnedId;
|
|
2703
|
+
}
|
|
2597
2704
|
if (slug) {
|
|
2598
|
-
const
|
|
2599
|
-
|
|
2705
|
+
const id = await findAssistantIdWithRetry(async () => {
|
|
2706
|
+
const created = await client.assistants.getBySlug(slug);
|
|
2707
|
+
return created?.id || null;
|
|
2708
|
+
});
|
|
2709
|
+
if (!id) {
|
|
2600
2710
|
throw new Error(`Assistant created but not found by slug: ${slug}`);
|
|
2601
2711
|
}
|
|
2602
|
-
return
|
|
2712
|
+
return id;
|
|
2603
2713
|
}
|
|
2604
|
-
const assistantId = await
|
|
2605
|
-
isGlobal: params.is_global === true
|
|
2606
|
-
|
|
2714
|
+
const assistantId = await findAssistantIdWithRetry(
|
|
2715
|
+
() => findAssistantByName(client, params.name, { isGlobal: params.is_global === true })
|
|
2716
|
+
);
|
|
2607
2717
|
if (!assistantId) {
|
|
2608
2718
|
throw new Error(`Assistant created but not found by name: ${params.name}`);
|
|
2609
2719
|
}
|
|
@@ -3002,7 +3112,8 @@ async function deployAssistants(config, client, loader, stateManager) {
|
|
|
3002
3112
|
logger.debug(JSON.stringify(apiParams, null, 2));
|
|
3003
3113
|
logger.debug("================================\n");
|
|
3004
3114
|
}
|
|
3005
|
-
await client.assistants.update(existingState.id, apiParams);
|
|
3115
|
+
const updateResponse = await client.assistants.update(existingState.id, apiParams);
|
|
3116
|
+
warnOnMissingIntegrations(updateResponse, assistant.name);
|
|
3006
3117
|
logger.info(`\u2713 Updated assistant: ${assistant.name} (${existingState.id})`);
|
|
3007
3118
|
stateManager.updateAssistantState(assistant.name, existingState.id, promptContent, assistant, buildConfig);
|
|
3008
3119
|
deployedAssistantId = existingState.id;
|
|
@@ -3026,6 +3137,9 @@ async function deployAssistants(config, client, loader, stateManager) {
|
|
|
3026
3137
|
logger.info(`\u2713 Created assistant: ${assistant.name} (${assistantId})`);
|
|
3027
3138
|
stats.created++;
|
|
3028
3139
|
} catch (createError) {
|
|
3140
|
+
if (!shouldRecoverAssistantCreateError(createError)) {
|
|
3141
|
+
throw createError;
|
|
3142
|
+
}
|
|
3029
3143
|
logger.warn(` \u26A0\uFE0F Assistant create failed. Checking if it already exists on platform...`);
|
|
3030
3144
|
let existingId = null;
|
|
3031
3145
|
if (assistant.slug) {
|
|
@@ -3044,7 +3158,8 @@ async function deployAssistants(config, client, loader, stateManager) {
|
|
|
3044
3158
|
throw createError;
|
|
3045
3159
|
}
|
|
3046
3160
|
logger.info(` Found existing assistant ID: ${existingId}. Updating...`);
|
|
3047
|
-
await client.assistants.update(existingId, apiParams);
|
|
3161
|
+
const updateResponse = await client.assistants.update(existingId, apiParams);
|
|
3162
|
+
warnOnMissingIntegrations(updateResponse, assistant.name);
|
|
3048
3163
|
assistantId = existingId;
|
|
3049
3164
|
logger.info(`\u2713 Recovered and updated assistant: ${assistant.name} (${assistantId})`);
|
|
3050
3165
|
stats.updated++;
|
|
@@ -3065,6 +3180,9 @@ async function deployAssistants(config, client, loader, stateManager) {
|
|
|
3065
3180
|
logger.info(`\u2713 Created assistant: ${assistant.name} (${assistantId})`);
|
|
3066
3181
|
stats.created++;
|
|
3067
3182
|
} catch (createError) {
|
|
3183
|
+
if (!shouldRecoverAssistantCreateError(createError)) {
|
|
3184
|
+
throw createError;
|
|
3185
|
+
}
|
|
3068
3186
|
logger.warn(` \u26A0\uFE0F Assistant create failed. Checking if it already exists on platform...`);
|
|
3069
3187
|
let existingId = null;
|
|
3070
3188
|
if (assistant.slug) {
|
|
@@ -3083,7 +3201,8 @@ async function deployAssistants(config, client, loader, stateManager) {
|
|
|
3083
3201
|
throw createError;
|
|
3084
3202
|
}
|
|
3085
3203
|
logger.info(` Found existing assistant ID: ${existingId}. Updating...`);
|
|
3086
|
-
await client.assistants.update(existingId, apiParams);
|
|
3204
|
+
const updateResponse = await client.assistants.update(existingId, apiParams);
|
|
3205
|
+
warnOnMissingIntegrations(updateResponse, assistant.name);
|
|
3087
3206
|
assistantId = existingId;
|
|
3088
3207
|
logger.info(`\u2713 Recovered and updated assistant: ${assistant.name} (${assistantId})`);
|
|
3089
3208
|
stats.updated++;
|
|
@@ -5893,7 +6012,7 @@ async function importResource(options) {
|
|
|
5893
6012
|
const managedSkillName = findManagedNameById(stateManager, "skill", skill.id);
|
|
5894
6013
|
if (managedSkillName !== void 0) {
|
|
5895
6014
|
logger.warn(
|
|
5896
|
-
` \u26A0\uFE0F Skill "${skill.name}" is already managed under the name "${managedSkillName}" \u2014 not imported. Run \`codemie import skill ${skill.id} --update\` to refresh it.`
|
|
6015
|
+
` \u26A0\uFE0F Skill "${skill.name}" is already managed under the name "${managedSkillName}" \u2014 not imported. Run \`codemie-cdk import skill ${skill.id} --update\` to refresh it.`
|
|
5897
6016
|
);
|
|
5898
6017
|
continue;
|
|
5899
6018
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemieai/cdk",
|
|
3
|
-
"version": "0.2.2
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Infrastructure as Code solution for managing Codemie AI assistants, datasources, and workflows through declarative YAML configuration",
|
|
6
6
|
"author": "CodeMie",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"bin": {
|
|
26
|
-
"codemie": "./dist/cli/index.js"
|
|
26
|
+
"codemie-cdk": "./dist/cli/index.js"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"dist",
|