Install integration command files into *project_root*. Returns the list of files created. Copies raw templates without processing. Integrations that need placeholder replacement (e.g. ``{SCRIPT}``, ``__AGENT__``) should override ``setup()`` and call ``process_templ
(
self,
project_root: Path,
manifest: IntegrationManifest,
parsed_options: dict[str, Any] | None = None,
**opts: Any,
)
| 682 | return content |
| 683 | |
| 684 | def setup( |
| 685 | self, |
| 686 | project_root: Path, |
| 687 | manifest: IntegrationManifest, |
| 688 | parsed_options: dict[str, Any] | None = None, |
| 689 | **opts: Any, |
| 690 | ) -> list[Path]: |
| 691 | """Install integration command files into *project_root*. |
| 692 | |
| 693 | Returns the list of files created. Copies raw templates without |
| 694 | processing. Integrations that need placeholder replacement |
| 695 | (e.g. ``{SCRIPT}``, ``__AGENT__``) should override ``setup()`` |
| 696 | and call ``process_template()`` in their own loop — see |
| 697 | ``CopilotIntegration`` for an example. |
| 698 | """ |
| 699 | templates = self.list_command_templates() |
| 700 | if not templates: |
| 701 | return [] |
| 702 | |
| 703 | project_root_resolved = project_root.resolve() |
| 704 | if manifest.project_root != project_root_resolved: |
| 705 | raise ValueError( |
| 706 | f"manifest.project_root ({manifest.project_root}) does not match " |
| 707 | f"project_root ({project_root_resolved})" |
| 708 | ) |
| 709 | |
| 710 | dest = self.commands_dest(project_root).resolve() |
| 711 | try: |
| 712 | dest.relative_to(project_root_resolved) |
| 713 | except ValueError as exc: |
| 714 | raise ValueError( |
| 715 | f"Integration destination {dest} escapes " |
| 716 | f"project root {project_root_resolved}" |
| 717 | ) from exc |
| 718 | |
| 719 | created: list[Path] = [] |
| 720 | |
| 721 | for src_file in templates: |
| 722 | dst_name = self.command_filename(src_file.stem) |
| 723 | dst_file = self.copy_command_to_directory(src_file, dest, dst_name) |
| 724 | self.record_file_in_manifest(dst_file, project_root, manifest) |
| 725 | created.append(dst_file) |
| 726 | |
| 727 | |
| 728 | return created |
| 729 | |
| 730 | def teardown( |
| 731 | self, |
no test coverage detected