catco 0.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.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/index.cjs +34 -0
- package/dist/index.js +33 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Robert Soriano <https://github.com/wobsoriano>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# catco
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
npm i -g catco
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Tell it what files, and it will concatenate them all and copy them to your clipboard (whitespace minimized) so you can go paste that shit to GPT, Perplexity, Claude, whatever AI to ask for help or whatever.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
catco foo.ts bar.ts some/directory/*.ts
|
|
11
|
+
```
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var globby = require('globby');
|
|
4
|
+
var fs = require('node:fs');
|
|
5
|
+
var path = require('node:path');
|
|
6
|
+
var clipboard = require('clipboardy');
|
|
7
|
+
|
|
8
|
+
function minify(content) {
|
|
9
|
+
return content.replace(/\s+/g, " ").replace(/\s*([\{\}\[\]\(\),;:])\s*/g, "$1").replace(/\s*=\s*/g, "=").replace(/\s*>\s*/g, ">").replace(/;\s*/g, ";").replace(/"\s+/g, '"').replace(/\s+"/g, '"').replace(/'\s+/g, "'").replace(/\s+'/g, "'").trim();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async function catco(patterns) {
|
|
13
|
+
let allContents = "";
|
|
14
|
+
for (const pattern of patterns) {
|
|
15
|
+
const files = await globby.globby(pattern);
|
|
16
|
+
for (const file of files) {
|
|
17
|
+
const content = await fs.promises.readFile(file, "utf-8");
|
|
18
|
+
const minifiedContent = minify(content);
|
|
19
|
+
allContents += `/* FILE: ${path.resolve(file)} */ ${minifiedContent} `;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (allContents) {
|
|
23
|
+
await clipboard.write(allContents);
|
|
24
|
+
console.log("Contents copied to clipboard!");
|
|
25
|
+
} else {
|
|
26
|
+
console.log("No matching files found.");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const args = process.argv.slice(2);
|
|
30
|
+
if (args.length === 0) {
|
|
31
|
+
console.log("Usage: catco [...patterns]");
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
catco(args);
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { globby } from 'globby';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import clipboard from 'clipboardy';
|
|
6
|
+
|
|
7
|
+
function minify(content) {
|
|
8
|
+
return content.replace(/\s+/g, " ").replace(/\s*([\{\}\[\]\(\),;:])\s*/g, "$1").replace(/\s*=\s*/g, "=").replace(/\s*>\s*/g, ">").replace(/;\s*/g, ";").replace(/"\s+/g, '"').replace(/\s+"/g, '"').replace(/'\s+/g, "'").replace(/\s+'/g, "'").trim();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async function catco(patterns) {
|
|
12
|
+
let allContents = "";
|
|
13
|
+
for (const pattern of patterns) {
|
|
14
|
+
const files = await globby(pattern);
|
|
15
|
+
for (const file of files) {
|
|
16
|
+
const content = await fs.promises.readFile(file, "utf-8");
|
|
17
|
+
const minifiedContent = minify(content);
|
|
18
|
+
allContents += `/* FILE: ${path.resolve(file)} */ ${minifiedContent} `;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (allContents) {
|
|
22
|
+
await clipboard.write(allContents);
|
|
23
|
+
console.log("Contents copied to clipboard!");
|
|
24
|
+
} else {
|
|
25
|
+
console.log("No matching files found.");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const args = process.argv.slice(2);
|
|
29
|
+
if (args.length === 0) {
|
|
30
|
+
console.log("Usage: catco [...patterns]");
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
catco(args);
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "catco",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"description": "",
|
|
8
|
+
"exports": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/index.cjs"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsx"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"keywords": [
|
|
19
|
+
"ai",
|
|
20
|
+
"ai-assistant",
|
|
21
|
+
"ai-tools",
|
|
22
|
+
"gpt",
|
|
23
|
+
"copy",
|
|
24
|
+
"clipboard",
|
|
25
|
+
"claude",
|
|
26
|
+
"chatgpt",
|
|
27
|
+
"chatgpt4o",
|
|
28
|
+
"chatgpt4o-mini"
|
|
29
|
+
],
|
|
30
|
+
"bin": {
|
|
31
|
+
"catco": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"homepage": "https://github.com/tasteee/catco",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/tasteee/catco.git"
|
|
38
|
+
},
|
|
39
|
+
"bugs": "https://github.com/tasteee/catco/issues",
|
|
40
|
+
"author": "tasteink <tasteink@proton.me>",
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"tsx": "^4.19.2",
|
|
43
|
+
"vitest": "^2.1.3",
|
|
44
|
+
"typescript": "^5.6.3"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"clipboardy": "^4.0.0",
|
|
48
|
+
"globby": "^14.0.2"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
}
|
|
53
|
+
}
|