claude-dev-env 7.4.1 → 7.6.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 (178) hide show
  1. package/.agents/skills/everything-search/scripts/everything_search.py +11 -0
  2. package/.agents/skills/everything-search/scripts/test_everything_search.py +1 -0
  3. package/.agents/skills/fresh-branch/SKILL.md +1 -0
  4. package/.agents/skills/fresh-branch/scripts/fresh_branch_git_commands.py +3 -0
  5. package/.agents/skills/fresh-branch/scripts/subprocess_window_access.py +43 -0
  6. package/.agents/skills/syncing-submodules/SKILL.md +1 -0
  7. package/.agents/skills/syncing-submodules/scripts/submodule_sync.py +4 -0
  8. package/.agents/skills/syncing-submodules/scripts/subprocess_window_access.py +43 -0
  9. package/.agents/skills/test-runner/SKILL.md +1 -0
  10. package/.agents/skills/test-runner/scripts/preflight_checks.py +5 -0
  11. package/.agents/skills/test-runner/scripts/run_tests.py +11 -0
  12. package/.agents/skills/test-runner/scripts/subprocess_window_access.py +43 -0
  13. package/.agents/skills/test-runner/scripts/test_run_tests.py +9 -7
  14. package/_shared/pr-loop/scripts/check_bugbot_ci.py +3 -0
  15. package/_shared/pr-loop/scripts/check_convergence_gates.py +3 -0
  16. package/_shared/pr-loop/scripts/check_pending_reviews.py +3 -0
  17. package/_shared/pr-loop/scripts/code_rules_gate_parts/added_line_maps.py +3 -0
  18. package/_shared/pr-loop/scripts/code_rules_gate_parts/baseline_import_isolation.py +3 -0
  19. package/_shared/pr-loop/scripts/code_rules_gate_parts/git_blob_readers.py +5 -0
  20. package/_shared/pr-loop/scripts/code_rules_gate_parts/git_file_sets.py +4 -0
  21. package/_shared/pr-loop/scripts/code_rules_gate_parts/staged_test_regression.py +3 -0
  22. package/_shared/pr-loop/scripts/code_rules_gate_parts/staged_test_running.py +3 -0
  23. package/_shared/pr-loop/scripts/codex_usage_probe.py +3 -0
  24. package/_shared/pr-loop/scripts/copilot_quota.py +3 -0
  25. package/_shared/pr-loop/scripts/fetch_copilot_reviews.py +3 -0
  26. package/_shared/pr-loop/scripts/fix_hookspath.py +7 -0
  27. package/_shared/pr-loop/scripts/post_fix_reply.py +4 -0
  28. package/_shared/pr-loop/scripts/preflight.py +7 -0
  29. package/_shared/pr-loop/scripts/preflight_self_heal.py +5 -0
  30. package/_shared/pr-loop/scripts/run_codex_review.py +3 -0
  31. package/_shared/pr-loop/scripts/subprocess_window_access.py +41 -0
  32. package/_shared/pr-loop/scripts/terminology_sweep.py +5 -0
  33. package/_shared/process-tree/scripts/process_tree_kill.py +3 -0
  34. package/_shared/process-tree/scripts/subprocess_window_access.py +41 -0
  35. package/bin/install-constants.mjs +4 -2
  36. package/bin/install.cursor-rules.test.mjs +57 -15
  37. package/bin/install.mjs +10 -16
  38. package/bin/install.policy-lint.test.mjs +1 -2
  39. package/bin/install.test.mjs +0 -1
  40. package/bin/pstack-model-preferences.claude.json +23 -0
  41. package/hooks/advisory/msys_path_conversion_advisor.py +200 -0
  42. package/hooks/advisory/pr_done_reminder.py +14 -13
  43. package/hooks/advisory/refactor_guard.py +8 -0
  44. package/hooks/advisory/test_msys_path_conversion_advisor.py +223 -0
  45. package/hooks/advisory/test_pr_done_reminder.py +22 -0
  46. package/hooks/advisory/test_refactor_guard.py +40 -0
  47. package/hooks/blocking/bash_post_call_dispatcher.py +6 -11
  48. package/hooks/blocking/block_main_commit.py +4 -0
  49. package/hooks/blocking/code_rules_comments.py +39 -5
  50. package/hooks/blocking/msys_rev_path_rewriter.py +192 -0
  51. package/hooks/blocking/pii_prevention_blocker_parts/repository_exemption.py +3 -0
  52. package/hooks/blocking/precommit_code_rules_gate.py +3 -0
  53. package/hooks/blocking/tdd_enforcer_parts/content_analysis.py +19 -3
  54. package/hooks/blocking/tdd_enforcer_parts/git_tracking.py +4 -0
  55. package/hooks/blocking/tdd_enforcer_parts/tests/test_content_analysis.py +25 -0
  56. package/hooks/blocking/test_bash_dispatcher_interpreter_starts.py +16 -3
  57. package/hooks/blocking/test_bash_post_call_dispatcher.py +2 -0
  58. package/hooks/blocking/test_code_rules_enforcer_comment_string_awareness.py +27 -0
  59. package/hooks/blocking/test_code_rules_enforcer_exempt_marker_chained.py +10 -0
  60. package/hooks/blocking/test_msys_rev_path_rewriter.py +141 -0
  61. package/hooks/git-hooks/git_hooks_constants/verification_notice_constants.py +0 -2
  62. package/hooks/git-hooks/pull_request_handoff.py +3 -0
  63. package/hooks/git-hooks/subprocess_window_access.py +41 -0
  64. package/hooks/git-hooks/test_verification_start.py +4 -0
  65. package/hooks/git-hooks/verification_notice_context.py +3 -0
  66. package/hooks/git-hooks/verification_start.py +7 -8
  67. package/hooks/hooks.json +10 -0
  68. package/hooks/hooks_constants/bash_post_call_dispatcher_constants.py +9 -0
  69. package/hooks/hooks_constants/bash_pre_tool_use_dispatcher_constants.py +6 -1
  70. package/hooks/hooks_constants/code_rules_enforcer_constants.py +2 -0
  71. package/hooks/hooks_constants/msys_path_conversion_advisor_constants.py +48 -0
  72. package/hooks/hooks_constants/msys_rev_path_rewriter_constants.py +37 -0
  73. package/hooks/hooks_constants/post_tool_use_context.py +34 -0
  74. package/hooks/hooks_constants/pr_done_reminder_constants.py +0 -2
  75. package/hooks/hooks_constants/pre_tool_use_allow_output.py +48 -0
  76. package/hooks/hooks_constants/subprocess_window.py +141 -0
  77. package/hooks/hooks_constants/subprocess_window_constants.py +9 -0
  78. package/hooks/hooks_constants/test_bash_post_call_dispatcher_constants.py +9 -2
  79. package/hooks/hooks_constants/test_bash_pre_tool_use_dispatcher_constants.py +9 -2
  80. package/hooks/hooks_constants/test_code_rules_enforcer_constants.py +6 -0
  81. package/hooks/hooks_constants/test_failure_recorder_constants.py +1 -2
  82. package/hooks/hooks_constants/test_post_tool_use_context.py +22 -0
  83. package/hooks/hooks_constants/test_pre_tool_use_allow_output.py +27 -0
  84. package/hooks/hooks_constants/test_subprocess_window.py +128 -0
  85. package/hooks/lifecycle/enter_worktree_origin_prefetch.py +3 -0
  86. package/hooks/observability/test_failure_recorder.py +3 -1
  87. package/hooks/validation/mypy_validator.py +4 -0
  88. package/hooks/validators/README.md +1 -0
  89. package/hooks/validators/git_checks.py +4 -0
  90. package/hooks/validators/health_check.py +3 -0
  91. package/hooks/validators/hook_timing_harness.py +3 -0
  92. package/hooks/validators/mypy_integration.py +4 -0
  93. package/hooks/validators/ruff_integration.py +6 -0
  94. package/hooks/validators/run_all_validators.py +7 -0
  95. package/hooks/validators/subprocess_window_access.py +41 -0
  96. package/hooks/workflow/auto_formatter.py +8 -0
  97. package/hooks/workflow/test_auto_formatter.py +39 -0
  98. package/package.json +1 -1
  99. package/rules/ask-user-question-required.md +3 -3
  100. package/rules/code-standards.md +3 -2
  101. package/rules/confirm-implementation-forks.md +2 -0
  102. package/rules/destructive-commands.md +19 -19
  103. package/rules/doc-inventory-integrity.md +4 -4
  104. package/rules/docstring-prose-matches-implementation.md +2 -2
  105. package/rules/failure-blast-radius.md +4 -2
  106. package/rules/filesystem-search.md +1 -1
  107. package/rules/git-workflow.md +34 -0
  108. package/rules/long-horizon-autonomy.md +2 -0
  109. package/rules/nas-ssh-invocation.md +3 -3
  110. package/rules/no-cross-skill-duplicate-helpers.md +6 -6
  111. package/rules/orphan-css-class.md +5 -5
  112. package/rules/paired-test-coverage.md +6 -6
  113. package/rules/plain-illustrative-docstrings.md +3 -3
  114. package/rules/pstack-models.md +4 -3
  115. package/rules/re-stage-before-commit.md +7 -7
  116. package/rules/retired-hook-prose.md +16 -0
  117. package/rules/shell-invocation.md +17 -1
  118. package/rules/testing.md +3 -5
  119. package/rules/verify-runtime-state.md +1 -1
  120. package/rules/windows-filesystem-safe.md +2 -2
  121. package/rules/workflow-substitution-slots.md +1 -1
  122. package/scripts/automatic_advisory/checkout.py +8 -1
  123. package/scripts/automatic_advisory/cli.py +9 -3
  124. package/scripts/automatic_advisory/config/constants.py +0 -2
  125. package/scripts/automatic_advisory/execution.py +7 -1
  126. package/scripts/automatic_advisory/git.py +9 -1
  127. package/scripts/automatic_advisory/process_host.py +3 -0
  128. package/scripts/claude_chain_runner.py +3 -0
  129. package/scripts/durable_post_lint_config/config/constants.py +0 -3
  130. package/scripts/durable_post_lint_config/config/test_constants.py +5 -0
  131. package/scripts/gh_artifact_upload.py +3 -0
  132. package/scripts/grok_headless_runner.py +3 -0
  133. package/scripts/grok_patch_artifacts.py +4 -0
  134. package/scripts/grok_worker_preflight.py +3 -0
  135. package/scripts/invoke_code_review.py +3 -0
  136. package/scripts/local_verification/command_runner.py +3 -0
  137. package/scripts/local_verification/git_state.py +3 -0
  138. package/scripts/policy_lint/adapter_configuration.py +24 -0
  139. package/scripts/policy_lint/adapter_detectors.py +48 -2
  140. package/scripts/policy_lint/adapter_pairing.py +150 -2
  141. package/scripts/policy_lint/adapter_retired_hook_prose.py +201 -0
  142. package/scripts/policy_lint/adapters.py +82 -5
  143. package/scripts/policy_lint/config/approved_test_pairs.py +25 -9
  144. package/scripts/policy_lint/config/constants.py +77 -0
  145. package/scripts/policy_lint/registry.py +6 -1
  146. package/scripts/policy_lint/selection.py +37 -18
  147. package/scripts/policy_lint/selection_git.py +17 -2
  148. package/scripts/repository_checks/config/constants.py +5 -0
  149. package/scripts/repository_checks/config/policy_document.py +19 -0
  150. package/scripts/repository_checks/email_exemptions.py +14 -71
  151. package/scripts/repository_checks/path_exemptions.py +35 -0
  152. package/scripts/repository_checks/policy_document.py +120 -0
  153. package/scripts/repository_checks/tracked_secrets.py +27 -4
  154. package/scripts/setup_project_paths.py +3 -0
  155. package/scripts/spawn_grok_batch.py +3 -0
  156. package/scripts/subprocess_window_access.py +41 -0
  157. package/scripts/test_dispatcher_profile_import.py +4 -0
  158. package/scripts/test_durable_post_lint.py +42 -9
  159. package/scripts/tests/test_adapter_configuration.py +8 -0
  160. package/scripts/tests/test_automatic_advisory_window_flags.py +17 -11
  161. package/scripts/tests/test_email_exemptions.py +37 -0
  162. package/scripts/tests/test_path_exemptions.py +164 -0
  163. package/scripts/tests/test_policy_document.py +104 -0
  164. package/scripts/tests/test_policy_lint_rules_function_length_scope.py +101 -0
  165. package/scripts/tests/test_policy_lint_rules_pairing.py +375 -0
  166. package/scripts/tests/test_policy_lint_rules_registry.py +116 -0
  167. package/scripts/tests/test_policy_lint_rules_retired_hook_prose.py +197 -0
  168. package/scripts/tests/test_policy_lint_selection.py +141 -0
  169. package/scripts/tests/test_subprocess_window_access.py +118 -0
  170. package/scripts/tests/test_tracked_secrets.py +79 -0
  171. package/scripts/validate_instruction_pairs.py +3 -0
  172. package/scripts/verify_installable_package.py +5 -0
  173. package/hooks/hooks_constants/convergence_branch_constants.py +0 -8
  174. package/hooks/hooks_constants/destructive_command_environment_constants.py +0 -18
  175. package/hooks/hooks_constants/test_text_stripping.py +0 -39
  176. package/hooks/hooks_constants/text_stripping.py +0 -36
  177. package/scripts/automatic_advisory/window_flags.py +0 -41
  178. package/scripts/repository_checks/config/email_exemptions.py +0 -10
