@sebasgc0399/agents-md 0.2.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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +203 -0
  3. package/dist/cli.d.ts +6 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +128 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/detect/command-detector.d.ts +6 -0
  8. package/dist/detect/command-detector.d.ts.map +1 -0
  9. package/dist/detect/command-detector.js +62 -0
  10. package/dist/detect/command-detector.js.map +1 -0
  11. package/dist/detect/folder-detector.d.ts +6 -0
  12. package/dist/detect/folder-detector.d.ts.map +1 -0
  13. package/dist/detect/folder-detector.js +69 -0
  14. package/dist/detect/folder-detector.js.map +1 -0
  15. package/dist/detect/framework-detector.d.ts +10 -0
  16. package/dist/detect/framework-detector.d.ts.map +1 -0
  17. package/dist/detect/framework-detector.js +121 -0
  18. package/dist/detect/framework-detector.js.map +1 -0
  19. package/dist/detect/index.d.ts +11 -0
  20. package/dist/detect/index.d.ts.map +1 -0
  21. package/dist/detect/index.js +70 -0
  22. package/dist/detect/index.js.map +1 -0
  23. package/dist/detect/package-detector.d.ts +6 -0
  24. package/dist/detect/package-detector.d.ts.map +1 -0
  25. package/dist/detect/package-detector.js +34 -0
  26. package/dist/detect/package-detector.js.map +1 -0
  27. package/dist/detect/runtime-detector.d.ts +6 -0
  28. package/dist/detect/runtime-detector.d.ts.map +1 -0
  29. package/dist/detect/runtime-detector.js +35 -0
  30. package/dist/detect/runtime-detector.js.map +1 -0
  31. package/dist/index.d.ts +12 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +15 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/render/data-builder.d.ts +9 -0
  36. package/dist/render/data-builder.d.ts.map +1 -0
  37. package/dist/render/data-builder.js +138 -0
  38. package/dist/render/data-builder.js.map +1 -0
  39. package/dist/render/index.d.ts +12 -0
  40. package/dist/render/index.d.ts.map +1 -0
  41. package/dist/render/index.js +29 -0
  42. package/dist/render/index.js.map +1 -0
  43. package/dist/render/mustache-renderer.d.ts +13 -0
  44. package/dist/render/mustache-renderer.d.ts.map +1 -0
  45. package/dist/render/mustache-renderer.js +51 -0
  46. package/dist/render/mustache-renderer.js.map +1 -0
  47. package/dist/render/validators.d.ts +9 -0
  48. package/dist/render/validators.d.ts.map +1 -0
  49. package/dist/render/validators.js +107 -0
  50. package/dist/render/validators.js.map +1 -0
  51. package/dist/templates/base.mustache +296 -0
  52. package/dist/templates/firebase.mustache +236 -0
  53. package/dist/templates/monorepo.mustache +253 -0
  54. package/dist/templates/react.mustache +231 -0
  55. package/dist/types.d.ts +112 -0
  56. package/dist/types.d.ts.map +1 -0
  57. package/dist/types.js +5 -0
  58. package/dist/types.js.map +1 -0
  59. package/dist/utils/fs-utils.d.ts +20 -0
  60. package/dist/utils/fs-utils.d.ts.map +1 -0
  61. package/dist/utils/fs-utils.js +121 -0
  62. package/dist/utils/fs-utils.js.map +1 -0
  63. package/dist/utils/logger.d.ts +14 -0
  64. package/dist/utils/logger.d.ts.map +1 -0
  65. package/dist/utils/logger.js +32 -0
  66. package/dist/utils/logger.js.map +1 -0
  67. package/dist/utils/token-counter.d.ts +18 -0
  68. package/dist/utils/token-counter.d.ts.map +1 -0
  69. package/dist/utils/token-counter.js +45 -0
  70. package/dist/utils/token-counter.js.map +1 -0
  71. package/package.json +75 -0
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Framework detection based on dependencies
3
+ */
4
+ export function detectFramework(packageInfo) {
5
+ const deps = packageInfo.dependencies || {};
6
+ const devDeps = packageInfo.devDependencies || {};
7
+ const allDeps = { ...deps, ...devDeps };
8
+ const indicators = [];
9
+ // React detection (highest priority)
10
+ if (deps.react && deps['react-dom']) {
11
+ indicators.push('react + react-dom in dependencies');
12
+ // Check if it's Next.js
13
+ if (deps.next) {
14
+ return {
15
+ type: 'next',
16
+ version: deps.next,
17
+ confidence: 'high',
18
+ indicators: [...indicators, 'next in dependencies'],
19
+ };
20
+ }
21
+ return {
22
+ type: 'react',
23
+ version: deps.react,
24
+ confidence: 'high',
25
+ indicators,
26
+ };
27
+ }
28
+ // Nuxt detection (works even when vue is not explicitly listed)
29
+ if (allDeps.nuxt) {
30
+ return {
31
+ type: 'nuxt',
32
+ version: allDeps.nuxt,
33
+ confidence: 'high',
34
+ indicators: ['nuxt in dependencies/devDependencies'],
35
+ };
36
+ }
37
+ // Vue detection
38
+ if (deps.vue) {
39
+ indicators.push('vue in dependencies');
40
+ return {
41
+ type: 'vue',
42
+ version: deps.vue,
43
+ confidence: 'high',
44
+ indicators,
45
+ };
46
+ }
47
+ // Angular detection
48
+ if (deps['@angular/core']) {
49
+ return {
50
+ type: 'angular',
51
+ version: deps['@angular/core'],
52
+ confidence: 'high',
53
+ indicators: ['@angular/core in dependencies'],
54
+ };
55
+ }
56
+ // Svelte detection
57
+ if (allDeps.svelte) {
58
+ return {
59
+ type: 'svelte',
60
+ version: allDeps.svelte,
61
+ confidence: 'high',
62
+ indicators: ['svelte in dependencies'],
63
+ };
64
+ }
65
+ // Firebase Functions detection
66
+ if (allDeps['firebase-functions']) {
67
+ return {
68
+ type: 'firebase-functions',
69
+ version: allDeps['firebase-functions'],
70
+ confidence: 'high',
71
+ indicators: ['firebase-functions in dependencies/devDependencies'],
72
+ };
73
+ }
74
+ // Express detection
75
+ if (deps.express) {
76
+ return {
77
+ type: 'express',
78
+ version: deps.express,
79
+ confidence: 'medium',
80
+ indicators: ['express in dependencies'],
81
+ };
82
+ }
83
+ // Fastify detection
84
+ if (deps.fastify) {
85
+ return {
86
+ type: 'fastify',
87
+ version: deps.fastify,
88
+ confidence: 'medium',
89
+ indicators: ['fastify in dependencies'],
90
+ };
91
+ }
92
+ // Unknown framework
93
+ return {
94
+ type: 'unknown',
95
+ confidence: 'low',
96
+ indicators: ['No recognized framework detected'],
97
+ };
98
+ }
99
+ /**
100
+ * Detect build tools
101
+ */
102
+ export function detectBuildTools(packageInfo) {
103
+ const devDeps = packageInfo.devDependencies || {};
104
+ const tools = [];
105
+ if (devDeps.vite)
106
+ tools.push('Vite');
107
+ if (devDeps.webpack)
108
+ tools.push('Webpack');
109
+ if (devDeps.turbo)
110
+ tools.push('Turbo');
111
+ if (devDeps.nx)
112
+ tools.push('Nx');
113
+ if (devDeps.rollup)
114
+ tools.push('Rollup');
115
+ if (devDeps.esbuild)
116
+ tools.push('esbuild');
117
+ if (devDeps.parcel)
118
+ tools.push('Parcel');
119
+ return tools;
120
+ }
121
+ //# sourceMappingURL=framework-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-detector.js","sourceRoot":"","sources":["../../src/detect/framework-detector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,UAAU,eAAe,CAAC,WAAwB;IACtD,MAAM,IAAI,GAAG,WAAW,CAAC,YAAY,IAAI,EAAE,CAAC;IAC5C,MAAM,OAAO,GAAG,WAAW,CAAC,eAAe,IAAI,EAAE,CAAC;IAClD,MAAM,OAAO,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC;IAExC,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,qCAAqC;IACrC,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QACpC,UAAU,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QAErD,wBAAwB;QACxB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO;gBACL,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,IAAI,CAAC,IAAI;gBAClB,UAAU,EAAE,MAAM;gBAClB,UAAU,EAAE,CAAC,GAAG,UAAU,EAAE,sBAAsB,CAAC;aACpD,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,IAAI,CAAC,KAAK;YACnB,UAAU,EAAE,MAAM;YAClB,UAAU;SACX,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**
2
+ * Main detection orchestrator
3
+ */
4
+ import { DetectionResult } from '../types.js';
5
+ export declare function detectProject(rootPath: string): Promise<DetectionResult>;
6
+ export { detectPackageInfo } from './package-detector.js';
7
+ export { detectFolderStructure } from './folder-detector.js';
8
+ export { detectFramework } from './framework-detector.js';
9
+ export { detectRuntime } from './runtime-detector.js';
10
+ export { detectCommands } from './command-detector.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/detect/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAO9C,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA4B9E;AAiDD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Main detection orchestrator
3
+ */
4
+ import { detectPackageInfo } from './package-detector.js';
5
+ import { detectFolderStructure } from './folder-detector.js';
6
+ import { detectFramework } from './framework-detector.js';
7
+ import { detectRuntime } from './runtime-detector.js';
8
+ import { detectCommands } from './command-detector.js';
9
+ export async function detectProject(rootPath) {
10
+ // 1. Detect package info (will throw if package.json doesn't exist)
11
+ const packageInfo = await detectPackageInfo(rootPath);
12
+ // 2. Detect folder structure
13
+ const folderStructure = detectFolderStructure(rootPath, packageInfo);
14
+ // 3. Detect framework
15
+ const rawFramework = detectFramework(packageInfo);
16
+ const framework = applyFolderSignals(rawFramework, folderStructure);
17
+ // 4. Detect runtime and package manager
18
+ const runtime = detectRuntime(rootPath, packageInfo);
19
+ // 5. Extract canonical commands
20
+ const commands = detectCommands(packageInfo, runtime);
21
+ // 6. Calculate overall confidence
22
+ const confidence = calculateConfidence(framework, folderStructure, packageInfo);
23
+ return {
24
+ packageInfo,
25
+ folderStructure,
26
+ framework,
27
+ runtime,
28
+ commands,
29
+ confidence,
30
+ };
31
+ }
32
+ function applyFolderSignals(framework, folderStructure) {
33
+ if (framework.type === 'firebase-functions' && !folderStructure.hasFunctions) {
34
+ return {
35
+ type: 'unknown',
36
+ confidence: 'low',
37
+ indicators: [...framework.indicators, 'missing functions/ directory'],
38
+ };
39
+ }
40
+ return framework;
41
+ }
42
+ /**
43
+ * Calculate overall detection confidence
44
+ */
45
+ function calculateConfidence(framework, folderStructure, packageInfo) {
46
+ // High confidence if:
47
+ // - Framework detected with high confidence
48
+ // - Has description
49
+ // - Has multiple standard folders
50
+ if (framework.confidence === 'high' &&
51
+ packageInfo?.description &&
52
+ folderStructure.folders.length >= 2) {
53
+ return 'high';
54
+ }
55
+ // Medium confidence if:
56
+ // - Framework detected (any confidence)
57
+ // - Has some folder structure
58
+ if (framework.type !== 'unknown' && folderStructure.folders.length >= 1) {
59
+ return 'medium';
60
+ }
61
+ // Low confidence otherwise
62
+ return 'low';
63
+ }
64
+ // Re-export sub-modules for testing
65
+ export { detectPackageInfo } from './package-detector.js';
66
+ export { detectFolderStructure } from './folder-detector.js';
67
+ export { detectFramework } from './framework-detector.js';
68
+ export { detectRuntime } from './runtime-detector.js';
69
+ export { detectCommands } from './command-detector.js';
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/detect/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;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4CAA4C;IAC5C,oBAAoB;IACpB,kCAAkC;IAClC,IACE,SAAS,CAAC,UAAU,KAAK,MAAM;QAC/B,WAAW,EAAE,WAAW;QACxB,eAAe,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,EACnC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,wBAAwB;IACxB,wCAAwC;IACxC,8BAA8B;IAC9B,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,IAAI,eAAe,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACxE,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,2BAA2B;IAC3B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,oCAAoC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Package.json detection and parsing
3
+ */
4
+ import { PackageInfo } from '../types.js';
5
+ export declare function detectPackageInfo(rootPath: string): Promise<PackageInfo>;
6
+ //# sourceMappingURL=package-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-detector.d.ts","sourceRoot":"","sources":["../../src/detect/package-detector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAc9E"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Package.json detection and parsing
3
+ */
4
+ import { readPackageJson } from '../utils/fs-utils.js';
5
+ export async function detectPackageInfo(rootPath) {
6
+ const pkg = (await readPackageJson(rootPath));
7
+ return {
8
+ name: pkg.name || 'unknown-project',
9
+ version: pkg.version,
10
+ description: pkg.description,
11
+ type: pkg.type || undefined,
12
+ scripts: pkg.scripts || {},
13
+ dependencies: pkg.dependencies || {},
14
+ devDependencies: pkg.devDependencies || {},
15
+ engines: pkg.engines,
16
+ workspaces: normalizeWorkspaces(pkg.workspaces),
17
+ };
18
+ }
19
+ function normalizeWorkspaces(value) {
20
+ if (Array.isArray(value)) {
21
+ return value.filter((item) => typeof item === 'string');
22
+ }
23
+ if (!value || typeof value !== 'object') {
24
+ return undefined;
25
+ }
26
+ const packages = value.packages;
27
+ if (Array.isArray(packages)) {
28
+ return {
29
+ packages: packages.filter((item) => typeof item === 'string'),
30
+ };
31
+ }
32
+ return undefined;
33
+ }
34
+ //# sourceMappingURL=package-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-detector.js","sourceRoot":"","sources":["../../src/detect/package-detector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IACtD,MAAM,GAAG,GAAG,CAAC,MAAM,eAAe,CAAC,QAAQ,CAAC,CAA4B,CAAC;IAEzE,OAAO;QACL,IAAI,EAAG,GAAG,CAAC,IAAe,IAAI,iBAAiB;QAC/C,OAAO,EAAE,GAAG,CAAC,OAA6B;QAC1C,WAAW,EAAE,GAAG,CAAC,WAAiC;QAClD,IAAI,EAAG,GAAG,CAAC,IAA8B,IAAI,SAAS;QACtD,OAAO,EAAG,GAAG,CAAC,OAAkC,IAAI,EAAE;QACtD,YAAY,EAAG,GAAG,CAAC,YAAuC,IAAI,EAAE;QAChE,eAAe,EAAG,GAAG,CAAC,eAA0C,IAAI,EAAE;QACtE,OAAO,EAAE,GAAG,CAAC,OAA6C;QAC1D,UAAU,EAAE,mBAAmB,CAAC,GAAG,CAAC,UAAU,CAAC;KAChD,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAc;IACzC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC;IAC1E,CAAC;IAED,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,QAAQ,GAAI,KAAgC,CAAC,QAAQ,CAAC;IAC5D,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,OAAO;YACL,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC;SAC9E,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Runtime and package manager detection
3
+ */
4
+ import { RuntimeInfo, PackageInfo } from '../types.js';
5
+ export declare function detectRuntime(rootPath: string, packageInfo: PackageInfo): RuntimeInfo;
6
+ //# sourceMappingURL=runtime-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-detector.d.ts","sourceRoot":"","sources":["../../src/detect/runtime-detector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGvD,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,WAAW,GACvB,WAAW,CA8Bb"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Runtime and package manager detection
3
+ */
4
+ import path from 'path';
5
+ import { fileExists } from '../utils/fs-utils.js';
6
+ export function detectRuntime(rootPath, packageInfo) {
7
+ // Detect package manager from lockfiles
8
+ let packageManager = 'npm';
9
+ if (fileExists(path.join(rootPath, 'yarn.lock'))) {
10
+ packageManager = 'yarn';
11
+ }
12
+ else if (fileExists(path.join(rootPath, 'pnpm-lock.yaml'))) {
13
+ packageManager = 'pnpm';
14
+ }
15
+ else if (fileExists(path.join(rootPath, 'bun.lockb'))) {
16
+ packageManager = 'bun';
17
+ }
18
+ // Detect runtime (Bun vs Node)
19
+ const deps = packageInfo.dependencies || {};
20
+ const devDeps = packageInfo.devDependencies || {};
21
+ if (deps.bun || devDeps.bun || packageManager === 'bun') {
22
+ return {
23
+ type: 'bun',
24
+ packageManager: 'bun',
25
+ version: packageInfo.engines?.bun,
26
+ };
27
+ }
28
+ // Default to Node.js
29
+ return {
30
+ type: 'node',
31
+ packageManager,
32
+ version: packageInfo.engines?.node,
33
+ };
34
+ }
35
+ //# sourceMappingURL=runtime-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-detector.js","sourceRoot":"","sources":["../../src/detect/runtime-detector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,UAAU,aAAa,CAC3B,QAAgB,EAChB,WAAwB;IAExB,wCAAwC;IACxC,IAAI,cAAc,GAAkC,KAAK,CAAC;IAE1D,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;QACjD,cAAc,GAAG,MAAM,CAAC;IAC1B,CAAC;SAAM,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC;QAC7D,cAAc,GAAG,MAAM,CAAC;IAC1B,CAAC;SAAM,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;QACxD,cAAc,GAAG,KAAK,CAAC;IACzB,CAAC;IAED,+BAA+B;IAC/B,MAAM,IAAI,GAAG,WAAW,CAAC,YAAY,IAAI,EAAE,CAAC;IAC5C,MAAM,OAAO,GAAG,WAAW,CAAC,eAAe,IAAI,EAAE,CAAC;IAElD,IAAI,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,IAAI,cAAc,KAAK,KAAK,EAAE,CAAC;QACxD,OAAO;YACL,IAAI,EAAE,KAAK;YACX,cAAc,EAAE,KAAK;YACrB,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,GAAG;SAClC,CAAC;IACJ,CAAC;IAED,qBAAqB;IACrB,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,cAAc;QACd,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,IAAI;KACnC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Programmatic API for agents-md
3
+ * Allows using agents-md as a library in other Node.js applications
4
+ */
5
+ export { detectProject } from './detect/index.js';
6
+ export { renderAgentsMd } from './render/index.js';
7
+ export { detectPackageInfo, detectFolderStructure, detectFramework, detectRuntime, detectCommands, } from './detect/index.js';
8
+ export { buildTemplateContext, renderTemplate, selectTemplate, validateOutput, } from './render/index.js';
9
+ export { estimateTokens, validateTokenCount } from './utils/token-counter.js';
10
+ export { Logger } from './utils/logger.js';
11
+ export type { CLIOptions, WorkspaceConfig, PackageInfo, FolderStructure, FrameworkInfo, FrameworkType, RuntimeInfo, RuntimeType, PackageManager, Profile, CanonicalCommands, DetectionResult, TemplateContext, ValidationResult, GenerationResult, } from './types.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,cAAc,GACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,YAAY,EACV,UAAU,EACV,eAAe,EACf,WAAW,EACX,eAAe,EACf,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,cAAc,EACd,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Programmatic API for agents-md
3
+ * Allows using agents-md as a library in other Node.js applications
4
+ */
5
+ // Export main functions
6
+ export { detectProject } from './detect/index.js';
7
+ export { renderAgentsMd } from './render/index.js';
8
+ // Export detection utilities
9
+ export { detectPackageInfo, detectFolderStructure, detectFramework, detectRuntime, detectCommands, } from './detect/index.js';
10
+ // Export rendering utilities
11
+ export { buildTemplateContext, renderTemplate, selectTemplate, validateOutput, } from './render/index.js';
12
+ // Export utilities
13
+ export { estimateTokens, validateTokenCount } from './utils/token-counter.js';
14
+ export { Logger } from './utils/logger.js';
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAwB;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,6BAA6B;AAC7B,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,6BAA6B;AAC7B,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,mBAAmB;AACnB,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Build template context from detection results
3
+ */
4
+ import { DetectionResult, TemplateContext, Profile } from '../types.js';
5
+ /**
6
+ * Build template context from detection result
7
+ */
8
+ export declare function buildTemplateContext(detection: DetectionResult, profile?: Profile): TemplateContext;
9
+ //# sourceMappingURL=data-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-builder.d.ts","sourceRoot":"","sources":["../../src/render/data-builder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAe,OAAO,EAAE,MAAM,aAAa,CAAC;AAmIrF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,eAAe,EAC1B,OAAO,GAAE,OAAmB,GAC3B,eAAe,CAsCjB"}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Build template context from detection results
3
+ */
4
+ import { detectBuildTools } from '../detect/framework-detector.js';
5
+ /**
6
+ * Default values when data is missing
7
+ */
8
+ const DEFAULTS = {
9
+ project_description: 'Proyecto sin descripcion en package.json. Definir objetivo y alcance antes de cambios amplios.',
10
+ style_notes: '- Seguir convenciones del framework\n' +
11
+ '- Mantener código consistente con archivos existentes\n' +
12
+ '- Documentar decisiones no obvias',
13
+ testing_notes: '- Escribir tests para lógica de negocio\n' +
14
+ '- Cubrir casos edge y errores\n' +
15
+ '- Mantener tests simples y legibles',
16
+ security_notes: '- No hardcodear secretos ni credenciales\n' +
17
+ '- Usar variables de entorno para configuración sensible\n' +
18
+ '- Validar inputs de usuario\n' +
19
+ '- No loggear información sensible (PII, tokens, passwords)',
20
+ };
21
+ /**
22
+ * Build framework-specific style notes
23
+ */
24
+ function buildStyleNotes(framework) {
25
+ switch (framework.type) {
26
+ case 'react':
27
+ return (DEFAULTS.style_notes +
28
+ '\n- Preferir componentes funcionales con hooks\n' +
29
+ '- Props naming: camelCase, event handlers con "on" prefix\n' +
30
+ '- Hooks en top-level del componente');
31
+ case 'vue':
32
+ return (DEFAULTS.style_notes +
33
+ '\n- Usar Composition API (setup script)\n' +
34
+ '- Props con defineProps, eventos con defineEmits\n' +
35
+ '- Componentes en PascalCase');
36
+ case 'firebase-functions':
37
+ return (DEFAULTS.style_notes +
38
+ '\n- Funciones idempotentes y stateless\n' +
39
+ '- Manejar cold starts (minimizar dependencias)\n' +
40
+ '- Usar Firebase Admin SDK para operaciones backend');
41
+ default:
42
+ return DEFAULTS.style_notes;
43
+ }
44
+ }
45
+ /**
46
+ * Build framework-specific testing notes
47
+ */
48
+ function buildTestingNotes(framework, packageInfo) {
49
+ const devDeps = packageInfo?.devDependencies || {};
50
+ let notes = DEFAULTS.testing_notes;
51
+ // Add framework-specific testing patterns
52
+ if (framework.type === 'react' && devDeps['@testing-library/react']) {
53
+ notes += '\n- Usar React Testing Library para tests de componentes\n';
54
+ notes += '- Preferir queries por rol y texto sobre testIds';
55
+ }
56
+ if (devDeps.vitest) {
57
+ notes += '\n- Framework de testing: Vitest';
58
+ }
59
+ else if (devDeps.jest) {
60
+ notes += '\n- Framework de testing: Jest';
61
+ }
62
+ return notes;
63
+ }
64
+ /**
65
+ * Build tech stack list
66
+ */
67
+ function buildStackList(packageInfo, framework, runtime) {
68
+ const stacks = [];
69
+ // Runtime
70
+ if (runtime.type === 'node') {
71
+ const version = runtime.version ? ` ${runtime.version}` : '';
72
+ stacks.push(`Node.js${version}`);
73
+ }
74
+ else if (runtime.type === 'bun') {
75
+ stacks.push('Bun');
76
+ }
77
+ // Package manager (if not npm)
78
+ if (runtime.packageManager !== 'npm') {
79
+ stacks.push(`Package manager: ${runtime.packageManager}`);
80
+ }
81
+ // Framework
82
+ if (framework.type !== 'unknown') {
83
+ const version = framework.version ? ` ${framework.version}` : '';
84
+ const frameworkName = framework.type.charAt(0).toUpperCase() + framework.type.slice(1);
85
+ stacks.push(`${frameworkName}${version}`);
86
+ }
87
+ // Build tools
88
+ if (packageInfo) {
89
+ const buildTools = detectBuildTools(packageInfo);
90
+ stacks.push(...buildTools.map(tool => `Build tool: ${tool}`));
91
+ }
92
+ // TypeScript
93
+ if (packageInfo?.devDependencies?.typescript || packageInfo?.dependencies?.typescript) {
94
+ stacks.push('TypeScript');
95
+ }
96
+ return stacks.length > 0 ? stacks : ['Node.js'];
97
+ }
98
+ /**
99
+ * Build template context from detection result
100
+ */
101
+ export function buildTemplateContext(detection, profile = 'compact') {
102
+ const { packageInfo, folderStructure, framework, runtime, commands } = detection;
103
+ const stacks = buildStackList(packageInfo, framework, runtime);
104
+ const description = packageInfo?.description || DEFAULTS.project_description;
105
+ const styleNotes = buildStyleNotes(framework);
106
+ const testingNotes = buildTestingNotes(framework, packageInfo);
107
+ return {
108
+ project_name: packageInfo?.name || 'unknown-project',
109
+ project_description: description,
110
+ profile,
111
+ stacks,
112
+ commands: {
113
+ install: commands.install,
114
+ dev: commands.dev || 'N/A',
115
+ build: commands.build || 'N/A',
116
+ test: commands.test || 'N/A',
117
+ lint: commands.lint || 'N/A',
118
+ format: commands.format || 'N/A',
119
+ },
120
+ style_notes: styleNotes,
121
+ testing_notes: testingNotes,
122
+ security_notes: DEFAULTS.security_notes,
123
+ has_dev: commands.dev !== null,
124
+ has_tests: commands.test !== null,
125
+ has_lint: commands.lint !== null,
126
+ has_format: commands.format !== null,
127
+ has_build: commands.build !== null,
128
+ is_monorepo: folderStructure.isMonorepo,
129
+ isCompact: profile === 'compact',
130
+ isStandard: profile === 'standard',
131
+ isFull: profile === 'full',
132
+ isStandardOrFull: profile === 'standard' || profile === 'full',
133
+ is_unknown_generic: framework.type === 'unknown' && !folderStructure.isMonorepo,
134
+ framework_type: framework.type,
135
+ runtime_type: runtime.type,
136
+ };
137
+ }
138
+ //# sourceMappingURL=data-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-builder.js","sourceRoot":"","sources":["../../src/render/data-builder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE;;GAEG;AACH,MAAM,QAAQ,GAAG;IACf,mBAAmB,EACjB,gGAAgG;IAElG,WAAW,EACT,uCAAuC;QACvC,yDAAyD;QACzD,mCAAmC;IAErC,aAAa,EACX,2CAA2C;QAC3C,iCAAiC;QACjC,qCAAqC;IAEvC,cAAc,EACZ,4CAA4C;QAC5C,2DAA2D;QAC3D,+BAA+B;QAC/B,4DAA4D;CAC/D,CAAC;AAEF;;GAEG;AACH,SAAS,eAAe,CAAC,SAAuC;IAC9D,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,OAAO;YACV,OAAO,CACL,QAAQ,CAAC,WAAW;gBACpB,kDAAkD;gBAClD,6DAA6D;gBAC7D,qCAAqC,CACtC,CAAC;QAEJ,KAAK,KAAK;YACR,OAAO,CACL,QAAQ,CAAC,WAAW;gBACpB,2CAA2C;gBAC3C,oDAAoD;gBACpD,6BAA6B,CAC9B,CAAC;QAEJ,KAAK,oBAAoB;YACvB,OAAO,CACL,QAAQ,CAAC,WAAW;gBACpB,0CAA0C;gBAC1C,kDAAkD;gBAClD,oDAAoD,CACrD,CAAC;QAEJ;YACE,OAAO,QAAQ,CAAC,WAAW,CAAC;IAChC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CACxB,SAAuC,EACvC,WAA+B;IAE/B,MAAM,OAAO,GAAG,WAAW,EAAE,eAAe,IAAI,EAAE,CAAC;IAEnD,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC;IAEnC,0CAA0C;IAC1C,IAAI,SAAS,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,C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AE;YACR,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,GAAG,EAAE,QAAQ,CAAC,GAAG,IAAI,KAAK;YAC1B,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,KAAK;YAC9B,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,KAAK;YAC5B,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,KAAK;YAC5B,MAAM,EAAE,QAAQ,CAAC,MAAM,IAAI,KAAK;SACjC;QACD,WAAW,EAAE,UAAU;QACvB,aAAa,EAAE,YAAY;QAC3B,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,OAAO,EAAE,QAAQ,CAAC,GAAG,KAAK,IAAI;QAC9B,SAAS,EAAE,QAAQ,CAAC,IAAI,KAAK,IAAI;QACjC,QAAQ,EAAE,QAAQ,CAAC,IAAI,KAAK,IAAI;QAChC,UAAU,EAAE,QAAQ,CAAC,MAAM,KAAK,IAAI;QACpC,SAAS,EAAE,QAAQ,CAAC,KAAK,KAAK,IAAI;QAClC,WAAW,EAAE,eAAe,CAAC,UAAU;QACvC,SAAS,EAAE,OAAO,KAAK,SAAS;QAChC,UAAU,EAAE,OAAO,KAAK,UAAU;QAClC,MAAM,EAAE,OAAO,KAAK,MAAM;QAC1B,gBAAgB,EAAE,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,MAAM;QAC9D,kBAAkB,EAAE,SAAS,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,eAAe,CAAC,UAAU;QAC/E,cAAc,EAAE,SAAS,CAAC,IAAI;QAC9B,YAAY,EAAE,OAAO,CAAC,IAAI;KAC3B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Main rendering module
3
+ */
4
+ import { DetectionResult, GenerationResult, Profile } from '../types.js';
5
+ /**
6
+ * Render AGENTS.md from detection result
7
+ */
8
+ export declare function renderAgentsMd(detection: DetectionResult, profile?: Profile): GenerationResult;
9
+ export { buildTemplateContext } from './data-builder.js';
10
+ export { renderTemplate, selectTemplate } from './mustache-renderer.js';
11
+ export { validateOutput } from './validators.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKzE;;GAEG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,eAAe,EAC1B,OAAO,GAAE,OAAmB,GAC3B,gBAAgB,CAkBlB;AAGD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Main rendering module
3
+ */
4
+ import { buildTemplateContext } from './data-builder.js';
5
+ import { renderTemplate, selectTemplate } from './mustache-renderer.js';
6
+ import { validateOutput } from './validators.js';
7
+ /**
8
+ * Render AGENTS.md from detection result
9
+ */
10
+ export function renderAgentsMd(detection, profile = 'compact') {
11
+ // Build template context
12
+ const context = buildTemplateContext(detection, profile);
13
+ // Select appropriate template
14
+ const templateName = selectTemplate(context);
15
+ // Render template
16
+ const content = renderTemplate(templateName, context);
17
+ // Validate output
18
+ const validation = validateOutput(content, profile);
19
+ return {
20
+ content,
21
+ validation,
22
+ detection,
23
+ };
24
+ }
25
+ // Re-export sub-modules for testing
26
+ export { buildTemplateContext } from './data-builder.js';
27
+ export { renderTemplate, selectTemplate } from './mustache-renderer.js';
28
+ export { validateOutput } from './validators.js';
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,SAA0B,EAC1B,UAAmB,SAAS;IAE5B,yBAAyB;IACzB,MAAM,OAAO,GAAG,oBAAoB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAEzD,8BAA8B;IAC9B,MAAM,YAAY,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAE7C,kBAAkB;IAClB,MAAM,OAAO,GAAG,cAAc,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAEtD,kBAAkB;IAClB,MAAM,UAAU,GAAG,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAEpD,OAAO;QACL,OAAO;QACP,UAAU;QACV,SAAS;KACV,CAAC;AACJ,CAAC;AAED,oCAAoC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Mustache template rendering
3
+ */
4
+ import { TemplateContext } from '../types.js';
5
+ /**
6
+ * Render template with context
7
+ */
8
+ export declare function renderTemplate(templateName: string, context: TemplateContext): string;
9
+ /**
10
+ * Select appropriate template based on framework
11
+ */
12
+ export declare function selectTemplate(context: TemplateContext): string;
13
+ //# sourceMappingURL=mustache-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mustache-renderer.d.ts","sourceRoot":"","sources":["../../src/render/mustache-renderer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAkB9C;;GAEG;AACH,wBAAgB,cAAc,CAC5B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,eAAe,GACvB,MAAM,CAOR;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAsB/D"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Mustache template rendering
3
+ */
4
+ import Mustache from 'mustache';
5
+ import fs from 'fs';
6
+ import path from 'path';
7
+ import { fileURLToPath } from 'url';
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+ /**
11
+ * Load template file
12
+ */
13
+ function loadTemplate(templateName) {
14
+ const templatePath = path.join(__dirname, '..', 'templates', templateName);
15
+ if (!fs.existsSync(templatePath)) {
16
+ throw new Error(`Template not found: ${templateName}`);
17
+ }
18
+ return fs.readFileSync(templatePath, 'utf-8');
19
+ }
20
+ /**
21
+ * Render template with context
22
+ */
23
+ export function renderTemplate(templateName, context) {
24
+ const template = loadTemplate(templateName);
25
+ // Disable HTML escaping since we're generating Markdown
26
+ Mustache.escape = (text) => text;
27
+ return Mustache.render(template, context);
28
+ }
29
+ /**
30
+ * Select appropriate template based on framework
31
+ */
32
+ export function selectTemplate(context) {
33
+ // Monorepo has highest priority
34
+ if (context.is_monorepo) {
35
+ return 'monorepo.mustache';
36
+ }
37
+ // Framework-specific templates
38
+ switch (context.framework_type) {
39
+ case 'react':
40
+ case 'next':
41
+ return 'react.mustache';
42
+ case 'vue':
43
+ case 'nuxt':
44
+ return 'base.mustache'; // Use base for now, can create vue.mustache later
45
+ case 'firebase-functions':
46
+ return 'firebase.mustache';
47
+ default:
48
+ return 'base.mustache';
49
+ }
50
+ }
51
+ //# sourceMappingURL=mustache-renderer.js.map