guardian-framework 0.1.162 → 0.1.163

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/dist/cli.js CHANGED
@@ -3206,7 +3206,7 @@ __export(exports_package, {
3206
3206
  bin: () => bin,
3207
3207
  author: () => author
3208
3208
  });
3209
- var name = "guardian-framework", version = "0.1.162", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
3209
+ var name = "guardian-framework", version = "0.1.163", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
3210
3210
  var init_package = __esm(() => {
3211
3211
  exports = {
3212
3212
  ".": {
package/dist/exports.js CHANGED
@@ -1991,7 +1991,7 @@ __export(exports_package, {
1991
1991
  bin: () => bin,
1992
1992
  author: () => author
1993
1993
  });
1994
- var name = "guardian-framework", version = "0.1.162", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
1994
+ var name = "guardian-framework", version = "0.1.163", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
1995
1995
  var init_package = __esm(() => {
1996
1996
  exports = {
1997
1997
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "guardian-framework",
3
- "version": "0.1.162",
3
+ "version": "0.1.163",
4
4
  "description": "Token-optimized agentic framework scaffolder with pi-first architecture",
5
5
  "type": "module",
6
6
  "main": "dist/exports.js",
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2026-11-13T20:21:08Z",
2
+ "timestamp": "2026-11-13T20:44:26Z",
3
3
  "mode": "all",
4
4
  "stages_run": [],
5
5
  "summary": {
@@ -245,6 +245,13 @@ def find_tests(slug):
245
245
  if not re.search(r"\.(py|ts|rs|go|java)$", f):
246
246
  continue
247
247
  low = os.path.join(dp, f).lower()
248
+ if "__pycache__" in low:
249
+ continue
250
+ # Only actual test files: conftest.py, _fixtures.py and
251
+ # __init__.py are support, not suites (they made counts lie).
252
+ stem = f.rsplit(".", 1)[0]
253
+ if not (stem.startswith("test_") or stem.endswith("_test") or stem in ("tests", "test")):
254
+ continue
248
255
  if slug in low or slug.replace("-", "") in low.replace("-", ""):
249
256
  hits.append(os.path.join(dp, f))
250
257
  if hits:
@@ -337,6 +344,8 @@ def verify(slug):
337
344
  sig_files = []
338
345
  for d in src_dirs:
339
346
  for dp, _dn, fs in os.walk(d):
347
+ if "__pycache__" in dp:
348
+ continue
340
349
  sig_files += [os.path.join(dp, f) for f in fs if re.search(r"\.(py|ts|java|rs|go)$", f)]
341
350
  ok_sigs = bool(sig_files)
342
351
  checks.append(("frozen signatures", ok_sigs, f"{len(sig_files)} source file(s)" if ok_sigs else f"no src/{slug}/"))
@@ -382,6 +391,62 @@ def verify(slug):
382
391
  checks.append(("red state", ok_red, f"{status}: {reason}"))
383
392
  ok_all &= ok_red
384
393
 
394
+ # 4b. recorded evidence must still hold (spec: a contract change means
395
+ # the module is no longer frozen and must be re-frozen).
396
+ st_rec = load_state()
397
+ ent = entry(st_rec, slug)
398
+ if ent.get("state") == "frozen" and (ent.get("evidence") or {}).get("commit"):
399
+ ev = ent["evidence"]
400
+ sha = ev["commit"]
401
+ base_ref = ev.get("branch") or base
402
+ # realpath both sides: on macOS /tmp is a symlink to /private/tmp, and a
403
+ # symlinked project dir made relpath produce ../../../tmp/... so git saw
404
+ # a path outside the repo and reported "no changes".
405
+ rel = os.path.relpath(os.path.realpath(root), os.path.realpath(git_top))
406
+ prefix = "" if rel == "." else f"{rel}/"
407
+
408
+ on_base = subprocess.run(
409
+ ["git", "-C", git_top, "merge-base", "--is-ancestor", sha, base_ref],
410
+ capture_output=True).returncode == 0
411
+ checks.append(("recorded commit", on_base,
412
+ f"{sha[:8]} is an ancestor of {base_ref}" if on_base
413
+ else f"{sha[:8]} is NOT an ancestor of {base_ref}"))
414
+ ok_all &= on_base
415
+
416
+ missing = [p for p in (ev.get("contracts") or []) if not os.path.exists(os.path.join(root, p))]
417
+ checks.append(("evidence files", not missing,
418
+ "recorded contract/test files exist" if not missing
419
+ else "missing: " + ", ".join(missing)))
420
+ ok_all &= not missing
421
+
422
+ def changed_since(paths):
423
+ """Files changed since the freeze — committed OR uncommitted.
424
+
425
+ `git diff <sha> -- <paths>` compares the recorded commit against the
426
+ WORKING TREE, so it catches both later commits and local edits.
427
+ Diffing commit-to-commit silently ignored uncommitted tampering.
428
+ """
429
+ if not paths:
430
+ return []
431
+ args = ["git", "-C", git_top, "diff", "--name-only", sha, "--"]
432
+ args += [f"{prefix}{p}" for p in paths]
433
+ out = subprocess.run(args, capture_output=True, text=True).stdout.strip()
434
+ if os.environ.get("GUARDIAN_FREEZE_DEBUG"):
435
+ print(f"DEBUG changed_since args={args} out={out!r}", file=sys.stderr)
436
+ return [l for l in out.splitlines() if l.strip()]
437
+
438
+ contract_changes = changed_since(ev.get("contracts") or [])
439
+ checks.append(("contracts unchanged", not contract_changes,
440
+ "contracts unchanged since the freeze" if not contract_changes
441
+ else "changed after the freeze — re-freeze: " + ", ".join(contract_changes)))
442
+ ok_all &= not contract_changes
443
+
444
+ test_changes = changed_since(ev.get("tests") or [])
445
+ checks.append(("tests unchanged", not test_changes,
446
+ "frozen test files unchanged" if not test_changes
447
+ else "tests changed after the freeze — re-freeze: " + ", ".join(test_changes[:3])))
448
+ ok_all &= not test_changes
449
+
385
450
  # 5. dependencies frozen/implemented
386
451
  bad_deps = []
387
452
  st = load_state()
@@ -472,8 +537,8 @@ if cmd == "list":
472
537
 
473
538
  if cmd == "status":
474
539
  if not module:
475
- print("usage: freeze.sh status --module <m>", file=sys.stderr)
476
- raise SystemExit(2)
540
+ # no module given: same as list
541
+ cmd = "list"
477
542
  slug = slugify(module)
478
543
  st = load_state()
479
544
  e = entry(st, slug)