@danmoisan/drm-copilot-mcp 0.0.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/out/mcp-server.js +10213 -398
  2. package/package.json +2 -2
  3. package/resources/claude-customizations/.claude/hooks/enforce-completion-consistency.ps1 +127 -17
  4. package/resources/claude-customizations/.claude/hooks/enforce-completion-helpers.ps1 +163 -0
  5. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +0 -12
  6. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output.ps1 +68 -1
  7. package/resources/config/orchestration-routing.json +3 -3
  8. package/resources/codex-and-agents-customizations/.codex/scripts/post-codex-worktree-session.ps1 +0 -5
  9. package/resources/scripts/dev_tools/__init__.py +0 -0
  10. package/resources/scripts/dev_tools/_orchestrator_state_human_interaction.py +0 -127
  11. package/resources/scripts/dev_tools/_orchestrator_state_routing.py +0 -216
  12. package/resources/scripts/dev_tools/agentic_sync.py +0 -819
  13. package/resources/scripts/dev_tools/codex_native_converter/__init__.py +0 -11
  14. package/resources/scripts/dev_tools/codex_native_converter/__main__.py +0 -6
  15. package/resources/scripts/dev_tools/codex_native_converter/cli.py +0 -11
  16. package/resources/scripts/dev_tools/new_active_feature_folder.py +0 -79
  17. package/resources/scripts/dev_tools/new_active_feature_folder_docs.py +0 -268
  18. package/resources/scripts/dev_tools/new_active_feature_folder_flow.py +0 -366
  19. package/resources/scripts/dev_tools/new_active_feature_folder_io.py +0 -306
  20. package/resources/scripts/dev_tools/new_active_feature_folder_markdown.py +0 -252
  21. package/resources/scripts/dev_tools/new_active_feature_folder_models.py +0 -136
  22. package/resources/scripts/dev_tools/new_potential_bug_entry.py +0 -465
  23. package/resources/scripts/dev_tools/potential_to_issue.py +0 -421
  24. package/resources/scripts/dev_tools/potential_to_issue_content.py +0 -212
  25. package/resources/scripts/dev_tools/pr_context/__init__.py +0 -0
  26. package/resources/scripts/dev_tools/pr_context/collector.py +0 -619
  27. package/resources/scripts/dev_tools/pr_context/feature_docs.py +0 -349
  28. package/resources/scripts/dev_tools/pr_context/git.py +0 -153
  29. package/resources/scripts/dev_tools/pr_context/github.py +0 -549
  30. package/resources/scripts/dev_tools/pr_context/models.py +0 -198
  31. package/resources/scripts/dev_tools/pr_context/render.py +0 -342
  32. package/resources/scripts/dev_tools/pr_context/render_feature_excerpts.py +0 -256
  33. package/resources/scripts/dev_tools/pr_context/render_pr_helpers.py +0 -291
  34. package/resources/scripts/dev_tools/pr_context/summary_helpers.py +0 -386
  35. package/resources/scripts/dev_tools/pr_context/verification_evidence.py +0 -171
  36. package/resources/scripts/dev_tools/prompt_mode_contract.py +0 -152
  37. package/resources/scripts/dev_tools/push_down_claude_customizations.py +0 -403
  38. package/resources/scripts/dev_tools/push_down_claude_filesystem.py +0 -472
  39. package/resources/scripts/dev_tools/push_down_claude_pack_selection.py +0 -401
  40. package/resources/scripts/dev_tools/push_down_codex_and_agents_customizations.py +0 -139
  41. package/resources/scripts/dev_tools/push_down_copilot_customizations.py +0 -504
  42. package/resources/scripts/dev_tools/push_down_copilot_customizations_filesystem.py +0 -217
  43. package/resources/scripts/dev_tools/push_down_copilot_customizations_rewrites.py +0 -293
  44. package/resources/scripts/dev_tools/resolve_file_prompt.py +0 -457
  45. package/resources/scripts/dev_tools/resolve_hard_lock_prompt.py +0 -444
  46. package/resources/scripts/dev_tools/validate_orchestration_artifacts.py +0 -246
  47. package/resources/scripts/dev_tools/validate_orchestration_review_artifacts.py +0 -107
  48. package/resources/scripts/dev_tools/validate_orchestrator_state.py +0 -505
  49. package/resources/scripts/dev_tools/validate_policy_audit_artifact.py +0 -472
  50. package/resources/templates/codex_native_converter.py +0 -35
  51. package/resources/templates/collect_commit_context.py +0 -212
  52. package/resources/templates/collect_pr_context.py +0 -74
  53. package/resources/templates/hello_python.py +0 -11
  54. package/resources/templates/new_active_feature_folder.py +0 -67
  55. package/resources/templates/new_potential_bug_entry.py +0 -54
  56. package/resources/templates/potential_to_issue.py +0 -55
  57. package/resources/templates/push_down_claude_customizations.py +0 -233
  58. package/resources/templates/push_down_codex_and_agents_customizations.py +0 -95
  59. package/resources/templates/push_down_copilot_customizations.py +0 -124
  60. package/resources/templates/resolve_atomic_plan_prompt.py +0 -75
  61. package/resources/templates/resolve_hard_lock_prompt.py +0 -65
  62. package/resources/templates/validate_orchestration_artifacts.py +0 -55
