tree-fs 0.1.2 → 0.1.4

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
@@ -131,6 +131,17 @@ project
131
131
  Known files without extensions are correctly identified as files.
132
132
  * `Dockerfile`, `Makefile`, `LICENSE`, `Procfile`, `.gitignore`, `Jenkinsfile`
133
133
 
134
+ ### 6. Indicators & Comments
135
+ We strip out common markers used to highlight specific files in documentation.
136
+ ```text
137
+ project
138
+ ├── src/ <-- Working directory
139
+ ├── utils.js // Deprecated
140
+ └── .env # Do not commit
141
+ ```
142
+
143
+ *Result: Creates folder src and files utils.js, .env. All comments are ignored.*
144
+
134
145
  ## 📦 CI/CD Integration
135
146
 
136
147
  You can use `tree-fs` to scaffold environments in GitHub Actions or pipelines.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tree-fs",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
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"
package/src/normaliser.js CHANGED
@@ -16,9 +16,22 @@ function normaliseLines(input) {
16
16
  const match = normalizedRaw.match(STRIP_REGEX)
17
17
  const prefixLength = match ? match[0].length : 0
18
18
 
19
- // 3. Strip comments (anything after ' #')
20
- const commentIndex = normalizedRaw.indexOf(" #")
21
- let cleaned = commentIndex !== -1 ? normalizedRaw.substring(0, commentIndex) : normalizedRaw
19
+ // 3. Strip comments
20
+ // Look for multiple comment styles. We use "space + marker" to avoid false positives.
21
+ const commentMarkers = [" #", " <--", " //"]
22
+ let splitIndex = -1
23
+
24
+ for (const marker of commentMarkers) {
25
+ const idx = normalizedRaw.indexOf(marker)
26
+ if (idx !== -1) {
27
+ // Keep the earliest marker found
28
+ if (splitIndex === -1 || idx < splitIndex) {
29
+ splitIndex = idx
30
+ }
31
+ }
32
+ }
33
+
34
+ let cleaned = splitIndex !== -1 ? normalizedRaw.substring(0, splitIndex) : normalizedRaw
22
35
 
23
36
  // 4. Check for explicit trailing slash
24
37
  const endsWithSlash = cleaned.trim().endsWith("/")