@@ -48,6 +48,8 @@ from reviews_disabled import (
48
48
  is_bugteam_disabled_via_env,
49
49
  )
50
50
 
51
+ from subprocess_window_access import hidden_window_creation_flags, inherited_stream_startup_info
52
+
51
53
 
52
54
  def verify_git_hooks_path(repository_root: Path | None = None) -> int:
53
55
  """Check that core.hooksPath resolves to the claude-dev-env git-hooks directory.
@@ -95,6 +97,7 @@ def verify_git_hooks_path(repository_root: Path | None = None) -> int:
95
97
  encoding="utf-8",
96
98
  errors="replace",
97
99
  check=False,
100
+ creationflags=hidden_window_creation_flags(),
98
101
  )
99
102
  except FileNotFoundError:
100
103
  print(
@@ -201,6 +204,7 @@ def has_discoverable_tests(root: Path) -> bool | None:
201
204
  encoding="utf-8",
202
205
  errors="replace",
203
206
  check=True,
207
+ creationflags=hidden_window_creation_flags(),
204
208
  )
205
209
  except FileNotFoundError:
206
210
  print(
@@ -260,6 +264,7 @@ def run_pytest(
260
264
  command,
261
265
  cwd=str(repository_root),
262
266
  check=False,
267
+ startupinfo=inherited_stream_startup_info(),
263
268
  )
264
269
  if completed.returncode == _pytest_exit_code_no_tests_collected():
265
270
  return 0
@@ -302,6 +307,7 @@ def get_changed_files(repository_root: Path, base_ref: str) -> list[Path] | None
302
307
  encoding="utf-8",
303
308
  errors="replace",
304
309
  check=False,
310
+ creationflags=hidden_window_creation_flags(),
305
311
  )
306
312
  except FileNotFoundError:
307
313
  print(
@@ -398,6 +404,7 @@ def run_pre_commit(repository_root: Path) -> int:
398
404
  list(ALL_PRE_COMMIT_RUN_ALL_FILES_COMMAND),
399
405
  cwd=str(repository_root),
400
406
  check=False,
407
+ startupinfo=inherited_stream_startup_info(),
401
408
  )
402
409
  return completed.returncode
403
410
 
@@ -24,6 +24,8 @@ from pr_loop_shared_constants.preflight_self_heal_constants import ( # noqa: E4
24
24
  ALL_GIT_CONFIG_LOCAL_UNSET_ALL_HOOKS_PATH_ARGUMENTS,
25
25
  )
26
26
 
27
+ from subprocess_window_access import hidden_window_creation_flags
28
+
27
29
 
28
30
  def _is_canonical_hooks_path_entry(
29
31
  raw_hooks_path_entry: str,
@@ -71,6 +73,7 @@ def _canonical_global_hooks_path_is_set(expected_hooks_path_suffix: str) -> bool
71
73
  encoding="utf-8",
72
74
  errors="replace",
73
75
  check=False,
76
+ creationflags=hidden_window_creation_flags(),
74
77
  )
75
78
  except (FileNotFoundError, OSError):
76
79
  return False
@@ -127,6 +130,7 @@ def silently_clear_stale_local_hooks_path_override(
127
130
  encoding="utf-8",
128
131
  errors="replace",
129
132
  check=False,
133
+ creationflags=hidden_window_creation_flags(),
130
134
  )
131
135
  except (FileNotFoundError, OSError):
132
136
  return
@@ -159,6 +163,7 @@ def silently_clear_stale_local_hooks_path_override(
159
163
  encoding="utf-8",
160
164
  errors="replace",
161
165
  check=False,
166
+ creationflags=hidden_window_creation_flags(),
162
167
  )
163
168
  except (FileNotFoundError, OSError):
164
169
  return
@@ -90,6 +90,8 @@ from codex_review_scripts_constants.run_constants import ( # noqa: E402
90
90
  VERSION_PROBE_PATTERN,
91
91
  )
92
92
 
93
+ from subprocess_window_access import hidden_window_creation_flags
94
+
93
95
 
94
96
  def _open_codex_popen(
95
97
  all_arguments: list[str],
@@ -110,6 +112,7 @@ def _open_codex_popen(
110
112
  encoding=stream_encoding if isinstance(stream_encoding, str) else None,
111
113
  env=process_environment if isinstance(process_environment, dict) else None,
112
114
  start_new_session=should_start_new_session(),
115
+ creationflags=hidden_window_creation_flags(),
113
116
  )
114
117
 
115
118
 
@@ -0,0 +1,41 @@
1
+ """Reach the hidden-window helpers from the scripts this directory deploys.
2
+
3
+ The installer copies this directory into a profile that holds no installed
4
+ Python distribution, and this repository's own tests run the deployed scripts
5
+ under ``python -S -E``, which hides every installed package from the child
6
+ process. On both routes ``hooks_constants`` is reachable only through the
7
+ deployed ``hooks`` directory, so this module puts that directory on
8
+ ``sys.path`` and re-exports the helpers a caller asks for::
9
+
10
+ from subprocess_window_access import hidden_window_creation_flags
11
+
12
+ The directory goes on the end of ``sys.path``. ``PathFinder`` runs ahead of
13
+ every editable-install finder, so a trailing entry still selects the deployed
14
+ copy, and the head of ``sys.path`` stays exactly as the caller left it. A
15
+ caller that prepended its own roots keeps them first.
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ import sys
21
+ from pathlib import Path
22
+
23
+ _subprocess_window_hooks_directory = str(
24
+ Path(__file__).resolve().parents[3] / "hooks"
25
+ )
26
+ if _subprocess_window_hooks_directory not in sys.path:
27
+ sys.path.append(_subprocess_window_hooks_directory)
28
+
29
+ from hooks_constants.subprocess_window import (
30
+ HiddenWindowStartupInfo,
31
+ detached_hidden_window_creation_flags,
32
+ hidden_window_creation_flags,
33
+ inherited_stream_startup_info,
34
+ )
35
+
36
+ __all__ = [
37
+ "HiddenWindowStartupInfo",
38
+ "detached_hidden_window_creation_flags",
39
+ "hidden_window_creation_flags",
40
+ "inherited_stream_startup_info",
41
+ ]
@@ -75,6 +75,8 @@ from pr_loop_shared_constants.terminology_sweep_constants import (
75
75
  TEST_FILE_SUFFIX,
76
76
  )
