chatporter 1.0.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/.github/workflows/npm-publish.yml +33 -0
- package/API.md +133 -0
- package/LICENSE +22 -0
- package/README.md +207 -0
- package/REPOSITORY.md +183 -0
- package/SETUP.md +146 -0
- package/USAGE.md +124 -0
- package/bin/chatporter.js +13 -0
- package/package.json +54 -0
- package/src/index.js +929 -0
package/SETUP.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# ChatPorter Setup Guide
|
|
2
|
+
|
|
3
|
+
## Quick Start
|
|
4
|
+
|
|
5
|
+
1. **Install dependencies:**
|
|
6
|
+
```bash
|
|
7
|
+
npm install
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
2. **Make CLI executable (if needed):**
|
|
11
|
+
```bash
|
|
12
|
+
chmod +x bin/chatporter.js
|
|
13
|
+
chmod +x src/index.js
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
3. **Test it:**
|
|
17
|
+
```bash
|
|
18
|
+
# Using node directly
|
|
19
|
+
node src/index.js upload EXAMPLE.md --platform v0
|
|
20
|
+
|
|
21
|
+
# Or use interactive mode
|
|
22
|
+
node src/index.js
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Installation Options
|
|
26
|
+
|
|
27
|
+
### Option 1: Global Install (Recommended)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Then use from anywhere:
|
|
34
|
+
```bash
|
|
35
|
+
chatporter upload docs/*.md
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Option 2: Use with npx
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx chatporter upload docs/*.md
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Option 3: Local Development
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Install dependencies
|
|
48
|
+
npm install
|
|
49
|
+
|
|
50
|
+
# Run directly
|
|
51
|
+
node src/index.js upload <files>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Usage Examples
|
|
55
|
+
|
|
56
|
+
### Upload Cherry project docs to v0
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
cd /path/to/Cherry
|
|
60
|
+
chatporter upload docs/spec-integration-summary.md docs/timeline.md docs/task-list.md --platform v0 --output context.txt
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Interactive mode
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
chatporter
|
|
67
|
+
# Follow prompts to select files and platform
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Quick upload and open
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
chatporter upload docs/*.md --platform v0 --open v0
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Moving to Separate Repo
|
|
77
|
+
|
|
78
|
+
This project is designed to be completely standalone. To move it to its own GitHub repo:
|
|
79
|
+
|
|
80
|
+
1. **Initialize git:**
|
|
81
|
+
```bash
|
|
82
|
+
cd ChatPorter
|
|
83
|
+
git init
|
|
84
|
+
git add .
|
|
85
|
+
git commit -m "Initial commit: ChatPorter utility"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
2. **Create GitHub repo** and push:
|
|
89
|
+
```bash
|
|
90
|
+
git remote add origin <your-repo-url>
|
|
91
|
+
git branch -M main
|
|
92
|
+
git push -u origin main
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
3. **Publish to npm (optional):**
|
|
96
|
+
```bash
|
|
97
|
+
npm login
|
|
98
|
+
npm publish
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Project Structure
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
ChatPorter/
|
|
105
|
+
├── bin/
|
|
106
|
+
│ └── chatporter.js # CLI entry point
|
|
107
|
+
├── src/
|
|
108
|
+
│ └── index.js # Main logic
|
|
109
|
+
├── package.json # Dependencies & config
|
|
110
|
+
├── README.md # User documentation
|
|
111
|
+
├── SETUP.md # This file
|
|
112
|
+
├── LICENSE # MIT license
|
|
113
|
+
└── .chatporterrc.json # Default config
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Configuration
|
|
117
|
+
|
|
118
|
+
Edit `.chatporterrc.json` to customize defaults:
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"defaultPlatform": "v0",
|
|
123
|
+
"includeMetadata": true,
|
|
124
|
+
"format": "concise",
|
|
125
|
+
"maxFileSize": "10MB"
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Troubleshooting
|
|
130
|
+
|
|
131
|
+
**Issue:** `command not found: chatporter`
|
|
132
|
+
- **Solution:** Use `node src/index.js` directly or install globally with `npm install -g .`
|
|
133
|
+
|
|
134
|
+
**Issue:** Permission denied
|
|
135
|
+
- **Solution:** Run `chmod +x bin/chatporter.js src/index.js`
|
|
136
|
+
|
|
137
|
+
**Issue:** Module not found errors
|
|
138
|
+
- **Solution:** Run `npm install` to install dependencies
|
|
139
|
+
|
|
140
|
+
## Next Steps
|
|
141
|
+
|
|
142
|
+
1. Test with your own markdown files
|
|
143
|
+
2. Customize platform formatters if needed
|
|
144
|
+
3. Add to your project's workflow
|
|
145
|
+
4. Share with your team!
|
|
146
|
+
|
package/USAGE.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# ChatPorter Usage Examples
|
|
2
|
+
|
|
3
|
+
## Using with Cherry Project
|
|
4
|
+
|
|
5
|
+
From the Cherry project root, you can upload documentation to AI chats:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Navigate to ChatPorter
|
|
9
|
+
cd ChatPorter
|
|
10
|
+
|
|
11
|
+
# Install dependencies (first time only)
|
|
12
|
+
npm install
|
|
13
|
+
|
|
14
|
+
# Set your v0 API key (first time only)
|
|
15
|
+
export V0_API_KEY=your_api_key_here
|
|
16
|
+
# Or create .env file with: V0_API_KEY=your_api_key_here
|
|
17
|
+
|
|
18
|
+
# Create actual v0 chat via API (Recommended!)
|
|
19
|
+
node src/index.js upload ../docs/spec-integration-summary.md ../docs/timeline.md ../docs/task-list.md --platform v0 --api
|
|
20
|
+
|
|
21
|
+
# With custom name
|
|
22
|
+
node src/index.js upload ../docs/*.md --platform v0 --api --name "Cherry Project Docs"
|
|
23
|
+
|
|
24
|
+
# Save formatted output (fallback mode)
|
|
25
|
+
node src/index.js upload ../docs/*.md --platform v0 --output ../chat-context.txt
|
|
26
|
+
|
|
27
|
+
# Interactive mode
|
|
28
|
+
node src/index.js
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Common Workflows
|
|
32
|
+
|
|
33
|
+
### 1. Upload Project Specs to v0
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
chatporter upload docs/spec-integration-summary.md docs/timeline.md --platform v0 --output v0-context.txt
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Share Documentation with Team
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
chatporter upload docs/architecture.md docs/data-model.md --platform raw --output shared-context.txt
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 3. Quick Context for ChatGPT
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
chatporter upload README.md docs/setup.md --platform chatgpt
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 4. Multiple Files with Metadata
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
chatporter upload docs/*.md --platform v0 --output full-context.txt
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Platform-Specific Tips
|
|
58
|
+
|
|
59
|
+
### v0.dev
|
|
60
|
+
- Best for: Technical specs, architecture docs, task lists
|
|
61
|
+
- Format: Includes file list header, clean markdown
|
|
62
|
+
- Usage: Copy output and paste into v0 chat
|
|
63
|
+
|
|
64
|
+
### ChatGPT
|
|
65
|
+
- Best for: General documentation, explanations
|
|
66
|
+
- Format: Includes friendly intro message
|
|
67
|
+
- Usage: Paste directly into new chat
|
|
68
|
+
|
|
69
|
+
### Claude
|
|
70
|
+
- Best for: Long-form documentation, analysis
|
|
71
|
+
- Format: XML-style document tags
|
|
72
|
+
- Usage: Paste into Claude chat
|
|
73
|
+
|
|
74
|
+
### Cursor AI
|
|
75
|
+
- Best for: Code-related documentation
|
|
76
|
+
- Format: Comment-style header
|
|
77
|
+
- Usage: Use in Cursor chat interface
|
|
78
|
+
|
|
79
|
+
## Advanced Usage
|
|
80
|
+
|
|
81
|
+
### Custom Output Format
|
|
82
|
+
|
|
83
|
+
Edit `src/index.js` to add custom formatters:
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
const platformFormatters = {
|
|
87
|
+
// ... existing formatters
|
|
88
|
+
custom: (content, metadata) => {
|
|
89
|
+
return `CUSTOM FORMAT\n\n${content}`;
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Batch Processing
|
|
95
|
+
|
|
96
|
+
Create a script to upload multiple project docs:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
#!/bin/bash
|
|
100
|
+
# upload-all.sh
|
|
101
|
+
|
|
102
|
+
chatporter upload \
|
|
103
|
+
docs/spec-integration-summary.md \
|
|
104
|
+
docs/timeline.md \
|
|
105
|
+
docs/task-list.md \
|
|
106
|
+
docs/architecture.md \
|
|
107
|
+
--platform v0 \
|
|
108
|
+
--output all-docs-context.txt
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Tips
|
|
112
|
+
|
|
113
|
+
1. **File Size**: Large files (>10MB) may need chunking
|
|
114
|
+
2. **Multiple Files**: Use glob patterns: `docs/*.md`
|
|
115
|
+
3. **Output**: Always save to file for sharing: `--output context.txt`
|
|
116
|
+
4. **Platform**: Choose based on your AI assistant's preferences
|
|
117
|
+
|
|
118
|
+
## Integration Ideas
|
|
119
|
+
|
|
120
|
+
- Add to your project's `package.json` scripts
|
|
121
|
+
- Create GitHub Actions to auto-generate context
|
|
122
|
+
- Use in CI/CD for documentation updates
|
|
123
|
+
- Share with team members for onboarding
|
|
124
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { dirname, join } from 'path';
|
|
5
|
+
import { createRequire } from 'module';
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
|
|
10
|
+
// Import the main module
|
|
11
|
+
const mainPath = join(__dirname, '../src/index.js');
|
|
12
|
+
await import(mainPath);
|
|
13
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chatporter",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Import repositories and directories from your local machine into v0.dev chats",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"chatporter": "./bin/chatporter.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node src/index.js",
|
|
12
|
+
"dev": "node --watch src/index.js",
|
|
13
|
+
"test": "node --test"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"v0",
|
|
17
|
+
"v0.dev",
|
|
18
|
+
"chat",
|
|
19
|
+
"repository",
|
|
20
|
+
"import",
|
|
21
|
+
"codebase",
|
|
22
|
+
"ai",
|
|
23
|
+
"cli",
|
|
24
|
+
"github",
|
|
25
|
+
"directory"
|
|
26
|
+
],
|
|
27
|
+
"author": "",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/pstagner/ChatPorter.git"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/pstagner/ChatPorter#readme",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/pstagner/ChatPorter/issues"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"commander": "^11.1.0",
|
|
39
|
+
"chalk": "^5.3.0",
|
|
40
|
+
"inquirer": "^9.2.15",
|
|
41
|
+
"open": "^10.1.0",
|
|
42
|
+
"v0-sdk": "^0.1.0",
|
|
43
|
+
"dotenv": "^16.3.1",
|
|
44
|
+
"archiver": "^7.0.1",
|
|
45
|
+
"glob": "^10.3.10"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^20.10.0"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=18.0.0"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|