aslopcleaner 1.0.7 → 1.1.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 +23 -9
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{scanner-DAmuBcau.mjs → scanner-CwP7wqm4.mjs} +12 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,12 +6,34 @@ High-performance CLI to normalize common LLM/AI Unicode punctuation and symbols
|
|
|
6
6
|
|
|
7
7
|
- Recursively scans the current directory.
|
|
8
8
|
- Uses `fast-glob` to skip expensive third-party/build/cache directories early.
|
|
9
|
+
- Reads `.agentsignore` (if present) for additional glob patterns to skip.
|
|
9
10
|
- Never opens `.env*`, SSH keys, certificate/key material, or password database files.
|
|
10
11
|
- Skips files larger than **125 KiB**.
|
|
11
12
|
- Uses a jump-sampled binary heuristic before reading as UTF-8.
|
|
12
13
|
- Prompts once per file in interactive mode.
|
|
13
14
|
- Replaces everything automatically in non-interactive mode with `-y`.
|
|
14
15
|
|
|
16
|
+
## Run it
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bunx aslopcleaner # Bun
|
|
20
|
+
npx aslopcleaner # npm
|
|
21
|
+
pnpx aslopcleaner # pnpm
|
|
22
|
+
yarn dlx aslopcleaner # Yarn
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## `.agentsignore`
|
|
26
|
+
|
|
27
|
+
Create a `.agentsignore` file in the directory you run `aslopcleaner` from. Each line is a glob pattern (same syntax as `.gitignore`). Blank lines and lines starting with `#` are comments.
|
|
28
|
+
|
|
29
|
+
```gitignore
|
|
30
|
+
# skip all markdown files
|
|
31
|
+
**/*.md
|
|
32
|
+
|
|
33
|
+
# skip a specific directory
|
|
34
|
+
generated/**
|
|
35
|
+
```
|
|
36
|
+
|
|
15
37
|
## Default replacements
|
|
16
38
|
|
|
17
39
|
### Dashes / hyphens
|
|
@@ -333,15 +355,6 @@ High-performance CLI to normalize common LLM/AI Unicode punctuation and symbols
|
|
|
333
355
|
- `╂` => `+` (box drawings light vertical and horizontal)
|
|
334
356
|
- `╋` => `+` (box drawings heavy vertical and horizontal)
|
|
335
357
|
|
|
336
|
-
## Run it
|
|
337
|
-
|
|
338
|
-
```bash
|
|
339
|
-
bunx aslopcleaner # Bun
|
|
340
|
-
npx aslopcleaner # npm
|
|
341
|
-
pnpx aslopcleaner # pnpm
|
|
342
|
-
yarn dlx aslopcleaner # Yarn
|
|
343
|
-
```
|
|
344
|
-
|
|
345
358
|
### Local testing
|
|
346
359
|
|
|
347
360
|
```bash
|
|
@@ -368,6 +381,7 @@ import {
|
|
|
368
381
|
scanDirectory,
|
|
369
382
|
isProbablyBinary,
|
|
370
383
|
shouldSkipSensitivePath,
|
|
384
|
+
loadAgentsIgnore,
|
|
371
385
|
REPLACEMENT_RULES,
|
|
372
386
|
REPLACEMENT_RULE_MAP,
|
|
373
387
|
} from "aslopcleaner";
|
package/dist/cli.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import process from 'node:process';
|
|
4
4
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
5
5
|
import * as readline from 'node:readline/promises';
|
|
6
|
-
import { R as REPLACEMENT_RULES, s as scanDirectory, d as shouldSkipSensitivePath, b as applyOccurrences, c as countByMatch, a as REPLACEMENT_RULE_MAP } from './scanner-
|
|
6
|
+
import { R as REPLACEMENT_RULES, s as scanDirectory, d as shouldSkipSensitivePath, b as applyOccurrences, c as countByMatch, a as REPLACEMENT_RULE_MAP } from './scanner-CwP7wqm4.mjs';
|
|
7
7
|
import 'fast-glob';
|
|
8
8
|
|
|
9
9
|
function parseArgs(argv) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { F as FAST_GLOB_IGNORE_PATTERNS, M as MAX_FILE_SIZE_BYTES, R as REPLACEMENT_RULES, a as REPLACEMENT_RULE_MAP, b as applyOccurrences, c as countByMatch, f as findOccurrences, i as isProbablyBinary, n as normalizeGlobPath, s as scanDirectory, d as shouldSkipSensitivePath } from './scanner-
|
|
2
|
+
export { F as FAST_GLOB_IGNORE_PATTERNS, M as MAX_FILE_SIZE_BYTES, R as REPLACEMENT_RULES, a as REPLACEMENT_RULE_MAP, b as applyOccurrences, c as countByMatch, f as findOccurrences, i as isProbablyBinary, l as loadAgentsIgnore, n as normalizeGlobPath, s as scanDirectory, d as shouldSkipSensitivePath } from './scanner-CwP7wqm4.mjs';
|
|
3
3
|
import 'fast-glob';
|
|
4
4
|
import 'node:path';
|
|
5
5
|
import 'node:fs/promises';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fg from 'fast-glob';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { open, stat
|
|
3
|
+
import { readFile, open, stat } from 'node:fs/promises';
|
|
4
4
|
|
|
5
5
|
const SKIPPED_DIRECTORIES = [
|
|
6
6
|
".git",
|
|
@@ -119,6 +119,14 @@ function shouldSkipSensitivePath(filePath) {
|
|
|
119
119
|
function normalizeGlobPath(filePath) {
|
|
120
120
|
return filePath.split(path.sep).join("/");
|
|
121
121
|
}
|
|
122
|
+
async function loadAgentsIgnore(cwd) {
|
|
123
|
+
try {
|
|
124
|
+
const content = await readFile(path.join(cwd, ".agentsignore"), "utf8");
|
|
125
|
+
return content.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
126
|
+
} catch {
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
122
130
|
|
|
123
131
|
function findOccurrences(content, rules) {
|
|
124
132
|
const matches = [];
|
|
@@ -897,13 +905,14 @@ async function scanDirectory(cwd) {
|
|
|
897
905
|
let skippedBySensitivePattern = 0;
|
|
898
906
|
let skippedBySize = 0;
|
|
899
907
|
let skippedByBinary = 0;
|
|
908
|
+
const agentsIgnorePatterns = await loadAgentsIgnore(cwd);
|
|
900
909
|
const stream = fg.stream("**/*", {
|
|
901
910
|
cwd,
|
|
902
911
|
onlyFiles: true,
|
|
903
912
|
dot: true,
|
|
904
913
|
followSymbolicLinks: false,
|
|
905
914
|
unique: true,
|
|
906
|
-
ignore: [...FAST_GLOB_IGNORE_PATTERNS]
|
|
915
|
+
ignore: [...FAST_GLOB_IGNORE_PATTERNS, ...agentsIgnorePatterns]
|
|
907
916
|
});
|
|
908
917
|
const inFlight = /* @__PURE__ */ new Set();
|
|
909
918
|
const schedule = async (relativePath) => {
|
|
@@ -945,4 +954,4 @@ async function scanDirectory(cwd) {
|
|
|
945
954
|
};
|
|
946
955
|
}
|
|
947
956
|
|
|
948
|
-
export { FAST_GLOB_IGNORE_PATTERNS as F, MAX_FILE_SIZE_BYTES as M, REPLACEMENT_RULES as R, REPLACEMENT_RULE_MAP as a, applyOccurrences as b, countByMatch as c, shouldSkipSensitivePath as d, findOccurrences as f, isProbablyBinary as i, normalizeGlobPath as n, scanDirectory as s };
|
|
957
|
+
export { FAST_GLOB_IGNORE_PATTERNS as F, MAX_FILE_SIZE_BYTES as M, REPLACEMENT_RULES as R, REPLACEMENT_RULE_MAP as a, applyOccurrences as b, countByMatch as c, shouldSkipSensitivePath as d, findOccurrences as f, isProbablyBinary as i, loadAgentsIgnore as l, normalizeGlobPath as n, scanDirectory as s };
|