@danmoisan/drm-copilot-mcp 0.0.1 → 0.0.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.
Files changed (183) hide show
  1. package/out/mcp-server.js +98 -21
  2. package/package.json +21 -5
  3. package/resources/claude-customizations/.claude/agent-memory/orchestrator/MEMORY.md +15 -3
  4. package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_branch_base_check_unmerged_pr_deps.md +16 -0
  5. package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_every_change_through_lifecycle.md +15 -0
  6. package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_policy_compliance_not_optional.md +18 -0
  7. package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_potential_to_issue_creates_github_issue.md +13 -0
  8. package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_remediation_plan_em_dash_required.md +13 -0
  9. package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_small_bug_uses_minor_audit.md +13 -0
  10. package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_test_files_count_against_500_cap.md +13 -0
  11. package/resources/claude-customizations/.claude/agents/atomic-executor.md +7 -7
  12. package/resources/claude-customizations/.claude/agents/csharp-typed-engineer.md +4 -5
  13. package/resources/claude-customizations/.claude/agents/feature-review.md +7 -3
  14. package/resources/claude-customizations/.claude/agents/orchestrator.md +22 -3
  15. package/resources/claude-customizations/.claude/agents/powershell-typed-engineer.md +1 -1
  16. package/resources/claude-customizations/.claude/agents/pr-author.md +78 -0
  17. package/resources/claude-customizations/.claude/agents/task-researcher.md +10 -6
  18. package/resources/claude-customizations/.claude/hooks/enforce-checkpoint-monotonic.ps1 +303 -0
  19. package/resources/claude-customizations/.claude/hooks/enforce-completion-consistency.ps1 +300 -0
  20. package/resources/claude-customizations/.claude/hooks/enforce-evidence-locations.ps1 +40 -14
  21. package/resources/claude-customizations/.claude/hooks/enforce-feature-folder-order.ps1 +148 -0
  22. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +210 -0
  23. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.ps1 +333 -0
  24. package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner.ps1 +216 -0
  25. package/resources/claude-customizations/.claude/hooks/enforce-promotion-mcp-only.ps1 +84 -15
  26. package/resources/claude-customizations/.claude/hooks/validate-executor-output.ps1 +1 -1
  27. package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage.ps1 +75 -5
  28. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output.ps1 +93 -0
  29. package/resources/claude-customizations/.claude/hooks/validate-pr-author-output.ps1 +136 -0
  30. package/resources/claude-customizations/.claude/hooks/validate-task-researcher-output.ps1 +90 -6
  31. package/resources/claude-customizations/.claude/rules/architecture-boundaries.md +46 -0
  32. package/resources/claude-customizations/.claude/rules/benchmark-baselines.md +35 -0
  33. package/resources/claude-customizations/.claude/rules/ci-workflows.md +36 -0
  34. package/resources/claude-customizations/.claude/rules/csharp.md +62 -16
  35. package/resources/claude-customizations/.claude/rules/general-code-change.md +12 -3
  36. package/resources/claude-customizations/.claude/rules/general-unit-test.md +47 -2
  37. package/resources/claude-customizations/.claude/rules/orchestrator-state.md +39 -0
  38. package/resources/claude-customizations/.claude/rules/powershell.md +5 -5
  39. package/resources/claude-customizations/.claude/rules/python.md +4 -3
  40. package/resources/claude-customizations/.claude/rules/quality-tiers.md +51 -0
  41. package/resources/claude-customizations/.claude/rules/typescript.md +37 -8
  42. package/resources/claude-customizations/.claude/settings.json +59 -12
  43. package/resources/claude-customizations/.claude/skills/atomic-plan-contract/SKILL.md +2 -2
  44. package/resources/claude-customizations/.claude/skills/csharp-qa-gate/SKILL.md +25 -10
  45. package/resources/claude-customizations/.claude/skills/evidence-and-timestamp-conventions/SKILL.md +0 -1
  46. package/resources/claude-customizations/.claude/skills/execute-hard-lock/SKILL.md +6 -6
  47. package/resources/claude-customizations/.claude/skills/feature-promotion-lifecycle/SKILL.md +8 -8
  48. package/resources/claude-customizations/.claude/skills/feature-review-workflow/SKILL.md +17 -6
  49. package/resources/claude-customizations/.claude/skills/human-exception-runbook/SKILL.md +52 -0
  50. package/resources/claude-customizations/.claude/skills/human-exception-runbook/example.runbook.md +36 -0
  51. package/resources/claude-customizations/.claude/skills/invoke-csharp-engineer/SKILL.md +4 -4
  52. package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +172 -5
  53. package/resources/claude-customizations/.claude/skills/policy-audit-template-usage/SKILL.md +3 -3
  54. package/resources/claude-customizations/.claude/skills/powershell-qa-gate/SKILL.md +4 -4
  55. package/resources/claude-customizations/.claude/skills/pr-base-branch-merge-base/SKILL.md +3 -3
  56. package/resources/claude-customizations/.claude/skills/python-qa-gate/SKILL.md +1 -1
  57. package/resources/claude-customizations/.claude/skills/remediation-handoff-atomic-planner/SKILL.md +90 -17
  58. package/resources/claude-customizations/.claude/skills/research-issue/SKILL.md +5 -3
  59. package/resources/claude-customizations/.claude-variants/csharp-legacy/agents/csharp-typed-engineer.md +69 -0
  60. package/resources/claude-customizations/.claude-variants/csharp-legacy/rules/csharp.md +96 -0
  61. package/resources/claude-customizations/.claude-variants/csharp-legacy/skills/csharp-qa-gate/SKILL.md +77 -0
  62. package/resources/claude-customizations/.claude-variants/csharp-legacy/skills/invoke-csharp-engineer/SKILL.md +64 -0
  63. package/resources/claude-customizations/pack-manifests/core.json +65 -0
  64. package/resources/claude-customizations/pack-manifests/csharp-legacy.json +11 -0
  65. package/resources/claude-customizations/pack-manifests/csharp-modern.json +12 -0
  66. package/resources/claude-customizations/pack-manifests/powershell.json +14 -0
  67. package/resources/claude-customizations/pack-manifests/python.json +14 -0
  68. package/resources/claude-customizations/pack-manifests/typescript.json +9 -0
  69. package/resources/claude-dir-customizations/.mcp.json +3 -3
  70. package/resources/codex-and-agents-customizations/.agents/README.md +1 -1
  71. package/resources/codex-and-agents-customizations/.agents/skills/acceptance-criteria-tracking/SKILL.md +0 -5
  72. package/resources/codex-and-agents-customizations/.agents/skills/architecture-boundaries/SKILL.md +52 -0
  73. package/resources/codex-and-agents-customizations/.agents/skills/atomic-plan-contract/SKILL.md +16 -8
  74. package/resources/codex-and-agents-customizations/.agents/skills/benchmark-baselines/SKILL.md +44 -0
  75. package/resources/codex-and-agents-customizations/.agents/skills/ci-workflows/SKILL.md +45 -0
  76. package/resources/codex-and-agents-customizations/.agents/skills/commit-message/SKILL.md +3 -11
  77. package/resources/codex-and-agents-customizations/.agents/skills/csharp/SKILL.md +1 -5
  78. package/resources/codex-and-agents-customizations/.agents/skills/csharp-change-budget-router/SKILL.md +1 -6
  79. package/resources/codex-and-agents-customizations/.agents/skills/csharp-orchestration-state-machine/SKILL.md +0 -5
  80. package/resources/codex-and-agents-customizations/.agents/skills/csharp-qa-gate/SKILL.md +0 -5
  81. package/resources/codex-and-agents-customizations/.agents/skills/evidence-and-timestamp-conventions/SKILL.md +0 -5
  82. package/resources/codex-and-agents-customizations/.agents/skills/execute-hard-lock/SKILL.md +8 -17
  83. package/resources/codex-and-agents-customizations/.agents/skills/feature-promotion-lifecycle/SKILL.md +41 -25
  84. package/resources/codex-and-agents-customizations/.agents/skills/feature-review-workflow/SKILL.md +1 -6
  85. package/resources/codex-and-agents-customizations/.agents/skills/fill-feature-docs/SKILL.md +0 -5
  86. package/resources/codex-and-agents-customizations/.agents/skills/general-code-change/SKILL.md +86 -0
  87. package/resources/codex-and-agents-customizations/.agents/skills/general-unit-test/SKILL.md +111 -0
  88. package/resources/codex-and-agents-customizations/.agents/skills/human-exception-runbook/SKILL.md +57 -0
  89. package/resources/codex-and-agents-customizations/.agents/skills/human-exception-runbook/example.runbook.md +36 -0
  90. package/resources/codex-and-agents-customizations/.agents/skills/invoke-csharp-engineer/SKILL.md +0 -9
  91. package/resources/codex-and-agents-customizations/.agents/skills/invoke-powershell-engineer/SKILL.md +0 -9
  92. package/resources/codex-and-agents-customizations/.agents/skills/invoke-python-engineer/SKILL.md +0 -9
  93. package/resources/codex-and-agents-customizations/.agents/skills/make-skill-template/SKILL.md +0 -5
  94. package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +206 -18
  95. package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-state/SKILL.md +48 -0
  96. package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-workflow/SKILL.md +94 -10
  97. package/resources/codex-and-agents-customizations/.agents/skills/policy-audit-template-usage/SKILL.md +3 -8
  98. package/resources/codex-and-agents-customizations/.agents/skills/policy-compliance-order/SKILL.md +0 -10
  99. package/resources/codex-and-agents-customizations/.agents/skills/powershell/SKILL.md +4 -8
  100. package/resources/codex-and-agents-customizations/.agents/skills/powershell-change-budget-router/SKILL.md +1 -6
  101. package/resources/codex-and-agents-customizations/.agents/skills/powershell-orchestration-state-machine/SKILL.md +0 -5
  102. package/resources/codex-and-agents-customizations/.agents/skills/powershell-qa-gate/SKILL.md +3 -9
  103. package/resources/codex-and-agents-customizations/.agents/skills/pr-author/SKILL.md +1 -9
  104. package/resources/codex-and-agents-customizations/.agents/skills/pr-base-branch-merge-base/SKILL.md +4 -9
  105. package/resources/codex-and-agents-customizations/.agents/skills/pr-context-artifacts/SKILL.md +0 -5
  106. package/resources/codex-and-agents-customizations/.agents/skills/python/SKILL.md +1 -5
  107. package/resources/codex-and-agents-customizations/.agents/skills/python-change-budget-router/SKILL.md +1 -6
  108. package/resources/codex-and-agents-customizations/.agents/skills/python-qa-gate/SKILL.md +0 -5
  109. package/resources/codex-and-agents-customizations/.agents/skills/python-suppressions/SKILL.md +2 -6
  110. package/resources/codex-and-agents-customizations/.agents/skills/quality-tiers/SKILL.md +57 -0
  111. package/resources/codex-and-agents-customizations/.agents/skills/remediation-handoff-atomic-planner/SKILL.md +0 -5
  112. package/resources/codex-and-agents-customizations/.agents/skills/repo-automation-adapter/SKILL.md +96 -72
  113. package/resources/codex-and-agents-customizations/.agents/skills/repo-automation-adapter/agents/openai.yaml +1 -1
  114. package/resources/codex-and-agents-customizations/.agents/skills/research-issue/SKILL.md +0 -10
  115. package/resources/codex-and-agents-customizations/.agents/skills/review-epic/SKILL.md +0 -5
  116. package/resources/codex-and-agents-customizations/.agents/skills/review-feature/SKILL.md +0 -5
  117. package/resources/codex-and-agents-customizations/.agents/skills/review-staged/SKILL.md +0 -5
  118. package/resources/codex-and-agents-customizations/.agents/skills/self-explanatory-code-commenting/SKILL.md +2 -6
  119. package/resources/codex-and-agents-customizations/.agents/skills/skill-canonical-location-audit/SKILL.md +0 -5
  120. package/resources/codex-and-agents-customizations/.agents/skills/tonality/SKILL.md +86 -0
  121. package/resources/codex-and-agents-customizations/.agents/skills/translate-claude-to-codex/SKILL.md +297 -0
  122. package/resources/codex-and-agents-customizations/.agents/skills/translate-copilot-to-claude/SKILL.md +0 -22
  123. package/resources/codex-and-agents-customizations/.agents/skills/typescript/SKILL.md +1 -5
  124. package/resources/codex-and-agents-customizations/.agents/skills/typescript-suppressions/SKILL.md +2 -6
  125. package/resources/codex-and-agents-customizations/.agents/skills/update-status/SKILL.md +0 -5
  126. package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor.toml +5 -5
  127. package/resources/codex-and-agents-customizations/.codex/agents/orchestrator.toml +91 -63
  128. package/resources/codex-and-agents-customizations/.codex/agents/powershell-atomic-executor.toml +1 -1
  129. package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer.toml +1 -1
  130. package/resources/codex-and-agents-customizations/.codex/config.toml +111 -137
  131. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-checkpoint-monotonic.ps1 +303 -0
  132. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-completion-consistency.ps1 +300 -0
  133. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1 +148 -0
  134. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-pr-author-skill.ps1 +336 -0
  135. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-promotion-mcp-only.ps1 +84 -18
  136. package/resources/codex-and-agents-customizations/.codex/prompts/orchestrate-work.md +4 -3
  137. package/resources/codex-and-agents-customizations/.codex/scripts/post-codex-worktree-session.ps1 +5 -0
  138. package/resources/codex-and-agents-customizations/.github/workflows/_validate-orchestrator-state.yml +68 -0
  139. package/resources/codex-and-agents-customizations/.github/workflows/validate-orchestrator-state.yml +15 -0
  140. package/resources/config/orchestration-routing.json +76 -0
  141. package/resources/customizations/.github/agents/Powershell DI Unit Test Engineer.agent.md +1 -1
  142. package/resources/customizations/.github/agents/atomic_executor.agent.md +1 -1
  143. package/resources/customizations/.github/agents/atomic_planning.agent.md +10 -10
  144. package/resources/customizations/.github/agents/csharp-orchestrator.agent.md +6 -2
  145. package/resources/customizations/.github/agents/feature-review.agent.md +2 -2
  146. package/resources/customizations/.github/agents/orchestrator.agent.md +6 -2
  147. package/resources/customizations/.github/agents/powershell-atomic-executor.agent.md +4 -4
  148. package/resources/customizations/.github/agents/powershell-atomic-planning.agent.md +10 -10
  149. package/resources/customizations/.github/agents/powershell-orchestrator.agent.md +6 -2
  150. package/resources/customizations/.github/agents/powershell-typed-engineer.agent.md +2 -2
  151. package/resources/customizations/.github/agents/pr-author.agent.md +25 -0
  152. package/resources/customizations/.github/agents/python-orchestrator.agent.md +6 -2
  153. package/resources/customizations/.github/agents/staged-review.agent.md +1 -1
  154. package/resources/customizations/.github/agents/task-researcher.agent.md +4 -4
  155. package/resources/customizations/.github/instructions/powershell-code-change.instructions.md +6 -6
  156. package/resources/customizations/.github/prompts/fillout-prd-feature.prompt.md +1 -1
  157. package/resources/customizations/.github/prompts/generate-commit-message-repo.prompt.md +1 -1
  158. package/resources/customizations/.github/prompts/orchestrate-csharp-work.prompt.md +5 -3
  159. package/resources/customizations/.github/prompts/orchestrate-work.prompt.md +5 -3
  160. package/resources/customizations/.github/prompts/research-issue.prompt.md +4 -3
  161. package/resources/customizations/.github/skills/atomic-plan-contract/SKILL.md +14 -1
  162. package/resources/customizations/.github/skills/feature-promotion-lifecycle/SKILL.md +11 -7
  163. package/resources/customizations/.github/skills/feature-review-workflow/SKILL.md +10 -1
  164. package/resources/customizations/.github/skills/pr-base-branch-merge-base/SKILL.md +2 -2
  165. package/resources/customizations/.github/skills/remediation-handoff-atomic-planner/SKILL.md +5 -0
  166. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +7 -0
  167. package/resources/scripts/dev_tools/_orchestrator_state_human_interaction.py +127 -0
  168. package/resources/scripts/dev_tools/_orchestrator_state_routing.py +216 -0
  169. package/resources/scripts/dev_tools/push_down_claude_customizations.py +276 -61
  170. package/resources/scripts/dev_tools/push_down_claude_filesystem.py +472 -0
  171. package/resources/scripts/dev_tools/push_down_claude_pack_selection.py +401 -0
  172. package/resources/scripts/dev_tools/validate_orchestration_artifacts.py +103 -411
  173. package/resources/scripts/dev_tools/validate_orchestration_review_artifacts.py +107 -0
  174. package/resources/scripts/dev_tools/validate_orchestrator_state.py +505 -0
  175. package/resources/scripts/dev_tools/validate_policy_audit_artifact.py +472 -0
  176. package/resources/templates/push_down_claude_customizations.py +162 -117
  177. package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_repo_root_is_source_of_truth.md +0 -11
  178. package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_vsce_verify_package_location.md +0 -19
  179. package/resources/claude-customizations/.claude/agent-memory/orchestrator/project_extension_location.md +0 -11
  180. package/resources/claude-customizations/.claude/agent-memory/prd-feature/MEMORY.md +0 -1
  181. package/resources/claude-customizations/.claude/agent-memory/prd-feature/project_push_down_pattern.md +0 -13
  182. package/resources/claude-customizations/.claude/agent-memory/task-researcher/MEMORY.md +0 -3
  183. package/resources/claude-customizations/.claude/agent-memory/task-researcher/project_push_down_claude_dir.md +0 -11