77
77
 
78
+ from subprocess_window_access import hidden_window_creation_flags
79
+
78
80
  IdentifierTuple = tuple[str, ...]
79
81
 
80
82
 
@@ -656,6 +658,7 @@ def _base_tree_names(
656
658
  timeout=GIT_DIFF_SUBPROCESS_TIMEOUT_SECONDS,
657
659
  check=False,
658
660
  env=repository_environment(),
661
+ creationflags=hidden_window_creation_flags(),
659
662
  )
660
663
  except (subprocess.TimeoutExpired, FileNotFoundError, OSError):
661
664
  continue
@@ -678,6 +681,7 @@ def _run_strict_git(
678
681
  timeout=GIT_DIFF_SUBPROCESS_TIMEOUT_SECONDS,
679
682
  check=False,
680
683
  env=repository_environment(),
684
+ creationflags=hidden_window_creation_flags(),
681
685
  )
682
686
  except (subprocess.TimeoutExpired, OSError) as e:
683
687
  raise RuntimeError(str(e)) from e
@@ -807,6 +811,7 @@ def staged_terminology_findings(repository_root: Path) -> list[str]:
807
811
  timeout=GIT_DIFF_SUBPROCESS_TIMEOUT_SECONDS,
808
812
  check=False,
809
813
  env=repository_environment(),
