@tikomni/skills 1.0.1 → 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",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
- Fact fields for the Markdown card go into frontmatter. Do not emit a separate `## Facts` section.
|
|
43
43
|
- The work-library directory writes only the Markdown card and no extra `.json` sidecar in the same directory.
|
|
44
44
|
- `primary_text` is the text that is best suited for reading and indexing in the current task.
|
|
45
|
+
- `asr_raw` and `subtitle_raw` are internal preserved text fields. Keep them in the normalized card data, but do not render them as standalone sections in the Markdown body.
|
|
45
46
|
- `play_count` may be `null`. Leave it empty when missing, and keep `0` only when the platform explicitly returns `0`.
|
|
46
47
|
- Preferred order for video works:
|
|
47
48
|
- `subtitle_raw`
|
|
@@ -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(
|
|
@@ -359,18 +359,10 @@ def _markdown_lines(card: Dict[str, Any]) -> List[str]:
|
|
|
359
359
|
lines = _frontmatter_lines(card)
|
|
360
360
|
primary_text = _safe_text(card.get("primary_text"))
|
|
361
361
|
caption_raw = _safe_text(card.get("caption_raw"))
|
|
362
|
-
subtitle_raw = _safe_text(card.get("subtitle_raw"))
|
|
363
|
-
asr_raw = _safe_text(card.get("asr_raw"))
|
|
364
362
|
|
|
365
363
|
lines.extend(["", "## 主文本", primary_text or ""])
|
|
366
364
|
if caption_raw and caption_raw != primary_text:
|
|
367
365
|
lines.extend(["", "## 原始文案", caption_raw])
|
|
368
|
-
if asr_raw and subtitle_raw and asr_raw == subtitle_raw and asr_raw != primary_text:
|
|
369
|
-
lines.extend(["", "## 原始转写", asr_raw])
|
|
370
|
-
elif subtitle_raw and subtitle_raw != primary_text:
|
|
371
|
-
lines.extend(["", "## 原始字幕", subtitle_raw])
|
|
372
|
-
if asr_raw and asr_raw not in {primary_text, subtitle_raw}:
|
|
373
|
-
lines.extend(["", "## 原始转写", asr_raw])
|
|
374
366
|
if card.get("missing_fields"):
|
|
375
367
|
lines.extend(["", "## 缺失字段"])
|
|
376
368
|
for entry in card["missing_fields"]:
|
|
@@ -389,7 +381,7 @@ def write_work_fact_card(
|
|
|
389
381
|
card = build_work_fact_card(payload, platform=platform)
|
|
390
382
|
published_date = card["published_date"] or _resolve_published_date(payload)
|
|
391
383
|
resolved_card_root = resolve_card_root(storage_config, explicit_card_root=card_root)
|
|
392
|
-
fallback_identifier =
|
|
384
|
+
fallback_identifier = ""
|
|
393
385
|
paths = build_work_fact_card_paths(
|
|
394
386
|
card_root=resolved_card_root,
|
|
395
387
|
platform=card["platform"],
|