Remove template version info from CLI, fix Claude user-invocable, cleanup dead code (#2081)

* Remove Template Version and Released from version output

Templates are now bundled with the CLI, so showing them as separate
artifacts with their own version and release date is no longer accurate.
This also removes the GitHub API call that fetched the latest release,
making the version command faster and eliminating a network dependency.

* Remove unused datetime import

* fix: inject user-invocable: true into Claude skill frontmatter

The SkillsIntegration.setup() builds frontmatter manually without
user-invocable. Add post-processing injection in ClaudeIntegration.setup(),
matching the existing pattern for disable-model-invocation.

* refactor: address review feedback

- Factor _inject_user_invocable and _inject_disable_model_invocation
  into a shared _inject_frontmatter_flag(key, value) helper
- Remove unused httpx, ssl, truststore imports and globals
- Remove unused _github_token and _github_auth_headers helpers
- Update setup() docstring to mention user-invocable

* chore: remove httpx and truststore from dependencies

Both are no longer used after removing the GitHub API call from the
version command. Removes from PEP 723 script header and pyproject.toml.

* fix: match EOL detection style in _inject_frontmatter_flag

Handle \r\n, \n, and no-newline cases consistently with
inject_argument_hint's pattern.
This commit is contained in:
Manfred Riem
2026-04-03 10:48:39 -05:00
committed by GitHub
parent 535ddbe0d2
commit e1ab4f0486
3 changed files with 15 additions and 60 deletions

View File

@@ -112,8 +112,8 @@ class ClaudeIntegration(SkillsIntegration):
)
@staticmethod
def _inject_disable_model_invocation(content: str) -> str:
"""Insert ``disable-model-invocation: true`` before the closing ``---``."""
def _inject_frontmatter_flag(content: str, key: str, value: str = "true") -> str:
"""Insert ``key: value`` before the closing ``---`` if not already present."""
lines = content.splitlines(keepends=True)
# Pre-scan: bail out if already present in frontmatter
@@ -125,7 +125,7 @@ class ClaudeIntegration(SkillsIntegration):
if dash_count == 2:
break
continue
if dash_count == 1 and stripped.startswith("disable-model-invocation:"):
if dash_count == 1 and stripped.startswith(f"{key}:"):
return content
# Inject before the closing --- of frontmatter
@@ -137,8 +137,13 @@ class ClaudeIntegration(SkillsIntegration):
if stripped == "---":
dash_count += 1
if dash_count == 2 and not injected:
eol = "\r\n" if line.endswith("\r\n") else "\n"
out.append(f"disable-model-invocation: true{eol}")
if line.endswith("\r\n"):
eol = "\r\n"
elif line.endswith("\n"):
eol = "\n"
else:
eol = ""
out.append(f"{key}: {value}{eol}")
injected = True
out.append(line)
return "".join(out)
@@ -150,7 +155,7 @@ class ClaudeIntegration(SkillsIntegration):
parsed_options: dict[str, Any] | None = None,
**opts: Any,
) -> list[Path]:
"""Install Claude skills, then inject argument-hint and disable-model-invocation."""
"""Install Claude skills, then inject user-invocable, disable-model-invocation, and argument-hint."""
created = super().setup(project_root, manifest, parsed_options, **opts)
# Post-process generated skill files
@@ -168,8 +173,11 @@ class ClaudeIntegration(SkillsIntegration):
content_bytes = path.read_bytes()
content = content_bytes.decode("utf-8")
# Inject user-invocable: true (Claude skills are accessible via /command)
updated = self._inject_frontmatter_flag(content, "user-invocable")
# Inject disable-model-invocation: true (Claude skills run only when invoked)
updated = self._inject_disable_model_invocation(content)
updated = self._inject_frontmatter_flag(updated, "disable-model-invocation")
# Inject argument-hint if available for this skill
skill_dir_name = path.parent.name # e.g. "speckit-plan"