@nerviq/cli 1.18.0 → 1.20.0

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.
Files changed (187) hide show
  1. package/LICENSE +23 -23
  2. package/README.md +2 -2
  3. package/bin/cli.js +131 -130
  4. package/package.json +2 -1
  5. package/src/activity.js +1039 -1039
  6. package/src/adoption-advisor.js +299 -299
  7. package/src/aider/config-parser.js +166 -166
  8. package/src/aider/context.js +158 -158
  9. package/src/aider/deep-review.js +316 -316
  10. package/src/aider/domain-packs.js +303 -303
  11. package/src/aider/freshness.js +93 -93
  12. package/src/aider/governance.js +253 -253
  13. package/src/aider/interactive.js +334 -334
  14. package/src/aider/mcp-packs.js +329 -329
  15. package/src/aider/patch.js +214 -214
  16. package/src/aider/plans.js +186 -186
  17. package/src/aider/premium.js +360 -360
  18. package/src/aider/setup.js +404 -404
  19. package/src/aider/techniques.js +16 -16
  20. package/src/analyze.js +951 -951
  21. package/src/anti-patterns.js +485 -485
  22. package/src/audit/instruction-files.js +180 -180
  23. package/src/audit/recommendations.js +577 -577
  24. package/src/auto-suggest.js +154 -154
  25. package/src/badge.js +13 -13
  26. package/src/behavioral-drift.js +801 -801
  27. package/src/benchmark.js +67 -67
  28. package/src/catalog.js +103 -103
  29. package/src/certification.js +128 -128
  30. package/src/codex/config-parser.js +183 -183
  31. package/src/codex/context.js +223 -223
  32. package/src/codex/deep-review.js +493 -493
  33. package/src/codex/domain-packs.js +394 -394
  34. package/src/codex/freshness.js +84 -84
  35. package/src/codex/governance.js +192 -192
  36. package/src/codex/interactive.js +618 -618
  37. package/src/codex/mcp-packs.js +914 -914
  38. package/src/codex/patch.js +209 -209
  39. package/src/codex/plans.js +251 -251
  40. package/src/codex/premium.js +614 -614
  41. package/src/codex/setup.js +591 -591
  42. package/src/context.js +320 -320
  43. package/src/continuous-ops.js +681 -681
  44. package/src/copilot/activity.js +309 -309
  45. package/src/copilot/deep-review.js +346 -346
  46. package/src/copilot/domain-packs.js +372 -372
  47. package/src/copilot/freshness.js +57 -57
  48. package/src/copilot/governance.js +222 -222
  49. package/src/copilot/interactive.js +406 -406
  50. package/src/copilot/mcp-packs.js +826 -826
  51. package/src/copilot/plans.js +253 -253
  52. package/src/copilot/premium.js +451 -451
  53. package/src/copilot/setup.js +488 -488
  54. package/src/cost-tracking.js +61 -61
  55. package/src/cursor/activity.js +301 -301
  56. package/src/cursor/config-parser.js +265 -265
  57. package/src/cursor/context.js +256 -256
  58. package/src/cursor/deep-review.js +334 -334
  59. package/src/cursor/domain-packs.js +368 -368
  60. package/src/cursor/freshness.js +65 -65
  61. package/src/cursor/governance.js +229 -229
  62. package/src/cursor/interactive.js +391 -391
  63. package/src/cursor/mcp-packs.js +828 -828
  64. package/src/cursor/plans.js +254 -254
  65. package/src/cursor/premium.js +469 -469
  66. package/src/cursor/setup.js +488 -488
  67. package/src/dashboard.js +493 -493
  68. package/src/deep-review.js +428 -428
  69. package/src/deprecation.js +98 -98
  70. package/src/diff-only.js +280 -280
  71. package/src/doctor.js +119 -119
  72. package/src/domain-pack-expansion.js +1033 -1033
  73. package/src/domain-packs.js +387 -387
  74. package/src/feedback.js +178 -178
  75. package/src/fix-engine.js +783 -783
  76. package/src/fix-prompts.js +122 -122
  77. package/src/formatters/sarif.js +115 -115
  78. package/src/freshness.js +74 -74
  79. package/src/gemini/config-parser.js +275 -275
  80. package/src/gemini/context.js +290 -221
  81. package/src/gemini/deep-review.js +559 -559
  82. package/src/gemini/domain-packs.js +393 -393
  83. package/src/gemini/freshness.js +66 -66
  84. package/src/gemini/governance.js +201 -201
  85. package/src/gemini/interactive.js +860 -860
  86. package/src/gemini/mcp-packs.js +915 -915
  87. package/src/gemini/plans.js +269 -269
  88. package/src/gemini/premium.js +760 -760
  89. package/src/gemini/setup.js +692 -692
  90. package/src/gemini/techniques.js +105 -33
  91. package/src/governance.js +72 -72
  92. package/src/harmony/add.js +68 -68
  93. package/src/harmony/advisor.js +333 -333
  94. package/src/harmony/canon.js +565 -565
  95. package/src/harmony/cli.js +591 -591
  96. package/src/harmony/drift.js +401 -401
  97. package/src/harmony/governance.js +313 -313
  98. package/src/harmony/memory.js +239 -239
  99. package/src/harmony/sync.js +475 -475
  100. package/src/harmony/watch.js +370 -370
  101. package/src/hook-validation.js +342 -342
  102. package/src/index.js +271 -271
  103. package/src/init.js +184 -184
  104. package/src/instruction-surfaces.js +185 -185
  105. package/src/integrations.js +144 -144
  106. package/src/interactive.js +118 -118
  107. package/src/locales/en.json +1 -1
  108. package/src/locales/es.json +1 -1
  109. package/src/mcp-packs.js +830 -830
  110. package/src/mcp-server.js +726 -726
  111. package/src/mcp-validation.js +337 -337
  112. package/src/nerviq-sync.json +7 -7
  113. package/src/opencode/config-parser.js +109 -109
  114. package/src/opencode/context.js +247 -247
  115. package/src/opencode/deep-review.js +313 -313
  116. package/src/opencode/domain-packs.js +262 -262
  117. package/src/opencode/freshness.js +66 -66
  118. package/src/opencode/governance.js +159 -159
  119. package/src/opencode/interactive.js +392 -392
  120. package/src/opencode/mcp-packs.js +705 -705
  121. package/src/opencode/patch.js +184 -184
  122. package/src/opencode/plans.js +231 -231
  123. package/src/opencode/premium.js +413 -413
  124. package/src/opencode/setup.js +449 -449
  125. package/src/opencode/techniques.js +27 -27
  126. package/src/operating-profile.js +574 -574
  127. package/src/org.js +152 -152
  128. package/src/permission-rules.js +218 -218
  129. package/src/plans.js +839 -839
  130. package/src/platform-change-manifest.js +86 -86
  131. package/src/plugins.js +110 -110
  132. package/src/policy-layers.js +210 -210
  133. package/src/profiles.js +124 -124
  134. package/src/prompt-injection.js +74 -74
  135. package/src/public-api.js +173 -173
  136. package/src/recommendation-rules.js +84 -84
  137. package/src/repo-archetype.js +386 -386
  138. package/src/secret-patterns.js +39 -39
  139. package/src/server.js +527 -527
  140. package/src/setup/analysis.js +607 -607
  141. package/src/setup/runtime.js +172 -172
  142. package/src/setup.js +677 -677
  143. package/src/shared/capabilities.js +194 -194
  144. package/src/source-urls.js +132 -132
  145. package/src/stack-checks.js +565 -565
  146. package/src/supplemental-checks.js +13 -13
  147. package/src/synergy/adaptive.js +261 -261
  148. package/src/synergy/compensation.js +137 -137
  149. package/src/synergy/evidence.js +193 -193
  150. package/src/synergy/learning.js +199 -199
  151. package/src/synergy/patterns.js +227 -227
  152. package/src/synergy/ranking.js +83 -83
  153. package/src/synergy/report.js +165 -165
  154. package/src/synergy/routing.js +146 -146
  155. package/src/techniques/api.js +407 -407
  156. package/src/techniques/automation.js +316 -316
  157. package/src/techniques/compliance.js +257 -257
  158. package/src/techniques/hygiene.js +294 -294
  159. package/src/techniques/instructions.js +243 -243
  160. package/src/techniques/observability.js +226 -226
  161. package/src/techniques/optimization.js +142 -142
  162. package/src/techniques/quality.js +318 -318
  163. package/src/techniques/security.js +237 -237
  164. package/src/techniques/shared.js +443 -443
  165. package/src/techniques/stacks.js +2294 -2294
  166. package/src/techniques/tools.js +106 -106
  167. package/src/techniques/workflow.js +413 -413
  168. package/src/techniques.js +81 -81
  169. package/src/terminology.js +73 -73
  170. package/src/token-estimate.js +35 -35
  171. package/src/usage-patterns.js +99 -99
  172. package/src/verification-metadata.js +145 -145
  173. package/src/watch.js +247 -247
  174. package/src/windsurf/activity.js +302 -302
  175. package/src/windsurf/config-parser.js +267 -267
  176. package/src/windsurf/context.js +249 -249
  177. package/src/windsurf/deep-review.js +337 -337
  178. package/src/windsurf/domain-packs.js +370 -370
  179. package/src/windsurf/freshness.js +36 -36
  180. package/src/windsurf/governance.js +231 -231
  181. package/src/windsurf/interactive.js +388 -388
  182. package/src/windsurf/mcp-packs.js +792 -792
  183. package/src/windsurf/plans.js +247 -247
  184. package/src/windsurf/premium.js +468 -468
  185. package/src/windsurf/setup.js +471 -471
  186. package/src/windsurf/techniques.js +17 -17
  187. package/src/workspace.js +375 -375
