@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.
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@aholbreich/agent-skills",
3
+ "version": "0.1.0",
4
+ "description": "Handcrafted Agent Skills for browser-authenticated Jira and Confluence ingestion, LLM wiki workflows, and developer automation.",
5
+ "license": "MIT",
6
+ "type": "commonjs",
7
+ "keywords": [
8
+ "pi-package",
9
+ "agent-skills",
10
+ "agent-skill",
11
+ "agentskills",
12
+ "skills.sh",
13
+ "claude-code",
14
+ "codex",
15
+ "open-claw",
16
+ "llm",
17
+ "jira",
18
+ "confluence",
19
+ "atlassian",
20
+ "browser-automation",
21
+ "llm-wiki"
22
+ ],
23
+ "homepage": "https://github.com/aholbreich/agent-skills#readme",
24
+ "bugs": {
25
+ "url": "https://github.com/aholbreich/agent-skills/issues"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/aholbreich/agent-skills.git"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "engines": {
35
+ "node": ">=22"
36
+ },
37
+ "bin": {
38
+ "agent-skills": "bin/agent-skills.js",
39
+ "jira-browser-fetch": "skills/jira-browser-fetch/scripts/jira-browser-fetch.js",
40
+ "confluence-browser-fetch": "skills/confluence-browser-fetch/scripts/confluence-browser-fetch.js"
41
+ },
42
+ "pi": {
43
+ "skills": [
44
+ "skills"
45
+ ]
46
+ },
47
+ "files": [
48
+ "bin/",
49
+ "skills/",
50
+ "README.md",
51
+ "COMPATIBILITY.md",
52
+ "LICENSE",
53
+ "SECURITY.md",
54
+ "CHANGELOG.md",
55
+ "CONTRIBUTING.md"
56
+ ],
57
+ "scripts": {
58
+ "check": "node --check bin/agent-skills.js && node --check skills/jira-browser-fetch/scripts/jira-browser-fetch.js && node --check skills/jira-browser-fetch/scripts/lib.js && node --check skills/confluence-browser-fetch/scripts/confluence-browser-fetch.js && node --check skills/confluence-browser-fetch/scripts/lib.js",
59
+ "test": "node --test",
60
+ "ci": "pnpm run check && pnpm test && pnpm pack --dry-run",
61
+ "pack:dry": "pnpm pack --dry-run"
62
+ }
63
+ }
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: confluence-browser-fetch
3
+ description: Fetch Confluence Cloud pages through an authenticated Chrome browser session when API tokens do not work, especially with Microsoft/SSO. Use to archive Confluence page JSON, storage/view HTML, browser HTML, attachments, CQL search results, or page descendants 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
+ # Confluence Browser Fetch
9
+
10
+ Use this skill when a user wants Confluence pages ingested into an LLM wiki `raw/` folder and normal Atlassian API-token auth is unavailable or inconvenient due to SSO.
11
+
12
+ The script opens/reuses Chrome with a dedicated profile, lets the user complete SSO once, extracts Atlassian cookies via Chrome DevTools, and fetches Confluence REST data plus rendered page HTML and attachments.
13
+
14
+ ## Safety
15
+
16
+ - Never ask users to paste Confluence cookies or API tokens into chat.
17
+ - Prefer browser automation so secrets remain in the local Chrome profile.
18
+ - Treat fetched pages and attachments as confidential.
19
+ - This skill is read-only: do not create, edit, delete, or move Confluence pages.
20
+
21
+ ## Script
22
+
23
+ ```bash
24
+ scripts/confluence-browser-fetch.js <URL|PAGE-ID> [...] [options]
25
+ ```
26
+
27
+ Important options:
28
+
29
+ ```bash
30
+ --site URL Atlassian site, e.g. https://example.atlassian.net
31
+ --raw-dir DIR output raw directory
32
+ --space KEY Confluence space key for --title search
33
+ --title TITLE resolve and fetch page by exact title
34
+ --cql CQL search Confluence and fetch matching pages
35
+ --descendants fetch descendant pages
36
+ --max-search-results N limit CQL result fetches
37
+ --max-attachment-size S skip attachment files larger than S (default 5mb; use unlimited to disable)
38
+ --force re-fetch even when local page version is current
39
+ --no-skip-unchanged disable version/timestamp skip check
40
+ --retries N retry transient HTTP failures
41
+ --request-timeout SEC per-request timeout
42
+ --no-attachments skip attachments
43
+ --no-browser-html skip rendered browser HTML
44
+ ```
45
+
46
+ ## Typical Workflow
47
+
48
+ 1. If the user gives a Confluence URL, run the script directly with that URL.
49
+ 2. If the user gives a title, ask for the space key or use `--cql`.
50
+ 3. Show the command before running it.
51
+ 4. If Chrome opens, ask the user to complete SSO in that browser window.
52
+ 5. Verify saved files.
53
+ 6. If this is an LLM wiki ingest, process the saved `raw/confluence/...` material into `wiki/` per the project `AGENTS.md`.
54
+
55
+ Example:
56
+
57
+ ```bash
58
+ scripts/confluence-browser-fetch.js \
59
+ "https://example.atlassian.net/wiki/spaces/ABC/pages/123456/Page+Title" \
60
+ --site https://example.atlassian.net \
61
+ --raw-dir ./raw
62
+ ```
63
+
64
+ Fetch a page and all descendants:
65
+
66
+ ```bash
67
+ scripts/confluence-browser-fetch.js \
68
+ 123456 \
69
+ --site https://example.atlassian.net \
70
+ --raw-dir ./raw \
71
+ --descendants
72
+ ```
73
+
74
+ Fetch by CQL:
75
+
76
+ ```bash
77
+ scripts/confluence-browser-fetch.js \
78
+ --site https://example.atlassian.net \
79
+ --raw-dir ./raw \
80
+ --cql 'space = ABC and type = page and text ~ "billing"'
81
+ ```
82
+
83
+ ## Output Layout
84
+
85
+ ```text
86
+ raw/confluence/<SPACE>/<PAGE-ID>-<slug>/
87
+ ├── page.json # Confluence REST content with storage/view HTML and metadata
88
+ ├── page.storage.html # Confluence storage format
89
+ ├── page.view.html # REST-rendered view body
90
+ ├── page.browser.html # browser page HTML, if enabled
91
+ ├── metadata.json # fetch metadata
92
+ ├── attachments.json # attachment manifest, including skipped large-file references
93
+ └── attachments/ # downloaded attachments under max-size threshold
94
+ ```
95
+
96
+ A run manifest is written to:
97
+
98
+ ```text
99
+ raw/confluence-browser-fetch-run.json
100
+ ```
101
+
102
+ ## Installation / PATH
103
+
104
+ Use directly by path, or install a symlink:
105
+
106
+ ```bash
107
+ mkdir -p ~/.local/bin
108
+ ln -sf ~/.pi/agent/skills/confluence-browser-fetch/scripts/confluence-browser-fetch.js ~/.local/bin/confluence-browser-fetch
109
+ ```
110
+
111
+ ## References
112
+
113
+ - [Usage reference](references/usage.md)
114
+ - [Distribution guide](references/distribution.md)
@@ -0,0 +1,110 @@
1
+ # Distribution Guide
2
+
3
+ This skill follows Pi / Agent Skills layout:
4
+
5
+ ```text
6
+ confluence-browser-fetch/
7
+ ├── SKILL.md
8
+ ├── scripts/
9
+ │ └── confluence-browser-fetch.js
10
+ └── references/
11
+ ├── usage.md
12
+ └── distribution.md
13
+ ```
14
+
15
+ ## Install for Current User
16
+
17
+ ```bash
18
+ mkdir -p ~/.pi/agent/skills
19
+ cp -a confluence-browser-fetch ~/.pi/agent/skills/
20
+ ```
21
+
22
+ Pi discovers it automatically on next start.
23
+
24
+ Optional command symlink:
25
+
26
+ ```bash
27
+ mkdir -p ~/.local/bin
28
+ ln -sf ~/.pi/agent/skills/confluence-browser-fetch/scripts/confluence-browser-fetch.js ~/.local/bin/confluence-browser-fetch
29
+ ```
30
+
31
+ ## Install in a Project Repository
32
+
33
+ ```bash
34
+ mkdir -p .pi/skills
35
+ cp -a confluence-browser-fetch .pi/skills/
36
+ git add .pi/skills/confluence-browser-fetch
37
+ git commit -m "Add Confluence browser fetch Pi skill"
38
+ ```
39
+
40
+ ## Distribute as a Tarball
41
+
42
+ From the parent directory:
43
+
44
+ ```bash
45
+ tar -czf confluence-browser-fetch-skill.tar.gz confluence-browser-fetch
46
+ ```
47
+
48
+ Install from tarball:
49
+
50
+ ```bash
51
+ mkdir -p ~/.pi/agent/skills
52
+ tar -xzf confluence-browser-fetch-skill.tar.gz -C ~/.pi/agent/skills
53
+ ```
54
+
55
+ ## Distribute as a Git Repository
56
+
57
+ Consumers can copy the skill:
58
+
59
+ ```bash
60
+ git clone <repo-url>
61
+ cp -a <repo>/confluence-browser-fetch ~/.pi/agent/skills/
62
+ ```
63
+
64
+ or reference a checkout in Pi settings:
65
+
66
+ ```json
67
+ {
68
+ "skills": ["/path/to/repo/confluence-browser-fetch"]
69
+ }
70
+ ```
71
+
72
+ ## npm/package.json Distribution
73
+
74
+ Pi can discover package skills from `skills/` directories or `pi.skills` entries in `package.json`.
75
+
76
+ Example package layout:
77
+
78
+ ```text
79
+ my-pi-skills/
80
+ ├── package.json
81
+ └── skills/
82
+ └── confluence-browser-fetch/
83
+ ├── SKILL.md
84
+ ├── scripts/confluence-browser-fetch.js
85
+ └── references/
86
+ ```
87
+
88
+ Minimal package metadata:
89
+
90
+ ```json
91
+ {
92
+ "name": "my-pi-skills",
93
+ "version": "1.0.0",
94
+ "private": true,
95
+ "pi": {
96
+ "skills": ["skills/confluence-browser-fetch"]
97
+ }
98
+ }
99
+ ```
100
+
101
+ ## Validation Checklist
102
+
103
+ - Directory name matches frontmatter name: `confluence-browser-fetch`.
104
+ - `SKILL.md` has `name` and `description`.
105
+ - No cookies, API tokens, or secrets are committed.
106
+ - Script is executable:
107
+
108
+ ```bash
109
+ chmod +x scripts/confluence-browser-fetch.js
110
+ ```
@@ -0,0 +1,161 @@
1
+ # Confluence Browser Fetch Usage
2
+
3
+ ## Why Browser Fetch?
4
+
5
+ Confluence Cloud pages are often behind Microsoft/SSO. API-token Basic auth may be disabled or inconvenient. Browser fetch works by:
6
+
7
+ 1. Launching Chrome with a dedicated user profile.
8
+ 2. Letting the user complete normal SSO.
9
+ 3. Reading Atlassian cookies through local Chrome DevTools.
10
+ 4. Calling Confluence REST endpoints with those cookies.
11
+
12
+ No cookie or API token needs to be pasted into chat.
13
+
14
+ ## Requirements
15
+
16
+ - Node.js 22+.
17
+ - Google Chrome or Chromium.
18
+ - Access to the Confluence page with the logged-in account.
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/confluence-browser-fetch.js 123456
31
+ ```
32
+
33
+ ## Common Commands
34
+
35
+ Fetch one page by URL:
36
+
37
+ ```bash
38
+ scripts/confluence-browser-fetch.js \
39
+ 'https://example.atlassian.net/wiki/spaces/ABC/pages/123456/Page+Title' \
40
+ --site https://example.atlassian.net \
41
+ --raw-dir /path/to/wiki/raw
42
+ ```
43
+
44
+ Fetch one page by page ID:
45
+
46
+ ```bash
47
+ scripts/confluence-browser-fetch.js 123456 \
48
+ --site https://example.atlassian.net \
49
+ --raw-dir /path/to/wiki/raw
50
+ ```
51
+
52
+ Fetch a page and descendants:
53
+
54
+ ```bash
55
+ scripts/confluence-browser-fetch.js 123456 \
56
+ --site https://example.atlassian.net \
57
+ --raw-dir /path/to/wiki/raw \
58
+ --descendants
59
+ ```
60
+
61
+ Fetch by exact title in a space:
62
+
63
+ ```bash
64
+ scripts/confluence-browser-fetch.js \
65
+ --site https://example.atlassian.net \
66
+ --raw-dir /path/to/wiki/raw \
67
+ --space ABC \
68
+ --title 'Architecture Overview'
69
+ ```
70
+
71
+ Fetch by CQL:
72
+
73
+ ```bash
74
+ scripts/confluence-browser-fetch.js \
75
+ --site https://example.atlassian.net \
76
+ --raw-dir /path/to/wiki/raw \
77
+ --cql 'space = ABC and type = page and text ~ "invoice"'
78
+ ```
79
+
80
+ Use shorter wait when already logged in:
81
+
82
+ ```bash
83
+ CONFLUENCE_FETCH_WAIT_SEC=15 scripts/confluence-browser-fetch.js 123456 --raw-dir ./raw
84
+ ```
85
+
86
+ Re-fetch everything even when versions match:
87
+
88
+ ```bash
89
+ scripts/confluence-browser-fetch.js 123456 --descendants --force --raw-dir ./raw
90
+ ```
91
+
92
+ Skip attachment downloads above a threshold while still recording references in `attachments.json`:
93
+
94
+ ```bash
95
+ scripts/confluence-browser-fetch.js 123456 --descendants --raw-dir ./raw --max-attachment-size 10mb
96
+ ```
97
+
98
+ Default max attachment download size is `5mb`. Use `--max-attachment-size unlimited` to download all attachments.
99
+
100
+ By default, pages with matching local `metadata.json` Confluence `version.number` and `version.when` are skipped. This avoids re-downloading unchanged page HTML and attachments during large tree fetches.
101
+
102
+ ## Environment Variables
103
+
104
+ | Variable | Meaning |
105
+ |---|---|
106
+ | `CONFLUENCE_SITE` | Default Atlassian site, e.g. `https://example.atlassian.net` |
107
+ | `CONFLUENCE_RAW_DIR` | Default output raw directory |
108
+ | `CONFLUENCE_CHROME_DEBUG_PORT` | Chrome DevTools port, default `9224` |
109
+ | `CONFLUENCE_FETCH_WAIT_SEC` | Wait timeout, default `900` |
110
+ | `CONFLUENCE_MAX_SEARCH_RESULTS` | Max CQL pages, default `200` |
111
+ | `CONFLUENCE_MAX_ATTACHMENT_SIZE` / `CONFLUENCE_MAX_ATTACHMENT_BYTES` | Max attachment download size, default `5mb`; skipped files are listed in `attachments.json` |
112
+ | `CONFLUENCE_RETRIES` | Retry count for transient HTTP errors, default `3` |
113
+ | `CONFLUENCE_REQUEST_TIMEOUT_SEC` | Per-request timeout, default `60` |
114
+ | `CONFLUENCE_SKIP_UNCHANGED` | Set to `0` to disable default skip-unchanged behavior |
115
+ | `CONFLUENCE_CHROME_PROFILE` | Dedicated Chrome profile dir |
116
+ | `CHROME` | Chrome executable path |
117
+
118
+ ## Output Files
119
+
120
+ For each page:
121
+
122
+ - `page.json` — REST content with body.storage, body.view, space, ancestors, labels, version, history.
123
+ - `page.storage.html` — Confluence storage XHTML.
124
+ - `page.view.html` — REST-rendered HTML body.
125
+ - `page.browser.html` — full browser HTML shell/page.
126
+ - `attachments.json` — manifest, including skipped large-file references with URL, file size, and reason.
127
+ - `attachments/` — files downloaded via Confluence attachment links under the max-size threshold.
128
+ - `metadata.json` — fetch metadata and source URLs.
129
+
130
+ ## Troubleshooting
131
+
132
+ ### `no Atlassian cookies yet`
133
+
134
+ Complete SSO in the Chrome window opened by the script.
135
+
136
+ ### `Page failed HTTP 404`
137
+
138
+ The authenticated user cannot see the page, or the page ID/site is wrong.
139
+
140
+ ### URL cannot be resolved
141
+
142
+ Provide the numeric page ID from a URL like:
143
+
144
+ ```text
145
+ /wiki/spaces/ABC/pages/123456/Page+Title
146
+ /wiki/pages/viewpage.action?pageId=123456
147
+ ```
148
+
149
+ Tiny links may not expose the page ID; open them in the browser and copy the expanded URL.
150
+
151
+ ### CQL returns too many pages
152
+
153
+ Use `--max-search-results N` or a narrower query.
154
+
155
+ ### DevTools port already in use
156
+
157
+ Use another port:
158
+
159
+ ```bash
160
+ scripts/confluence-browser-fetch.js 123456 --port 9334
161
+ ```