@@ -1,152 +1,118 @@
1
- """Publish bundled `.claude` content into a destination workspace.
1
+ """Bundled template entry point for the `.claude` customization push-down.
2
2
 
3
3
  Purpose:
4
- Provide a dedicated public entry point for the Claude customization push-down
5
- workflow while reusing the shared publisher engine behind the existing
6
- `.github` customization flow. Settings-local configuration is excluded from
7
- push-down because it holds host-specific overrides that must not propagate.
4
+ Provide the extension-invoked CLI that publishes the bundled `.claude`
5
+ payload into a destination workspace. This template bootstraps the bundled
6
+ ``resources/scripts`` directory onto ``sys.path`` and then delegates all
7
+ pack-selection, C# variant-routing, and memory-mode logic to the bundled
8
+ ``push_down_claude_customizations`` engine module so the template and the
9
+ repository source stay behaviorally identical.
10
+
11
+ Settings-local configuration is excluded from push-down because it holds
12
+ host-specific overrides. Agent-memory files under `.claude/agent-memory/`
13
+ are filtered by the engine's content-based scope check; only general-scoped
14
+ memories are distributed.
15
+
16
+ Responsibilities:
17
+ - Ensure the bundled scripts directory is importable when invoked directly
18
+ from ``resources/templates/``.
19
+ - Parse the CLI arguments (``--destination``, ``--packs``,
20
+ ``--csharp-variant``, ``--memory-mode``).
21
+ - Resolve the source root and bundle root to the sibling bundled
22
+ ``claude-customizations`` directory so the template distributes the
23
+ bundled payload rather than a destination workspace's own `.claude`.
24
+
25
+ Side Effects:
26
+ Mutates ``sys.path`` at import time; reads bundled source files and writes
27
+ destination files through the publisher engine.
8
28
  """
9
29
 
10
30
  from __future__ import annotations
11
31
 
12
32
  import argparse
33
+ import sys
13
34
  from pathlib import Path
14
35
 
36
+
37
+ def _ensure_bundled_scripts_import_path() -> None:
38
+ """Prepend bundled ``resources/scripts`` directory to ``sys.path``.
39
+
40
+ Purpose:
41
+ Make extension-bundled Python packages importable when this template is
42
+ invoked directly from ``resources/templates/`` rather than from the
43
+ repository root. Without this bootstrap, neither
44
+ ``scripts.dev_tools.push_down_claude_customizations`` nor the fallback
45
+ ``dev_tools.push_down_claude_customizations`` import resolves because
46
+ ``resources/scripts`` is not on ``sys.path`` by default.
47
+
48
+ Side Effects:
49
+ Mutates ``sys.path`` by inserting the bundled scripts directory at
50
+ index 0 when not already present.
51
+ """
52
+ scripts_dir = Path(__file__).resolve().parent.parent / "scripts"
53
+ scripts_dir_str = str(scripts_dir)
54
+
55
+ if scripts_dir_str not in sys.path:
56
+ sys.path.insert(0, scripts_dir_str)
57
+
58
+
59
+ _ensure_bundled_scripts_import_path()
60
+
15
61
  try:
62
+ from scripts.dev_tools.push_down_claude_customizations import (
63
+ CSHARP_VARIANT_CHOICES,
64
+ MEMORY_MODE_CHOICES,
65
+ PushDownSummary,
66
+ push_down_customizations,
67
+ )
16
68
  from scripts.dev_tools.push_down_copilot_customizations import (
17
69
  PushDownFileSystem,
18
- PushDownSummary,
19
70
  RealPushDownFileSystem,
20
71
  resolve_cli_path,
21
72
  )
22
- from scripts.dev_tools.push_down_copilot_customizations import (
23
- push_down_customizations as push_down_scoped_customizations,
24
- )
25
73
  except ModuleNotFoundError as error:
26
74
  if error.name is None or not error.name.startswith("scripts"):
27
75
  raise
76
+ from dev_tools.push_down_claude_customizations import (
77
+ CSHARP_VARIANT_CHOICES,
78
+ MEMORY_MODE_CHOICES,
79
+ PushDownSummary,
80
+ push_down_customizations,
81
+ )
28
82
  from dev_tools.push_down_copilot_customizations import (
29
83
  PushDownFileSystem,
30
- PushDownSummary,
31
84
  RealPushDownFileSystem,
32
85
  resolve_cli_path,
33
86
  )
34
- from dev_tools.push_down_copilot_customizations import (
35
- push_down_customizations as push_down_scoped_customizations,
36
- )
37
87
 
38
- ARTIFACT_DIRECTORY = "artifacts/claude-customizations"
39
88
  MODULE_ENTRY_POINT = "scripts.dev_tools.push_down_claude_customizations"
40
- ROOT_FOLDERS: tuple[Path, ...] = (Path(".claude"),)
41
- EXCLUDED_RELATIVE_PATHS: tuple[Path, ...] = (Path(".claude/settings.local.json"),)
42
89
 
43
- __all__ = [
44
- "ARTIFACT_DIRECTORY",
45
- "EXCLUDED_RELATIVE_PATHS",
46
- "PushDownSummary",
47
- "ROOT_FOLDERS",
48
- "main",
49
- "parse_args",
50
- "push_down_customizations",
51
- ]
90
+ __all__ = ["main", "parse_args"]
52
91
 
53
92
 
54
- class _ExcludingFileSystem:
55
- """Wrap a PushDownFileSystem and filter specified paths from list_files.
93
+ def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
94
+ """Parse CLI arguments for the bundled Claude customization push-down.
56
95
 
57
96
  Purpose:
58
- Prevent host-specific files (e.g. `settings.local.json`) from being
59
- included when the publisher enumerates source files. Chosen over a
60
- post-enumeration filter so the exclusion travels with the filesystem
61
- contract and is transparent to the shared engine.
62
-
63
- Usage:
64
- Instantiate with the inner adapter and exclusion paths relative to
65
- the repo root; pass the result as the `fs` argument to the engine.
66
-
67
- Invariants / Constraints:
68
- Excluded paths are resolved once at construction time for O(1) checks.
69
-
70
- Side Effects:
71
- Delegates all I/O to the inner adapter.
72
- """
73
-
74
- def __init__(
75
- self, inner: PushDownFileSystem, repo_root: Path, excluded: tuple[Path, ...]
76
- ) -> None:
77
- """Set up the adapter; resolve exclusion paths relative to repo_root."""
78
- self._inner = inner
79
- # Resolve once at init so list_files per-path checks are O(1).
80
- self._excluded: frozenset[Path] = frozenset(
81
- (repo_root / p).resolve() for p in excluded
82
- )
83
-
84
- def list_files(self, root: Path) -> list[Path]:
85
- """Return inner list_files output with excluded paths removed."""
86
- return [
87
- p for p in self._inner.list_files(root) if p.resolve() not in self._excluded
88
- ]
89
-
90
- def is_dir(self, path: Path) -> bool:
91
- """Delegate to inner adapter."""
92
- return self._inner.is_dir(path)
93
-
94
- def is_file(self, path: Path) -> bool:
95
- """Delegate to inner adapter."""
96
- return self._inner.is_file(path)
97
+ Mirror the repository entry point's CLI contract, including the optional
98
+ ``--packs``, ``--csharp-variant``, and ``--memory-mode`` flags. With no
99
+ optional flags the parsed namespace yields the backward-compatible
100
+ defaults (``packs=None``, ``csharp_variant="modern"``,
101
+ ``memory_mode="overwrite"``).
97
102
 
