tree-fs 1.0.0 → 1.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/README.md +5 -1
- package/package.json +3 -3
- package/src/normaliser.js +16 -11
package/README.md
CHANGED
|
@@ -203,4 +203,8 @@ tree-fs structure.txt --dry-run
|
|
|
203
203
|
|
|
204
204
|
## License
|
|
205
205
|
|
|
206
|
-
MIT
|
|
206
|
+
MIT
|
|
207
|
+
|
|
208
|
+
> **{ github.com/mgks }**
|
|
209
|
+
>
|
|
210
|
+
>  
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tree-fs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Generate file system structures from text-based directory trees. The standard receiver for AI-generated project scaffolding.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tree-fs": "bin/tree-fs.js"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"LICENSE"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"test": "echo \"
|
|
17
|
+
"test": "echo \"No tests specified currently\" && exit 0",
|
|
18
18
|
"start": "node bin/tree-fs.js"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
@@ -48,4 +48,4 @@
|
|
|
48
48
|
"homepage": "https://github.com/mgks/tree-fs#readme",
|
|
49
49
|
"funding": "https://github.com/sponsors/mgks",
|
|
50
50
|
"license": "MIT"
|
|
51
|
-
}
|
|
51
|
+
}
|
package/src/normaliser.js
CHANGED
|
@@ -20,13 +20,19 @@ function normaliseLines(input) {
|
|
|
20
20
|
.filter(Boolean)
|
|
21
21
|
.map(raw => {
|
|
22
22
|
// A. Normalize slashes
|
|
23
|
-
|
|
23
|
+
let normalizedRaw = raw.replace(/\\/g, "/")
|
|
24
24
|
|
|
25
|
-
// B.
|
|
25
|
+
// B. "Broken Root" Normalization
|
|
26
|
+
// Fixes copy-paste artifacts where the first line is missing the pipe (── vs ├──)
|
|
27
|
+
if (normalizedRaw.trim().startsWith("── ")) {
|
|
28
|
+
normalizedRaw = normalizedRaw.replace("── ", "├── ")
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// C. Calculate Indent (Must happen AFTER normalization)
|
|
26
32
|
const treeMatch = normalizedRaw.match(STRIP_REGEX)
|
|
27
33
|
const prefixLength = treeMatch ? treeMatch[0].length : 0
|
|
28
34
|
|
|
29
|
-
//
|
|
35
|
+
// D. Strip Explicit Comments
|
|
30
36
|
const commentMarkers = [" #", " <--", " //"]
|
|
31
37
|
let splitIndex = -1
|
|
32
38
|
for (const marker of commentMarkers) {
|
|
@@ -37,15 +43,14 @@ function normaliseLines(input) {
|
|
|
37
43
|
}
|
|
38
44
|
let cleaned = splitIndex !== -1 ? normalizedRaw.substring(0, splitIndex) : normalizedRaw
|
|
39
45
|
|
|
40
|
-
//
|
|
41
|
-
// We repeat the trailing checks to handle mixed cases like "file.js (Logic) 🚀"
|
|
46
|
+
// E. Deep Cleaning Chain
|
|
42
47
|
cleaned = cleaned
|
|
43
|
-
.replace(STRIP_REGEX, "")
|
|
44
|
-
.replace(LEADING_EMOJI_REGEX, "")
|
|
45
|
-
.replace(TRAILING_EMOJI_REGEX, "")
|
|
46
|
-
.replace(PAREN_COMMENT_REGEX, "")
|
|
47
|
-
.replace(TRAILING_EMOJI_REGEX, "")
|
|
48
|
-
.replace(/\/$/, "")
|
|
48
|
+
.replace(STRIP_REGEX, "")
|
|
49
|
+
.replace(LEADING_EMOJI_REGEX, "")
|
|
50
|
+
.replace(TRAILING_EMOJI_REGEX, "")
|
|
51
|
+
.replace(PAREN_COMMENT_REGEX, "")
|
|
52
|
+
.replace(TRAILING_EMOJI_REGEX, "")
|
|
53
|
+
.replace(/\/$/, "")
|
|
49
54
|
.trim()
|
|
50
55
|
|
|
51
56
|
return {
|