confluence-browser-fetch

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Confluence Browser Fetch

Confluence Browser Fetch

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.
The script opens/reuses Chrome with a dedicated profile, lets the user complete SSO once, extracts Atlassian cookies via Chrome DevTools, verifies they represent an authenticated Confluence REST session, and fetches Confluence REST data plus rendered page HTML and attachments.
当用户希望将Confluence页面导入LLM wiki的
raw/
文件夹,且由于SSO导致常规Atlassian API令牌认证不可用或不便时,可使用此技能。
该脚本会打开/复用带有专用配置文件的Chrome浏览器,让用户完成一次SSO登录,通过Chrome DevTools提取Atlassian Cookie,验证其代表已认证的Confluence REST会话,然后获取Confluence REST数据、渲染后的页面HTML以及附件。

Safety

安全注意事项

  • Never ask users to paste Confluence cookies or API tokens into chat.
  • Prefer browser automation so secrets remain in the local Chrome profile.
  • Treat fetched pages and attachments as confidential.
  • This skill is read-only: do not create, edit, delete, or move Confluence pages.
  • 切勿要求用户在聊天中粘贴Confluence Cookie或API令牌。
  • 优先使用浏览器自动化,确保密钥仅保存在本地Chrome配置文件中。
  • 将获取的页面和附件视为机密内容。
  • 本技能为只读:请勿创建、编辑、删除或移动Confluence页面。

Script

脚本

bash
scripts/confluence-browser-fetch.js <URL|PAGE-ID> [...] [options]
Important options:
bash
--site URL               Atlassian site, e.g. https://example.atlassian.net
--raw-dir DIR            output raw directory
--space KEY              Confluence space key for --title search
--title TITLE            resolve and fetch page by exact title
--cql CQL                search Confluence and fetch matching pages
--descendants            fetch descendant pages
--max-search-results N   limit CQL result fetches
--max-attachment-size S  skip attachment files larger than S (default 5mb; use unlimited to disable)
--force                  re-fetch even when local page version is current
--no-skip-unchanged      disable version/timestamp skip check
--retries N              retry transient HTTP failures
--request-timeout SEC    per-request timeout
--no-attachments         skip attachments
--no-browser-html        skip rendered browser HTML
bash
scripts/confluence-browser-fetch.js <URL|PAGE-ID> [...] [options]
重要选项:
bash
--site URL               Atlassian站点,例如https://example.atlassian.net
--raw-dir DIR            输出原始目录
--space KEY              用于--title搜索的Confluence空间键
--title TITLE            通过精确标题解析并获取页面
--cql CQL                搜索Confluence并获取匹配页面
--descendants            获取子页面
--max-search-results N   限制CQL结果获取数量
--max-attachment-size S  跳过大于S的附件文件(默认5mb;使用unlimited可禁用限制)
--force                  即使本地页面版本为最新,仍重新获取
--no-skip-unchanged      禁用版本/时间戳跳过检查
--retries N              重试临时HTTP失败
--request-timeout SEC    单请求超时时间
--no-attachments         跳过附件
--no-browser-html        跳过渲染后的浏览器HTML

Shared Atlassian SSO Session

共享Atlassian SSO会话

All five Atlassian skills (
jira-browser-fetch
,
jira-update
,
confluence-browser-fetch
,
confluence-update
,
bitbucket-browser-fetch
) default to the same Chrome profile (
~/.local/share/atlassian-browser-chrome
) and DevTools port (
9223
). Log in once via any skill and the others reuse that session automatically — no env vars needed.
This is a separate Chrome window from any browser the user already has open. The script always launches its own profile with remote-debugging enabled; cookies from the user's regular Chrome are not read. The user logs in inside the window the script opens; that session is then reused by every Atlassian skill until it expires.
Reuse signal. When attaching to an existing session, the script prints
Reusing Chrome DevTools on port 9223
and (if the target tab is open)
Found existing tab for <host>
. When you see those lines, do not ask the user to re-SSO — the session is already valid.
If Chrome/Chromium is installed via Flatpak, Snap, or another non-PATH location, set
CHROME=/path/to/launcher
(or a wrapper script) so the script can find the binary.
Override with
ATLASSIAN_CHROME_PROFILE
and/or
ATLASSIAN_CHROME_DEBUG_PORT
to relocate the shared profile/port, or use skill-specific
*_CHROME_PROFILE
/
*_CHROME_DEBUG_PORT
env vars for isolation.
所有五个Atlassian技能(
jira-browser-fetch
jira-update
confluence-browser-fetch
confluence-update
bitbucket-browser-fetch
)默认使用相同的Chrome配置文件(
~/.local/share/atlassian-browser-chrome
)和DevTools端口(
9223
)。通过任意技能登录一次后,其他技能会自动复用该会话——无需设置环境变量。
这是一个独立于用户已打开的浏览器的Chrome窗口。 脚本始终启动带有远程调试功能的专用配置文件;不会读取用户常规Chrome中的Cookie。用户在脚本打开的窗口中登录;该会话会被所有Atlassian技能复用,直到过期。
复用信号:当连接到现有会话时,脚本会打印
Reusing Chrome DevTools on port 9223
,如果目标标签页已打开,还会打印
Found existing tab for <host>
。当看到这些信息时,请勿要求用户重新进行SSO登录——会话已有效。
如果Chrome/Chromium是通过Flatpak、Snap或其他非PATH路径安装的,请设置
CHROME=/path/to/launcher
(或包装脚本),以便脚本找到二进制文件。
可通过
ATLASSIAN_CHROME_PROFILE
和/或
ATLASSIAN_CHROME_DEBUG_PORT
覆盖共享配置文件/端口,或使用技能专属的
*_CHROME_PROFILE
/
*_CHROME_DEBUG_PORT
环境变量进行隔离。

