Skip to content

Commit 9bbbaab

Browse files
authored
Add NLBoot release archive inspection
Adds read-only NLBoot release archive inspection to sourceosctl. Includes inspect-archive command, valid/invalid fixtures, tests, README usage, and CI validation. Closes #6.
1 parent 63024b3 commit 9bbbaab

11 files changed

Lines changed: 136 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ sourceosctl [--version] <command> [<subcommand>] [options]
5454
| `sourceosctl nlboot evidence inspect --validate <path>` | Inspect and validate a NLBoot evidence file against its bundled schema (read-only) |
5555
| `sourceosctl nlboot evidence validate <path>` | Validate a NLBoot evidence file against its bundled JSON Schema (read-only) |
5656
| `sourceosctl release inspect <path>` | Inspect a release artifact JSON file (read-only) |
57+
| `sourceosctl release inspect-archive <path>` | Inspect a NLBoot release archive directory for required files (read-only) |
5758
| `sourceosctl fingerprint collect --dry-run` | Print environment fingerprint fields (dry-run only) |
5859
| `sourceosctl ai labs list` | List available AI labs (read-only) |
5960
| `sourceosctl agents sandbox plan --dry-run` | Print agent sandbox plan (dry-run only) |
@@ -68,6 +69,7 @@ python3 bin/sourceosctl nlboot evidence inspect fixtures/sample_nlboot_evidence.
6869
python3 bin/sourceosctl nlboot evidence inspect --validate fixtures/sample_nlboot_evidence.json
6970
python3 bin/sourceosctl nlboot evidence validate fixtures/sample_nlboot_evidence.json
7071
python3 bin/sourceosctl release inspect fixtures/sample_release.json
72+
python3 bin/sourceosctl release inspect-archive fixtures/nlboot_release_valid
7173
python3 bin/sourceosctl fingerprint collect --dry-run
7274
python3 bin/sourceosctl ai labs list
7375
python3 bin/sourceosctl agents sandbox plan --dry-run

fixtures/nlboot_release_invalid/Cargo.lock

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# stub nlboot-client binary placeholder (not executable; read-only fixture only)

fixtures/nlboot_release_valid/Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"note": "stub cargo-metadata for fixture/inspection purposes only",
3+
"packages": [
4+
{
5+
"name": "nlboot-client",
6+
"version": "0.1.0",
7+
"id": "nlboot-client 0.1.0 (path+file:///stub)"
8+
}
9+
]
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# stub nlboot-client binary placeholder (not executable; read-only fixture only)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"schemaVersion": "nlboot-release.v1",
3+
"name": "nlboot-client",
4+
"version": "0.1.0",
5+
"channel": "stable",
6+
"note": "stub release-manifest for fixture/inspection purposes only",
7+
"artifacts": [
8+
"nlboot-client",
9+
"Cargo.lock",
10+
"cargo-metadata.json",
11+
"sbom.spdx.json"
12+
],
13+
"metadata": {
14+
"gitRef": "refs/heads/main",
15+
"builtAt": "2025-01-01T00:00:00Z"
16+
}
17+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"SPDXID": "SPDXRef-DOCUMENT",
3+
"spdxVersion": "SPDX-2.3",
4+
"name": "nlboot-client-sbom",
5+
"dataLicense": "CC0-1.0",
6+
"documentNamespace": "https://example.invalid/nlboot-client-stub",
7+
"note": "stub SBOM for fixture/inspection purposes only"
8+
}

sourceosctl/cli.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ def build_parser() -> argparse.ArgumentParser:
7474
release_inspect_p.add_argument("path", help="Path to release artifact JSON file")
7575
release_inspect_p.set_defaults(func=release.inspect)
7676

77+
release_inspect_archive_p = release_sub.add_parser(
78+
"inspect-archive",
79+
help="Inspect a NLBoot release archive directory for required files",
80+
)
81+
release_inspect_archive_p.add_argument(
82+
"path", help="Path to unpacked NLBoot release archive directory"
83+
)
84+
release_inspect_archive_p.set_defaults(func=release.inspect_archive)
85+
7786
# --- fingerprint ---
7887
fingerprint_p = sub.add_parser("fingerprint", help="Environment fingerprint utilities")
7988
fingerprint_sub = fingerprint_p.add_subparsers(

sourceosctl/commands/release.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,46 @@
44
import pathlib
55
import sys
66

7+
# Files that must be present in a valid NLBoot release archive directory.
8+
_NLBOOT_REQUIRED_FILES = [
9+
"nlboot-client",
10+
"Cargo.lock",
11+
"cargo-metadata.json",
12+
"sbom.spdx.json",
13+
"release-manifest.json",
14+
]
15+
16+
17+
def inspect_archive(args) -> int:
18+
"""Inspect a NLBoot release archive directory for required files. Read-only."""
19+
path = pathlib.Path(args.path)
20+
if not path.exists():
21+
print(f"error: path not found: {path}", file=sys.stderr)
22+
return 1
23+
if not path.is_dir():
24+
print(f"error: not a directory: {path}", file=sys.stderr)
25+
return 1
26+
27+
print(f"NLBoot release archive: {path}")
28+
missing = []
29+
for name in _NLBOOT_REQUIRED_FILES:
30+
entry = path / name
31+
if entry.exists():
32+
print(f" ok {name}")
33+
else:
34+
print(f" MISSING {name}")
35+
missing.append(name)
36+
37+
if missing:
38+
print(
39+
f"error: {len(missing)} required file(s) missing: {', '.join(missing)}",
40+
file=sys.stderr,
41+
)
42+
return 1
43+
44+
print("ok: all required NLBoot release files present")
45+
return 0
46+
747

848
def inspect(args) -> int:
949
"""Inspect a release artifact. Read-only."""

0 commit comments

Comments
 (0)