client-handover 1.0.2 → 1.0.4

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.
Files changed (4) hide show
  1. package/README.md +207 -203
  2. package/cli.js +128 -125
  3. package/generator.js +28 -1
  4. package/package.json +44 -43
package/README.md CHANGED
@@ -1,203 +1,207 @@
1
- # client-handover
2
-
3
- AI-powered handover document generator for frontend developers handing off websites to clients.
4
-
5
- Run one command. Get a professional handover document in Markdown, plain text, and HTML — written for both your client and the next developer.
6
-
7
- Uses the [Claude API](https://console.anthropic.com) (Anthropic) under the hood.
8
-
9
- ---
10
-
11
- ## Install
12
-
13
- ```bash
14
- npm install -g client-handover
15
- ```
16
-
17
- Then set your Anthropic API key as an environment variable:
18
-
19
- ```bash
20
- # macOS / Linux
21
- export ANTHROPIC_API_KEY=your_key_here
22
-
23
- # Windows (Command Prompt)
24
- set ANTHROPIC_API_KEY=your_key_here
25
-
26
- # Windows (PowerShell)
27
- $env:ANTHROPIC_API_KEY="your_key_here"
28
- ```
29
-
30
- Get a free API key at [console.anthropic.com](https://console.anthropic.com)
31
-
32
- ---
33
-
34
- ## Quick start
35
-
36
- ```bash
37
- handover handover
38
- ```
39
-
40
- This generates a full handover document with placeholder content in an `output/` folder in your current directory.
41
-
42
- ---
43
-
44
- ## Commands
45
-
46
- | Command | Description |
47
- |---------|-------------|
48
- | `all` | Every section as separate files in one folder |
49
- | `handover` | Full handover document (all sections combined) |
50
- | `setup` | Project setup & dependencies |
51
- | `deploy` | Deployment & hosting info |
52
- | `credentials` | Logins & API keys template |
53
- | `license` | Licensing & attribution |
54
-
55
- ---
56
-
57
- ## Usage
58
-
59
- ### With your own project notes
60
-
61
- Create a plain text file describing your project:
62
-
63
- ```
64
- project-info.txt
65
- ----------------
66
- Project: Acme Corp website
67
- Stack: Vue 3, Vite, Netlify
68
- Repo: https://github.com/you/acme
69
- Live URL: https://acmecorp.com
70
- Hosting: Netlify (free tier)
71
- Domain: Namecheap, auto-renews Jan 2026
72
- CMS: Netlify CMS
73
- Analytics: Google Analytics 4
74
- APIs: Mailchimp (newsletter), Stripe (payments)
75
- ```
76
-
77
- Then run any command with that file as input:
78
-
79
- ```bash
80
- # Every section as separate files in one folder
81
- handover all project-info.txt acme-client
82
-
83
- # Full combined doc
84
- handover handover project-info.txt
85
-
86
- # Full combined doc with a custom output filename
87
- handover handover project-info.txt acme-handover
88
-
89
- # Individual sections
90
- handover setup project-info.txt
91
- handover deploy project-info.txt
92
- handover credentials project-info.txt
93
- handover license project-info.txt
94
- ```
95
-
96
- The more detail you put in your project-info file, the more accurate and useful the output will be.
97
-
98
- ---
99
-
100
- ## Output
101
-
102
- All commands generate three files per section inside an `output/` folder.
103
-
104
- **Single command** (e.g. `handover`):
105
- ```
106
- output/
107
- ├── handover.md ← Paste into Notion, GitHub, or a README
108
- ├── handover.txt ← Clean plain text for email or printing
109
- └── handover.html ← Styled HTML ready to send directly to a client
110
- ```
111
-
112
- **`all` command** every section in its own subfolder:
113
- ```
114
- output/acme-client/
115
- ├── handover.md / .txt / .html
116
- ├── setup.md / .txt / .html
117
- ├── deploy.md / .txt / .html
118
- ├── credentials.md / .txt / .html
119
- └── license.md / .txt / .html
120
- ```
121
-
122
- | Format | Best for |
123
- |--------|----------|
124
- | `.md` | Notion, GitHub, linear docs |
125
- | `.txt` | Email attachments, printing |
126
- | `.html`| Sending directly to a client |
127
-
128
- ---
129
-
130
- ## Use as a library
131
-
132
- You can also import the prompt builders and doc generator directly into your own project:
133
-
134
- ```js
135
- import { handover, setup, generateDoc } from 'client-handover'
136
-
137
- // Build a prompt from your project info string
138
- const prompt = handover('Vue 3 project hosted on Vercel, domain on Cloudflare...')
139
-
140
- // Generate and save the document
141
- await generateDoc(prompt, 'my-client', './docs')
142
- ```
143
-
144
- ### Available exports
145
-
146
- | Export | Type | Description |
147
- |--------|------|-------------|
148
- | `generateDoc(prompt, name, dir)` | async function | Calls Claude API and writes `.md`, `.txt`, `.html` |
149
- | `handover(projectInfo)` | function | Prompt builder for full handover doc |
150
- | `setup(projectInfo)` | function | Prompt builder for setup section |
151
- | `deploy(projectInfo)` | function | Prompt builder for deployment section |
152
- | `credentials(projectInfo)` | function | Prompt builder for credentials section |
153
- | `license(projectInfo)` | function | Prompt builder for licensing section |
154
-
155
- All prompt builders accept an optional `projectInfo` string. If omitted, Claude generates placeholder content.
156
-
157
- ---
158
-
159
- ## Requirements
160
-
161
- - Node.js 18+
162
- - An Anthropic API key — [get one free at console.anthropic.com](https://console.anthropic.com)
163
-
164
- ---
165
-
166
- ## How it works
167
-
168
- 1. You provide a plain text description of your project (or nothing, for placeholder output)
169
- 2. The CLI builds a structured prompt for Claude
170
- 3. Claude generates a professional, dual-audience document (plain English for clients, technical detail for developers)
171
- 4. The output is saved as `.md`, `.txt`, and `.html`
172
-
173
- Each document section is written for **two audiences**:
174
- - **The client** plain English, reassuring tone, no jargon
175
- - **The next developer** precise technical detail, commands, file paths
176
-
177
- ---
178
-
179
- ## Project structure
180
-
181
- ```
182
- client-handover/
183
- ├── cli.js # CLI entry point
184
- ├── index.js # Library exports
185
- ├── generator.js # Claude API call + file output
186
- ├── handover.js # Full handover prompt builder
187
- ├── setup.js # Setup section prompt builder
188
- ├── deploy.js # Deployment section prompt builder
189
- ├── credentials.js # Credentials section prompt builder
190
- └── license.js # Licensing section prompt builder
191
- ```
192
-
193
- ---
194
-
195
- ## Contributing
196
-
197
- Pull requests are welcome. For major changes, open an issue first.
198
-
199
- ---
200
-
201
- ## License
202
-
203
- MIT
1
+ # claude-client-handover
2
+
3
+ AI-powered handover document generator for frontend developers handing off websites to clients.
4
+
5
+ Run one command. Get a professional handover document in Markdown, plain text, and HTML — written for both your client and the next developer.
6
+
7
+ Uses the [Claude API](https://console.anthropic.com) (Anthropic) under the hood.
8
+
9
+ ---
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install -g client-handover
15
+ ```
16
+
17
+ ### API key setup
18
+
19
+ **If you have Claude Code installed**, no setup needed — `client-handover` will automatically use your existing Claude credentials.
20
+
21
+ **Otherwise**, set your Anthropic API key as an environment variable:
22
+
23
+ ```bash
24
+ # macOS / Linux
25
+ export ANTHROPIC_API_KEY=your_key_here
26
+
27
+ # Windows (Command Prompt)
28
+ set ANTHROPIC_API_KEY=your_key_here
29
+
30
+ # Windows (PowerShell)
31
+ $env:ANTHROPIC_API_KEY="your_key_here"
32
+ ```
33
+
34
+ Get a free API key at [console.anthropic.com](https://console.anthropic.com)
35
+
36
+ ---
37
+
38
+ ## Quick start
39
+
40
+ ```bash
41
+ handover handover
42
+ ```
43
+
44
+ This generates a full handover document with placeholder content in an `output/` folder in your current directory.
45
+
46
+ ---
47
+
48
+ ## Commands
49
+
50
+ | Command | Description |
51
+ |---------|-------------|
52
+ | `all` | Every section as separate files in one folder |
53
+ | `handover` | Full handover document (all sections combined) |
54
+ | `setup` | Project setup & dependencies |
55
+ | `deploy` | Deployment & hosting info |
56
+ | `credentials` | Logins & API keys template |
57
+ | `license` | Licensing & attribution |
58
+
59
+ ---
60
+
61
+ ## Usage
62
+
63
+ ### With your own project notes
64
+
65
+ Create a plain text file describing your project:
66
+
67
+ ```
68
+ project-info.txt
69
+ ----------------
70
+ Project: Acme Corp website
71
+ Stack: Vue 3, Vite, Netlify
72
+ Repo: https://github.com/you/acme
73
+ Live URL: https://acmecorp.com
74
+ Hosting: Netlify (free tier)
75
+ Domain: Namecheap, auto-renews Jan 2026
76
+ CMS: Netlify CMS
77
+ Analytics: Google Analytics 4
78
+ APIs: Mailchimp (newsletter), Stripe (payments)
79
+ ```
80
+
81
+ Then run any command with that file as input:
82
+
83
+ ```bash
84
+ # Every section as separate files in one folder
85
+ handover all project-info.txt acme-client
86
+
87
+ # Full combined doc
88
+ handover handover project-info.txt
89
+
90
+ # Full combined doc with a custom output filename
91
+ handover handover project-info.txt acme-handover
92
+
93
+ # Individual sections
94
+ handover setup project-info.txt
95
+ handover deploy project-info.txt
96
+ handover credentials project-info.txt
97
+ handover license project-info.txt
98
+ ```
99
+
100
+ The more detail you put in your project-info file, the more accurate and useful the output will be.
101
+
102
+ ---
103
+
104
+ ## Output
105
+
106
+ All commands generate three files per section inside an `output/` folder.
107
+
108
+ **Single command** (e.g. `handover`):
109
+ ```
110
+ output/
111
+ ├── handover.md ← Paste into Notion, GitHub, or a README
112
+ ├── handover.txt ← Clean plain text for email or printing
113
+ └── handover.html ← Styled HTML ready to send directly to a client
114
+ ```
115
+
116
+ **`all` command** every section in its own subfolder:
117
+ ```
118
+ output/acme-client/
119
+ ├── handover.md / .txt / .html
120
+ ├── setup.md / .txt / .html
121
+ ├── deploy.md / .txt / .html
122
+ ├── credentials.md / .txt / .html
123
+ └── license.md / .txt / .html
124
+ ```
125
+
126
+ | Format | Best for |
127
+ |--------|----------|
128
+ | `.md` | Notion, GitHub, linear docs |
129
+ | `.txt` | Email attachments, printing |
130
+ | `.html`| Sending directly to a client |
131
+
132
+ ---
133
+
134
+ ## Use as a library
135
+
136
+ You can also import the prompt builders and doc generator directly into your own project:
137
+
138
+ ```js
139
+ import { handover, setup, generateDoc } from 'client-handover'
140
+
141
+ // Build a prompt from your project info string
142
+ const prompt = handover('Vue 3 project hosted on Vercel, domain on Cloudflare...')
143
+
144
+ // Generate and save the document
145
+ await generateDoc(prompt, 'my-client', './docs')
146
+ ```
147
+
148
+ ### Available exports
149
+
150
+ | Export | Type | Description |
151
+ |--------|------|-------------|
152
+ | `generateDoc(prompt, name, dir)` | async function | Calls Claude API and writes `.md`, `.txt`, `.html` |
153
+ | `handover(projectInfo)` | function | Prompt builder for full handover doc |
154
+ | `setup(projectInfo)` | function | Prompt builder for setup section |
155
+ | `deploy(projectInfo)` | function | Prompt builder for deployment section |
156
+ | `credentials(projectInfo)` | function | Prompt builder for credentials section |
157
+ | `license(projectInfo)` | function | Prompt builder for licensing section |
158
+
159
+ All prompt builders accept an optional `projectInfo` string. If omitted, Claude generates placeholder content.
160
+
161
+ ---
162
+
163
+ ## Requirements
164
+
165
+ - Node.js 18+
166
+ - An Anthropic API key — [get one free at console.anthropic.com](https://console.anthropic.com)
167
+
168
+ ---
169
+
170
+ ## How it works
171
+
172
+ 1. You provide a plain text description of your project (or nothing, for placeholder output)
173
+ 2. The CLI builds a structured prompt for Claude
174
+ 3. Claude generates a professional, dual-audience document (plain English for clients, technical detail for developers)
175
+ 4. The output is saved as `.md`, `.txt`, and `.html`
176
+
177
+ Each document section is written for **two audiences**:
178
+ - **The client** — plain English, reassuring tone, no jargon
179
+ - **The next developer** — precise technical detail, commands, file paths
180
+
181
+ ---
182
+
183
+ ## Project structure
184
+
185
+ ```
186
+ client-handover/
187
+ ├── cli.js # CLI entry point
188
+ ├── index.js # Library exports
189
+ ├── generator.js # Claude API call + file output
190
+ ├── handover.js # Full handover prompt builder
191
+ ├── setup.js # Setup section prompt builder
192
+ ├── deploy.js # Deployment section prompt builder
193
+ ├── credentials.js # Credentials section prompt builder
194
+ └── license.js # Licensing section prompt builder
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Contributing
200
+
201
+ Pull requests are welcome. For major changes, open an issue first.
202
+
203
+ ---
204
+
205
+ ## License
206
+
207
+ MIT
package/cli.js CHANGED
@@ -1,125 +1,128 @@
1
- #!/usr/bin/env node
2
-
3
- import { setup } from './setup.js'
4
- import { deploy } from './deploy.js'
5
- import { credentials } from './credentials.js'
6
- import { handover } from './handover.js'
7
- import { license } from './license.js'
8
- import { generateDoc } from './generator.js'
9
- import chalk from 'chalk'
10
- import fs from 'fs'
11
-
12
- const COMMANDS = {
13
- 'setup': { fn: setup, label: 'Project Setup & Dependencies' },
14
- 'deploy': { fn: deploy, label: 'Deployment & Hosting' },
15
- 'credentials': { fn: credentials, label: 'Credentials & Access' },
16
- 'handover': { fn: handover, label: 'Full Handover Document' },
17
- 'license': { fn: license, label: 'Licensing & Attribution' },
18
- }
19
-
20
- function normalizeCommand(cmd) {
21
- return cmd.replace(/^\/+/, '')
22
- }
23
-
24
- function printHelp() {
25
- console.log(chalk.bold('\n🚀 handover-cli — Frontend Website Handover - by Scott AK (sabrkei)\n'))
26
- console.log(chalk.dim('Usage:'))
27
- console.log(' handover <command> [project-info-file] [output-name]\n')
28
- console.log(chalk.dim('Commands:'))
29
- Object.entries(COMMANDS).forEach(([cmd, { label }]) => {
30
- console.log(` ${chalk.cyan(cmd.padEnd(16))} ${label}`)
31
- })
32
- console.log(` ${chalk.cyan('all'.padEnd(16))} All sections in a single folder`)
33
- console.log('\n' + chalk.dim('Examples:'))
34
- console.log(' handover handover # Full doc with placeholders')
35
- console.log(' handover setup project-info.txt # Setup section using your notes')
36
- console.log(' handover handover project-info.txt my-client # Full doc, custom filename')
37
- console.log(' handover all project-info.txt acme-client # Every section in output/acme-client/')
38
- console.log()
39
- }
40
-
41
- async function runAll(projectInfo, folderName) {
42
- const sections = [
43
- { key: 'handover', fn: handover, label: 'Full Handover Document' },
44
- { key: 'setup', fn: setup, label: 'Project Setup & Dependencies' },
45
- { key: 'deploy', fn: deploy, label: 'Deployment & Hosting' },
46
- { key: 'credentials', fn: credentials, label: 'Credentials & Access' },
47
- { key: 'license', fn: license, label: 'Licensing & Attribution' },
48
- ]
49
-
50
- const outputDir = `./output/${folderName}`
51
-
52
- console.log(chalk.bold(`\n📁 Generating all sections into: ${outputDir}\n`))
53
-
54
- for (const section of sections) {
55
- console.log(chalk.bold(`📝 Generating: ${section.label}`))
56
- const prompt = section.fn(projectInfo)
57
- await generateDoc(prompt, section.key, outputDir)
58
- console.log()
59
- }
60
-
61
- console.log(chalk.green.bold(`✅ All sections saved to ${outputDir}\n`))
62
- }
63
-
64
- async function main() {
65
- const [,, rawCommand, infoFile, outputName] = process.argv
66
-
67
- if (!rawCommand || rawCommand === '--help' || rawCommand === '-h') {
68
- printHelp()
69
- process.exit(0)
70
- }
71
-
72
- const command = normalizeCommand(rawCommand)
73
-
74
- // Read optional project info file
75
- let projectInfo = ''
76
- if (infoFile) {
77
- if (!fs.existsSync(infoFile)) {
78
- console.error(chalk.red(`\n❌ File not found: ${infoFile}\n`))
79
- process.exit(1)
80
- }
81
- projectInfo = fs.readFileSync(infoFile, 'utf-8')
82
- console.log(chalk.green(`\n📄 Loaded project info from: ${infoFile}`))
83
- }
84
-
85
- if (command === 'all') {
86
- const folderName = outputName || 'all'
87
- try {
88
- await runAll(projectInfo, folderName)
89
- } catch (err) {
90
- if (err.status === 401) {
91
- console.error(chalk.red('\n❌ Invalid API key. Set your ANTHROPIC_API_KEY environment variable.\n'))
92
- } else {
93
- console.error(chalk.red(`\n❌ Error: ${err.message}\n`))
94
- }
95
- process.exit(1)
96
- }
97
- return
98
- }
99
-
100
- const entry = COMMANDS[command]
101
- if (!entry) {
102
- console.error(chalk.red(`\n❌ Unknown command: ${rawCommand}\n`))
103
- printHelp()
104
- process.exit(1)
105
- }
106
-
107
- const docName = outputName || command
108
- const prompt = entry.fn(projectInfo)
109
-
110
- console.log(chalk.bold(`\n📝 Generating: ${entry.label}`))
111
- console.log(chalk.dim(` Output: ./output/${docName}.{md,txt,html}\n`))
112
-
113
- try {
114
- await generateDoc(prompt, docName, './output')
115
- } catch (err) {
116
- if (err.status === 401) {
117
- console.error(chalk.red('\n❌ Invalid API key. Set your ANTHROPIC_API_KEY environment variable.\n'))
118
- } else {
119
- console.error(chalk.red(`\n❌ Error: ${err.message}\n`))
120
- }
121
- process.exit(1)
122
- }
123
- }
124
-
125
- main()
1
+ #!/usr/bin/env node
2
+
3
+ import { setup } from './setup.js'
4
+ import { deploy } from './deploy.js'
5
+ import { credentials } from './credentials.js'
6
+ import { handover } from './handover.js'
7
+ import { license } from './license.js'
8
+ import { generateDoc } from './generator.js'
9
+ import chalk from 'chalk'
10
+ import fs from 'fs'
11
+ import path from 'path'
12
+
13
+ const COMMANDS = {
14
+ 'setup': { fn: setup, label: 'Project Setup & Dependencies' },
15
+ 'deploy': { fn: deploy, label: 'Deployment & Hosting' },
16
+ 'credentials': { fn: credentials, label: 'Credentials & Access' },
17
+ 'handover': { fn: handover, label: 'Full Handover Document' },
18
+ 'license': { fn: license, label: 'Licensing & Attribution' },
19
+ }
20
+
21
+ function normalizeCommand(cmd) {
22
+ // Git Bash converts /handover → C:\Program Files\Git\handover before Node sees it
23
+ // path.basename extracts just the last segment regardless of what form it arrives in
24
+ return path.basename(cmd).replace(/^\/+/, '')
25
+ }
26
+
27
+ function printHelp() {
28
+ console.log(chalk.bold('\n🚀 handover-cli — Frontend Website Handover - by Scott AK (sabrkei)\n'))
29
+ console.log(chalk.dim('Usage:'))
30
+ console.log(' handover <command> [project-info-file] [output-name]\n')
31
+ console.log(chalk.dim('Commands:'))
32
+ Object.entries(COMMANDS).forEach(([cmd, { label }]) => {
33
+ console.log(` ${chalk.cyan(cmd.padEnd(16))} ${label}`)
34
+ })
35
+ console.log(` ${chalk.cyan('all'.padEnd(16))} All sections in a single folder`)
36
+ console.log('\n' + chalk.dim('Examples:'))
37
+ console.log(' handover handover # Full doc with placeholders')
38
+ console.log(' handover setup project-info.txt # Setup section using your notes')
39
+ console.log(' handover handover project-info.txt my-client # Full doc, custom filename')
40
+ console.log(' handover all project-info.txt acme-client # Every section in output/acme-client/')
41
+ console.log()
42
+ }
43
+
44
+ async function runAll(projectInfo, folderName) {
45
+ const sections = [
46
+ { key: 'handover', fn: handover, label: 'Full Handover Document' },
47
+ { key: 'setup', fn: setup, label: 'Project Setup & Dependencies' },
48
+ { key: 'deploy', fn: deploy, label: 'Deployment & Hosting' },
49
+ { key: 'credentials', fn: credentials, label: 'Credentials & Access' },
50
+ { key: 'license', fn: license, label: 'Licensing & Attribution' },
51
+ ]
52
+
53
+ const outputDir = `./output/${folderName}`
54
+
55
+ console.log(chalk.bold(`\n📁 Generating all sections into: ${outputDir}\n`))
56
+
57
+ for (const section of sections) {
58
+ console.log(chalk.bold(`📝 Generating: ${section.label}`))
59
+ const prompt = section.fn(projectInfo)
60
+ await generateDoc(prompt, section.key, outputDir)
61
+ console.log()
62
+ }
63
+
64
+ console.log(chalk.green.bold(`✅ All sections saved to ${outputDir}\n`))
65
+ }
66
+
67
+ async function main() {
68
+ const [,, rawCommand, infoFile, outputName] = process.argv
69
+
70
+ if (!rawCommand || rawCommand === '--help' || rawCommand === '-h') {
71
+ printHelp()
72
+ process.exit(0)
73
+ }
74
+
75
+ const command = normalizeCommand(rawCommand)
76
+
77
+ // Read optional project info file
78
+ let projectInfo = ''
79
+ if (infoFile) {
80
+ if (!fs.existsSync(infoFile)) {
81
+ console.error(chalk.red(`\n❌ File not found: ${infoFile}\n`))
82
+ process.exit(1)
83
+ }
84
+ projectInfo = fs.readFileSync(infoFile, 'utf-8')
85
+ console.log(chalk.green(`\n📄 Loaded project info from: ${infoFile}`))
86
+ }
87
+
88
+ if (command === 'all') {
89
+ const folderName = outputName || 'all'
90
+ try {
91
+ await runAll(projectInfo, folderName)
92
+ } catch (err) {
93
+ if (err.status === 401) {
94
+ console.error(chalk.red('\n❌ Authentication failed. Set ANTHROPIC_API_KEY or install Claude Code.\n'))
95
+ } else {
96
+ console.error(chalk.red(`\n❌ Error: ${err.message}\n`))
97
+ }
98
+ process.exit(1)
99
+ }
100
+ return
101
+ }
102
+
103
+ const entry = COMMANDS[command]
104
+ if (!entry) {
105
+ console.error(chalk.red(`\n❌ Unknown command: ${rawCommand}\n`))
106
+ printHelp()
107
+ process.exit(1)
108
+ }
109
+
110
+ const docName = outputName || command
111
+ const prompt = entry.fn(projectInfo)
112
+
113
+ console.log(chalk.bold(`\n📝 Generating: ${entry.label}`))
114
+ console.log(chalk.dim(` Output: ./output/${docName}.{md,txt,html}\n`))
115
+
116
+ try {
117
+ await generateDoc(prompt, docName, './output')
118
+ } catch (err) {
119
+ if (err.status === 401) {
120
+ console.error(chalk.red('\n❌ Authentication failed. Set ANTHROPIC_API_KEY or install Claude Code.\n'))
121
+ } else {
122
+ console.error(chalk.red(`\n❌ Error: ${err.message}\n`))
123
+ }
124
+ process.exit(1)
125
+ }
126
+ }
127
+
128
+ main()
package/generator.js CHANGED
@@ -2,8 +2,35 @@ import Anthropic from '@anthropic-ai/sdk'
2
2
  import { marked } from 'marked'
3
3
  import fs from 'fs'
4
4
  import path from 'path'
5
+ import os from 'os'
5
6
 
6
- const client = new Anthropic()
7
+ function resolveApiKey() {
8
+ if (process.env.ANTHROPIC_API_KEY) return process.env.ANTHROPIC_API_KEY
9
+
10
+ const credentialsPath = path.join(os.homedir(), '.claude', '.credentials.json')
11
+ if (fs.existsSync(credentialsPath)) {
12
+ try {
13
+ const creds = JSON.parse(fs.readFileSync(credentialsPath, 'utf-8'))
14
+ const token = creds?.claudeAiOauth?.accessToken
15
+ const expiresAt = creds?.claudeAiOauth?.expiresAt
16
+ if (token && (!expiresAt || expiresAt > Date.now())) {
17
+ return token
18
+ }
19
+ } catch {
20
+ // ignore malformed credentials file
21
+ }
22
+ }
23
+
24
+ return null
25
+ }
26
+
27
+ const apiKey = resolveApiKey()
28
+ if (!apiKey) {
29
+ console.error('\n❌ No API key found. Set ANTHROPIC_API_KEY or install Claude Code (code.visualstudio.com/download).\n')
30
+ process.exit(1)
31
+ }
32
+
33
+ const client = new Anthropic({ apiKey })
7
34
 
8
35
  /**
9
36
  * Generate a handover document using the Claude API
package/package.json CHANGED
@@ -1,43 +1,44 @@
1
- {
2
- "name": "client-handover",
3
- "version": "1.0.2",
4
- "description": "AI-powered handover document generator for frontend developers handing off client websites",
5
- "type": "module",
6
- "main": "index.js",
7
- "bin": {
8
- "handover": "cli.js"
9
- },
10
- "files": [
11
- "cli.js",
12
- "index.js",
13
- "generator.js",
14
- "handover.js",
15
- "setup.js",
16
- "deploy.js",
17
- "credentials.js",
18
- "license.js",
19
- "README.md"
20
- ],
21
- "scripts": {
22
- "test": "node test.js"
23
- },
24
- "keywords": [
25
- "handover",
26
- "frontend",
27
- "client",
28
- "documentation",
29
- "developer",
30
- "claude",
31
- "ai"
32
- ],
33
- "author": "sabrkei",
34
- "license": "MIT",
35
- "engines": {
36
- "node": ">=18"
37
- },
38
- "dependencies": {
39
- "@anthropic-ai/sdk": "^0.39.0",
40
- "chalk": "^5.3.0",
41
- "marked": "^12.0.0"
42
- }
43
- }
1
+ {
2
+ "name": "client-handover",
3
+ "version": "1.0.4",
4
+ "description": "AI-powered handover document generator for frontend developers handing off client websites",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "bin": {
8
+ "handover": "cli.js"
9
+ },
10
+ "files": [
11
+ "cli.js",
12
+ "index.js",
13
+ "generator.js",
14
+ "handover.js",
15
+ "setup.js",
16
+ "deploy.js",
17
+ "credentials.js",
18
+ "license.js",
19
+ "README.md"
20
+ ],
21
+ "scripts": {
22
+ "test": "node test.js"
23
+ },
24
+ "keywords": [
25
+ "handover",
26
+ "frontend",
27
+ "client",
28
+ "documentation",
29
+ "developer",
30
+ "claude",
31
+ "ai"
32
+ ],
33
+ "author": "sabrkei",
34
+ "license": "MIT",
35
+ "engines": {
36
+ "node": ">=18"
37
+ },
38
+ "dependencies": {
39
+ "@anthropic-ai/sdk": "^0.39.0",
40
+ "chalk": "^5.3.0",
41
+ "client-handover": "^1.0.2",
42
+ "marked": "^12.0.0"
43
+ }
44
+ }