prompt-exporter 2.0.1

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,128 @@
1
+ # prompt-exporter — Developer Guide
2
+
3
+ ## Overview
4
+
5
+ TypeScript ESM CLI that:
6
+
7
+ 1. Talks to a **source** (first: ChatGPT via Chromium CDP in-page `fetch`)
8
+ 2. Writes JSON + Markdown under `~/.prompt-exporter/{source}/`
9
+ 3. Registers sources in `src/sources/registry.ts`
10
+
11
+ ## Layout
12
+
13
+ ```text
14
+ src/
15
+ cli/ # commander entry + commands
16
+ sources/
17
+ types.ts # Source interface
18
+ registry.ts
19
+ chatgpt/ # chatgpt source (api/, index.ts)
20
+ services/ # storage, markdown, backup (source-agnostic)
21
+ utils/ # paths, credentials, cdp, browser
22
+ aur/
23
+ prompt-exporter/ # AUR stable (GitHub tag tarball)
24
+ prompt-exporter-git/ # AUR VCS (tracks master)
25
+ publish.sh
26
+ ```
27
+
28
+ ## Release (2.0.x)
29
+
30
+ `package.json` is track `package.json` (currently 2.0.1). Shipping steps:
31
+
32
+ ### 1. Push release prep (this commit) and tag
33
+
34
+ ```bash
35
+ cd /path/to/prompt-exporter
36
+ git push origin master
37
+
38
+ git tag -a v2.0.0 -m "prompt-exporter 2.0.0"
39
+ git push origin v2.0.0
40
+ ```
41
+
42
+ ### 2. GitHub Release
43
+
44
+ ```bash
45
+ # If gh is installed:
46
+ gh release create v2.0.0 --title "2.0.0" --notes-file - <<'EOF'
47
+ See CHANGELOG.md for breaking changes (rebrand, Apache-2.0, multi-source layout).
48
+ EOF
49
+
50
+ # Or: GitHub → Releases → Draft from tag v2.0.0 → paste CHANGELOG 2.0.0 section
51
+ ```
52
+
53
+ ### 3. Fill AUR stable checksum
54
+
55
+ ```bash
56
+ TARBALL_URL="https://github.com/azbarcea/prompt-exporter/archive/refs/tags/v2.0.0.tar.gz"
57
+ SUM=$(curl -sL "$TARBALL_URL" | sha256sum | awk '{print $1}')
58
+ echo "$SUM"
59
+
60
+ # Update aur/prompt-exporter/PKGBUILD sha256sums and regenerate .SRCINFO:
61
+ sed -i "s/sha256sums=.*/sha256sums=('${SUM}')/" aur/prompt-exporter/PKGBUILD
62
+ ( cd aur/prompt-exporter && makepkg --printsrcinfo > .SRCINFO )
63
+
64
+ git add aur/prompt-exporter
65
+ git commit -m "chore(aur): set sha256 for prompt-exporter 2.0.0"
66
+ git push origin master
67
+ ```
68
+
69
+ ### 4. Publish AUR packages
70
+
71
+ Requires SSH key registered on [AUR](https://aur.archlinux.org) (`ssh aur@aur.archlinux.org`).
72
+
73
+ ```bash
74
+ # First-time package names (if empty clone fails, publish.sh inits and pushes):
75
+ ./aur/publish.sh prompt-exporter # stable 2.0.0
76
+ ./aur/publish.sh prompt-exporter-git # rolling
77
+ ```
78
+
79
+ If `prompt-exporter` or `prompt-exporter-git` does not exist yet on AUR, create them once via the AUR web UI (“Submit”) or by pushing a new empty repo with `git push -u origin master` after the script’s `git init` path — you must be logged in as the maintainer.
80
+
81
+ ### 5. Optional: npm registry
82
+
83
+ Not required (install via `github:azbarcea/prompt-exporter` works). To publish:
84
+
85
+ ```bash
86
+ npm login
87
+ npm publish --access public
88
+ ```
89
+
90
+ ### 6. Smoke after install
91
+
92
+ ```bash
93
+ yay -S prompt-exporter
94
+ prompt-exporter --version # 2.0.0
95
+ prompt-exporter sources
96
+ ```
97
+
98
+ ## Develop
99
+
100
+ ```bash
101
+ git clone https://github.com/azbarcea/prompt-exporter.git
102
+ cd prompt-exporter
103
+ npm install
104
+ npm run typecheck
105
+ npm test
106
+ npm run dev -- --help
107
+ npm run dev -- sync --source chatgpt -v
108
+ ```
109
+
110
+ ## Paths
111
+
112
+ | Helper | Default |
113
+ |--------|---------|
114
+ | `getConfigDir()` | `~/.prompt-exporter` |
115
+ | `getSourceDataDir('chatgpt')` | `~/.prompt-exporter/chatgpt` |
116
+ | `getSourceTokenPath('chatgpt')` | `~/.prompt-exporter/sources/chatgpt/token` |
117
+
118
+ Env: `PROMPT_EXPORTER_HOME`, `PROMPT_EXPORTER_DATA`, `PROMPT_EXPORTER_BROWSER`, `PROMPT_EXPORTER_CDP_PORT`.
119
+
120
+ ## Adding a source
121
+
122
+ 1. Implement `Source` in `src/sources/<id>/`
123
+ 2. Register in `src/sources/registry.ts`
124
+ 3. Wire `sync` / `list` in `src/cli/index.ts` for that id
125
+
126
+ ## License
127
+
128
+ Apache-2.0 — `LICENSE` + `NOTICE`.
@@ -0,0 +1,116 @@
1
+ # prompt-exporter — User Guide
2
+
3
+ ## Purpose
4
+
5
+ **prompt-exporter** downloads conversation history from AI chat products (**sources**) so you can:
6
+
7
+ - Keep a local, searchable archive (JSON + Markdown)
8
+ - Re-sync incrementally as chats change
9
+ - Hand transcripts to another AI as context
10
+
11
+ The first source is **chatgpt** (chatgpt.com). Planned next: Claude, Gemini, Copilot, Perplexity, and Grok.
12
+
13
+ **Platforms:** Linux is supported today; Windows and macOS are in focus for CDP/browser path parity.
14
+
15
+ ## Install
16
+
17
+ ### Arch Linux (AUR)
18
+
19
+ ```bash
20
+ # Stable release (recommended)
21
+ yay -S prompt-exporter
22
+
23
+ # Or track git master
24
+ yay -S prompt-exporter-git
25
+ ```
26
+
27
+ ### From GitHub (npm package)
28
+
29
+ ```bash
30
+ npm install -g github:azbarcea/prompt-exporter
31
+ ```
32
+
33
+ ### From source
34
+
35
+ ```bash
36
+ git clone https://github.com/azbarcea/prompt-exporter.git
37
+ cd prompt-exporter
38
+ npm install
39
+ npm run build
40
+ ```
41
+
42
+ Install the CLI (pick one):
43
+
44
+ ```bash
45
+ # User scope (recommended)
46
+ npm config set prefix "$HOME/.local"
47
+ npm install -g .
48
+ export PATH="$HOME/.local/bin:$PATH" # add to shell rc if needed
49
+
50
+ # Global
51
+ npm install -g .
52
+
53
+ # Dev link
54
+ npm link
55
+ ```
56
+
57
+ ## Layout
58
+
59
+ ```text
60
+ ~/.prompt-exporter/
61
+ chatgpt/ # --source chatgpt data root
62
+ conversations/
63
+ YYYY-mm-dd-HHMM.Title.md
64
+ json/<id>.json
65
+ projects/
66
+ metadata.json
67
+ backup.log
68
+ sources/
69
+ chatgpt/token
70
+ chromium/ # only with: chromium start --isolated
71
+ ```
72
+
73
+ | Variable / flag | Meaning |
74
+ |-----------------|---------|
75
+ | `-s` / `--source` | Source id (default: `chatgpt`) |
76
+ | `-o` / `--output` | Override that source’s data directory |
77
+ | `PROMPT_EXPORTER_HOME` | Replace `~/.prompt-exporter` |
78
+ | `PROMPT_EXPORTER_DATA` | Parent of source dirs |
79
+ | `PROMPT_EXPORTER_BROWSER` | Chromium binary |
80
+ | `PROMPT_EXPORTER_CHATGPT_TOKEN` | Optional Bearer for chatgpt |
81
+
82
+ ## Typical workflow
83
+
84
+ ```bash
85
+ prompt-exporter chromium start
86
+ prompt-exporter sync --source chatgpt
87
+ prompt-exporter sync --download-files
88
+ prompt-exporter sync --no-incremental # force full re-download
89
+ prompt-exporter sources
90
+ ```
91
+
92
+ `sync` is incremental by default (skips unchanged `update_time`).
93
+
94
+ Auth prefers a logged-in Chromium CDP session. Node Bearer alone is often blocked by Cloudflare.
95
+
96
+ ## Commands
97
+
98
+ ```text
99
+ prompt-exporter --help
100
+ prompt-exporter sources
101
+ prompt-exporter chromium start --help
102
+ prompt-exporter sync --help
103
+ ```
104
+
105
+ | Command | What it does |
106
+ |---------|----------------|
107
+ | `sources` | List registered sources |
108
+ | `chromium start` | Start/reuse Chromium with CDP |
109
+ | `token` | Extract/save chatgpt accessToken |
110
+ | `sync` / `backup` | Download conversations |
111
+ | `list` | Preview conversations |
112
+ | `projects` | List ChatGPT projects |
113
+
114
+ ## Privacy
115
+
116
+ Runs locally. Contacts the source site with your session. No telemetry.
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "prompt-exporter",
3
+ "version": "2.0.1",
4
+ "description": "CLI to sync AI conversation prompts from multiple sources (ChatGPT first) to local JSON + Markdown",
5
+ "license": "Apache-2.0",
6
+ "author": "Alexandru Zbarcea <alexz@apache.org>",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "bin": {
10
+ "prompt-exporter": "dist/index.js"
11
+ },
12
+ "files": [
13
+ "dist",
14
+ "docs",
15
+ "LICENSE",
16
+ "NOTICE",
17
+ "README.md"
18
+ ],
19
+ "engines": {
20
+ "node": ">=20"
21
+ },
22
+ "scripts": {
23
+ "dev": "tsx src/index.ts",
24
+ "build": "tsup src/index.ts --format esm --dts --clean",
25
+ "start": "node dist/index.js",
26
+ "prepublishOnly": "npm run build",
27
+ "typecheck": "tsc --noEmit",
28
+ "test": "npm run build && tsx --test tests/*.test.ts",
29
+ "test:unit": "tsx --test tests/*.test.ts",
30
+ "ci": "npm run typecheck && npm run test"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/azbarcea/prompt-exporter.git"
35
+ },
36
+ "keywords": [
37
+ "prompt",
38
+ "chatgpt",
39
+ "export",
40
+ "backup",
41
+ "cli",
42
+ "markdown"
43
+ ],
44
+ "dependencies": {
45
+ "chalk": "^5.3.0",
46
+ "cli-progress": "^3.12.0",
47
+ "commander": "^14.0.3",
48
+ "ora": "^9.3.0",
49
+ "zod": "^4.3.6"
50
+ },
51
+ "devDependencies": {
52
+ "@types/cli-progress": "^3.11.5",
53
+ "@types/node": "^25.3.0",
54
+ "tsup": "^8.1.0",
55
+ "tsx": "^4.15.0",
56
+ "typescript": "^5.4.5"
57
+ },
58
+ "bugs": {
59
+ "url": "https://github.com/azbarcea/prompt-exporter/issues"
60
+ },
61
+ "homepage": "https://github.com/azbarcea/prompt-exporter"
62
+ }