Skip to content

Commit 317c6f0

Browse files
claudespoorcc
authored andcommitted
docs: update architecture diagram and AGENTS.md for composition refactoring
Replace the old SubProject inheritance model (ArchiveSubProject/GitSubproject/ SvnSubproject each implementing abstract SubProject) with the new composition design: SubProject composes with a Fetcher; Fetcher and VcsFetcher as protocols; AbstractVcsFetcher as shared ABC; GitFetcher and SvnFetcher implementing VcsFetcher; ArchiveFetcher implementing Fetcher only. Update AGENTS.md to describe the concrete SubProject aggregate and direct developers to implement Fetcher/VcsFetcher protocols when adding new backends. https://claude.ai/code/session_01BMSF8XFAxV6hABQgL7RZ3z
1 parent cfa81f7 commit 317c6f0

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ dfetch.log ← logging (lowest layer)
7171
- **`dfetch/__main__.py`** — CLI entry point; builds argparse subcommands and dispatches
7272
- **`dfetch/commands/`** — One file per CLI command (e.g., `update.py`, `check.py`); all inherit from `command.py`'s abstract `Command` base
7373
- **`dfetch/manifest/`** — YAML manifest loading/writing with `strictyaml` schema validation; `manifest.py` is the main handler
74-
- **`dfetch/project/`**Abstract `Subproject`/`Superproject` classes with concrete Git, SVN, and Archive implementations; factory functions `create_sub_project()` and `create_super_project()` are the main entry points
74+
- **`dfetch/project/`**Concrete `SubProject` domain aggregate that composes with a `Fetcher`; `GitFetcher`, `SvnFetcher`, and `ArchiveFetcher` implement the `Fetcher`/`VcsFetcher` protocols defined in `fetcher.py`; factory functions `create_sub_project()` and `create_super_project()` are the main entry points
7575
- **`dfetch/vcs/`** — Low-level VCS operations: `git.py`, `svn.py`, `archive.py` (with hash verification in `integrity_hash.py`), and `patch.py`
7676
- **`dfetch/reporting/`** — Output formatters; check results can be emitted as stdout, Jenkins JSON, SARIF, or Code Climate format; SBOM output uses CycloneDX format
7777
- **`dfetch/terminal/`** — Terminal UI components (interactive prompts, tree browser, ANSI colors)
@@ -84,7 +84,7 @@ dfetch.log ← logging (lowest layer)
8484

8585
### Adding a new VCS backend
8686

87-
Implement the abstract interfaces in `dfetch/project/subproject.py` and `dfetch/vcs/` and register via the factory in `dfetch/project/`.
87+
Implement the `Fetcher` protocol (or `VcsFetcher` if you need branch/tag/revision semantics) defined in `dfetch/project/fetcher.py`, add a concrete class in `dfetch/project/`, add low-level VCS operations in `dfetch/vcs/` if needed, and register via the factory in `dfetch/project/__init__.py`.
8888

8989
## Testing conventions
9090

doc/static/uml/c3_dfetch_components_project.puml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,29 @@ System_Boundary(DFetch, "Dfetch") {
1212
Boundary(DfetchProject, "Project", "python", "Main project that has a manifest.") {
1313

1414
Component(compAbstractCheckReporter, "AbstractCheckReporter", "python", "Abstract interface for generating a check report.")
15-
Component(compArchiveSub, "ArchiveSubProject", "python", "A subproject based on an archive.")
16-
Component(compGitSub, "GitSubproject", "python", "A subproject based on git.")
15+
Component(compSubProject, "SubProject", "python", "Concrete domain aggregate; composes with a Fetcher.")
16+
Component(compFetcher, "Fetcher", "python", "Protocol: minimal contract for all fetcher types.")
17+
Component(compVcsFetcher, "VcsFetcher", "python", "Protocol: Fetcher extended with VCS semantics (branches, tags, revisions).")
18+
Component(compAbstractVcsFetcher, "AbstractVcsFetcher", "python", "Shared VCS implementation (latest_available_version, freeze).")
19+
Component(compGitFetcher, "GitFetcher", "python", "Fetcher implementation for Git repositories.")
20+
Component(compSvnFetcher, "SvnFetcher", "python", "Fetcher implementation for SVN repositories.")
21+
Component(compArchiveFetcher, "ArchiveFetcher", "python", "Fetcher implementation for archive URLs (no VCS semantics).")
1722
Component(compMetadata, "Metadata", "python", "A file containing metadata about a project.")
18-
Component(compSvnSub, "SvnSubproject", "python", "A subproject based on svn.")
19-
Component(compSubProject, "SubProject", "python", "An abstract subproject.")
2023
Component(compSuperProject, "SuperProject", "python", "An abstract superproject.")
2124
Component(compGitSuper, "GitSuperProject", "python", "A superproject based on git.")
2225
Component(compSvnSuper, "SvnSuperProject", "python", "A superproject based on svn.")
2326
Component(compNoVcsSuper, "NoVcsSuperProject", "python", "A superproject without VCS.")
2427

25-
Rel_U(compArchiveSub, compSubProject, "Implements")
26-
Rel_U(compGitSub, compSubProject, "Implements")
27-
Rel_U(compSvnSub, compSubProject, "Implements")
28+
Rel(compSubProject, compFetcher, "Composes")
2829
Rel(compSubProject, compAbstractCheckReporter, "Uses")
2930
Rel_L(compSubProject, compMetadata, "Uses")
3031

32+
Rel_U(compVcsFetcher, compFetcher, "Extends")
33+
Rel_U(compAbstractVcsFetcher, compVcsFetcher, "Implements")
34+
Rel_U(compGitFetcher, compAbstractVcsFetcher, "Extends")
35+
Rel_U(compSvnFetcher, compAbstractVcsFetcher, "Extends")
36+
Rel_U(compArchiveFetcher, compFetcher, "Implements")
37+
3138
Rel_U(compGitSuper, compSuperProject, "Implements")
3239
Rel_U(compSvnSuper, compSuperProject, "Implements")
3340
Rel_U(compNoVcsSuper, compSuperProject, "Implements")
@@ -43,9 +50,9 @@ System_Boundary(DFetch, "Dfetch") {
4350
Rel_U(compMetadata, contManifest, "Has")
4451
Rel(compSuperProject, contManifest, "Has")
4552
Rel_U(contReporting, contManifest, "Uses")
46-
Rel(compArchiveSub, contVcs, "Uses")
47-
Rel(compGitSub, contVcs, "Uses")
48-
Rel(compSvnSub, contVcs, "Uses")
53+
Rel(compGitFetcher, contVcs, "Uses")
54+
Rel(compSvnFetcher, contVcs, "Uses")
55+
Rel(compArchiveFetcher, contVcs, "Uses")
4956
Rel(compGitSuper, contVcs, "Uses")
5057
Rel(compSvnSuper, contVcs, "Uses")
5158
}

0 commit comments

Comments
 (0)