@tikomni/skills 1.0.2 → 1.0.3
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tikomni/skills",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "TikOmni skill installer CLI for structured social media crawling in Codex, Claude Code, and OpenClaw",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/mark-ly-wang/TikOmni-Skills#readme",
|
|
@@ -26,14 +26,15 @@ def slugify_token(value: Any, fallback: str = "unknown") -> str:
|
|
|
26
26
|
return text or fallback
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
def cardify_token(value: Any, fallback: str = "unknown") -> str:
|
|
29
|
+
def cardify_token(value: Any, fallback: str = "unknown", keep_trailing_dash: bool = False) -> str:
|
|
30
30
|
text = str(value or "").strip()
|
|
31
31
|
if not text:
|
|
32
32
|
text = fallback
|
|
33
33
|
text = _INVALID_FILENAME_CHARS.sub("-", text)
|
|
34
34
|
text = _SPACE_RUN.sub("", text)
|
|
35
35
|
text = _CARD_TOKEN_INVALID_CHARS.sub("", text)
|
|
36
|
-
text = re.sub(r"-{2,}", "-", text)
|
|
36
|
+
text = re.sub(r"-{2,}", "-", text)
|
|
37
|
+
text = text.strip("_.") if keep_trailing_dash else text.strip("-_.")
|
|
37
38
|
return text or fallback
|
|
38
39
|
|
|
39
40
|
|
|
@@ -85,7 +86,10 @@ def render_card_filename(
|
|
|
85
86
|
default_filename: str,
|
|
86
87
|
default_ext: str,
|
|
87
88
|
) -> str:
|
|
88
|
-
safe_context = {
|
|
89
|
+
safe_context = {
|
|
90
|
+
key: cardify_token(value, fallback="", keep_trailing_dash=(key == "identifier"))
|
|
91
|
+
for key, value in context.items()
|
|
92
|
+
}
|
|
89
93
|
safe_context["ext"] = default_ext
|
|
90
94
|
try:
|
|
91
95
|
rendered = str(pattern).format(**safe_context).strip()
|
|
@@ -159,10 +163,15 @@ def build_card_identifier(
|
|
|
159
163
|
return f"{published_token}-{title_token}"
|
|
160
164
|
if title_token:
|
|
161
165
|
return title_token
|
|
166
|
+
work_id_token = cardify_token(platform_work_id, fallback="")
|
|
167
|
+
if published_token and work_id_token:
|
|
168
|
+
return f"{published_token}-{work_id_token}"
|
|
169
|
+
if work_id_token:
|
|
170
|
+
return work_id_token
|
|
171
|
+
if published_token:
|
|
172
|
+
return f"{published_token}-"
|
|
162
173
|
fallback_token = cardify_token(fallback_identifier, fallback="")
|
|
163
|
-
|
|
164
|
-
return f"{published_token}-{fallback_token}"
|
|
165
|
-
return fallback_token or slugify_token(platform_work_id, fallback="unknown")
|
|
174
|
+
return fallback_token or "unknown"
|
|
166
175
|
|
|
167
176
|
|
|
168
177
|
def resolve_card_route_parts(
|
|
@@ -381,7 +381,7 @@ def write_work_fact_card(
|
|
|
381
381
|
card = build_work_fact_card(payload, platform=platform)
|
|
382
382
|
published_date = card["published_date"] or _resolve_published_date(payload)
|
|
383
383
|
resolved_card_root = resolve_card_root(storage_config, explicit_card_root=card_root)
|
|
384
|
-
fallback_identifier =
|
|
384
|
+
fallback_identifier = ""
|
|
385
385
|
paths = build_work_fact_card_paths(
|
|
386
386
|
card_root=resolved_card_root,
|
|
387
387
|
platform=card["platform"],
|