@mokoconsulting/mcp-mokogitea-api 1.2.0

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.
Files changed (86) hide show
  1. package/.gitattributes +94 -0
  2. package/.gitmessage +9 -0
  3. package/.mokogitea/ISSUE_TEMPLATE/adr.md +110 -0
  4. package/.mokogitea/ISSUE_TEMPLATE/bug_report.md +48 -0
  5. package/.mokogitea/ISSUE_TEMPLATE/config.yml +18 -0
  6. package/.mokogitea/ISSUE_TEMPLATE/documentation.md +52 -0
  7. package/.mokogitea/ISSUE_TEMPLATE/enterprise_support.md +85 -0
  8. package/.mokogitea/ISSUE_TEMPLATE/feature_request.md +51 -0
  9. package/.mokogitea/ISSUE_TEMPLATE/firewall-request.md +190 -0
  10. package/.mokogitea/ISSUE_TEMPLATE/mcp_api_integration.md +48 -0
  11. package/.mokogitea/ISSUE_TEMPLATE/mcp_connection_issue.md +67 -0
  12. package/.mokogitea/ISSUE_TEMPLATE/mcp_tool_request.md +49 -0
  13. package/.mokogitea/ISSUE_TEMPLATE/question.md +82 -0
  14. package/.mokogitea/ISSUE_TEMPLATE/rfc.md +126 -0
  15. package/.mokogitea/ISSUE_TEMPLATE/security.md +51 -0
  16. package/.mokogitea/ISSUE_TEMPLATE/version.md +24 -0
  17. package/.mokogitea/auto-assign.yml +76 -0
  18. package/.mokogitea/auto-dev-issue.yml +207 -0
  19. package/.mokogitea/auto-release.yml +337 -0
  20. package/.mokogitea/branch-protection.yml +251 -0
  21. package/.mokogitea/changelog-validation.yml +101 -0
  22. package/.mokogitea/codeql-analysis.yml +115 -0
  23. package/.mokogitea/copilot-agent.yml +44 -0
  24. package/.mokogitea/deploy-demo.yml +734 -0
  25. package/.mokogitea/deploy-dev.yml +700 -0
  26. package/.mokogitea/enterprise-firewall-setup.yml +758 -0
  27. package/.mokogitea/manifest.xml +25 -0
  28. package/.mokogitea/mcp-auto-release.yml +278 -0
  29. package/.mokogitea/mcp-build-test.yml +65 -0
  30. package/.mokogitea/mcp-sdk-check.yml +109 -0
  31. package/.mokogitea/mcp-tool-inventory.yml +61 -0
  32. package/.mokogitea/pr-branch-check.yml +90 -0
  33. package/.mokogitea/repository-cleanup.yml +525 -0
  34. package/.mokogitea/standards-compliance.yml +2614 -0
  35. package/.mokogitea/sync-version-on-merge.yml +133 -0
  36. package/.mokogitea/workflows/auto-assign.yml +76 -0
  37. package/.mokogitea/workflows/auto-bump.yml +66 -0
  38. package/.mokogitea/workflows/auto-dev-issue.yml +207 -0
  39. package/.mokogitea/workflows/auto-release.yml +341 -0
  40. package/.mokogitea/workflows/branch-cleanup.yml +48 -0
  41. package/.mokogitea/workflows/cascade-dev.yml +10 -0
  42. package/.mokogitea/workflows/changelog-validation.yml +101 -0
  43. package/.mokogitea/workflows/ci-generic.yml +204 -0
  44. package/.mokogitea/workflows/cleanup.yml +87 -0
  45. package/.mokogitea/workflows/codeql-analysis.yml +115 -0
  46. package/.mokogitea/workflows/copilot-agent.yml +44 -0
  47. package/.mokogitea/workflows/deploy-manual.yml +126 -0
  48. package/.mokogitea/workflows/enterprise-firewall-setup.yml +758 -0
  49. package/.mokogitea/workflows/gitleaks.yml +96 -0
  50. package/.mokogitea/workflows/issue-branch.yml +73 -0
  51. package/.mokogitea/workflows/mcp-auto-release.yml +280 -0
  52. package/.mokogitea/workflows/mcp-build-test.yml +65 -0
  53. package/.mokogitea/workflows/mcp-sdk-check.yml +109 -0
  54. package/.mokogitea/workflows/mcp-tool-inventory.yml +61 -0
  55. package/.mokogitea/workflows/notify.yml +70 -0
  56. package/.mokogitea/workflows/npm-publish.yml +51 -0
  57. package/.mokogitea/workflows/pr-check.yml +508 -0
  58. package/.mokogitea/workflows/pre-release.yml +11 -0
  59. package/.mokogitea/workflows/repo-health.yml +711 -0
  60. package/.mokogitea/workflows/repository-cleanup.yml +525 -0
  61. package/.mokogitea/workflows/security-audit.yml +82 -0
  62. package/.mokogitea/workflows/standards-compliance.yml +2614 -0
  63. package/.mokogitea/workflows/sync-version-on-merge.yml +130 -0
  64. package/.mokogitea/workflows/update-server.yml +312 -0
  65. package/CHANGELOG.md +145 -0
  66. package/CLAUDE.md +43 -0
  67. package/CONTRIBUTING.md +161 -0
  68. package/README.md +286 -0
  69. package/SECURITY.md +91 -0
  70. package/automation/ci-issue-reporter.sh +237 -0
  71. package/config.example.json +13 -0
  72. package/dist/client.d.ts +15 -0
  73. package/dist/client.js +104 -0
  74. package/dist/config.d.ts +4 -0
  75. package/dist/config.js +48 -0
  76. package/dist/index.d.ts +3 -0
  77. package/dist/index.js +1119 -0
  78. package/dist/types.d.ts +20 -0
  79. package/dist/types.js +16 -0
  80. package/package.json +34 -0
  81. package/scripts/setup.mjs +40 -0
  82. package/src/client.ts +120 -0
  83. package/src/config.ts +58 -0
  84. package/src/index.ts +1712 -0
  85. package/src/types.ts +37 -0
  86. package/tsconfig.json +19 -0
