copit 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/README.md +134 -0
- package/package.json +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# copit
|
|
2
|
+
|
|
3
|
+
A GitHub File Fetcher TUI application that allows you to browse and download files from GitHub repositories with OAuth authentication, fuzzy search, and download history management.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔐 **GitHub OAuth Authentication** - Secure Device Flow authentication
|
|
8
|
+
- 🔍 **Fuzzy Search** - Fast file and repository search using fuse.js
|
|
9
|
+
- 📋 **Download History** - Track and quickly re-download recent files
|
|
10
|
+
- 🚀 **Terminal UI** - Beautiful terminal interface built with ink + React
|
|
11
|
+
- 💾 **Encrypted Storage** - Secure token storage with AES-256-GCM encryption
|
|
12
|
+
- 🛡️ **Security** - Path traversal protection and input validation
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
### Global Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Install globally via npm
|
|
20
|
+
npm install -g copit
|
|
21
|
+
|
|
22
|
+
# Or install via bunx (recommended)
|
|
23
|
+
bunx copit
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Local Development
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Clone the repository
|
|
30
|
+
git clone https://github.com/mrsekut/copit.git
|
|
31
|
+
cd copit
|
|
32
|
+
|
|
33
|
+
# Install dependencies
|
|
34
|
+
bun install
|
|
35
|
+
|
|
36
|
+
# Run in development mode
|
|
37
|
+
bun run dev
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
### Basic Usage
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Run the application
|
|
46
|
+
copit
|
|
47
|
+
|
|
48
|
+
# Or with bunx
|
|
49
|
+
bunx copit
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Environment Variables
|
|
53
|
+
|
|
54
|
+
Create a `.env` file or set environment variables:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# GitHub OAuth Client ID (optional - uses default if not set)
|
|
58
|
+
GITHUB_CLIENT_ID=your_github_client_id
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### First Run
|
|
62
|
+
|
|
63
|
+
1. Run `copit` command
|
|
64
|
+
2. Follow the OAuth authentication flow
|
|
65
|
+
3. Browse repositories and download files
|
|
66
|
+
4. Use Tab to switch between History and Browse modes
|
|
67
|
+
|
|
68
|
+
### Navigation
|
|
69
|
+
|
|
70
|
+
- **↑/↓** - Navigate through lists
|
|
71
|
+
- **Enter** - Select/Download files
|
|
72
|
+
- **Tab** - Switch between History and Browse modes
|
|
73
|
+
- **Esc** - Go back or exit
|
|
74
|
+
- **Type** - Fuzzy search in any list
|
|
75
|
+
|
|
76
|
+
## GitHub OAuth Setup
|
|
77
|
+
|
|
78
|
+
To use your own GitHub OAuth App:
|
|
79
|
+
|
|
80
|
+
1. Go to [GitHub Developer Settings](https://github.com/settings/applications/new)
|
|
81
|
+
2. Create a new OAuth App with these settings:
|
|
82
|
+
- Application name: `copit` (or your preferred name)
|
|
83
|
+
- Homepage URL: `https://github.com/mrsekut/copit`
|
|
84
|
+
- Authorization callback URL: `http://localhost` (not used for device flow)
|
|
85
|
+
3. Enable "Device Flow" in the app settings
|
|
86
|
+
4. Copy the Client ID and set it as `GITHUB_CLIENT_ID` environment variable
|
|
87
|
+
|
|
88
|
+
## Architecture
|
|
89
|
+
|
|
90
|
+
Built with modern technologies and patterns:
|
|
91
|
+
|
|
92
|
+
- **Runtime**: Bun
|
|
93
|
+
- **UI**: ink + React for terminal interface
|
|
94
|
+
- **State Management**: jotai
|
|
95
|
+
- **Authentication**: GitHub OAuth Device Flow
|
|
96
|
+
- **Search**: fuse.js for fuzzy search
|
|
97
|
+
- **Architecture**: Package by Feature pattern
|
|
98
|
+
- **Language**: TypeScript with strict type checking
|
|
99
|
+
|
|
100
|
+
## Security
|
|
101
|
+
|
|
102
|
+
- OAuth tokens are encrypted using AES-256-GCM
|
|
103
|
+
- Path traversal protection for file downloads
|
|
104
|
+
- Input validation and sanitization
|
|
105
|
+
- No hardcoded secrets (configurable via environment variables)
|
|
106
|
+
|
|
107
|
+
## Scripts
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Development
|
|
111
|
+
bun run dev # Start development server
|
|
112
|
+
bun run build # Build for production
|
|
113
|
+
bun run typecheck # Run TypeScript type checking
|
|
114
|
+
bun run lint # Run ESLint
|
|
115
|
+
bun run format # Format code with Prettier
|
|
116
|
+
bun run test # Run tests
|
|
117
|
+
bun run check # Run all checks (typecheck + lint + format + test)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Contributing
|
|
121
|
+
|
|
122
|
+
1. Fork the repository
|
|
123
|
+
2. Create a feature branch
|
|
124
|
+
3. Make your changes
|
|
125
|
+
4. Run `bun run check` to ensure code quality
|
|
126
|
+
5. Submit a pull request
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
131
|
+
|
|
132
|
+
## Author
|
|
133
|
+
|
|
134
|
+
[mrsekut](https://github.com/mrsekut)
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "copit",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "GitHub File Fetcher TUI - Download files from GitHub repositories with OAuth authentication, fuzzy search, and download history",
|
|
5
|
+
"module": "src/index.tsx",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"private": false,
|
|
8
|
+
"bin": {
|
|
9
|
+
"copit": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/**/*",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"github",
|
|
18
|
+
"cli",
|
|
19
|
+
"download"
|
|
20
|
+
],
|
|
21
|
+
"author": "mrsekut",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/mrsekut/copit.git"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/mrsekut/copit/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/mrsekut/copit#readme",
|
|
31
|
+
"scripts": {
|
|
32
|
+
"dev": "bun run src/index.tsx",
|
|
33
|
+
"build": "bun build src/index.tsx --outdir dist --target node",
|
|
34
|
+
"typecheck": "tsc --noEmit",
|
|
35
|
+
"lint": "eslint . --ext .ts,.tsx --fix",
|
|
36
|
+
"format": "prettier --write .",
|
|
37
|
+
"test": "vitest",
|
|
38
|
+
"check": "bun typecheck && bun lint && bun format && bun test"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@octokit/auth-oauth-device": "^8.0.1",
|
|
42
|
+
"@octokit/rest": "^21.0.2",
|
|
43
|
+
"fuse.js": "^7.0.0",
|
|
44
|
+
"ink": "^5.0.1",
|
|
45
|
+
"ink-select-input": "^6.2.0",
|
|
46
|
+
"ink-text-input": "^6.0.0",
|
|
47
|
+
"jotai": "^2.12.5",
|
|
48
|
+
"react": "^18.3.1"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/bun": "latest",
|
|
52
|
+
"@types/node": "^22.10.5",
|
|
53
|
+
"@types/react": "^18.3.18",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^8.20.0",
|
|
55
|
+
"@typescript-eslint/parser": "^8.20.0",
|
|
56
|
+
"eslint": "^9.18.0",
|
|
57
|
+
"eslint-config-prettier": "^10.0.1",
|
|
58
|
+
"eslint-plugin-react": "^7.37.3",
|
|
59
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
60
|
+
"prettier": "^3.4.2",
|
|
61
|
+
"typescript": "^5.7.3",
|
|
62
|
+
"vitest": "^2.1.8"
|
|
63
|
+
}
|
|
64
|
+
}
|