onbuzz 3.3.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 +267 -0
- package/README.md +425 -0
- package/bin/cli.js +556 -0
- package/bin/loxia-terminal-v2.js +162 -0
- package/bin/loxia-terminal.js +90 -0
- package/bin/start-with-terminal.js +200 -0
- package/node_modules/@isaacs/balanced-match/LICENSE.md +23 -0
- package/node_modules/@isaacs/balanced-match/README.md +60 -0
- package/node_modules/@isaacs/balanced-match/dist/commonjs/index.d.ts +9 -0
- package/node_modules/@isaacs/balanced-match/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@isaacs/balanced-match/dist/commonjs/index.js +59 -0
- package/node_modules/@isaacs/balanced-match/dist/commonjs/index.js.map +1 -0
- package/node_modules/@isaacs/balanced-match/dist/commonjs/package.json +3 -0
- package/node_modules/@isaacs/balanced-match/dist/esm/index.d.ts +9 -0
- package/node_modules/@isaacs/balanced-match/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@isaacs/balanced-match/dist/esm/index.js +54 -0
- package/node_modules/@isaacs/balanced-match/dist/esm/index.js.map +1 -0
- package/node_modules/@isaacs/balanced-match/dist/esm/package.json +3 -0
- package/node_modules/@isaacs/balanced-match/package.json +79 -0
- package/node_modules/@isaacs/brace-expansion/LICENSE +23 -0
- package/node_modules/@isaacs/brace-expansion/README.md +97 -0
- package/node_modules/@isaacs/brace-expansion/dist/commonjs/index.d.ts +6 -0
- package/node_modules/@isaacs/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@isaacs/brace-expansion/dist/commonjs/index.js +199 -0
- package/node_modules/@isaacs/brace-expansion/dist/commonjs/index.js.map +1 -0
- package/node_modules/@isaacs/brace-expansion/dist/commonjs/package.json +3 -0
- package/node_modules/@isaacs/brace-expansion/dist/esm/index.d.ts +6 -0
- package/node_modules/@isaacs/brace-expansion/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@isaacs/brace-expansion/dist/esm/index.js +195 -0
- package/node_modules/@isaacs/brace-expansion/dist/esm/index.js.map +1 -0
- package/node_modules/@isaacs/brace-expansion/dist/esm/package.json +3 -0
- package/node_modules/@isaacs/brace-expansion/package.json +60 -0
- package/node_modules/glob/LICENSE.md +63 -0
- package/node_modules/glob/README.md +1177 -0
- package/node_modules/glob/dist/commonjs/glob.d.ts +388 -0
- package/node_modules/glob/dist/commonjs/glob.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/glob.js +247 -0
- package/node_modules/glob/dist/commonjs/glob.js.map +1 -0
- package/node_modules/glob/dist/commonjs/has-magic.d.ts +14 -0
- package/node_modules/glob/dist/commonjs/has-magic.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/has-magic.js +27 -0
- package/node_modules/glob/dist/commonjs/has-magic.js.map +1 -0
- package/node_modules/glob/dist/commonjs/ignore.d.ts +24 -0
- package/node_modules/glob/dist/commonjs/ignore.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/ignore.js +119 -0
- package/node_modules/glob/dist/commonjs/ignore.js.map +1 -0
- package/node_modules/glob/dist/commonjs/index.d.ts +97 -0
- package/node_modules/glob/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/index.js +68 -0
- package/node_modules/glob/dist/commonjs/index.js.map +1 -0
- package/node_modules/glob/dist/commonjs/index.min.js +4 -0
- package/node_modules/glob/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/glob/dist/commonjs/package.json +3 -0
- package/node_modules/glob/dist/commonjs/pattern.d.ts +76 -0
- package/node_modules/glob/dist/commonjs/pattern.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/pattern.js +219 -0
- package/node_modules/glob/dist/commonjs/pattern.js.map +1 -0
- package/node_modules/glob/dist/commonjs/processor.d.ts +59 -0
- package/node_modules/glob/dist/commonjs/processor.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/processor.js +301 -0
- package/node_modules/glob/dist/commonjs/processor.js.map +1 -0
- package/node_modules/glob/dist/commonjs/walker.d.ts +97 -0
- package/node_modules/glob/dist/commonjs/walker.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/walker.js +387 -0
- package/node_modules/glob/dist/commonjs/walker.js.map +1 -0
- package/node_modules/glob/dist/esm/glob.d.ts +388 -0
- package/node_modules/glob/dist/esm/glob.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/glob.js +243 -0
- package/node_modules/glob/dist/esm/glob.js.map +1 -0
- package/node_modules/glob/dist/esm/has-magic.d.ts +14 -0
- package/node_modules/glob/dist/esm/has-magic.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/has-magic.js +23 -0
- package/node_modules/glob/dist/esm/has-magic.js.map +1 -0
- package/node_modules/glob/dist/esm/ignore.d.ts +24 -0
- package/node_modules/glob/dist/esm/ignore.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/ignore.js +115 -0
- package/node_modules/glob/dist/esm/ignore.js.map +1 -0
- package/node_modules/glob/dist/esm/index.d.ts +97 -0
- package/node_modules/glob/dist/esm/index.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/index.js +55 -0
- package/node_modules/glob/dist/esm/index.js.map +1 -0
- package/node_modules/glob/dist/esm/index.min.js +4 -0
- package/node_modules/glob/dist/esm/index.min.js.map +7 -0
- package/node_modules/glob/dist/esm/package.json +3 -0
- package/node_modules/glob/dist/esm/pattern.d.ts +76 -0
- package/node_modules/glob/dist/esm/pattern.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/pattern.js +215 -0
- package/node_modules/glob/dist/esm/pattern.js.map +1 -0
- package/node_modules/glob/dist/esm/processor.d.ts +59 -0
- package/node_modules/glob/dist/esm/processor.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/processor.js +294 -0
- package/node_modules/glob/dist/esm/processor.js.map +1 -0
- package/node_modules/glob/dist/esm/walker.d.ts +97 -0
- package/node_modules/glob/dist/esm/walker.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/walker.js +381 -0
- package/node_modules/glob/dist/esm/walker.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/LICENSE.md +55 -0
- package/node_modules/glob/node_modules/minimatch/README.md +453 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.d.ts +20 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js +591 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js +30 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/index.d.ts +94 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/index.js +1029 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/package.json +3 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
- package/node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/ast.d.ts +20 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/ast.js +587 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/ast.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.js +148 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/escape.js +26 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/escape.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/index.d.ts +94 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/index.js +1016 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/index.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/package.json +3 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/unescape.js +34 -0
- package/node_modules/glob/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
- package/node_modules/glob/node_modules/minimatch/package.json +67 -0
- package/node_modules/glob/package.json +101 -0
- package/node_modules/minipass/LICENSE +15 -0
- package/node_modules/minipass/README.md +825 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts +549 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/commonjs/index.js +1028 -0
- package/node_modules/minipass/dist/commonjs/index.js.map +1 -0
- package/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/node_modules/minipass/dist/esm/index.d.ts +549 -0
- package/node_modules/minipass/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/esm/index.js +1018 -0
- package/node_modules/minipass/dist/esm/index.js.map +1 -0
- package/node_modules/minipass/dist/esm/package.json +3 -0
- package/node_modules/minipass/package.json +82 -0
- package/node_modules/package-json-from-dist/LICENSE.md +63 -0
- package/node_modules/package-json-from-dist/README.md +110 -0
- package/node_modules/package-json-from-dist/dist/commonjs/index.d.ts +89 -0
- package/node_modules/package-json-from-dist/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/package-json-from-dist/dist/commonjs/index.js +134 -0
- package/node_modules/package-json-from-dist/dist/commonjs/index.js.map +1 -0
- package/node_modules/package-json-from-dist/dist/commonjs/package.json +3 -0
- package/node_modules/package-json-from-dist/dist/esm/index.d.ts +89 -0
- package/node_modules/package-json-from-dist/dist/esm/index.d.ts.map +1 -0
- package/node_modules/package-json-from-dist/dist/esm/index.js +129 -0
- package/node_modules/package-json-from-dist/dist/esm/index.js.map +1 -0
- package/node_modules/package-json-from-dist/dist/esm/package.json +3 -0
- package/node_modules/package-json-from-dist/package.json +68 -0
- package/node_modules/path-scurry/LICENSE.md +55 -0
- package/node_modules/path-scurry/README.md +636 -0
- package/node_modules/path-scurry/dist/commonjs/index.d.ts +1115 -0
- package/node_modules/path-scurry/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/path-scurry/dist/commonjs/index.js +2018 -0
- package/node_modules/path-scurry/dist/commonjs/index.js.map +1 -0
- package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
- package/node_modules/path-scurry/dist/esm/index.d.ts +1115 -0
- package/node_modules/path-scurry/dist/esm/index.d.ts.map +1 -0
- package/node_modules/path-scurry/dist/esm/index.js +1983 -0
- package/node_modules/path-scurry/dist/esm/index.js.map +1 -0
- package/node_modules/path-scurry/dist/esm/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/LICENSE.md +55 -0
- package/node_modules/path-scurry/node_modules/lru-cache/README.md +383 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.d.ts +1323 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +1589 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.d.ts +1323 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +1585 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js.map +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/package.json +101 -0
- package/node_modules/path-scurry/package.json +88 -0
- package/node_modules/rimraf/LICENSE.md +55 -0
- package/node_modules/rimraf/README.md +226 -0
- package/node_modules/rimraf/dist/commonjs/default-tmp.d.ts +3 -0
- package/node_modules/rimraf/dist/commonjs/default-tmp.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/default-tmp.js +58 -0
- package/node_modules/rimraf/dist/commonjs/default-tmp.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/error.d.ts +6 -0
- package/node_modules/rimraf/dist/commonjs/error.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/error.js +10 -0
- package/node_modules/rimraf/dist/commonjs/error.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/fix-eperm.d.ts +3 -0
- package/node_modules/rimraf/dist/commonjs/fix-eperm.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/fix-eperm.js +38 -0
- package/node_modules/rimraf/dist/commonjs/fix-eperm.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/fs.d.ts +15 -0
- package/node_modules/rimraf/dist/commonjs/fs.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/fs.js +33 -0
- package/node_modules/rimraf/dist/commonjs/fs.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/ignore-enoent.d.ts +3 -0
- package/node_modules/rimraf/dist/commonjs/ignore-enoent.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/ignore-enoent.js +24 -0
- package/node_modules/rimraf/dist/commonjs/ignore-enoent.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/index.d.ts +50 -0
- package/node_modules/rimraf/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/index.js +78 -0
- package/node_modules/rimraf/dist/commonjs/index.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/opt-arg.d.ts +34 -0
- package/node_modules/rimraf/dist/commonjs/opt-arg.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/opt-arg.js +53 -0
- package/node_modules/rimraf/dist/commonjs/opt-arg.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/package.json +3 -0
- package/node_modules/rimraf/dist/commonjs/path-arg.d.ts +4 -0
- package/node_modules/rimraf/dist/commonjs/path-arg.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/path-arg.js +48 -0
- package/node_modules/rimraf/dist/commonjs/path-arg.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/readdir-or-error.d.ts +3 -0
- package/node_modules/rimraf/dist/commonjs/readdir-or-error.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/readdir-or-error.js +19 -0
- package/node_modules/rimraf/dist/commonjs/readdir-or-error.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/retry-busy.d.ts +8 -0
- package/node_modules/rimraf/dist/commonjs/retry-busy.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/retry-busy.js +65 -0
- package/node_modules/rimraf/dist/commonjs/retry-busy.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-manual.d.ts +3 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-manual.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-manual.js +8 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-manual.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-move-remove.d.ts +4 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-move-remove.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-move-remove.js +138 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-move-remove.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-native.d.ts +4 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-native.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-native.js +24 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-native.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-posix.d.ts +4 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-posix.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-posix.js +103 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-posix.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-windows.d.ts +4 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-windows.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-windows.js +159 -0
- package/node_modules/rimraf/dist/commonjs/rimraf-windows.js.map +1 -0
- package/node_modules/rimraf/dist/commonjs/use-native.d.ts +4 -0
- package/node_modules/rimraf/dist/commonjs/use-native.d.ts.map +1 -0
- package/node_modules/rimraf/dist/commonjs/use-native.js +18 -0
- package/node_modules/rimraf/dist/commonjs/use-native.js.map +1 -0
- package/node_modules/rimraf/dist/esm/bin.d.mts +3 -0
- package/node_modules/rimraf/dist/esm/bin.d.mts.map +1 -0
- package/node_modules/rimraf/dist/esm/bin.mjs +250 -0
- package/node_modules/rimraf/dist/esm/bin.mjs.map +1 -0
- package/node_modules/rimraf/dist/esm/default-tmp.d.ts +3 -0
- package/node_modules/rimraf/dist/esm/default-tmp.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/default-tmp.js +55 -0
- package/node_modules/rimraf/dist/esm/default-tmp.js.map +1 -0
- package/node_modules/rimraf/dist/esm/error.d.ts +6 -0
- package/node_modules/rimraf/dist/esm/error.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/error.js +5 -0
- package/node_modules/rimraf/dist/esm/error.js.map +1 -0
- package/node_modules/rimraf/dist/esm/fix-eperm.d.ts +3 -0
- package/node_modules/rimraf/dist/esm/fix-eperm.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/fix-eperm.js +33 -0
- package/node_modules/rimraf/dist/esm/fix-eperm.js.map +1 -0
- package/node_modules/rimraf/dist/esm/fs.d.ts +15 -0
- package/node_modules/rimraf/dist/esm/fs.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/fs.js +18 -0
- package/node_modules/rimraf/dist/esm/fs.js.map +1 -0
- package/node_modules/rimraf/dist/esm/ignore-enoent.d.ts +3 -0
- package/node_modules/rimraf/dist/esm/ignore-enoent.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/ignore-enoent.js +19 -0
- package/node_modules/rimraf/dist/esm/ignore-enoent.js.map +1 -0
- package/node_modules/rimraf/dist/esm/index.d.ts +50 -0
- package/node_modules/rimraf/dist/esm/index.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/index.js +70 -0
- package/node_modules/rimraf/dist/esm/index.js.map +1 -0
- package/node_modules/rimraf/dist/esm/opt-arg.d.ts +34 -0
- package/node_modules/rimraf/dist/esm/opt-arg.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/opt-arg.js +46 -0
- package/node_modules/rimraf/dist/esm/opt-arg.js.map +1 -0
- package/node_modules/rimraf/dist/esm/package.json +3 -0
- package/node_modules/rimraf/dist/esm/path-arg.d.ts +4 -0
- package/node_modules/rimraf/dist/esm/path-arg.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/path-arg.js +46 -0
- package/node_modules/rimraf/dist/esm/path-arg.js.map +1 -0
- package/node_modules/rimraf/dist/esm/readdir-or-error.d.ts +3 -0
- package/node_modules/rimraf/dist/esm/readdir-or-error.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/readdir-or-error.js +14 -0
- package/node_modules/rimraf/dist/esm/readdir-or-error.js.map +1 -0
- package/node_modules/rimraf/dist/esm/retry-busy.d.ts +8 -0
- package/node_modules/rimraf/dist/esm/retry-busy.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/retry-busy.js +60 -0
- package/node_modules/rimraf/dist/esm/retry-busy.js.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-manual.d.ts +3 -0
- package/node_modules/rimraf/dist/esm/rimraf-manual.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-manual.js +5 -0
- package/node_modules/rimraf/dist/esm/rimraf-manual.js.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-move-remove.d.ts +4 -0
- package/node_modules/rimraf/dist/esm/rimraf-move-remove.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-move-remove.js +133 -0
- package/node_modules/rimraf/dist/esm/rimraf-move-remove.js.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-native.d.ts +4 -0
- package/node_modules/rimraf/dist/esm/rimraf-native.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-native.js +19 -0
- package/node_modules/rimraf/dist/esm/rimraf-native.js.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-posix.d.ts +4 -0
- package/node_modules/rimraf/dist/esm/rimraf-posix.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-posix.js +98 -0
- package/node_modules/rimraf/dist/esm/rimraf-posix.js.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-windows.d.ts +4 -0
- package/node_modules/rimraf/dist/esm/rimraf-windows.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/rimraf-windows.js +154 -0
- package/node_modules/rimraf/dist/esm/rimraf-windows.js.map +1 -0
- package/node_modules/rimraf/dist/esm/use-native.d.ts +4 -0
- package/node_modules/rimraf/dist/esm/use-native.d.ts.map +1 -0
- package/node_modules/rimraf/dist/esm/use-native.js +15 -0
- package/node_modules/rimraf/dist/esm/use-native.js.map +1 -0
- package/node_modules/rimraf/package.json +92 -0
- package/package.json +152 -0
- package/scripts/install-scanners.js +258 -0
- package/scripts/watchdog.js +147 -0
- package/src/analyzers/CSSAnalyzer.js +297 -0
- package/src/analyzers/ConfigValidator.js +690 -0
- package/src/analyzers/ESLintAnalyzer.js +320 -0
- package/src/analyzers/JavaScriptAnalyzer.js +261 -0
- package/src/analyzers/PrettierFormatter.js +247 -0
- package/src/analyzers/PythonAnalyzer.js +283 -0
- package/src/analyzers/SecurityAnalyzer.js +729 -0
- package/src/analyzers/SparrowAnalyzer.js +341 -0
- package/src/analyzers/TypeScriptAnalyzer.js +247 -0
- package/src/analyzers/codeCloneDetector/analyzer.js +344 -0
- package/src/analyzers/codeCloneDetector/detector.js +250 -0
- package/src/analyzers/codeCloneDetector/index.js +192 -0
- package/src/analyzers/codeCloneDetector/parser.js +199 -0
- package/src/analyzers/codeCloneDetector/reporter.js +148 -0
- package/src/analyzers/codeCloneDetector/scanner.js +88 -0
- package/src/core/agentPool.js +1957 -0
- package/src/core/agentScheduler.js +3212 -0
- package/src/core/contextManager.js +709 -0
- package/src/core/flowExecutor.js +928 -0
- package/src/core/messageProcessor.js +808 -0
- package/src/core/orchestrator.js +584 -0
- package/src/core/stateManager.js +1500 -0
- package/src/index.js +972 -0
- package/src/interfaces/cli.js +553 -0
- package/src/interfaces/terminal/__tests__/smoke/advancedFeatures.test.js +208 -0
- package/src/interfaces/terminal/__tests__/smoke/agentControl.test.js +236 -0
- package/src/interfaces/terminal/__tests__/smoke/agents.test.js +138 -0
- package/src/interfaces/terminal/__tests__/smoke/components.test.js +137 -0
- package/src/interfaces/terminal/__tests__/smoke/connection.test.js +350 -0
- package/src/interfaces/terminal/__tests__/smoke/enhancements.test.js +156 -0
- package/src/interfaces/terminal/__tests__/smoke/imports.test.js +332 -0
- package/src/interfaces/terminal/__tests__/smoke/messages.test.js +256 -0
- package/src/interfaces/terminal/__tests__/smoke/tools.test.js +388 -0
- package/src/interfaces/terminal/api/apiClient.js +299 -0
- package/src/interfaces/terminal/api/messageRouter.js +262 -0
- package/src/interfaces/terminal/api/session.js +266 -0
- package/src/interfaces/terminal/api/websocket.js +497 -0
- package/src/interfaces/terminal/components/AgentCreator.js +705 -0
- package/src/interfaces/terminal/components/AgentEditor.js +678 -0
- package/src/interfaces/terminal/components/AgentSwitcher.js +330 -0
- package/src/interfaces/terminal/components/ErrorBoundary.js +92 -0
- package/src/interfaces/terminal/components/ErrorPanel.js +264 -0
- package/src/interfaces/terminal/components/Header.js +28 -0
- package/src/interfaces/terminal/components/HelpPanel.js +231 -0
- package/src/interfaces/terminal/components/InputBox.js +118 -0
- package/src/interfaces/terminal/components/Layout.js +603 -0
- package/src/interfaces/terminal/components/LoadingSpinner.js +71 -0
- package/src/interfaces/terminal/components/MessageList.js +281 -0
- package/src/interfaces/terminal/components/MultilineTextInput.js +251 -0
- package/src/interfaces/terminal/components/SearchPanel.js +265 -0
- package/src/interfaces/terminal/components/SettingsPanel.js +415 -0
- package/src/interfaces/terminal/components/StatusBar.js +65 -0
- package/src/interfaces/terminal/components/TextInput.js +127 -0
- package/src/interfaces/terminal/config/agentEditorConstants.js +227 -0
- package/src/interfaces/terminal/config/constants.js +393 -0
- package/src/interfaces/terminal/index.js +168 -0
- package/src/interfaces/terminal/state/useAgentControl.js +496 -0
- package/src/interfaces/terminal/state/useAgents.js +537 -0
- package/src/interfaces/terminal/state/useConnection.js +444 -0
- package/src/interfaces/terminal/state/useMessages.js +630 -0
- package/src/interfaces/terminal/state/useTools.js +554 -0
- package/src/interfaces/terminal/utils/debugLogger.js +44 -0
- package/src/interfaces/terminal/utils/settingsStorage.js +232 -0
- package/src/interfaces/terminal/utils/theme.js +85 -0
- package/src/interfaces/webServer.js +5457 -0
- package/src/modules/fileExplorer/controller.js +413 -0
- package/src/modules/fileExplorer/index.js +37 -0
- package/src/modules/fileExplorer/middleware.js +92 -0
- package/src/modules/fileExplorer/routes.js +158 -0
- package/src/modules/fileExplorer/types.js +44 -0
- package/src/services/agentActivityService.js +399 -0
- package/src/services/aiService.js +2618 -0
- package/src/services/apiKeyManager.js +334 -0
- package/src/services/benchmarkService.js +196 -0
- package/src/services/budgetService.js +565 -0
- package/src/services/contextInjectionService.js +268 -0
- package/src/services/conversationCompactionService.js +1103 -0
- package/src/services/credentialVault.js +685 -0
- package/src/services/errorHandler.js +810 -0
- package/src/services/fileAttachmentService.js +547 -0
- package/src/services/flowContextService.js +189 -0
- package/src/services/memoryService.js +521 -0
- package/src/services/modelRouterService.js +365 -0
- package/src/services/modelsService.js +323 -0
- package/src/services/ollamaService.js +452 -0
- package/src/services/portRegistry.js +336 -0
- package/src/services/portTracker.js +223 -0
- package/src/services/projectDetector.js +404 -0
- package/src/services/promptService.js +372 -0
- package/src/services/qualityInspector.js +796 -0
- package/src/services/scheduleService.js +725 -0
- package/src/services/serviceRegistry.js +386 -0
- package/src/services/skillsService.js +486 -0
- package/src/services/telegramService.js +920 -0
- package/src/services/tokenCountingService.js +316 -0
- package/src/services/visualEditorBridge.js +1033 -0
- package/src/services/visualEditorServer.js +1727 -0
- package/src/services/whatsappService.js +663 -0
- package/src/tools/__tests__/webTool.e2e.test.js +569 -0
- package/src/tools/__tests__/webTool.unit.test.js +195 -0
- package/src/tools/agentCommunicationTool.js +1343 -0
- package/src/tools/agentDelayTool.js +498 -0
- package/src/tools/asyncToolManager.js +604 -0
- package/src/tools/baseTool.js +887 -0
- package/src/tools/browserTool.js +897 -0
- package/src/tools/cloneDetectionTool.js +581 -0
- package/src/tools/codeMapTool.js +857 -0
- package/src/tools/dependencyResolverTool.js +1212 -0
- package/src/tools/docxTool.js +623 -0
- package/src/tools/excelTool.js +636 -0
- package/src/tools/fileContentReplaceTool.js +840 -0
- package/src/tools/fileTreeTool.js +833 -0
- package/src/tools/filesystemTool.js +1217 -0
- package/src/tools/helpTool.js +198 -0
- package/src/tools/imageTool.js +1034 -0
- package/src/tools/importAnalyzerTool.js +1056 -0
- package/src/tools/jobDoneTool.js +388 -0
- package/src/tools/memoryTool.js +554 -0
- package/src/tools/pdfTool.js +627 -0
- package/src/tools/seekTool.js +883 -0
- package/src/tools/skillsTool.js +276 -0
- package/src/tools/staticAnalysisTool.js +2146 -0
- package/src/tools/taskManagerTool.js +2836 -0
- package/src/tools/terminalTool.js +2486 -0
- package/src/tools/userPromptTool.js +474 -0
- package/src/tools/videoTool.js +1139 -0
- package/src/tools/visionTool.js +507 -0
- package/src/tools/visualEditorTool.js +1175 -0
- package/src/tools/webTool.js +3114 -0
- package/src/tools/whatsappTool.js +457 -0
- package/src/types/agent.js +519 -0
- package/src/types/contextReference.js +972 -0
- package/src/types/conversation.js +730 -0
- package/src/types/toolCommand.js +747 -0
- package/src/utilities/attachmentValidator.js +288 -0
- package/src/utilities/browserStealth.js +630 -0
- package/src/utilities/configManager.js +618 -0
- package/src/utilities/constants.js +870 -0
- package/src/utilities/directoryAccessManager.js +566 -0
- package/src/utilities/fileProcessor.js +307 -0
- package/src/utilities/humanBehavior.js +453 -0
- package/src/utilities/jsonRepair.js +242 -0
- package/src/utilities/logger.js +436 -0
- package/src/utilities/platformUtils.js +255 -0
- package/src/utilities/platformUtils.test.js +98 -0
- package/src/utilities/stealthConstants.js +377 -0
- package/src/utilities/structuredFileValidator.js +699 -0
- package/src/utilities/tagParser.js +878 -0
- package/src/utilities/toolConstants.js +415 -0
- package/src/utilities/userDataDir.js +300 -0
- package/web-ui/build/brands/autopilot/favicon.svg +1 -0
- package/web-ui/build/brands/autopilot/logo.webp +0 -0
- package/web-ui/build/brands/onbuzz/favicon.svg +1 -0
- package/web-ui/build/brands/onbuzz/logo-text.webp +0 -0
- package/web-ui/build/brands/onbuzz/logo.webp +0 -0
- package/web-ui/build/index.html +15 -0
- package/web-ui/build/logo.png +0 -0
- package/web-ui/build/logo2.png +0 -0
- package/web-ui/build/static/index-SmQFfvBs.js +746 -0
- package/web-ui/build/static/index-V2ySwjHp.css +1 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analyzes clones and provides refactoring recommendations
|
|
3
|
+
*/
|
|
4
|
+
export class RefactoringAnalyzer {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.config = config;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Analyze clones and provide refactoring advice
|
|
11
|
+
* @param {Array} clones - Array of detected clones
|
|
12
|
+
* @returns {Array} Enriched clones with refactoring advice
|
|
13
|
+
*/
|
|
14
|
+
analyzeClones(clones) {
|
|
15
|
+
console.log('Analyzing clones for refactoring opportunities...');
|
|
16
|
+
|
|
17
|
+
return clones.map((clone, index) => {
|
|
18
|
+
const metrics = this.calculateMetrics(clone);
|
|
19
|
+
const advice = this.generateRefactoringAdvice(clone, metrics);
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
id: `clone-${index + 1}`,
|
|
23
|
+
type: clone.type,
|
|
24
|
+
confidence: clone.confidence,
|
|
25
|
+
instances: clone.blocks.map(block => ({
|
|
26
|
+
file: block.file,
|
|
27
|
+
startLine: block.startLine,
|
|
28
|
+
endLine: block.endLine,
|
|
29
|
+
code: this.truncateCode(block.code),
|
|
30
|
+
fullCode: block.code,
|
|
31
|
+
blockType: block.type
|
|
32
|
+
})),
|
|
33
|
+
metrics,
|
|
34
|
+
refactoringAdvice: advice
|
|
35
|
+
};
|
|
36
|
+
}).sort((a, b) => b.metrics.impactScore - a.metrics.impactScore);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Calculate metrics for a clone
|
|
41
|
+
*/
|
|
42
|
+
calculateMetrics(clone) {
|
|
43
|
+
const blocks = clone.blocks;
|
|
44
|
+
const tokenCount = clone.tokenCount;
|
|
45
|
+
const lineCount = this.averageLineCount(blocks);
|
|
46
|
+
const instanceCount = blocks.length;
|
|
47
|
+
|
|
48
|
+
// Calculate impact score (higher = more important to refactor)
|
|
49
|
+
const impactScore = this.calculateImpactScore(
|
|
50
|
+
tokenCount,
|
|
51
|
+
lineCount,
|
|
52
|
+
instanceCount,
|
|
53
|
+
clone.confidence
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// Calculate duplication overhead
|
|
57
|
+
const duplicatedLines = lineCount * (instanceCount - 1);
|
|
58
|
+
const duplicatedTokens = tokenCount * (instanceCount - 1);
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
tokenCount,
|
|
62
|
+
lineCount,
|
|
63
|
+
instanceCount,
|
|
64
|
+
duplicatedLines,
|
|
65
|
+
duplicatedTokens,
|
|
66
|
+
impactScore: parseFloat(impactScore.toFixed(2)),
|
|
67
|
+
filesCovered: new Set(blocks.map(b => b.file)).size
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Calculate impact score for prioritization
|
|
73
|
+
*/
|
|
74
|
+
calculateImpactScore(tokenCount, lineCount, instanceCount, confidence) {
|
|
75
|
+
// Weighted formula:
|
|
76
|
+
// - Size matters (more tokens = more important)
|
|
77
|
+
// - Instances matter (more copies = more important)
|
|
78
|
+
// - Confidence matters
|
|
79
|
+
// - Line count matters (user visibility)
|
|
80
|
+
|
|
81
|
+
const sizeScore = Math.log10(tokenCount + 1) * 2;
|
|
82
|
+
const instanceScore = Math.log2(instanceCount + 1) * 3;
|
|
83
|
+
const confidenceScore = confidence * 2;
|
|
84
|
+
const lineScore = Math.min(lineCount / 10, 3);
|
|
85
|
+
|
|
86
|
+
return sizeScore + instanceScore + confidenceScore + lineScore;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Generate refactoring advice
|
|
91
|
+
*/
|
|
92
|
+
generateRefactoringAdvice(clone, metrics) {
|
|
93
|
+
const strategy = this.determineRefactoringStrategy(clone, metrics);
|
|
94
|
+
const priority = this.determinePriority(metrics);
|
|
95
|
+
const suggestedName = this.suggestName(clone);
|
|
96
|
+
const reasoning = this.generateReasoning(clone, metrics, strategy);
|
|
97
|
+
const estimatedEffort = this.estimateEffort(metrics, strategy);
|
|
98
|
+
const benefits = this.describeBenefits(metrics);
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
priority,
|
|
102
|
+
strategy,
|
|
103
|
+
suggestedName,
|
|
104
|
+
reasoning,
|
|
105
|
+
estimatedEffort,
|
|
106
|
+
benefits,
|
|
107
|
+
actionableSteps: this.generateActionableSteps(strategy, suggestedName, metrics)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Determine refactoring strategy
|
|
113
|
+
*/
|
|
114
|
+
determineRefactoringStrategy(clone, metrics) {
|
|
115
|
+
const { tokenCount, lineCount, instanceCount, filesCovered } = metrics;
|
|
116
|
+
const blockTypes = clone.blocks.map(b => b.type);
|
|
117
|
+
|
|
118
|
+
// Check if it's a function/method
|
|
119
|
+
const isFunctionLike = blockTypes.some(type =>
|
|
120
|
+
type.includes('Function') || type.includes('Method')
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
// Check if it's a class
|
|
124
|
+
const isClassLike = blockTypes.some(type =>
|
|
125
|
+
type.includes('Class')
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
// Decision tree
|
|
129
|
+
if (isClassLike && lineCount > 50) {
|
|
130
|
+
return 'extract-module';
|
|
131
|
+
} else if (filesCovered > 2 && tokenCount > 100) {
|
|
132
|
+
return 'extract-module';
|
|
133
|
+
} else if (isFunctionLike || (lineCount >= 10 && lineCount <= 50)) {
|
|
134
|
+
return 'extract-function';
|
|
135
|
+
} else if (lineCount > 50) {
|
|
136
|
+
return 'extract-class';
|
|
137
|
+
} else if (lineCount < 10) {
|
|
138
|
+
return 'extract-constant-or-utility';
|
|
139
|
+
} else {
|
|
140
|
+
return 'extract-function';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Determine priority level
|
|
146
|
+
*/
|
|
147
|
+
determinePriority(metrics) {
|
|
148
|
+
const { impactScore } = metrics;
|
|
149
|
+
|
|
150
|
+
if (impactScore >= 8) return 'high';
|
|
151
|
+
if (impactScore >= 5) return 'medium';
|
|
152
|
+
return 'low';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Suggest a name based on code analysis
|
|
157
|
+
*/
|
|
158
|
+
suggestName(clone) {
|
|
159
|
+
// Extract common words from the code
|
|
160
|
+
const allCode = clone.blocks.map(b => b.code).join(' ');
|
|
161
|
+
|
|
162
|
+
// Look for common identifiers
|
|
163
|
+
const identifiers = allCode.match(/[a-zA-Z_$][a-zA-Z0-9_$]*/g) || [];
|
|
164
|
+
const frequency = {};
|
|
165
|
+
|
|
166
|
+
identifiers.forEach(id => {
|
|
167
|
+
// Skip common keywords
|
|
168
|
+
if (['const', 'let', 'var', 'function', 'return', 'if', 'else', 'for', 'while'].includes(id)) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
frequency[id] = (frequency[id] || 0) + 1;
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Find most common meaningful identifier
|
|
175
|
+
const sorted = Object.entries(frequency)
|
|
176
|
+
.sort((a, b) => b[1] - a[1])
|
|
177
|
+
.slice(0, 3);
|
|
178
|
+
|
|
179
|
+
if (sorted.length > 0) {
|
|
180
|
+
// Create a descriptive name from top identifiers
|
|
181
|
+
const topWords = sorted.map(([word]) => word);
|
|
182
|
+
return this.createFunctionName(topWords);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return 'extractedFunction';
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Create a function name from words
|
|
190
|
+
*/
|
|
191
|
+
createFunctionName(words) {
|
|
192
|
+
if (words.length === 0) return 'extractedFunction';
|
|
193
|
+
|
|
194
|
+
// Convert to camelCase
|
|
195
|
+
return words[0] + words.slice(1).map(w =>
|
|
196
|
+
w.charAt(0).toUpperCase() + w.slice(1)
|
|
197
|
+
).join('');
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Generate reasoning for refactoring
|
|
202
|
+
*/
|
|
203
|
+
generateReasoning(clone, metrics, strategy) {
|
|
204
|
+
const { instanceCount, duplicatedLines, filesCovered } = metrics;
|
|
205
|
+
|
|
206
|
+
let reasoning = `This ${clone.type} code pattern appears ${instanceCount} times`;
|
|
207
|
+
|
|
208
|
+
if (filesCovered > 1) {
|
|
209
|
+
reasoning += ` across ${filesCovered} different files`;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
reasoning += `, resulting in ${duplicatedLines} duplicated lines. `;
|
|
213
|
+
|
|
214
|
+
reasoning += `Refactoring to ${strategy.replace(/-/g, ' ')} would improve maintainability`;
|
|
215
|
+
|
|
216
|
+
if (instanceCount >= 3) {
|
|
217
|
+
reasoning += ', reduce bugs from inconsistent changes';
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
reasoning += ', and reduce code size';
|
|
221
|
+
|
|
222
|
+
if (metrics.impactScore >= 8) {
|
|
223
|
+
reasoning += '. This is a high-impact refactoring opportunity';
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return reasoning + '.';
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Estimate effort for refactoring
|
|
231
|
+
*/
|
|
232
|
+
estimateEffort(metrics, strategy) {
|
|
233
|
+
const { lineCount, instanceCount, filesCovered } = metrics;
|
|
234
|
+
|
|
235
|
+
let effortPoints = 0;
|
|
236
|
+
|
|
237
|
+
// Base effort on size
|
|
238
|
+
effortPoints += Math.min(lineCount / 10, 5);
|
|
239
|
+
|
|
240
|
+
// Effort increases with instances
|
|
241
|
+
effortPoints += instanceCount * 0.5;
|
|
242
|
+
|
|
243
|
+
// Effort increases with file spread
|
|
244
|
+
effortPoints += filesCovered * 0.5;
|
|
245
|
+
|
|
246
|
+
// Strategy-specific effort
|
|
247
|
+
if (strategy === 'extract-module') {
|
|
248
|
+
effortPoints += 3;
|
|
249
|
+
} else if (strategy === 'extract-class') {
|
|
250
|
+
effortPoints += 2;
|
|
251
|
+
} else if (strategy === 'extract-function') {
|
|
252
|
+
effortPoints += 1;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (effortPoints <= 3) return 'low';
|
|
256
|
+
if (effortPoints <= 7) return 'medium';
|
|
257
|
+
return 'high';
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Describe benefits of refactoring
|
|
262
|
+
*/
|
|
263
|
+
describeBenefits(metrics) {
|
|
264
|
+
const benefits = [];
|
|
265
|
+
|
|
266
|
+
benefits.push(`Eliminate ${metrics.duplicatedLines} duplicated lines of code`);
|
|
267
|
+
benefits.push(`Improve maintainability by centralizing logic in one place`);
|
|
268
|
+
|
|
269
|
+
if (metrics.instanceCount >= 3) {
|
|
270
|
+
benefits.push(`Reduce risk of inconsistent changes across ${metrics.instanceCount} locations`);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (metrics.filesCovered > 2) {
|
|
274
|
+
benefits.push(`Improve code organization across ${metrics.filesCovered} files`);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
benefits.push('Make future changes easier and less error-prone');
|
|
278
|
+
|
|
279
|
+
return benefits;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Generate actionable steps
|
|
284
|
+
*/
|
|
285
|
+
generateActionableSteps(strategy, suggestedName, metrics) {
|
|
286
|
+
const steps = [];
|
|
287
|
+
|
|
288
|
+
switch (strategy) {
|
|
289
|
+
case 'extract-function':
|
|
290
|
+
steps.push(`1. Create a new function named '${suggestedName}'`);
|
|
291
|
+
steps.push('2. Move the duplicated logic into this function');
|
|
292
|
+
steps.push('3. Identify parameters needed from the surrounding context');
|
|
293
|
+
steps.push('4. Replace all instances with calls to the new function');
|
|
294
|
+
steps.push('5. Test to ensure behavior is preserved');
|
|
295
|
+
break;
|
|
296
|
+
|
|
297
|
+
case 'extract-class':
|
|
298
|
+
steps.push(`1. Create a new class to encapsulate this functionality`);
|
|
299
|
+
steps.push('2. Move related methods and properties into the class');
|
|
300
|
+
steps.push('3. Update all instances to use the new class');
|
|
301
|
+
steps.push('4. Consider dependency injection for better testability');
|
|
302
|
+
break;
|
|
303
|
+
|
|
304
|
+
case 'extract-module':
|
|
305
|
+
steps.push(`1. Create a new module/file for this shared functionality`);
|
|
306
|
+
steps.push('2. Move the duplicated code into the new module');
|
|
307
|
+
steps.push('3. Export the necessary functions/classes');
|
|
308
|
+
steps.push('4. Update all files to import from the new module');
|
|
309
|
+
steps.push('5. Update any build configurations if needed');
|
|
310
|
+
break;
|
|
311
|
+
|
|
312
|
+
default:
|
|
313
|
+
steps.push(`1. Extract the duplicated code using ${strategy.replace(/-/g, ' ')}`);
|
|
314
|
+
steps.push('2. Replace all instances with the extracted version');
|
|
315
|
+
steps.push('3. Test thoroughly');
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return steps;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Truncate code for display
|
|
323
|
+
*/
|
|
324
|
+
truncateCode(code, maxLines = 10) {
|
|
325
|
+
const lines = code.split('\n');
|
|
326
|
+
|
|
327
|
+
if (lines.length <= maxLines) {
|
|
328
|
+
return code;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return lines.slice(0, maxLines).join('\n') + '\n... (truncated)';
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Calculate average line count
|
|
336
|
+
*/
|
|
337
|
+
averageLineCount(blocks) {
|
|
338
|
+
const totalLines = blocks.reduce((sum, block) =>
|
|
339
|
+
sum + (block.endLine - block.startLine + 1), 0
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
return Math.round(totalLines / blocks.length);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects code clones across files (async, non-blocking)
|
|
3
|
+
*/
|
|
4
|
+
export class CloneDetector {
|
|
5
|
+
constructor(config, parser) {
|
|
6
|
+
this.config = config;
|
|
7
|
+
this.parser = parser;
|
|
8
|
+
this.comparisonBatchSize = config.comparisonBatchSize || 1000; // Yield after this many comparisons
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Find all clones in parsed files (async)
|
|
13
|
+
* @param {Array} parsedFiles - Array of parsed file objects
|
|
14
|
+
* @returns {Promise<Array>} Array of clone groups
|
|
15
|
+
*/
|
|
16
|
+
async detectClones(parsedFiles) {
|
|
17
|
+
console.log('Detecting clones...');
|
|
18
|
+
|
|
19
|
+
const clones = [];
|
|
20
|
+
const allBlocks = [];
|
|
21
|
+
|
|
22
|
+
// Collect all code blocks
|
|
23
|
+
for (const file of parsedFiles) {
|
|
24
|
+
allBlocks.push(...file.blocks);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
console.log(`Analyzing ${allBlocks.length} code blocks`);
|
|
28
|
+
|
|
29
|
+
// Group blocks by hash for exact clones
|
|
30
|
+
const hashGroups = this.groupByHash(allBlocks);
|
|
31
|
+
|
|
32
|
+
// Find exact clones
|
|
33
|
+
for (const [hash, blocks] of Object.entries(hashGroups)) {
|
|
34
|
+
if (blocks.length > 1) {
|
|
35
|
+
clones.push({
|
|
36
|
+
type: 'exact',
|
|
37
|
+
confidence: 1.0,
|
|
38
|
+
blocks,
|
|
39
|
+
tokenCount: blocks[0].tokens.length
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Find similar clones (more expensive) - now async
|
|
45
|
+
const similarClones = await this.findSimilarClones(allBlocks);
|
|
46
|
+
clones.push(...similarClones);
|
|
47
|
+
|
|
48
|
+
console.log(`Found ${clones.length} clone groups`);
|
|
49
|
+
return clones;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Group blocks by hash
|
|
54
|
+
*/
|
|
55
|
+
groupByHash(blocks) {
|
|
56
|
+
const groups = {};
|
|
57
|
+
|
|
58
|
+
for (const block of blocks) {
|
|
59
|
+
if (block.tokens.length < this.config.minTokens) continue;
|
|
60
|
+
|
|
61
|
+
if (!groups[block.hash]) {
|
|
62
|
+
groups[block.hash] = [];
|
|
63
|
+
}
|
|
64
|
+
groups[block.hash].push(block);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return groups;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Find similar (but not exact) clones - async with batching
|
|
72
|
+
*/
|
|
73
|
+
async findSimilarClones(blocks) {
|
|
74
|
+
const similarClones = [];
|
|
75
|
+
const processed = new Set();
|
|
76
|
+
|
|
77
|
+
// Filter blocks that meet minimum size
|
|
78
|
+
const eligibleBlocks = blocks.filter(b =>
|
|
79
|
+
b.tokens.length >= this.config.minTokens
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
let comparisonCount = 0;
|
|
83
|
+
const totalPossibleComparisons = (eligibleBlocks.length * (eligibleBlocks.length - 1)) / 2;
|
|
84
|
+
|
|
85
|
+
// Log progress periodically
|
|
86
|
+
const logInterval = Math.max(1000, Math.floor(totalPossibleComparisons / 10));
|
|
87
|
+
let lastLogCount = 0;
|
|
88
|
+
|
|
89
|
+
for (let i = 0; i < eligibleBlocks.length; i++) {
|
|
90
|
+
const block1 = eligibleBlocks[i];
|
|
91
|
+
const cloneGroup = [block1];
|
|
92
|
+
|
|
93
|
+
if (processed.has(block1.id)) continue;
|
|
94
|
+
|
|
95
|
+
for (let j = i + 1; j < eligibleBlocks.length; j++) {
|
|
96
|
+
const block2 = eligibleBlocks[j];
|
|
97
|
+
|
|
98
|
+
if (processed.has(block2.id)) continue;
|
|
99
|
+
|
|
100
|
+
// Skip if already exact match
|
|
101
|
+
if (block1.hash === block2.hash) continue;
|
|
102
|
+
|
|
103
|
+
// Calculate similarity
|
|
104
|
+
const similarity = this.calculateBlockSimilarity(block1, block2);
|
|
105
|
+
comparisonCount++;
|
|
106
|
+
|
|
107
|
+
if (similarity >= this.config.similarityThreshold) {
|
|
108
|
+
cloneGroup.push(block2);
|
|
109
|
+
processed.add(block2.id);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Yield to event loop periodically to prevent blocking
|
|
113
|
+
if (comparisonCount % this.comparisonBatchSize === 0) {
|
|
114
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
115
|
+
|
|
116
|
+
// Log progress
|
|
117
|
+
if (comparisonCount - lastLogCount >= logInterval) {
|
|
118
|
+
const progress = ((comparisonCount / totalPossibleComparisons) * 100).toFixed(1);
|
|
119
|
+
console.log(`Clone detection progress: ${progress}% (${comparisonCount}/${totalPossibleComparisons} comparisons)`);
|
|
120
|
+
lastLogCount = comparisonCount;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (cloneGroup.length > 1) {
|
|
126
|
+
processed.add(block1.id);
|
|
127
|
+
|
|
128
|
+
similarClones.push({
|
|
129
|
+
type: 'similar',
|
|
130
|
+
confidence: this.calculateGroupConfidenceFast(cloneGroup),
|
|
131
|
+
blocks: cloneGroup,
|
|
132
|
+
tokenCount: Math.max(...cloneGroup.map(b => b.tokens.length))
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return similarClones;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Calculate similarity between two blocks
|
|
142
|
+
*/
|
|
143
|
+
calculateBlockSimilarity(block1, block2) {
|
|
144
|
+
const tokens1 = block1.tokens;
|
|
145
|
+
const tokens2 = block2.tokens;
|
|
146
|
+
|
|
147
|
+
// Length similarity check (quick rejection)
|
|
148
|
+
const lengthRatio = Math.min(tokens1.length, tokens2.length) /
|
|
149
|
+
Math.max(tokens1.length, tokens2.length);
|
|
150
|
+
|
|
151
|
+
if (lengthRatio < 0.7) return 0; // Too different in size
|
|
152
|
+
|
|
153
|
+
// Token sequence similarity using longest common subsequence
|
|
154
|
+
const lcs = this.longestCommonSubsequence(tokens1, tokens2);
|
|
155
|
+
const lcsRatio = (2 * lcs) / (tokens1.length + tokens2.length);
|
|
156
|
+
|
|
157
|
+
return lcsRatio;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Longest common subsequence length - optimized
|
|
162
|
+
*/
|
|
163
|
+
longestCommonSubsequence(seq1, seq2) {
|
|
164
|
+
const m = seq1.length;
|
|
165
|
+
const n = seq2.length;
|
|
166
|
+
|
|
167
|
+
// Use approximate version for large sequences (lower threshold for performance)
|
|
168
|
+
if (m * n > 10000) {
|
|
169
|
+
return this.approximateLCS(seq1, seq2);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Space-optimized LCS using only two rows
|
|
173
|
+
let prev = new Array(n + 1).fill(0);
|
|
174
|
+
let curr = new Array(n + 1).fill(0);
|
|
175
|
+
|
|
176
|
+
for (let i = 1; i <= m; i++) {
|
|
177
|
+
for (let j = 1; j <= n; j++) {
|
|
178
|
+
if (seq1[i - 1] === seq2[j - 1]) {
|
|
179
|
+
curr[j] = prev[j - 1] + 1;
|
|
180
|
+
} else {
|
|
181
|
+
curr[j] = Math.max(prev[j], curr[j - 1]);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// Swap rows
|
|
185
|
+
[prev, curr] = [curr, prev];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return prev[n];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Approximate LCS for large sequences - faster heuristic
|
|
193
|
+
*/
|
|
194
|
+
approximateLCS(seq1, seq2) {
|
|
195
|
+
// Use set intersection as a fast approximation
|
|
196
|
+
const set1 = new Set(seq1);
|
|
197
|
+
const set2 = new Set(seq2);
|
|
198
|
+
|
|
199
|
+
let commonTokens = 0;
|
|
200
|
+
for (const token of set1) {
|
|
201
|
+
if (set2.has(token)) {
|
|
202
|
+
commonTokens++;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Scale by average occurrence frequency
|
|
207
|
+
const avgLen = (seq1.length + seq2.length) / 2;
|
|
208
|
+
const uniqueAvg = (set1.size + set2.size) / 2;
|
|
209
|
+
const frequencyFactor = avgLen / uniqueAvg;
|
|
210
|
+
|
|
211
|
+
return Math.min(commonTokens * frequencyFactor, Math.min(seq1.length, seq2.length));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Calculate confidence for a clone group - fast version without full pairwise comparison
|
|
216
|
+
*/
|
|
217
|
+
calculateGroupConfidenceFast(blocks) {
|
|
218
|
+
if (blocks.length < 2) return 0;
|
|
219
|
+
|
|
220
|
+
// Sample-based confidence instead of full pairwise
|
|
221
|
+
const first = blocks[0];
|
|
222
|
+
let totalSimilarity = 0;
|
|
223
|
+
|
|
224
|
+
for (let i = 1; i < Math.min(blocks.length, 5); i++) {
|
|
225
|
+
totalSimilarity += this.calculateBlockSimilarity(first, blocks[i]);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return totalSimilarity / Math.min(blocks.length - 1, 4);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Calculate confidence for a clone group (original full version)
|
|
233
|
+
*/
|
|
234
|
+
calculateGroupConfidence(blocks) {
|
|
235
|
+
if (blocks.length === 0) return 0;
|
|
236
|
+
|
|
237
|
+
// Calculate average pairwise similarity
|
|
238
|
+
let totalSimilarity = 0;
|
|
239
|
+
let comparisons = 0;
|
|
240
|
+
|
|
241
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
242
|
+
for (let j = i + 1; j < blocks.length; j++) {
|
|
243
|
+
totalSimilarity += this.calculateBlockSimilarity(blocks[i], blocks[j]);
|
|
244
|
+
comparisons++;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return comparisons > 0 ? totalSimilarity / comparisons : 0;
|
|
249
|
+
}
|
|
250
|
+
}
|