@danmoisan/drm-copilot-mcp 0.0.1 → 0.0.5
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 +5 -1
- 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 +16 -1
- package/resources/claude-customizations/.claude/agents/powershell-typed-engineer.md +1 -1
- package/resources/claude-customizations/.claude/hooks/enforce-checkpoint-monotonic.ps1 +245 -0
- package/resources/claude-customizations/.claude/hooks/enforce-completion-consistency.ps1 +273 -0
- package/resources/claude-customizations/.claude/hooks/enforce-feature-folder-order.ps1 +148 -0
- package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.ps1 +190 -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-task-researcher-output.ps1 +68 -0
- 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 +37 -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/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 +96 -3
- 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-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 +13 -14
- 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 +93 -8
- 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 +61 -2
- 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 +91 -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 +51 -136
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-promotion-mcp-only.ps1 +1 -1
- 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 +84 -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/python-orchestrator.agent.md +6 -2
- package/resources/customizations/.github/agents/staged-review.agent.md +1 -1
- package/resources/customizations/.github/instructions/powershell-code-change.instructions.md +6 -6
- 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/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 +191 -5
- 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 +428 -0
- package/resources/scripts/dev_tools/validate_policy_audit_artifact.py +448 -0
- package/resources/templates/push_down_claude_customizations.py +227 -6
- 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,13 +5,71 @@ 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
|
|
11
19
|
|
|
12
20
|
import argparse
|
|
21
|
+
import re
|
|
22
|
+
import sys
|
|
13
23
|
from pathlib import Path
|
|
14
24
|
|
|
25
|
+
AGENT_MEMORY_RELATIVE_ROOT = Path(".claude/agent-memory")
|
|
26
|
+
GENERAL_MEMORY_SCOPE = "general"
|
|
27
|
+
REPO_MEMORY_SCOPE = "repo"
|
|
28
|
+
|
|
29
|
+
# Match a leading YAML frontmatter block: the first `---` line, the block body,
|
|
30
|
+
# and the closing `---` line. DOTALL lets the body span multiple lines.
|
|
31
|
+
_FRONTMATTER_PATTERN = re.compile(
|
|
32
|
+
r"\A---[ \t]*\r?\n(.*?)\r?\n---[ \t]*(?:\r?\n|\Z)", re.DOTALL
|
|
33
|
+
)
|
|
34
|
+
# Match a `metadata:` mapping key at column zero, then capture the indented
|
|
35
|
+
# block lines that belong to it (lines that are more-indented or blank) until
|
|
36
|
+
# the next column-zero key or end of the frontmatter body.
|
|
37
|
+
_METADATA_BLOCK_PATTERN = re.compile(
|
|
38
|
+
r"^metadata:[ \t]*\r?\n((?:[ \t]+.*(?:\r?\n|\Z)|\r?\n)*)",
|
|
39
|
+
re.MULTILINE,
|
|
40
|
+
)
|
|
41
|
+
# Match a `scope:` leaf inside the metadata block, capturing its scalar value
|
|
42
|
+
# up to an optional inline comment. Surrounding quotes are stripped later.
|
|
43
|
+
_SCOPE_LEAF_PATTERN = re.compile(
|
|
44
|
+
r"^[ \t]+scope:[ \t]*([^\r\n#]*)",
|
|
45
|
+
re.MULTILINE,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _ensure_bundled_scripts_import_path() -> None:
|
|
50
|
+
"""Prepend bundled ``resources/scripts`` directory to ``sys.path``.
|
|
51
|
+
|
|
52
|
+
Purpose:
|
|
53
|
+
Make extension-bundled Python packages importable when this template is
|
|
54
|
+
invoked directly from ``resources/templates/`` rather than from the
|
|
55
|
+
repository root. Without this bootstrap, neither
|
|
56
|
+
``scripts.dev_tools.push_down_copilot_customizations`` nor the fallback
|
|
57
|
+
``dev_tools.push_down_copilot_customizations`` import resolves because
|
|
58
|
+
``resources/scripts`` is not on ``sys.path`` by default.
|
|
59
|
+
|
|
60
|
+
Side Effects:
|
|
61
|
+
Mutates ``sys.path`` by inserting the bundled scripts directory at
|
|
62
|
+
index 0 when not already present.
|
|
63
|
+
"""
|
|
64
|
+
scripts_dir = Path(__file__).resolve().parent.parent / "scripts"
|
|
65
|
+
scripts_dir_str = str(scripts_dir)
|
|
66
|
+
|
|
67
|
+
if scripts_dir_str not in sys.path:
|
|
68
|
+
sys.path.insert(0, scripts_dir_str)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
_ensure_bundled_scripts_import_path()
|
|
72
|
+
|
|
15
73
|
try:
|
|
16
74
|
from scripts.dev_tools.push_down_copilot_customizations import (
|
|
17
75
|
PushDownFileSystem,
|
|
@@ -41,9 +99,12 @@ ROOT_FOLDERS: tuple[Path, ...] = (Path(".claude"),)
|
|
|
41
99
|
EXCLUDED_RELATIVE_PATHS: tuple[Path, ...] = (Path(".claude/settings.local.json"),)
|
|
42
100
|
|
|
43
101
|
__all__ = [
|
|
102
|
+
"AGENT_MEMORY_RELATIVE_ROOT",
|
|
44
103
|
"ARTIFACT_DIRECTORY",
|
|
45
104
|
"EXCLUDED_RELATIVE_PATHS",
|
|
105
|
+
"GENERAL_MEMORY_SCOPE",
|
|
46
106
|
"PushDownSummary",
|
|
107
|
+
"REPO_MEMORY_SCOPE",
|
|
47
108
|
"ROOT_FOLDERS",
|
|
48
109
|
"main",
|
|
49
110
|
"parse_args",
|
|
@@ -51,14 +112,113 @@ __all__ = [
|
|
|
51
112
|
]
|
|
52
113
|
|
|
53
114
|
|
|
115
|
+
def _read_memory_scope(content: str) -> str:
|
|
116
|
+
"""Return the declared memory scope from a file's YAML frontmatter.
|
|
117
|
+
|
|
118
|
+
Purpose:
|
|
119
|
+
Extract the `metadata.scope` leaf from the leading YAML frontmatter
|
|
120
|
+
block using a narrow `re`-based parser. This avoids adding a runtime
|
|
121
|
+
YAML dependency (PyYAML) while reading only the single leaf the
|
|
122
|
+
push-down scope filter requires.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
content (str): The full text of a candidate memory file, including any
|
|
126
|
+
leading `---` frontmatter block.
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
str: ``"general"`` only when the frontmatter contains a `metadata:`
|
|
130
|
+
mapping whose `scope:` leaf is exactly ``general`` (quotes and inline
|
|
131
|
+
comments stripped). In every other case — missing frontmatter, no
|
|
132
|
+
closing `---`, no `metadata:` block, no `scope:` leaf, or any value
|
|
133
|
+
other than exactly ``general`` — it returns ``"repo"`` as the fail-safe
|
|
134
|
+
default so nothing leaks by accident.
|
|
135
|
+
|
|
136
|
+
Raises:
|
|
137
|
+
None.
|
|
138
|
+
|
|
139
|
+
Side Effects:
|
|
140
|
+
None.
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
# Isolate the leading frontmatter block; absent or unterminated frontmatter
|
|
144
|
+
# fails safe to the repo scope so unmarked files are never distributed.
|
|
145
|
+
frontmatter_match = _FRONTMATTER_PATTERN.match(content)
|
|
146
|
+
if frontmatter_match is None:
|
|
147
|
+
return REPO_MEMORY_SCOPE
|
|
148
|
+
frontmatter_body = frontmatter_match.group(1)
|
|
149
|
+
|
|
150
|
+
# Locate the metadata mapping; without it there is no scope leaf to read.
|
|
151
|
+
metadata_match = _METADATA_BLOCK_PATTERN.search(frontmatter_body)
|
|
152
|
+
if metadata_match is None:
|
|
153
|
+
return REPO_MEMORY_SCOPE
|
|
154
|
+
metadata_block = metadata_match.group(1)
|
|
155
|
+
|
|
156
|
+
# Read the scope leaf from within the metadata block only; a top-level
|
|
157
|
+
# `scope:` outside `metadata:` is intentionally ignored.
|
|
158
|
+
scope_match = _SCOPE_LEAF_PATTERN.search(metadata_block)
|
|
159
|
+
if scope_match is None:
|
|
160
|
+
return REPO_MEMORY_SCOPE
|
|
161
|
+
|
|
162
|
+
# Strip surrounding whitespace and optional matching quotes before the
|
|
163
|
+
# exact-match comparison; only an exact `general` is treated as general.
|
|
164
|
+
scope_value = scope_match.group(1).strip()
|
|
165
|
+
if (
|
|
166
|
+
len(scope_value) >= 2
|
|
167
|
+
and scope_value[0] == scope_value[-1]
|
|
168
|
+
and scope_value[0] in {'"', "'"}
|
|
169
|
+
):
|
|
170
|
+
scope_value = scope_value[1:-1].strip()
|
|
171
|
+
if scope_value == GENERAL_MEMORY_SCOPE:
|
|
172
|
+
return GENERAL_MEMORY_SCOPE
|
|
173
|
+
return REPO_MEMORY_SCOPE
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def _is_general_memory_file(relative_path: Path, content: str) -> bool:
|
|
177
|
+
"""Return whether a candidate file may be distributed by push-down.
|
|
178
|
+
|
|
179
|
+
Purpose:
|
|
180
|
+
Decide inclusion for one source file. Files under
|
|
181
|
+
`.claude/agent-memory/` are distributed only when general-scoped;
|
|
182
|
+
every other file is always distributed and is unaffected by the scope
|
|
183
|
+
filter.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
relative_path (Path): The file path relative to the repository root.
|
|
187
|
+
content (str): The full text of the file, used to read the memory
|
|
188
|
+
scope when the path is under the agent-memory subtree.
|
|
189
|
+
|
|
190
|
+
Returns:
|
|
191
|
+
bool: ``True`` when the path is outside `.claude/agent-memory/`, or when
|
|
192
|
+
the path is under that subtree and `_read_memory_scope(content)` is
|
|
193
|
+
exactly ``general``. ``False`` only for an agent-memory file whose
|
|
194
|
+
scope is not general (the fail-safe exclusion).
|
|
195
|
+
|
|
196
|
+
Raises:
|
|
197
|
+
None.
|
|
198
|
+
|
|
199
|
+
Side Effects:
|
|
200
|
+
None.
|
|
201
|
+
"""
|
|
202
|
+
|
|
203
|
+
# Files outside the agent-memory subtree are always copied; the scope
|
|
204
|
+
# filter never applies to rules, skills, agents, hooks, or settings.
|
|
205
|
+
try:
|
|
206
|
+
relative_path.relative_to(AGENT_MEMORY_RELATIVE_ROOT)
|
|
207
|
+
except ValueError:
|
|
208
|
+
return True
|
|
209
|
+
return _read_memory_scope(content) == GENERAL_MEMORY_SCOPE
|
|
210
|
+
|
|
211
|
+
|
|
54
212
|
class _ExcludingFileSystem:
|
|
55
213
|
"""Wrap a PushDownFileSystem and filter specified paths from list_files.
|
|
56
214
|
|
|
57
215
|
Purpose:
|
|
58
216
|
Prevent host-specific files (e.g. `settings.local.json`) from being
|
|
59
|
-
included when the publisher enumerates source files
|
|
60
|
-
|
|
61
|
-
|
|
217
|
+
included when the publisher enumerates source files, and exclude
|
|
218
|
+
repository-specific agent memories so only general-scoped memories are
|
|
219
|
+
distributed. Chosen over a post-enumeration filter so the exclusion
|
|
220
|
+
travels with the filesystem contract and is transparent to the shared
|
|
221
|
+
engine.
|
|
62
222
|
|
|
63
223
|
Usage:
|
|
64
224
|
Instantiate with the inner adapter and exclusion paths relative to
|
|
@@ -66,6 +226,8 @@ class _ExcludingFileSystem:
|
|
|
66
226
|
|
|
67
227
|
Invariants / Constraints:
|
|
68
228
|
Excluded paths are resolved once at construction time for O(1) checks.
|
|
229
|
+
The content-based scope filter reads file content only for candidates
|
|
230
|
+
under `.claude/agent-memory/`; all other files skip the read.
|
|
69
231
|
|
|
70
232
|
Side Effects:
|
|
71
233
|
Delegates all I/O to the inner adapter.
|
|
@@ -76,15 +238,65 @@ class _ExcludingFileSystem:
|
|
|
76
238
|
) -> None:
|
|
77
239
|
"""Set up the adapter; resolve exclusion paths relative to repo_root."""
|
|
78
240
|
self._inner = inner
|
|
241
|
+
# Retain the resolved repo root so per-file scope checks can derive the
|
|
242
|
+
# repo-relative path needed by the agent-memory scope filter.
|
|
243
|
+
self._repo_root = repo_root.resolve()
|
|
79
244
|
# Resolve once at init so list_files per-path checks are O(1).
|
|
80
245
|
self._excluded: frozenset[Path] = frozenset(
|
|
81
246
|
(repo_root / p).resolve() for p in excluded
|
|
82
247
|
)
|
|
83
248
|
|
|
249
|
+
def _is_scope_included(self, path: Path) -> bool:
|
|
250
|
+
"""Return whether a candidate file passes the agent-memory scope filter.
|
|
251
|
+
|
|
252
|
+
Purpose:
|
|
253
|
+
Apply the general-vs-repo memory scope decision to one enumerated
|
|
254
|
+
file, reading its content only when the path is under the
|
|
255
|
+
agent-memory subtree.
|
|
256
|
+
|
|
257
|
+
Args:
|
|
258
|
+
path (Path): The absolute candidate path returned by the inner
|
|
259
|
+
adapter's ``list_files``.
|
|
260
|
+
|
|
261
|
+
Returns:
|
|
262
|
+
bool: ``True`` when the file is outside `.claude/agent-memory/` or
|
|
263
|
+
is a general-scoped memory; ``False`` for a non-general memory.
|
|
264
|
+
|
|
265
|
+
Raises:
|
|
266
|
+
None.
|
|
267
|
+
|
|
268
|
+
Side Effects:
|
|
269
|
+
Reads file content via the inner adapter for agent-memory
|
|
270
|
+
candidates only.
|
|
271
|
+
"""
|
|
272
|
+
|
|
273
|
+
# Derive the repo-relative path so the agent-memory check matches the
|
|
274
|
+
# `.claude/agent-memory/` prefix regardless of the absolute location.
|
|
275
|
+
try:
|
|
276
|
+
relative_path = path.resolve().relative_to(self._repo_root)
|
|
277
|
+
except ValueError:
|
|
278
|
+
# A path outside the repo root cannot be an agent memory; include it.
|
|
279
|
+
return True
|
|
280
|
+
|
|
281
|
+
# Skip the content read entirely for files outside the memory subtree.
|
|
282
|
+
try:
|
|
283
|
+
relative_path.relative_to(AGENT_MEMORY_RELATIVE_ROOT)
|
|
284
|
+
except ValueError:
|
|
285
|
+
return True
|
|
286
|
+
|
|
287
|
+
content = self._inner.read_text(path)
|
|
288
|
+
return _is_general_memory_file(relative_path, content)
|
|
289
|
+
|
|
84
290
|
def list_files(self, root: Path) -> list[Path]:
|
|
85
|
-
"""Return inner list_files output with excluded paths removed.
|
|
291
|
+
"""Return inner list_files output with excluded paths removed.
|
|
292
|
+
|
|
293
|
+
Drops paths in ``EXCLUDED_RELATIVE_PATHS`` and any agent-memory file
|
|
294
|
+
that is not general-scoped per the content-based scope filter.
|
|
295
|
+
"""
|
|
86
296
|
return [
|
|
87
|
-
p
|
|
297
|
+
p
|
|
298
|
+
for p in self._inner.list_files(root)
|
|
299
|
+
if p.resolve() not in self._excluded and self._is_scope_included(p)
|
|
88
300
|
]
|
|
89
301
|
|
|
90
302
|
def is_dir(self, path: Path) -> bool:
|
|
@@ -170,7 +382,16 @@ def main(
|
|
|
170
382
|
"""Run the Claude customization push-down publisher CLI."""
|
|
171
383
|
|
|
172
384
|
args = parse_args(argv)
|
|
173
|
-
|
|
385
|
+
# Resolve the source root to the bundled customizations directory so the
|
|
386
|
+
# template distributes the bundled `.claude` payload rather than copying a
|
|
387
|
+
# destination workspace's existing `.claude` back onto itself. This mirrors
|
|
388
|
+
# the codex template (`push_down_codex_and_agents_customizations.py`), which
|
|
389
|
+
# sets its source root to the sibling bundled directory. The optional
|
|
390
|
+
# `repo_root` argument still allows tests to inject an explicit root.
|
|
391
|
+
customizations_root = (
|
|
392
|
+
Path(__file__).resolve().parent.parent / "claude-customizations"
|
|
393
|
+
)
|
|
394
|
+
resolved_repo_root = resolve_cli_path(repo_root or customizations_root)
|
|
174
395
|
resolved_destination = resolve_cli_path(args.destination)
|
|
175
396
|
resolved_fs = fs or RealPushDownFileSystem()
|
|
176
397
|
summary = push_down_customizations(
|
|
@@ -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,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/`.
|