Remove the status field in metadata.

This commit is contained in:
ed committed 2026-08-23 22:51:03 -04:00
1 parent a1cad786d4
commit bbba5db7ac
193 files changed
+39 -196

No files matched your search

+2 -1
View File
@@ -10,6 +10,7 @@ python scripts/twitter/tw.py graph --id <snowflake>
python scripts/twitter/tw.py refresh --id <snowflake> --tip
python scripts/twitter/tw.py lift --id <snowflake> --orig
python scripts/twitter/tw.py ocr --id <snowflake>
python scripts/twitter/tw.py publish --id <snowflake>
```
`paths.py` sets vault = two parents above this file, dumps = `../manual_slop/docs/twitter`, scratch = `../Threadwell-ai/scratch`.
@@ -21,7 +22,7 @@ Usual publish path after you like the note:
1. `tw.py graph --id …` — confirm tip vs root.
2. `tw.py refresh --id … --tip` if the dump stored a tip as root.
3. `tw.py lift --id … --orig` — catbox + rewrite `![](https://…)`.
4. You set `draft: false` and commit.
4. `tw.py publish --id …` sets `draft: false`. You commit.
Site wikilinks must be `[[archive/threads/<handle>/<date-slug>]]`. Short `[[slug]]` 404s.
-2
View File
@@ -319,7 +319,6 @@ def ensure_handle_index(vault: Path, handle: str, dir_name: str) -> None:
"---\n"
f"title: {handle}\n"
"type: note\n"
"status: published\n"
"draft: false\n"
f"description: Archived threads by {handle}.\n"
"tags:\n"
@@ -347,7 +346,6 @@ def ensure_threads_index(vault: Path, handle: str) -> None:
"---\n"
"title: Threads\n"
"type: note\n"
"status: published\n"
"draft: false\n"
"description: Archived Twitter/X threads and similar sequential posts.\n"
"tags:\n"
-1
View File
@@ -56,7 +56,6 @@ def _frontmatter(
f"post_id: {_yaml_quote(post_id)}",
f"date: {date}",
f"archived: {archived}",
"status: draft",
"draft: true",
"tags:",
" - archive",
+36 -2
View File
@@ -9,7 +9,8 @@ From the vault root:
python scripts/twitter/tw.py locate --id 1692565070583136348
refresh = refetch + emit --force (--tip uses the --id as tip).
Does not commit. Does not flip draft. Never prints cookies or userhash.
publish = draft: false on the thread index (the only switch).
Does not commit. Never prints cookies or userhash.
"""
from __future__ import annotations
@@ -250,10 +251,41 @@ def cmd_refresh(post_id: str, tip: bool, slug: str | None) -> int:
return 0
def cmd_publish(post_id: str) -> int:
_assets, notes = locate(post_id)
if notes is None:
raise SystemExit(f"no vault thread for {post_id}")
path = notes / "index.md"
if not path.is_file():
raise SystemExit(f"missing {path}")
text = path.read_text(encoding="utf-8")
new = text
new = new.replace("draft: true", "draft: false")
new = new.replace("status: draft", "status: published")
if "draft: false" not in new:
raise SystemExit(f"no draft field in {path}")
if new == text:
print(f"already published {path}")
return 0
path.write_text(new, encoding="utf-8", newline="\n")
print(f"draft: false -> {path}")
return 0
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
sub = parser.add_subparsers(dest="cmd", required=True)
for name in ("locate", "graph", "refetch", "emit", "lift", "ocr", "merge", "refresh"):
for name in (
"locate",
"graph",
"refetch",
"emit",
"lift",
"ocr",
"merge",
"refresh",
"publish",
):
p = sub.add_parser(name)
p.add_argument("--id", required=True)
if name in ("emit", "refresh"):
@@ -285,6 +317,8 @@ def main(argv: list[str] | None = None) -> int:
return cmd_merge(post_id)
if args.cmd == "refresh":
return cmd_refresh(post_id, tip=args.tip, slug=args.slug)
if args.cmd == "publish":
return cmd_publish(post_id)
raise SystemExit(f"unknown {args.cmd}")