agents-md-gen 0.3.0 → 0.4.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/CHANGELOG.md +38 -0
- package/README.md +2 -0
- package/package.json +6 -2
- package/src/detect.js +45 -0
- package/src/render.js +13 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
- Ship `CHANGELOG.md` inside the published package.
|
|
6
|
+
- First release published via npm's OIDC trusted publishing from GitHub
|
|
7
|
+
Actions instead of a manually-generated token.
|
|
8
|
+
|
|
9
|
+
## 0.4.0
|
|
10
|
+
|
|
11
|
+
- Detect monorepos (Turborepo, Nx, Lerna, npm/yarn/pnpm workspaces) and
|
|
12
|
+
list their sub-packages by name.
|
|
13
|
+
|
|
14
|
+
## 0.3.0
|
|
15
|
+
|
|
16
|
+
- Add `--check`: exits 1 if the output file is missing or out of date,
|
|
17
|
+
without writing anything. Meant for CI.
|
|
18
|
+
- Fix: the tool's own output file (`AGENTS.md`/`CLAUDE.md`) could appear
|
|
19
|
+
inconsistently in its own "Structure" section depending on whether it
|
|
20
|
+
already existed when the repo was scanned, which would have made
|
|
21
|
+
`--check` report false positives forever after the first run. Both
|
|
22
|
+
files are now excluded from the structure listing.
|
|
23
|
+
|
|
24
|
+
## 0.2.0
|
|
25
|
+
|
|
26
|
+
- Detect Java/Kotlin projects (Maven, Gradle, including wrapper scripts).
|
|
27
|
+
|
|
28
|
+
## 0.1.1
|
|
29
|
+
|
|
30
|
+
- Broaden npm keywords for discoverability.
|
|
31
|
+
- Add a real example output to the README.
|
|
32
|
+
|
|
33
|
+
## 0.1.0
|
|
34
|
+
|
|
35
|
+
- Initial release. Detects Node.js/TypeScript, Python, Rust, Go, and Ruby
|
|
36
|
+
projects and generates `AGENTS.md`/`CLAUDE.md` from what it finds:
|
|
37
|
+
package manager, framework, test runner, build/test/lint commands,
|
|
38
|
+
top-level structure, CI, and license.
|
package/README.md
CHANGED
|
@@ -21,6 +21,8 @@ on immediately.
|
|
|
21
21
|
- **Go** — go.mod, golangci-lint
|
|
22
22
|
- **Ruby** — Bundler, RSpec
|
|
23
23
|
- **Java/Kotlin** — Maven, Gradle (with wrapper detection)
|
|
24
|
+
- **Monorepos** — Turborepo, Nx, Lerna, npm/yarn/pnpm workspaces, listing
|
|
25
|
+
each detected sub-package
|
|
24
26
|
- CI (GitHub Actions), license, and top-level project structure
|
|
25
27
|
|
|
26
28
|
## GitHub Action
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agents-md-gen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Generate a solid AGENTS.md / CLAUDE.md for any repo by detecting its stack, commands, and structure",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"main": "src/index.js",
|
|
10
10
|
"files": [
|
|
11
11
|
"bin",
|
|
12
|
-
"src"
|
|
12
|
+
"src",
|
|
13
|
+
"CHANGELOG.md"
|
|
13
14
|
],
|
|
14
15
|
"engines": {
|
|
15
16
|
"node": ">=18.3.0"
|
|
@@ -29,6 +30,9 @@
|
|
|
29
30
|
"java",
|
|
30
31
|
"maven",
|
|
31
32
|
"gradle",
|
|
33
|
+
"monorepo",
|
|
34
|
+
"turborepo",
|
|
35
|
+
"nx",
|
|
32
36
|
"cli",
|
|
33
37
|
"codegen",
|
|
34
38
|
"developer-tools"
|
package/src/detect.js
CHANGED
|
@@ -272,6 +272,50 @@ function detectLicense(root) {
|
|
|
272
272
|
return null;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
+
function detectMonorepo(root) {
|
|
276
|
+
const pkg = readJson(root, 'package.json');
|
|
277
|
+
const patterns = [];
|
|
278
|
+
|
|
279
|
+
if (pkg && Array.isArray(pkg.workspaces)) {
|
|
280
|
+
patterns.push(...pkg.workspaces);
|
|
281
|
+
} else if (pkg && pkg.workspaces && Array.isArray(pkg.workspaces.packages)) {
|
|
282
|
+
patterns.push(...pkg.workspaces.packages);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const pnpmWorkspace = readText(root, 'pnpm-workspace.yaml');
|
|
286
|
+
if (pnpmWorkspace) {
|
|
287
|
+
for (const m of pnpmWorkspace.matchAll(/^\s*-\s*['"]?([^'"\n]+)['"]?\s*$/gm)) {
|
|
288
|
+
patterns.push(m[1].trim());
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const tool = exists(root, 'turbo.json') ? 'Turborepo'
|
|
293
|
+
: exists(root, 'nx.json') ? 'Nx'
|
|
294
|
+
: exists(root, 'lerna.json') ? 'Lerna'
|
|
295
|
+
: patterns.length ? 'workspaces'
|
|
296
|
+
: null;
|
|
297
|
+
|
|
298
|
+
if (!tool) return null;
|
|
299
|
+
|
|
300
|
+
const packages = new Set();
|
|
301
|
+
for (const pattern of patterns) {
|
|
302
|
+
const dirPath = path.join(root, pattern.replace(/\/\*+$/, ''));
|
|
303
|
+
let entries;
|
|
304
|
+
try {
|
|
305
|
+
entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
306
|
+
} catch {
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
for (const e of entries) {
|
|
310
|
+
if (!e.isDirectory()) continue;
|
|
311
|
+
const subPkg = readJson(dirPath, e.name, 'package.json');
|
|
312
|
+
if (subPkg) packages.add(subPkg.name || e.name);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return { tool, packages: [...packages].sort() };
|
|
317
|
+
}
|
|
318
|
+
|
|
275
319
|
function detectProject(root) {
|
|
276
320
|
const detectors = [detectNode, detectPython, detectRust, detectGo, detectRuby, detectJava];
|
|
277
321
|
const stacks = detectors.map((fn) => fn(root)).filter(Boolean);
|
|
@@ -279,6 +323,7 @@ function detectProject(root) {
|
|
|
279
323
|
return {
|
|
280
324
|
root,
|
|
281
325
|
stacks,
|
|
326
|
+
monorepo: detectMonorepo(root),
|
|
282
327
|
structure: listStructure(root),
|
|
283
328
|
ci: detectCI(root),
|
|
284
329
|
license: detectLicense(root),
|
package/src/render.js
CHANGED
|
@@ -51,6 +51,16 @@ function renderStack(stack) {
|
|
|
51
51
|
return parts.join('\n');
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
function renderMonorepo(monorepo) {
|
|
55
|
+
if (!monorepo) return null;
|
|
56
|
+
const lines = [`This is a monorepo (${monorepo.tool}).`];
|
|
57
|
+
if (monorepo.packages.length) {
|
|
58
|
+
lines.push('', 'Packages:', '');
|
|
59
|
+
lines.push(...monorepo.packages.map((p) => `- \`${p}\``));
|
|
60
|
+
}
|
|
61
|
+
return ['## Monorepo', '', ...lines].join('\n');
|
|
62
|
+
}
|
|
63
|
+
|
|
54
64
|
function renderStructure(structure) {
|
|
55
65
|
if (!structure.length) return null;
|
|
56
66
|
const lines = structure.map((entry) => {
|
|
@@ -87,6 +97,9 @@ function renderAgentsMd(project) {
|
|
|
87
97
|
}
|
|
88
98
|
}
|
|
89
99
|
|
|
100
|
+
const monorepo = renderMonorepo(project.monorepo);
|
|
101
|
+
if (monorepo) sections.push('', monorepo);
|
|
102
|
+
|
|
90
103
|
const structure = renderStructure(project.structure);
|
|
91
104
|
if (structure) sections.push('', structure);
|
|
92
105
|
|