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
repokit/common_kit.py
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
git-repokit-common in a project git-repokit creates.
|
|
4
|
+
|
|
5
|
+
git-repokit-common holds the hooks and tools (version sync, private-content
|
|
6
|
+
checks, test gating) that projects use; git-repokit's part is to put a copy
|
|
7
|
+
in the project and set it up. Nothing here writes a hook itself: the hooks
|
|
8
|
+
come from repokit-common's own install-hooks.sh.
|
|
9
|
+
|
|
10
|
+
The copy is vendored as a git subtree at scripts/repokit-common/, the layout
|
|
11
|
+
the hooks look for first (/create-project, Phase 3).
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
import re
|
|
16
|
+
import shutil
|
|
17
|
+
import subprocess
|
|
18
|
+
import sys
|
|
19
|
+
from typing import Dict, List, Optional, Tuple
|
|
20
|
+
|
|
21
|
+
DEFAULT_URL = "https://github.com/DazzleTools/git-repokit-common.git"
|
|
22
|
+
DEFAULT_REF = "main"
|
|
23
|
+
PREFIX = "scripts/repokit-common"
|
|
24
|
+
|
|
25
|
+
# REPOKIT_COMMON_SOURCE overrides the URL (a local path works); "off" skips
|
|
26
|
+
# vendoring. The test suite uses both so it never reaches the network.
|
|
27
|
+
SOURCE_ENV = "REPOKIT_COMMON_SOURCE"
|
|
28
|
+
|
|
29
|
+
# repokit-common's built-in private branches (hooks/lib.sh); a project whose
|
|
30
|
+
# private branch is not among them must list it in private-branches.
|
|
31
|
+
REPOKIT_COMMON_PRIVATE_BRANCHES = ["local", "private", "feature/*", "feat/*",
|
|
32
|
+
"prototype/*", "experiment/*", "spike/*"]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _git(args: List[str], cwd: str) -> Tuple[int, str]:
|
|
36
|
+
result = subprocess.run(["git"] + args, cwd=cwd, capture_output=True, text=True,
|
|
37
|
+
encoding="utf-8", errors="replace")
|
|
38
|
+
return result.returncode, (result.stdout + result.stderr).strip()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def source(config: Dict) -> Optional[Tuple[str, str]]:
|
|
42
|
+
"""(url, ref) to vendor from, or None when vendoring is switched off."""
|
|
43
|
+
settings = config.get("repokit_common") or {}
|
|
44
|
+
url = os.environ.get(SOURCE_ENV) or settings.get("url") or DEFAULT_URL
|
|
45
|
+
if url.strip().lower() == "off":
|
|
46
|
+
return None
|
|
47
|
+
return url, settings.get("ref") or DEFAULT_REF
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def vendor(repo_root: str, url: str, ref: str) -> Optional[str]:
|
|
51
|
+
"""Add repokit-common at scripts/repokit-common/ as a squashed subtree.
|
|
52
|
+
|
|
53
|
+
Needs a clean tree and at least one commit. The two commits git subtree
|
|
54
|
+
makes are not signed (git builds them with plumbing); git-repokit does not
|
|
55
|
+
rewrite them -- the next steps say how. Returns None or the failure.
|
|
56
|
+
"""
|
|
57
|
+
if os.path.exists(os.path.join(repo_root, PREFIX)):
|
|
58
|
+
return f"{PREFIX} already exists"
|
|
59
|
+
if os.path.isdir(url):
|
|
60
|
+
url = os.path.abspath(url)
|
|
61
|
+
rc, out = _git(["subtree", "add", f"--prefix={PREFIX}", url, ref, "--squash"], repo_root)
|
|
62
|
+
if rc == 0:
|
|
63
|
+
return None
|
|
64
|
+
# A failure midway (Windows' path limit on a deep project directory, a
|
|
65
|
+
# lost connection) leaves what git read into the index and part of the
|
|
66
|
+
# checkout behind; take it back out so the project's first commit is not
|
|
67
|
+
# made of, or refused for, half of repokit-common.
|
|
68
|
+
prefix = os.path.join(repo_root, PREFIX)
|
|
69
|
+
if os.path.exists(prefix):
|
|
70
|
+
_git(["reset", "-q", "--", PREFIX], repo_root)
|
|
71
|
+
target = prefix
|
|
72
|
+
if sys.platform == "win32" and not prefix.startswith("\\\\?\\"):
|
|
73
|
+
target = "\\\\?\\" + os.path.abspath(prefix)
|
|
74
|
+
shutil.rmtree(target, ignore_errors=True)
|
|
75
|
+
return out or "git subtree add failed"
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def find_sh() -> Optional[str]:
|
|
79
|
+
"""The POSIX shell to run install-hooks.sh with.
|
|
80
|
+
|
|
81
|
+
On Windows, Git for Windows' own sh (next to git), never a `bash` found
|
|
82
|
+
on PATH -- that can be WSL's, which would see a different filesystem.
|
|
83
|
+
"""
|
|
84
|
+
if sys.platform == "win32":
|
|
85
|
+
rc, exec_path = _git(["--exec-path"], os.getcwd())
|
|
86
|
+
if rc == 0 and exec_path:
|
|
87
|
+
# <git>/mingw64/libexec/git-core -> <git>/bin/sh.exe
|
|
88
|
+
git_root = os.path.normpath(os.path.join(exec_path.strip(), "..", "..", ".."))
|
|
89
|
+
candidate = os.path.join(git_root, "bin", "sh.exe")
|
|
90
|
+
if os.path.isfile(candidate):
|
|
91
|
+
return candidate
|
|
92
|
+
return shutil.which("sh")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def install_hooks(repo_root: str) -> Optional[str]:
|
|
96
|
+
"""Run the vendored install-hooks.sh. Returns None or the failure."""
|
|
97
|
+
script = os.path.join(repo_root, PREFIX, "install-hooks.sh")
|
|
98
|
+
if not os.path.isfile(script):
|
|
99
|
+
return f"{PREFIX}/install-hooks.sh not found"
|
|
100
|
+
sh = find_sh()
|
|
101
|
+
if not sh:
|
|
102
|
+
return "no POSIX shell (sh) found to run install-hooks.sh"
|
|
103
|
+
result = subprocess.run([sh, f"{PREFIX}/install-hooks.sh"], cwd=repo_root,
|
|
104
|
+
capture_output=True, text=True, encoding="utf-8", errors="replace")
|
|
105
|
+
if result.returncode != 0:
|
|
106
|
+
return (result.stdout + result.stderr).strip() or "install-hooks.sh failed"
|
|
107
|
+
return None
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def private_branch_settings(private_branch: Optional[str], private_paths: List[str]) -> Dict[str, List[str]]:
|
|
111
|
+
"""Settings that make repokit-common's pre-commit guard the private-branch model.
|
|
112
|
+
|
|
113
|
+
private-patterns: the paths git-repokit's own guard protected (literal
|
|
114
|
+
prefixes; repokit-common adds them to its built-in list).
|
|
115
|
+
private-branches: only when the private branch is not one of
|
|
116
|
+
repokit-common's defaults; the setting replaces the list, so the defaults
|
|
117
|
+
are listed too.
|
|
118
|
+
"""
|
|
119
|
+
settings: Dict[str, List[str]] = {}
|
|
120
|
+
if private_paths:
|
|
121
|
+
settings["private-patterns"] = sorted(dict.fromkeys(private_paths))
|
|
122
|
+
if private_branch and private_branch not in REPOKIT_COMMON_PRIVATE_BRANCHES:
|
|
123
|
+
settings["private-branches"] = REPOKIT_COMMON_PRIVATE_BRANCHES + [private_branch]
|
|
124
|
+
return settings
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _toml_list(values: List[str]) -> str:
|
|
128
|
+
return "[" + ", ".join('"' + v.replace("\\", "\\\\").replace('"', '\\"') + '"' for v in values) + "]"
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
_TABLE_HEADER = re.compile(r"^[ \t]*\[[ \t]*tool[ \t]*\.[ \t]*\"?repokit-common\"?[ \t]*\][ \t]*\r?\n", re.MULTILINE)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _merge_into_table(text: str, settings: Dict[str, List[str]]) -> Optional[str]:
|
|
135
|
+
"""Add the keys the existing [tool.repokit-common] table lacks, right after
|
|
136
|
+
its header; a key already present is never overwritten. Returns the new
|
|
137
|
+
text, or None when nothing was missing."""
|
|
138
|
+
header = _TABLE_HEADER.search(text)
|
|
139
|
+
if not header:
|
|
140
|
+
return None
|
|
141
|
+
rest = text[header.end():]
|
|
142
|
+
next_table = re.search(r"^[ \t]*\[", rest, re.MULTILINE) # the table ends at the next header
|
|
143
|
+
table = rest[: next_table.start()] if next_table else rest
|
|
144
|
+
missing = [key for key in settings
|
|
145
|
+
if not re.search(rf"^[ \t]*{re.escape(key)}[ \t]*=", table, re.MULTILINE)]
|
|
146
|
+
if not missing:
|
|
147
|
+
return None
|
|
148
|
+
nl = "\r\n" if "\r\n" in text else "\n"
|
|
149
|
+
lines = "".join(f"{key} = {_toml_list(settings[key])}{nl}" for key in missing)
|
|
150
|
+
return text[: header.end()] + lines + rest
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def write_settings(repo_root: str, settings: Dict[str, List[str]]) -> Optional[str]:
|
|
154
|
+
"""Write [tool.repokit-common] settings; returns the file written, or None.
|
|
155
|
+
|
|
156
|
+
pyproject.toml when the project has one (the table is added, or the keys
|
|
157
|
+
it lacks are merged into the table it has), else .repokit-common.toml
|
|
158
|
+
(created with the header repokit-common requires, or merged the same way).
|
|
159
|
+
A key already present is never overwritten: a code-type layer may ship
|
|
160
|
+
the file with its own version-source, and the private-branch settings go
|
|
161
|
+
in beside it rather than being dropped.
|
|
162
|
+
"""
|
|
163
|
+
if not settings:
|
|
164
|
+
return None
|
|
165
|
+
lines = [f"{key} = {_toml_list(values)}" for key, values in settings.items()]
|
|
166
|
+
body = "[tool.repokit-common]\n" + "\n".join(lines) + "\n"
|
|
167
|
+
|
|
168
|
+
pyproject = os.path.join(repo_root, "pyproject.toml")
|
|
169
|
+
if os.path.isfile(pyproject):
|
|
170
|
+
with open(pyproject, encoding="utf-8", newline="") as f:
|
|
171
|
+
text = f.read()
|
|
172
|
+
if _TABLE_HEADER.search(text):
|
|
173
|
+
merged = _merge_into_table(text, settings)
|
|
174
|
+
if merged is None:
|
|
175
|
+
return None
|
|
176
|
+
with open(pyproject, "w", encoding="utf-8", newline="") as f:
|
|
177
|
+
f.write(merged)
|
|
178
|
+
return "pyproject.toml"
|
|
179
|
+
with open(pyproject, "a", encoding="utf-8") as f:
|
|
180
|
+
f.write(("\n" if text and not text.endswith("\n") else "") + "\n" + body)
|
|
181
|
+
return "pyproject.toml"
|
|
182
|
+
|
|
183
|
+
path = os.path.join(repo_root, ".repokit-common.toml")
|
|
184
|
+
if os.path.exists(path):
|
|
185
|
+
with open(path, encoding="utf-8", newline="") as f:
|
|
186
|
+
text = f.read()
|
|
187
|
+
merged = _merge_into_table(text, settings)
|
|
188
|
+
if merged is None:
|
|
189
|
+
return None
|
|
190
|
+
with open(path, "w", encoding="utf-8", newline="") as f:
|
|
191
|
+
f.write(merged)
|
|
192
|
+
return ".repokit-common.toml"
|
|
193
|
+
with open(path, "w", encoding="utf-8") as f:
|
|
194
|
+
f.write("# Settings for the vendored git-repokit-common hooks and tools\n" + body)
|
|
195
|
+
return ".repokit-common.toml"
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
RESIGN_HINT = (
|
|
199
|
+
"git subtree made two unsigned commits for scripts/repokit-common/. If this\n"
|
|
200
|
+
"repository signs its commits, re-sign them before pushing (see the\n"
|
|
201
|
+
"/create-project skill, Phase 3), or leave them unsigned."
|
|
202
|
+
)
|