@@ -1,403 +0,0 @@
1
- """Publish bundled `.claude` content into a destination workspace.
2
-
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.
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.
16
- """
17
-
18
- from __future__ import annotations
19
-
20
- import argparse
21
- from pathlib import Path
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
-
76
- try:
77
- from scripts.dev_tools.push_down_copilot_customizations import (
78
- PushDownFileSystem,
79
- PushDownSummary,
80
- RealPushDownFileSystem,
81
- resolve_cli_path,
82
- )
83
- from scripts.dev_tools.push_down_copilot_customizations import (
84
- push_down_customizations as push_down_scoped_customizations,
85
- )
86
- except ModuleNotFoundError as error:
87
- if error.name is None or not error.name.startswith("scripts"):
88
- raise
89
- from dev_tools.push_down_copilot_customizations import (
90
- PushDownFileSystem,
91
- PushDownSummary,
92
- RealPushDownFileSystem,
93
- resolve_cli_path,
94
- )
95
- from dev_tools.push_down_copilot_customizations import (
96
- push_down_customizations as push_down_scoped_customizations,
97
- )
98
-
99
- ARTIFACT_DIRECTORY = "artifacts/claude-customizations"
100
- MODULE_ENTRY_POINT = "scripts.dev_tools.push_down_claude_customizations"
101
- ROOT_FOLDERS: tuple[Path, ...] = (Path(".claude"),)
102
- EXCLUDED_RELATIVE_PATHS: tuple[Path, ...] = (Path(".claude/settings.local.json"),)
103
-
104
- __all__ = [
105
- "AGENT_MEMORY_RELATIVE_ROOT",
106
- "ARTIFACT_DIRECTORY",
107
- "CSHARP_VARIANT_CHOICES",
108
- "EXCLUDED_RELATIVE_PATHS",
109
- "GENERAL_MEMORY_SCOPE",
110
- "BUNDLE_ROOT_RELATIVE_DIR",
111
- "MEMORY_MODE_CHOICES",
112
- "PACK_MANIFEST_SUBDIR",
113
- "ManifestError",
114
- "PushDownSummary",
115
- "REPO_MEMORY_SCOPE",
116
- "ROOT_FOLDERS",
117
- "main",
118
- "parse_args",
119
- "push_down_customizations",
120
- ]
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
127
-
128
-
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."""
133
-
134
- return text, 0, 0, []
135
-
136
-
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.
144
-
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.
166
-
167
- Side Effects:
168
- Reads manifest files through the adapter when a selection is present.
169
- """
170
-
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
175
-
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
186
-
187
-
188
- def push_down_customizations(
189
- *,
190
- repo_root: Path,
191
- destination_root: Path,
192
- fs: PushDownFileSystem,
193
- source_root: Path | None = None,
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,
199
- ) -> PushDownSummary:
200
- """Copy the `.claude` tree into the destination workspace.
201
-
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.
240
- """
241
-
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
- )
272
- return push_down_scoped_customizations(
273
- repo_root=repo_root,
274
- destination_root=destination_root,
275
- fs=excluding_fs,
276
- source_root=source_root,
277
- artifact_root=artifact_root,
278
- root_folders=ROOT_FOLDERS,
279
- artifact_directory=ARTIFACT_DIRECTORY,
280
- rewrite_references=_passthrough_rewrite,
281
- )
282
-
283
-
284
- def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
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
- """
306
-
307
- parser = argparse.ArgumentParser(
308
- description=(
309
- "Publish bundled Claude customizations with "
310
- f"python -m {MODULE_ENTRY_POINT}."
311
- )
312
- )
313
- parser.add_argument(
314
- "--destination",
315
- required=True,
316
- help=("Destination workspace root that will receive the copied .claude tree."),
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
- )
343
- return parser.parse_args(argv)
344
-
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
-
369
- def main(
370
- argv: list[str] | None = None,
371
- *,
372
- repo_root: Path | None = None,
373
- fs: PushDownFileSystem | None = None,
374
- ) -> int:
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
- """
382
-
383
- args = parse_args(argv)
384
- resolved_repo_root = resolve_cli_path(repo_root or Path.cwd())
385
- resolved_destination = resolve_cli_path(args.destination)
386
- resolved_fs = fs or RealPushDownFileSystem()
387
- packs = _parse_packs_argument(args.packs)
388
- summary = push_down_customizations(
389
- repo_root=resolved_repo_root,
390
- destination_root=resolved_destination,
391
- fs=resolved_fs,
392
- source_root=resolved_repo_root,
393
- artifact_root=resolved_repo_root,
394
- packs=packs,
395
- csharp_variant=args.csharp_variant,
396
- memory_mode=args.memory_mode,
397
- )
398
- print(f"Wrote push-down summary artifact to: {summary.artifact_path}")
399
- return 0
400
-
401
-
402
- if __name__ == "__main__":
403
- raise SystemExit(main())