Merge branch 'main' into machine-id-option

This commit is contained in:
pinpox
2025-06-24 11:12:24 +00:00
4 changed files with 59 additions and 11 deletions

View File

@@ -393,6 +393,12 @@ in
options.name = lib.mkOption { options.name = lib.mkOption {
type = types.str; type = types.str;
default = name; default = name;
defaultText = "<Name of the Instance>";
description = ''
Attribute of the clan service module imported from the chosen input.
Defaults to the name of the instance.
'';
}; };
}; };
default = { }; default = { };

View File

@@ -204,9 +204,51 @@ def get_latest_commit_info() -> tuple[str, str]:
return title, body return title, body
def get_commits_since_main() -> list[tuple[str, str]]:
"""Get all commits since main as (title, body) tuples."""
exit_code, commit_log, error = run_git_command(
[
"git",
"log",
"main..HEAD",
"--no-merges",
"--pretty=format:%s|%b|---END---",
]
)
if exit_code != 0:
print(f"Error getting commits since main: {error}")
return []
if not commit_log:
return []
commits = []
commit_messages = commit_log.split("---END---")
for commit_msg in commit_messages:
commit_msg = commit_msg.strip()
if not commit_msg:
continue
parts = commit_msg.split("|")
if len(parts) < 2:
continue
title = parts[0].strip()
body = parts[1].strip() if len(parts) > 1 else ""
if not title:
continue
commits.append((title, body))
return commits
def open_editor_for_pr() -> tuple[str, str]: def open_editor_for_pr() -> tuple[str, str]:
"""Open editor to get PR title and description. First line is title, rest is description.""" """Open editor to get PR title and description. First line is title, rest is description."""
commit_title, commit_body = get_latest_commit_info() commits_since_main = get_commits_since_main()
with tempfile.NamedTemporaryFile( with tempfile.NamedTemporaryFile(
mode="w+", suffix="COMMIT_EDITMSG", delete=False mode="w+", suffix="COMMIT_EDITMSG", delete=False
@@ -217,14 +259,14 @@ def open_editor_for_pr() -> tuple[str, str]:
temp_file.write("# The first line will be used as the PR title.\n") temp_file.write("# The first line will be used as the PR title.\n")
temp_file.write("# Everything else will be used as the PR description.\n") temp_file.write("# Everything else will be used as the PR description.\n")
temp_file.write("#\n") temp_file.write("#\n")
temp_file.write("# Current commit information:\n") temp_file.write("# All commits since main:\n")
temp_file.write("#\n") temp_file.write("#\n")
if commit_title: for i, (title, body) in enumerate(commits_since_main, 1):
temp_file.write(f"# {commit_title}\n") temp_file.write(f"# Commit {i}:\n")
temp_file.write("#\n") temp_file.write(f"# {title}\n")
if commit_body: if body:
for line in commit_body.split("\n"): for line in body.split("\n"):
temp_file.write(f"# {line}\n") temp_file.write(f"# {line}\n")
temp_file.write("#\n") temp_file.write("#\n")
temp_file.flush() temp_file.flush()
temp_file_path = temp_file.name temp_file_path = temp_file.name

View File

@@ -44,7 +44,7 @@
"prettier": "^3.2.5", "prettier": "^3.2.5",
"solid-devtools": "^0.34.0", "solid-devtools": "^0.34.0",
"storybook": "^9.0.8", "storybook": "^9.0.8",
"tailwindcss": "^3.4.3", "tailwindcss": "^4.0.0",
"typescript": "^5.4.5", "typescript": "^5.4.5",
"typescript-eslint": "^8.32.1", "typescript-eslint": "^8.32.1",
"vite": "^6.3.5", "vite": "^6.3.5",

View File

@@ -15,12 +15,12 @@ class Unknown:
pass pass
InventoryInstanceModuleInputType = str
InventoryInstanceModuleNameType = str InventoryInstanceModuleNameType = str
InventoryInstanceModuleInputType = str
class InventoryInstanceModule(TypedDict): class InventoryInstanceModule(TypedDict):
name: str
input: NotRequired[InventoryInstanceModuleInputType] input: NotRequired[InventoryInstanceModuleInputType]
name: NotRequired[InventoryInstanceModuleNameType]