docs-for-me 0.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/LICENSE +21 -0
- package/README.md +217 -0
- package/bin/docs-for-me.cjs +64 -0
- package/package.json +46 -0
- package/prebuilt/win32-x64/docs-for-me.exe +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 John Manuel A. Cuerdo
|
|
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,217 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://i.pinimg.com/736x/7a/6d/a5/7a6da5d2962db34846138e08e2932f01.jpg" alt="docs-for-me logo" width="220">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">docs-for-me</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
A CLI that creates programmer-friendly guides for files, folders, and Git changes.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
It is meant for the everyday developer moment where you want to know:
|
|
12
|
+
|
|
13
|
+
- What is in this file?
|
|
14
|
+
- What does this folder contain?
|
|
15
|
+
- What did I change before I commit?
|
|
16
|
+
- What commit message can I copy after reviewing the changes?
|
|
17
|
+
|
|
18
|
+
The output is Markdown, so it can be read in a terminal, saved beside a project,
|
|
19
|
+
or deleted after review.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
The intended install path is npm:
|
|
24
|
+
|
|
25
|
+
```powershell
|
|
26
|
+
npx docs-for-me --help
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or install it inside a project:
|
|
30
|
+
|
|
31
|
+
```powershell
|
|
32
|
+
npm install --save-dev docs-for-me
|
|
33
|
+
npx docs-for-me changes --ai none --out changes-guide.md
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This is the main distribution goal: users should not need to install Python,
|
|
37
|
+
pip, or pipx just to use the tool.
|
|
38
|
+
|
|
39
|
+
The first npm release ships with a bundled Windows x64 executable. macOS and
|
|
40
|
+
Linux builds can be added after the Windows release flow is stable.
|
|
41
|
+
|
|
42
|
+
## What It Does
|
|
43
|
+
|
|
44
|
+
`docs-for-me` supports three main tasks:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
docs-for-me file <path>
|
|
48
|
+
docs-for-me folder <path>
|
|
49
|
+
docs-for-me changes
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
It has two modes:
|
|
53
|
+
|
|
54
|
+
- `--ai none` uses local static analysis and Git diff parsing.
|
|
55
|
+
- `--ai opencode` asks OpenCode to write a fuller guide.
|
|
56
|
+
|
|
57
|
+
Static mode is useful when you want quick local output. OpenCode mode is useful
|
|
58
|
+
when you want a more natural explanation.
|
|
59
|
+
|
|
60
|
+
## Basic Usage
|
|
61
|
+
|
|
62
|
+
Document one file:
|
|
63
|
+
|
|
64
|
+
```powershell
|
|
65
|
+
docs-for-me file "app/(dashboard)/bookings/page.tsx" --ai none --out bookings-doc.md
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Document one folder:
|
|
69
|
+
|
|
70
|
+
```powershell
|
|
71
|
+
docs-for-me folder app --ai none --out app-docs.md
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Explain unstaged Git changes:
|
|
75
|
+
|
|
76
|
+
```powershell
|
|
77
|
+
docs-for-me changes --ai none --out changes-guide.md
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Explain staged Git changes:
|
|
81
|
+
|
|
82
|
+
```powershell
|
|
83
|
+
docs-for-me changes --staged --ai none --out changes-guide.md
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Compare changes since a branch or ref:
|
|
87
|
+
|
|
88
|
+
```powershell
|
|
89
|
+
docs-for-me changes --since main --ai none --out changes-guide.md
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## OpenCode Mode
|
|
93
|
+
|
|
94
|
+
OpenCode mode uses the `opencode` CLI as the AI provider.
|
|
95
|
+
|
|
96
|
+
First, make sure OpenCode works:
|
|
97
|
+
|
|
98
|
+
```powershell
|
|
99
|
+
opencode run "Say hello in one sentence."
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Then run:
|
|
103
|
+
|
|
104
|
+
```powershell
|
|
105
|
+
docs-for-me file "app/(dashboard)/bookings/page.tsx" --ai opencode --out bookings-ai-doc.md
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Or for Git changes:
|
|
109
|
+
|
|
110
|
+
```powershell
|
|
111
|
+
docs-for-me changes --ai opencode --out changes-ai-guide.md
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
When OpenCode is working, the generated Markdown should not contain:
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
- **AI:** unavailable or disabled (`opencode`)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Contributor Setup
|
|
121
|
+
|
|
122
|
+
The core CLI is written in Python, but npm is the user-facing package path.
|
|
123
|
+
Use this setup only when developing `docs-for-me` itself:
|
|
124
|
+
|
|
125
|
+
```powershell
|
|
126
|
+
python -m venv .venv
|
|
127
|
+
.venv\Scripts\activate
|
|
128
|
+
pip install -e . pytest
|
|
129
|
+
pytest
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
To build the Windows executable that the npm package runs:
|
|
133
|
+
|
|
134
|
+
```powershell
|
|
135
|
+
npm run build:exe:win
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Then test the npm wrapper locally:
|
|
139
|
+
|
|
140
|
+
```powershell
|
|
141
|
+
npm run test:npm-local
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The npm wrapper expects the executable here:
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
prebuilt/win32-x64/docs-for-me.exe
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
When publishing to npm, that executable is included so users can run
|
|
151
|
+
`npx docs-for-me ...` without setting up Python.
|
|
152
|
+
|
|
153
|
+
If that line appears, `docs-for-me` fell back to static mode.
|
|
154
|
+
|
|
155
|
+
## Git Changes Guide
|
|
156
|
+
|
|
157
|
+
The `changes` command is designed for pre-commit review. It summarizes the diff,
|
|
158
|
+
lists changed files, explains what the changes appear to do, and includes a
|
|
159
|
+
copy-paste-ready commit message.
|
|
160
|
+
|
|
161
|
+
Example output includes:
|
|
162
|
+
|
|
163
|
+
```text
|
|
164
|
+
update: search behavior and plan limits
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Review the generated guide before committing. The guide is meant to save time,
|
|
168
|
+
not replace your own final check.
|
|
169
|
+
|
|
170
|
+
## Progress Messages
|
|
171
|
+
|
|
172
|
+
Commands print progress messages so long-running AI calls do not look frozen:
|
|
173
|
+
|
|
174
|
+
```text
|
|
175
|
+
[ 0.0s] Reading file: app/(dashboard)/bookings/page.tsx
|
|
176
|
+
[ 0.0s] Preparing documentation with provider: opencode
|
|
177
|
+
[ 0.0s] Waiting for AI response. This can take a moment...
|
|
178
|
+
[ 5.0s] OpenCode is reading the file and prompt...
|
|
179
|
+
[ 10.0s] OpenCode is drafting the guide...
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Hide progress messages with:
|
|
183
|
+
|
|
184
|
+
```powershell
|
|
185
|
+
docs-for-me file README.md --quiet
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Privacy
|
|
189
|
+
|
|
190
|
+
`--ai none` runs locally and does not call an AI provider.
|
|
191
|
+
|
|
192
|
+
`--ai opencode` sends the relevant file contents or Git diff to OpenCode and to
|
|
193
|
+
whatever model/provider OpenCode is configured to use. Do not use AI mode on
|
|
194
|
+
private or sensitive code unless you are comfortable with that provider handling
|
|
195
|
+
the content.
|
|
196
|
+
|
|
197
|
+
## Current Provider Support
|
|
198
|
+
|
|
199
|
+
Today:
|
|
200
|
+
|
|
201
|
+
- `none`
|
|
202
|
+
- `opencode`
|
|
203
|
+
|
|
204
|
+
The code is provider-based, so more providers can be added later.
|
|
205
|
+
|
|
206
|
+
## Project Status
|
|
207
|
+
|
|
208
|
+
`docs-for-me` is early-stage. It already works as a local CLI, but the package is
|
|
209
|
+
not published yet.
|
|
210
|
+
|
|
211
|
+
Good next steps:
|
|
212
|
+
|
|
213
|
+
- improve README and packaging metadata
|
|
214
|
+
- add a `LICENSE`
|
|
215
|
+
- add config file support
|
|
216
|
+
- add more AI providers
|
|
217
|
+
- publish to PyPI
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require("node:child_process");
|
|
4
|
+
const fs = require("node:fs");
|
|
5
|
+
const os = require("node:os");
|
|
6
|
+
const path = require("node:path");
|
|
7
|
+
|
|
8
|
+
function platformKey() {
|
|
9
|
+
const platform = os.platform();
|
|
10
|
+
const arch = os.arch();
|
|
11
|
+
|
|
12
|
+
if (platform === "win32" && arch === "x64") {
|
|
13
|
+
return "win32-x64";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (platform === "darwin" && arch === "arm64") {
|
|
17
|
+
return "darwin-arm64";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (platform === "darwin" && arch === "x64") {
|
|
21
|
+
return "darwin-x64";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (platform === "linux" && arch === "x64") {
|
|
25
|
+
return "linux-x64";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return `${platform}-${arch}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function executableName() {
|
|
32
|
+
return os.platform() === "win32" ? "docs-for-me.exe" : "docs-for-me";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const packageRoot = path.resolve(__dirname, "..");
|
|
36
|
+
const binaryPath = path.join(packageRoot, "prebuilt", platformKey(), executableName());
|
|
37
|
+
|
|
38
|
+
if (!fs.existsSync(binaryPath)) {
|
|
39
|
+
console.error("");
|
|
40
|
+
console.error("docs-for-me is installed, but no bundled executable was found for this platform.");
|
|
41
|
+
console.error("");
|
|
42
|
+
console.error(`Expected: ${binaryPath}`);
|
|
43
|
+
console.error("");
|
|
44
|
+
console.error("For users, install a released npm package that includes prebuilt binaries.");
|
|
45
|
+
console.error("For contributors, build one first:");
|
|
46
|
+
console.error("");
|
|
47
|
+
console.error(" npm run build:exe:win");
|
|
48
|
+
console.error("");
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
53
|
+
stdio: "inherit",
|
|
54
|
+
cwd: process.cwd(),
|
|
55
|
+
env: process.env,
|
|
56
|
+
windowsHide: false,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (result.error) {
|
|
60
|
+
console.error(result.error.message);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
process.exit(result.status ?? 0);
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "docs-for-me",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Create programmer-friendly docs for files, folders, and Git changes.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "John Manuel A. Cuerdo",
|
|
7
|
+
"homepage": "https://github.com/manwelAC/docs-for-me#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/manwelAC/docs-for-me.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/manwelAC/docs-for-me/issues"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"docs-for-me": "./bin/docs-for-me.cjs"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"bin/",
|
|
20
|
+
"prebuilt/",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build:exe:win": "powershell -ExecutionPolicy Bypass -File scripts/build-windows-exe.ps1",
|
|
26
|
+
"pack:npm": "npm pack",
|
|
27
|
+
"test:npm-local": "node bin/docs-for-me.cjs --help"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"documentation",
|
|
31
|
+
"developer-tools",
|
|
32
|
+
"cli",
|
|
33
|
+
"git",
|
|
34
|
+
"opencode",
|
|
35
|
+
"markdown"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18"
|
|
39
|
+
},
|
|
40
|
+
"os": [
|
|
41
|
+
"win32"
|
|
42
|
+
],
|
|
43
|
+
"cpu": [
|
|
44
|
+
"x64"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
Binary file
|