@codemieai/cdk 0.1.664 → 0.1.666
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 +157 -1
- package/dist/cli/index.js +1332 -376
- package/dist/index.d.ts +32 -3
- package/dist/index.js +1311 -387
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -75,6 +75,11 @@ The `.env` file is already added to `.gitignore` and should never be committed t
|
|
|
75
75
|
- `CODEMIE_CLIENT_ID`
|
|
76
76
|
- `CODEMIE_CLIENT_SECRET` (mark as **Masked**)
|
|
77
77
|
|
|
78
|
+
**Substitution in `codemie.yaml`:**
|
|
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
|
+
- 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
|
+
- There is no escape syntax: every `${...}` occurrence in a string value is substituted, so a configuration cannot carry a literal `${VAR}` through the loader.
|
|
82
|
+
|
|
78
83
|
## Quick Start
|
|
79
84
|
|
|
80
85
|
```bash
|
|
@@ -182,6 +187,7 @@ codemie import <type> <slug>
|
|
|
182
187
|
codemie import assistant my-assistant
|
|
183
188
|
codemie import workflow 11111111-1111-1111-1111-111111111111
|
|
184
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
|
|
185
191
|
# <type> is one of: assistant, datasource, workflow, skill
|
|
186
192
|
# <slug> is a resource slug or name; for assistant and workflow it may also be a platform UUID
|
|
187
193
|
|
|
@@ -189,6 +195,15 @@ codemie import assistant my-assistant --update # refresh an already-managed res
|
|
|
189
195
|
codemie validate --root-dir ../another-project
|
|
190
196
|
```
|
|
191
197
|
|
|
198
|
+
**`--with-skills` (assistants only).** An imported assistant references its skills by name, so a
|
|
199
|
+
deploy fails if one of those skills belongs to this project but is not in `resources.skills` yet.
|
|
200
|
+
With `--with-skills`, each referenced skill that the project owns and does not manage yet is
|
|
201
|
+
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.
|
|
203
|
+
Skills owned by other projects keep landing in `imported.skills` as references, and a skill the
|
|
204
|
+
configuration already names is left untouched (also under `--update`, which refreshes the
|
|
205
|
+
assistant only). On any other resource type the flag is ignored with a warning.
|
|
206
|
+
|
|
192
207
|
**Note:** Every command finds the project root automatically by walking up from the current
|
|
193
208
|
directory looking for `codemie.yaml`, so you can run `codemie` from any subdirectory of your
|
|
194
209
|
project. Pass `-d, --root-dir <path>` to point at a different project root instead. `codemie init`
|
|
@@ -519,6 +534,7 @@ For detailed examples of each resource type, see:
|
|
|
519
534
|
- `examples/assistant-examples.yaml` - Assistant patterns and configurations
|
|
520
535
|
- `examples/toolkit-examples.yaml` - All toolkit configurations
|
|
521
536
|
- `examples/workflow-examples.yaml` - Workflow patterns and structures
|
|
537
|
+
- `examples/skill-examples.yaml` - Skill patterns, including expanding a folder of skill directories
|
|
522
538
|
|
|
523
539
|
## 📁 Configuration Organization
|
|
524
540
|
|
|
@@ -740,6 +756,145 @@ project-root/
|
|
|
740
756
|
└── *.yaml
|
|
741
757
|
```
|
|
742
758
|
|
|
759
|
+
## 🧩 Skills Configuration
|
|
760
|
+
|
|
761
|
+
Skills are defined under `resources.skills`. Two shapes are supported, and you can mix both in the same list.
|
|
762
|
+
|
|
763
|
+
#### Single-File Skill
|
|
764
|
+
|
|
765
|
+
The original shape — one entry, one `.skill.md` file:
|
|
766
|
+
|
|
767
|
+
```yaml
|
|
768
|
+
resources:
|
|
769
|
+
skills:
|
|
770
|
+
- name: code-review-checklist
|
|
771
|
+
description: Checklist the assistant walks through when reviewing a pull request
|
|
772
|
+
file: ./skills/code-review-checklist.skill.md
|
|
773
|
+
categories: [review, quality]
|
|
774
|
+
visibility: project
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
- `name` (required): unique skill name.
|
|
778
|
+
- `description` (required): 10-1000 characters — see "Description length validation" below.
|
|
779
|
+
- `file` (or inline `content`, see below): at least one of the two is required. A skill expanded from `source_dir` carries both — `file` points at its `SKILL.md` and `content` holds the body.
|
|
780
|
+
- `categories` (optional): array of category labels.
|
|
781
|
+
- `visibility` (optional): `project` or `public` (default: `project`).
|
|
782
|
+
|
|
783
|
+
#### A Folder of Skill Directories (`source_dir`)
|
|
784
|
+
|
|
785
|
+
For a directory that already holds one subdirectory per skill (the layout used by skill authoring tools), point `source_dir` at it instead of listing every skill by hand:
|
|
786
|
+
|
|
787
|
+
```yaml
|
|
788
|
+
resources:
|
|
789
|
+
skills:
|
|
790
|
+
- source_dir: ./skills/engineering
|
|
791
|
+
ignore_file: ./skills/engineering/.codemie-skills-ignore.yaml
|
|
792
|
+
categories: [engineering]
|
|
793
|
+
visibility: project
|
|
794
|
+
group: engineering-team
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
```
|
|
798
|
+
skills/engineering/
|
|
799
|
+
├── code-review-checklist/
|
|
800
|
+
│ └── SKILL.md
|
|
801
|
+
├── incident-runbook/
|
|
802
|
+
│ └── SKILL.md
|
|
803
|
+
└── draft-idea/ # no SKILL.md here → skipped silently
|
|
804
|
+
└── notes.md
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
```yaml
|
|
808
|
+
# skills/engineering/.codemie-skills-ignore.yaml
|
|
809
|
+
skills:
|
|
810
|
+
- draft-idea
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
Behavior:
|
|
814
|
+
- Each **immediate** subdirectory of `source_dir` that directly contains a `SKILL.md` becomes one skill entry. Subdirectories without a `SKILL.md` are skipped silently. There is no recursion into deeper levels.
|
|
815
|
+
- Skills are expanded in sorted order of their subdirectory names, so two loads of the same folder always produce identical results.
|
|
816
|
+
- `SKILL.md` may start with `---`-delimited YAML front matter (a UTF-8 BOM and CRLF line endings are tolerated). `name` is taken from the front matter, falling back to the directory name when absent. `description` is taken from the front matter. Everything after the front matter becomes the skill's content.
|
|
817
|
+
- `ignore_file` (optional) points at a YAML file shaped `skills: [<dirName>, ...]`; the listed directory names are skipped during expansion.
|
|
818
|
+
- `categories`, `visibility` and `group` on the `source_dir` entry are inherited by every skill expanded from it. `group` is a label only — it never splits or migrates anything, and it is intentionally excluded from change detection, so relabelling a skill does not mark it as changed. The one command that reads it is `deploy --replace-skill-group` (see "Replacing a Whole Skill Group" below).
|
|
819
|
+
- A `source_dir` that does not exist is a configuration error naming both the resolved path and the offending `source_dir` entry. A missing or malformed `ignore_file`, and malformed `SKILL.md` front matter, fail the same way — naming the file at fault.
|
|
820
|
+
- Skill names must be unique across every `source_dir` and every hand-written entry. A duplicate is a configuration error naming the name and both sources that produced it.
|
|
821
|
+
- Names produced by expansion must be kebab-case, 3-64 characters, starting and ending with a letter or digit. This rule only applies to skills expanded from `source_dir` — existing hand-written skill names in the single-file shape are unaffected.
|
|
822
|
+
- Every other file in a skill's subdirectory ships with it as a companion file — see "Companion Files" below.
|
|
823
|
+
|
|
824
|
+
#### Companion Files
|
|
825
|
+
|
|
826
|
+
A skill whose `file` points at a `SKILL.md` — every skill expanded from `source_dir`, plus any hand-written entry that points at one — ships the rest of its directory too. Every other file beneath that directory, at any depth, becomes a **companion file** that travels with the skill to the platform:
|
|
827
|
+
|
|
828
|
+
```
|
|
829
|
+
skills/engineering/code-review-checklist/
|
|
830
|
+
├── SKILL.md # the skill's own content, never a companion file
|
|
831
|
+
├── .codemie-exclude # optional, never shipped itself
|
|
832
|
+
├── checklist.md # companion file
|
|
833
|
+
├── templates/pr-body.md # companion file (the relative path is preserved)
|
|
834
|
+
└── assets/diagram.png # companion file (binary → shipped base64)
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
A skill in the single-file shape (`file: ./skills/foo.skill.md`) or with inline `content` has no companion files.
|
|
838
|
+
|
|
839
|
+
**Always excluded**, whatever patterns you write: `SKILL.md` and `.codemie-exclude` themselves, the directories `node_modules`, `.git` and `evals`, and the lockfiles `package-lock.json`, `npm-shrinkwrap.json`, `yarn.lock`, `pnpm-lock.yaml`, `bun.lockb`, `composer.lock`, `Gemfile.lock`, `Cargo.lock` and `poetry.lock`. Symlinks — to files or directories — are skipped rather than followed.
|
|
840
|
+
|
|
841
|
+
**`.codemie-exclude`** is optional and is read only from the skill's own directory (one placed deeper in the tree is not read). Patterns go one per line and are matched against skill-relative POSIX paths:
|
|
842
|
+
|
|
843
|
+
| Pattern | Matches |
|
|
844
|
+
|---------|---------|
|
|
845
|
+
| `docs/secret.txt` | that exact path |
|
|
846
|
+
| `vendor/lib` | `vendor/lib` itself and everything beneath it |
|
|
847
|
+
| `build/` | everything beneath `build/` — a trailing slash marks a directory prefix |
|
|
848
|
+
| `secret.txt` | a file named `secret.txt` at any depth — a pattern without `/` matches the basename |
|
|
849
|
+
| `*.log` | `*` matches any run of characters except `/` |
|
|
850
|
+
| `docs/**/notes.md` | `**` crosses `/` |
|
|
851
|
+
| `file?.txt` | `?` is exactly one character, never `/` |
|
|
852
|
+
| `{foo,bar}.txt` | `{a,b}` is alternation |
|
|
853
|
+
| `# draft/` | nothing — a line whose first non-whitespace character is `#` is a comment |
|
|
854
|
+
|
|
855
|
+
Blank lines are ignored, and every other character is literal (the `.` in `file.txt` is a dot, not "any character").
|
|
856
|
+
|
|
857
|
+
**Text and binary files are detected automatically.** Content that contains no NUL byte and round-trips exactly as UTF-8 is sent as text, byte-identical to the file on disk; anything else — a binary asset, or text in a legacy single-byte encoding — is base64-encoded, so it survives deploy and backup byte-for-byte. The MIME type is derived from the file extension, falling back to `application/octet-stream`.
|
|
858
|
+
|
|
859
|
+
**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
|
+
|
|
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.
|
|
862
|
+
|
|
863
|
+
**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
|
+
|
|
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.
|
|
866
|
+
|
|
867
|
+
#### Description Length Validation
|
|
868
|
+
|
|
869
|
+
**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
|
+
|
|
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.
|
|
872
|
+
|
|
873
|
+
#### Replacing a Whole Skill Group (`--replace-skill-group`)
|
|
874
|
+
|
|
875
|
+
Some skill sets are regenerated as a whole — a large skill split differently, for example — and have to be deleted and recreated under the same names. `deploy` updates skills in place and `--prune` only removes skills that left the config, so neither detaches and recreates a set of skills. `--replace-skill-group` does:
|
|
876
|
+
|
|
877
|
+
```bash
|
|
878
|
+
# See what would happen first
|
|
879
|
+
codemie preview --replace-skill-group github-copilot
|
|
880
|
+
|
|
881
|
+
# Then run it (the confirmation flag is mandatory)
|
|
882
|
+
codemie deploy --replace-skill-group github-copilot --yes-replace-skills
|
|
883
|
+
```
|
|
884
|
+
|
|
885
|
+
**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.
|
|
886
|
+
|
|
887
|
+
What a run does, in order:
|
|
888
|
+
|
|
889
|
+
1. **Refuses without `--yes-replace-skills`** — nothing is touched, no API call is made. A group name that matches an `imported.skills` entry, or that matches no skill at all, is refused the same way.
|
|
890
|
+
2. **Detaches** every selected skill from every state-managed assistant and every assistant in `imported.assistants`, before the first delete.
|
|
891
|
+
3. **Deletes** the selected skills and drops their state entries. A delete failure aborts the run then and there, so no skill is recreated while part of the group is still on the platform; fix the platform error and rerun.
|
|
892
|
+
4. **Deploys only that group's skills and the assistants that reference them** (plus those assistants' `sub_assistants`, so dependency resolution still works), letting the normal attachment sync reattach the recreated skills. An assistant's `skills` entries are matched against the group case-insensitively, the same way validation accepts them. **Datasources and workflows are not deployed** — `resources.datasources` and `imported.datasources` are still read, so an assistant's `datasource_names` resolve — `--prune` is ignored, and no other resource type is created, updated or deleted.
|
|
893
|
+
|
|
894
|
+
`preview --replace-skill-group <group>` reports the same set of skills as the deploy: one delete per selected skill and one create per config entry of the group.
|
|
895
|
+
|
|
896
|
+
> ⚠️ **Recreated skills get new platform ids.** Anything that references them by id rather than by name does not follow the change. In particular, another IaC project that references these skills through its own `imported.skills` keeps the old ids and must be updated (re-import the skill, or update the id by hand) after a replacement run.
|
|
897
|
+
|
|
743
898
|
## 📁 File Structure
|
|
744
899
|
|
|
745
900
|
```
|
|
@@ -755,7 +910,8 @@ assistant-resources/
|
|
|
755
910
|
│ ├── datasource-examples.yaml
|
|
756
911
|
│ ├── assistant-examples.yaml
|
|
757
912
|
│ ├── toolkit-examples.yaml
|
|
758
|
-
│
|
|
913
|
+
│ ├── workflow-examples.yaml
|
|
914
|
+
│ └── skill-examples.yaml
|
|
759
915
|
└── src/ # IaC implementation
|
|
760
916
|
```
|
|
761
917
|
|