@@ -0,0 +1,133 @@
1
+ # Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
2
+ #
3
+ # This file is part of a Moko Consulting project.
4
+ #
5
+ # SPDX-License-Identifier: GPL-3.0-or-later
6
+ #
7
+ # FILE INFORMATION
8
+ # DEFGROUP: GitHub.Workflow
9
+ # INGROUP: MokoStandards.Automation
10
+ # REPO: https://github.com/mokoconsulting-tech/MokoStandards
11
+ # PATH: /templates/workflows/shared/sync-version-on-merge.yml.template
12
+ # VERSION: 04.06.00
13
+ # BRIEF: Auto-bump patch version on every push to main and propagate to all file headers
14
+ # NOTE: Synced via bulk-repo-sync to .github/workflows/sync-version-on-merge.yml in all governed repos.
15
+ # README.md is the single source of truth for the repository version.
16
+
17
+ name: Sync Version from README
18
+
19
+ on:
20
+ push:
21
+ branches:
22
+ - main
23
+ - master
24
+ workflow_dispatch:
25
+ inputs:
26
+ dry_run:
27
+ description: 'Dry run (preview only, no commit)'
28
+ type: boolean
29
+ default: false
30
+
31
+ permissions:
32
+ contents: write
33
+ issues: write
34
+
35
+ env:
36
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
37
+
38
+ jobs:
39
+ sync-version:
40
+ name: Propagate README version
41
+ runs-on: ubuntu-latest
42
+
43
+ steps:
44
+ - name: Checkout repository
45
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
46
+ with:
47
+ token: ${{ secrets.GH_TOKEN || github.token }}
48
+ fetch-depth: 0
49
+
50
+ - name: Set up PHP
51
+ uses: shivammathur/setup-php@fcafdd6392932010c2bd5094439b8e33be2a8a09 # v2.37.0
52
+ with:
53
+ php-version: '8.1'
54
+ tools: composer
55
+
56
+ - name: Setup MokoStandards tools
57
+ env:
58
+ GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
59
+ COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}'
60
+ run: |
61
+ git clone --depth 1 --branch version/04 --quiet \
62
+ "https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
63
+ /tmp/mokostandards
64
+ cd /tmp/mokostandards
65
+ composer install --no-dev --no-interaction --quiet
66
+
67
+ - name: Auto-bump patch version
68
+ if: ${{ github.event_name == 'push' && github.actor != 'github-actions[bot]' }}
69
+ run: |
70
+ if git diff --name-only HEAD~1 HEAD 2>/dev/null | grep -q '^README\.md$'; then
71
+ echo "README.md changed in this push — skipping auto-bump"
72
+ exit 0
73
+ fi
74
+
75
+ RESULT=$(php /tmp/mokostandards/api/cli/version_bump.php --path .) || {
76
+ echo "⚠️ Could not bump version — skipping"
77
+ exit 0
78
+ }
79
+ echo "Auto-bumping patch: $RESULT"
80
+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
81
+ git config --local user.name "github-actions[bot]"
82
+ git add README.md
83
+ git commit -m "chore(version): auto-bump patch ${RESULT} [skip ci]" \
84
+ --author="github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
85
+ git push
86
+
87
+ - name: Extract version from README.md
88
+ id: readme_version
89
+ run: |
90
+ git pull --ff-only 2>/dev/null || true
91
+ VERSION=$(php /tmp/mokostandards/api/cli/version_read.php --path . 2>/dev/null)
92
+ if [ -z "$VERSION" ]; then
93
+ echo "⚠️ No VERSION in README.md — skipping propagation"
94
+ echo "skip=true" >> $GITHUB_OUTPUT
95
+ exit 0
96
+ fi
97
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
98
+ echo "skip=false" >> $GITHUB_OUTPUT
99
+ echo "✅ README.md version: $VERSION"
100
+
101
+ - name: Run version sync
102
+ if: ${{ steps.readme_version.outputs.skip != 'true' && inputs.dry_run != true }}
103
+ run: |
104
+ php /tmp/mokostandards/api/maintenance/update_version_from_readme.php \
105
+ --path . \
106
+ --create-issue \
107
+ --repo "${{ github.repository }}"
108
+ env:
109
+ GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
110
+
111
+ - name: Commit updated files
112
+ if: ${{ steps.readme_version.outputs.skip != 'true' && inputs.dry_run != true }}
113
+ run: |
114
+ git pull --ff-only 2>/dev/null || true
115
+ if git diff --quiet; then
116
+ echo "ℹ️ No version changes needed — already up to date"
117
+ exit 0
118
+ fi
119
+ VERSION="${{ steps.readme_version.outputs.version }}"
120
+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
121
+ git config --local user.name "github-actions[bot]"
122
+ git add -A
123
+ git commit -m "chore(version): sync badges and headers to ${VERSION} [skip ci]" \
124
+ --author="github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
125
+ git push
126
+
127
+ - name: Summary
128
+ run: |
129
+ VERSION="${{ steps.readme_version.outputs.version }}"
130
+ echo "## 📦 Version Sync — ${VERSION}" >> $GITHUB_STEP_SUMMARY
131
+ echo "" >> $GITHUB_STEP_SUMMARY
132
+ echo "**Source:** \`README.md\` FILE INFORMATION block" >> $GITHUB_STEP_SUMMARY
133
+ echo "**Version:** \`${VERSION}\`" >> $GITHUB_STEP_SUMMARY
@@ -0,0 +1,76 @@
1
+ # Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
2
+ # SPDX-License-Identifier: GPL-3.0-or-later
3
+ #
4
+ # FILE INFORMATION
5
+ # DEFGROUP: GitHub.Workflow
6
+ # INGROUP: MokoStandards.Workflows.Shared
7
+ # REPO: https://github.com/mokoconsulting-tech/MokoStandards
8
+ # PATH: /.mokogitea/workflows/auto-assign.yml
9
+ # VERSION: 04.06.00
10
+ # BRIEF: Auto-assign jmiller to unassigned issues and PRs every 15 minutes
11
+
12
+ name: "Universal: Auto-Assign"
13
+
14
+ on:
15
+ issues:
16
+ types: [opened]
17
+ pull_request_target:
18
+ types: [opened]
19
+ schedule:
20
+ - cron: '0 */12 * * *'
21
+ workflow_dispatch:
22
+
23
+ permissions:
24
+ issues: write
25
+ pull-requests: write
26
+
27
+ jobs:
28
+ auto-assign:
29
+ name: Assign unassigned issues and PRs
30
+ runs-on: ubuntu-latest
31
+
32
+ steps:
33
+ - name: Assign unassigned issues
34
+ env:
35
+ GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
36
+ run: |
37
+ REPO="${{ github.repository }}"
38
+ ASSIGNEE="jmiller"
39
+
40
+ echo "## 🏷️ Auto-Assign Report" >> $GITHUB_STEP_SUMMARY
41
+ echo "" >> $GITHUB_STEP_SUMMARY
42
+
43
+ ASSIGNED_ISSUES=0
44
+ ASSIGNED_PRS=0
45
+
46
+ # Assign unassigned open issues
47
+ ISSUES=$(gh api "repos/$REPO/issues?state=open&per_page=100&assignee=none" --jq '.[].number' 2>/dev/null || true)
48
+ for NUM in $ISSUES; do
49
+ # Skip PRs (the issues endpoint returns PRs too)
50
+ IS_PR=$(gh api "repos/$REPO/issues/$NUM" --jq '.pull_request // empty' 2>/dev/null || true)
51
+ if [ -z "$IS_PR" ]; then
52
+ gh api "repos/$REPO/issues/$NUM/assignees" -X POST -f "assignees[]=$ASSIGNEE" --silent 2>/dev/null && {
53
+ ASSIGNED_ISSUES=$((ASSIGNED_ISSUES + 1))
54
+ echo " Assigned issue #$NUM"
55
+ } || true
56
+ fi
57
+ done
58
+
59
+ # Assign unassigned open PRs
60
+ PRS=$(gh api "repos/$REPO/pulls?state=open&per_page=100" --jq '.[] | select(.assignees | length == 0) | .number' 2>/dev/null || true)
61
+ for NUM in $PRS; do
62
+ gh api "repos/$REPO/issues/$NUM/assignees" -X POST -f "assignees[]=$ASSIGNEE" --silent 2>/dev/null && {
63
+ ASSIGNED_PRS=$((ASSIGNED_PRS + 1))
64
+ echo " Assigned PR #$NUM"
65
+ } || true
66
+ done
67
+
68
+ echo "| Type | Assigned |" >> $GITHUB_STEP_SUMMARY
69
+ echo "|------|----------|" >> $GITHUB_STEP_SUMMARY
70
+ echo "| Issues | $ASSIGNED_ISSUES |" >> $GITHUB_STEP_SUMMARY
71
+ echo "| Pull Requests | $ASSIGNED_PRS |" >> $GITHUB_STEP_SUMMARY
72
+
73
+ if [ "$ASSIGNED_ISSUES" -eq 0 ] && [ "$ASSIGNED_PRS" -eq 0 ]; then
74
+ echo "" >> $GITHUB_STEP_SUMMARY
75
+ echo "✅ All issues and PRs already have assignees" >> $GITHUB_STEP_SUMMARY
76
+ fi
@@ -0,0 +1,66 @@
1
+ # Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
2
+ #
3
+ # SPDX-License-Identifier: GPL-3.0-or-later
4
+ #
5
+ # FILE INFORMATION
6
+ # DEFGROUP: Gitea.Workflow
7
+ # INGROUP: moko-platform.Release
8
+ # REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
9
+ # PATH: /.mokogitea/workflows/auto-bump.yml
10
+ # VERSION: 09.02.00
11
+ # BRIEF: Auto patch-bump version on every push to dev (skips merge commits)
12
+
13
+ name: "Universal: Auto Version Bump"
14
+
15
+ on:
16
+ push:
17
+ branches:
18
+ - dev
19
+ - rc
20
+ - 'feature/**'
21
+ - 'patch/**'
22
+
23
+ env:
24
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
25
+ GITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
26
+
27
+ permissions:
28
+ contents: write
29
+
30
+ jobs:
31
+ bump:
32
+ name: Version Bump
33
+ runs-on: release
34
+ if: >-
35
+ !contains(github.event.head_commit.message, '[skip ci]') &&
36
+ !contains(github.event.head_commit.message, '[skip bump]') &&
37
+ !startsWith(github.event.head_commit.message, 'Merge pull request')
38
+
39
+ steps:
40
+ - name: Checkout
41
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
42
+ with:
43
+ token: ${{ secrets.MOKOGITEA_TOKEN }}
44
+ fetch-depth: 1
45
+
46
+ - name: Setup moko-platform tools
47
+ run: |
48
+ if ! command -v composer &> /dev/null; then
49
+ sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer >/dev/null 2>&1
50
+ fi
51
+ if [ -d "/opt/moko-platform/cli" ]; then
52
+ echo "MOKO_CLI=/opt/moko-platform/cli" >> "$GITHUB_ENV"
53
+ else
54
+ git clone --depth 1 --branch main --quiet \
55
+ "https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/MokoConsulting/moko-platform.git" \
56
+ /tmp/moko-platform-api
57
+ cd /tmp/moko-platform-api && composer install --no-dev --no-interaction --quiet
58
+ echo "MOKO_CLI=/tmp/moko-platform-api/cli" >> "$GITHUB_ENV"
59
+ fi
60
+
61
+ - name: Bump version
62
+ run: |
63
+ php ${MOKO_CLI}/version_auto_bump.php \
64
+ --path . --branch "${GITHUB_REF_NAME}" \
65
+ --token "${{ secrets.MOKOGITEA_TOKEN }}" \
66
+ --repo-url "https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/${{ github.repository }}.git"
@@ -0,0 +1,207 @@
1
+ # Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
2
+ #
3
+ # This file is part of a Moko Consulting project.
4
+ #
5
+ # SPDX-License-Identifier: GPL-3.0-or-later
6
+ #
7
+ # FILE INFORMATION
8
+ # DEFGROUP: GitHub.Workflow
9
+ # INGROUP: MokoStandards.Automation
10
+ # REPO: https://github.com/mokoconsulting-tech/MokoStandards
11
+ # PATH: /templates/workflows/shared/auto-dev-issue.yml.template
12
+ # VERSION: 04.06.00
13
+ # BRIEF: Auto-create tracking issue with sub-issues for dev/rc branch workflow
14
+ # NOTE: Synced via bulk-repo-sync to .mokogitea/workflows/auto-dev-issue.yml in all governed repos.
15
+
16
+ name: "Universal: Dev/RC Branch Issue"
17
+
18
+ on:
19
+ # Auto-create on RC branch creation
20
+ create:
21
+ # Manual trigger for dev branches
22
+ workflow_dispatch:
23
+ inputs:
24
+ branch:
25
+ description: 'Branch name (e.g., dev/my-feature or dev/04.06)'
26
+ required: true
27
+ type: string
28
+
29
+ env:
30
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
31
+
32
+ permissions:
33
+ contents: read
34
+ issues: write
35
+
36
+ jobs:
37
+ create-issue:
38
+ name: Create version tracking issue
39
+ runs-on: ubuntu-latest
40
+ if: >-
41
+ (github.event_name == 'workflow_dispatch') ||
42
+ (github.event.ref_type == 'branch' &&
43
+ (startsWith(github.event.ref, 'rc/') ||
44
+ startsWith(github.event.ref, 'alpha/') ||
45
+ startsWith(github.event.ref, 'beta/')))
46
+
47
+ steps:
48
+ - name: Create tracking issue and sub-issues
49
+ env:
50
+ GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
51
+ run: |
52
+ # For manual dispatch, use input; for auto, use event ref
53
+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
54
+ BRANCH="${{ inputs.branch }}"
55
+ else
56
+ BRANCH="${{ github.event.ref }}"
57
+ fi
58
+ REPO="${{ github.repository }}"
59
+ ACTOR="${{ github.actor }}"
60
+ NOW=$(date -u '+%Y-%m-%d %H:%M UTC')
61
+
62
+ # Determine branch type and version
63
+ if [[ "$BRANCH" == rc/* ]]; then
64
+ VERSION="${BRANCH#rc/}"
65
+ BRANCH_TYPE="Release Candidate"
66
+ LABEL_TYPE="type: release"
67
+ TITLE_PREFIX="rc"
68
+ elif [[ "$BRANCH" == beta/* ]]; then
69
+ VERSION="${BRANCH#beta/}"
70
+ BRANCH_TYPE="Beta"
71
+ LABEL_TYPE="type: release"
72
+ TITLE_PREFIX="beta"
73
+ elif [[ "$BRANCH" == alpha/* ]]; then
74
+ VERSION="${BRANCH#alpha/}"
75
+ BRANCH_TYPE="Alpha"
76
+ LABEL_TYPE="type: release"
77
+ TITLE_PREFIX="alpha"
78
+ else
79
+ VERSION="${BRANCH#dev/}"
80
+ BRANCH_TYPE="Development"
81
+ LABEL_TYPE="type: feature"
82
+ TITLE_PREFIX="feat"
83
+ fi
84
+
85
+ TITLE="${TITLE_PREFIX}(${VERSION}): ${BRANCH_TYPE} tracking for ${BRANCH}"
86
+
87
+ # Check for existing issue with same title prefix
88
+ EXISTING=$(gh api "repos/${REPO}/issues?state=open&per_page=10" \
89
+ --jq ".[] | select(.title | startswith(\"${TITLE_PREFIX}(${VERSION})\")) | .number" 2>/dev/null | head -1)
90
+
91
+ if [ -n "$EXISTING" ]; then
92
+ echo "ℹ️ Issue #${EXISTING} already exists for ${VERSION}" >> $GITHUB_STEP_SUMMARY
93
+ exit 0
94
+ fi
95
+
96
+ # ── Define sub-issues for the workflow ─────────────────────────
97
+ if [[ "$BRANCH" == rc/* ]]; then
98
+ SUB_ISSUES=(
99
+ "RC Testing|Verify all features work on rc branch|type: test,release-candidate"
100
+ "Regression Testing|Run full regression suite before merge|type: test,release-candidate"
101
+ "Version Bump|Bump version in README.md and all headers|type: version,release-candidate"
102
+ "Changelog Update|Update CHANGELOG.md with release notes|documentation,release-candidate"
103
+ "Merge to Version Branch|Create PR to version/XX|type: release,needs-review"
104
+ )
105
+ elif [[ "$BRANCH" == alpha/* ]] || [[ "$BRANCH" == beta/* ]]; then
106
+ SUB_ISSUES=(
107
+ "Testing|Verify features on ${BRANCH_TYPE} branch|type: test,status: in-progress"
108
+ "Bug Fixes|Fix issues found during ${BRANCH_TYPE} testing|type: bug,status: pending"
109
+ "Promote to Next Stage|Create PR to promote to next release stage|type: release,needs-review"
110
+ )
111
+ else
112
+ SUB_ISSUES=(
113
+ "Development|Implement feature/fix on dev branch|type: feature,status: in-progress"
114
+ "Unit Testing|Write and pass unit tests|type: test,status: pending"
115
+ "Code Review|Request and complete code review|needs-review,status: pending"
116
+ "Version Bump|Bump version in README.md and all headers|type: version,status: pending"
117
+ "Changelog Update|Update CHANGELOG.md with release notes|documentation,status: pending"
118
+ "Create RC Branch|Promote dev to rc branch for final testing|type: release,status: pending"
119
+ "Merge to Main|Create PR from rc/dev to main|type: release,needs-review,status: pending"
120
+ )
121
+ fi
122
+
123
+ # ── Create sub-issues first ───────────────────────────────────────
124
+ SUB_LIST=""
125
+ SUB_NUMBERS=""
126
+ for SUB in "${SUB_ISSUES[@]}"; do
127
+ IFS='|' read -r SUB_TITLE SUB_DESC SUB_LABELS <<< "$SUB"
128
+ SUB_FULL_TITLE="${TITLE_PREFIX}(${VERSION}): ${SUB_TITLE}"
129
+
130
+ SUB_BODY=$(printf '### %s\n\n%s\n\n| Field | Value |\n|-------|-------|\n| **Parent Branch** | `%s` |\n| **Version** | `%s` |\n\n---\n*Sub-issue of the %s tracking issue for `%s`.*' \
131
+ "$SUB_TITLE" "$SUB_DESC" "$BRANCH" "$VERSION" "$BRANCH_TYPE" "$BRANCH")
132
+
133
+ SUB_URL=$(gh issue create \
134
+ --repo "$REPO" \
135
+ --title "$SUB_FULL_TITLE" \
136
+ --body "$SUB_BODY" \
137
+ --label "${SUB_LABELS}" \
138
+ --assignee "jmiller" 2>&1)
139
+
140
+ SUB_NUM=$(echo "$SUB_URL" | grep -oE '[0-9]+$')
141
+ if [ -n "$SUB_NUM" ]; then
142
+ SUB_LIST="${SUB_LIST}\n- [ ] ${SUB_TITLE} (#${SUB_NUM})"
143
+ SUB_NUMBERS="${SUB_NUMBERS} #${SUB_NUM}"
144
+ fi
145
+ sleep 0.3
146
+ done
147
+
148
+ # ── Create parent tracking issue ──────────────────────────────────
149
+ PARENT_BODY=$(printf '## %s Branch Created\n\n| Field | Value |\n|-------|-------|\n| **Branch** | `%s` |\n| **Version** | `%s` |\n| **Type** | %s |\n| **Created by** | @%s |\n| **Created at** | %s |\n| **Repository** | `%s` |\n\n## Workflow Sub-Issues\n\n%b\n\n---\n*Auto-created by [auto-dev-issue.yml](.github/workflows/auto-dev-issue.yml) on branch creation.*' \
150
+ "$BRANCH_TYPE" "$BRANCH" "$VERSION" "$BRANCH_TYPE" "$ACTOR" "$NOW" "$REPO" "$SUB_LIST")
151
+
152
+ PARENT_URL=$(gh issue create \
153
+ --repo "$REPO" \
154
+ --title "$TITLE" \
155
+ --body "$PARENT_BODY" \
156
+ --label "${LABEL_TYPE},version" \
157
+ --assignee "jmiller" 2>&1)
158
+
159
+ PARENT_NUM=$(echo "$PARENT_URL" | grep -oE '[0-9]+$')
160
+
161
+ # ── Link sub-issues back to parent ────────────────────────────────
162
+ if [ -n "$PARENT_NUM" ]; then
163
+ for SUB in "${SUB_ISSUES[@]}"; do
164
+ IFS='|' read -r SUB_TITLE _ _ <<< "$SUB"
165
+ SUB_FULL_TITLE="${TITLE_PREFIX}(${VERSION}): ${SUB_TITLE}"
166
+ SUB_NUM=$(gh api "repos/${REPO}/issues?state=open&per_page=20" \
167
+ --jq ".[] | select(.title == \"${SUB_FULL_TITLE}\") | .number" 2>/dev/null | head -1)
168
+ if [ -n "$SUB_NUM" ]; then
169
+ gh api "repos/${REPO}/issues/${SUB_NUM}" -X PATCH \
170
+ -f body="$(gh api "repos/${REPO}/issues/${SUB_NUM}" --jq '.body' 2>/dev/null)
171
+
172
+ > **Parent Issue:** #${PARENT_NUM}" --silent 2>/dev/null || true
173
+ fi
174
+ sleep 0.2
175
+ done
176
+ fi
177
+
178
+ # ── Create or update prerelease for alpha/beta/rc ────────────────
179
+ if [[ "$BRANCH" == rc/* ]] || [[ "$BRANCH" == alpha/* ]] || [[ "$BRANCH" == beta/* ]]; then
180
+ case "$BRANCH_TYPE" in
181
+ Alpha) RELEASE_TAG="alpha" ;;
182
+ Beta) RELEASE_TAG="beta" ;;
183
+ "Release Candidate") RELEASE_TAG="release-candidate" ;;
184
+ esac
185
+
186
+ EXISTING=$(gh release view "$RELEASE_TAG" --json tagName -q .tagName 2>/dev/null || true)
187
+ if [ -z "$EXISTING" ]; then
188
+ gh release create "$RELEASE_TAG" \
189
+ --title "${RELEASE_TAG} (${VERSION})" \
190
+ --notes "## ${BRANCH_TYPE} ${VERSION}\n\nBranch: \`${BRANCH}\`\nTracking issue: ${PARENT_URL}" \
191
+ --prerelease \
192
+ --target main 2>/dev/null || true
193
+ echo "${BRANCH_TYPE} release created: ${RELEASE_TAG}" >> $GITHUB_STEP_SUMMARY
194
+ else
195
+ gh release edit "$RELEASE_TAG" \
196
+ --title "${RELEASE_TAG} (${VERSION})" --prerelease 2>/dev/null || true
197
+ echo "${BRANCH_TYPE} release updated: ${RELEASE_TAG}" >> $GITHUB_STEP_SUMMARY
198
+ fi
199
+ fi
200
+
201
+ # ── Summary ───────────────────────────────────────────────────────
202
+ echo "## Dev Workflow Issues Created" >> $GITHUB_STEP_SUMMARY
203
+ echo "" >> $GITHUB_STEP_SUMMARY
204
+ echo "| Item | Issue |" >> $GITHUB_STEP_SUMMARY
205
+ echo "|------|-------|" >> $GITHUB_STEP_SUMMARY
206
+ echo "| **Parent** | ${PARENT_URL} |" >> $GITHUB_STEP_SUMMARY
207
+ echo "| **Sub-issues** |${SUB_NUMBERS} |" >> $GITHUB_STEP_SUMMARY