Merge pull request '發佈 jsc-gitea 0.0.6:wiki 頁型新增 DELIVER' (#10) from develop into master
Reviewed-on: #10 Reviewed-by: 系統管理員 <1+admin@noreply.localhost>
This commit was merged in pull request #10.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jsc-gitea",
|
"name": "jsc-gitea",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"description": "Gitea API 工具、Wiki 讀寫與存取庫批次同步",
|
"description": "Gitea API 工具、Wiki 讀寫與存取庫批次同步",
|
||||||
"skills": "./skills",
|
"skills": "./skills",
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jsc-gitea",
|
"name": "jsc-gitea",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"description": "Gitea API 工具、Wiki 讀寫與存取庫批次同步",
|
"description": "Gitea API 工具、Wiki 讀寫與存取庫批次同步",
|
||||||
"skills": "./skills"
|
"skills": "./skills"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ gitea.sh repos <owner> # 列出 owner 的 repo 全名
|
|||||||
gitea.sh default-branch <owner>/<repo>
|
gitea.sh default-branch <owner>/<repo>
|
||||||
gitea.sh clone-url <owner>/<repo>
|
gitea.sh clone-url <owner>/<repo>
|
||||||
gitea.sh hash-id <text> # 產生 8 碼大寫 SHA-1;首碼 0-9/A/B/C 時改成 Hxxxxxxx
|
gitea.sh hash-id <text> # 產生 8 碼大寫 SHA-1;首碼 0-9/A/B/C 時改成 Hxxxxxxx
|
||||||
gitea.sh wiki-repo <TYPE> # 解析頁面類型的 wiki 位置(TYPE = QUESTION / PLAN / ANALYZE / MAINTAIN / REPO / LOG / LEARN / ERROR)
|
gitea.sh wiki-repo <TYPE> # 解析頁面類型的 wiki 位置(TYPE = QUESTION / PLAN / ANALYZE / DELIVER / MAINTAIN / REPO / LOG / LEARN / ERROR)
|
||||||
gitea.sh wiki-list <owner>/<repo>
|
gitea.sh wiki-list <owner>/<repo>
|
||||||
gitea.sh wiki-get <owner>/<repo> <page> # 不存在 exit 4
|
gitea.sh wiki-get <owner>/<repo> <page> # 不存在 exit 4
|
||||||
gitea.sh wiki-put <owner>/<repo> <page> <file> # 自動判斷新建或更新
|
gitea.sh wiki-put <owner>/<repo> <page> <file> # 自動判斷新建或更新
|
||||||
@@ -44,7 +44,7 @@ check-wiki-rules.sh # 驗證 wiki repo 解析與 ha
|
|||||||
|
|
||||||
### `wiki`
|
### `wiki`
|
||||||
|
|
||||||
Gitea wiki 頁讀寫的統一入口:依頁面類型(QUESTION / PLAN / ANALYZE / MAINTAIN / REPO / LOG / LEARN / ERROR)解析 wiki 所在的 `{owner}/{repo}`,先讀對應的 `JSC_WIKI_REPO_{TYPE}`,再退回 `JSC_WIKI_REPO`,不同類型不可互相代用。頁面內容以圖表優先(mermaid 圖、markdown 表格),純文字為最後手段。
|
Gitea wiki 頁讀寫的統一入口:依頁面類型(QUESTION / PLAN / ANALYZE / DELIVER / MAINTAIN / REPO / LOG / LEARN / ERROR)解析 wiki 所在的 `{owner}/{repo}`,先讀對應的 `JSC_WIKI_REPO_{TYPE}`,再退回 `JSC_WIKI_REPO`,不同類型不可互相代用。頁面內容以圖表優先(mermaid 圖、markdown 表格),純文字為最後手段。
|
||||||
|
|
||||||
### `repo-sync`
|
### `repo-sync`
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ Gitea wiki 頁讀寫的統一入口:依頁面類型(QUESTION / PLAN / ANALYZ
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `GITEA_HOST` | Gitea 站台(可省略 scheme,預設 https) | 詢問使用者 |
|
| `GITEA_HOST` | Gitea 站台(可省略 scheme,預設 https) | 詢問使用者 |
|
||||||
| `GITEA_TOKEN` | Gitea API token;缺少或遇 401/403 時自動退回 tea CLI 登入 token | 詢問使用者 |
|
| `GITEA_TOKEN` | Gitea API token;缺少或遇 401/403 時自動退回 tea CLI 登入 token | 詢問使用者 |
|
||||||
| `JSC_WIKI_REPO_{TYPE}` | 各類型 wiki 頁的 `{owner}/{repo}`;TYPE = QUESTION / PLAN / ANALYZE / MAINTAIN / REPO / LOG / LEARN / ERROR | 退回 `JSC_WIKI_REPO`,不做跨類型代用 |
|
| `JSC_WIKI_REPO_{TYPE}` | 各類型 wiki 頁的 `{owner}/{repo}`;TYPE = QUESTION / PLAN / ANALYZE / DELIVER / MAINTAIN / REPO / LOG / LEARN / ERROR | 退回 `JSC_WIKI_REPO`,不做跨類型代用 |
|
||||||
| `JSC_WIKI_REPO` | 共用預設的 wiki `{owner}/{repo}` | 詢問使用者 |
|
| `JSC_WIKI_REPO` | 共用預設的 wiki `{owner}/{repo}` | 詢問使用者 |
|
||||||
|
|
||||||
## Hash 規則
|
## Hash 規則
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jsc-gitea",
|
"name": "jsc-gitea",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"description": "Gitea API 工具、Wiki 讀寫與存取庫批次同步",
|
"description": "Gitea API 工具、Wiki 讀寫與存取庫批次同步",
|
||||||
"skills": "./skills/"
|
"skills": "./skills/"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ Every wiki operation in the jsc skill set goes through this skill. One entry poi
|
|||||||
|
|
||||||
## Resolve the wiki location
|
## Resolve the wiki location
|
||||||
|
|
||||||
Different page types can live in different `{owner}/{repo}` repos, classified by page-name prefix: `QUESTION`, `PLAN`, `ANALYZE`, `MAINTAIN`, `REPO`, `LOG`, `LEARN`, `ERROR`.
|
Different page types can live in different `{owner}/{repo}` repos, classified by page-name prefix: `QUESTION`, `PLAN`, `ANALYZE`, `DELIVER`, `MAINTAIN`, `REPO`, `LOG`, `LEARN`, `ERROR`.
|
||||||
|
|
||||||
1. Before asking the user, inspect the current shell environment for the needed repo variables and Gitea connection variables: `JSC_WIKI_REPO_{TYPE}`, `JSC_WIKI_REPO`, `GITEA_HOST`, and `GITEA_TOKEN` (also check `tea login list` for a usable login token when `GITEA_TOKEN` is unset). Use inherited shell values first; only ask when the needed repo or connection value cannot be resolved after that check. `GITEA_HOST` and `GITEA_TOKEN` are both covered by this ask-if-unresolvable rule, the same as the wiki-repo variables below.
|
1. Before asking the user, inspect the current shell environment for the needed repo variables and Gitea connection variables: `JSC_WIKI_REPO_{TYPE}`, `JSC_WIKI_REPO`, `GITEA_HOST`, and `GITEA_TOKEN` (also check `tea login list` for a usable login token when `GITEA_TOKEN` is unset). Use inherited shell values first; only ask when the needed repo or connection value cannot be resolved after that check. `GITEA_HOST` and `GITEA_TOKEN` are both covered by this ask-if-unresolvable rule, the same as the wiki-repo variables below.
|
||||||
2. Run `tools/gitea.sh wiki-repo {TYPE}` (TYPE = the page-name prefix). Allowed types are `QUESTION`, `PLAN`, `ANALYZE`, `MAINTAIN`, `REPO`, `LOG`, `LEARN`, and `ERROR`. Resolution order is `JSC_WIKI_REPO_{TYPE}` first, then `JSC_WIKI_REPO`. Never borrow another type's repo.
|
2. Run `tools/gitea.sh wiki-repo {TYPE}` (TYPE = the page-name prefix). Allowed types are `QUESTION`, `PLAN`, `ANALYZE`, `DELIVER`, `MAINTAIN`, `REPO`, `LOG`, `LEARN`, and `ERROR`. Resolution order is `JSC_WIKI_REPO_{TYPE}` first, then `JSC_WIKI_REPO`. Never borrow another type's repo.
|
||||||
3. On exit 3 (neither is set after env inspection), ask the user for that page type's `{owner}/{repo}` per the `jsc-ask:ask` rules, and suggest setting `JSC_WIKI_REPO_{TYPE}` (can differ per type) or `JSC_WIKI_REPO` (shared default).
|
3. On exit 3 (neither is set after env inspection), ask the user for that page type's `{owner}/{repo}` per the `jsc-ask:ask` rules, and suggest setting `JSC_WIKI_REPO_{TYPE}` (can differ per type) or `JSC_WIKI_REPO` (shared default).
|
||||||
|
|
||||||
## Operations
|
## Operations
|
||||||
|
|||||||
@@ -60,6 +60,14 @@ check_repo LEARN 'LEARN falls back to shared only' 'shared/wiki' \
|
|||||||
JSC_WIKI_REPO_LOG='records/LOG' \
|
JSC_WIKI_REPO_LOG='records/LOG' \
|
||||||
JSC_WIKI_REPO='shared/wiki'
|
JSC_WIKI_REPO='shared/wiki'
|
||||||
|
|
||||||
|
check_repo DELIVER 'DELIVER specific wins' 'handover/DELIVER' \
|
||||||
|
JSC_WIKI_REPO_DELIVER='handover/DELIVER' \
|
||||||
|
JSC_WIKI_REPO='shared/wiki'
|
||||||
|
|
||||||
|
check_repo DELIVER 'DELIVER falls back to shared only' 'shared/wiki' \
|
||||||
|
JSC_WIKI_REPO_ANALYZE='knowledges/ANALYZE' \
|
||||||
|
JSC_WIKI_REPO='shared/wiki'
|
||||||
|
|
||||||
check_repo ERROR 'ERROR uses its own repo' 'errors/wiki' \
|
check_repo ERROR 'ERROR uses its own repo' 'errors/wiki' \
|
||||||
JSC_WIKI_REPO_ERROR='errors/wiki' \
|
JSC_WIKI_REPO_ERROR='errors/wiki' \
|
||||||
JSC_WIKI_REPO='shared/wiki'
|
JSC_WIKI_REPO='shared/wiki'
|
||||||
|
|||||||
+2
-2
@@ -7,7 +7,7 @@
|
|||||||
# gitea.sh clone-url <owner>/<repo> # 印出 clone URL
|
# gitea.sh clone-url <owner>/<repo> # 印出 clone URL
|
||||||
# gitea.sh hash-id <text> # 產生 8 碼大寫 SHA-1 hash;首碼為 0-9/A/B/C 時改成 Hxxxxxxx
|
# gitea.sh hash-id <text> # 產生 8 碼大寫 SHA-1 hash;首碼為 0-9/A/B/C 時改成 Hxxxxxxx
|
||||||
# gitea.sh wiki-repo <TYPE> # 解析頁面類型的 wiki 位置:
|
# gitea.sh wiki-repo <TYPE> # 解析頁面類型的 wiki 位置:
|
||||||
# TYPE = QUESTION|PLAN|ANALYZE|MAINTAIN|REPO|LOG|LEARN|ERROR(即頁名前綴)
|
# TYPE = QUESTION|PLAN|ANALYZE|DELIVER|MAINTAIN|REPO|LOG|LEARN|ERROR(即頁名前綴)
|
||||||
# 依序取 JSC_WIKI_REPO_{TYPE} > JSC_WIKI_REPO;不得跨類型代用;都未設定 exit 3
|
# 依序取 JSC_WIKI_REPO_{TYPE} > JSC_WIKI_REPO;不得跨類型代用;都未設定 exit 3
|
||||||
# gitea.sh wiki-list <owner>/<repo> # 列出 wiki 頁名
|
# gitea.sh wiki-list <owner>/<repo> # 列出 wiki 頁名
|
||||||
# gitea.sh wiki-get <owner>/<repo> <page> # 印出 wiki 頁 markdown;不存在時 exit 4
|
# gitea.sh wiki-get <owner>/<repo> <page> # 印出 wiki 頁 markdown;不存在時 exit 4
|
||||||
@@ -27,7 +27,7 @@ script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|||||||
resolve_wiki_repo() { # TYPE -> JSC_WIKI_REPO_{TYPE} -> JSC_WIKI_REPO
|
resolve_wiki_repo() { # TYPE -> JSC_WIKI_REPO_{TYPE} -> JSC_WIKI_REPO
|
||||||
type=$(printf '%s' "${1:?TYPE required}" | tr a-z A-Z)
|
type=$(printf '%s' "${1:?TYPE required}" | tr a-z A-Z)
|
||||||
case "$type" in
|
case "$type" in
|
||||||
QUESTION|PLAN|ANALYZE|MAINTAIN|REPO|LOG|LEARN|ERROR) ;;
|
QUESTION|PLAN|ANALYZE|DELIVER|MAINTAIN|REPO|LOG|LEARN|ERROR) ;;
|
||||||
*) echo "unknown wiki type: $type" >&2; exit 2 ;;
|
*) echo "unknown wiki type: $type" >&2; exit 2 ;;
|
||||||
esac
|
esac
|
||||||
eval "v=\${JSC_WIKI_REPO_${type}:-}"
|
eval "v=\${JSC_WIKI_REPO_${type}:-}"
|
||||||
|
|||||||
Reference in New Issue
Block a user