diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..7e32fa1 Binary files /dev/null and b/.DS_Store differ diff --git a/images/.DS_Store b/images/.DS_Store new file mode 100644 index 0000000..b801563 Binary files /dev/null and b/images/.DS_Store differ diff --git a/make-json.sh b/make-json.sh new file mode 100644 index 0000000..d3d65e3 --- /dev/null +++ b/make-json.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +TOKEN="578edf8a8328fb37d6c32f56eb1450622db3492a" +BASE="https://git.sunamura-llc.com" +OWNER="openRepo" +REPO="AI-ART" +BRANCH="main" + +OUT="manifest.json" + +images_json=$(curl -s \ + -H "Authorization: token ${TOKEN}" \ + "${BASE}/api/v1/repos/${OWNER}/${REPO}/contents/images") + +echo "{ + \"repo\": \"${OWNER}/${REPO}\", + \"branch\": \"${BRANCH}\", + \"readme\": \"${BASE}/${OWNER}/${REPO}/raw/branch/${BRANCH}/README.md\", + \"task_template\": \"${BASE}/${OWNER}/${REPO}/raw/branch/${BRANCH}/prompts/task_template.md\", + \"rules\": \"${BASE}/${OWNER}/${REPO}/raw/branch/${BRANCH}/.cursorrules\", + \"images\": $(echo "$images_json" | jq '[.[] | {name: .name, url: .download_url}]') +}" > "${OUT}" + +echo "✔ manifest.json generated" diff --git a/maker.sh b/maker.sh new file mode 100755 index 0000000..d682b50 --- /dev/null +++ b/maker.sh @@ -0,0 +1,58 @@ +mkdir -p tools +cat > tools/gen_manifest.sh <<'EOF' +#!/usr/bin/env bash +set -euo pipefail + +BASE="${GITEA_BASE:-https://git.sunamura-llc.com}" +OWNER="${GITEA_OWNER:-openRepo}" +REPO="${GITEA_REPO:-AI-ART}" +BRANCH="${GITEA_BRANCH:-main}" + +OUT="${OUT:-manifest.json}" +TOKEN="${GITEA_TOKEN:-}" + +command -v curl >/dev/null 2>&1 || { echo "ERROR: curl not found"; exit 1; } +command -v jq >/dev/null 2>&1 || { echo "ERROR: jq not found (mac: brew install jq)"; exit 1; } + +if [[ -z "$TOKEN" ]]; then + echo "ERROR: GITEA_TOKEN is empty" + echo "例: export GITEA_TOKEN='xxxxx'" + exit 1 +fi + +API="${BASE}/api/v1" +AUTH_HEADER="Authorization: token ${TOKEN}" + +images_json="$(curl -sS -H "$AUTH_HEADER" \ + "${API}/repos/${OWNER}/${REPO}/contents/images" \ + || true)" + +images_array="$(echo "$images_json" | jq -c ' + if type=="array" then + [.[] | select(.type=="file") | {name: .name, path: .path, url: .download_url}] + else + [] + end +')" + +cat > "$OUT" </dev/null 2>&1 || { echo "ERROR: curl not found"; exit 1; } +command -v jq >/dev/null 2>&1 || { echo "ERROR: jq not found (mac: brew install jq)"; exit 1; } + +if [[ -z "$TOKEN" ]]; then + echo "ERROR: GITEA_TOKEN is empty" + echo "例: export GITEA_TOKEN='xxxxx'" + exit 1 +fi + +API="${BASE}/api/v1" +AUTH_HEADER="Authorization: token ${TOKEN}" + +images_json="$(curl -sS -H "$AUTH_HEADER" \ + "${API}/repos/${OWNER}/${REPO}/contents/images" \ + || true)" + +images_array="$(echo "$images_json" | jq -c ' + if type=="array" then + [.[] | select(.type=="file") | {name: .name, path: .path, url: .download_url}] + else + [] + end +')" + +cat > "$OUT" <