@aibyzero/cm-workflow 0.10.5 → 0.10.6

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.
@@ -19,16 +19,23 @@ LEGACY = "scripts/test-cm-openai-compatible-call.py"
19
19
 
20
20
 
21
21
  class PublicSafetyTests(unittest.TestCase):
22
- def scan(self, files):
22
+ def scan(self, files, *, git_repo=False, tracked=()):
23
23
  with tempfile.TemporaryDirectory(prefix="cm-safety-") as raw:
24
24
  root = Path(raw)
25
25
  script = root / "scripts" / SCANNER.name
26
26
  script.parent.mkdir()
27
27
  shutil.copyfile(SCANNER, script)
28
+ if git_repo:
29
+ subprocess.run(["git", "init", "-q", str(root)], check=True, capture_output=True)
28
30
  for name, text in files.items():
29
31
  target = root / name
30
32
  target.parent.mkdir(parents=True, exist_ok=True)
31
33
  target.write_text(text, encoding="utf-8")
34
+ if tracked:
35
+ subprocess.run(
36
+ ["git", "-C", str(root), "add", "-f", "--", *tracked],
37
+ check=True, capture_output=True,
38
+ )
32
39
  return subprocess.run(
33
40
  [sys.executable, str(script)], cwd=root,
34
41
  capture_output=True, text=True, check=False,
@@ -71,6 +78,57 @@ class PublicSafetyTests(unittest.TestCase):
71
78
  self.assertIn(APPROVED + expected, result.stderr)
72
79
  self.assertNotIn(APPROVED + ":1:", result.stderr)
73
80
 
81
+ def test_tracked_omx_files_are_scanned_at_root_and_nested_paths(self):
82
+ for name in [".omx/sample.txt", "module/.omx/sample.txt"]:
83
+ with self.subTest(name=name):
84
+ result = self.scan(
85
+ {".gitignore": ".omx/\n", name: "sk-" + "x" * 24},
86
+ git_repo=True, tracked=[name],
87
+ )
88
+ self.assertEqual(result.returncode, 1, result.stdout)
89
+ self.assertIn(name + ":1: OpenAI-style key", result.stderr)
90
+
91
+ def test_untracked_omx_state_remains_private(self):
92
+ result = self.scan(
93
+ {".gitignore": ".omx/\n", ".omx/local.txt": "sk-" + "x" * 24,
94
+ "module/.omx/local.txt": "sk-" + "y" * 24},
95
+ git_repo=True,
96
+ )
97
+ self.assertEqual(result.returncode, 0, result.stderr)
98
+
99
+ def test_omx_exclusion_is_per_file_not_per_directory(self):
100
+ result = self.scan(
101
+ {".omx/tracked.txt": "sk-" + "x" * 24,
102
+ ".omx/untracked.txt": "sk-" + "y" * 24,
103
+ "docs/ordinary.txt": "sk-" + "z" * 24},
104
+ git_repo=True, tracked=[".omx/tracked.txt"],
105
+ )
106
+ self.assertEqual(result.returncode, 1)
107
+ self.assertIn(".omx/tracked.txt:1: OpenAI-style key", result.stderr)
108
+ self.assertIn("docs/ordinary.txt:1: OpenAI-style key", result.stderr)
109
+ self.assertNotIn(".omx/untracked.txt:", result.stderr)
110
+
111
+ def test_git_query_failure_scans_omx_conservatively(self):
112
+ # No Git repository: ls-files fails instead of returning an empty inventory.
113
+ result = self.scan({".omx/sample.txt": "sk-" + "x" * 24})
114
+ self.assertEqual(result.returncode, 1, result.stdout)
115
+ self.assertIn(".omx/sample.txt:1: OpenAI-style key", result.stderr)
116
+
117
+ def test_private_key_header_formats_are_detected(self):
118
+ for label in ["PRIVATE KEY", "ENCRYPTED PRIVATE KEY", "RSA PRIVATE KEY",
119
+ "EC PRIVATE KEY", "OPENSSH PRIVATE KEY", "DSA PRIVATE KEY"]:
120
+ with self.subTest(label=label):
121
+ # Construct marker only; the body is not a usable private key.
122
+ result = self.scan({"docs/example.pem": "-----BEGIN " + label + "-----\nSYNTHETIC\n"})
123
+ self.assertEqual(result.returncode, 1, result.stdout)
124
+ self.assertIn("docs/example.pem:1: private key", result.stderr)
125
+
126
+ def test_public_key_headers_are_not_private_keys(self):
127
+ for label in ["PUBLIC KEY", "RSA PUBLIC KEY", "CERTIFICATE"]:
128
+ with self.subTest(label=label):
129
+ result = self.scan({"docs/example.pem": "-----BEGIN " + label + "-----\nSYNTHETIC\n"})
130
+ self.assertEqual(result.returncode, 0, result.stderr)
131
+
74
132
 
75
133
  if __name__ == "__main__":
76
134
  unittest.main()
@@ -50,6 +50,7 @@ CM_AI_RUNTIME = (
50
50
  )
51
51
  REQUIRED = (
52
52
  ".codex-plugin/plugin.json",
53
+ "package.json",
53
54
  "AGENTS.md",
54
55
  "README.md",
55
56
  "VERSION",
@@ -75,6 +76,7 @@ REQUIRED = (
75
76
  "scripts/cm-ai-admission.test.mjs",
76
77
  "scripts/cm-check-runtime.sh",
77
78
  "scripts/cm-check-runtime.ps1",
79
+ "scripts/cm-release-smoke.sh",
78
80
  "scripts/cm-log-event.mjs",
79
81
  "scripts/cm-log-event.test.mjs",
80
82
  "scripts/cm-log-event.py",
@@ -141,6 +143,29 @@ def main() -> int:
141
143
  if manifest.get("skills") != "./skills/":
142
144
  fail("plugin skills must point to ./skills/", failures)
143
145
 
146
+ package_path = ROOT / "package.json"
147
+ try:
148
+ package = json.loads(package_path.read_text(encoding="utf-8"))
149
+ except (OSError, UnicodeDecodeError, json.JSONDecodeError) as error:
150
+ fail(f"package.json is not valid readable JSON: {error}", failures)
151
+ package = {}
152
+ if package.get("name") != "@aibyzero/cm-workflow":
153
+ fail("Pi package name must be @aibyzero/cm-workflow", failures)
154
+ if package.get("version") != version:
155
+ fail(f"Pi package version {package.get('version')} != VERSION {version}", failures)
156
+ keywords = package.get("keywords", [])
157
+ if not isinstance(keywords, list) or "pi-package" not in keywords:
158
+ fail("Pi package keywords must include pi-package", failures)
159
+ pi_manifest = package.get("pi", {})
160
+ if not isinstance(pi_manifest, dict):
161
+ fail("Pi package manifest must be an object", failures)
162
+ pi_manifest = {}
163
+ expected_pi_skills = [f"./skills/{name}" for name in sorted(CORE_SKILLS)]
164
+ if pi_manifest.get("skills") != expected_pi_skills:
165
+ fail("Pi package skills must expose exactly the eight core Skills", failures)
166
+ if pi_manifest.get("prompts") != ["./compat/claude-commands"]:
167
+ fail("Pi package prompts must point to ./compat/claude-commands", failures)
168
+
144
169
  handoff_schema = json.loads(
145
170
  (ROOT / "runtime/task-handoff.schema.json").read_text(encoding="utf-8")
146
171
  )