watchdocs 0.1.2
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
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# WatchDocs CLI
|
|
2
|
+
|
|
3
|
+
A lightweight CLI tool that scans a project for dependencies and returns their official documentation URLs as structured JSON — built for AI agents and developers.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx watchdocs scan
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
No installation needed. Works via `npx` anywhere Node.js is available.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
### `watchdocs scan`
|
|
18
|
+
|
|
19
|
+
Recursively scans the current directory for manifest files, parses dependencies, and resolves official doc URLs from their respective registries.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
watchdocs scan
|
|
23
|
+
watchdocs scan --path ./frontend
|
|
24
|
+
watchdocs scan --ecosystem npm,go
|
|
25
|
+
watchdocs scan --slim
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
| Flag | Description |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `--path <dir>` | Target a specific directory instead of cwd |
|
|
31
|
+
| `--ecosystem <list>` | Filter by ecosystem(s), comma-separated |
|
|
32
|
+
| `--slim` | Return only `name` and `docUrl` per result (saves tokens) |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
### `watchdocs lookup`
|
|
37
|
+
|
|
38
|
+
Look up a single package by name without needing a manifest file.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
watchdocs lookup express --ecosystem npm
|
|
42
|
+
watchdocs lookup github.com/spf13/cobra --ecosystem go
|
|
43
|
+
watchdocs lookup requests --ecosystem pip --slim
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
| Flag | Description |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `--ecosystem <eco>` | Required — one of: `npm`, `go`, `pip`, `cargo`, `pub`, `maven` |
|
|
49
|
+
| `--slim` | Return only `name` and `docUrl` |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Output
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"scanned": ["go.mod", "package.json"],
|
|
58
|
+
"total": 5,
|
|
59
|
+
"results": [
|
|
60
|
+
{
|
|
61
|
+
"name": "express",
|
|
62
|
+
"version": "^4.18.0",
|
|
63
|
+
"ecosystem": "npm",
|
|
64
|
+
"type": "prod",
|
|
65
|
+
"docUrl": "https://expressjs.com",
|
|
66
|
+
"status": "resolved"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`status` is either `"resolved"` or `"not_found"`.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Supported Ecosystems
|
|
77
|
+
|
|
78
|
+
| Ecosystem | Manifest files | Registry |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| `npm` | `package.json` | registry.npmjs.org |
|
|
81
|
+
| `go` | `go.mod` | proxy.golang.org / pkg.go.dev |
|
|
82
|
+
| `pip` | `requirements.txt`, `pyproject.toml`, `uv.lock` | pypi.org |
|
|
83
|
+
| `cargo` | `Cargo.toml` | crates.io |
|
|
84
|
+
| `pub` | `pubspec.yaml` | pub.dev |
|
|
85
|
+
| `maven` | `pom.xml` | search.maven.org |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Building from Source
|
|
90
|
+
|
|
91
|
+
### Prerequisites
|
|
92
|
+
- [Go](https://go.dev/doc/install) 1.21+
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
git clone https://github.com/prohv/watchdocs-cli
|
|
96
|
+
cd watchdocs-cli
|
|
97
|
+
go build -o watchdocs .
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Project Structure
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
watchdocs-cli/
|
|
106
|
+
├── cmd/ # CLI commands (scan, lookup)
|
|
107
|
+
├── internal/
|
|
108
|
+
│ ├── scanner/ # Recursive manifest file detection
|
|
109
|
+
│ ├── parser/ # Per-ecosystem manifest parsers
|
|
110
|
+
│ ├── resolver/ # Per-ecosystem online resolvers
|
|
111
|
+
│ └── models/ # Shared types (Dependency, DocResult)
|
|
112
|
+
├── bin/
|
|
113
|
+
│ └── watchdocs.js # npm binary shim
|
|
114
|
+
├── binaries/ # Pre-built platform binaries (not in git)
|
|
115
|
+
├── package.json
|
|
116
|
+
└── main.go
|
|
117
|
+
```
|
package/bin/watchdocs.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
|
|
7
|
+
const platform = os.platform(); // linux, darwin, win32
|
|
8
|
+
const arch = os.arch(); // x64, arm64
|
|
9
|
+
|
|
10
|
+
const binaryMap = {
|
|
11
|
+
"linux-x64": "watchdocs-linux-x64",
|
|
12
|
+
"darwin-x64": "watchdocs-darwin-x64",
|
|
13
|
+
"darwin-arm64": "watchdocs-darwin-arm64",
|
|
14
|
+
"win32-x64": "watchdocs-win32-x64.exe",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const key = `${platform}-${arch}`;
|
|
18
|
+
const binaryName = binaryMap[key];
|
|
19
|
+
|
|
20
|
+
if (!binaryName) {
|
|
21
|
+
console.error(`watchdocs: unsupported platform: ${key}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const binaryPath = path.join(__dirname, "..", "binaries", binaryName);
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
execFileSync(binaryPath, process.argv.slice(2), { stdio: "inherit" });
|
|
29
|
+
} catch (err) {
|
|
30
|
+
process.exit(err.status ?? 1);
|
|
31
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "watchdocs",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Scan a project for dependencies and get official documentation URLs — agent-friendly JSON output.",
|
|
5
|
+
"keywords": ["docs", "dependencies", "cli", "agents", "ai"],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"watchdocs": "./bin/watchdocs.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"binaries/"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=14"
|
|
16
|
+
}
|
|
17
|
+
}
|