@agentyx/core 0.8.0 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentyx/core",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Shared domain foundations for Agentyx: configuration model, pack resolution and skills.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "access": "public"
44
44
  },
45
45
  "dependencies": {
46
- "zod": "^4.0.17"
46
+ "zod": "^4.6.5"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsdown src/index.ts --dts --clean",
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: cargo-project-verification
3
+ description: Verify Rust work in a single crate or Cargo workspace before handoff, and keep manifests, lockfile, features and public API consistent. Use before declaring Rust work done and when editing Cargo.toml, Cargo.lock, features or public items.
4
+ ---
5
+
6
+ # Cargo project verification
7
+
8
+ Complements the generic `verification` Skill: that covers the discipline of proving a change; this
9
+ covers Cargo specifics.
10
+
11
+ ## Find the real gate
12
+
13
+ Read the repository's CI workflows, Makefile/justfile and contributor docs first. Repository policy
14
+ wins over any default below, including flags, feature sets and toolchain.
15
+
16
+ Typical baseline (drop `--workspace` for a single crate, adjust features to what the repo supports):
17
+
18
+ ```sh
19
+ cargo fmt --all -- --check
20
+ cargo clippy --workspace --all-targets --all-features -- -D warnings
21
+ cargo test --workspace --locked
22
+ cargo build --workspace --locked
23
+ ```
24
+
25
+ - `--locked` assumes `Cargo.lock` is committed. Libraries sometimes ignore it; do not invent or
26
+ commit one against repository convention. If a lockfile is tracked and changed, say why.
27
+ - `--all-features` is not valid everywhere (mutually exclusive or platform-specific features). Use
28
+ the combinations CI uses.
29
+ - Fix clippy findings rather than adding `#[allow]`; if an allow is justified, scope it to the item
30
+ with a reason.
31
+
32
+ ## Manifests
33
+
34
+ - In a workspace, shared versions and metadata belong in `[workspace.package]` and
35
+ `[workspace.dependencies]`; members inherit with `.workspace = true`. Do not re-pin them.
36
+ - Add a dependency only with a reason; check `default-features` and the features it enables.
37
+ - `rust-version` is a contract: avoid newer APIs and do not raise it casually.
38
+ - Features should be additive. After adding or changing one, build with `--no-default-features`
39
+ and the repository's full feature set.
40
+
41
+ ## Public API and release
42
+
43
+ - Public changes (items, CLI flags, output formats, schemas) need tests and docs. Run
44
+ `cargo doc --no-deps` when docs link to changed items, and call the change out in the summary.
45
+ - For publishable crates, `cargo package --list` or `cargo publish --dry-run` shows what ships. Never
46
+ edit release versions by hand if release tooling owns them.
47
+
48
+ Report the exact commands run and their outcome; name any you could not run and why.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: rust-filesystem-safety
3
+ description: Handle untrusted paths, symlinks and output directories safely in Rust. Use only when Rust code reads, walks, scans, generates, scaffolds or writes files whose names or locations come from users or repository contents; skip for code that never touches paths.
4
+ ---
5
+
6
+ # Rust filesystem safety
7
+
8
+ Treat names and locations from users, repositories, manifests and links as untrusted. A file inside
9
+ the project can still point outside it.
10
+
11
+ ## Paths
12
+
13
+ - Use `Path`/`PathBuf` and `components()` for path logic, never string slicing or `split('/')`.
14
+ Convert to `/`-joined strings only for URLs or IDs, handling `\` explicitly.
15
+ - Accept a user-supplied relative path only if every component is `Component::Normal`; reject `..`,
16
+ root, drive/UNC prefixes and empty paths. Absolute inputs need an explicit decision.
17
+ - Containment: canonicalize root and target, then `Path::starts_with` (component-wise, not a string
18
+ prefix). Do it before reading content, and again for resolved link targets. Canonicalizing needs an
19
+ existing path; for a new file, canonicalize the parent.
20
+ - `to_str()` is `Option`: non-UTF-8 names are normal, so handle them without panicking.
21
+
22
+ ## Symlinks and races
23
+
24
+ - Decide symlink behavior per feature; default to refusing. Walk without following links and inspect
25
+ with `symlink_metadata`. Never write through a symlinked directory. Treat Windows junctions the
26
+ same way.
27
+ - Checks and use are separate syscalls, so a check cannot guarantee safety. Prefer an operation that
28
+ fails safely (`create_new`) over check-then-act, and expect files to vanish mid-run.
29
+
30
+ ## Collisions
31
+
32
+ On case-insensitive filesystems two names differing only by case collide. Detect collisions on a
33
+ normalized key before writing. On Windows also watch trailing dots/spaces and reserved device names.
34
+
35
+ ## Writing
36
+
37
+ - Never overwrite or delete what you did not create. Use `OpenOptions::create_new(true)` for new
38
+ files and report `AlreadyExists`. Delete only paths you recorded or can prove are yours (for
39
+ example via a marker file).
40
+ - For generated output directories, write into a staging directory on the same filesystem and rename
41
+ into place, keeping the last good output on failure.
42
+
43
+ ## Bounds and errors
44
+
45
+ Bound traversal (depth, entry count, file size). Skip an unreadable or non-UTF-8 file with a
46
+ diagnostic naming the path instead of failing the whole run, unless the caller needs completeness.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: rust-idiomatic-development
3
+ description: Write and review idiomatic Rust with clear ownership, expressive types, honest errors and a small public API. Use when adding or changing Rust types, functions, error handling or public items.
4
+ ---
5
+
6
+ # Idiomatic Rust
7
+
8
+ ## Ownership
9
+
10
+ - Borrow before cloning. Accept `&str`, `&Path` and `&[T]`; return owned data only when the caller
11
+ needs it. A `.clone()` added only to satisfy the borrow checker signals a design problem:
12
+ restructure the borrow or scope, or justify the clone in a comment.
13
+ - Use `impl AsRef<Path>` or `impl Into<String>` at API edges where callers benefit; keep internals
14
+ concrete.
15
+ - Avoid allocation in hot loops: reuse buffers, stream with iterators, use `Cow` when most inputs
16
+ pass through unchanged. Measure before contorting readable code.
17
+
18
+ ## Types
19
+
20
+ - Make invalid states hard to represent: an `enum` per distinct case instead of a `String` plus
21
+ flags; newtypes whose constructor validates identifiers and similar values.
22
+ - Match exhaustively on enums you own. Avoid `_ =>` there so a new variant breaks the build rather
23
+ than silently changing behavior.
24
+ - Use an iterator chain when it reads as a pipeline; use a `for` loop for side effects or early
25
+ exits.
26
+
27
+ ## Errors
28
+
29
+ - Code that handles user input, files or the network returns `Result`. Do not `unwrap`, `expect` or
30
+ index data that originates outside the process; reserve `expect` for true invariants and state the
31
+ invariant in the message.
32
+ - Add context where an error crosses a boundary (which path, which key). Diagnostics are user-facing
33
+ output.
34
+
35
+ ## API surface
36
+
37
+ - Keep `pub` minimal and prefer `pub(crate)`; every public item is a promise.
38
+ - Keep serialized/wire types separate from domain types and convert at the boundary. Do not derive
39
+ `Deserialize` on a domain type if that bypasses its constructor validation.
40
+ - Document public items with `///`, including failure modes. Comments explain intent, not syntax.
41
+
42
+ ## `unsafe`
43
+
44
+ `unsafe` is repository policy, not a universal rule. Check `Cargo.toml`, `[workspace.lints]`, existing
45
+ `unsafe` blocks and `SAFETY:` comments first. If the repository forbids it, respect that. If it
46
+ allows it, keep blocks minimal and document the invariant in a `SAFETY:` comment.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: rust-testing-portability
3
+ description: Write deterministic, portable Rust tests that cover regressions and user-visible behavior. Use when adding or fixing Rust tests, fixing a bug, or touching code that must run on Linux, macOS and Windows.
4
+ ---
5
+
6
+ # Rust testing and portability
7
+
8
+ ## Level
9
+
10
+ - Unit tests (`#[cfg(test)]`) for pure logic and edge cases inside one module.
11
+ - Integration tests (`tests/*.rs`) for the public API or the real binary, including exit codes and
12
+ the stdout/stderr text users see.
13
+ - Every fixed bug gets a regression test that fails without the fix. Name it for the behavior, not
14
+ the issue number.
15
+
16
+ ## Deterministic
17
+
18
+ - Use `tempfile` for filesystem fixtures; never write into the source tree or depend on the current
19
+ directory. Build fixtures in code or from small checked-in directories.
20
+ - Do not sleep for arbitrary durations. Poll a condition with a bounded timeout, or inject the clock
21
+ or dependency. Bind port `0` instead of assuming a free port.
22
+ - Sort anything from directory walks or hash maps before comparing.
23
+ - Isolate the environment: set the variables a child process needs and clear those it must not
24
+ inherit.
25
+ - To diagnose flakiness, repeat the single test (a shell loop around `cargo test <name>`) before
26
+ claiming it is stable.
27
+
28
+ ## Portable
29
+
30
+ - Build paths with `join`; compare `/`-normalized strings only where the code promises them. Add a
31
+ Windows-separator case for any path or ID normalization.
32
+ - Gate platform behavior with `#[cfg(unix)]` (symlinks, permissions) and `#[cfg(windows)]`. Do not
33
+ assume executable names or `.exe` suffixes; use `env!("CARGO_BIN_EXE_<name>")`.
34
+ - Normalize `\r\n` before comparing generated text.
35
+ - Do not create two fixtures differing only by case in one directory; case-insensitive filesystems
36
+ will merge them.
37
+
38
+ ## Snapshots
39
+
40
+ Keep goldens small, reviewed and regenerated only through the project's documented command. Strip
41
+ absolute paths, timestamps and versions so they pass on every platform.