@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.
- package/out/mcp-server.js +98 -21
- package/package.json +21 -5
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/MEMORY.md +15 -3
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_branch_base_check_unmerged_pr_deps.md +16 -0
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_every_change_through_lifecycle.md +15 -0
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_policy_compliance_not_optional.md +18 -0
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_potential_to_issue_creates_github_issue.md +13 -0
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_remediation_plan_em_dash_required.md +13 -0
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_small_bug_uses_minor_audit.md +13 -0
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_test_files_count_against_500_cap.md +13 -0
- package/resources/claude-customizations/.claude/agents/atomic-executor.md +7 -7
- package/resources/claude-customizations/.claude/agents/csharp-typed-engineer.md +4 -5
- package/resources/claude-customizations/.claude/agents/feature-review.md +7 -3
- package/resources/claude-customizations/.claude/agents/orchestrator.md +22 -3
- package/resources/claude-customizations/.claude/agents/powershell-typed-engineer.md +1 -1
- package/resources/claude-customizations/.claude/agents/pr-author.md +78 -0
- package/resources/claude-customizations/.claude/agents/task-researcher.md +10 -6
- package/resources/claude-customizations/.claude/hooks/enforce-checkpoint-monotonic.ps1 +303 -0
- package/resources/claude-customizations/.claude/hooks/enforce-completion-consistency.ps1 +300 -0
- package/resources/claude-customizations/.claude/hooks/enforce-evidence-locations.ps1 +40 -14
- package/resources/claude-customizations/.claude/hooks/enforce-feature-folder-order.ps1 +148 -0
- package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +210 -0
- package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.ps1 +333 -0
- package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner.ps1 +216 -0
- package/resources/claude-customizations/.claude/hooks/enforce-promotion-mcp-only.ps1 +84 -15
- package/resources/claude-customizations/.claude/hooks/validate-executor-output.ps1 +1 -1
- package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage.ps1 +75 -5
- package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output.ps1 +93 -0
- package/resources/claude-customizations/.claude/hooks/validate-pr-author-output.ps1 +136 -0
- package/resources/claude-customizations/.claude/hooks/validate-task-researcher-output.ps1 +90 -6
- package/resources/claude-customizations/.claude/rules/architecture-boundaries.md +46 -0
- package/resources/claude-customizations/.claude/rules/benchmark-baselines.md +35 -0
- package/resources/claude-customizations/.claude/rules/ci-workflows.md +36 -0
- package/resources/claude-customizations/.claude/rules/csharp.md +62 -16
- package/resources/claude-customizations/.claude/rules/general-code-change.md +12 -3
- package/resources/claude-customizations/.claude/rules/general-unit-test.md +47 -2
- package/resources/claude-customizations/.claude/rules/orchestrator-state.md +39 -0
- package/resources/claude-customizations/.claude/rules/powershell.md +5 -5
- package/resources/claude-customizations/.claude/rules/python.md +4 -3
- package/resources/claude-customizations/.claude/rules/quality-tiers.md +51 -0
- package/resources/claude-customizations/.claude/rules/typescript.md +37 -8
- package/resources/claude-customizations/.claude/settings.json +59 -12
- package/resources/claude-customizations/.claude/skills/atomic-plan-contract/SKILL.md +2 -2
- package/resources/claude-customizations/.claude/skills/csharp-qa-gate/SKILL.md +25 -10
- package/resources/claude-customizations/.claude/skills/evidence-and-timestamp-conventions/SKILL.md +0 -1
- package/resources/claude-customizations/.claude/skills/execute-hard-lock/SKILL.md +6 -6
- package/resources/claude-customizations/.claude/skills/feature-promotion-lifecycle/SKILL.md +8 -8
- package/resources/claude-customizations/.claude/skills/feature-review-workflow/SKILL.md +17 -6
- package/resources/claude-customizations/.claude/skills/human-exception-runbook/SKILL.md +52 -0
- package/resources/claude-customizations/.claude/skills/human-exception-runbook/example.runbook.md +36 -0
- package/resources/claude-customizations/.claude/skills/invoke-csharp-engineer/SKILL.md +4 -4
- package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +172 -5
- package/resources/claude-customizations/.claude/skills/policy-audit-template-usage/SKILL.md +3 -3
- package/resources/claude-customizations/.claude/skills/powershell-qa-gate/SKILL.md +4 -4
- package/resources/claude-customizations/.claude/skills/pr-base-branch-merge-base/SKILL.md +3 -3
- package/resources/claude-customizations/.claude/skills/python-qa-gate/SKILL.md +1 -1
- package/resources/claude-customizations/.claude/skills/remediation-handoff-atomic-planner/SKILL.md +90 -17
- package/resources/claude-customizations/.claude/skills/research-issue/SKILL.md +5 -3
- package/resources/claude-customizations/.claude-variants/csharp-legacy/agents/csharp-typed-engineer.md +69 -0
- package/resources/claude-customizations/.claude-variants/csharp-legacy/rules/csharp.md +96 -0
- package/resources/claude-customizations/.claude-variants/csharp-legacy/skills/csharp-qa-gate/SKILL.md +77 -0
- package/resources/claude-customizations/.claude-variants/csharp-legacy/skills/invoke-csharp-engineer/SKILL.md +64 -0
- package/resources/claude-customizations/pack-manifests/core.json +65 -0
- package/resources/claude-customizations/pack-manifests/csharp-legacy.json +11 -0
- package/resources/claude-customizations/pack-manifests/csharp-modern.json +12 -0
- package/resources/claude-customizations/pack-manifests/powershell.json +14 -0
- package/resources/claude-customizations/pack-manifests/python.json +14 -0
- package/resources/claude-customizations/pack-manifests/typescript.json +9 -0
- package/resources/claude-dir-customizations/.mcp.json +3 -3
- package/resources/codex-and-agents-customizations/.agents/README.md +1 -1
- package/resources/codex-and-agents-customizations/.agents/skills/acceptance-criteria-tracking/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/architecture-boundaries/SKILL.md +52 -0
- package/resources/codex-and-agents-customizations/.agents/skills/atomic-plan-contract/SKILL.md +16 -8
- package/resources/codex-and-agents-customizations/.agents/skills/benchmark-baselines/SKILL.md +44 -0
- package/resources/codex-and-agents-customizations/.agents/skills/ci-workflows/SKILL.md +45 -0
- package/resources/codex-and-agents-customizations/.agents/skills/commit-message/SKILL.md +3 -11
- package/resources/codex-and-agents-customizations/.agents/skills/csharp/SKILL.md +1 -5
- package/resources/codex-and-agents-customizations/.agents/skills/csharp-change-budget-router/SKILL.md +1 -6
- package/resources/codex-and-agents-customizations/.agents/skills/csharp-orchestration-state-machine/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/csharp-qa-gate/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/evidence-and-timestamp-conventions/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/execute-hard-lock/SKILL.md +8 -17
- package/resources/codex-and-agents-customizations/.agents/skills/feature-promotion-lifecycle/SKILL.md +41 -25
- package/resources/codex-and-agents-customizations/.agents/skills/feature-review-workflow/SKILL.md +1 -6
- package/resources/codex-and-agents-customizations/.agents/skills/fill-feature-docs/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/general-code-change/SKILL.md +86 -0
- package/resources/codex-and-agents-customizations/.agents/skills/general-unit-test/SKILL.md +111 -0
- package/resources/codex-and-agents-customizations/.agents/skills/human-exception-runbook/SKILL.md +57 -0
- package/resources/codex-and-agents-customizations/.agents/skills/human-exception-runbook/example.runbook.md +36 -0
- package/resources/codex-and-agents-customizations/.agents/skills/invoke-csharp-engineer/SKILL.md +0 -9
- package/resources/codex-and-agents-customizations/.agents/skills/invoke-powershell-engineer/SKILL.md +0 -9
- package/resources/codex-and-agents-customizations/.agents/skills/invoke-python-engineer/SKILL.md +0 -9
- package/resources/codex-and-agents-customizations/.agents/skills/make-skill-template/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +206 -18
- package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-state/SKILL.md +48 -0
- package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-workflow/SKILL.md +94 -10
- package/resources/codex-and-agents-customizations/.agents/skills/policy-audit-template-usage/SKILL.md +3 -8
- package/resources/codex-and-agents-customizations/.agents/skills/policy-compliance-order/SKILL.md +0 -10
- package/resources/codex-and-agents-customizations/.agents/skills/powershell/SKILL.md +4 -8
- package/resources/codex-and-agents-customizations/.agents/skills/powershell-change-budget-router/SKILL.md +1 -6
- package/resources/codex-and-agents-customizations/.agents/skills/powershell-orchestration-state-machine/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/powershell-qa-gate/SKILL.md +3 -9
- package/resources/codex-and-agents-customizations/.agents/skills/pr-author/SKILL.md +1 -9
- package/resources/codex-and-agents-customizations/.agents/skills/pr-base-branch-merge-base/SKILL.md +4 -9
- package/resources/codex-and-agents-customizations/.agents/skills/pr-context-artifacts/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/python/SKILL.md +1 -5
- package/resources/codex-and-agents-customizations/.agents/skills/python-change-budget-router/SKILL.md +1 -6
- package/resources/codex-and-agents-customizations/.agents/skills/python-qa-gate/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/python-suppressions/SKILL.md +2 -6
- package/resources/codex-and-agents-customizations/.agents/skills/quality-tiers/SKILL.md +57 -0
- package/resources/codex-and-agents-customizations/.agents/skills/remediation-handoff-atomic-planner/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/repo-automation-adapter/SKILL.md +96 -72
- package/resources/codex-and-agents-customizations/.agents/skills/repo-automation-adapter/agents/openai.yaml +1 -1
- package/resources/codex-and-agents-customizations/.agents/skills/research-issue/SKILL.md +0 -10
- package/resources/codex-and-agents-customizations/.agents/skills/review-epic/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/review-feature/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/review-staged/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/self-explanatory-code-commenting/SKILL.md +2 -6
- package/resources/codex-and-agents-customizations/.agents/skills/skill-canonical-location-audit/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/tonality/SKILL.md +86 -0
- package/resources/codex-and-agents-customizations/.agents/skills/translate-claude-to-codex/SKILL.md +297 -0
- package/resources/codex-and-agents-customizations/.agents/skills/translate-copilot-to-claude/SKILL.md +0 -22
- package/resources/codex-and-agents-customizations/.agents/skills/typescript/SKILL.md +1 -5
- package/resources/codex-and-agents-customizations/.agents/skills/typescript-suppressions/SKILL.md +2 -6
- package/resources/codex-and-agents-customizations/.agents/skills/update-status/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor.toml +5 -5
- package/resources/codex-and-agents-customizations/.codex/agents/orchestrator.toml +91 -63
- package/resources/codex-and-agents-customizations/.codex/agents/powershell-atomic-executor.toml +1 -1
- package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer.toml +1 -1
- package/resources/codex-and-agents-customizations/.codex/config.toml +111 -137
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-checkpoint-monotonic.ps1 +303 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-completion-consistency.ps1 +300 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1 +148 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-pr-author-skill.ps1 +336 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-promotion-mcp-only.ps1 +84 -18
- package/resources/codex-and-agents-customizations/.codex/prompts/orchestrate-work.md +4 -3
- package/resources/codex-and-agents-customizations/.codex/scripts/post-codex-worktree-session.ps1 +5 -0
- package/resources/codex-and-agents-customizations/.github/workflows/_validate-orchestrator-state.yml +68 -0
- package/resources/codex-and-agents-customizations/.github/workflows/validate-orchestrator-state.yml +15 -0
- package/resources/config/orchestration-routing.json +76 -0
- package/resources/customizations/.github/agents/Powershell DI Unit Test Engineer.agent.md +1 -1
- package/resources/customizations/.github/agents/atomic_executor.agent.md +1 -1
- package/resources/customizations/.github/agents/atomic_planning.agent.md +10 -10
- package/resources/customizations/.github/agents/csharp-orchestrator.agent.md +6 -2
- package/resources/customizations/.github/agents/feature-review.agent.md +2 -2
- package/resources/customizations/.github/agents/orchestrator.agent.md +6 -2
- package/resources/customizations/.github/agents/powershell-atomic-executor.agent.md +4 -4
- package/resources/customizations/.github/agents/powershell-atomic-planning.agent.md +10 -10
- package/resources/customizations/.github/agents/powershell-orchestrator.agent.md +6 -2
- package/resources/customizations/.github/agents/powershell-typed-engineer.agent.md +2 -2
- package/resources/customizations/.github/agents/pr-author.agent.md +25 -0
- package/resources/customizations/.github/agents/python-orchestrator.agent.md +6 -2
- package/resources/customizations/.github/agents/staged-review.agent.md +1 -1
- package/resources/customizations/.github/agents/task-researcher.agent.md +4 -4
- package/resources/customizations/.github/instructions/powershell-code-change.instructions.md +6 -6
- package/resources/customizations/.github/prompts/fillout-prd-feature.prompt.md +1 -1
- package/resources/customizations/.github/prompts/generate-commit-message-repo.prompt.md +1 -1
- package/resources/customizations/.github/prompts/orchestrate-csharp-work.prompt.md +5 -3
- package/resources/customizations/.github/prompts/orchestrate-work.prompt.md +5 -3
- package/resources/customizations/.github/prompts/research-issue.prompt.md +4 -3
- package/resources/customizations/.github/skills/atomic-plan-contract/SKILL.md +14 -1
- package/resources/customizations/.github/skills/feature-promotion-lifecycle/SKILL.md +11 -7
- package/resources/customizations/.github/skills/feature-review-workflow/SKILL.md +10 -1
- package/resources/customizations/.github/skills/pr-base-branch-merge-base/SKILL.md +2 -2
- package/resources/customizations/.github/skills/remediation-handoff-atomic-planner/SKILL.md +5 -0
- package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +7 -0
- package/resources/scripts/dev_tools/_orchestrator_state_human_interaction.py +127 -0
- package/resources/scripts/dev_tools/_orchestrator_state_routing.py +216 -0
- package/resources/scripts/dev_tools/push_down_claude_customizations.py +276 -61
- package/resources/scripts/dev_tools/push_down_claude_filesystem.py +472 -0
- package/resources/scripts/dev_tools/push_down_claude_pack_selection.py +401 -0
- package/resources/scripts/dev_tools/validate_orchestration_artifacts.py +103 -411
- package/resources/scripts/dev_tools/validate_orchestration_review_artifacts.py +107 -0
- package/resources/scripts/dev_tools/validate_orchestrator_state.py +505 -0
- package/resources/scripts/dev_tools/validate_policy_audit_artifact.py +472 -0
- package/resources/templates/push_down_claude_customizations.py +162 -117
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_repo_root_is_source_of_truth.md +0 -11
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_vsce_verify_package_location.md +0 -19
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/project_extension_location.md +0 -11
- package/resources/claude-customizations/.claude/agent-memory/prd-feature/MEMORY.md +0 -1
- package/resources/claude-customizations/.claude/agent-memory/prd-feature/project_push_down_pattern.md +0 -13
- package/resources/claude-customizations/.claude/agent-memory/task-researcher/MEMORY.md +0 -3
- package/resources/claude-customizations/.claude/agent-memory/task-researcher/project_push_down_claude_dir.md +0 -11
|
@@ -5,6 +5,14 @@ Purpose:
|
|
|
5
5
|
workflow while reusing the shared publisher engine behind the existing
|
|
6
6
|
`.github` customization flow. Settings-local configuration is excluded from
|
|
7
7
|
push-down because it holds host-specific overrides that must not propagate.
|
|
8
|
+
|
|
9
|
+
Agent-memory files under `.claude/agent-memory/` are filtered by a
|
|
10
|
+
content-based scope check: only memories whose frontmatter declares
|
|
11
|
+
`metadata.scope: general` are distributed to a destination workspace. A
|
|
12
|
+
memory with an absent, malformed, or unrecognized scope is treated as
|
|
13
|
+
`repo` and excluded (fail-safe default), so repository-specific memories do
|
|
14
|
+
not leak into consumer workspaces. Files outside `.claude/agent-memory/`
|
|
15
|
+
are copied verbatim and are never affected by the scope filter.
|
|
8
16
|
"""
|
|
9
17
|
|
|
10
18
|
from __future__ import annotations
|
|
@@ -12,6 +20,59 @@ from __future__ import annotations
|
|
|
12
20
|
import argparse
|
|
13
21
|
from pathlib import Path
|
|
14
22
|
|
|
23
|
+
try:
|
|
24
|
+
from scripts.dev_tools.push_down_claude_filesystem import (
|
|
25
|
+
AGENT_MEMORY_RELATIVE_ROOT,
|
|
26
|
+
GENERAL_MEMORY_SCOPE,
|
|
27
|
+
REPO_MEMORY_SCOPE,
|
|
28
|
+
ExcludingFileSystem,
|
|
29
|
+
is_general_memory_file,
|
|
30
|
+
read_memory_scope,
|
|
31
|
+
)
|
|
32
|
+
from scripts.dev_tools.push_down_claude_pack_selection import (
|
|
33
|
+
CSharpVariant,
|
|
34
|
+
ManifestError,
|
|
35
|
+
MemoryMode,
|
|
36
|
+
PackManifest,
|
|
37
|
+
assert_single_csharp_toolchain,
|
|
38
|
+
compute_published_paths,
|
|
39
|
+
load_pack_manifests,
|
|
40
|
+
)
|
|
41
|
+
except ModuleNotFoundError as error: # pragma: no cover - bundled import fallback
|
|
42
|
+
if error.name is None or not error.name.startswith("scripts"):
|
|
43
|
+
raise
|
|
44
|
+
from dev_tools.push_down_claude_filesystem import (
|
|
45
|
+
AGENT_MEMORY_RELATIVE_ROOT,
|
|
46
|
+
GENERAL_MEMORY_SCOPE,
|
|
47
|
+
REPO_MEMORY_SCOPE,
|
|
48
|
+
ExcludingFileSystem,
|
|
49
|
+
is_general_memory_file,
|
|
50
|
+
read_memory_scope,
|
|
51
|
+
)
|
|
52
|
+
from dev_tools.push_down_claude_pack_selection import (
|
|
53
|
+
CSharpVariant,
|
|
54
|
+
ManifestError,
|
|
55
|
+
MemoryMode,
|
|
56
|
+
PackManifest,
|
|
57
|
+
assert_single_csharp_toolchain,
|
|
58
|
+
compute_published_paths,
|
|
59
|
+
load_pack_manifests,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Repo-relative location of the bundle root that holds the pack manifests and
|
|
63
|
+
# the legacy variant subtree. In the repository CLI the source root is the repo
|
|
64
|
+
# root, so the manifests and variant live under this bundle path. The bundled
|
|
65
|
+
# template overrides ``bundle_root`` because its source root already is the
|
|
66
|
+
# bundle's ``claude-customizations`` directory.
|
|
67
|
+
BUNDLE_ROOT_RELATIVE_DIR = Path(
|
|
68
|
+
"extensions/drm-copilot/resources/claude-customizations"
|
|
69
|
+
)
|
|
70
|
+
# Subdirectory under the bundle root that contains the pack-manifest JSON files.
|
|
71
|
+
PACK_MANIFEST_SUBDIR = "pack-manifests"
|
|
72
|
+
# Valid CLI choices for the C# variant and memory-mode arguments.
|
|
73
|
+
CSHARP_VARIANT_CHOICES: tuple[str, ...] = ("modern", "legacy")
|
|
74
|
+
MEMORY_MODE_CHOICES: tuple[str, ...] = ("overwrite", "merge", "skip")
|
|
75
|
+
|
|
15
76
|
try:
|
|
16
77
|
from scripts.dev_tools.push_down_copilot_customizations import (
|
|
17
78
|
PushDownFileSystem,
|
|
@@ -41,79 +102,87 @@ ROOT_FOLDERS: tuple[Path, ...] = (Path(".claude"),)
|
|
|
41
102
|
EXCLUDED_RELATIVE_PATHS: tuple[Path, ...] = (Path(".claude/settings.local.json"),)
|
|
42
103
|
|
|
43
104
|
__all__ = [
|
|
105
|
+
"AGENT_MEMORY_RELATIVE_ROOT",
|
|
44
106
|
"ARTIFACT_DIRECTORY",
|
|
107
|
+
"CSHARP_VARIANT_CHOICES",
|
|
45
108
|
"EXCLUDED_RELATIVE_PATHS",
|
|
109
|
+
"GENERAL_MEMORY_SCOPE",
|
|
110
|
+
"BUNDLE_ROOT_RELATIVE_DIR",
|
|
111
|
+
"MEMORY_MODE_CHOICES",
|
|
112
|
+
"PACK_MANIFEST_SUBDIR",
|
|
113
|
+
"ManifestError",
|
|
46
114
|
"PushDownSummary",
|
|
115
|
+
"REPO_MEMORY_SCOPE",
|
|
47
116
|
"ROOT_FOLDERS",
|
|
48
117
|
"main",
|
|
49
118
|
"parse_args",
|
|
50
119
|
"push_down_customizations",
|
|
51
120
|
]
|
|
52
121
|
|
|
122
|
+
# Backward-compatible private aliases. The memory-scope helpers moved to
|
|
123
|
+
# ``push_down_claude_filesystem``; these aliases keep the prior import location
|
|
124
|
+
# stable for existing callers and tests that referenced the private names here.
|
|
125
|
+
_read_memory_scope = read_memory_scope
|
|
126
|
+
_is_general_memory_file = is_general_memory_file
|
|
53
127
|
|
|
54
|
-
class _ExcludingFileSystem:
|
|
55
|
-
"""Wrap a PushDownFileSystem and filter specified paths from list_files.
|
|
56
|
-
|
|
57
|
-
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
128
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
)
|
|
129
|
+
def _passthrough_rewrite(
|
|
130
|
+
text: str,
|
|
131
|
+
) -> tuple[str, int, int, list[str]]:
|
|
132
|
+
"""Return unmodified text for payloads that do not need command rewrites."""
|
|
83
133
|
|
|
84
|
-
|
|
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
|
-
]
|
|
134
|
+
return text, 0, 0, []
|
|
89
135
|
|
|
90
|
-
def is_dir(self, path: Path) -> bool:
|
|
91
|
-
"""Delegate to inner adapter."""
|
|
92
|
-
return self._inner.is_dir(path)
|
|
93
136
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
137
|
+
def _resolve_published_paths(
|
|
138
|
+
*,
|
|
139
|
+
packs: frozenset[str] | None,
|
|
140
|
+
bundle_root: Path,
|
|
141
|
+
fs: PushDownFileSystem,
|
|
142
|
+
) -> frozenset[str] | None:
|
|
143
|
+
"""Compute the published `.claude`-relative path set for a pack selection.
|
|
97
144
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
145
|
+
Purpose:
|
|
146
|
+
Load the selected pack manifests from the bundle, compute the union of
|
|
147
|
+
their destination paths (always including ``core``), and assert C#
|
|
148
|
+
mutual exclusion. Returns ``None`` when no pack selection was supplied so
|
|
149
|
+
the publisher falls back to the backward-compatible publish-everything
|
|
150
|
+
path with no manifest read.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
packs (frozenset[str] | None): Selected pack names, or ``None``/empty for
|
|
154
|
+
the publish-everything default.
|
|
155
|
+
bundle_root (Path): Bundle root that contains the ``pack-manifests``
|
|
156
|
+
subdirectory and the legacy variant subtree.
|
|
157
|
+
fs (PushDownFileSystem): Adapter used to read the manifest files.
|
|
158
|
+
|
|
159
|
+
Returns:
|
|
160
|
+
frozenset[str] | None: The union of selected packs' paths plus ``core``,
|
|
161
|
+
or ``None`` to signal the publish-everything default.
|
|
162
|
+
|
|
163
|
+
Raises:
|
|
164
|
+
ManifestError: When a manifest is missing/malformed or both C# variants
|
|
165
|
+
are selected in the same run.
|
|
101
166
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
167
|
+
Side Effects:
|
|
168
|
+
Reads manifest files through the adapter when a selection is present.
|
|
169
|
+
"""
|
|
105
170
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
171
|
+
# No explicit selection means the backward-compatible default: publish the
|
|
172
|
+
# full tree without reading any manifest.
|
|
173
|
+
if not packs:
|
|
174
|
+
return None
|
|
109
175
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
176
|
+
manifest_dir = bundle_root / PACK_MANIFEST_SUBDIR
|
|
177
|
+
manifests: dict[str, PackManifest] = load_pack_manifests(manifest_dir, packs, fs)
|
|
178
|
+
published = compute_published_paths(packs, manifests)
|
|
179
|
+
# compute_published_paths returns None only for an empty selection, which the
|
|
180
|
+
# early return above already excluded; treat a None here as an empty set so
|
|
181
|
+
# the C# exclusion check still runs on a concrete value.
|
|
182
|
+
empty: frozenset[str] = frozenset()
|
|
183
|
+
effective_published = published if published is not None else empty
|
|
184
|
+
assert_single_csharp_toolchain(effective_published, packs)
|
|
185
|
+
return effective_published
|
|
117
186
|
|
|
118
187
|
|
|
119
188
|
def push_down_customizations(
|
|
@@ -123,15 +192,83 @@ def push_down_customizations(
|
|
|
123
192
|
fs: PushDownFileSystem,
|
|
124
193
|
source_root: Path | None = None,
|
|
125
194
|
artifact_root: Path | None = None,
|
|
195
|
+
packs: frozenset[str] | None = None,
|
|
196
|
+
csharp_variant: CSharpVariant = "modern",
|
|
197
|
+
memory_mode: MemoryMode = "overwrite",
|
|
198
|
+
bundle_root: Path | None = None,
|
|
126
199
|
) -> PushDownSummary:
|
|
127
200
|
"""Copy the `.claude` tree into the destination workspace.
|
|
128
201
|
|
|
129
|
-
|
|
130
|
-
|
|
202
|
+
Purpose:
|
|
203
|
+
Publish the bundled `.claude` customizations into a destination
|
|
204
|
+
workspace, optionally filtered to a set of language packs, optionally
|
|
205
|
+
sourcing the C# toolchain from the legacy variant, and applying the
|
|
206
|
+
selected agent-memory mode.
|
|
207
|
+
|
|
208
|
+
Args:
|
|
209
|
+
repo_root (Path): Source repository root.
|
|
210
|
+
destination_root (Path): Destination workspace root.
|
|
211
|
+
fs (PushDownFileSystem): Filesystem adapter.
|
|
212
|
+
source_root (Path | None): Explicit source root for packaged content;
|
|
213
|
+
defaults to ``repo_root``.
|
|
214
|
+
artifact_root (Path | None): Explicit artifact root; defaults to
|
|
215
|
+
``repo_root``.
|
|
216
|
+
packs (frozenset[str] | None): Selected pack names. ``None``/empty
|
|
217
|
+
publishes the full tree (backward-compatible default) with no
|
|
218
|
+
manifest read and no variant routing.
|
|
219
|
+
csharp_variant (CSharpVariant): ``"modern"`` (default) reads C# files
|
|
220
|
+
from `.claude`; ``"legacy"`` reads them from the bundle-only legacy
|
|
221
|
+
variant subtree while still writing the canonical destination paths.
|
|
222
|
+
memory_mode (MemoryMode): ``overwrite`` (default), ``merge``, or
|
|
223
|
+
``skip`` for agent-memory handling.
|
|
224
|
+
bundle_root (Path | None): Root that holds the ``pack-manifests``
|
|
225
|
+
subdirectory and the legacy variant subtree. Defaults to
|
|
226
|
+
``source_root / BUNDLE_ROOT_RELATIVE_DIR`` (the repository CLI
|
|
227
|
+
layout). The bundled template passes its ``claude-customizations``
|
|
228
|
+
directory directly because its source root already is that bundle.
|
|
229
|
+
|
|
230
|
+
Returns:
|
|
231
|
+
PushDownSummary: The shared engine's run summary.
|
|
232
|
+
|
|
233
|
+
Raises:
|
|
234
|
+
ManifestError: When a selected manifest is missing/malformed or both C#
|
|
235
|
+
variants are selected.
|
|
236
|
+
|
|
237
|
+
Side Effects:
|
|
238
|
+
Reads source files and writes destination files and the summary artifact
|
|
239
|
+
through the adapter.
|
|
131
240
|
"""
|
|
132
241
|
|
|
133
|
-
|
|
134
|
-
|
|
242
|
+
effective_source = source_root if source_root is not None else repo_root
|
|
243
|
+
# Resolve the bundle root that holds manifests and the variant subtree. The
|
|
244
|
+
# repository CLI nests the bundle under the source root; the template passes
|
|
245
|
+
# its own bundle directory directly.
|
|
246
|
+
effective_bundle = (
|
|
247
|
+
bundle_root
|
|
248
|
+
if bundle_root is not None
|
|
249
|
+
else effective_source / BUNDLE_ROOT_RELATIVE_DIR
|
|
250
|
+
)
|
|
251
|
+
# Resolve the published-path set only when a pack selection is supplied so
|
|
252
|
+
# the no-argument path performs no manifest I/O and stays byte-equivalent.
|
|
253
|
+
published_paths = _resolve_published_paths(
|
|
254
|
+
packs=packs,
|
|
255
|
+
bundle_root=effective_bundle,
|
|
256
|
+
fs=fs,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
# Wrap the caller-supplied adapter so enumeration omits excluded paths and
|
|
260
|
+
# honors the pack, variant, and memory-mode selections.
|
|
261
|
+
excluding_fs = ExcludingFileSystem(
|
|
262
|
+
fs,
|
|
263
|
+
repo_root,
|
|
264
|
+
EXCLUDED_RELATIVE_PATHS,
|
|
265
|
+
source_root=effective_source,
|
|
266
|
+
destination_root=destination_root,
|
|
267
|
+
published_paths=published_paths,
|
|
268
|
+
csharp_variant=csharp_variant,
|
|
269
|
+
memory_mode=memory_mode,
|
|
270
|
+
variant_root=effective_bundle,
|
|
271
|
+
)
|
|
135
272
|
return push_down_scoped_customizations(
|
|
136
273
|
repo_root=repo_root,
|
|
137
274
|
destination_root=destination_root,
|
|
@@ -145,7 +282,27 @@ def push_down_customizations(
|
|
|
145
282
|
|
|
146
283
|
|
|
147
284
|
def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
|
|
148
|
-
"""Parse CLI arguments for the Claude customization push-down publisher.
|
|
285
|
+
"""Parse CLI arguments for the Claude customization push-down publisher.
|
|
286
|
+
|
|
287
|
+
Purpose:
|
|
288
|
+
Define the CLI contract, including the optional pack selection, C#
|
|
289
|
+
variant, and memory-mode flags. When the optional flags are omitted the
|
|
290
|
+
parsed namespace yields the backward-compatible defaults
|
|
291
|
+
(``packs=None``, ``csharp_variant="modern"``, ``memory_mode="overwrite"``).
|
|
292
|
+
|
|
293
|
+
Args:
|
|
294
|
+
argv (list[str] | None): Optional argument list for tests or embedding.
|
|
295
|
+
|
|
296
|
+
Returns:
|
|
297
|
+
argparse.Namespace: Parsed arguments with attributes ``destination``,
|
|
298
|
+
``packs``, ``csharp_variant``, and ``memory_mode``.
|
|
299
|
+
|
|
300
|
+
Raises:
|
|
301
|
+
SystemExit: Raised by ``argparse`` when arguments are invalid.
|
|
302
|
+
|
|
303
|
+
Side Effects:
|
|
304
|
+
Emits usage/help text through ``argparse`` when parsing fails.
|
|
305
|
+
"""
|
|
149
306
|
|
|
150
307
|
parser = argparse.ArgumentParser(
|
|
151
308
|
description=(
|
|
@@ -158,27 +315,85 @@ def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
|
|
|
158
315
|
required=True,
|
|
159
316
|
help=("Destination workspace root that will receive the copied .claude tree."),
|
|
160
317
|
)
|
|
318
|
+
parser.add_argument(
|
|
319
|
+
"--packs",
|
|
320
|
+
default=None,
|
|
321
|
+
help=(
|
|
322
|
+
"Comma-separated language pack names to publish (for example "
|
|
323
|
+
"'core,typescript'). When omitted, the full tree is published. "
|
|
324
|
+
"'core' is always included."
|
|
325
|
+
),
|
|
326
|
+
)
|
|
327
|
+
parser.add_argument(
|
|
328
|
+
"--csharp-variant",
|
|
329
|
+
dest="csharp_variant",
|
|
330
|
+
choices=CSHARP_VARIANT_CHOICES,
|
|
331
|
+
default="modern",
|
|
332
|
+
help="C# toolchain variant to source ('modern' default or 'legacy').",
|
|
333
|
+
)
|
|
334
|
+
parser.add_argument(
|
|
335
|
+
"--memory-mode",
|
|
336
|
+
dest="memory_mode",
|
|
337
|
+
choices=MEMORY_MODE_CHOICES,
|
|
338
|
+
default="overwrite",
|
|
339
|
+
help=(
|
|
340
|
+
"Agent-memory handling mode: 'overwrite' (default), 'merge', or " "'skip'."
|
|
341
|
+
),
|
|
342
|
+
)
|
|
161
343
|
return parser.parse_args(argv)
|
|
162
344
|
|
|
163
345
|
|
|
346
|
+
def _parse_packs_argument(packs_value: str | None) -> frozenset[str] | None:
|
|
347
|
+
"""Parse the raw ``--packs`` CLI value into a normalized pack-name set.
|
|
348
|
+
|
|
349
|
+
Args:
|
|
350
|
+
packs_value (str | None): The raw comma-separated value, or ``None`` when
|
|
351
|
+
the flag was omitted.
|
|
352
|
+
|
|
353
|
+
Returns:
|
|
354
|
+
frozenset[str] | None: The set of non-empty, stripped pack names, or
|
|
355
|
+
``None`` when the flag was omitted or contained only empty entries (the
|
|
356
|
+
publish-everything default).
|
|
357
|
+
"""
|
|
358
|
+
|
|
359
|
+
if packs_value is None:
|
|
360
|
+
return None
|
|
361
|
+
# Strip whitespace and drop empty entries so trailing commas or stray spaces
|
|
362
|
+
# do not produce empty pack names.
|
|
363
|
+
names = {entry.strip() for entry in packs_value.split(",") if entry.strip()}
|
|
364
|
+
if not names:
|
|
365
|
+
return None
|
|
366
|
+
return frozenset(names)
|
|
367
|
+
|
|
368
|
+
|
|
164
369
|
def main(
|
|
165
370
|
argv: list[str] | None = None,
|
|
166
371
|
*,
|
|
167
372
|
repo_root: Path | None = None,
|
|
168
373
|
fs: PushDownFileSystem | None = None,
|
|
169
374
|
) -> int:
|
|
170
|
-
"""Run the Claude customization push-down publisher CLI.
|
|
375
|
+
"""Run the Claude customization push-down publisher CLI.
|
|
376
|
+
|
|
377
|
+
Parses arguments, resolves defaults, threads the pack selection, C# variant,
|
|
378
|
+
and memory mode into ``push_down_customizations``, and prints the summary
|
|
379
|
+
artifact path. With no optional flags this is byte-for-byte equivalent to
|
|
380
|
+
the prior publish-everything/overwrite behavior.
|
|
381
|
+
"""
|
|
171
382
|
|
|
172
383
|
args = parse_args(argv)
|
|
173
384
|
resolved_repo_root = resolve_cli_path(repo_root or Path.cwd())
|
|
174
385
|
resolved_destination = resolve_cli_path(args.destination)
|
|
175
386
|
resolved_fs = fs or RealPushDownFileSystem()
|
|
387
|
+
packs = _parse_packs_argument(args.packs)
|
|
176
388
|
summary = push_down_customizations(
|
|
177
389
|
repo_root=resolved_repo_root,
|
|
178
390
|
destination_root=resolved_destination,
|
|
179
391
|
fs=resolved_fs,
|
|
180
392
|
source_root=resolved_repo_root,
|
|
181
393
|
artifact_root=resolved_repo_root,
|
|
394
|
+
packs=packs,
|
|
395
|
+
csharp_variant=args.csharp_variant,
|
|
396
|
+
memory_mode=args.memory_mode,
|
|
182
397
|
)
|
|
183
398
|
print(f"Wrote push-down summary artifact to: {summary.artifact_path}")
|
|
184
399
|
return 0
|