git-repokit 0.9.10__py3-none-any.whl
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.
- git_repokit-0.9.10.dist-info/METADATA +422 -0
- git_repokit-0.9.10.dist-info/RECORD +174 -0
- git_repokit-0.9.10.dist-info/WHEEL +5 -0
- git_repokit-0.9.10.dist-info/entry_points.txt +2 -0
- git_repokit-0.9.10.dist-info/licenses/LICENSE +9 -0
- git_repokit-0.9.10.dist-info/top_level.txt +1 -0
- repokit/__init__.py +8 -0
- repokit/__main__.py +12 -0
- repokit/__version__.py +4 -0
- repokit/_vendor/__init__.py +0 -0
- repokit/_vendor/ailib/__init__.py +1 -0
- repokit/_vendor/ailib/analyzer.py +177 -0
- repokit/_vendor/ailib/backend.py +95 -0
- repokit/_vendor/ailib/cache.py +97 -0
- repokit/_vendor/ailib/parsers.py +52 -0
- repokit/_vendor/ailib/transports/__init__.py +16 -0
- repokit/_vendor/ailib/transports/cli.py +312 -0
- repokit/_vendor/ailib/transports/openai_compat.py +383 -0
- repokit/_vendor/ailib/transports/prompt_file.py +41 -0
- repokit/_vendor/ailib/types.py +224 -0
- repokit/auth_integration.py +244 -0
- repokit/badges.py +183 -0
- repokit/branch_utils.py +364 -0
- repokit/cli.py +2997 -0
- repokit/common_kit.py +202 -0
- repokit/config.py +686 -0
- repokit/defaults.py +220 -0
- repokit/directory_analyzer.py +1244 -0
- repokit/directory_profiles.py +423 -0
- repokit/git_config.py +370 -0
- repokit/github_create.py +142 -0
- repokit/github_setup.py +248 -0
- repokit/guardrails.py +707 -0
- repokit/history_cleaner.py +449 -0
- repokit/history_protection.py +434 -0
- repokit/hooks/pre-commit-guardrails +122 -0
- repokit/hooks/pre-commit-template +28 -0
- repokit/layers.py +510 -0
- repokit/licenses/0bsd.txt +14 -0
- repokit/licenses/LICENSES.md +27 -0
- repokit/licenses/__init__.py +142 -0
- repokit/licenses/agpl-3.0.txt +661 -0
- repokit/licenses/all-rights-reserved.txt +10 -0
- repokit/licenses/apache-2.0.txt +201 -0
- repokit/licenses/bsd-2-clause.txt +24 -0
- repokit/licenses/bsd-3-clause.txt +28 -0
- repokit/licenses/bsl-1.0.txt +23 -0
- repokit/licenses/cc-by-4.0.txt +395 -0
- repokit/licenses/cc-by-sa-4.0.txt +427 -0
- repokit/licenses/cc0-1.0.txt +121 -0
- repokit/licenses/epl-2.0.txt +277 -0
- repokit/licenses/gpl-2.0.txt +339 -0
- repokit/licenses/gpl-3.0.txt +674 -0
- repokit/licenses/isc.txt +15 -0
- repokit/licenses/lgpl-2.1.txt +504 -0
- repokit/licenses/lgpl-3.0.txt +165 -0
- repokit/licenses/mit.txt +21 -0
- repokit/licenses/mpl-2.0.txt +373 -0
- repokit/licenses/unlicense.txt +24 -0
- repokit/readme_blocks.py +112 -0
- repokit/remote_integration.py +627 -0
- repokit/repo_manager.py +2796 -0
- repokit/template_engine.py +391 -0
- repokit/templates/ai/claude/CLAUDE-nested.md.template +25 -0
- repokit/templates/ai/claude/CLAUDE.md.template +98 -0
- repokit/templates/ai/claude/instructions/step1_context_rebuilder.md +33 -0
- repokit/templates/ai/claude/instructions/step2_dev_workflow_process.md +67 -0
- repokit/templates/ai/claude/instructions/step3_context_bridge.md +52 -0
- repokit/templates/common/CHANGELOG.md.template +15 -0
- repokit/templates/common/CONTRIBUTING.md.template +31 -0
- repokit/templates/common/README.md.template +30 -0
- repokit/templates/common/gitattributes.template +17 -0
- repokit/templates/common/gitignore.template +141 -0
- repokit/templates/extras/FUNDING.yml.template +13 -0
- repokit/templates/extras/ROADMAP.md.template +17 -0
- repokit/templates/extras/dependabot.yml.template +22 -0
- repokit/templates/extras/one-offs-README.md.template +28 -0
- repokit/templates/extras/platform-support.md.template +11 -0
- repokit/templates/extras/pull_request_template.md.template +25 -0
- repokit/templates/extras/release-template.md.template +34 -0
- repokit/templates/extras/settings.json.template +11 -0
- repokit/templates/extras/stale.yml.template +14 -0
- repokit/templates/github/CODEOWNERS.template +11 -0
- repokit/templates/github/ISSUE_TEMPLATE/bug-report.md.template +29 -0
- repokit/templates/github/ISSUE_TEMPLATE/feature-request.md.template +19 -0
- repokit/templates/github/issues/notes.md.template +18 -0
- repokit/templates/github/issues/roadmap.md.template +15 -0
- repokit/templates/hooks/pre-commit.template +64 -0
- repokit/templates/layers/archetypes/any/claude-plugin/.claude-plugin/marketplace.json +20 -0
- repokit/templates/layers/archetypes/any/claude-plugin/plugin/.claude-plugin/plugin.json +15 -0
- repokit/templates/layers/archetypes/any/claude-plugin/plugin/README.md +28 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/.github/workflows/ci-c-cpp.yml +24 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/.repokit-common.toml.rkappend +4 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/.vscode/launch.json +29 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/.vscode/tasks.json +26 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/CMakeLists.txt +47 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/CMakePresets.json +23 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/cmake/GenerateStamp.cmake +45 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/src/main.cpp +27 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/tests/test_version.cpp +20 -0
- repokit/templates/layers/archetypes/c-cpp/cmake-app/vcpkg.json +5 -0
- repokit/templates/layers/archetypes/c-cpp/minimal/.vscode/launch.json +27 -0
- repokit/templates/layers/archetypes/c-cpp/minimal/Makefile +10 -0
- repokit/templates/layers/archetypes/c-cpp/minimal/build.bat +7 -0
- repokit/templates/layers/archetypes/c-cpp/minimal/src/__RK_SNAKE__.c +26 -0
- repokit/templates/layers/archetypes/c-cpp/msbuild/.vscode/launch.json +17 -0
- repokit/templates/layers/archetypes/c-cpp/msbuild/.vscode/tasks.json +20 -0
- repokit/templates/layers/archetypes/c-cpp/msbuild/__RK_PROJECT__.sln +19 -0
- repokit/templates/layers/archetypes/c-cpp/msbuild/__RK_PROJECT__.vcxproj +41 -0
- repokit/templates/layers/archetypes/c-cpp/msbuild/src/main.cpp +26 -0
- repokit/templates/layers/archetypes/js-ts/claude-plugin/.repokit-common.toml +28 -0
- repokit/templates/layers/archetypes/js-ts/claude-plugin/.vscode/launch.json +34 -0
- repokit/templates/layers/archetypes/js-ts/claude-plugin/plugin/hooks/hooks.json +15 -0
- repokit/templates/layers/archetypes/js-ts/claude-plugin/plugin/hooks/scripts/session-start.mjs +23 -0
- repokit/templates/layers/archetypes/js-ts/claude-plugin/plugin/tests/manifest.test.js +30 -0
- repokit/templates/layers/archetypes/js-ts/node/.repokit-common.toml.rkappend +6 -0
- repokit/templates/layers/archetypes/js-ts/node/package.json +13 -0
- repokit/templates/layers/archetypes/js-ts/node-package/.github/workflows/release.yml +39 -0
- repokit/templates/layers/archetypes/js-ts/node-package/package.json +32 -0
- repokit/templates/layers/archetypes/js-ts/node-package/src/index.ts +13 -0
- repokit/templates/layers/archetypes/js-ts/node-package/tests/index.test.ts +11 -0
- repokit/templates/layers/archetypes/js-ts/script/.vscode/launch.json +34 -0
- repokit/templates/layers/archetypes/js-ts/script/__RK_PROJECT__.js +37 -0
- repokit/templates/layers/archetypes/js-ts/script/tests/version.test.js +26 -0
- repokit/templates/layers/archetypes/js-ts/ts/package.json +18 -0
- repokit/templates/layers/archetypes/js-ts/ts/tsconfig.json +15 -0
- repokit/templates/layers/archetypes/python/claude-plugin/.github/workflows/ci-python.yml +44 -0
- repokit/templates/layers/archetypes/python/claude-plugin/.repokit-common.toml +21 -0
- repokit/templates/layers/archetypes/python/claude-plugin/.vscode/launch.json +33 -0
- repokit/templates/layers/archetypes/python/claude-plugin/VERSION +1 -0
- repokit/templates/layers/archetypes/python/claude-plugin/plugin/hooks/hooks.json +15 -0
- repokit/templates/layers/archetypes/python/claude-plugin/plugin/hooks/scripts/run-hook.mjs +42 -0
- repokit/templates/layers/archetypes/python/claude-plugin/plugin/hooks/scripts/session_start.py +31 -0
- repokit/templates/layers/archetypes/python/claude-plugin/plugin/tests/test_manifest.py +42 -0
- repokit/templates/layers/archetypes/python/pypi/.github/workflows/release.yml +63 -0
- repokit/templates/layers/archetypes/python/pypi/.vscode/launch.json +43 -0
- repokit/templates/layers/archetypes/python/pypi/__RK_SNAKE__/__init__.py +5 -0
- repokit/templates/layers/archetypes/python/pypi/__RK_SNAKE__/__main__.py +6 -0
- repokit/templates/layers/archetypes/python/pypi/__RK_SNAKE__/_version.py +96 -0
- repokit/templates/layers/archetypes/python/pypi/__RK_SNAKE__/cli.py +18 -0
- repokit/templates/layers/archetypes/python/pypi/pyproject.toml +71 -0
- repokit/templates/layers/archetypes/python/pypi/tests/conftest.py +11 -0
- repokit/templates/layers/archetypes/python/pypi/tests/test_version.py +50 -0
- repokit/templates/layers/archetypes/python/script/.github/workflows/ci-python.yml +43 -0
- repokit/templates/layers/archetypes/python/script/.repokit-common.toml +14 -0
- repokit/templates/layers/archetypes/python/script/.vscode/launch.json +33 -0
- repokit/templates/layers/archetypes/python/script/VERSION +1 -0
- repokit/templates/layers/archetypes/python/script/__RK_PROJECT__.py +40 -0
- repokit/templates/layers/archetypes/python/script/tests/test_version.py +25 -0
- repokit/templates/layers/archetypes/python/setuppy/requirements.txt +8 -0
- repokit/templates/layers/archetypes/python/setuppy/setup.py +23 -0
- repokit/templates/layers/languages/c-cpp/.gitignore.rkappend +20 -0
- repokit/templates/layers/languages/c-cpp/.repokit-common.toml +7 -0
- repokit/templates/layers/languages/c-cpp/include/__RK_SNAKE__/version.h +20 -0
- repokit/templates/layers/languages/c-cpp/src/app.rc +25 -0
- repokit/templates/layers/languages/js-ts/.editorconfig +15 -0
- repokit/templates/layers/languages/js-ts/.github/workflows/ci-js-ts.yml +41 -0
- repokit/templates/layers/languages/js-ts/.gitignore.rkappend +13 -0
- repokit/templates/layers/languages/js-ts/.repokit-common.toml +19 -0
- repokit/templates/layers/languages/js-ts/.vscode/launch.json +24 -0
- repokit/templates/layers/languages/js-ts/VERSION +1 -0
- repokit/templates/layers/languages/python/.github/workflows/ci-python.yml +76 -0
- repokit/templates/layers/languages/python/.gitignore.rkappend +15 -0
- repokit/templates/layers/languages/python/.vscode/launch.json +33 -0
- repokit/templates/layers/manifest.toml +302 -0
- repokit/templates/vault/CLAUDE.md +29 -0
- repokit/templates/vault/claude/_maps/MOC-project.md +15 -0
- repokit/templates/vault/claude/_oracle/backlinks.md +3 -0
- repokit/templates/vault/claude/_oracle/concepts.md +12 -0
- repokit/templates/vault/claude/_oracle/manifest.md +10 -0
- repokit/templates/vault/claude/_todo/ACTIVE-WORK.md +18 -0
- repokit/templates/vault/claude/_todo/OPEN-LOOPS.md +14 -0
- repokit/utils.py +316 -0
- repokit/vault.py +248 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"""The licence catalogue: the SPDX set GitHub and GitLab offer at repository
|
|
2
|
+
creation, as text files beside this module, plus a file form for anything else.
|
|
3
|
+
|
|
4
|
+
The texts come from github/choosealicense.com at one pinned commit; LICENSES.md
|
|
5
|
+
beside them records the commit and each file's fingerprint as received and as
|
|
6
|
+
shipped (the placeholders became __RK_YEAR__ and __RK_HOLDER__, nothing else).
|
|
7
|
+
A licence is a PARAMETER of `repokit create`, not a template file: the value
|
|
8
|
+
comes from --license, else the global config (`license`, or `license_private`
|
|
9
|
+
for a private repository), and with none of those the create is refused and the
|
|
10
|
+
catalogue named -- there is no silent default (djdarcy, 2026-10-22: "perhaps
|
|
11
|
+
just making it a requirement that the person provides it is best").
|
|
12
|
+
|
|
13
|
+
The "or-later" variants are not files: the licence text is identical and only
|
|
14
|
+
the project's notice says "or later", so they render from the base text with a
|
|
15
|
+
notice line. Design: 2026-10-22__22-06-57__dev-workflow-process__0-9-x-parity-
|
|
16
|
+
with-the-old-route.md (U1, U2); the survey behind the catalogue's size:
|
|
17
|
+
tests/one-offs/thinking/p4-measure-licenses/results.md.
|
|
18
|
+
"""
|
|
19
|
+
import datetime
|
|
20
|
+
import hashlib
|
|
21
|
+
import re
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
from typing import Dict, List, Optional, Tuple
|
|
24
|
+
|
|
25
|
+
DIR = Path(__file__).resolve().parent
|
|
26
|
+
RECORD = DIR / "LICENSES.md"
|
|
27
|
+
HOLDER = "__RK_HOLDER__"
|
|
28
|
+
YEAR = "__RK_YEAR__"
|
|
29
|
+
|
|
30
|
+
# id -> (base id, SPDX id, the notice line's wording)
|
|
31
|
+
VARIANTS: Dict[str, Tuple[str, str, str]] = {
|
|
32
|
+
"gpl-3.0-or-later": ("gpl-3.0", "GPL-3.0-or-later", "GNU General Public License, version 3 or (at your option) any later version"),
|
|
33
|
+
"lgpl-3.0-or-later": ("lgpl-3.0", "LGPL-3.0-or-later", "GNU Lesser General Public License, version 3 or (at your option) any later version"),
|
|
34
|
+
"agpl-3.0-or-later": ("agpl-3.0", "AGPL-3.0-or-later", "GNU Affero General Public License, version 3 or (at your option) any later version"),
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class LicenseError(ValueError):
|
|
39
|
+
"""A licence the person named cannot be used; the message says what would."""
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def known() -> List[str]:
|
|
43
|
+
"""Every id the catalogue renders: the files, then the notice variants."""
|
|
44
|
+
files = sorted(p.stem for p in DIR.glob("*.txt"))
|
|
45
|
+
return files + sorted(VARIANTS)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def normalise(spec: str) -> str:
|
|
49
|
+
"""`GPL-3.0`, `gpl-3.0`, `MIT` -> the catalogue's lower-case id."""
|
|
50
|
+
return spec.strip().lower()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def is_known(spec: str) -> bool:
|
|
54
|
+
return normalise(spec) in known()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def body(lid: str) -> str:
|
|
58
|
+
"""The shipped text of one catalogue file, tokens unresolved."""
|
|
59
|
+
path = DIR / f"{lid}.txt"
|
|
60
|
+
if not path.is_file():
|
|
61
|
+
raise LicenseError(f"unknown licence {lid!r}; the catalogue has: {', '.join(known())}; or --license file=<path>")
|
|
62
|
+
return path.read_text(encoding="utf-8")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def render(spec: str, holder: str, year: Optional[int] = None) -> str:
|
|
66
|
+
"""The LICENSE text for this id, holder and year (default: this year)."""
|
|
67
|
+
lid = normalise(spec)
|
|
68
|
+
year = year or datetime.date.today().year
|
|
69
|
+
if lid in VARIANTS:
|
|
70
|
+
base, spdx, wording = VARIANTS[lid]
|
|
71
|
+
notice = (f"Copyright (c) {year} {holder}\n\n"
|
|
72
|
+
f"This program is free software: you may redistribute it and/or modify it under the terms of the "
|
|
73
|
+
f"{wording} (SPDX-License-Identifier: {spdx}). The licence text follows.\n\n")
|
|
74
|
+
return notice + body(base)
|
|
75
|
+
return body(lid).replace(HOLDER, holder).replace(YEAR, str(year))
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def record() -> Dict[str, Tuple[str, str]]:
|
|
79
|
+
"""LICENSES.md's table: id -> (sha256 as received, sha256 as shipped)."""
|
|
80
|
+
out: Dict[str, Tuple[str, str]] = {}
|
|
81
|
+
for line in RECORD.read_text(encoding="utf-8").splitlines():
|
|
82
|
+
m = re.match(r"\|\s*([a-z0-9.\-]+)\s*\|[^|]*\|[^|]*\|\s*([0-9a-f]{64}|-)\s*\|\s*([0-9a-f]{64})\s*\|", line)
|
|
83
|
+
if m:
|
|
84
|
+
out[m.group(1)] = (m.group(2), m.group(3))
|
|
85
|
+
return out
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def spdx(lid: str) -> Optional[str]:
|
|
89
|
+
"""The SPDX identifier for a catalogue id (`gpl-3.0` -> `GPL-3.0`), from the
|
|
90
|
+
variants or LICENSES.md's SPDX column; None for an id the catalogue lacks."""
|
|
91
|
+
lid = normalise(lid)
|
|
92
|
+
if lid in VARIANTS:
|
|
93
|
+
return VARIANTS[lid][1]
|
|
94
|
+
for line in RECORD.read_text(encoding="utf-8").splitlines():
|
|
95
|
+
cells = [c.strip() for c in line.strip().strip("|").split("|")]
|
|
96
|
+
if len(cells) > 2 and cells[0] == lid:
|
|
97
|
+
return cells[1]
|
|
98
|
+
return None
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def title(lid: str) -> Optional[str]:
|
|
102
|
+
"""The licence's full name for prose (`gpl-3.0` -> `GNU General Public
|
|
103
|
+
License v3.0`): the variants' base title plus "or later", else
|
|
104
|
+
LICENSES.md's title column; None for an id the catalogue lacks."""
|
|
105
|
+
lid = normalise(lid)
|
|
106
|
+
if lid in VARIANTS:
|
|
107
|
+
base = title(VARIANTS[lid][0])
|
|
108
|
+
return f"{base} or later" if base else None
|
|
109
|
+
for line in RECORD.read_text(encoding="utf-8").splitlines():
|
|
110
|
+
cells = [c.strip() for c in line.strip().strip("|").split("|")]
|
|
111
|
+
if len(cells) > 2 and cells[0] == lid:
|
|
112
|
+
return cells[2].replace(" (authored here)", "")
|
|
113
|
+
return None
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def file_sha256(path: Path) -> str:
|
|
117
|
+
return hashlib.sha256(path.read_bytes()).hexdigest()
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def resolve(spec: Optional[str], config_license: Optional[str], private: bool,
|
|
121
|
+
config_private: Optional[str]) -> Tuple[str, Optional[str]]:
|
|
122
|
+
"""What LICENSE to write: ("catalogue", id), ("file", path) or ("none", None).
|
|
123
|
+
|
|
124
|
+
Order: --license; else the config's `license_private` for a private
|
|
125
|
+
repository or `license` otherwise; else refuse. `none` means no file."""
|
|
126
|
+
chosen = spec or (config_private if private and config_private else config_license)
|
|
127
|
+
if not chosen:
|
|
128
|
+
raise LicenseError("no licence named: pass --license <id>, --license file=<path> or --license none, "
|
|
129
|
+
"or set `license` (and `license_private`) in ~/.repokit/config.json; "
|
|
130
|
+
f"the catalogue has: {', '.join(known())}")
|
|
131
|
+
chosen = chosen.strip()
|
|
132
|
+
if chosen.lower() == "none":
|
|
133
|
+
return ("none", None)
|
|
134
|
+
if chosen.lower().startswith("file="):
|
|
135
|
+
path = chosen[5:].strip()
|
|
136
|
+
if not Path(path).is_file():
|
|
137
|
+
raise LicenseError(f"licence file not found: {path}")
|
|
138
|
+
return ("file", path)
|
|
139
|
+
lid = normalise(chosen)
|
|
140
|
+
if lid not in known():
|
|
141
|
+
raise LicenseError(f"unknown licence {chosen!r}; the catalogue has: {', '.join(known())}; or --license file=<path>")
|
|
142
|
+
return ("catalogue", lid)
|