https://github.com/megamanics/replacor
Search & Replace CLI for Confluence Pages
https://github.com/megamanics/replacor
atlassian-confluence cli confluence nodejs rest-api
Last synced: 14 days ago
JSON representation
Search & Replace CLI for Confluence Pages
- Host: GitHub
- URL: https://github.com/megamanics/replacor
- Owner: megamanics
- License: gpl-3.0
- Created: 2022-06-10T19:29:11.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-24T19:45:16.000Z (over 2 years ago)
- Last Synced: 2026-04-30T16:27:58.960Z (about 2 months ago)
- Topics: atlassian-confluence, cli, confluence, nodejs, rest-api
- Language: JavaScript
- Homepage:
- Size: 246 KB
- Stars: 1
- Watchers: 0
- Forks: 3
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
[](https://github.com/megamanics/replacor/actions/workflows/codeql-analysis.yml)
[](https://github.com/megamanics/replacor/actions/workflows/eslint.yml)
[](https://api.securityscorecards.dev/projects/github.com/megamanics/replacor)
# Pre-Reqs for this
* [Install node.js](https://nodejs.org/en/)
* [API Token with scope read:content-details:confluence,write:content:confluence](https://id.atlassian.com/manage/api-tokens)
# Setup
```
gh repo clone megamanics/replacor
cd replacor
npm install
```
# Search CLI
```
./search.js -h
Usage: search.js [options]
CLI to search Confluence Pages
Options:
-V, --version output the version number
-q, --query CQL query to search for, eg: text~gitlab
-u, --user user eg: your_email@domain.com
-t, --token your_user_api_token with scope read:content-details:confluence,write:content:confluence
-d, --domain eg: https://.atlassian.net
-h, --help display help for command
```
example of an execution
```
./search.js -u $CONFLUENCE_USER -t $CONFLUENCE_TOKEN -d $CONFLUENCE_DOMAIN -q text~bitbucket.com
```
# Search & Replace CLI
```
./replace.js -h
Usage: replace.js [options]
CLI to replace strings in Confluence Pages
Options:
-V, --version output the version number
-q, --query CQL query used to search pages, eg: text~gitlab
-s, --search string to replace eg: gitlab
-r, --replace replacement string eg: gitlab -> github
-u, --user user eg: your_email@domain.com
-t, --token your_user_api_token with scope read:content-details:confluence,write:content:confluence
-d, --domain eg: https://.atlassian.net
-l, --loglevel loglevel, eg: debug, info, warn, error, fatal
-c, --convertbburl convert bitbucket url format to github url format
--dryrun dry run only
-h, --help display help for command
```
example of an execution
```
./replace.js -u $CONFLUENCE_USER -t $CONFLUENCE_TOKEN -d $CONFLUENCE_DOMAIN -q text~searchexpression -s -r --convertbburl --dryrun
```
### Advanced Search Strings
### To restrict search within a space
```
space = DEV and text~gitlab
```
# Reference
https://developer.atlassian.com/server/confluence/advanced-searching-using-cql
https://developer.atlassian.com/server/confluence/performing-text-searches-using-cql