agents-md-gen 0.5.0 → 0.6.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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.1
4
+
5
+ - Detect Rush monorepos (`rush.json`, including the `//` line
6
+ comments Rush's own tooling writes into it).
7
+
8
+ ## 0.6.0
9
+
10
+ - Detect Swift packages (`Package.swift`, XCTest detection).
11
+
3
12
  ## 0.5.0
4
13
 
5
14
  - Detect PHP/Composer projects (Laravel/Symfony framework detection,
package/README.md CHANGED
@@ -62,8 +62,9 @@ docker run --rm -v "$PWD":/workdir ghcr.io/peshino2012/agents-md-gen
62
62
  - **Java/Kotlin** — Maven, Gradle (with wrapper detection)
63
63
  - **PHP** — Composer, Laravel/Symfony detection, PHPUnit
64
64
  - **.NET/C#** — NuGet, xUnit/NUnit/MSTest detection
65
- - **Monorepos** — Turborepo, Nx, Lerna, npm/yarn/pnpm workspaces, listing
66
- each detected sub-package
65
+ - **Swift** — Swift Package Manager, XCTest detection
66
+ - **Monorepos** — Turborepo, Nx, Lerna, Rush, npm/yarn/pnpm workspaces,
67
+ listing each detected sub-package
67
68
  - CI (GitHub Actions), license, and top-level project structure
68
69
 
69
70
  ## GitHub Action
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-md-gen",
3
- "version": "0.5.0",
3
+ "version": "0.6.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
  "funding": {
@@ -42,6 +42,8 @@
42
42
  "laravel",
43
43
  "dotnet",
44
44
  "csharp",
45
+ "swift",
46
+ "swiftpm",
45
47
  "cli",
46
48
  "codegen",
47
49
  "developer-tools"
package/src/detect.js CHANGED
@@ -229,6 +229,29 @@ function detectRuby(root) {
229
229
  };
230
230
  }
231
231
 
232
+ function detectSwift(root) {
233
+ const manifest = readText(root, 'Package.swift');
234
+ if (!manifest) return null;
235
+ const nameMatch = manifest.match(/name:\s*"([^"]+)"/);
236
+ const usesXCTest = /XCTest/.test(manifest) || exists(root, 'Tests');
237
+
238
+ return {
239
+ ecosystem: 'Swift',
240
+ name: nameMatch ? nameMatch[1] : null,
241
+ description: null,
242
+ packageManager: 'swiftpm',
243
+ frameworks: [],
244
+ testFramework: usesXCTest ? 'XCTest' : null,
245
+ commands: {
246
+ install: 'swift package resolve',
247
+ build: 'swift build',
248
+ test: usesXCTest ? 'swift test' : null,
249
+ lint: exists(root, '.swiftlint.yml') ? 'swiftlint' : null,
250
+ dev: null,
251
+ },
252
+ };
253
+ }
254
+
232
255
  function detectPhp(root) {
233
256
  const composer = readJson(root, 'composer.json');
234
257
  if (!composer) return null;
@@ -345,7 +368,27 @@ function detectDocker(root) {
345
368
  return { dockerfile, compose: compose || null };
346
369
  }
347
370
 
371
+ function readJsonWithComments(root, ...segments) {
372
+ const text = readText(root, ...segments);
373
+ if (!text) return null;
374
+ try {
375
+ // rush.json commonly ships with // line comments, which aren't valid JSON.
376
+ return JSON.parse(text.replace(/^\s*\/\/.*$/gm, ''));
377
+ } catch {
378
+ return null;
379
+ }
380
+ }
381
+
348
382
  function detectMonorepo(root) {
383
+ const rush = readJsonWithComments(root, 'rush.json');
384
+ if (rush && Array.isArray(rush.projects)) {
385
+ const packages = rush.projects
386
+ .map((p) => p.packageName)
387
+ .filter(Boolean)
388
+ .sort();
389
+ return { tool: 'Rush', packages };
390
+ }
391
+
349
392
  const pkg = readJson(root, 'package.json');
350
393
  const patterns = [];
351
394
 
@@ -390,7 +433,7 @@ function detectMonorepo(root) {
390
433
  }
391
434
 
392
435
  function detectProject(root) {
393
- const detectors = [detectNode, detectPython, detectRust, detectGo, detectRuby, detectJava, detectPhp, detectDotnet];
436
+ const detectors = [detectNode, detectPython, detectRust, detectGo, detectRuby, detectJava, detectPhp, detectDotnet, detectSwift];
394
437
  const stacks = detectors.map((fn) => fn(root)).filter(Boolean);
395
438
 
396
439
  return {