98
- def read_text(self, path: Path) -> str:
99
- """Delegate to inner adapter."""
100
- return self._inner.read_text(path)
103
+ Args:
104
+ argv (list[str] | None): Optional argument list for tests or embedding.
101
105
 
102
- def write_text(self, path: Path, content: str) -> None:
103
- """Delegate to inner adapter."""
104
- self._inner.write_text(path, content)
106
+ Returns:
107
+ argparse.Namespace: Parsed arguments with attributes ``destination``,
108
+ ``packs``, ``csharp_variant``, and ``memory_mode``.
105
109
 
106
- def ensure_dir(self, path: Path) -> None:
107
- """Delegate to inner adapter."""
108
- self._inner.ensure_dir(path)
110
+ Raises:
111
+ SystemExit: Raised by ``argparse`` when arguments are invalid.
109
112
 
110
-
111
- def _passthrough_rewrite(
112
- text: str,
113
- ) -> tuple[str, int, int, list[str]]:
114
- """Return unmodified text for payloads that do not need command rewrites."""
115
-
116
- return text, 0, 0, []
117
-
118
-
119
- def push_down_customizations(
120
- *,
121
- repo_root: Path,
122
- destination_root: Path,
123
- fs: PushDownFileSystem,
124
- source_root: Path | None = None,
125
- artifact_root: Path | None = None,
126
- ) -> PushDownSummary:
127
- """Copy the `.claude` tree into the destination workspace.
128
-
129
- Excludes paths in `EXCLUDED_RELATIVE_PATHS` by wrapping `fs` in
130
- `_ExcludingFileSystem` before delegating to the shared engine.
113
+ Side Effects:
114
+ Emits usage/help text through ``argparse`` when parsing fails.
131
115
  """
