@didnhdj/fnmap 0.1.7 → 0.1.8

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 (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -53,7 +53,7 @@ The \`.fnmap\` file provides a structured code index for quick navigation. Read
53
53
  1. Every global variable, function, class, and file module must have a **concise comment describing its purpose or functionality** - avoid describing anything else
54
54
  2. When updating code, always update related comments to reflect the changes
55
55
  3. Prefer encapsulating logic in functions rather than writing flat, sequential code
56
- `;function je(e){const i=["CLAUDE.md","AGENTS.md"],r=v.readdirSync(e);for(const t of i){const h=r.find(o=>o.toLowerCase()===t.toLowerCase());if(h){const o=S.join(e,h);if(v.readFileSync(o,"utf-8").includes(".fnmap Code Index Format")){console.log(`${b.yellow}!${b.reset} ${h} already contains fnmap documentation`);continue}v.appendFileSync(o,Le),console.log(`${b.green}✓${b.reset} Appended fnmap documentation to ${h}`)}}}function ye(){const e=Y();e.parse(process.argv);const i=e.opts(),r=e.args;i.quiet&&ae(!0);const t=S.resolve(i.project);if(i.init){const a=S.join(t,".fnmaprc");if(v.existsSync(a)){console.log(`${b.yellow}!${b.reset} Config file already exists: .fnmaprc`);return}const s={enable:!0,include:["src/**/*.js","src/**/*.ts","src/**/*.jsx","src/**/*.tsx"],exclude:["node_modules","dist","build",".next","coverage","__pycache__",".cache"]};v.writeFileSync(a,JSON.stringify(s,null,2)),console.log(`${b.green}✓${b.reset} Created config file: .fnmaprc`),je(t);return}const h=[...i.files??[],...r].filter(a=>v.existsSync(a));let o=[];if(i.changed||i.staged){const a=de(t,i.staged);if(a.length===0){R.info("No git changed code files detected");return}const s=new Set;for(const u of a)s.add(S.dirname(u));for(const u of s){const p=Ne(u);o.push(...p)}}else if(h.length>0)o=h.map(a=>S.isAbsolute(a)?a:S.resolve(t,a));else if(i.dir){const a=S.resolve(t,i.dir);o=W(a,t).map(u=>S.join(t,u))}else{const{config:a,source:s}=le(t);if(a){if(R.info(`Using config: ${s}`),a.enable===!1){R.info("Config file has enable set to false, skipping processing");return}const u=fe(a),p=[...K,...u.exclude];if(u.include)for(const F of u.include){const f=F.replace(/\/\*\*\/.*$/,"").replace(/\*\*\/.*$/,""),n=f?S.resolve(t,f):t;if(v.existsSync(n)){const c=W(n,t,p);o.push(...c.map(g=>S.join(t,g)))}}}else{R.warn("No config file found. Use fnmap init to create config, or use --dir/--files to specify scope"),R.info(""),R.info("Supported config files: .fnmaprc, .fnmaprc.json, package.json#fnmap");return}}if(o.length===0){R.info("No files found to process");return}o=[...new Set(o)],R.info("=".repeat(50)),R.title("fnmap - AI Code Indexing Tool"),R.info("=".repeat(50));let m=0,l=0;const d=new Map;for(const a of o){const s=S.relative(t,a);R.info(`
56
+ `;function je(e){const i=["CLAUDE.md","AGENTS.md"],r=v.readdirSync(e);for(const t of i){const h=r.find(o=>o.toLowerCase()===t.toLowerCase());if(h){const o=S.join(e,h);if(v.readFileSync(o,"utf-8").includes(".fnmap Code Index Format")){console.log(`${b.yellow}!${b.reset} ${h} already contains fnmap documentation`);continue}v.appendFileSync(o,Le),console.log(`${b.green}✓${b.reset} Appended fnmap documentation to ${h}`)}}}function ye(){const e=Y();e.parse(process.argv);const i=e.opts(),r=e.args;i.quiet&&ae(!0);const t=S.resolve(i.project);if(i.init){const a=S.join(t,".fnmaprc");if(v.existsSync(a))console.log(`${b.yellow}!${b.reset} Config file already exists: .fnmaprc`);else{const s={enable:!0,include:["src/**/*.js","src/**/*.ts","src/**/*.jsx","src/**/*.tsx"],exclude:["node_modules","dist","build",".next","coverage","__pycache__",".cache"]};v.writeFileSync(a,JSON.stringify(s,null,2)),console.log(`${b.green}✓${b.reset} Created config file: .fnmaprc`)}je(t);return}const h=[...i.files??[],...r].filter(a=>v.existsSync(a));let o=[];if(i.changed||i.staged){const a=de(t,i.staged);if(a.length===0){R.info("No git changed code files detected");return}const s=new Set;for(const u of a)s.add(S.dirname(u));for(const u of s){const p=Ne(u);o.push(...p)}}else if(h.length>0)o=h.map(a=>S.isAbsolute(a)?a:S.resolve(t,a));else if(i.dir){const a=S.resolve(t,i.dir);o=W(a,t).map(u=>S.join(t,u))}else{const{config:a,source:s}=le(t);if(a){if(R.info(`Using config: ${s}`),a.enable===!1){R.info("Config file has enable set to false, skipping processing");return}const u=fe(a),p=[...K,...u.exclude];if(u.include)for(const F of u.include){const f=F.replace(/\/\*\*\/.*$/,"").replace(/\*\*\/.*$/,""),n=f?S.resolve(t,f):t;if(v.existsSync(n)){const c=W(n,t,p);o.push(...c.map(g=>S.join(t,g)))}}}else{R.warn("No config file found. Use fnmap init to create config, or use --dir/--files to specify scope"),R.info(""),R.info("Supported config files: .fnmaprc, .fnmaprc.json, package.json#fnmap");return}}if(o.length===0){R.info("No files found to process");return}o=[...new Set(o)],R.info("=".repeat(50)),R.title("fnmap - AI Code Indexing Tool"),R.info("=".repeat(50));let m=0,l=0;const d=new Map;for(const a of o){const s=S.relative(t,a);R.info(`
57
57
  Analyzing: ${s}`);const u=he(a);if(u.success){m++;const p=u.info;R.success(`Imports: ${p.imports.length}, Functions: ${p.functions.length}, Classes: ${p.classes.length}, Constants: ${p.constants.length}`);const F=S.dirname(a);d.has(F)||d.set(F,[]),d.get(F).push({relativePath:s,info:p})}else l++,R.error(u.error)}if(d.size>0){R.info(`
58
58
  Generating .fnmap index...`);for(const[a,s]of d){const u=pe(a,s),p=S.join(a,".fnmap");v.writeFileSync(p,u),R.success(S.relative(t,p))}}if(i.mermaid&&d.size>0){if(R.info(`
59
59
  Generating Mermaid call graphs...`),i.mermaid==="file"||i.mermaid===!0)for(const[a,s]of d)for(const{relativePath:u,info:p}of s){const F=me(u,p);if(F){const f=S.basename(u,S.extname(u)),n=S.join(a,`${f}.mermaid`);v.writeFileSync(n,F),R.success(S.relative(t,n))}}else if(i.mermaid==="project"){const a=[];for(const[,p]of d)a.push(...p);const s=ge(t,a),u=S.join(t,".fnmap.mermaid");v.writeFileSync(u,s),R.success(S.relative(t,u))}}R.info(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@didnhdj/fnmap",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "AI code indexing tool for analyzing JS/TS code structure and generating structured code maps to help AI understand code quickly",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",