現行紀錄只記「被叫用」,沒有成敗也沒有結束碼。跑完整輪的技能與開場就 中止的技能,在紀錄裡長得一模一樣。 start 由技能用量 hook 順手發,不必改技能文件。end 只能由技能自己在收尾 步驟寫——hook 接在技能工具呼叫上,而實際工作發生在之後的模型輪次,它在 原理上看不到成敗。有 start 沒有配對的 end,就是那一輪中止了。 status 五選一,每支技能各自寫明什麼情況選哪一個。找不到回報腳本就安靜 跳過,回報失敗一律不改變技能自己的結論。
7.5 KiB
name, description
| name | description |
|---|---|
| html-export | Export one Gitea wiki page or issue as a single self-contained HTML file. Parse the link with tools/gitea-link.sh, resolve that kind's layout and style through tools/html-style.sh (kind, then DEFAULT, then the built-in report/minimal), then render with tools/html-render.sh, which puts the markdown through Gitea's own renderer and inlines every asset. A request without a wiki or issue link stops the skill immediately: never guess the repository, the page or the issue number. Use when a page or issue has to leave Gitea as a document; not for choosing which template a kind uses - that is jsc-gitea:html-style. |
html-export — a wiki page or issue becomes one HTML file
The link is the only input. The output is one file that opens anywhere, with no external asset.
Steps
-
Link gate. Run
tools/gitea-link.sh parse {url}. Exit 3, or no link in the request: stop and report it. Exit 2 is a usage error — fix the arguments and call again. Never fall back to the working directory's remote or to a page name the user mentioned in passing. This gate runs first because it stops the whole skill more often than any other check, and it costs no API call. Completion condition:kindiswikiorissue, andrepopluspageorindexare known. -
Host gate. Confirm
GITEA_HOSTholds a value in the current shell; ask for it per thejsc-ask:askrules when it does not.GITEA_TOKENneeds no inventory —tools/gitea.shresolves it, retries once with the tea CLI login token, and exits 7 when neither works. Completion condition:GITEA_HOSTholds a value. -
Run these three tracks at the same time. They are independent, so start them in one batch rather than one after another; only the issue branch of track B waits, and only for track A's
labelsline.- Track A — content. Wiki page:
jsc-gitea:wikiwiki-get {repo} {page}for the markdown, pluswiki-url {repo} {page}for the source URL; route its exit codes by that skill's table (4 = no such page, 7 = the key is invalid, 8 = other API failure), and every one of them stops this skill with the page name in the report. Issue:tools/issue.sh show {repo} {index}, which returns title, labels and body from one API call — never calltitle,bodyandlabels-ofseparately on the same issue. Exit 1 means the issue could not be read: stop and report the issue number; exit 2 is a usage error, so fix the arguments and call again. - Track B — template. Wiki page:
tools/html-style.sh key wiki {page}. Issue:tools/html-style.sh key issue {repo} {index} --labels {the names from track A's labels line}, which spends no extra API call; the labels line arrives before the body, so this track starts well before track A finishes. The script owns both derivation rules — the page-name prefix, and trying each label in order until one is configured. It prints{key}<TAB>{reason}; keep the reason, it is how the report says which prefix or label produced the key. Exit 1 means the labels could not be read: report that first, then continue withISSUE:DEFAULTand say in the report that the template was picked without labels. Exit 2 is a usage error — fix the arguments and call again. Then runtools/html-style.sh get {key}, which always printslayout<TAB>style<TAB>source. Read the third column and report it:projectorglobalmeans the user configured this kind;defaultmeans it fell back to the DEFAULT row;builtinmeans nothing is configured at all andreport/minimalwas used. Fordefaultandbuiltin, tell the user in one line thatjsc-gitea:html-stylecan set this kind's own template. - Track C — destination. Ask per the
jsc-ask:askrules where the file goes, proposing./.jsc/html/{page-or-issue}.html. State the impact scope: a path inside a repository gets committed unless it is ignored.
Completion condition: the markdown and the document title are in hand, exactly one kind key is chosen with the reason that produced it, the layout, style and source are reported, and the user has confirmed one output path.
- Track A — content. Wiki page:
-
Prepare the markdown — this step MUST run as a sub agent. Links are written as
[text](absolute URL), so pages that follow the current rule need no conversion. An older page can still carry a wiki-internal link: turn it into an absolute URL fromwiki-url, because the renderer does not resolve it and it would ship as literal brackets. Strip personal data — an exported file travels further than the page it came from. Leave everything else exactly as written; this step never rewrites the content. Completion condition: every link in the file is[text](absolute URL), and the diff against the source is limited to link conversion and personal-data removal. -
Render:
tools/html-render.sh --markdown {file} --title {title} --layout {layout} --style {style} --source-url {absolute URL} --out {path}. Route every exit code: 0 → the path it printed is the finished file; 1 → Gitea's renderer or the write failed, so report it and stop, with no half-rendered file left behind; 2 → a usage error or a missing markdown file, so fix the arguments and call again; 4 → the layout or style template file is gone, so report which pair was asked for and send the user tojsc-gitea:html-stylerather than editing the configuration by hand. Completion condition: the file exists, and the report names its path, the layout, the style and where that pair came from. -
Record how the run ended. This is the last thing this skill does, and it runs on every path out of the skill — including the ones that stop at step 1. Call
jsc-hooks/tools/report-status.sh skill-end jsc-gitea:html-export {status} {exit code} [detail]{exit code}is the exit code of whatever decided the outcome, and0when nothing failed.{detail}is one short line, no more than 200 characters. If the script is not on this machine, skip this step in silence and finish the run as it stood — missing infrastructure is not a failure, and a reporting call may never change what this skill returns or reports.status When this skill uses it okThe file was rendered and the report names its path, layout, style and source blockedThe host gate of step 2 stopped the run: GITEA_HOSTholds no value and the user gave none, so nothing was read and nothing was renderedfailedThe work started and broke: wiki-getreturned 7 or 8,issue.sh showreturned 1, orhtml-render.shreturned 1, 2 or 4. Nothing usable came outdegradedThe file was rendered, but part of the run did not hold — track B could not read the labels (exit 1) so the template was picked without them, and the export used a template the configuration did not choose abortedThe premise did not hold, so the skill stopped on its own: the request carried no wiki or issue link, or gitea-link.sh parsereturned 3. Also used when the user stops the run at step 3's destination questionCompletion condition: exactly one
skill-endline was recorded for this run, or the script was absent and the run finished without it.
Rules
- One link, one file. Batch export is a loop the caller runs, not something this skill decides on its own.
- The rendered file inlines CSS and scripts on purpose: it is usually sent to someone outside Gitea, and an external asset breaks on their machine.
- The layout and style are never chosen by inspecting the content. The configuration decides, and
jsc-gitea:html-styleowns the configuration.