feat(skills): add jira-workflow, repo-map, docs-map, go-standards
- descriptions state WHEN each skill applies - jira-workflow ships curl scripts reading TRACKER_URL/JIRA_TOKEN from env, no hardcoded secrets/URLs - repo-map/docs-map defer values to session corporate context; company specifics left as TODO - go-standards uses realistic Go defaults, company-specific bits marked TODO
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# add-comment.sh <ISSUE_KEY> "<comment text>"
|
||||
# Adds a comment to a tracker issue.
|
||||
# Reads TRACKER_URL and JIRA_TOKEN from the environment. No secrets are hardcoded.
|
||||
set -euo pipefail
|
||||
|
||||
KEY="${1:?usage: add-comment.sh <ISSUE_KEY> \"<text>\"}"
|
||||
TEXT="${2:?usage: add-comment.sh <ISSUE_KEY> \"<text>\"}"
|
||||
: "${TRACKER_URL:?set TRACKER_URL (or take the tracker address from the session corporate context)}"
|
||||
: "${JIRA_TOKEN:?set JIRA_TOKEN (tracker personal access token)}"
|
||||
|
||||
BASE="${TRACKER_URL%/}"
|
||||
|
||||
# Build JSON body safely (jq escapes the text); fall back to a naive body if jq is absent.
|
||||
if command -v jq >/dev/null 2>&1; then
|
||||
BODY="$(jq -n --arg b "$TEXT" '{body: $b}')"
|
||||
else
|
||||
BODY="{\"body\": \"${TEXT//\"/\\\"}\"}"
|
||||
fi
|
||||
|
||||
curl -fsS -X POST \
|
||||
-H "Authorization: Bearer ${JIRA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$BODY" \
|
||||
"${BASE}/rest/api/2/issue/${KEY}/comment" >/dev/null
|
||||
|
||||
echo "Comment added to ${KEY}"
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# get-issue.sh <ISSUE_KEY>
|
||||
# Prints summary, status and description of a tracker issue.
|
||||
# Reads TRACKER_URL and JIRA_TOKEN from the environment. No secrets are hardcoded.
|
||||
set -euo pipefail
|
||||
|
||||
KEY="${1:?usage: get-issue.sh <ISSUE_KEY>}"
|
||||
: "${TRACKER_URL:?set TRACKER_URL (or take the tracker address from the session corporate context)}"
|
||||
: "${JIRA_TOKEN:?set JIRA_TOKEN (tracker personal access token)}"
|
||||
|
||||
BASE="${TRACKER_URL%/}"
|
||||
|
||||
curl -fsS \
|
||||
-H "Authorization: Bearer ${JIRA_TOKEN}" \
|
||||
-H "Accept: application/json" \
|
||||
"${BASE}/rest/api/2/issue/${KEY}?fields=summary,status,description" \
|
||||
| { jq -r '"\(.key)\t\(.fields.status.name)\n\(.fields.summary)\n\n\(.fields.description // "")"' 2>/dev/null || cat; }
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# link-mr.sh <ISSUE_KEY> "<mr-url>" ["<title>"]
|
||||
# Attaches a merge request link to a tracker issue.
|
||||
# Default implementation posts a comment with the link (works on any Jira).
|
||||
# Reads TRACKER_URL and JIRA_TOKEN from the environment. No secrets are hardcoded.
|
||||
set -euo pipefail
|
||||
|
||||
KEY="${1:?usage: link-mr.sh <ISSUE_KEY> \"<mr-url>\" [\"<title>\"]}"
|
||||
URL="${2:?usage: link-mr.sh <ISSUE_KEY> \"<mr-url>\" [\"<title>\"]}"
|
||||
TITLE="${3:-Merge request}"
|
||||
: "${TRACKER_URL:?set TRACKER_URL (or take the tracker address from the session corporate context)}"
|
||||
: "${JIRA_TOKEN:?set JIRA_TOKEN (tracker personal access token)}"
|
||||
|
||||
BASE="${TRACKER_URL%/}"
|
||||
|
||||
# Default: comment with the MR link.
|
||||
COMMENT="${TITLE}: ${URL}"
|
||||
exec "$(dirname "$0")/add-comment.sh" "$KEY" "$COMMENT"
|
||||
|
||||
# TODO: если в компании используется remote issue link API, заменить на:
|
||||
# POST ${BASE}/rest/api/2/issue/${KEY}/remotelink
|
||||
# с телом {"object":{"url":"<URL>","title":"<TITLE>"}}
|
||||
Reference in New Issue
Block a user