@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,67 @@
1
+ ---
2
+ name: MCP Connection Issue
3
+ about: Report a connection, authentication, or API communication issue
4
+ title: '[CONNECTION] '
5
+ labels: 'bug, mcp-connection'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ ## Connection Issue
11
+
12
+ ### Issue Type
13
+ - [ ] Authentication failure (401/403)
14
+ - [ ] Connection refused / timeout
15
+ - [ ] TLS / SSL certificate error
16
+ - [ ] Wrong connection used (wrong environment)
17
+ - [ ] Config file not found / parse error
18
+ - [ ] API response error (4xx / 5xx)
19
+
20
+ ### MCP Server
21
+ - **Server Name**: [e.g., mcp_mokowaas]
22
+ - **Server Version**: [e.g., 1.0.0]
23
+ - **Node.js Version**: [e.g., 20.x]
24
+
25
+ ### Connection Details
26
+ - **Connection Name**: [e.g., production, staging, default]
27
+ - **API Base URL**: [e.g., https://api.example.com] *(do not include API keys)*
28
+ - **Insecure Mode**: [Yes / No]
29
+
30
+ ### Error Message
31
+ ```
32
+ Paste the exact error message here
33
+ ```
34
+
35
+ ### Steps to Reproduce
36
+ 1. Configure connection with `npm run setup`
37
+ 2. Call tool `...` with parameters `...`
38
+ 3. See error
39
+
40
+ ### Expected Behavior
41
+ What should have happened.
42
+
43
+ ### Debugging Attempted
44
+ - [ ] Tested API directly with curl
45
+ - [ ] Verified API key is valid
46
+ - [ ] Checked config file exists and is valid JSON
47
+ - [ ] Tested with `list_connections` tool
48
+ - [ ] Ran server manually: `node dist/index.js 2> debug.log`
49
+
50
+ ### Config File
51
+ ```json
52
+ {
53
+ "defaultConnection": "...",
54
+ "connections": {
55
+ "connection_name": {
56
+ "baseUrl": "https://...",
57
+ "apiKey": "REDACTED"
58
+ }
59
+ }
60
+ }
61
+ ```
62
+ *(Redact all API keys and tokens)*
63
+
64
+ ### Environment
65
+ - **OS**: [e.g., macOS 14, Ubuntu 22.04, Windows 11]
66
+ - **Claude Code Version**: [e.g., latest]
67
+ - **Registration**: [.mcp.json / ~/.claude.json]
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: New MCP Tool Request
3
+ about: Request a new tool to be added to this MCP server
4
+ title: '[TOOL] '
5
+ labels: 'enhancement, mcp-tool'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ ## Tool Request
11
+
12
+ ### Tool Name
13
+ Proposed tool name (snake_case): `resource_action`
14
+
15
+ ### Description
16
+ What should this tool do? What API endpoint(s) does it map to?
17
+
18
+ ### API Endpoint(s)
19
+ - **Method**: [GET / POST / PUT / PATCH / DELETE]
20
+ - **Endpoint**: `/api/v1/...`
21
+ - **Auth**: [API Key / Token / None]
22
+
23
+ ### Parameters
24
+
25
+ | Parameter | Type | Required | Description |
26
+ |---|---|---|---|
27
+ | `id` | number | Yes | Resource ID |
28
+ | `search` | string | No | Search filter |
29
+
30
+ ### Expected Response
31
+ ```json
32
+ {
33
+ "id": 1,
34
+ "name": "Example"
35
+ }
36
+ ```
37
+
38
+ ### Use Case
39
+ Describe when and why someone would use this tool from Claude or another AI assistant.
40
+
41
+ ### Connection Scope
42
+ - [ ] Works with all connections
43
+ - [ ] Specific to certain API versions
44
+ - [ ] Requires additional permissions
45
+
46
+ ### Checklist
47
+ - [ ] I have checked this tool does not already exist
48
+ - [ ] I have verified the API endpoint exists and is documented
49
+ - [ ] The proposed name follows the `resource_action` convention
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: Question
3
+ about: Ask a question about usage, features, or best practices
4
+ title: '[QUESTION] '
5
+ labels: ['question']
6
+ assignees: ['jmiller']
7
+ ---
8
+
9
+
10
+ ## Question
11
+
12
+ **Your question:**
13
+
14
+
15
+ ## Context
16
+
17
+ **What are you trying to accomplish?**
18
+
19
+
20
+ **What have you already tried?**
21
+
22
+
23
+ **Category**:
24
+ - [ ] Script usage
25
+ - [ ] Configuration
26
+ - [ ] Workflow setup
27
+ - [ ] Documentation interpretation
28
+ - [ ] Best practices
29
+ - [ ] Integration
30
+ - [ ] Other: __________
31
+
32
+ ## Environment (if relevant)
33
+
34
+ **Your setup**:
35
+ - Operating System:
36
+ - Version:
37
+
38
+ ## What You've Researched
39
+
40
+ **Documentation reviewed**:
41
+ - [ ] README.md
42
+ - [ ] Project documentation
43
+ - [ ] Other (specify): __________
44
+
45
+ **Similar issues/questions found**:
46
+ - #
47
+ - #
48
+
49
+ ## Expected Outcome
50
+
51
+ **What result are you hoping for?**
52
+
53
+
54
+ ## Code/Configuration Samples
55
+
56
+ **Relevant code or configuration** (if applicable):
57
+
58
+ ```bash
59
+ # Your code here
60
+ ```
61
+
62
+ ## Additional Context
63
+
64
+ **Any other relevant information:**
65
+
66
+
67
+ **Screenshots** (if helpful):
68
+
69
+
70
+ ## Urgency
71
+
72
+ - [ ] Urgent (blocking work)
73
+ - [ ] Normal (can work on other things meanwhile)
74
+ - [ ] Low priority (just curious)
75
+
76
+ ## Checklist
77
+
78
+ - [ ] I have searched existing issues and discussions
79
+ - [ ] I have reviewed relevant documentation
80
+ - [ ] I have provided sufficient context
81
+ - [ ] I have included code/configuration samples if relevant
82
+ - [ ] This is a genuine question (not a bug report or feature request)
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: Request for Comments (RFC)
3
+ about: Propose a significant change for community discussion
4
+ title: '[RFC] '
5
+ labels: 'rfc, discussion'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+
11
+ ## RFC Summary
12
+ One-paragraph summary of the proposal.
13
+
14
+ ## Motivation
15
+ Why are we doing this? What use cases does it support? What is the expected outcome?
16
+
17
+ ## Detailed Design
18
+ ### Overview
19
+ Provide a detailed explanation of the proposed change.
20
+
21
+ ### API Changes (if applicable)
22
+ ```php
23
+ // Before
24
+ function oldApi($param1) { }
25
+
26
+ // After
27
+ function newApi($param1, $param2) { }
28
+ ```
29
+
30
+ ### User Experience Changes
31
+ Describe how users will interact with this change.
32
+
33
+ ### Implementation Approach
34
+ High-level implementation strategy.
35
+
36
+ ## Drawbacks
37
+ Why should we *not* do this?
38
+
39
+ ## Alternatives
40
+ What other designs have been considered? What is the impact of not doing this?
41
+
42
+ ### Alternative 1
43
+ - Description
44
+ - Trade-offs
45
+
46
+ ### Alternative 2
47
+ - Description
48
+ - Trade-offs
49
+
50
+ ## Adoption Strategy
51
+ How will existing users adopt this? Is this a breaking change?
52
+
53
+ ### Migration Guide
54
+ ```bash
55
+ # Steps to migrate
56
+ ```
57
+
58
+ ### Deprecation Timeline
59
+ - **Announcement**:
60
+ - **Deprecation**:
61
+ - **Removal**:
62
+
63
+ ## Unresolved Questions
64
+ - Question 1
65
+ - Question 2
66
+
67
+ ## Future Possibilities
68
+ What future work does this enable?
69
+
70
+ ## Impact Assessment
71
+ ### Performance
72
+ Expected performance impact.
73
+
74
+ ### Security
75
+ Security considerations and implications.
76
+
77
+ ### Compatibility
78
+ - **Backward Compatible**: [Yes / No]
79
+ - **Breaking Changes**: [List]
80
+
81
+ ### Maintenance
82
+ Long-term maintenance considerations.
83
+
84
+ ## Community Input
85
+ ### Stakeholders
86
+ - [ ] Core team
87
+ - [ ] Module developers
88
+ - [ ] End users
89
+ - [ ] Enterprise customers
90
+
91
+ ### Feedback Period
92
+ **Duration**: [e.g., 2 weeks]
93
+ **Deadline**: [date]
94
+
95
+ ## Implementation Timeline
96
+ ### Phase 1: Design
97
+ - [ ] RFC discussion
98
+ - [ ] Design finalization
99
+ - [ ] Approval
100
+
101
+ ### Phase 2: Implementation
102
+ - [ ] Core implementation
103
+ - [ ] Tests
104
+ - [ ] Documentation
105
+
106
+ ### Phase 3: Release
107
+ - [ ] Beta release
108
+ - [ ] Feedback collection
109
+ - [ ] Stable release
110
+
111
+ ## Success Metrics
112
+ How will we measure success?
113
+ - Metric 1
114
+ - Metric 2
115
+
116
+ ## References
117
+ - Related RFCs:
118
+ - External documentation:
119
+ - Prior art:
120
+
121
+ ## Open Questions for Community
122
+ 1. Question 1?
123
+ 2. Question 2?
124
+
125
+ ---
126
+ **Note**: This RFC is open for community discussion. Please provide feedback in the comments below.
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: Security Vulnerability Report
3
+ about: Report a security vulnerability (use only for non-critical issues)
4
+ title: '[SECURITY] '
5
+ labels: 'security'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+
11
+ ## ⚠️ IMPORTANT: Private Disclosure Required
12
+
13
+ **For critical security vulnerabilities, DO NOT use this template.**
14
+ Follow the process in [SECURITY.md](../SECURITY.md) for responsible disclosure.
15
+
16
+ Use this template only for:
17
+ - Security improvements
18
+ - Non-critical security suggestions
19
+ - Security documentation updates
20
+
21
+ ---
22
+
23
+ ## Security Issue
24
+
25
+ **Severity**:
26
+ <!-- Low, Medium, or informational only -->
27
+
28
+ ## Description
29
+ <!-- Describe the security concern or improvement suggestion -->
30
+
31
+ ## Affected Components
32
+ <!-- List the affected files, features, or components -->
33
+
34
+ ## Suggested Mitigation
35
+ <!-- Describe how this could be addressed -->
36
+
37
+ ## Standards Reference
38
+ Does this relate to security standards in [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/MokoStandards)?
39
+ - [ ] SPDX license identifiers
40
+ - [ ] Secret management
41
+ - [ ] Dependency security
42
+ - [ ] Access control
43
+ - [ ] Other: [specify]
44
+
45
+ ## Additional Context
46
+ <!-- Add any other context about the security concern -->
47
+
48
+ ## Checklist
49
+ - [ ] This is NOT a critical vulnerability requiring private disclosure
50
+ - [ ] I have reviewed the SECURITY.md policy
51
+ - [ ] I have provided sufficient detail for evaluation
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: Version Bump
3
+ about: Request or track a version change
4
+ title: '[VERSION] '
5
+ labels: 'version, type: version'
6
+ assignees: 'jmiller'
7
+ ---
8
+
9
+ ## Version Change
10
+
11
+ **Current version**: <!-- e.g., 01.02.03 -->
12
+ **Requested version**: <!-- e.g., 01.03.00 -->
13
+ **Change type**: <!-- patch / minor / major -->
14
+
15
+ ## Reason
16
+
17
+ <!-- Why is this version bump needed? -->
18
+
19
+ ## Checklist
20
+
21
+ - [ ] README.md `VERSION:` field updated
22
+ - [ ] CHANGELOG.md entry added
23
+ - [ ] Module descriptor version updated (Dolibarr: `$this->version`, Joomla: `<version>`)
24
+ - [ ] All file headers will be auto-propagated by `sync-version-on-merge` workflow
@@ -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: /.github/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: Auto-Assign Issues & PRs
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,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 .github/workflows/auto-dev-issue.yml in all governed repos.
15
+
16
+ name: 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