diff --git a/.omegon/audit-log.jsonl b/.omegon/audit-log.jsonl index f938f35..0606feb 100644 --- a/.omegon/audit-log.jsonl +++ b/.omegon/audit-log.jsonl @@ -1530,3 +1530,24 @@ {"ts":1780097792310,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_end","details":{"command":"git status --short && git diff --stat"},"error":false,"id":"call_kH3aa3rY6VeOlJhrNT7QSTxd|fc_0ebbaa23da47a2b7016a1a22fcf2108195823e3f776b5107f9","preview":" M .omegon/agent-journal.md\n M .omegon/audit-log.jsonl\n M ai/memory/facts.db\n M tests/integration/mocks/nix\n .omegon/agent-journal.md | 22 ++++++++++++++++++++++\n .omegon/audit-log.jsonl | 35","tool":"bash"} {"ts":1780097792311,"session":"2026-05-28T15-00-13_c031906f","kind":"turn","cache":0,"ctx":{"conv":9011,"free":140771,"mem":0,"sys":23662,"think":966,"tools":8540},"ctx_window":272000,"drift":null,"est_tokens":99226,"in":144077,"model":"openai-codex:gpt-5.5","out":30,"phase":"Act","progress":"None","provider":"openai-codex","quota":{"codex_active_limit":"premium","codex_credits_unlimited":false,"codex_limit_name":"GPT-5.3-Codex-Spark","codex_primary_reset_secs":16860,"codex_primary_used_pct":0.0,"codex_secondary_reset_secs":74927,"codex_secondary_used_pct":62.0,"provider":"openai-codex","request_id":"52178cba-6e03-46b3-9fd2-b9df893ec01d","source":"response_headers"},"turn":9} {"ts":1780097798608,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_start","args":{"message":"test: harden nix integration mock on newer bash","paths":["tests/integration/mocks/nix",".omegon/agent-journal.md",".omegon/audit-log.jsonl","ai/memory/facts.db"]},"id":"call_QMW9RKTNCWWyB7uRRp9SkDu8|fc_0ebbaa23da47a2b7016a1a2304bab481959e35822d298b139d","tool":"commit"} +{"ts":1780097858168,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_end","details":{"command":"git checkout -- .omegon/agent-journal.md .omegon/audit-log.jsonl && git status --short && git checkout pr-21 && git rebase origin/main"},"error":false,"id":"call_QLg4X3GoUgvNiLLlYzOP03Dr|fc_0ebbaa23da47a2b7016a1a2340218881958db2264486c759ac","preview":"Switched to branch 'pr-21'\nRebasing (1/1)\rSuccessfully rebased and updated refs/heads/pr-21.","tool":"bash"} +{"ts":1780097858169,"session":"2026-05-28T15-00-13_c031906f","kind":"turn","cache":0,"ctx":{"conv":9482,"free":139013,"mem":0,"sys":23815,"think":1064,"tools":8540},"ctx_window":272000,"drift":null,"est_tokens":100838,"in":146293,"model":"openai-codex:gpt-5.5","out":57,"phase":"Act","progress":"None","provider":"openai-codex","quota":{"codex_active_limit":"premium","codex_credits_unlimited":false,"codex_limit_name":"GPT-5.3-Codex-Spark","codex_primary_reset_secs":16792,"codex_primary_used_pct":0.0,"codex_secondary_reset_secs":74859,"codex_secondary_used_pct":62.0,"provider":"openai-codex","request_id":"b7e29110-39a8-4f54-96ce-0ce076c1e952","source":"response_headers"},"turn":3} +{"ts":1780097862812,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_start","args":{"command":"cargo clippy --quiet --all-targets -- -D warnings && cargo test --quiet","timeout":240},"id":"call_WZGeBMUSDHpSUSsxPuwttjt2|fc_0ebbaa23da47a2b7016a1a2345c1a48195a872db4a73a3510a","tool":"bash"} +{"ts":1780097873764,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_end","details":{"command":"cargo clippy --quiet --all-targets -- -D warnings && cargo test --quiet"},"error":false,"id":"call_WZGeBMUSDHpSUSsxPuwttjt2|fc_0ebbaa23da47a2b7016a1a2345c1a48195a872db4a73a3510a","preview":"\nrunning 99 tests\n....................................................................................... 87/99\n............\ntest result: ok. 99 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out","tool":"bash"} +{"ts":1780097873766,"session":"2026-05-28T15-00-13_c031906f","kind":"turn","cache":0,"ctx":{"conv":9482,"free":138796,"mem":0,"sys":23815,"think":1064,"tools":8540},"ctx_window":272000,"drift":null,"est_tokens":101056,"in":146391,"model":"openai-codex:gpt-5.5","out":39,"phase":"Act","progress":"None","provider":"openai-codex","quota":{"codex_active_limit":"premium","codex_credits_unlimited":false,"codex_limit_name":"GPT-5.3-Codex-Spark","codex_primary_reset_secs":16786,"codex_primary_used_pct":0.0,"codex_secondary_reset_secs":74852,"codex_secondary_used_pct":62.0,"provider":"openai-codex","request_id":"d81d7d12-5544-4e33-80fb-fcabeedbdb2c","source":"response_headers"},"turn":4} +{"ts":1780097880118,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_start","args":{"command":"git push --force-with-lease origin pr-21:fix/empty-armory-lock-status && gh pr view 21 --json mergeable,statusCheckRollup,headRefOid --jq '{mergeable,head:.headRefOid[0:7],checks:[.statusCheckRollup[]?|{name,status,conclusion}]}'","timeout":120},"id":"call_VSwGShcnMwQPAbemIhPxnZEC|fc_0ebbaa23da47a2b7016a1a2356240881958d28aa29334a0e70","tool":"bash"} +{"ts":1780097881533,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_end","details":{"command":"git push --force-with-lease origin pr-21:fix/empty-armory-lock-status && gh pr view 21 --json mergeable,statusCheckRollup,headRefOid --jq '{mergeable,head:.headRefOid[0:7],checks:[.statusCheckRollup[]?|{name,status,conclusion}]}'"},"error":false,"id":"call_VSwGShcnMwQPAbemIhPxnZEC|fc_0ebbaa23da47a2b7016a1a2356240881958d28aa29334a0e70","preview":"To https://github.com/styrene-lab/nex.git\n + ac10bf1...7ed85ec pr-21 -> fix/empty-armory-lock-status (forced update)\n{\"checks\":[{\"conclusion\":\"FAILURE\",\"name\":\"Rust\",\"status\":\"COMPLETED\"},{\"conclusion","tool":"bash"} +{"ts":1780097881535,"session":"2026-05-28T15-00-13_c031906f","kind":"turn","cache":0,"ctx":{"conv":9482,"free":138638,"mem":0,"sys":23815,"think":1064,"tools":8540},"ctx_window":272000,"drift":null,"est_tokens":101215,"in":146627,"model":"openai-codex:gpt-5.5","out":91,"phase":"Act","progress":"None","provider":"openai-codex","quota":{"codex_active_limit":"premium","codex_credits_unlimited":false,"codex_limit_name":"GPT-5.3-Codex-Spark","codex_primary_reset_secs":16770,"codex_primary_used_pct":0.0,"codex_secondary_reset_secs":74837,"codex_secondary_used_pct":62.0,"provider":"openai-codex","request_id":"0d224ee2-1af9-45c5-b082-3de823bc3f7e","source":"response_headers"},"turn":5} +{"ts":1780097890775,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_start","args":{"command":"sleep 5; gh pr view 21 --json mergeable,statusCheckRollup,headRefOid --jq '{mergeable,head:.headRefOid[0:7],checks:[.statusCheckRollup[]?|{name,status,conclusion}]}' && gh run list --limit 8 --json databaseId,name,status,conclusion,headSha,event,url | jq -r '.[] | [.databaseId,.name,.status,(.conclusion//\"\"),.headSha[0:7],.event,.url] | @tsv'","timeout":30},"id":"call_wBSGm3rubuvBU6hwafFQFNNO|fc_0ebbaa23da47a2b7016a1a235fe4b08195a405aeb528d885e4","tool":"bash"} +{"ts":1780097896925,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_end","details":{"command":"sleep 5; gh pr view 21 --json mergeable,statusCheckRollup,headRefOid --jq '{mergeable,head:.headRefOid[0:7],checks:[.statusCheckRollup[]?|{name,status,conclusion}]}' && gh run list --limit 8 --json databaseId,name,status,conclusion,headSha,event,url | jq -r '.[] | [.databaseId,.name,.status,(.conclusion//\"\"),.headSha[0:7],.event,.url] | @tsv'"},"error":false,"id":"call_wBSGm3rubuvBU6hwafFQFNNO|fc_0ebbaa23da47a2b7016a1a235fe4b08195a405aeb528d885e4","preview":"{\"checks\":[{\"conclusion\":\"\",\"name\":\"Rust\",\"status\":\"IN_PROGRESS\"},{\"conclusion\":\"\",\"name\":\"lipstyk / lipstyk scan\",\"status\":\"IN_PROGRESS\"}],\"head\":\"7ed85ec\",\"mergeable\":\"MERGEABLE\"}\n26667716874\tCI\tin_","tool":"bash"} +{"ts":1780097896926,"session":"2026-05-28T15-00-13_c031906f","kind":"turn","cache":0,"ctx":{"conv":9482,"free":138332,"mem":0,"sys":23759,"think":1064,"tools":8540},"ctx_window":272000,"drift":null,"est_tokens":101578,"in":146842,"model":"openai-codex:gpt-5.5","out":137,"phase":"Act","progress":"None","provider":"openai-codex","quota":{"codex_active_limit":"premium","codex_credits_unlimited":false,"codex_limit_name":"GPT-5.3-Codex-Spark","codex_primary_reset_secs":16762,"codex_primary_used_pct":0.0,"codex_secondary_reset_secs":74829,"codex_secondary_used_pct":62.0,"provider":"openai-codex","request_id":"9ac6e7b0-327a-461a-8e58-ec600ca5b0c2","source":"response_headers"},"turn":6} +{"ts":1780097903966,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_start","args":{"command":"gh run view 26667677135 --json jobs --jq '.jobs[] | [.name,.conclusion,.url] | @tsv' && gh run view 26667677135 --job $(gh run view 26667677135 --json jobs --jq '.jobs[] | select(.name==\"Rust\") | .databaseId') --log | tail -140","timeout":60},"id":"call_QYz3of81LHhImfHSqrtZ6Yu6|fc_0ebbaa23da47a2b7016a1a236cb3f881959f13a3208718db46","tool":"bash"} +{"ts":1780097906441,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_end","details":{"command":"gh run view 26667677135 --json jobs --jq '.jobs[] | [.name,.conclusion,.url] | @tsv' && gh run view 26667677135 --job $(gh run view 26667677135 --json jobs --jq '.jobs[] | select(.name==\"Rust\") | .databaseId') --log | tail -140"},"error":false,"id":"call_QYz3of81LHhImfHSqrtZ6Yu6|fc_0ebbaa23da47a2b7016a1a236cb3f881959f13a3208718db46","preview":"lipstyk / lipstyk scan\tsuccess\thttps://github.com/styrene-lab/nex/actions/runs/26667677135/job/78604453675\nRust\tfailure\thttps://github.com/styrene-lab/nex/actions/runs/26667677135/job/78604453715\nRust","tool":"bash"} +{"ts":1780097906443,"session":"2026-05-28T15-00-13_c031906f","kind":"turn","cache":0,"ctx":{"conv":9482,"free":134280,"mem":0,"sys":23731,"think":1064,"tools":8540},"ctx_window":272000,"drift":null,"est_tokens":105658,"in":147261,"model":"openai-codex:gpt-5.5","out":98,"phase":"Act","progress":"None","provider":"openai-codex","quota":{"codex_active_limit":"premium","codex_credits_unlimited":false,"codex_limit_name":"GPT-5.3-Codex-Spark","codex_primary_reset_secs":16747,"codex_primary_used_pct":0.0,"codex_secondary_reset_secs":74814,"codex_secondary_used_pct":62.0,"provider":"openai-codex","request_id":"0a058df2-4ef1-4a92-b66a-a8c2630f14a1","source":"response_headers"},"turn":7} +{"ts":1780097923825,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_start","args":{"command":"python3 - <<'PY'\nfrom pathlib import Path\np=Path('tests/integration/mocks/nix')\ns=p.read_text()\nstart=s.index('# Package database: attr → version')\nend=s.index('\\n\\ncmd=\"${1:-}\"')\nreplacement='''# Package database lookup kept POSIX-ish because macOS CI may invoke this\\n# through an older /bin/bash that lacks associative arrays.\\nnixpkg_version() {\\n case \"$1\" in\\n htop) echo \"3.3.0\" ;;\\n ripgrep) echo \"14.1.0\" ;;\\n git) echo \"2.44.0\" ;;\\n vim) echo \"9.1.0\" ;;\\n firefox) echo \"128.0\" ;;\\n wget) echo \"1.24.5\" ;;\\n jq) echo \"1.7.1\" ;;\\n tmux) echo \"3.4\" ;;\\n btop) echo \"1.3.2\" ;;\\n curl) echo \"8.7.1\" ;;\\n tree) echo \"2.1.1\" ;;\\n nodejs) echo \"22.2.0\" ;;\\n bash) echo \"5.2\" ;;\\n zsh) echo \"5.9\" ;;\\n neovim) echo \"0.10.0\" ;;\\n go) echo \"1.22.3\" ;;\\n *) return 1 ;;\\n esac\\n}\\n'''\ns=s[:start]+replacement+s[end:]\ns=s.replace(''' if [[ -n \"${NIXPKGS[$pkg]+set}\" ]]; then\\n case \"$field\" in\\n version) printf '%s' \"${NIXPKGS[$pkg]}\" ;;\\n name) printf '%s' \"$pkg\" ;;\\n *) printf '%s' \"$pkg\" ;;\\n esac\\n exit 0\\n else\\n exit 1\\n fi\\n''',''' if version=\"$(nixpkg_version \"$pkg\")\"; then\\n case \"$field\" in\\n version) printf '%s' \"$version\" ;;\\n name) printf '%s' \"$pkg\" ;;\\n *) printf '%s' \"$pkg\" ;;\\n esac\\n exit 0\\n else\\n exit 1\\n fi\\n''')\np.write_text(s)\nPY\ncargo test --test e2e forge_check_materialization --quiet && cargo test --test e2e forge_build_materialization_uses_pkl_source_and_output_link --quiet","timeout":180},"id":"call_raCS881G4ZAbGYdyecVKiemv|fc_0ebbaa23da47a2b7016a1a2378618c8195bb979f1bd1406a4f","tool":"bash"} +{"ts":1780097925441,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_end","details":{"command":"python3 - <<'PY'\nfrom pathlib import Path\np=Path('tests/integration/mocks/nix')\ns=p.read_text()\nstart=s.index('# Package database: attr → version')\nend=s.index('\\n\\ncmd=\"${1:-}\"')\nreplacement='''# Package database lookup kept POSIX-ish because macOS CI may invoke this\\n# through an older /bin/bash that lacks associative arrays.\\nnixpkg_version() {\\n case \"$1\" in\\n htop) echo \"3.3.0\" ;;\\n ripgrep) echo \"14.1.0\" ;;\\n git) echo \"2.44.0\" ;;\\n vim) echo \"9.1.0\" ;;\\n firefox) echo \"128.0\" ;;\\n wget) echo \"1.24.5\" ;;\\n jq) echo \"1.7.1\" ;;\\n tmux) echo \"3.4\" ;;\\n btop) echo \"1.3.2\" ;;\\n curl) echo \"8.7.1\" ;;\\n tree) echo \"2.1.1\" ;;\\n nodejs) echo \"22.2.0\" ;;\\n bash) echo \"5.2\" ;;\\n zsh) echo \"5.9\" ;;\\n neovim) echo \"0.10.0\" ;;\\n go) echo \"1.22.3\" ;;\\n *) return 1 ;;\\n esac\\n}\\n'''\ns=s[:start]+replacement+s[end:]\ns=s.replace(''' if [[ -n \"${NIXPKGS[$pkg]+set}\" ]]; then\\n case \"$field\" in\\n version) printf '%s' \"${NIXPKGS[$pkg]}\" ;;\\n name) printf '%s' \"$pkg\" ;;\\n *) printf '%s' \"$pkg\" ;;\\n esac\\n exit 0\\n else\\n exit 1\\n fi\\n''',''' if version=\"$(nixpkg_version \"$pkg\")\"; then\\n case \"$field\" in\\n version) printf '%s' \"$version\" ;;\\n name) printf '%s' \"$pkg\" ;;\\n *) printf '%s' \"$pkg\" ;;\\n esac\\n exit 0\\n else\\n exit 1\\n fi\\n''')\np.write_text(s)\nPY\ncargo test --test e2e forge_check_materialization --quiet && cargo test --test e2e forge_build_materialization_uses_pkl_source_and_output_link --quiet"},"error":false,"id":"call_raCS881G4ZAbGYdyecVKiemv|fc_0ebbaa23da47a2b7016a1a2378618c8195bb979f1bd1406a4f","preview":"\nrunning 4 tests\n....\ntest result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 48 filtered out; finished in 0.71s\n\n\nrunning 1 test\n.\ntest result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 51 f","tool":"bash"} +{"ts":1780097925443,"session":"2026-05-28T15-00-13_c031906f","kind":"turn","cache":0,"ctx":{"conv":9482,"free":133943,"mem":0,"sys":23578,"think":1064,"tools":8540},"ctx_window":272000,"drift":null,"est_tokens":106149,"in":153346,"model":"openai-codex:gpt-5.5","out":626,"phase":"Act","progress":"None","provider":"openai-codex","quota":{"codex_active_limit":"premium","codex_credits_unlimited":false,"codex_limit_name":"GPT-5.3-Codex-Spark","codex_primary_reset_secs":16738,"codex_primary_used_pct":0.0,"codex_secondary_reset_secs":74804,"codex_secondary_used_pct":62.0,"provider":"openai-codex","request_id":"e66660df-5d8e-4ff6-bc81-d28ec52d80e9","source":"response_headers"},"turn":8} +{"ts":1780097931426,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_start","args":{"command":"cargo clippy --quiet --all-targets -- -D warnings && cargo test --quiet","timeout":240},"id":"call_W7Fo7w4rZpab9ghwmQdp7u6H|fc_0ebbaa23da47a2b7016a1a238a1ad081958733798469091ea2","tool":"bash"} +{"ts":1780097936677,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_end","details":{"command":"cargo clippy --quiet --all-targets -- -D warnings && cargo test --quiet"},"error":false,"id":"call_W7Fo7w4rZpab9ghwmQdp7u6H|fc_0ebbaa23da47a2b7016a1a238a1ad081958733798469091ea2","preview":"\nrunning 99 tests\n....................................................................................... 87/99\n............\ntest result: ok. 99 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out","tool":"bash"} +{"ts":1780097936679,"session":"2026-05-28T15-00-13_c031906f","kind":"turn","cache":0,"ctx":{"conv":9482,"free":133669,"mem":0,"sys":23635,"think":1064,"tools":8540},"ctx_window":272000,"drift":null,"est_tokens":106367,"in":153878,"model":"openai-codex:gpt-5.5","out":39,"phase":"Act","progress":"None","provider":"openai-codex","quota":{"codex_active_limit":"premium","codex_credits_unlimited":false,"codex_limit_name":"GPT-5.3-Codex-Spark","codex_primary_reset_secs":16718,"codex_primary_used_pct":0.0,"codex_secondary_reset_secs":74785,"codex_secondary_used_pct":62.0,"provider":"openai-codex","request_id":"1e2abc18-3fd5-4ea2-89b3-42e95b138b16","source":"response_headers"},"turn":9} +{"ts":1780097942119,"session":"2026-05-28T15-00-13_c031906f","kind":"tool_start","args":{"message":"test: avoid associative arrays in nix mock","paths":["tests/integration/mocks/nix",".omegon/agent-journal.md",".omegon/audit-log.jsonl"]},"id":"call_sdniwZoBtHJyPZs5Az637GKL|fc_0ebbaa23da47a2b7016a1a2394c718819595418ebe5c5e6f60","tool":"commit"} diff --git a/src/main.rs b/src/main.rs index 714a1df..c7cca3b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -50,7 +50,11 @@ fn main() -> Result<()> { match cli.command { Command::Init { from } => return ops::init::run(from, cli.dry_run), Command::Relocate { ref to } => return ops::relocate::run(to.as_deref(), cli.dry_run), - Command::Search { .. } | Command::Info { .. } | Command::Lock { .. } => {} + Command::Search { .. } | Command::Info { .. } => {} + Command::Lock { + action: cli::LockAction::Status, + } => return ops::lock_status::status(), + Command::Lock { .. } => {} Command::SelfUpdate => return ops::self_update::run(), Command::Gc => return ops::gc::run(cli.dry_run), Command::Forge { @@ -243,7 +247,9 @@ fn main() -> Result<()> { Command::Lock { action } => match action { cli::LockAction::Refresh => ops::lock::refresh(&config), cli::LockAction::Materialize => ops::lock::materialize(&config), - cli::LockAction::Status => ops::lock_status::status(), + cli::LockAction::Status => { + unreachable!("lock status is handled before config resolution") + } }, Command::Profile { ref action } => match action { cli::ProfileAction::Apply { source, verify } => { diff --git a/src/ops/lock_status.rs b/src/ops/lock_status.rs index 8265ed4..a8e223f 100644 --- a/src/ops/lock_status.rs +++ b/src/ops/lock_status.rs @@ -3,6 +3,14 @@ use anyhow::Result; use crate::armory_lock; pub fn status() -> Result<()> { + let lock_path = armory_lock::package_lock_path()?; + if !lock_path.exists() { + println!("Armory package lock: absent"); + println!("roots: 0"); + println!("materialized packages: 0"); + return Ok(()); + } + let lock = armory_lock::read_package_lock()?; println!("schema: {}", lock.schema); println!("registries:"); @@ -33,3 +41,24 @@ pub fn status() -> Result<()> { } Ok(()) } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn status_treats_absent_lock_as_empty_state() { + let dir = tempfile::tempdir().expect("tempdir"); + let old_home = std::env::var_os("HOME"); + std::env::set_var("HOME", dir.path()); + + let result = status(); + + match old_home { + Some(home) => std::env::set_var("HOME", home), + None => std::env::remove_var("HOME"), + } + + result.expect("absent package lock should be a valid empty status"); + } +} diff --git a/tests/integration/mocks/nix b/tests/integration/mocks/nix index 28aad92..7e9b3bb 100755 --- a/tests/integration/mocks/nix +++ b/tests/integration/mocks/nix @@ -3,25 +3,30 @@ # Handles: eval, search, build, shell, store, flake set -eo pipefail -# Package database: attr → version -declare -A NIXPKGS=( - [htop]="3.3.0" - [ripgrep]="14.1.0" - [git]="2.44.0" - [vim]="9.1.0" - [firefox]="128.0" - [wget]="1.24.5" - [jq]="1.7.1" - [tmux]="3.4" - [btop]="1.3.2" - [curl]="8.7.1" - [tree]="2.1.1" - [nodejs]="22.2.0" - [bash]="5.2" - [zsh]="5.9" - [neovim]="0.10.0" - [go]="1.22.3" -) +# Package database lookup kept POSIX-ish because macOS CI may invoke this +# through an older /bin/bash that lacks associative arrays. +nixpkg_version() { + case "$1" in + htop) echo "3.3.0" ;; + ripgrep) echo "14.1.0" ;; + git) echo "2.44.0" ;; + vim) echo "9.1.0" ;; + firefox) echo "128.0" ;; + wget) echo "1.24.5" ;; + jq) echo "1.7.1" ;; + tmux) echo "3.4" ;; + btop) echo "1.3.2" ;; + curl) echo "8.7.1" ;; + tree) echo "2.1.1" ;; + nodejs) echo "22.2.0" ;; + bash) echo "5.2" ;; + zsh) echo "5.9" ;; + neovim) echo "0.10.0" ;; + go) echo "1.22.3" ;; + *) return 1 ;; + esac +} + cmd="${1:-}" shift || true @@ -58,9 +63,9 @@ case "$cmd" in pkg="${rest%%.*}" field="${rest#*.}" - if [[ -n "${NIXPKGS[$pkg]+set}" ]]; then + if version="$(nixpkg_version "$pkg")"; then case "$field" in - version) printf '%s' "${NIXPKGS[$pkg]}" ;; + version) printf '%s' "$version" ;; name) printf '%s' "$pkg" ;; *) printf '%s' "$pkg" ;; esac