Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50b3103b9f | ||
|
|
e59d5d377e | ||
|
|
5123ba7643 |
No files matched your search
@@ -2,6 +2,7 @@ name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
@@ -18,7 +19,7 @@ jobs:
|
||||
extra-conf: |
|
||||
sandbox-fallback = false
|
||||
|
||||
# Builds the package with its tests, clippy, rustfmt and the VM test (which needs KVM), and
|
||||
# evaluates the other outputs
|
||||
# Builds the package with its tests, runs clippy, rustfmt, shellcheck and the VM test
|
||||
# (which needs KVM), and evaluates the other outputs
|
||||
- name: Check the flake
|
||||
run: nix flake check -L
|
||||
@@ -39,7 +39,8 @@ of devenv's scripts, `devenv test` or the demo's host side.
|
||||
errors) and the tests.
|
||||
- `cargo fmt` — the crate is formatted with `rustfmt` (`rustfmt.toml`); run it on code you change.
|
||||
- `nix build` — the package, which also runs the tests.
|
||||
- CI ([`.gitea/workflows/ci.yaml`](.gitea/workflows/ci.yaml)) runs `nix flake check` on every push:
|
||||
- CI ([`.gitea/workflows/ci.yaml`](.gitea/workflows/ci.yaml)) runs `nix flake check` for pull
|
||||
requests and pushes to `main`:
|
||||
the package with its tests, `clippy` (warnings as errors), `fmt` (`cargo fmt --check`),
|
||||
`shellcheck` on `src/**/*.sh` and the VM test. Keep them passing. `nix flake check --no-build`
|
||||
fails where the VM test's keys haven't been built, because the test reads them at evaluation.
|
||||
|
||||
Generated
+1
-1
@@ -3859,7 +3859,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
||||
|
||||
[[package]]
|
||||
name = "slop-broker"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"age",
|
||||
"anyhow",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "slop-broker"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2024"
|
||||
description = "Approval broker that runs privileged operations for coding agents"
|
||||
license = "MIT"
|
||||
|
||||
@@ -45,6 +45,20 @@ The development environment is [devenv](https://devenv.sh): direnv with `.envrc`
|
||||
and `cargo clippy --all-targets` work there, `devenv test` runs both, and `vm-test` runs the NixOS
|
||||
VM test (needs KVM). See [`AGENTS.md`](AGENTS.md) for conventions.
|
||||
|
||||
## Releasing
|
||||
|
||||
Use SemVer for the CLI, request protocol and Nix module options. Bump the patch for
|
||||
compatible fixes and the minor for compatible features. While the major is zero,
|
||||
use a minor bump for breaking changes and document how to upgrade. After `1.0.0`,
|
||||
bump the major for breaking changes.
|
||||
|
||||
1. Set `package.version` in `Cargo.toml` and run `cargo check` to refresh
|
||||
`Cargo.lock`. The Nix package reads the version from `Cargo.toml`.
|
||||
2. After the release commit lands on `main` and passes CI, tag it `v<version>` and
|
||||
push the tag. Keep published tags fixed.
|
||||
3. Update the `slop-broker` input in nixfiles to `ref=refs/tags/v<version>` and run
|
||||
`nix flake update slop-broker` there to refresh its lock entry.
|
||||
|
||||
## License
|
||||
|
||||
MIT; see [`LICENSE`](LICENSE).
|
||||
+1
-1
@@ -4,7 +4,7 @@ let
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "slop-broker";
|
||||
version = "0.1.0";
|
||||
inherit ((builtins.fromTOML (builtins.readFile ../Cargo.toml)).package) version;
|
||||
|
||||
src = toSource {
|
||||
root = ../.;
|
||||
|
||||
+20
-6
@@ -417,12 +417,24 @@ impl Changes {
|
||||
/// and size change.
|
||||
fn package_cells(line: &str) -> [&str; 3] {
|
||||
let Some((name, rest)) = line.split_once(": ") else { return [line, "", ""] };
|
||||
let is_size = |s: &str| s.starts_with(['+', '-']);
|
||||
match rest.rsplit_once(", ") {
|
||||
Some((version, size)) if is_size(size) => [name, version, size],
|
||||
_ if is_size(rest) => [name, "", rest],
|
||||
_ => [name, rest, ""],
|
||||
if let Some((version, size)) = rest.rsplit_once(", ")
|
||||
&& let Some(size) = package_size(size)
|
||||
{
|
||||
return [name, version, size];
|
||||
}
|
||||
if let Some(size) = package_size(rest) {
|
||||
return [name, "unchanged", size];
|
||||
}
|
||||
[name, rest, ""]
|
||||
}
|
||||
|
||||
fn package_size(value: &str) -> Option<&str> {
|
||||
// Some Nix versions indicate the direction with colour even on piped output.
|
||||
value
|
||||
.strip_prefix("\x1b[31;1m")
|
||||
.or_else(|| value.strip_prefix("\x1b[32;1m"))
|
||||
.and_then(|size| size.strip_suffix("\x1b[0m"))
|
||||
.or_else(|| value.starts_with(['+', '-']).then_some(value))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -432,7 +444,9 @@ mod tests {
|
||||
#[test]
|
||||
fn splits_package_lines() {
|
||||
assert_eq!(package_cells("a: 1.0 → 1.1, +3.4 KiB"), ["a", "1.0 → 1.1", "+3.4 KiB"]);
|
||||
assert_eq!(package_cells("b: -12.0 KiB"), ["b", "", "-12.0 KiB"]);
|
||||
assert_eq!(package_cells("b: -12.0 KiB"), ["b", "unchanged", "-12.0 KiB"]);
|
||||
assert_eq!(package_cells("b: \x1b[31;1m12.0 KiB\x1b[0m"), ["b", "unchanged", "12.0 KiB"]);
|
||||
assert_eq!(package_cells("b: 1.0 → 1.1, \x1b[32;1m-12.0 KiB\x1b[0m"), ["b", "1.0 → 1.1", "-12.0 KiB"]);
|
||||
assert_eq!(package_cells("c: ∅ → 2.0"), ["c", "∅ → 2.0", ""]);
|
||||
assert_eq!(package_cells("odd"), ["odd", "", ""]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user