814
+ creationflags=hidden_window_creation_flags(),
810
815
  )
811
816
  if diff_process.returncode != 0:
812
817
  return []
@@ -39,6 +39,8 @@ from process_tree_scripts_constants.process_tree_kill_constants import ( # noqa
39
39
  WINDOWS_TASKKILL_TREE_FLAG,
40
40
  )
41
41
 
42
+ from subprocess_window_access import hidden_window_creation_flags
43
+
42
44
  process_tree_subprocess_run = subprocess.run
43
45
 
44
46
 
@@ -73,6 +75,7 @@ def _kill_windows_process_tree(process_identifier: int) -> None:
73
75
  stderr=subprocess.DEVNULL,
74
76
  check=False,
75
77
  timeout=PROCESS_TREE_KILL_TIMEOUT_SECONDS,
78
+ creationflags=hidden_window_creation_flags(),
76
79
  )
77
80
  except (subprocess.TimeoutExpired, OSError):
78
81
  return
@@ -0,0 +1,41 @@
1
+ """Reach the hidden-window helpers from the scripts this directory deploys.
2
+
3
+ The installer copies this directory into a profile that holds no installed
4
+ Python distribution, and this repository's own tests run the deployed scripts
5
+ under ``python -S -E``, which hides every installed package from the child
6
+ process. On both routes ``hooks_constants`` is reachable only through the
7
+ deployed ``hooks`` directory, so this module puts that directory on
8
+ ``sys.path`` and re-exports the helpers a caller asks for::
9
+
10
+ from subprocess_window_access import hidden_window_creation_flags
11
+
12
+ The directory goes on the end of ``sys.path``. ``PathFinder`` runs ahead of
13
+ every editable-install finder, so a trailing entry still selects the deployed
14
+ copy, and the head of ``sys.path`` stays exactly as the caller left it. A
15
+ caller that prepended its own roots keeps them first.
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ import sys
21
+ from pathlib import Path
22
+
23
+ _subprocess_window_hooks_directory = str(
24
+ Path(__file__).resolve().parents[3] / "hooks"
25
+ )
26
+ if _subprocess_window_hooks_directory not in sys.path:
27
+ sys.path.append(_subprocess_window_hooks_directory)
28
+
29
+ from hooks_constants.subprocess_window import (
30
+ HiddenWindowStartupInfo,
31
+ detached_hidden_window_creation_flags,
32
+ hidden_window_creation_flags,
33
+ inherited_stream_startup_info,
34
+ )
35
+
36
+ __all__ = [
37
+ "HiddenWindowStartupInfo",
38
+ "detached_hidden_window_creation_flags",
39
+ "hidden_window_creation_flags",
40
+ "inherited_stream_startup_info",
41
+ ]
@@ -56,8 +56,10 @@ export const RUN_BACKUP_DIRECTORY_NAME_PATTERN =
56
56
  export const PACKAGE_AGENTS_HOME_DIRECTORY_NAME = '.agents';
57
57
 
58
58
  export const PSTACK_MODEL_RULE_FILE_NAME = 'pstack-models.mdc';
59
- export const PSTACK_CODEX_MODEL_PREFERENCES_FILE_NAME =
60
- 'pstack-model-preferences.codex.json';
59
+ export const PSTACK_SEEDED_MODEL_PREFERENCES_FILE_NAMES = Object.freeze([
60
+ 'pstack-model-preferences.claude.json',
61
+ 'pstack-model-preferences.codex.json',
62
+ ]);
61
63
 
62
64
  /**
63
65
  * The directory name skill directories carry in a package source and under
@@ -220,18 +220,60 @@ for (const targetName of [null, 'profile']) {
220
220
  model: 'gpt-5.6-sol',
221
221
  });
222
222
 
223
- const foreignPreferencesPath = join(
223
+ const claudePreferencesPath = join(
224
224
  resolution.agentsHome,
225
225
  'rules',
226
226
  'pstack-model-preferences.claude.json',
227
227
  );
228
- writeFileSync(foreignPreferencesPath, JSON.stringify({
228
+ const seededClaudePreferences = JSON.parse(
229
+ readFileSync(claudePreferencesPath, 'utf8'),
230
+ );
231
+ assert.deepEqual(seededClaudePreferences, {
232
+ host: 'claude',
233
+ modelsByRole: {
234
+ 'feature, refactoring': ['opus'],
235
+ 'bug-fix': ['opus'],
236
+ 'perf-issue': ['fable'],
237
+ hillclimb: ['fable'],
238
+ 'judgment and prose': ['fable'],
239
+ 'hardest tasks': ['fable'],
240
+ 'how explorer': ['sonnet'],
241
+ 'how explainer': ['opus'],
242
+ 'how critics': ['sonnet', 'opus', 'fable'],
243
+ 'why investigators': ['sonnet'],
244
+ 'why synthesizer': ['fable'],
245
+ 'reflect tooling': ['opus'],
246
+ 'reflect judgment, divergent, synthesizer': ['fable'],
247
+ 'arena runners': ['sonnet', 'opus', 'fable'],
248
+ 'arena cross-judge pool': ['opus', 'fable'],
249
+ 'swarm workers': ['sonnet'],
250
+ 'architect runners': ['opus', 'fable'],
251
+ 'interrogate reviewers': ['sonnet', 'opus', 'fable'],
252
+ },
253
+ });
254
+ const claudeSelection = runSelector(selectorPath, {
255
+ host: 'claude',
256
+ inventoryHost: 'claude',
257
+ role: 'swarm workers',
258
+ delegationIndex: 0,
259
+ availableModelIds: ['sonnet', 'opus', 'fable'],
260
+ confirmedSuitableModelIds: [],
261
+ parentFallback: {
262
+ isAllowed: false,
263
+ hasMaterialCapabilityLoss: false,
264
+ },
265
+ });
266
+ assert.deepEqual(claudeSelection.nativeSpawnArguments, {
267
+ model: 'sonnet',
268
+ });
269
+
270
+ writeFileSync(claudePreferencesPath, JSON.stringify({
229
271
  host: 'claude',
230
272
  modelsByRole: {
231
273
  'feature, refactoring': ['confirmed-claude-model'],
232
274
  },
233
275
  }));
234
- const foreignSelection = runSelector(selectorPath, {
276
+ const editedClaudeSelection = runSelector(selectorPath, {
235
277
  host: 'claude',
236
278
  inventoryHost: 'claude',
237
279
  role: 'feature, refactoring',
@@ -243,7 +285,7 @@ for (const targetName of [null, 'profile']) {
243
285
  hasMaterialCapabilityLoss: false,
244
286
  },
245
287
  });
246
- assert.deepEqual(foreignSelection.nativeSpawnArguments, {
288
+ assert.deepEqual(editedClaudeSelection.nativeSpawnArguments, {
247
289
  model: 'confirmed-claude-model',
248
290
  });
249
291
 
@@ -251,7 +293,7 @@ for (const targetName of [null, 'profile']) {
251
293
  assert.equal(manifest.files.includes(sharedPath), true);
252
294
  assert.equal(manifest.files.includes(managedSelectorPath), true);
253
295
  assert.equal(manifest.files.includes(preferencesPath), false);
254
- assert.equal(manifest.files.includes(foreignPreferencesPath), false);
296
+ assert.equal(manifest.files.includes(claudePreferencesPath), false);
255
297
 
256
298
  writeFileSync(sharedPath, 'stale');
257
299
  writeFileSync(preferencesPath, JSON.stringify({
@@ -268,7 +310,7 @@ for (const targetName of [null, 'profile']) {
268
310
  ['user-edited-codex-model'],
269
311
  );
270
312
  assert.deepEqual(
271
- JSON.parse(readFileSync(foreignPreferencesPath, 'utf8'))
313
+ JSON.parse(readFileSync(claudePreferencesPath, 'utf8'))
272
314
  .modelsByRole['feature, refactoring'],
273
315
  ['confirmed-claude-model'],
274
316
  );
@@ -295,7 +337,7 @@ for (const targetName of [null, 'profile']) {
295
337
  assert.equal(existsSync(cursorPath), false);
296
338
  assert.equal(existsSync(selectorPath), false);
297
339
  assert.equal(existsSync(preferencesPath), true);
298
- assert.equal(existsSync(foreignPreferencesPath), true);
340
+ assert.equal(existsSync(claudePreferencesPath), true);
299
341
  } finally {
300
342
  rmSync(homeDirectory, { recursive: true, force: true });
301
343
  }
@@ -317,21 +359,21 @@ test('a blocked shared rule destination rolls back generated Cursor files', () =
317
359
  }
318
360
  });
319
361
 
320
- test('a failed install rolls back a newly seeded Codex preference file', () => {
362
+ test('a failed install rolls back newly seeded host preference files', () => {
321
363
  const homeDirectory = mkdtempSync(join(tmpdir(), 'cdev-pstack-seed-rollback-'));
322
364
  try {
323
- const preferencesPath = join(
324
- homeDirectory,
325
- '.agents',
326
- 'rules',
327
- 'pstack-model-preferences.codex.json',
328
- );
365
+ const preferencesDirectory = join(homeDirectory, '.agents', 'rules');
329
366
  assert.throws(() => runInstaller(
330
367
  homeDirectory,
331
368
  ['--only', 'core'],
332
369
  { CLAUDE_DEV_ENV_INSTALL_FAULT: 'after_file_staging' },
333
370
  ));
334
- assert.equal(existsSync(preferencesPath), false);
371
+ for (const hostName of ['claude', 'codex']) {
372
+ assert.equal(
373
+ existsSync(join(preferencesDirectory, 'pstack-model-preferences.' + hostName + '.json')),
374
+ false,
375
+ );
376
+ }
335
377
  } finally {
336
378
  rmSync(homeDirectory, { recursive: true, force: true });
337
379
  }
package/bin/install.mjs CHANGED
@@ -34,7 +34,7 @@ import {
34
34
  CURSOR_SYNC_SCRIPT_FILE_NAME,
35
35
  CURSOR_RULES_DIRECTORY_NAME,
36
36
  PSTACK_MODEL_RULE_FILE_NAME,
37
- PSTACK_CODEX_MODEL_PREFERENCES_FILE_NAME,
37
+ PSTACK_SEEDED_MODEL_PREFERENCES_FILE_NAMES,
38
38
  WINDOWS_PYTHON_LAUNCHER_COMMAND,
39
39
  PYTHON_PROBE_TIMEOUT_MILLISECONDS,
40
40
  } from './install-constants.mjs';
@@ -491,17 +491,10 @@ export function refreshInstalledPstackPluginManifest(
491
491
  return join(pluginRoot, PSTACK_PLUGIN_MANIFEST_RELATIVE_PATH);
492
492
  }
493
493
 
494
- function seedCodexPstackPreferences() {
494
+ function seedPstackPreferences(preferenceFileName) {
495
495
  const preferenceDirectory = join(AGENTS_HOME, CURSOR_RULES_DIRECTORY_NAME);
496
- const preferencePath = join(
497
- preferenceDirectory,
498
- PSTACK_CODEX_MODEL_PREFERENCES_FILE_NAME,
499
- );
500
- const preferenceSource = join(
501
- PACKAGE_ROOT,
502
- 'bin',
503
- PSTACK_CODEX_MODEL_PREFERENCES_FILE_NAME,
504
- );
496
+ const preferencePath = join(preferenceDirectory, preferenceFileName);
497
+ const preferenceSource = join(PACKAGE_ROOT, 'bin', preferenceFileName);
505
498
  mkdirSync(preferenceDirectory, { recursive: true });
506
499
  try {
507
500
  copyFileSync(
@@ -1292,7 +1285,6 @@ export const RETIRED_HOOK_REGISTRATION_RELATIVE_PATHS = new Set([
1292
1285
  'blocking/nas_ssh_binary_enforcer.py',
1293
1286
  'blocking/block_main_commit.py',
1294
1287
  'blocking/session_edit_stage_gate.py',
1295
- 'blocking/bash_pre_tool_use_dispatcher.py',
1296
1288
  'blocking/stop_dispatcher.py',
1297
1289
  'blocking/bot_mention_comment_blocker.py',
1298
1290
  'blocking/fable_spawn_gate.py',
@@ -2757,10 +2749,12 @@ function executeInstallPlanMutations(plan, transactionHelpers) {
2757
2749
  copyFileSync(pstackRuleSource, sharedRulePath);
2758
2750
  allInstalledFiles.push(sharedRulePath);
2759
2751
  syncWrittenPaths(allInstalledFiles);
2760
- const seededPreferencePath = seedCodexPstackPreferences();
2761
- if (seededPreferencePath) {
2762
- allInstalledFiles.push(seededPreferencePath);
2763
- allUserOwnedPreferencePaths.add(seededPreferencePath);
2752
+ for (const eachPreferenceFileName of PSTACK_SEEDED_MODEL_PREFERENCES_FILE_NAMES) {
2753
+ const seededPreferencePath = seedPstackPreferences(eachPreferenceFileName);
2754
+ if (seededPreferencePath) {
2755
+ allInstalledFiles.push(seededPreferencePath);
2756
+ allUserOwnedPreferencePaths.add(seededPreferencePath);
2757
+ }
2764
2758
  }
2765
2759
  syncWrittenPaths(allInstalledFiles);
2766
2760
  }
@@ -36,7 +36,6 @@ const allRetiredPolicyRegistrations = [
36
36
  'blocking/nas_ssh_binary_enforcer.py',
37
37
  'blocking/block_main_commit.py',
38
38
  'blocking/session_edit_stage_gate.py',
39
- 'blocking/bash_pre_tool_use_dispatcher.py',
40
39
  'blocking/stop_dispatcher.py',
41
40
  'blocking/bot_mention_comment_blocker.py',
42
41
  'blocking/fable_spawn_gate.py',
@@ -117,7 +116,7 @@ test('upgrade prunes legacy direct file checks while retaining foreign hooks', (
117
116
  });
118
117
  assert.ok(commands.every(command => !command.includes('/blocking/stop_dispatcher.py')));
119
118
  assert.ok(commands.some(command => command.includes('/blocking/pre_tool_use_dispatcher.py')));
120
- assert.ok(commands.every(command => !command.includes('/blocking/bash_pre_tool_use_dispatcher.py')));
119
+ assert.ok(commands.some(command => command.includes('/blocking/bash_pre_tool_use_dispatcher.py')));
121
120
  });
122
121
 
123
122
  test('reinstall does not restore retired direct checks or duplicate foreign hooks', () => {
@@ -1195,7 +1195,6 @@ test('retired hook registrations stay managed so reinstall removes them', () =>
1195
1195
  'blocking/nas_ssh_binary_enforcer.py',
1196
1196
  'blocking/block_main_commit.py',
1197
1197
  'blocking/session_edit_stage_gate.py',
1198
- 'blocking/bash_pre_tool_use_dispatcher.py',
1199
1198
  'blocking/stop_dispatcher.py',
1200
1199
  'blocking/bot_mention_comment_blocker.py',
1201
1200
  'blocking/fable_spawn_gate.py',
@@ -0,0 +1,23 @@
1
+ {
2
+ "host": "claude",
3
+ "modelsByRole": {
4
+ "feature, refactoring": ["opus"],
5
+ "bug-fix": ["opus"],
6
+ "perf-issue": ["fable"],
7
+ "hillclimb": ["fable"],
8
+ "judgment and prose": ["fable"],
9
+ "hardest tasks": ["fable"],
10
+ "how explorer": ["sonnet"],
11
+ "how explainer": ["opus"],
12
+ "how critics": ["sonnet", "opus", "fable"],
13
+ "why investigators": ["sonnet"],
14
+ "why synthesizer": ["fable"],
15
+ "reflect tooling": ["opus"],
16
+ "reflect judgment, divergent, synthesizer": ["fable"],
17
+ "arena runners": ["sonnet", "opus", "fable"],
18
+ "arena cross-judge pool": ["opus", "fable"],
19
+ "swarm workers": ["sonnet"],
20
+ "architect runners": ["opus", "fable"],
21
+ "interrogate reviewers": ["sonnet", "opus", "fable"]
22
+ }
23
+ }