Typical Workflow

典型工作流程

  1. If the user gives a Confluence URL, run the script directly with that URL.
  2. If the user gives a title, ask for the space key or use
    --cql
    .
  3. Show the command before running it.
  4. If Chrome opens (first run or expired session), ask the user to complete SSO in that window. On subsequent invocations the script reuses the session silently — see the Reuse signal above.
  5. Verify saved files.
  6. If this is an LLM wiki ingest, process the saved
    raw/confluence/...
    material into
    wiki/
    per the project
    AGENTS.md
    .
Example:
bash
scripts/confluence-browser-fetch.js \
  "https://example.atlassian.net/wiki/spaces/ABC/pages/123456/Page+Title" \
  --site https://example.atlassian.net \
  --raw-dir ./raw
Fetch a page and all descendants:
bash
scripts/confluence-browser-fetch.js \
  123456 \
  --site https://example.atlassian.net \
  --raw-dir ./raw \
  --descendants
Fetch by CQL:
bash
scripts/confluence-browser-fetch.js \
  --site https://example.atlassian.net \
  --raw-dir ./raw \
  --cql 'space = ABC and type = page and text ~ "billing"'
  1. 如果用户提供Confluence URL,直接使用该URL运行脚本。
  2. 如果用户提供标题,询问空间键或使用
    --cql
    参数。
  3. 在运行前展示命令。
  4. 如果Chrome打开(首次运行或会话过期),请用户在该窗口中完成SSO登录。后续调用时,脚本会静默复用会话——请参考上述复用信号。
  5. 验证保存的文件。
  6. 如果是LLM wiki导入,请根据项目
    AGENTS.md
    将保存的
    raw/confluence/...
    内容处理到
    wiki/
    文件夹中。
示例:
bash
scripts/confluence-browser-fetch.js \
  "https://example.atlassian.net/wiki/spaces/ABC/pages/123456/Page+Title" \
  --site https://example.atlassian.net \
  --raw-dir ./raw
获取页面及其所有子页面:
bash
scripts/confluence-browser-fetch.js \
  123456 \
  --site https://example.atlassian.net \
  --raw-dir ./raw \
  --descendants
通过CQL搜索获取页面:
bash
scripts/confluence-browser-fetch.js \
  --site https://example.atlassian.net \
  --raw-dir ./raw \
  --cql 'space = ABC and type = page and text ~ "billing"'

Output Layout

输出结构

text
raw/confluence/<SPACE>/<PAGE-ID>-<slug>/
├── page.json          # Confluence REST content with storage/view HTML and metadata
├── page.storage.html  # Confluence storage format
├── page.view.html     # REST-rendered view body
├── page.browser.html  # browser page HTML, if enabled
├── metadata.json      # fetch metadata
├── attachments.json   # attachment manifest, including skipped large-file references
└── attachments/       # downloaded attachments under max-size threshold
A run manifest is written to:
text
raw/confluence-browser-fetch-run.json
text
raw/confluence/<SPACE>/<PAGE-ID>-<slug>/
├── page.json          # 包含存储/视图HTML和元数据的Confluence REST内容
├── page.storage.html  # Confluence存储格式
├── page.view.html     # REST渲染的视图主体
├── page.browser.html  # 浏览器页面HTML(若启用)
├── metadata.json      # 获取元数据
├── attachments.json   # 附件清单,包含被跳过的大文件引用
└── attachments/       # 下载的未超过最大大小限制的附件
运行清单会写入以下路径:
text
raw/confluence-browser-fetch-run.json

Installation / PATH

安装 / PATH

Use directly by path, or install a symlink:
bash
mkdir -p ~/.local/bin
ln -sf ~/.pi/agent/skills/confluence-browser-fetch/scripts/confluence-browser-fetch.js ~/.local/bin/confluence-browser-fetch
可直接通过路径使用,或创建符号链接:
bash
mkdir -p ~/.local/bin
ln -sf ~/.pi/agent/skills/confluence-browser-fetch/scripts/confluence-browser-fetch.js ~/.local/bin/confluence-browser-fetch

References

参考资料

  • Usage reference
  • Distribution guide
  • 使用参考
  • 分发指南