@nerviq/cli 1.20.1 → 1.21.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 (181) hide show
  1. package/LICENSE +23 -23
  2. package/README.md +2 -2
  3. package/package.json +1 -1
  4. package/src/activity.js +1039 -1039
  5. package/src/adoption-advisor.js +299 -299
  6. package/src/aider/config-parser.js +166 -166
  7. package/src/aider/context.js +4 -1
  8. package/src/aider/deep-review.js +316 -316
  9. package/src/aider/domain-packs.js +303 -303
  10. package/src/aider/freshness.js +93 -93
  11. package/src/aider/governance.js +253 -253
  12. package/src/aider/interactive.js +334 -334
  13. package/src/aider/mcp-packs.js +329 -329
  14. package/src/aider/patch.js +214 -214
  15. package/src/aider/plans.js +186 -186
  16. package/src/aider/premium.js +360 -360
  17. package/src/aider/setup.js +404 -404
  18. package/src/aider/techniques.js +312 -67
  19. package/src/analyze.js +951 -951
  20. package/src/anti-patterns.js +485 -485
  21. package/src/audit/instruction-files.js +180 -180
  22. package/src/audit/recommendations.js +577 -577
  23. package/src/auto-suggest.js +154 -154
  24. package/src/badge.js +13 -13
  25. package/src/behavioral-drift.js +801 -801
  26. package/src/benchmark.js +67 -67
  27. package/src/catalog.js +103 -103
  28. package/src/certification.js +128 -128
  29. package/src/codex/config-parser.js +183 -183
  30. package/src/codex/context.js +223 -223
  31. package/src/codex/deep-review.js +493 -493
  32. package/src/codex/domain-packs.js +394 -394
  33. package/src/codex/freshness.js +84 -84
  34. package/src/codex/governance.js +192 -192
  35. package/src/codex/interactive.js +618 -618
  36. package/src/codex/mcp-packs.js +914 -914
  37. package/src/codex/patch.js +209 -209
  38. package/src/codex/plans.js +251 -251
  39. package/src/codex/premium.js +614 -614
  40. package/src/codex/setup.js +591 -591
  41. package/src/continuous-ops.js +681 -681
  42. package/src/copilot/activity.js +309 -309
  43. package/src/copilot/deep-review.js +346 -346
  44. package/src/copilot/domain-packs.js +372 -372
  45. package/src/copilot/freshness.js +57 -57
  46. package/src/copilot/governance.js +222 -222
  47. package/src/copilot/interactive.js +406 -406
  48. package/src/copilot/mcp-packs.js +826 -826
  49. package/src/copilot/plans.js +253 -253
  50. package/src/copilot/premium.js +451 -451
  51. package/src/copilot/setup.js +488 -488
  52. package/src/cost-tracking.js +61 -61
  53. package/src/cursor/activity.js +301 -301
  54. package/src/cursor/config-parser.js +265 -265
  55. package/src/cursor/context.js +256 -256
  56. package/src/cursor/deep-review.js +334 -334
  57. package/src/cursor/domain-packs.js +368 -368
  58. package/src/cursor/freshness.js +65 -65
  59. package/src/cursor/governance.js +229 -229
  60. package/src/cursor/interactive.js +391 -391
  61. package/src/cursor/mcp-packs.js +828 -828
  62. package/src/cursor/plans.js +254 -254
  63. package/src/cursor/premium.js +469 -469
  64. package/src/cursor/setup.js +488 -488
  65. package/src/dashboard.js +493 -493
  66. package/src/deep-review.js +428 -428
  67. package/src/deprecation.js +98 -98
  68. package/src/diff-only.js +280 -280
  69. package/src/doctor.js +119 -119
  70. package/src/domain-pack-expansion.js +1033 -1033
  71. package/src/domain-packs.js +387 -387
  72. package/src/feedback.js +178 -178
  73. package/src/fix-engine.js +783 -783
  74. package/src/fix-prompts.js +122 -122
  75. package/src/formatters/sarif.js +115 -115
  76. package/src/freshness.js +74 -74
  77. package/src/gemini/config-parser.js +275 -275
  78. package/src/gemini/deep-review.js +559 -559
  79. package/src/gemini/domain-packs.js +393 -393
  80. package/src/gemini/freshness.js +66 -66
  81. package/src/gemini/governance.js +201 -201
  82. package/src/gemini/interactive.js +860 -860
  83. package/src/gemini/mcp-packs.js +915 -915
  84. package/src/gemini/plans.js +269 -269
  85. package/src/gemini/premium.js +760 -760
  86. package/src/gemini/setup.js +692 -692
  87. package/src/governance.js +72 -72
  88. package/src/harmony/add.js +68 -68
  89. package/src/harmony/advisor.js +333 -333
  90. package/src/harmony/canon.js +565 -565
  91. package/src/harmony/cli.js +591 -591
  92. package/src/harmony/drift.js +401 -401
  93. package/src/harmony/governance.js +313 -313
  94. package/src/harmony/memory.js +239 -239
  95. package/src/harmony/sync.js +475 -475
  96. package/src/harmony/watch.js +370 -370
  97. package/src/hook-validation.js +342 -342
  98. package/src/index.js +271 -271
  99. package/src/init.js +184 -184
  100. package/src/instruction-surfaces.js +185 -185
  101. package/src/integrations.js +144 -144
  102. package/src/interactive.js +118 -118
  103. package/src/locales/en.json +1 -1
  104. package/src/locales/es.json +1 -1
  105. package/src/mcp-packs.js +830 -830
  106. package/src/mcp-server.js +726 -726
  107. package/src/mcp-validation.js +337 -337
  108. package/src/nerviq-sync.json +7 -7
  109. package/src/opencode/config-parser.js +109 -109
  110. package/src/opencode/context.js +247 -247
  111. package/src/opencode/deep-review.js +313 -313
  112. package/src/opencode/domain-packs.js +262 -262
  113. package/src/opencode/freshness.js +66 -66
  114. package/src/opencode/governance.js +159 -159
  115. package/src/opencode/interactive.js +392 -392
  116. package/src/opencode/mcp-packs.js +705 -705
  117. package/src/opencode/patch.js +184 -184
  118. package/src/opencode/plans.js +231 -231
  119. package/src/opencode/premium.js +413 -413
  120. package/src/opencode/setup.js +449 -449
  121. package/src/opencode/techniques.js +27 -27
  122. package/src/operating-profile.js +574 -574
  123. package/src/org.js +152 -152
  124. package/src/permission-rules.js +218 -218
  125. package/src/plans.js +839 -839
  126. package/src/platform-change-manifest.js +86 -86
  127. package/src/plugins.js +110 -110
  128. package/src/policy-layers.js +210 -210
  129. package/src/profiles.js +124 -124
  130. package/src/prompt-injection.js +74 -74
  131. package/src/public-api.js +173 -173
  132. package/src/recommendation-rules.js +84 -84
  133. package/src/repo-archetype.js +386 -386
  134. package/src/secret-patterns.js +39 -39
  135. package/src/server.js +527 -527
  136. package/src/setup/analysis.js +607 -607
  137. package/src/setup/runtime.js +172 -172
  138. package/src/setup.js +677 -677
  139. package/src/shared/capabilities.js +194 -194
  140. package/src/source-urls.js +132 -132
  141. package/src/stack-checks.js +565 -565
  142. package/src/supplemental-checks.js +13 -13
  143. package/src/synergy/adaptive.js +261 -261
  144. package/src/synergy/compensation.js +137 -137
  145. package/src/synergy/evidence.js +193 -193
  146. package/src/synergy/learning.js +199 -199
  147. package/src/synergy/patterns.js +227 -227
  148. package/src/synergy/ranking.js +83 -83
  149. package/src/synergy/report.js +165 -165
  150. package/src/synergy/routing.js +146 -146
  151. package/src/techniques/api.js +407 -407
  152. package/src/techniques/automation.js +316 -316
  153. package/src/techniques/compliance.js +257 -257
  154. package/src/techniques/hygiene.js +294 -294
  155. package/src/techniques/instructions.js +243 -243
  156. package/src/techniques/observability.js +226 -226
  157. package/src/techniques/optimization.js +142 -142
  158. package/src/techniques/quality.js +318 -318
  159. package/src/techniques/security.js +237 -237
  160. package/src/techniques/shared.js +443 -443
  161. package/src/techniques/stacks.js +2294 -2294
  162. package/src/techniques/tools.js +106 -106
  163. package/src/techniques/workflow.js +413 -413
  164. package/src/techniques.js +81 -81
  165. package/src/terminology.js +73 -73
  166. package/src/token-estimate.js +35 -35
  167. package/src/usage-patterns.js +99 -99
  168. package/src/verification-metadata.js +145 -145
  169. package/src/watch.js +247 -247
  170. package/src/windsurf/activity.js +302 -302
  171. package/src/windsurf/config-parser.js +267 -267
  172. package/src/windsurf/deep-review.js +337 -337
  173. package/src/windsurf/domain-packs.js +370 -370
  174. package/src/windsurf/freshness.js +36 -36
  175. package/src/windsurf/governance.js +231 -231
  176. package/src/windsurf/interactive.js +388 -388
  177. package/src/windsurf/mcp-packs.js +792 -792
  178. package/src/windsurf/plans.js +247 -247
  179. package/src/windsurf/premium.js +468 -468
  180. package/src/windsurf/setup.js +471 -471
  181. 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
+ };