onepaste 1.3.0__tar.gz

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,37 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ build-and-publish:
10
+ runs-on: ubuntu-latest
11
+ # Must match the "environment" name configured in the PyPI Trusted Publisher
12
+ environment: pypi
13
+ permissions:
14
+ id-token: write # OIDC trusted publishing — no API token stored
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.12"
21
+
22
+ - name: Install build deps
23
+ run: python -m pip install --upgrade build twine
24
+
25
+ - name: Run tests
26
+ run: |
27
+ python -m pip install -e '.[dev]'
28
+ python -m pytest -q
29
+
30
+ - name: Build distributions
31
+ run: python -m build
32
+
33
+ - name: Twine check
34
+ run: twine check dist/*
35
+
36
+ - name: Publish to PyPI
37
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,315 @@
1
+ # ============================================
2
+ # CodeCollector - .gitignore
3
+ # ============================================
4
+
5
+ # --- Python ---
6
+ # Byte-compiled / optimized / DLL files
7
+ __pycache__/
8
+ *.py[cod]
9
+ *$py.class
10
+
11
+ # C extensions
12
+ *.so
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ downloads/
20
+ eggs/
21
+ .eggs/
22
+ lib/
23
+ lib64/
24
+ parts/
25
+ sdist/
26
+ var/
27
+ wheels/
28
+ share/python-wheels/
29
+ *.egg-info/
30
+ .installed.cfg
31
+ *.egg
32
+ MANIFEST
33
+
34
+ # PyInstaller
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py,cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+ cover/
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+ db.sqlite3-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ .pybuilder/
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # pyenv
89
+ .python-version
90
+
91
+ # pipenv
92
+ Pipfile.lock
93
+
94
+ # poetry
95
+ poetry.lock
96
+
97
+ # pdm
98
+ .pdm-build/
99
+ .pdm.toml
100
+
101
+ # PEP 582
102
+ __pypackages__/
103
+
104
+ # Celery stuff
105
+ celerybeat-schedule
106
+ celerybeat.pid
107
+
108
+ # SageMath parsed files
109
+ *.sage.py
110
+
111
+ # Environments
112
+ .env
113
+ .venv
114
+ env/
115
+ venv/
116
+ ENV/
117
+ env.bak/
118
+ venv.bak/
119
+
120
+ # Spyder project settings
121
+ .spyderproject
122
+ .spyproject
123
+
124
+ # Rope project settings
125
+ .ropeproject
126
+
127
+ # mkdocs documentation
128
+ /site
129
+
130
+ # mypy
131
+ .mypy_cache/
132
+ .dmypy.json
133
+ dmypy.json
134
+
135
+ # ruff
136
+ .ruff_cache/
137
+
138
+ # Pyre type checker
139
+ .pyre/
140
+
141
+ # pytype static type analyzer
142
+ .pytype/
143
+
144
+ # Cython debug symbols
145
+ cython_debug/
146
+
147
+ # --- IDE ---
148
+ # PyCharm
149
+ .idea/
150
+
151
+ # VS Code
152
+ .vscode/
153
+ *.code-workspace
154
+
155
+ # Eclipse
156
+ .project
157
+ .classpath
158
+ .settings/
159
+
160
+ # NetBeans
161
+ nbproject/
162
+ nbbuild/
163
+ nbdist/
164
+
165
+ # Sublime Text
166
+ *.sublime-project
167
+ *.sublime-workspace
168
+
169
+ # Atom
170
+ .atom/
171
+
172
+ # Vim
173
+ *.swp
174
+ *.swo
175
+ *~
176
+ .*.swp
177
+ .*.swo
178
+
179
+ # Emacs
180
+ *~
181
+ \#*\#
182
+ .\#*
183
+
184
+ # --- OS ---
185
+ # macOS
186
+ .DS_Store
187
+ .AppleDouble
188
+ .LSOverride
189
+ Icon
190
+ ._*
191
+ .DocumentRevisions-V100
192
+ .fseventsd
193
+ .Spotlight-V100
194
+ .TemporaryItems
195
+ .Trashes
196
+ .VolumeIcon.icns
197
+ .com.apple.timemachine.donotpresent
198
+
199
+ # Linux
200
+ *~
201
+ .directory
202
+ .Trash-*
203
+
204
+ # Windows
205
+ Thumbs.db
206
+ Thumbs.db:encryptable
207
+ ehthumbs.db
208
+ ehthumbs_vista.db
209
+ *.stackdump
210
+ [Dd]esktop.ini
211
+ $RECYCLE.BIN/
212
+ *.cab
213
+ *.msi
214
+ *.msix
215
+ *.msm
216
+ *.msp
217
+ *.lnk
218
+
219
+ # --- Project Specific ---
220
+ # 输出文件(可以根据需要调整)
221
+ code_collection.txt
222
+ code_collection.md
223
+ code_collection*.txt
224
+ code_collection*.md
225
+ code_collection*.manifest.json
226
+ *.collection.txt
227
+ *.collection.md
228
+ output/
229
+ collected_code/
230
+
231
+ # 临时文件
232
+ tmp/
233
+ temp/
234
+ *.tmp
235
+ *.temp
236
+
237
+ # 备份文件
238
+ *.bak
239
+ *.backup
240
+ *.old
241
+
242
+ # 压缩文件
243
+ *.zip
244
+ *.tar.gz
245
+ *.rar
246
+ *.7z
247
+
248
+ # 配置文件(保留示例)
249
+ config.local.json
250
+ *.local.cfg
251
+
252
+ # 日志文件
253
+ *.log
254
+ logs/
255
+
256
+ # --- Environment ---
257
+ # Conda
258
+ .conda/
259
+ conda/
260
+ Miniconda*/
261
+ Anaconda*/
262
+
263
+ # NPM (如果项目中有前端部分)
264
+ node_modules/
265
+ package-lock.json
266
+ yarn.lock
267
+ .npm
268
+ .npmrc
269
+
270
+ # --- Docker ---
271
+ # (如果将来添加 Docker 支持)
272
+ .docker/
273
+ docker-compose.override.yml
274
+
275
+ # --- Documentation ---
276
+ # 生成的文档
277
+ site/
278
+ docs/_build/
279
+
280
+ # --- Security ---
281
+ # 私钥和证书
282
+ *.pem
283
+ *.key
284
+ *.crt
285
+ *.p12
286
+ *.pfx
287
+
288
+ # 密码文件
289
+ credentials.json
290
+ secrets.json
291
+ .env.local
292
+ .env.production
293
+
294
+ # --- Website ---
295
+ website/node_modules/
296
+ website/dist/
297
+
298
+ # --- Misc ---
299
+ # CodeCollector 自身的输出
300
+ codecollection.txt
301
+ collected_*.txt
302
+ !collected_example.txt
303
+
304
+ # 测试输出
305
+ test_output/
306
+ test_results/
307
+
308
+ # 性能分析
309
+ *.prof
310
+ *.lprof
311
+
312
+ # 数据库
313
+ *.db
314
+ *.sqlite
315
+ *.sqlite3
onepaste-1.3.0/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+
2
+ MIT License
3
+
4
+ Copyright (c) 2024 Your Name
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.5
2
+ Name: onepaste
3
+ Version: 1.3.0
4
+ Summary: Collect project code files into a single output for AI assistants
5
+ Project-URL: Homepage, https://github.com/emVisible/codecollector
6
+ Project-URL: Repository, https://github.com/emVisible/codecollector.git
7
+ Project-URL: Issues, https://github.com/emVisible/codecollector/issues
8
+ Author: emVisible
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: ai,cli,code,collector,context,developer-tools,llm,prompt
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Code Generators
23
+ Classifier: Topic :: Utilities
24
+ Requires-Python: >=3.8
25
+ Requires-Dist: questionary>=2.0.0
26
+ Requires-Dist: rich>=13.0.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: black>=23.0; extra == 'dev'
29
+ Requires-Dist: mypy>=1.0; extra == 'dev'
30
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
31
+ Requires-Dist: pytest>=7.0; extra == 'dev'
32
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
33
+ Requires-Dist: tiktoken>=0.5; extra == 'dev'
34
+ Provides-Extra: tokens
35
+ Requires-Dist: tiktoken>=0.5; extra == 'tokens'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # CodeCollector
39
+
40
+ Collect project code into LLM-ready Markdown. Select a directory, press Enter, copy and paste.
41
+
42
+ ## Installation
43
+
44
+ ### pipx (recommended)
45
+
46
+ ```bash
47
+ brew install pipx
48
+ pipx ensurepath
49
+ pipx install onepaste
50
+
51
+ # Optional: exact token counting via tiktoken
52
+ pipx install "onepaste[tokens]"
53
+ ```
54
+
55
+ Without the `tokens` extra, token counts use a fast characters/4 estimate.
56
+
57
+ ### From source (for development)
58
+
59
+ ```bash
60
+ git clone https://github.com/emVisible/codecollector.git
61
+ cd codecollector
62
+ pipx install -e .
63
+ ```
64
+
65
+ ### Uninstall / reinstall (for updates & debugging)
66
+
67
+ ```bash
68
+ # Uninstall package
69
+ collect --uninstall
70
+
71
+ # Uninstall and remove ~/.config/codecollector
72
+ collect --uninstall --purge-config
73
+
74
+ # Reinstall editable from local source
75
+ cd /path/to/CodeCollector
76
+ pipx install -e .
77
+ ```
78
+
79
+ ## Quick Start
80
+
81
+ ```bash
82
+ # Interactive: navigate to folder → select "Collect this directory" → Enter
83
+ collect
84
+
85
+ # Collect current directory (.gitignore filtering on automatically inside git repos)
86
+ collect .
87
+
88
+ # Pipe straight into another tool — no file written
89
+ collect . --stdout | llm "Explain what this project does"
90
+
91
+ # Only TypeScript sources, skip tests
92
+ collect . --include "src/**/*.ts" --exclude-pattern "*.test.ts"
93
+ ```
94
+
95
+ Output is a single Markdown file (`code_collection.md`) ready to copy-paste into any LLM.
96
+
97
+ ## Usage
98
+
99
+ ```bash
100
+ # Interactive mode
101
+ collect
102
+ collect -i # force .gitignore filter (deprecated: auto inside git)
103
+
104
+ # Collect a specific directory
105
+ collect /path/to/project
106
+ collect . --no-gitignore # include gitignored files too
107
+
108
+ # Non-recursive (current directory only)
109
+ collect . -n
110
+
111
+ # Custom output
112
+ collect . -o my_project.md
113
+ collect . -d ./collected
114
+
115
+ # Glob filtering (repeatable)
116
+ collect . --include "src/**"
117
+ collect . --include "*.py" --include "*.md"
118
+ collect . --exclude-pattern "*.min.js" --exclude-pattern "tests/*"
119
+
120
+ # Split large output (default: 2MB per part)
121
+ collect . --max-output-size 5
122
+
123
+ # Preview without writing
124
+ collect . --dry-run
125
+
126
+ # Extra exclusions
127
+ collect . --exclude vendor --exclude tmp
128
+ ```
129
+
130
+ ## Options
131
+
132
+ | Option | Description |
133
+ | ---------------------------- | ---------------------------------------------------------------------------------- |
134
+ | `path` | Directory to collect (default: interactive picker) |
135
+ | `-i` | Force-enable `.gitignore` filtering (deprecated alias; see below) |
136
+ | `--no-gitignore` | Disable `.gitignore` filtering |
137
+ | `-n, --non-recursive` | Only current directory, skip subdirectories |
138
+ | `-o, --output` | Output filename (default: `code_collection.md`) |
139
+ | `-d, --output-dir` | Output directory (default: current working directory) |
140
+ | `--max-output-size MB` | Max output size per file; auto-split when exceeded (default: 2) |
141
+ | `--exclude DIR` | Extra directory to exclude (repeatable) |
142
+ | `--include GLOB` | Only collect files matching glob (repeatable; overrides extension whitelist) |
143
+ | `--exclude-pattern GLOB` | Skip files matching glob (repeatable) |
144
+ | `--stdout` | Write collection to stdout; progress goes to stderr; no file written |
145
+ | `--dry-run` | Preview collection without writing output |
146
+ | `--force` | Overwrite existing output instead of auto-incrementing |
147
+ | `--config` | Path to config file (merged with global config) |
148
+ | `--init-config` | Generate default config at `~/.config/codecollector/config.json` |
149
+ | `--uninstall` | Uninstall codecollector via pipx and/or pip |
150
+ | `--purge-config` | Also remove `~/.config/codecollector` (with `--uninstall`) |
151
+ | `-v, --version` | Show version |
152
+ | `-h, --help` | Show help |
153
+
154
+ ### .gitignore defaults
155
+
156
+ Inside a git work tree, `.gitignore` filtering is **on by default**. Outside git repos it is off.
157
+ Explicit flags win over the default: `-i` forces it on, `--no-gitignore` forces it off.
158
+ (`-i` used to be required to enable filtering; it still works but the default has changed.)
159
+
160
+ ### Glob patterns
161
+
162
+ `--include` / `--exclude-pattern` match against paths relative to the collected root using
163
+ [fnmatch](https://docs.python.org/3/library/fnmatch.html) semantics:
164
+
165
+ | Pattern | Matches |
166
+ | ---------------- | --------------------------------------------------- |
167
+ | `*.py` | any `.py` file anywhere |
168
+ | `src/**` | everything under `src/` |
169
+ | `tests/*` | files directly inside `tests/` |
170
+ | `*_test.go` | Go test files anywhere |
171
+
172
+ When `--include` patterns are given they **replace** the extension whitelist — you get exactly
173
+ the matched files (still respecting excludes, size limits and binary detection).
174
+
175
+ ### Token counting
176
+
177
+ Summaries show total tokens plus per-file counts, with a Top-10 table of the largest files.
178
+ With the optional `tokens` extra installed, counts are exact (`tiktoken`, `o200k_base`);
179
+ otherwise an estimate (~4 chars/token) is shown and labelled as such.
180
+
181
+ ## Output Format
182
+
183
+ All output is **detailed Markdown** optimized for LLM consumption:
184
+
185
+ - Summary with metadata, token totals, top files by tokens, directory tree, and file list
186
+ - Each source file as a `###` heading with line count, size, tokens, and a fenced code block
187
+ (fences auto-lengthen so source containing backticks never breaks rendering)
188
+ - Auto-split into parts for large projects, each with `Part X of N` header
189
+
190
+ ## Output Behavior
191
+
192
+ ### Auto-increment (no overwrite)
193
+
194
+ If `code_collection.md` already exists, the next run writes to `code_collection_1.md`, then `_2.md`, etc.
195
+
196
+ Use `--force` to overwrite.
197
+
198
+ ### Auto-split
199
+
200
+ When output exceeds the size limit, files are split at source-file boundaries. A manifest JSON is written alongside multi-part output.
201
+
202
+ `--stdout` never splits; it warns on stderr if the limit would have been exceeded.
203
+ It also requires an explicit `path` — the interactive picker would otherwise mix its
204
+ own output into the piped stream.
205
+
206
+ ## Configuration
207
+
208
+ ```bash
209
+ collect --init-config
210
+ ```
211
+
212
+ Edit `~/.config/codecollector/config.json`:
213
+
214
+ ```json
215
+ {
216
+ "exclude_dirs": [
217
+ "node_modules",
218
+ ".git",
219
+ "__pycache__",
220
+ "venv",
221
+ "dist",
222
+ "build"
223
+ ],
224
+ "include_extensions": [".py", ".js", ".ts", ".go", ".rs", ".java"],
225
+ "include_patterns": [],
226
+ "exclude_patterns": [],
227
+ "max_file_size_mb": 5.0,
228
+ "max_output_size_mb": 2.0,
229
+ "auto_increment_output": true,
230
+ "write_manifest": true
231
+ }
232
+ ```
233
+
234
+ `.gitignore` filtering is intentionally not stored in the config file — it resolves
235
+ automatically per run (on inside git work trees) unless overridden by `-i` or
236
+ `--no-gitignore`.
237
+
238
+ ## Requirements
239
+
240
+ - Python 3.8+
241
+ - pipx (for installation)
@@ -0,0 +1,41 @@
1
+ # Publishing to PyPI
2
+
3
+ Package name: **onepaste** (import name stays `codecollector`, command stays `collect`).
4
+
5
+ ## One-time setup (manual first release)
6
+
7
+ 1. Register at <https://pypi.org/account/register/> and verify your email.
8
+ 2. Create an API token: <https://pypi.org/manage/account/token/>
9
+ - Scope: "Entire account" (project-scoped tokens become available after the first upload).
10
+ 3. Upload the built artifacts:
11
+
12
+ ```bash
13
+ .venv/bin/twine upload dist/*
14
+ # Username: __token__
15
+ # Password: pypi-... (paste your token)
16
+ ```
17
+
18
+ 4. Verify from a clean environment:
19
+
20
+ ```bash
21
+ pipx install onepaste
22
+ collect --version # CodeCollector v1.3.0
23
+ ```
24
+
25
+ ## Subsequent releases (GitHub Actions, zero tokens)
26
+
27
+ Uses PyPI Trusted Publishing (OIDC) — no secrets stored in GitHub.
28
+
29
+ 1. On PyPI: your project → *Settings* → *Publishing* → add a **Trusted Publisher**:
30
+ - Owner: `emVisible` Repo: `CodeCollector`
31
+ - Workflow filename: `publish.yml`
32
+ - Environment name: `pypi`
33
+ 2. Release: create a GitHub *Release* (or run the workflow manually via `workflow_dispatch`).
34
+
35
+ The workflow runs tests, builds, twine-checks, then publishes.
36
+
37
+ ## Bump a version
38
+
39
+ 1. `pyproject.toml` → `version`
40
+ 2. `codecollector/__init__.py` → `__version__` (a test enforces both match)
41
+ 3. Commit + GitHub Release with tag `vX.Y.Z`