treedocs 0.3.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/LICENSE +21 -0
- package/README.md +140 -0
- package/dist/treedocs.js +16108 -0
- package/package.json +42 -0
- package/site/schemas/0.2.0/treedocs-0.2.0.schema.json +337 -0
- package/site/schemas/0.2.0/treedocs.schema.json +337 -0
- package/src/cli.ts +650 -0
- package/src/core.ts +2051 -0
- package/src/index.ts +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel Lyons
|
|
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,140 @@
|
|
|
1
|
+
# treedocs
|
|
2
|
+
|
|
3
|
+
`treedocs` keeps a version-controlled architectural map of a repository in `treedocs.yaml`. It scans the filesystem into a nested YAML tree, stores descriptions and references beside paths, and reports drift when the repository changes.
|
|
4
|
+
|
|
5
|
+
This rewrite is a Bun-native TypeScript CLI intended for npm distribution. The old Swift package, interactive terminal UI, DocC assets, Homebrew formulae, and historical migration scaffolding were removed so the package focuses on the useful portable workflow.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
`treedocs` is published as an npm package with a Bun executable entrypoint. Install Bun first, then install the package:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g treedocs
|
|
13
|
+
treedocs --help
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
For local development:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bun install
|
|
20
|
+
bun run src/cli.ts --help
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
treedocs init
|
|
27
|
+
treedocs sync
|
|
28
|
+
treedocs check
|
|
29
|
+
treedocs show .
|
|
30
|
+
treedocs explore src/ tests/
|
|
31
|
+
treedocs ls
|
|
32
|
+
treedocs inspect src/ --recursive
|
|
33
|
+
treedocs update README.md "Project overview"
|
|
34
|
+
treedocs update src/ --add-reference DOCS/Architecture.md
|
|
35
|
+
treedocs update docs/api/ --link src/api/
|
|
36
|
+
treedocs path renderer
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Shared options:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
-p, --path <path> Repository root, defaults to .
|
|
43
|
+
-n, --non-interactive Accepted for script compatibility
|
|
44
|
+
-f, --full-descriptions Render untruncated descriptions for show/explore/ls
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Bare path usage is shorthand for `show`:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
treedocs src/
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## What It Keeps
|
|
54
|
+
|
|
55
|
+
- Scans files and directories into `treedocs.yaml`
|
|
56
|
+
- Treats nested `treedocs.yaml` files as delegated documentation boundaries
|
|
57
|
+
- Preserves descriptions, references, and `_link` aliases during sync
|
|
58
|
+
- Computes deterministic `sha256:` signatures from repository structure
|
|
59
|
+
- Merges built-in excludes, config excludes, `.gitignore`, and `.treedocs/.treedocs_ignore`
|
|
60
|
+
- Validates `treedocs.yaml` against the bundled JSON Schema
|
|
61
|
+
- Renders full trees, subtrees, and shallow exploration views
|
|
62
|
+
- Searches paths and descriptions for shell workflows
|
|
63
|
+
|
|
64
|
+
## YAML Shape
|
|
65
|
+
|
|
66
|
+
Generated files include a YAML language-server schema header and use schema version `0.2.0`:
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
# yaml-language-server: $schema=https://dandylyons.github.io/treedocs/schemas/0.2.0/treedocs.schema.json
|
|
70
|
+
schema_version: "0.2.0"
|
|
71
|
+
project:
|
|
72
|
+
name: example
|
|
73
|
+
version: "0.0.0"
|
|
74
|
+
last_updated: "2026-07-05"
|
|
75
|
+
signature: "sha256:..."
|
|
76
|
+
tree:
|
|
77
|
+
README.md: Project overview
|
|
78
|
+
src:
|
|
79
|
+
_doc:
|
|
80
|
+
_description: Source files
|
|
81
|
+
_references:
|
|
82
|
+
- DOCS/Architecture.md
|
|
83
|
+
cli.ts: Command-line entrypoint
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Directory documentation is stored under `_doc`. File entries can be compact strings or mappings with `_description`, `_references`, and `_link`.
|
|
87
|
+
|
|
88
|
+
## Configuration
|
|
89
|
+
|
|
90
|
+
Configuration is merged in this order:
|
|
91
|
+
|
|
92
|
+
1. Built-in defaults
|
|
93
|
+
2. `~/.config/treedocs/config.yaml`
|
|
94
|
+
3. `.treedocs/config.yaml`
|
|
95
|
+
4. `treedocs.yaml` `overrides`
|
|
96
|
+
|
|
97
|
+
Supported keys:
|
|
98
|
+
|
|
99
|
+
```yaml
|
|
100
|
+
exclude:
|
|
101
|
+
- Generated/
|
|
102
|
+
use_gitignore: true
|
|
103
|
+
max_description_length: 120
|
|
104
|
+
indent_size: 2
|
|
105
|
+
align_columns: false
|
|
106
|
+
check_severity: error # error or warn
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Standard scanner excludes are `.git/`, `.build/`, `.swiftpm/`, `.treedocs/`, `.agents/`, `.opencode/`, `node_modules/`, and `treedocs.yaml`.
|
|
110
|
+
|
|
111
|
+
## Development
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
bun install
|
|
115
|
+
bun run typecheck
|
|
116
|
+
bun run lint
|
|
117
|
+
bun test
|
|
118
|
+
bun run build
|
|
119
|
+
bun run check
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The package uses:
|
|
123
|
+
|
|
124
|
+
- Bun for runtime, tests, and bundling
|
|
125
|
+
- TypeScript for implementation
|
|
126
|
+
- Biome with its default recommended formatting/linting setup
|
|
127
|
+
- `yaml` for YAML parsing/serialization
|
|
128
|
+
- `ajv` for JSON Schema validation
|
|
129
|
+
|
|
130
|
+
## Publish
|
|
131
|
+
|
|
132
|
+
Build and verify before publishing:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
bun run check
|
|
136
|
+
bun run build
|
|
137
|
+
npm publish
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The npm package ships `dist/treedocs.js`, `src/`, the bundled schema under `site/schemas/`, `README.md`, and `LICENSE`.
|