132
-
133
- # Wrap the caller-supplied adapter so enumeration omits excluded paths.
134
- excluding_fs = _ExcludingFileSystem(fs, repo_root, EXCLUDED_RELATIVE_PATHS)
135
- return push_down_scoped_customizations(
136
- repo_root=repo_root,
137
- destination_root=destination_root,
138
- fs=excluding_fs,
139
- source_root=source_root,
140
- artifact_root=artifact_root,
141
- root_folders=ROOT_FOLDERS,
142
- artifact_directory=ARTIFACT_DIRECTORY,
143
- rewrite_references=_passthrough_rewrite,
144
- )
145
-
146
-
147
- def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
148
- """Parse CLI arguments for the Claude customization push-down publisher."""
149
-
150
116
  parser = argparse.ArgumentParser(
151
117
  description=(
152
118
  "Publish bundled Claude customizations with "
@@ -158,27 +124,106 @@ def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
158
124
  required=True,
159
125
  help=("Destination workspace root that will receive the copied .claude tree."),
160
126
  )
127
+ parser.add_argument(
128
+ "--packs",
129
+ default=None,
130
+ help=(
131
+ "Comma-separated language pack names to publish (for example "
132
+ "'core,typescript'). When omitted, the full tree is published. "
133
+ "'core' is always included."
134
+ ),
135
+ )
136
+ parser.add_argument(
137
+ "--csharp-variant",
138
+ dest="csharp_variant",
139
+ choices=CSHARP_VARIANT_CHOICES,
140
+ default="modern",
141
+ help="C# toolchain variant to source ('modern' default or 'legacy').",
142
+ )
143
+ parser.add_argument(
144
+ "--memory-mode",
145
+ dest="memory_mode",
146
+ choices=MEMORY_MODE_CHOICES,
147
+ default="overwrite",
148
+ help=("Agent-memory handling mode: 'overwrite' (default), 'merge', or 'skip'."),
149
+ )
161
150
  return parser.parse_args(argv)
162
151
 
163
152
 
153
+ def _parse_packs_argument(packs_value: str | None) -> frozenset[str] | None:
154
+ """Parse the raw ``--packs`` CLI value into a normalized pack-name set.
155
+
156
+ Args:
157
+ packs_value (str | None): The raw comma-separated value, or ``None`` when
158
+ the flag was omitted.
159
+
160
+ Returns:
161
+ frozenset[str] | None: The set of non-empty, stripped pack names, or
162
+ ``None`` when the flag was omitted or contained only empty entries (the
163
+ publish-everything default).
164
+ """
165
+ if packs_value is None:
166
+ return None
167
+ # Strip whitespace and drop empty entries so trailing commas or stray spaces
168
+ # do not produce empty pack names.
169
+ names = {entry.strip() for entry in packs_value.split(",") if entry.strip()}
170
+ if not names:
171
+ return None
172
+ return frozenset(names)
173
+
174
+
164
175
  def main(
165
176
  argv: list[str] | None = None,
166
177
  *,
167
178
  repo_root: Path | None = None,
168
179
  fs: PushDownFileSystem | None = None,
169
180
  ) -> int:
170
- """Run the Claude customization push-down publisher CLI."""
181
+ """Run the bundled Claude customization push-down publisher CLI.
171
182
 
183
+ Purpose:
184
+ Parse arguments, resolve the source and bundle roots to the sibling
185
+ bundled ``claude-customizations`` directory, thread the pack selection,
186
+ C# variant, and memory mode into the engine, and print the summary
187
+ artifact path. With no optional flags this is byte-for-byte equivalent
188
+ to the prior bundled publish-everything/overwrite behavior.
189
+
190
+ Args:
191
+ argv (list[str] | None): Optional CLI argument list.
192
+ repo_root (Path | None): Optional explicit source root for tests; when
193
+ absent, the bundled ``claude-customizations`` directory is used.
194
+ fs (PushDownFileSystem | None): Optional filesystem adapter for tests.
195
+
196
+ Returns:
197
+ int: Process exit code (``0`` on success).
198
+
199
+ Side Effects:
200
+ Reads bundled source files and writes destination files and the summary
201
+ artifact through the adapter.
202
+ """
172
203
  args = parse_args(argv)
173
- resolved_repo_root = resolve_cli_path(repo_root or Path.cwd())
204
+ # Resolve the source root to the bundled customizations directory so the
205
+ # template distributes the bundled `.claude` payload rather than copying a
206
+ # destination workspace's existing `.claude` back onto itself. The bundle
207
+ # root that holds the pack manifests and legacy variant subtree is the same
208
+ # customizations directory. The optional `repo_root` argument still allows
209
+ # tests to inject an explicit root.
210
+ customizations_root = (
211
+ Path(__file__).resolve().parent.parent / "claude-customizations"
212
+ )
213
+ resolved_repo_root = resolve_cli_path(repo_root or customizations_root)
174
214
  resolved_destination = resolve_cli_path(args.destination)
175
215
  resolved_fs = fs or RealPushDownFileSystem()
176
- summary = push_down_customizations(
216
+ packs = _parse_packs_argument(args.packs)
217
+ summary: PushDownSummary = push_down_customizations(
177
218
  repo_root=resolved_repo_root,
178
219
  destination_root=resolved_destination,
179
220
  fs=resolved_fs,
180
221
  source_root=resolved_repo_root,
181
222
  artifact_root=resolved_repo_root,
223
+ packs=packs,
224
+ csharp_variant=args.csharp_variant,
225
+ memory_mode=args.memory_mode,
226
+ bundle_root=resolved_repo_root,
182
227
  )
183
228
  print(f"Wrote push-down summary artifact to: {summary.artifact_path}")
184
229
  return 0
@@ -1,11 +0,0 @@
1
- ---
2
- name: repo-root-is-source-of-truth-for-codex-bundle
3
- description: When repo-root .codex/.agents/AGENTS.md/etc differ from the extension's bundled customizations, treat the repo root as authoritative and update the bundle to match — not the other way around.
4
- type: feedback
5
- ---
6
-
7
- When repo-root files such as `.codex/agents/*.toml`, `.codex/config.toml`, `.codex/hooks/*.ps1`, `.agents/skills/**`, and `AGENTS.md` differ from their bundled copies under `extensions/drm-copilot/resources/codex-and-agents-customizations/` and `extensions/drm-copilot/resources/claude-customizations/`, the repo-root version is the source of truth. Update the bundle to mirror the repo root.
8
-
9
- **Why:** The user actively overwrites repo-root files (e.g., by running the codex-native-converter in apply mode) and expects the bundle to reflect those changes. Reverting repo-root files to match the bundle is the wrong direction. Confirmed 2026-05-02 after a converter apply run regenerated `.codex/`, `.agents/`, and `AGENTS.md`.
10
-
11
- **How to apply:** When contract tests like `test_push_down_claude_resource_contracts`, `test_push_down_codex_and_agents_resource_contracts`, `test_codex_agent_wrapper_contracts`, `test_codex_full_migration_inventory`, `test_codex_handoff_contract_parity`, or `test_orchestration_guardrail_contracts` fail with diffs between repo and bundle, copy from repo → bundle. Never propose `git checkout HEAD --` on the repo-root file.
@@ -1,19 +0,0 @@
1
- ---
2
- name: Verify which package.json is the VS Code extension before any vsce work
3
- description: In multi-package repos, never assume the repo root is the publishable extension. Verify location before vsce package/publish/.vscodeignore work.
4
- type: feedback
5
- ---
6
-
7
- Before doing any `vsce` packaging, publishing, or `.vscodeignore` work, verify which directory contains the actual VS Code extension. Do not assume the repo root.
8
-
9
- **Why:** On 2026-05-02, I spent multiple troubleshooting rounds (`.vscodeignore` rewrites, allow-list strategy, esbuild bundling) treating the repo root `package.json` as the publishable extension. The real extension lives at `extensions/drm-copilot/` with its own `package.json`, `src/`, `tsconfig.json`, `node_modules/`, and existing build pipeline. The user had been side-loading shipping `.vsix` builds for ~4 months from the correct location. The root `package.json` is a workspace orchestrator, not a publishable extension. My misdiagnosis caused the user to push back: "I have been side-loading this extension for a significant period of time and it functions properly." All the changes I made to the root (main, activationEvents, esbuild.config.cjs, bundle script, root .vscodeignore) were applied to the wrong package and produced no value for the actual extension.
10
-
11
- **How to apply:** When the user mentions `vsce`, packaging, publishing, `.vscodeignore`, extension manifests, or "the extension":
12
-
13
- 1. First, locate every `package.json` in the workspace that declares `engines.vscode` or `contributes` or has `@types/vscode` as a dep. Use `Grep` for `"engines"` or `"contributes"` across all `package.json` files.
14
- 2. If multiple candidates exist, identify the one with `main`, `activationEvents`, and `contributes` populated — that is the real extension.
15
- 3. If shipping `.vsix` artifacts exist (e.g., under `artifacts/vsix/`), inspect the most recent one with `unzip -l` and read the included `extension/package.json` to see what is actually being shipped. The directory whose source matches the shipped `out/` files is the real extension.
16
- 4. Run `vsce ls` only from that directory.
17
- 5. State explicitly which directory you identified before making any edits.
18
-
19
- This rule applies even when the user opens a root `package.json` in the IDE. The `ide_opened_file` hint indicates focus, not authority over which package is the extension.
@@ -1,11 +0,0 @@
1
- ---
2
- name: VS Code extension location in this repo
3
- description: The publishable VS Code extension lives at extensions/drm-copilot/, not at the repo root.
4
- type: project
5
- ---
6
-
7
- The publishable VS Code extension lives at `extensions/drm-copilot/`, not at the repo root.
8
-
9
- **Why:** This repo is a workspace orchestrator that contains multiple parallel toolchains (Python, PowerShell, TypeScript) plus a Claude/Copilot agent runtime. The VS Code extension is one component among several. Its source is at `extensions/drm-copilot/src/`, its build output is at `extensions/drm-copilot/out/`, its manifest is `extensions/drm-copilot/package.json`, and shipping `.vsix` artifacts go to `artifacts/vsix/` with timestamped filenames. Confirmed 2026-05-02 by inspecting the most recent shipping `.vsix` (`drm-copilot-20260501-114515.vsix`), whose `extension.vsixmanifest` description reads "Extension-side bundled workflow execution utilities and MCP bridge."
10
-
11
- **How to apply:** All `vsce` commands (`ls`, `package`, `publish`) must run from `extensions/drm-copilot/`. The repo root `package.json` is not a publishable extension and should not declare `main`, `activationEvents`, or be passed to `vsce`. When the user asks about extension packaging, install paths, the manifest, or the `.vsix`, default to inspecting `extensions/drm-copilot/` first. Verify the location is still current before acting (the layout could change).
@@ -1 +0,0 @@
1
- - [push-down command pattern](project_push_down_pattern.md) — 10-file change map for adding a new push-down command; reference impl is pushDownCodexAndAgentsCustomizations
@@ -1,13 +0,0 @@
1
- ---
2
- name: push-down command pattern
3
- description: The established 10-file pattern for adding a new push-down command to the drm-copilot extension, as used by pushDownCodexAndAgentsCustomizations and pushDownClaudeDir.
4
- type: project
5
- ---
6
-
7
- All push-down commands follow a zero-argument pattern across five layers: bundled resource directory, Python dev-tools publisher, Python entry-point template, TypeScript service, and MCP surface.
8
-
9
- The reference implementation is `pushDownCodexAndAgentsCustomizations`. New push-down commands clone it, changing only the resource path, tool name, and artifact directory string.
10
-
11
- **Why:** Consistency across the extension's automation surface and test coverage.
12
-
13
- **How to apply:** When speccing or implementing any new push-down command, the 10-file change map is: (1) resource bundle directory, (2) dev_tools publisher .py, (3) templates entry-point .py, (4) repo-automation-service.ts (REPO_AUTOMATION_TOOLS tuple, interface, implementation), (5) mcp-tool-inputs.ts (input resolver), (6) mcp-tools.ts (definition, dispatch, import), (7) extension.ts (register + subscriptions), (8) package.json (commands entry), (9) extension.workflow-commands.test.ts (registration test), (10) mcp-server.test.ts (mock + tool list assertion). The tool list assertion is an exact ordered array — insert new tool name at the correct position.
@@ -1,3 +0,0 @@
1
- # Task Researcher Memory Index
2
-
3
- - [push-down-claude-dir-149](project_push_down_claude_dir.md) — Issue #149: pushDownClaudeDir command research completed 2026-04-16
@@ -1,11 +0,0 @@
1
- ---
2
- name: push-down-claude-dir-149
3
- description: Research for Issue #149 — pushDownClaudeDir command. Pattern, file map, and risks documented.
4
- type: project
5
- ---
6
-
7
- Issue #149 adds `drmCopilotExtension.pushDownClaudeDir` / MCP tool `push_down_claude_dir`.
8
-
9
- **Why:** Developers opening new workspaces lack the `.claude/` runtime directory. The extension has push-down commands for `.github/` and `.codex/.agents/` but not `.claude/`.
10
-
11
- **How to apply:** When implementing, clone the `pushDownCodexAndAgentsCustomizations` pattern exactly. Full file change map is in `artifacts/research/push-down-claude-dir-149.md`. Key constraint: exclude `settings.local.json` and `agent-memory/` from the bundled resource directory at `resources/claude-dir-customizations/.claude/`.