@aholbreich/agent-skills 0.1.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.
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: jira-browser-fetch
3
+ description: Fetch Jira issue raw data through an authenticated Chrome browser session when jira-cli/API tokens do not work, especially with Microsoft/SSO. Use to archive Jira issues, linked tickets, rendered HTML/XML, remote links, and attachments into a raw wiki folder.
4
+ license: MIT
5
+ compatibility: Agent Skills standard. Tested with Pi; installable into Claude Code, Codex, OpenClaw/generic .agents skills directories. Requires Node.js 22+ with built-in fetch/WebSocket and Google Chrome/Chromium with remote debugging. No npm dependencies.
6
+ ---
7
+
8
+ # Jira Browser Fetch
9
+
10
+ Use this skill when Jira API-token authentication fails or the organization uses Microsoft/SSO and the user wants Jira issues archived into a local raw/wiki folder.
11
+
12
+ The bundled script opens/reuses Chrome with a dedicated profile, lets the user complete SSO once, extracts Jira cookies via Chrome DevTools, and fetches Jira REST/HTML/XML/attachments into a raw directory.
13
+
14
+ ## Safety
15
+
16
+ - Never ask the user to paste Jira cookies or API tokens into chat.
17
+ - Prefer the browser automation flow because secrets remain in the local Chrome profile.
18
+ - Treat fetched issue data and attachments as potentially confidential.
19
+ - Do not update/transition/edit Jira issues with this skill; it is read-only.
20
+
21
+ ## Script
22
+
23
+ ```bash
24
+ scripts/jira-browser-fetch.js ISSUE-KEY [options]
25
+ ```
26
+
27
+ Important options:
28
+
29
+ ```bash
30
+ --server URL Jira base URL, e.g. https://example.atlassian.net
31
+ --raw-dir DIR folder where ISSUE-KEY/ directories are created
32
+ --connected fetch connected/referenced tickets too
33
+ --depth N recursion depth for connected tickets
34
+ --scan-text find issue keys in JSON/XML/HTML text, not only formal Jira links
35
+ --jql JQL search Jira with JQL and fetch all matching issues
36
+ --assignee-me fetch all issues assigned to current Jira user
37
+ --max-attachment-size S skip attachment files larger than S (default 5mb; use unlimited to disable)
38
+ --prefix A,B,C only follow keys with these project prefixes
39
+ --wait SEC SSO/session wait timeout per issue
40
+ ```
41
+
42
+ ## Typical Workflow
43
+
44
+ 1. Identify raw directory.
45
+ 2. Run the script and show the command first.
46
+ 3. If Chrome opens, ask the user to complete SSO in that browser window.
47
+ 4. Verify saved files.
48
+
49
+ Example:
50
+
51
+ ```bash
52
+ scripts/jira-browser-fetch.js \
53
+ SWING-4770 \
54
+ --server https://example.atlassian.net \
55
+ --raw-dir ./raw \
56
+ --connected \
57
+ --scan-text \
58
+ --prefix SWING,SSD,EC \
59
+ --depth 1
60
+
61
+ # Fetch requested issues plus everything assigned to current user:
62
+ scripts/jira-browser-fetch.js \
63
+ SWING-4611 SWING-4621 \
64
+ --server https://example.atlassian.net \
65
+ --raw-dir ./raw \
66
+ --assignee-me
67
+ ```
68
+
69
+ ## Output Layout
70
+
71
+ For each issue:
72
+
73
+ ```text
74
+ raw/ISSUE-KEY/
75
+ ├── issue.json # Jira REST issue with renderedFields,names,schema,changelog
76
+ ├── issue.html # Browser issue page HTML
77
+ ├── issue.xml # Jira XML issue view
78
+ ├── remotelinks.json # Jira remote links endpoint
79
+ ├── connected-keys.json # Connected/referenced issue keys detected
80
+ ├── metadata.json # Fetch metadata
81
+ ├── attachments.json # Attachment manifest, including skipped large-file references
82
+ └── attachments/ # Downloaded attachments under max-size threshold
83
+ ```
84
+
85
+ A run manifest is written to:
86
+
87
+ ```text
88
+ raw/jira-browser-fetch-run.json
89
+ ```
90
+
91
+ ## Installation / PATH
92
+
93
+ The skill can be used directly by path. Optionally install a convenience symlink:
94
+
95
+ ```bash
96
+ mkdir -p ~/.local/bin
97
+ ln -sf ~/.pi/agent/skills/jira-browser-fetch/scripts/jira-browser-fetch.js ~/.local/bin/jira-browser-fetch
98
+ ```
99
+
100
+ Then use:
101
+
102
+ ```bash
103
+ jira-browser-fetch SWING-4770 --raw-dir ./raw --connected
104
+ ```
105
+
106
+ ## References
107
+
108
+ - [Usage reference](references/usage.md)
109
+ - [Distribution guide](references/distribution.md)
@@ -0,0 +1,124 @@
1
+ # Distribution Guide
2
+
3
+ This skill follows Pi / Agent Skills layout:
4
+
5
+ ```text
6
+ jira-browser-fetch/
7
+ ├── SKILL.md
8
+ ├── scripts/
9
+ │ └── jira-browser-fetch.js
10
+ └── references/
11
+ ├── usage.md
12
+ └── distribution.md
13
+ ```
14
+
15
+ ## Install for Current User
16
+
17
+ Copy the whole directory to Pi's global skill location:
18
+
19
+ ```bash
20
+ mkdir -p ~/.pi/agent/skills
21
+ cp -a jira-browser-fetch ~/.pi/agent/skills/
22
+ ```
23
+
24
+ Pi discovers it automatically on next start.
25
+
26
+ Optional command symlink:
27
+
28
+ ```bash
29
+ mkdir -p ~/.local/bin
30
+ ln -sf ~/.pi/agent/skills/jira-browser-fetch/scripts/jira-browser-fetch.js ~/.local/bin/jira-browser-fetch
31
+ ```
32
+
33
+ ## Install in a Project Repository
34
+
35
+ For a repo-local skill:
36
+
37
+ ```bash
38
+ mkdir -p .pi/skills
39
+ cp -a jira-browser-fetch .pi/skills/
40
+ ```
41
+
42
+ Commit it:
43
+
44
+ ```bash
45
+ git add .pi/skills/jira-browser-fetch
46
+ git commit -m "Add Jira browser fetch Pi skill"
47
+ ```
48
+
49
+ Anyone using Pi inside that repository gets the skill automatically.
50
+
51
+ ## Distribute as a Tarball
52
+
53
+ From the parent directory:
54
+
55
+ ```bash
56
+ tar -czf jira-browser-fetch-skill.tar.gz jira-browser-fetch
57
+ ```
58
+
59
+ Install from tarball:
60
+
61
+ ```bash
62
+ mkdir -p ~/.pi/agent/skills
63
+ tar -xzf jira-browser-fetch-skill.tar.gz -C ~/.pi/agent/skills
64
+ ```
65
+
66
+ ## Distribute as a Git Repository
67
+
68
+ Create a repo with the skill directory as content or as `skills/jira-browser-fetch`.
69
+
70
+ Consumers can either copy it:
71
+
72
+ ```bash
73
+ git clone <repo-url>
74
+ cp -a <repo>/jira-browser-fetch ~/.pi/agent/skills/
75
+ ```
76
+
77
+ or reference it in Pi settings if they keep a checkout:
78
+
79
+ ```json
80
+ {
81
+ "skills": ["/path/to/repo/jira-browser-fetch"]
82
+ }
83
+ ```
84
+
85
+ ## npm/package.json Distribution
86
+
87
+ Pi can discover package skills from `skills/` directories or `pi.skills` entries in `package.json`.
88
+
89
+ Example package layout:
90
+
91
+ ```text
92
+ my-pi-skills/
93
+ ├── package.json
94
+ └── skills/
95
+ └── jira-browser-fetch/
96
+ ├── SKILL.md
97
+ ├── scripts/jira-browser-fetch.js
98
+ └── references/
99
+ ```
100
+
101
+ Minimal `package.json`:
102
+
103
+ ```json
104
+ {
105
+ "name": "my-pi-skills",
106
+ "version": "1.0.0",
107
+ "private": true,
108
+ "pi": {
109
+ "skills": ["skills/jira-browser-fetch"]
110
+ }
111
+ }
112
+ ```
113
+
114
+ ## Validation Checklist
115
+
116
+ - Directory name matches `name` in `SKILL.md`: `jira-browser-fetch`.
117
+ - `SKILL.md` has required `name` and `description` frontmatter.
118
+ - Scripts use relative paths in docs.
119
+ - No secrets, cookies, or tokens are committed.
120
+ - Script is executable:
121
+
122
+ ```bash
123
+ chmod +x scripts/jira-browser-fetch.js
124
+ ```
@@ -0,0 +1,138 @@
1
+ # Jira Browser Fetch Usage
2
+
3
+ ## Why Browser Fetch?
4
+
5
+ Some Jira Cloud organizations use Microsoft/SSO and block or break API-token Basic auth. The browser fetcher avoids this by:
6
+
7
+ 1. Launching Chrome with a dedicated user profile.
8
+ 2. Letting the user complete normal SSO in Chrome.
9
+ 3. Reading Jira cookies through the local Chrome DevTools protocol.
10
+ 4. Calling Jira REST endpoints with those cookies.
11
+
12
+ No token or cookie needs to be pasted into chat.
13
+
14
+ ## Requirements
15
+
16
+ - Linux/macOS with Chrome or Chromium.
17
+ - Node.js 22+.
18
+ - Network access to the Jira site.
19
+
20
+ Check:
21
+
22
+ ```bash
23
+ node --version
24
+ which google-chrome || which chromium || which chromium-browser
25
+ ```
26
+
27
+ If Chrome has a different path:
28
+
29
+ ```bash
30
+ CHROME=/path/to/chrome scripts/jira-browser-fetch.js PROJ-123
31
+ ```
32
+
33
+ ## Common Commands
34
+
35
+ Fetch one issue:
36
+
37
+ ```bash
38
+ scripts/jira-browser-fetch.js PROJ-123 \
39
+ --server https://example.atlassian.net \
40
+ --raw-dir /path/to/wiki/raw
41
+ ```
42
+
43
+ Fetch one issue and formal Jira links/subtasks/parents:
44
+
45
+ ```bash
46
+ scripts/jira-browser-fetch.js PROJ-123 \
47
+ --server https://example.atlassian.net \
48
+ --raw-dir /path/to/wiki/raw \
49
+ --connected \
50
+ --depth 1
51
+ ```
52
+
53
+ Fetch issue keys mentioned in comments/descriptions/rendered HTML too:
54
+
55
+ ```bash
56
+ scripts/jira-browser-fetch.js PROJ-123 \
57
+ --server https://example.atlassian.net \
58
+ --raw-dir /path/to/wiki/raw \
59
+ --connected \
60
+ --scan-text \
61
+ --prefix PROJ,HELPDESK \
62
+ --depth 1
63
+ ```
64
+
65
+ Fetch all issues assigned to the current browser-authenticated Jira user:
66
+
67
+ ```bash
68
+ scripts/jira-browser-fetch.js \
69
+ --server https://example.atlassian.net \
70
+ --raw-dir /path/to/wiki/raw \
71
+ --assignee-me
72
+ ```
73
+
74
+ Fetch any JQL result set:
75
+
76
+ ```bash
77
+ scripts/jira-browser-fetch.js \
78
+ --server https://example.atlassian.net \
79
+ --raw-dir /path/to/wiki/raw \
80
+ --jql "assignee = currentUser() AND statusCategory != Done ORDER BY updated DESC"
81
+ ```
82
+
83
+ Use a shorter wait when the browser session is already logged in:
84
+
85
+ ```bash
86
+ JIRA_FETCH_WAIT_SEC=15 scripts/jira-browser-fetch.js PROJ-123 --raw-dir ./raw
87
+ ```
88
+
89
+ Skip attachment downloads above a threshold while still recording references in `attachments.json`:
90
+
91
+ ```bash
92
+ scripts/jira-browser-fetch.js PROJ-123 --raw-dir ./raw --max-attachment-size 10mb
93
+ ```
94
+
95
+ Default max attachment download size is `5mb`. Use `--max-attachment-size unlimited` to download all attachments.
96
+
97
+ ## Environment Variables
98
+
99
+ | Variable | Meaning |
100
+ |---|---|
101
+ | `JIRA_SERVER` | Default Jira base URL |
102
+ | `JIRA_RAW_DIR` | Default output raw directory |
103
+ | `JIRA_CHROME_DEBUG_PORT` | Chrome DevTools port, default `9223` |
104
+ | `JIRA_FETCH_WAIT_SEC` | Wait timeout per issue, default `900` |
105
+ | `JIRA_MAX_SEARCH_RESULTS` | Max issues added per JQL search, default `1000` |
106
+ | `JIRA_MAX_ATTACHMENT_SIZE` / `JIRA_MAX_ATTACHMENT_BYTES` | Max attachment download size, default `5mb`; skipped files are listed in `attachments.json` |
107
+ | `JIRA_CHROME_PROFILE` | Dedicated Chrome profile dir |
108
+ | `CHROME` | Chrome executable path |
109
+
110
+ ## Troubleshooting
111
+
112
+ ### `no Jira cookies yet`
113
+
114
+ Complete SSO in the Chrome window opened by the script.
115
+
116
+ ### `HTTP 404 Issue does not exist or you do not have permission`
117
+
118
+ The session works, but the account cannot see the issue or the key is not a Jira issue.
119
+
120
+ ### Chrome does not open
121
+
122
+ Set the executable path:
123
+
124
+ ```bash
125
+ CHROME=/usr/bin/chromium scripts/jira-browser-fetch.js PROJ-123
126
+ ```
127
+
128
+ ### DevTools port already in use
129
+
130
+ Use another port:
131
+
132
+ ```bash
133
+ scripts/jira-browser-fetch.js PROJ-123 --port 9333
134
+ ```
135
+
136
+ ### SSO opens in the wrong Chrome profile
137
+
138
+ The script uses its own profile by default. That is intentional so it can enable remote debugging safely. Complete SSO once in that window; future runs reuse it.