Skip to content

Commit e330159

Browse files
committed
minor fixes
1 parent 2a67cd2 commit e330159

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

platform-integrations/claude/plugins/evolve-lite/lib/entity_io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def unique_filename(directory, slug):
126126
# Markdown <-> dict conversion
127127
# ---------------------------------------------------------------------------
128128

129-
_FRONTMATTER_KEYS = ("type", "trigger", "trajectory", "owner", "visibility", "published_at")
129+
_FRONTMATTER_KEYS = ("type", "trigger", "trajectory", "owner", "visibility", "published_at", "source")
130130

131131

132132
def entity_to_markdown(entity):

platform-integrations/claude/plugins/evolve-lite/skills/publish/scripts/publish.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,40 @@
11
#!/usr/bin/env python3
22
"""Publish a private guideline entity to the public directory.
33
4-
- Reads source from .evolve/entities/guideline/{filename}
5-
- Copies to .evolve/public/guideline/{filename}
4+
- Moves source from .evolve/entities/guideline/{filename}
5+
- to .evolve/public/guideline/{filename}
66
- Updates frontmatter: visibility=public, owner={user}, published_at={now}
77
- Appends to audit.log
88
"""
99

1010
import argparse
1111
import datetime
1212
import os
13+
import re
1314
import sys
1415
from pathlib import Path
1516

1617
# Add lib to path
1718
sys.path.insert(0, str(Path(__file__).resolve().parent.parent.parent.parent / "lib"))
1819
from entity_io import markdown_to_entity, entity_to_markdown
1920
from audit import append as audit_append
21+
from config import load_config
22+
23+
24+
def _resolve_source(cfg, user_arg):
25+
"""Derive a source label from config or fallback to user arg."""
26+
remote = cfg.get("public_repo", {})
27+
if isinstance(remote, dict):
28+
remote = remote.get("remote", "")
29+
if remote:
30+
# Extract user/repo from SSH or HTTPS remote URLs
31+
m = re.search(r"[:/]([^/:]+/[^/]+?)(?:\.git)?$", remote)
32+
if m:
33+
return m.group(1)
34+
identity = cfg.get("identity", {})
35+
if isinstance(identity, dict) and identity.get("user"):
36+
return identity["user"]
37+
return user_arg
2038

2139

2240
def main():
@@ -46,6 +64,10 @@ def main():
4664
if args.user:
4765
entity["owner"] = args.user
4866
entity["published_at"] = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
67+
cfg = load_config(str(evolve_dir.resolve().parent))
68+
source = _resolve_source(cfg, args.user)
69+
if source:
70+
entity["source"] = source
4971

5072
# Write to public directory
5173
dest_dir = evolve_dir / "public" / "guideline"
@@ -58,6 +80,7 @@ def main():
5880

5981
content = entity_to_markdown(entity)
6082
dest_path.write_text(content, encoding="utf-8")
83+
src_path.unlink()
6184

6285
# Audit log
6386
audit_append(

0 commit comments

Comments
 (0)