catco 1.0.1 → 2.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 CHANGED
@@ -1,6 +1,9 @@
1
1
  # catco
2
2
 
3
- Glob copy file contents to ya clipboard. Use it to quickly share many files with an AI code assistant.
3
+ catco does two things.
4
+
5
+ 1. It creates a single string of text from the contents of all files that match a glob.
6
+ 2. It can take a file of combined file contents and scaffold directories/files from it.
4
7
 
5
8
  ## Install
6
9
 
@@ -8,44 +11,40 @@ Glob copy file contents to ya clipboard. Use it to quickly share many files with
8
11
  npm i -g catco
9
12
  ```
10
13
 
11
- ## Examples
14
+ ---
15
+
16
+ ## Copying files to your clipboard
12
17
 
13
- 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.
18
+ You give catco a glob pattern, it reads every matching file, wraps each one in a little `/* FILE: ./path/to/file */` comment, minifies the whole thing into a single string, and puts it in your clipboard.
14
19
 
20
+ ```sh
21
+ catco "./src/**/*.ts"
15
22
  ```
16
- catco src/components/**/*.ts
17
23
 
18
- catco src/components/**/*.ts src/styles/**/*.css
24
+ Multiple patterns work too. Just keep adding them.
19
25
 
20
- catco src/components/**/*.ts src/styles/**/*.css --ignore *.test.ts
26
+ ```sh
27
+ catco "./src/**/*.ts" "./src/**/*.css"
21
28
  ```
22
29
 
23
- ## Default Ignore Patterns
30
+ If you want to skip certain files, pass `--ignore` with a space-separated list of patterns.
24
31
 
32
+ ```sh
33
+ catco "./src/**/*.ts" --ignore "**/*.test.ts **/*.spec.ts"
25
34
  ```
26
- node_modules
27
- node_modules/**
28
- .git
29
- .git/**
30
- .github
31
- .github/**
32
- dist
33
- dist/**
34
- build
35
- build/**
36
- coverage
37
- coverage/**
38
- .next
39
- .next/**
40
- .vercel
41
- .vercel/**
42
- .turbo
43
- .turbo/**
44
- .DS_Store
45
- *.log
46
- npm-debug.log
47
- yarn-error.log
48
- pnpm-debug.log
49
- .env
50
- .env.*
35
+
36
+ Without `--ignore`, catco already skips the usual suspects — `node_modules`, `dist`, `build`, `.git`, `.env`, log files, and framework cache folders like `.next`, `.vercel`, and `.turbo`.
37
+
38
+ ---
39
+
40
+ ## Parsing a string of combined files into files/directories.
41
+
42
+ ```sh
43
+ catco parse ./output.txt ./my-project
51
44
  ```
45
+
46
+ That reads `output.txt`, finds every `/* FILE: ./some/path */` section, creates whatever folders are needed, and writes each file.
47
+
48
+ ---
49
+
50
+ The output format catco uses is plain enough you can give it to AI if you need to. The `/* FILE: */` markers are just comments, so syntax highlighting still works and nothing breaks if you drop it into a code block.
package/package.json CHANGED
@@ -1,60 +1,63 @@
1
- {
2
- "name": "catco",
3
- "version": "1.0.1",
4
- "type": "module",
5
- "description": "Glob copy file contents to ya clipboard.",
6
- "scripts": {
7
- "build": "pkgroll",
8
- "start": "tsx src/index.ts ./src/**/*.ts"
9
- },
10
- "files": [
11
- "dist"
12
- ],
13
- "main": "./dist/index.cjs",
14
- "module": "./dist/index.mjs",
15
- "exports": {
16
- "import": {
17
- "default": "./dist/index.mjs"
18
- },
19
- "require": {
20
- "default": "./dist/index.cjs"
21
- }
22
- },
23
- "bin": {
24
- "catco": "./dist/index.js"
25
- },
26
- "license": "MIT",
27
- "homepage": "https://github.com/tasteee/catco",
28
- "repository": {
29
- "type": "git",
30
- "url": "git+https://github.com/tasteee/catco.git"
31
- },
32
- "bugs": "https://github.com/tasteee/catco/issues",
33
- "author": "tasteink <rocolcleasure@gmail.com>",
34
- "devDependencies": {
35
- "pkgroll": "^2.12.2",
36
- "prettier": "^3.5.3",
37
- "tsx": "^4.19.2",
38
- "typescript": "^5.6.3",
39
- "vitest": "^2.1.3"
40
- },
41
- "dependencies": {
42
- "clipboardy": "^4.0.0",
43
- "globby": "^14.0.2"
44
- },
45
- "publishConfig": {
46
- "access": "public"
47
- },
48
- "keywords": [
49
- "ai",
50
- "ai-assistant",
51
- "ai-tools",
52
- "gpt",
53
- "copy",
54
- "clipboard",
55
- "claude",
56
- "chatgpt",
57
- "chatgpt4o",
58
- "chatgpt4o-mini"
59
- ]
60
- }
1
+ {
2
+ "name": "catco",
3
+ "version": "2.0.0",
4
+ "type": "module",
5
+ "description": "Glob copy file contents to ya clipboard.",
6
+ "scripts": {
7
+ "build": "pkgroll",
8
+ "start": "tsx src/index.ts ./src/**/*.ts"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "main": "./dist/index.cjs",
14
+ "module": "./dist/index.mjs",
15
+ "exports": {
16
+ "import": {
17
+ "default": "./dist/index.mjs"
18
+ },
19
+ "require": {
20
+ "default": "./dist/index.cjs"
21
+ }
22
+ },
23
+ "bin": {
24
+ "catco": "./dist/index.js"
25
+ },
26
+ "license": "MIT",
27
+ "homepage": "https://github.com/tasteee/catco",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/tasteee/catco.git"
31
+ },
32
+ "bugs": "https://github.com/tasteee/catco/issues",
33
+ "author": "tasteink <rocolcleasure@gmail.com>",
34
+ "devDependencies": {
35
+ "@types/node": "^25.5.2",
36
+ "@types/sade": "^1.8.0",
37
+ "pkgroll": "^2.12.2",
38
+ "prettier": "^3.5.3",
39
+ "tsx": "^4.19.2",
40
+ "typescript": "^5.6.3",
41
+ "vitest": "^2.1.3"
42
+ },
43
+ "dependencies": {
44
+ "clipboardy": "^4.0.0",
45
+ "globby": "^14.0.2",
46
+ "sade": "^1.8.1"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "keywords": [
52
+ "ai",
53
+ "ai-assistant",
54
+ "ai-tools",
55
+ "gpt",
56
+ "copy",
57
+ "clipboard",
58
+ "claude",
59
+ "chatgpt",
60
+ "chatgpt4o",
61
+ "chatgpt4o-mini"
62
+ ]
63
+ }
package/dist/index.cjs DELETED
@@ -1,103 +0,0 @@
1
- 'use strict';
2
-
3
- var fs = require('node:fs');
4
- var path = require('node:path');
5
- var globby = require('globby');
6
- var clipboard = require('clipboardy');
7
-
8
- const minify = (content) => {
9
- const minified = 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
- if (!minified) return "(EMPTY FILE)";
11
- return minified;
12
- };
13
-
14
- const DEFAULT_ANTI_PATTERNS = [
15
- "node_modules",
16
- "node_modules/**",
17
- ".git",
18
- ".git/**",
19
- ".github",
20
- ".github/**",
21
- "dist",
22
- "dist/**",
23
- "build",
24
- "build/**",
25
- "coverage",
26
- "coverage/**",
27
- ".next",
28
- ".next/**",
29
- ".vercel",
30
- ".vercel/**",
31
- ".turbo",
32
- ".turbo/**",
33
- ".DS_Store",
34
- "*.log",
35
- "npm-debug.log",
36
- "yarn-error.log",
37
- "pnpm-debug.log",
38
- ".env",
39
- ".env.*"
40
- ];
41
-
42
- const argv = process.argv.slice(2);
43
- const getInput = () => {
44
- let hasIgnorePassed = false;
45
- const patterns = [];
46
- const ignorePatterns = [];
47
- for (const value of argv) {
48
- if (value === "--ignore") {
49
- hasIgnorePassed = true;
50
- continue;
51
- }
52
- if (hasIgnorePassed) ignorePatterns.push(value);
53
- if (!hasIgnorePassed) patterns.push(value);
54
- }
55
- const ignore = ignorePatterns.length ? ignorePatterns : DEFAULT_ANTI_PATTERNS;
56
- return { patterns, ignore };
57
- };
58
- const input = getInput();
59
-
60
- if (input.patterns.length === 0) {
61
- console.log("[catco] usage: catco [...patterns]");
62
- console.log("");
63
- console.log("Examples:");
64
- console.log(" catco ./");
65
- console.log(' catco "./src/**/*.ts"');
66
- console.log(' catco "./src/**/*.{js,ts}"');
67
- console.log(' catco "./*.js"');
68
- console.log(' catco "./src/**/index.ts"');
69
- console.log(' catco "./src/**/*.test.ts"');
70
- console.log(' catco "./**/*.md"');
71
- console.log(' catco "./src/utils/*.ts" "./src/components/*.ts"');
72
- console.log(' catco "./**/*" "!./node_modules"');
73
- console.log(' catco "./src/**/*" --exclude="./src/**/*.spec.ts"');
74
- console.log("");
75
- console.log("Supports multiple patterns and globs. Use quotes for complex patterns.");
76
- process.exit(1);
77
- }
78
- const createOutputContents = (filePath, content) => {
79
- return `/* FILE: ${path.resolve(filePath)} */ ${content} `;
80
- };
81
- const catco = async () => {
82
- const fileContentsList = [];
83
- const options = { ignore: input.ignore };
84
- const filePaths = await globby.globby(input.patterns, options);
85
- console.log(`[catco] found ${filePaths.length} files.`);
86
- for (const filePath of filePaths) {
87
- const content = await fs.promises.readFile(filePath, "utf-8");
88
- const final = createOutputContents(filePath, content);
89
- fileContentsList.push(final);
90
- }
91
- if (fileContentsList.length) {
92
- const joined = fileContentsList.join("\n");
93
- const minified = minify(joined);
94
- await clipboard.write(minified);
95
- console.log(`[catco] pre-minified length: ${joined.length}`);
96
- console.log(`[catco] post-minified length: ${minified.length}`);
97
- console.log(`[catco] all files contents copied to clipboard!`);
98
- }
99
- if (!fileContentsList) {
100
- console.warn(`[catco] no matching files found for patterns: ${input.patterns}`);
101
- }
102
- };
103
- catco();
package/dist/index.d.cts DELETED
@@ -1 +0,0 @@
1
- #!/usr/bin/env bun
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- #!/usr/bin/env bun
package/dist/index.js DELETED
@@ -1,102 +0,0 @@
1
- #!/usr/bin/env node
2
- import fs from 'node:fs';
3
- import path from 'node:path';
4
- import { globby } from 'globby';
5
- import clipboard from 'clipboardy';
6
-
7
- const minify = (content) => {
8
- const minified = 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
- if (!minified) return "(EMPTY FILE)";
10
- return minified;
11
- };
12
-
13
- const DEFAULT_ANTI_PATTERNS = [
14
- "node_modules",
15
- "node_modules/**",
16
- ".git",
17
- ".git/**",
18
- ".github",
19
- ".github/**",
20
- "dist",
21
- "dist/**",
22
- "build",
23
- "build/**",
24
- "coverage",
25
- "coverage/**",
26
- ".next",
27
- ".next/**",
28
- ".vercel",
29
- ".vercel/**",
30
- ".turbo",
31
- ".turbo/**",
32
- ".DS_Store",
33
- "*.log",
34
- "npm-debug.log",
35
- "yarn-error.log",
36
- "pnpm-debug.log",
37
- ".env",
38
- ".env.*"
39
- ];
40
-
41
- const argv = process.argv.slice(2);
42
- const getInput = () => {
43
- let hasIgnorePassed = false;
44
- const patterns = [];
45
- const ignorePatterns = [];
46
- for (const value of argv) {
47
- if (value === "--ignore") {
48
- hasIgnorePassed = true;
49
- continue;
50
- }
51
- if (hasIgnorePassed) ignorePatterns.push(value);
52
- if (!hasIgnorePassed) patterns.push(value);
53
- }
54
- const ignore = ignorePatterns.length ? ignorePatterns : DEFAULT_ANTI_PATTERNS;
55
- return { patterns, ignore };
56
- };
57
- const input = getInput();
58
-
59
- if (input.patterns.length === 0) {
60
- console.log("[catco] usage: catco [...patterns]");
61
- console.log("");
62
- console.log("Examples:");
63
- console.log(" catco ./");
64
- console.log(' catco "./src/**/*.ts"');
65
- console.log(' catco "./src/**/*.{js,ts}"');
66
- console.log(' catco "./*.js"');
67
- console.log(' catco "./src/**/index.ts"');
68
- console.log(' catco "./src/**/*.test.ts"');
69
- console.log(' catco "./**/*.md"');
70
- console.log(' catco "./src/utils/*.ts" "./src/components/*.ts"');
71
- console.log(' catco "./**/*" "!./node_modules"');
72
- console.log(' catco "./src/**/*" --exclude="./src/**/*.spec.ts"');
73
- console.log("");
74
- console.log("Supports multiple patterns and globs. Use quotes for complex patterns.");
75
- process.exit(1);
76
- }
77
- const createOutputContents = (filePath, content) => {
78
- return `/* FILE: ${path.resolve(filePath)} */ ${content} `;
79
- };
80
- const catco = async () => {
81
- const fileContentsList = [];
82
- const options = { ignore: input.ignore };
83
- const filePaths = await globby(input.patterns, options);
84
- console.log(`[catco] found ${filePaths.length} files.`);
85
- for (const filePath of filePaths) {
86
- const content = await fs.promises.readFile(filePath, "utf-8");
87
- const final = createOutputContents(filePath, content);
88
- fileContentsList.push(final);
89
- }
90
- if (fileContentsList.length) {
91
- const joined = fileContentsList.join("\n");
92
- const minified = minify(joined);
93
- await clipboard.write(minified);
94
- console.log(`[catco] pre-minified length: ${joined.length}`);
95
- console.log(`[catco] post-minified length: ${minified.length}`);
96
- console.log(`[catco] all files contents copied to clipboard!`);
97
- }
98
- if (!fileContentsList) {
99
- console.warn(`[catco] no matching files found for patterns: ${input.patterns}`);
100
- }
101
- };
102
- catco();
package/dist/index.mjs DELETED
@@ -1,101 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { globby } from 'globby';
4
- import clipboard from 'clipboardy';
5
-
6
- const minify = (content) => {
7
- const minified = 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();
8
- if (!minified) return "(EMPTY FILE)";
9
- return minified;
10
- };
11
-
12
- const DEFAULT_ANTI_PATTERNS = [
13
- "node_modules",
14
- "node_modules/**",
15
- ".git",
16
- ".git/**",
17
- ".github",
18
- ".github/**",
19
- "dist",
20
- "dist/**",
21
- "build",
22
- "build/**",
23
- "coverage",
24
- "coverage/**",
25
- ".next",
26
- ".next/**",
27
- ".vercel",
28
- ".vercel/**",
29
- ".turbo",
30
- ".turbo/**",
31
- ".DS_Store",
32
- "*.log",
33
- "npm-debug.log",
34
- "yarn-error.log",
35
- "pnpm-debug.log",
36
- ".env",
37
- ".env.*"
38
- ];
39
-
40
- const argv = process.argv.slice(2);
41
- const getInput = () => {
42
- let hasIgnorePassed = false;
43
- const patterns = [];
44
- const ignorePatterns = [];
45
- for (const value of argv) {
46
- if (value === "--ignore") {
47
- hasIgnorePassed = true;
48
- continue;
49
- }
50
- if (hasIgnorePassed) ignorePatterns.push(value);
51
- if (!hasIgnorePassed) patterns.push(value);
52
- }
53
- const ignore = ignorePatterns.length ? ignorePatterns : DEFAULT_ANTI_PATTERNS;
54
- return { patterns, ignore };
55
- };
56
- const input = getInput();
57
-
58
- if (input.patterns.length === 0) {
59
- console.log("[catco] usage: catco [...patterns]");
60
- console.log("");
61
- console.log("Examples:");
62
- console.log(" catco ./");
63
- console.log(' catco "./src/**/*.ts"');
64
- console.log(' catco "./src/**/*.{js,ts}"');
65
- console.log(' catco "./*.js"');
66
- console.log(' catco "./src/**/index.ts"');
67
- console.log(' catco "./src/**/*.test.ts"');
68
- console.log(' catco "./**/*.md"');
69
- console.log(' catco "./src/utils/*.ts" "./src/components/*.ts"');
70
- console.log(' catco "./**/*" "!./node_modules"');
71
- console.log(' catco "./src/**/*" --exclude="./src/**/*.spec.ts"');
72
- console.log("");
73
- console.log("Supports multiple patterns and globs. Use quotes for complex patterns.");
74
- process.exit(1);
75
- }
76
- const createOutputContents = (filePath, content) => {
77
- return `/* FILE: ${path.resolve(filePath)} */ ${content} `;
78
- };
79
- const catco = async () => {
80
- const fileContentsList = [];
81
- const options = { ignore: input.ignore };
82
- const filePaths = await globby(input.patterns, options);
83
- console.log(`[catco] found ${filePaths.length} files.`);
84
- for (const filePath of filePaths) {
85
- const content = await fs.promises.readFile(filePath, "utf-8");
86
- const final = createOutputContents(filePath, content);
87
- fileContentsList.push(final);
88
- }
89
- if (fileContentsList.length) {
90
- const joined = fileContentsList.join("\n");
91
- const minified = minify(joined);
92
- await clipboard.write(minified);
93
- console.log(`[catco] pre-minified length: ${joined.length}`);
94
- console.log(`[catco] post-minified length: ${minified.length}`);
95
- console.log(`[catco] all files contents copied to clipboard!`);
96
- }
97
- if (!fileContentsList) {
98
- console.warn(`[catco] no matching files found for patterns: ${input.patterns}`);
99
- }
100
- };
101
- catco();