@@ -8,10 +8,10 @@
8
8
  const { version } = require('../../package.json');
9
9
 
10
10
  /**
11
- * P0 sources that must be fresh before any Codex release claim.
12
- * Each source has a staleness threshold in days.
13
- */
14
- const P0_SOURCES = [
11
+ * P0 sources that must be fresh before any Codex release claim.
12
+ * Each source has a staleness threshold in days.
13
+ */
14
+ const P0_SOURCES = [
15
15
  {
16
16
  key: 'codex-cli-docs',
17
17
  label: 'Codex CLI Official Docs',
@@ -19,53 +19,53 @@ const P0_SOURCES = [
19
19
  stalenessThresholdDays: 30,
20
20
  verifiedAt: '2026-04-07',
21
21
  },
22
- {
23
- key: 'codex-config-reference',
24
- label: 'Codex Config Reference',
25
- url: 'https://developers.openai.com/codex/config-reference',
26
- stalenessThresholdDays: 30,
27
- verifiedAt: '2026-04-07',
28
- },
29
- {
30
- key: 'codex-agent-approvals-security',
31
- label: 'Codex Agent Approvals & Security',
32
- url: 'https://developers.openai.com/codex/agent-approvals-security',
33
- stalenessThresholdDays: 14,
34
- verifiedAt: '2026-04-10',
35
- },
36
- {
37
- key: 'codex-subagents',
38
- label: 'Codex Subagents Documentation',
39
- url: 'https://developers.openai.com/codex/subagents',
40
- stalenessThresholdDays: 14,
41
- verifiedAt: '2026-04-10',
42
- },
43
- {
44
- key: 'codex-automations',
45
- label: 'Codex Automations / App Workflows',
46
- url: 'https://developers.openai.com/codex/app/automations',
47
- stalenessThresholdDays: 14,
48
- verifiedAt: '2026-04-10',
49
- },
50
- {
51
- key: 'codex-local-environments',
52
- label: 'Codex Local Environments / Worktrees',
53
- url: 'https://developers.openai.com/codex/app/local-environments',
54
- stalenessThresholdDays: 14,
55
- verifiedAt: '2026-04-10',
56
- },
57
- {
58
- key: 'codex-feature-maturity',
59
- label: 'Codex Feature Maturity',
60
- url: 'https://developers.openai.com/codex/feature-maturity',
61
- stalenessThresholdDays: 14,
62
- verifiedAt: '2026-04-10',
63
- },
64
- {
65
- key: 'codex-github-action',
66
- label: 'Codex GitHub Action',
67
- url: 'https://github.com/openai/codex-action',
68
- stalenessThresholdDays: 30,
22
+ {
23
+ key: 'codex-config-reference',
24
+ label: 'Codex Config Reference',
25
+ url: 'https://developers.openai.com/codex/config-reference',
26
+ stalenessThresholdDays: 30,
27
+ verifiedAt: '2026-04-07',
28
+ },
29
+ {
30
+ key: 'codex-agent-approvals-security',
31
+ label: 'Codex Agent Approvals & Security',
32
+ url: 'https://developers.openai.com/codex/agent-approvals-security',
33
+ stalenessThresholdDays: 14,
34
+ verifiedAt: '2026-04-10',
35
+ },
36
+ {
37
+ key: 'codex-subagents',
38
+ label: 'Codex Subagents Documentation',
39
+ url: 'https://developers.openai.com/codex/subagents',
40
+ stalenessThresholdDays: 14,
41
+ verifiedAt: '2026-04-10',
42
+ },
43
+ {
44
+ key: 'codex-automations',
45
+ label: 'Codex Automations / App Workflows',
46
+ url: 'https://developers.openai.com/codex/app/automations',
47
+ stalenessThresholdDays: 14,
48
+ verifiedAt: '2026-04-10',
49
+ },
50
+ {
51
+ key: 'codex-local-environments',
52
+ label: 'Codex Local Environments / Worktrees',
53
+ url: 'https://developers.openai.com/codex/app/local-environments',
54
+ stalenessThresholdDays: 14,
55
+ verifiedAt: '2026-04-10',
56
+ },
57
+ {
58
+ key: 'codex-feature-maturity',
59
+ label: 'Codex Feature Maturity',
60
+ url: 'https://developers.openai.com/codex/feature-maturity',
61
+ stalenessThresholdDays: 14,
62
+ verifiedAt: '2026-04-10',
63
+ },
64
+ {
65
+ key: 'codex-github-action',
66
+ label: 'Codex GitHub Action',
67
+ url: 'https://github.com/openai/codex-action',
68
+ stalenessThresholdDays: 30,
69
69
  verifiedAt: '2026-04-07',
70
70
  },
71
71
  {
@@ -112,39 +112,39 @@ const PROPAGATION_CHECKLIST = [
112
112
  'src/codex/governance.js — governance export picks up changes',
113
113
  ],
114
114
  },
115
- {
116
- trigger: 'New check category added',
117
- targets: [
118
- 'src/codex/techniques.js — add check implementations',
119
- 'test/codex-check-matrix.js — add pass/fail scenarios',
120
- 'test/codex-golden-matrix.js — update golden scores',
121
- ],
122
- },
123
- {
124
- trigger: 'Codex approvals/security model change (approval classes, sandboxing, unattended safety behavior)',
125
- targets: [
126
- 'src/codex/governance.js — update permission profiles and caveats',
127
- 'src/codex/techniques.js — update trust/security checks tied to approval behavior',
128
- 'src/source-urls.js — refresh Codex trust/authentication source mappings if docs move',
129
- ],
130
- },
131
- {
132
- trigger: 'Codex subagent or local-environment change (subagents, worktrees, workspace lifecycle, handoff expectations)',
133
- targets: [
134
- 'src/codex/setup.js — update subagent/worktree starter templates',
135
- 'src/codex/techniques.js — update subagent and worktree governance checks',
136
- 'src/codex/governance.js — update multi-agent policy guidance',
137
- ],
138
- },
139
- {
140
- trigger: 'Codex automation or feature-maturity change (automations, background workflows, capability maturity guidance)',
141
- targets: [
142
- 'src/codex/techniques.js — update automation and maturity-sensitive checks',
143
- 'src/codex/interactive.js — update automation/setup wizard copy if platform behavior changes',
144
- 'src/source-urls.js — refresh Codex automation and maturity source mappings',
145
- ],
146
- },
147
- ];
115
+ {
116
+ trigger: 'New check category added',
117
+ targets: [
118
+ 'src/codex/techniques.js — add check implementations',
119
+ 'test/codex-check-matrix.js — add pass/fail scenarios',
120
+ 'test/codex-golden-matrix.js — update golden scores',
121
+ ],
122
+ },
123
+ {
124
+ trigger: 'Codex approvals/security model change (approval classes, sandboxing, unattended safety behavior)',
125
+ targets: [
126
+ 'src/codex/governance.js — update permission profiles and caveats',
127
+ 'src/codex/techniques.js — update trust/security checks tied to approval behavior',
128
+ 'src/source-urls.js — refresh Codex trust/authentication source mappings if docs move',
129
+ ],
130
+ },
131
+ {
132
+ trigger: 'Codex subagent or local-environment change (subagents, worktrees, workspace lifecycle, handoff expectations)',
133
+ targets: [
134
+ 'src/codex/setup.js — update subagent/worktree starter templates',
135
+ 'src/codex/techniques.js — update subagent and worktree governance checks',
136
+ 'src/codex/governance.js — update multi-agent policy guidance',
137
+ ],
138
+ },
139
+ {
140
+ trigger: 'Codex automation or feature-maturity change (automations, background workflows, capability maturity guidance)',
141
+ targets: [
142
+ 'src/codex/techniques.js — update automation and maturity-sensitive checks',
143
+ 'src/codex/interactive.js — update automation/setup wizard copy if platform behavior changes',
144
+ 'src/source-urls.js — refresh Codex automation and maturity source mappings',
145
+ ],
146
+ },
147
+ ];
148
148
 
149
149
  /**
150
150
  * Release gate: check if all P0 sources are within staleness threshold.
@@ -1,192 +1,192 @@
1
- const { CODEX_DOMAIN_PACKS } = require('./domain-packs');
2
- const { CODEX_MCP_PACKS } = require('./mcp-packs');
3
-
4
- const CODEX_PERMISSION_PROFILES = [
5
- {
6
- key: 'locked-down',
7
- label: 'Locked Down',
8
- risk: 'low',
9
- defaultSandbox: 'read-only',
10
- approvalPolicy: 'untrusted',
11
- useWhen: 'First contact with a repo, security review, or regulated environments.',
12
- behavior: 'No writes, explicit escalation for anything outside trusted commands.',
13
- },
14
- {
15
- key: 'standard',
16
- label: 'Standard',
17
- risk: 'medium',
18
- defaultSandbox: 'workspace-write',
19
- approvalPolicy: 'on-request',
20
- useWhen: 'Default product work where Codex edits locally but risky commands still need review.',
21
- behavior: 'Balanced baseline for normal repo work.',
22
- },
23
- {
24
- key: 'full-auto',
25
- label: 'Full Auto',
26
- risk: 'high',
27
- defaultSandbox: 'workspace-write',
28
- approvalPolicy: 'never',
29
- useWhen: 'Externally sandboxed automation only, with strong repo guardrails.',
30
- behavior: 'No approval prompts. Suitable only when the outer environment is controlled.',
31
- },
32
- {
33
- key: 'unrestricted',
34
- label: 'Unrestricted',
35
- risk: 'critical',
36
- defaultSandbox: 'danger-full-access',
37
- approvalPolicy: 'never',
38
- useWhen: 'Exceptional internal debugging only.',
39
- behavior: 'Bypasses core safety boundaries and should never be the product default.',
40
- },
41
- // CP-10: New profile for CI/automation
42
- {
43
- key: 'ci-automation',
44
- label: 'CI Automation',
45
- risk: 'high',
46
- defaultSandbox: 'workspace-write',
47
- approvalPolicy: 'never',
48
- useWhen: 'GitHub Actions, `codex exec`, or scheduled automation where the outer CI environment provides containment.',
49
- behavior: 'No prompts. Designed for `codex exec` and GitHub Action contexts. Requires CODEX_API_KEY, not user credentials.',
50
- },
51
- ];
52
-
53
- const CODEX_HOOK_REGISTRY = [
54
- {
55
- key: 'session-start',
56
- file: '.codex/hooks.json',
57
- triggerPoint: 'SessionStart',
58
- matcher: null,
59
- purpose: 'Bootstrap local context or guardrails at session start when hooks are supported.',
60
- risk: 'low',
61
- },
62
- {
63
- key: 'pre-tool-use',
64
- file: '.codex/hooks.json',
65
- triggerPoint: 'PreToolUse',
66
- matcher: 'shell or tool events',
67
- purpose: 'Pre-flight validation before risky work.',
68
- risk: 'medium',
69
- },
70
- {
71
- key: 'post-tool-use',
72
- file: '.codex/hooks.json',
73
- triggerPoint: 'PostToolUse',
74
- matcher: 'shell or tool events',
75
- purpose: 'Post-edit checks and guardrails after commands complete.',
76
- risk: 'medium',
77
- },
78
- // CP-10: Expanded hook registry
79
- {
80
- key: 'user-prompt-submit',
81
- file: '.codex/hooks.json',
82
- triggerPoint: 'UserPromptSubmit',
83
- matcher: null,
84
- purpose: 'Validate or transform user prompts before they reach the model.',
85
- risk: 'low',
86
- },
87
- {
88
- key: 'stop',
89
- file: '.codex/hooks.json',
90
- triggerPoint: 'Stop',
91
- matcher: null,
92
- purpose: 'Clean up resources or log session outcomes when Codex exits.',
93
- risk: 'low',
94
- },
95
- // Parity hooks to match Claude's 7
96
- {
97
- key: 'injection-defense',
98
- file: '.codex/hooks.json',
99
- triggerPoint: 'PreToolUse',
100
- matcher: 'fetch or web events',
101
- purpose: 'Validate external content for prompt injection before processing.',
102
- risk: 'medium',
103
- },
104
- {
105
- key: 'trust-drift-check',
106
- file: '.codex/hooks.json',
107
- triggerPoint: 'PostToolUse',
108
- matcher: 'config or agents file changes',
109
- purpose: 'Detect config/instruction drift after tool edits that touch trust surfaces.',
110
- risk: 'medium',
111
- },
112
- ];
113
-
114
- const CODEX_POLICY_PACKS = [
115
- {
116
- key: 'baseline-safe',
117
- label: 'Baseline Safe',
118
- modules: ['AGENTS.md baseline', 'safe profile', 'network explicit', 'history explicit'],
119
- useWhen: 'Default local Codex rollout.',
120
- },
121
- {
122
- key: 'automation-reviewed',
123
- label: 'Automation Reviewed',
124
- modules: ['safe GitHub Action strategy', 'managed CODEX_API_KEY', 'manual test note'],
125
- useWhen: 'Repos adding Codex workflows in CI or scheduled automation.',
126
- },
127
- {
128
- key: 'skills-and-subagents',
129
- label: 'Skills + Subagents',
130
- modules: ['repo-local skills', 'custom agent field validation', 'fanout limits'],
131
- useWhen: 'Teams that want structured Codex specialization without losing governance.',
132
- },
133
- // CP-10: New policy packs
134
- {
135
- key: 'cloud-automation',
136
- label: 'Cloud Automation',
137
- modules: ['ci-automation profile', 'CODEX_API_KEY auth', 'exec safety review', 'cloud trust boundary'],
138
- useWhen: 'Repos deploying Codex in CI/CD, cloud tasks, or scheduled automation.',
139
- },
140
- {
141
- key: 'enterprise-strict',
142
- label: 'Enterprise Strict',
143
- modules: ['locked-down profile', 'audit trail', 'explicit governance export', 'compliance-safe history settings'],
144
- useWhen: 'Regulated or compliance-sensitive repos where every Codex action must be auditable.',
145
- },
146
- ];
147
-
148
- const CODEX_PILOT_ROLLOUT_KIT = {
149
- recommendedScope: [
150
- 'Start with audit and setup on one trusted repo before enabling automation.',
151
- 'Keep AGENTS.md and config.toml in version control so Codex behavior is reviewable.',
152
- 'Use workflow_dispatch or manual dry runs before schedules or cloud tasks.',
153
- ],
154
- approvals: [
155
- 'Engineering owner approves approval_policy and sandbox_mode.',
156
- 'Security owner approves any CI, cloud, or full-auto posture.',
157
- 'Pilot owner records before/after audit deltas and rollback expectations.',
158
- ],
159
- successMetrics: [
160
- 'Audit score delta',
161
- 'Config explicitness delta',
162
- 'Time to first useful Codex task',
163
- 'No-overwrite rate on existing repo files',
164
- ],
165
- rollbackExpectations: [
166
- 'Every Codex setup/apply write path should emit a rollback artifact.',
167
- 'Treat hooks on Windows as unsupported and move enforcement to CI.',
168
- 'Re-run audit after rollback to confirm the repo returned to the expected state.',
169
- ],
170
- };
171
-
172
- function getCodexGovernanceSummary() {
173
- return {
174
- platform: 'codex',
175
- platformLabel: 'Codex',
176
- permissionProfiles: CODEX_PERMISSION_PROFILES,
177
- hookRegistry: CODEX_HOOK_REGISTRY,
178
- policyPacks: CODEX_POLICY_PACKS,
179
- domainPacks: CODEX_DOMAIN_PACKS,
180
- mcpPacks: CODEX_MCP_PACKS,
181
- pilotRolloutKit: CODEX_PILOT_ROLLOUT_KIT,
182
- platformCaveats: [
183
- 'Hooks are not enforced on Windows today.',
184
- 'agents.max_threads defaults high enough to deserve an explicit cap.',
185
- 'Cloud tasks have a different trust class than local CLI work.',
186
- ],
187
- };
188
- }
189
-
190
- module.exports = {
191
- getCodexGovernanceSummary,
192
- };
1
+ const { CODEX_DOMAIN_PACKS } = require('./domain-packs');
2
+ const { CODEX_MCP_PACKS } = require('./mcp-packs');
3
+
4
+ const CODEX_PERMISSION_PROFILES = [
5
+ {
6
+ key: 'locked-down',
7
+ label: 'Locked Down',
8
+ risk: 'low',
9
+ defaultSandbox: 'read-only',
10
+ approvalPolicy: 'untrusted',
11
+ useWhen: 'First contact with a repo, security review, or regulated environments.',
12
+ behavior: 'No writes, explicit escalation for anything outside trusted commands.',
13
+ },
14
+ {
15
+ key: 'standard',
16
+ label: 'Standard',
17
+ risk: 'medium',
18
+ defaultSandbox: 'workspace-write',
19
+ approvalPolicy: 'on-request',
20
+ useWhen: 'Default product work where Codex edits locally but risky commands still need review.',
21
+ behavior: 'Balanced baseline for normal repo work.',
22
+ },
23
+ {
24
+ key: 'full-auto',
25
+ label: 'Full Auto',
26
+ risk: 'high',
27
+ defaultSandbox: 'workspace-write',
28
+ approvalPolicy: 'never',
29
+ useWhen: 'Externally sandboxed automation only, with strong repo guardrails.',
30
+ behavior: 'No approval prompts. Suitable only when the outer environment is controlled.',
31
+ },
32
+ {
33
+ key: 'unrestricted',
34
+ label: 'Unrestricted',
35
+ risk: 'critical',
36
+ defaultSandbox: 'danger-full-access',
37
+ approvalPolicy: 'never',
38
+ useWhen: 'Exceptional internal debugging only.',
39
+ behavior: 'Bypasses core safety boundaries and should never be the product default.',
40
+ },
41
+ // CP-10: New profile for CI/automation
42
+ {
43
+ key: 'ci-automation',
44
+ label: 'CI Automation',
45
+ risk: 'high',
46
+ defaultSandbox: 'workspace-write',
47
+ approvalPolicy: 'never',
48
+ useWhen: 'GitHub Actions, `codex exec`, or scheduled automation where the outer CI environment provides containment.',
49
+ behavior: 'No prompts. Designed for `codex exec` and GitHub Action contexts. Requires CODEX_API_KEY, not user credentials.',
50
+ },
51
+ ];
52
+
53
+ const CODEX_HOOK_REGISTRY = [
54
+ {
55
+ key: 'session-start',
56
+ file: '.codex/hooks.json',
57
+ triggerPoint: 'SessionStart',
58
+ matcher: null,
59
+ purpose: 'Bootstrap local context or guardrails at session start when hooks are supported.',
60
+ risk: 'low',
61
+ },
62
+ {
63
+ key: 'pre-tool-use',
64
+ file: '.codex/hooks.json',
65
+ triggerPoint: 'PreToolUse',
66
+ matcher: 'shell or tool events',
67
+ purpose: 'Pre-flight validation before risky work.',
68
+ risk: 'medium',
69
+ },
70
+ {
71
+ key: 'post-tool-use',
72
+ file: '.codex/hooks.json',
73
+ triggerPoint: 'PostToolUse',
74
+ matcher: 'shell or tool events',
75
+ purpose: 'Post-edit checks and guardrails after commands complete.',
76
+ risk: 'medium',
77
+ },
78
+ // CP-10: Expanded hook registry
79
+ {
80
+ key: 'user-prompt-submit',
81
+ file: '.codex/hooks.json',
82
+ triggerPoint: 'UserPromptSubmit',
83
+ matcher: null,
84
+ purpose: 'Validate or transform user prompts before they reach the model.',
85
+ risk: 'low',
86
+ },
87
+ {
88
+ key: 'stop',
89
+ file: '.codex/hooks.json',
90
+ triggerPoint: 'Stop',
91
+ matcher: null,
92
+ purpose: 'Clean up resources or log session outcomes when Codex exits.',
93
+ risk: 'low',
94
+ },
95
+ // Parity hooks to match Claude's 7
96
+ {
97
+ key: 'injection-defense',
98
+ file: '.codex/hooks.json',
99
+ triggerPoint: 'PreToolUse',
100
+ matcher: 'fetch or web events',
101
+ purpose: 'Validate external content for prompt injection before processing.',
102
+ risk: 'medium',
103
+ },
104
+ {
105
+ key: 'trust-drift-check',
106
+ file: '.codex/hooks.json',
107
+ triggerPoint: 'PostToolUse',
108
+ matcher: 'config or agents file changes',
109
+ purpose: 'Detect config/instruction drift after tool edits that touch trust surfaces.',
110
+ risk: 'medium',
111
+ },
112
+ ];
113
+
114
+ const CODEX_POLICY_PACKS = [
115
+ {
116
+ key: 'baseline-safe',
117
+ label: 'Baseline Safe',
118
+ modules: ['AGENTS.md baseline', 'safe profile', 'network explicit', 'history explicit'],
119
+ useWhen: 'Default local Codex rollout.',
120
+ },
121
+ {
122
+ key: 'automation-reviewed',
123
+ label: 'Automation Reviewed',
124
+ modules: ['safe GitHub Action strategy', 'managed CODEX_API_KEY', 'manual test note'],
125
+ useWhen: 'Repos adding Codex workflows in CI or scheduled automation.',
126
+ },
127
+ {
128
+ key: 'skills-and-subagents',
129
+ label: 'Skills + Subagents',
130
+ modules: ['repo-local skills', 'custom agent field validation', 'fanout limits'],
131
+ useWhen: 'Teams that want structured Codex specialization without losing governance.',
132
+ },
133
+ // CP-10: New policy packs
134
+ {
135
+ key: 'cloud-automation',
136
+ label: 'Cloud Automation',
137
+ modules: ['ci-automation profile', 'CODEX_API_KEY auth', 'exec safety review', 'cloud trust boundary'],
138
+ useWhen: 'Repos deploying Codex in CI/CD, cloud tasks, or scheduled automation.',
139
+ },
140
+ {
141
+ key: 'enterprise-strict',
142
+ label: 'Enterprise Strict',
143
+ modules: ['locked-down profile', 'audit trail', 'explicit governance export', 'compliance-safe history settings'],
144
+ useWhen: 'Regulated or compliance-sensitive repos where every Codex action must be auditable.',
145
+ },
146
+ ];
147
+
148
+ const CODEX_PILOT_ROLLOUT_KIT = {
149
+ recommendedScope: [
150
+ 'Start with audit and setup on one trusted repo before enabling automation.',
151
+ 'Keep AGENTS.md and config.toml in version control so Codex behavior is reviewable.',
152
+ 'Use workflow_dispatch or manual dry runs before schedules or cloud tasks.',
153
+ ],
154
+ approvals: [
155
+ 'Engineering owner approves approval_policy and sandbox_mode.',
156
+ 'Security owner approves any CI, cloud, or full-auto posture.',
157
+ 'Pilot owner records before/after audit deltas and rollback expectations.',
158
+ ],
159
+ successMetrics: [
160
+ 'Audit score delta',
161
+ 'Config explicitness delta',
162
+ 'Time to first useful Codex task',
163
+ 'No-overwrite rate on existing repo files',
164
+ ],
165
+ rollbackExpectations: [
166
+ 'Every Codex setup/apply write path should emit a rollback artifact.',
167
+ 'Treat hooks on Windows as unsupported and move enforcement to CI.',
168
+ 'Re-run audit after rollback to confirm the repo returned to the expected state.',
169
+ ],
170
+ };
171
+
172
+ function getCodexGovernanceSummary() {
173
+ return {
174
+ platform: 'codex',
175
+ platformLabel: 'Codex',
176
+ permissionProfiles: CODEX_PERMISSION_PROFILES,
177
+ hookRegistry: CODEX_HOOK_REGISTRY,
178
+ policyPacks: CODEX_POLICY_PACKS,
179
+ domainPacks: CODEX_DOMAIN_PACKS,
180
+ mcpPacks: CODEX_MCP_PACKS,
181
+ pilotRolloutKit: CODEX_PILOT_ROLLOUT_KIT,
182
+ platformCaveats: [
183
+ 'Hooks are not enforced on Windows today.',
184
+ 'agents.max_threads defaults high enough to deserve an explicit cap.',
185
+ 'Cloud tasks have a different trust class than local CLI work.',
186
+ ],
187
+ };
188
+ }
189
+
190
+ module.exports = {
191
+ getCodexGovernanceSummary,
192
+ };