file-analyzer 0.1.0__py3-none-any.whl
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.
- file_analyzer-0.1.0.dist-info/METADATA +590 -0
- file_analyzer-0.1.0.dist-info/RECORD +380 -0
- file_analyzer-0.1.0.dist-info/WHEEL +5 -0
- file_analyzer-0.1.0.dist-info/entry_points.txt +4 -0
- file_analyzer-0.1.0.dist-info/licenses/LICENSE +201 -0
- file_analyzer-0.1.0.dist-info/licenses/NOTICE +44 -0
- file_analyzer-0.1.0.dist-info/top_level.txt +2 -0
- mcp_server.py +860 -0
- src/__init__.py +69 -0
- src/__main__.py +258 -0
- src/_version.py +18 -0
- src/archive/__init__.py +16 -0
- src/archive/archive_analyzer.py +1014 -0
- src/binary/__init__.py +29 -0
- src/binary/binary_forensics.py +397 -0
- src/binary/format_parsers.py +2814 -0
- src/binary/machine_code.py +1477 -0
- src/config/__init__.py +12 -0
- src/config/config_analyzer.py +634 -0
- src/config/config_formats.py +2276 -0
- src/convert/__init__.py +28 -0
- src/convert/format_converter.py +1340 -0
- src/convert/text_analyzer.py +881 -0
- src/core/__init__.py +24 -0
- src/core/analysis_engine.py +862 -0
- src/core/db_generator.py +4239 -0
- src/core/import_linkage.py +319 -0
- src/core/mcp_enrichment.py +1845 -0
- src/core/repository_analyzer.py +734 -0
- src/core/runtime_guard.py +305 -0
- src/core/unified_db.py +303 -0
- src/data/__init__.py +5 -0
- src/data/asset_text_formats.py +929 -0
- src/data/catalog_binary_formats.py +1451 -0
- src/data/catalog_text_formats.py +1552 -0
- src/data/data_analyzer.py +5891 -0
- src/data/media_metrics.py +586 -0
- src/data/model_formats.py +1023 -0
- src/data/science_formats.py +1179 -0
- src/database/__init__.py +12 -0
- src/database/database_analyzer.py +506 -0
- src/database/db_formats.py +1907 -0
- src/document/__init__.py +39 -0
- src/document/agent_mcp.py +1578 -0
- src/document/document_analyzer.py +428 -0
- src/document/document_db.py +1452 -0
- src/document/document_formats.py +69 -0
- src/document/document_parser.py +4620 -0
- src/document/dynamic_engine.py +1602 -0
- src/document/evaluation_engine.py +890 -0
- src/document/evaluation_metrics.py +1119 -0
- src/document/parsers.py +1631 -0
- src/main.py +924 -0
- src/markup/__init__.py +14 -0
- src/markup/markup_analyzer.py +506 -0
- src/markup/markup_formats.py +1828 -0
- src/misc/__init__.py +14 -0
- src/misc/misc_analyzer.py +427 -0
- src/misc/misc_formats.py +70 -0
- src/misc/parsers.py +724 -0
- src/monitor/__init__.py +71 -0
- src/monitor/change_log.py +221 -0
- src/monitor/control.py +270 -0
- src/monitor/diff_db.py +521 -0
- src/monitor/go/go.mod +3 -0
- src/monitor/go/plane.go +193 -0
- src/monitor/incremental.py +267 -0
- src/monitor/monitor.py +499 -0
- src/monitor/pool.py +227 -0
- src/monitor/scanner.py +291 -0
- src/monitor/session_log.py +417 -0
- src/monitor/store.py +347 -0
- src/monitor/worker.py +90 -0
- src/prog_lang/__init__.py +469 -0
- src/prog_lang/_tree_sitter.py +55 -0
- src/prog_lang/abap_analyzer.py +191 -0
- src/prog_lang/actionscript_analyzer.py +149 -0
- src/prog_lang/ada_analyzer.py +169 -0
- src/prog_lang/afl_analyzer.py +78 -0
- src/prog_lang/agda_analyzer.py +196 -0
- src/prog_lang/al_analyzer.py +175 -0
- src/prog_lang/alembic_analyzer.py +46 -0
- src/prog_lang/algol_analyzer.py +116 -0
- src/prog_lang/ampl_analyzer.py +68 -0
- src/prog_lang/apache_beam_analyzer.py +61 -0
- src/prog_lang/apl_analyzer.py +103 -0
- src/prog_lang/asl_analyzer.py +119 -0
- src/prog_lang/aspnet_ashx_analyzer.py +108 -0
- src/prog_lang/aspnet_asmx_analyzer.py +113 -0
- src/prog_lang/astro_analyzer.py +83 -0
- src/prog_lang/ballerina_analyzer.py +196 -0
- src/prog_lang/base_code_analyzer.py +328 -0
- src/prog_lang/befunge_analyzer.py +44 -0
- src/prog_lang/bicep_analyzer.py +86 -0
- src/prog_lang/blackbird_analyzer.py +61 -0
- src/prog_lang/bloqade_analyzer.py +94 -0
- src/prog_lang/bluespec_analyzer.py +130 -0
- src/prog_lang/bms_analyzer.py +87 -0
- src/prog_lang/boo_analyzer.py +170 -0
- src/prog_lang/brainfuck_analyzer.py +46 -0
- src/prog_lang/c_analyzer.py +336 -0
- src/prog_lang/cairo_analyzer.py +175 -0
- src/prog_lang/carbon_analyzer.py +113 -0
- src/prog_lang/cask_analyzer.py +136 -0
- src/prog_lang/cdk_analyzer.py +33 -0
- src/prog_lang/cedar_analyzer.py +64 -0
- src/prog_lang/ceylon_analyzer.py +169 -0
- src/prog_lang/chapel_analyzer.py +202 -0
- src/prog_lang/chisel_analyzer.py +169 -0
- src/prog_lang/cirq_analyzer.py +68 -0
- src/prog_lang/clarity_analyzer.py +131 -0
- src/prog_lang/clojure_analyzer.py +80 -0
- src/prog_lang/cobol_analyzer.py +250 -0
- src/prog_lang/coffeescript_analyzer.py +147 -0
- src/prog_lang/coldfusion_analyzer.py +184 -0
- src/prog_lang/cppmodule_analyzer.py +260 -0
- src/prog_lang/crystal_analyzer.py +230 -0
- src/prog_lang/csharp_analyzer.py +187 -0
- src/prog_lang/curry_analyzer.py +182 -0
- src/prog_lang/cython_analyzer.py +300 -0
- src/prog_lang/d_analyzer.py +192 -0
- src/prog_lang/dagman_analyzer.py +86 -0
- src/prog_lang/dagster_analyzer.py +60 -0
- src/prog_lang/dart_analyzer.py +138 -0
- src/prog_lang/devicetree_analyzer.py +79 -0
- src/prog_lang/drools_analyzer.py +109 -0
- src/prog_lang/dynamics_nav_analyzer.py +90 -0
- src/prog_lang/easytrieve_analyzer.py +195 -0
- src/prog_lang/edgeworker_analyzer.py +24 -0
- src/prog_lang/eiffel_analyzer.py +247 -0
- src/prog_lang/elixir_analyzer.py +187 -0
- src/prog_lang/elm_analyzer.py +177 -0
- src/prog_lang/emacslisp_analyzer.py +159 -0
- src/prog_lang/erlang_analyzer.py +90 -0
- src/prog_lang/esignal_efs_analyzer.py +82 -0
- src/prog_lang/factor_analyzer.py +166 -0
- src/prog_lang/fennel_analyzer.py +92 -0
- src/prog_lang/flix_analyzer.py +84 -0
- src/prog_lang/focus_analyzer.py +115 -0
- src/prog_lang/forth_analyzer.py +108 -0
- src/prog_lang/fortran_analyzer.py +207 -0
- src/prog_lang/fourgl_analyzer.py +96 -0
- src/prog_lang/frege_analyzer.py +131 -0
- src/prog_lang/fsharp_analyzer.py +159 -0
- src/prog_lang/gams_analyzer.py +128 -0
- src/prog_lang/gauge_spec_analyzer.py +93 -0
- src/prog_lang/gaussian_input_analyzer.py +62 -0
- src/prog_lang/gdscript_analyzer.py +203 -0
- src/prog_lang/gleam_analyzer.py +106 -0
- src/prog_lang/gmsh_geo_analyzer.py +107 -0
- src/prog_lang/gnu_assembly_analyzer.py +81 -0
- src/prog_lang/go_analyzer.py +294 -0
- src/prog_lang/gren_analyzer.py +108 -0
- src/prog_lang/groovy_analyzer.py +107 -0
- src/prog_lang/harbour_analyzer.py +156 -0
- src/prog_lang/haskell_analyzer.py +153 -0
- src/prog_lang/haxe_analyzer.py +159 -0
- src/prog_lang/hip_analyzer.py +227 -0
- src/prog_lang/hy_analyzer.py +175 -0
- src/prog_lang/icon_analyzer.py +125 -0
- src/prog_lang/ideal_analyzer.py +78 -0
- src/prog_lang/idris_analyzer.py +197 -0
- src/prog_lang/ink_analyzer.py +80 -0
- src/prog_lang/intercal_analyzer.py +78 -0
- src/prog_lang/io_analyzer.py +84 -0
- src/prog_lang/isabelle_analyzer.py +77 -0
- src/prog_lang/j_analyzer.py +60 -0
- src/prog_lang/jai_analyzer.py +91 -0
- src/prog_lang/janet_analyzer.py +117 -0
- src/prog_lang/java_analyzer.py +198 -0
- src/prog_lang/javascript_analyzer.py +475 -0
- src/prog_lang/jbi_analyzer.py +80 -0
- src/prog_lang/jsbundle_analyzer.py +22 -0
- src/prog_lang/julia_analyzer.py +120 -0
- src/prog_lang/k6_analyzer.py +23 -0
- src/prog_lang/k_analyzer.py +65 -0
- src/prog_lang/koka_analyzer.py +99 -0
- src/prog_lang/kotlin_analyzer.py +220 -0
- src/prog_lang/krl_analyzer.py +103 -0
- src/prog_lang/labview_vi_analyzer.py +57 -0
- src/prog_lang/lark_analyzer.py +68 -0
- src/prog_lang/lean_analyzer.py +196 -0
- src/prog_lang/lex_analyzer.py +101 -0
- src/prog_lang/ligo_analyzer.py +60 -0
- src/prog_lang/lilypond_analyzer.py +91 -0
- src/prog_lang/lisp_analyzer.py +240 -0
- src/prog_lang/livescript_analyzer.py +176 -0
- src/prog_lang/llvmir_analyzer.py +61 -0
- src/prog_lang/locust_analyzer.py +38 -0
- src/prog_lang/logtalk_analyzer.py +145 -0
- src/prog_lang/lolcode_analyzer.py +47 -0
- src/prog_lang/lookml_analyzer.py +103 -0
- src/prog_lang/lua_analyzer.py +96 -0
- src/prog_lang/luigi_analyzer.py +38 -0
- src/prog_lang/macro_asm_analyzer.py +161 -0
- src/prog_lang/magik_analyzer.py +104 -0
- src/prog_lang/marko_analyzer.py +177 -0
- src/prog_lang/matlab_analyzer.py +100 -0
- src/prog_lang/mercury_analyzer.py +119 -0
- src/prog_lang/mermaid_analyzer.py +370 -0
- src/prog_lang/metafont_analyzer.py +103 -0
- src/prog_lang/michelson_analyzer.py +44 -0
- src/prog_lang/mizar_analyzer.py +88 -0
- src/prog_lang/ml4_analyzer.py +130 -0
- src/prog_lang/mlir_analyzer.py +64 -0
- src/prog_lang/modula2_analyzer.py +105 -0
- src/prog_lang/modula3_analyzer.py +113 -0
- src/prog_lang/mojo_analyzer.py +177 -0
- src/prog_lang/moonscript_analyzer.py +163 -0
- src/prog_lang/motoko_analyzer.py +106 -0
- src/prog_lang/move_analyzer.py +109 -0
- src/prog_lang/mql_analyzer.py +115 -0
- src/prog_lang/nasm_analyzer.py +85 -0
- src/prog_lang/natural_analyzer.py +92 -0
- src/prog_lang/nemerle_analyzer.py +163 -0
- src/prog_lang/netlogo_analyzer.py +90 -0
- src/prog_lang/nim_analyzer.py +109 -0
- src/prog_lang/nix_analyzer.py +71 -0
- src/prog_lang/oberon_analyzer.py +124 -0
- src/prog_lang/ocaml_analyzer.py +92 -0
- src/prog_lang/ocamllex_analyzer.py +85 -0
- src/prog_lang/ocamlyacc_analyzer.py +89 -0
- src/prog_lang/odin_analyzer.py +159 -0
- src/prog_lang/ook_analyzer.py +52 -0
- src/prog_lang/opendss_analyzer.py +65 -0
- src/prog_lang/openqasm_analyzer.py +116 -0
- src/prog_lang/openscad_analyzer.py +84 -0
- src/prog_lang/pascal_analyzer.py +276 -0
- src/prog_lang/peg_analyzer.py +60 -0
- src/prog_lang/pennylane_analyzer.py +53 -0
- src/prog_lang/perl_analyzer.py +109 -0
- src/prog_lang/php_analyzer.py +196 -0
- src/prog_lang/piet_analyzer.py +36 -0
- src/prog_lang/pinescript_analyzer.py +110 -0
- src/prog_lang/plantuml_analyzer.py +147 -0
- src/prog_lang/pli_analyzer.py +101 -0
- src/prog_lang/polyglot.py +886 -0
- src/prog_lang/pony_analyzer.py +137 -0
- src/prog_lang/prefect_analyzer.py +33 -0
- src/prog_lang/processing_analyzer.py +150 -0
- src/prog_lang/progress_analyzer.py +166 -0
- src/prog_lang/prolog_analyzer.py +110 -0
- src/prog_lang/puppet_analyzer.py +129 -0
- src/prog_lang/purescript_analyzer.py +198 -0
- src/prog_lang/pyquil_analyzer.py +53 -0
- src/prog_lang/python_analyzer.py +534 -0
- src/prog_lang/python_embedded_base.py +151 -0
- src/prog_lang/q_analyzer.py +69 -0
- src/prog_lang/qir_analyzer.py +70 -0
- src/prog_lang/qml_analyzer.py +137 -0
- src/prog_lang/qmod_analyzer.py +79 -0
- src/prog_lang/qsharp_analyzer.py +80 -0
- src/prog_lang/quest_analyzer.py +131 -0
- src/prog_lang/quil_analyzer.py +78 -0
- src/prog_lang/r_analyzer.py +108 -0
- src/prog_lang/racket_analyzer.py +176 -0
- src/prog_lang/raku_analyzer.py +159 -0
- src/prog_lang/ramis_analyzer.py +78 -0
- src/prog_lang/rapid_analyzer.py +107 -0
- src/prog_lang/rc_analyzer.py +119 -0
- src/prog_lang/reasonml_analyzer.py +110 -0
- src/prog_lang/rebol_analyzer.py +90 -0
- src/prog_lang/red_analyzer.py +87 -0
- src/prog_lang/regex_base.py +420 -0
- src/prog_lang/rego_analyzer.py +96 -0
- src/prog_lang/ren_analyzer.py +127 -0
- src/prog_lang/rescript_analyzer.py +114 -0
- src/prog_lang/riot_analyzer.py +167 -0
- src/prog_lang/robotframework_analyzer.py +121 -0
- src/prog_lang/roc_analyzer.py +114 -0
- src/prog_lang/rpg_analyzer.py +146 -0
- src/prog_lang/ruby_analyzer.py +167 -0
- src/prog_lang/rust_analyzer.py +301 -0
- src/prog_lang/scala_analyzer.py +183 -0
- src/prog_lang/scheme_analyzer.py +154 -0
- src/prog_lang/scilab_analyzer.py +92 -0
- src/prog_lang/scilla_analyzer.py +97 -0
- src/prog_lang/sentinel_analyzer.py +80 -0
- src/prog_lang/simula_analyzer.py +123 -0
- src/prog_lang/slang_analyzer.py +93 -0
- src/prog_lang/smali_analyzer.py +97 -0
- src/prog_lang/sml_analyzer.py +197 -0
- src/prog_lang/smtlib_analyzer.py +116 -0
- src/prog_lang/snobol_analyzer.py +72 -0
- src/prog_lang/solidity_analyzer.py +157 -0
- src/prog_lang/spice_analyzer.py +125 -0
- src/prog_lang/spice_lib_analyzer.py +97 -0
- src/prog_lang/squirrel_analyzer.py +138 -0
- src/prog_lang/stim_analyzer.py +54 -0
- src/prog_lang/stl_analyzer.py +98 -0
- src/prog_lang/structuredtext_analyzer.py +83 -0
- src/prog_lang/svelte_analyzer.py +78 -0
- src/prog_lang/swift_analyzer.py +185 -0
- src/prog_lang/swiftinterface_analyzer.py +172 -0
- src/prog_lang/sycl_analyzer.py +232 -0
- src/prog_lang/tal_analyzer.py +108 -0
- src/prog_lang/teal_analyzer.py +52 -0
- src/prog_lang/test_def_analyzer.py +107 -0
- src/prog_lang/tradestation_tsl_analyzer.py +71 -0
- src/prog_lang/tree_sitter_base.py +268 -0
- src/prog_lang/tree_sitter_grammar_analyzer.py +30 -0
- src/prog_lang/triton_analyzer.py +35 -0
- src/prog_lang/twee_analyzer.py +84 -0
- src/prog_lang/unison_analyzer.py +76 -0
- src/prog_lang/upc_analyzer.py +184 -0
- src/prog_lang/urscript_analyzer.py +68 -0
- src/prog_lang/vala_analyzer.py +170 -0
- src/prog_lang/vb_analyzer.py +236 -0
- src/prog_lang/vb_usercontrol_analyzer.py +92 -0
- src/prog_lang/vcl_analyzer.py +76 -0
- src/prog_lang/verilog_analyzer.py +122 -0
- src/prog_lang/verilog_header_analyzer.py +134 -0
- src/prog_lang/vhdl_analyzer.py +102 -0
- src/prog_lang/vue_analyzer.py +81 -0
- src/prog_lang/vyper_analyzer.py +180 -0
- src/prog_lang/wat_analyzer.py +127 -0
- src/prog_lang/whitespace_analyzer.py +135 -0
- src/prog_lang/wolfram_analyzer.py +83 -0
- src/prog_lang/wren_analyzer.py +92 -0
- src/prog_lang/yacc_analyzer.py +121 -0
- src/prog_lang/yara_analyzer.py +79 -0
- src/prog_lang/zig_analyzer.py +95 -0
- src/prog_lang/zimpl_analyzer.py +106 -0
- src/router/__init__.py +28 -0
- src/router/concordance_worker.py +216 -0
- src/router/go/go.mod +3 -0
- src/router/go/plane.go +159 -0
- src/router/java/AnalyzerPlane.java +157 -0
- src/router/planes.py +282 -0
- src/router/routing.py +702 -0
- src/router/worker.py +143 -0
- src/schema/__init__.py +5 -0
- src/schema/schema_analyzer.py +2721 -0
- src/schema/schema_defs.py +877 -0
- src/script/__init__.py +61 -0
- src/script/build_tools.py +138 -0
- src/script/reused.py +28 -0
- src/script/shells.py +153 -0
- src/script/windows.py +229 -0
- src/shell/__init__.py +202 -0
- src/shell/applescript.py +95 -0
- src/shell/automation.py +209 -0
- src/shell/binary_template.py +108 -0
- src/shell/bitbake.py +117 -0
- src/shell/build_scripts.py +203 -0
- src/shell/compiled_scripts.py +96 -0
- src/shell/domain_scripts.py +255 -0
- src/shell/installers.py +187 -0
- src/shell/mainframe.py +295 -0
- src/shell/math_scripting.py +207 -0
- src/shell/misc_langs.py +271 -0
- src/shell/modern_shells.py +144 -0
- src/shell/posix_shell.py +167 -0
- src/shell/python_dsls.py +101 -0
- src/shell/shell_base.py +138 -0
- src/shell/statistics.py +205 -0
- src/shell/tcl_family.py +147 -0
- src/shell/text_processing.py +107 -0
- src/shell/windows_scripting.py +155 -0
- src/tables/file_extensions.json +72744 -0
- src/tables/iana_global_timezones.json +1193 -0
- src/tables/iana_local_timezones.json +4421 -0
- src/text/__init__.py +12 -0
- src/text/textual_analyzer.py +430 -0
- src/text/textual_formats.py +3329 -0
- src/views/__init__.py +46 -0
- src/views/__main__.py +96 -0
- src/views/builder.py +226 -0
- src/views/catalog.py +408 -0
- src/views/go/go.mod +21 -0
- src/views/go/go.sum +49 -0
- src/views/go/main.go +488 -0
- src/views/java/RepositoryReader.java +536 -0
- src/views/java/slf4j-api-2.0.13.jar +0 -0
- src/views/java/sqlite-jdbc-3.45.3.0.jar +0 -0
- src/views/native_reader.py +343 -0
- src/views/reader.py +78 -0
- src/views/sql/catalog.json +280 -0
- src/views/sql/views.pgsql.sql +101 -0
- src/views/sql/views.sqlite.sql +101 -0
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: file-analyzer
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Repository intelligence platform: turns a source tree into a queryable SQLite/PostgreSQL database of code, schemas, data, archives, binaries and docs -- without executing it -- plus a live background monitor, an MCP agent-enrichment tier, and a document-intelligence engine.
|
|
5
|
+
Author: Rohan Pratap Reddy Ravula
|
|
6
|
+
License: Apache License
|
|
7
|
+
Version 2.0, January 2004
|
|
8
|
+
http://www.apache.org/licenses/
|
|
9
|
+
|
|
10
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
+
|
|
12
|
+
1. Definitions.
|
|
13
|
+
|
|
14
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
15
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
16
|
+
|
|
17
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
18
|
+
the copyright owner that is granting the License.
|
|
19
|
+
|
|
20
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
21
|
+
other entities that control, are controlled by, or are under common
|
|
22
|
+
control with that entity. For the purposes of this definition,
|
|
23
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
24
|
+
direction or management of such entity, whether by contract or
|
|
25
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
26
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
27
|
+
|
|
28
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
29
|
+
exercising permissions granted by this License.
|
|
30
|
+
|
|
31
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
32
|
+
including but not limited to software source code, documentation
|
|
33
|
+
source, and configuration files.
|
|
34
|
+
|
|
35
|
+
"Object" form shall mean any form resulting from mechanical
|
|
36
|
+
transformation or translation of a Source form, including but
|
|
37
|
+
not limited to compiled object code, generated documentation,
|
|
38
|
+
and conversions to other media types.
|
|
39
|
+
|
|
40
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
41
|
+
Object form, made available under the License, as indicated by a
|
|
42
|
+
copyright notice that is included in or attached to the work
|
|
43
|
+
(an example is provided in the Appendix below).
|
|
44
|
+
|
|
45
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
46
|
+
form, that is based on (or derived from) the Work and for which the
|
|
47
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
48
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
49
|
+
of this License, Derivative Works shall not include works that remain
|
|
50
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
51
|
+
the Work and Derivative Works thereof.
|
|
52
|
+
|
|
53
|
+
"Contribution" shall mean any work of authorship, including
|
|
54
|
+
the original version of the Work and any modifications or additions
|
|
55
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
56
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
57
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
58
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
59
|
+
means any form of electronic, verbal, or written communication sent
|
|
60
|
+
to the Licensor or its representatives, including but not limited to
|
|
61
|
+
communication on electronic mailing lists, source code control systems,
|
|
62
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
63
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
64
|
+
excluding communication that is conspicuously marked or otherwise
|
|
65
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
66
|
+
|
|
67
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
68
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
69
|
+
subsequently incorporated within the Work.
|
|
70
|
+
|
|
71
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
72
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
75
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
76
|
+
Work and such Derivative Works in Source or Object form.
|
|
77
|
+
|
|
78
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
+
(except as stated in this section) patent license to make, have made,
|
|
82
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
83
|
+
where such license applies only to those patent claims licensable
|
|
84
|
+
by such Contributor that are necessarily infringed by their
|
|
85
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
86
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
87
|
+
institute patent litigation against any entity (including a
|
|
88
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
89
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
90
|
+
or contributory patent infringement, then any patent licenses
|
|
91
|
+
granted to You under this License for that Work shall terminate
|
|
92
|
+
as of the date such litigation is filed.
|
|
93
|
+
|
|
94
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
+
modifications, and in Source or Object form, provided that You
|
|
97
|
+
meet the following conditions:
|
|
98
|
+
|
|
99
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
100
|
+
Works a copy of this License; and
|
|
101
|
+
|
|
102
|
+
(b) You must cause any modified files to carry prominent notices
|
|
103
|
+
stating that You changed the files; and
|
|
104
|
+
|
|
105
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
+
that You distribute, all copyright, patent, trademark, and
|
|
107
|
+
attribution notices from the Source form of the Work, excluding
|
|
108
|
+
those notices that do not pertain to any part of the Derivative
|
|
109
|
+
Works; and
|
|
110
|
+
|
|
111
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
+
distribution, then any Derivative Works that You distribute must
|
|
113
|
+
include a readable copy of the attribution notices contained
|
|
114
|
+
within such NOTICE file, excluding those notices that do not
|
|
115
|
+
pertain to any part of the Derivative Works, in at least one
|
|
116
|
+
of the following places: within a NOTICE text file distributed
|
|
117
|
+
as part of the Derivative Works; within the Source form or
|
|
118
|
+
documentation, if provided along with the Derivative Works; or,
|
|
119
|
+
within a display generated by the Derivative Works, if and
|
|
120
|
+
wherever such third-party notices normally appear. The contents
|
|
121
|
+
of the NOTICE file are for informational purposes only and do
|
|
122
|
+
not modify the License. You may add Your own attribution notices
|
|
123
|
+
within Derivative Works that You distribute, alongside or as an
|
|
124
|
+
addendum to the NOTICE text from the Work, provided that such
|
|
125
|
+
additional attribution notices cannot be construed as modifying
|
|
126
|
+
the License.
|
|
127
|
+
|
|
128
|
+
You may add Your own copyright statement to Your modifications and
|
|
129
|
+
may provide additional or different license terms and conditions
|
|
130
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
131
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
132
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
133
|
+
the conditions stated in this License.
|
|
134
|
+
|
|
135
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
+
this License, without any additional terms or conditions.
|
|
139
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
140
|
+
the terms of any separate license agreement you may have executed
|
|
141
|
+
with Licensor regarding such Contributions.
|
|
142
|
+
|
|
143
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
144
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
145
|
+
except as required for reasonable and customary use in describing the
|
|
146
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
147
|
+
|
|
148
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
149
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
150
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
151
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
152
|
+
implied, including, without limitation, any warranties or conditions
|
|
153
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
154
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
+
appropriateness of using or redistributing the Work and assume any
|
|
156
|
+
risks associated with Your exercise of permissions under this License.
|
|
157
|
+
|
|
158
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
159
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
160
|
+
unless required by applicable law (such as deliberate and grossly
|
|
161
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
162
|
+
liable to You for damages, including any direct, indirect, special,
|
|
163
|
+
incidental, or consequential damages of any character arising as a
|
|
164
|
+
result of this License or out of the use or inability to use the
|
|
165
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
166
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
167
|
+
other commercial damages or losses), even if such Contributor
|
|
168
|
+
has been advised of the possibility of such damages.
|
|
169
|
+
|
|
170
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
171
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
172
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
173
|
+
or other liability obligations and/or rights consistent with this
|
|
174
|
+
License. However, in accepting such obligations, You may act only
|
|
175
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
176
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
177
|
+
defend, and hold each Contributor harmless for any liability
|
|
178
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
179
|
+
of your accepting any such warranty or additional liability.
|
|
180
|
+
|
|
181
|
+
END OF TERMS AND CONDITIONS
|
|
182
|
+
|
|
183
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
184
|
+
|
|
185
|
+
To apply the Apache License to your work, attach the following
|
|
186
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
187
|
+
replaced with your own identifying information. (Don't include
|
|
188
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
189
|
+
comment syntax for the file format. We also recommend that a
|
|
190
|
+
file or class name and description of purpose be included on the
|
|
191
|
+
same "printed page" as the copyright notice for easier
|
|
192
|
+
identification within third-party archives.
|
|
193
|
+
|
|
194
|
+
Copyright 2026 Rohan Pratap Reddy Ravula
|
|
195
|
+
|
|
196
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
197
|
+
you may not use this file except in compliance with the License.
|
|
198
|
+
You may obtain a copy of the License at
|
|
199
|
+
|
|
200
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
201
|
+
|
|
202
|
+
Unless required by applicable law or agreed to in writing, software
|
|
203
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
204
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
205
|
+
See the License for the specific language governing permissions and
|
|
206
|
+
limitations under the License.
|
|
207
|
+
|
|
208
|
+
Project-URL: Homepage, https://github.com/RohanPratapReddy/file-analyzer
|
|
209
|
+
Project-URL: Repository, https://github.com/RohanPratapReddy/file-analyzer
|
|
210
|
+
Keywords: static-analysis,code-intelligence,repository,sqlite,mcp,ai-agent,repository-monitor,incremental-analysis,document-intelligence
|
|
211
|
+
Classifier: Development Status :: 4 - Beta
|
|
212
|
+
Classifier: Intended Audience :: Developers
|
|
213
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
214
|
+
Classifier: Programming Language :: Python :: 3
|
|
215
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
216
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
217
|
+
Requires-Python: >=3.9
|
|
218
|
+
Description-Content-Type: text/markdown
|
|
219
|
+
License-File: LICENSE
|
|
220
|
+
License-File: NOTICE
|
|
221
|
+
Provides-Extra: agent
|
|
222
|
+
Requires-Dist: mcp[cli]<2,>=1.2; extra == "agent"
|
|
223
|
+
Provides-Extra: monitor-postgres
|
|
224
|
+
Requires-Dist: psycopg[binary]>=3.1; extra == "monitor-postgres"
|
|
225
|
+
Provides-Extra: monitor-mysql
|
|
226
|
+
Requires-Dist: PyMySQL>=1.1; extra == "monitor-mysql"
|
|
227
|
+
Provides-Extra: parse
|
|
228
|
+
Requires-Dist: pdfplumber; extra == "parse"
|
|
229
|
+
Requires-Dist: pdfminer.six; extra == "parse"
|
|
230
|
+
Requires-Dist: pikepdf; extra == "parse"
|
|
231
|
+
Requires-Dist: python-docx; extra == "parse"
|
|
232
|
+
Requires-Dist: oletools; extra == "parse"
|
|
233
|
+
Provides-Extra: ocr
|
|
234
|
+
Requires-Dist: scikit-image; extra == "ocr"
|
|
235
|
+
Requires-Dist: pytesseract; extra == "ocr"
|
|
236
|
+
Provides-Extra: pii
|
|
237
|
+
Requires-Dist: phonenumbers; extra == "pii"
|
|
238
|
+
Requires-Dist: python-stdnum; extra == "pii"
|
|
239
|
+
Requires-Dist: presidio-analyzer; extra == "pii"
|
|
240
|
+
Requires-Dist: spacy; extra == "pii"
|
|
241
|
+
Requires-Dist: textstat; extra == "pii"
|
|
242
|
+
Provides-Extra: eval
|
|
243
|
+
Requires-Dist: jiwer; extra == "eval"
|
|
244
|
+
Requires-Dist: sacrebleu; extra == "eval"
|
|
245
|
+
Requires-Dist: nltk; extra == "eval"
|
|
246
|
+
Requires-Dist: lxml; extra == "eval"
|
|
247
|
+
Requires-Dist: zss; extra == "eval"
|
|
248
|
+
Requires-Dist: scikit-learn; extra == "eval"
|
|
249
|
+
Requires-Dist: jsonschema; extra == "eval"
|
|
250
|
+
Requires-Dist: tiktoken; extra == "eval"
|
|
251
|
+
Requires-Dist: ragas; extra == "eval"
|
|
252
|
+
Requires-Dist: deepeval; extra == "eval"
|
|
253
|
+
Provides-Extra: document
|
|
254
|
+
Requires-Dist: file-analyzer[eval,ocr,parse,pii]; extra == "document"
|
|
255
|
+
Dynamic: license-file
|
|
256
|
+
|
|
257
|
+
# file-analyzer
|
|
258
|
+
|
|
259
|
+
**Point it at a repository, get back a queryable database of everything in it.**
|
|
260
|
+
|
|
261
|
+
`file-analyzer` is a **repository intelligence platform**. Its core walks a source
|
|
262
|
+
tree — code, schemas, data files, archives, binaries, configs, docs — **without ever
|
|
263
|
+
executing it**, and emits a single **SQLite** (or **PostgreSQL**) database describing
|
|
264
|
+
what it found: files and folders, per-language symbols (classes, functions, imports
|
|
265
|
+
and the links between them), database schemas (tables, columns, keys, constraints,
|
|
266
|
+
triggers), data-artifact profiles (datasets, columns, tensors, correlations), and
|
|
267
|
+
more. A layer of ready-made **analysis views** (`v_*`) sits on top so you can answer
|
|
268
|
+
questions with plain `SELECT`s, and two independent **concurrent readers** (Go and
|
|
269
|
+
Java) demonstrate strictly read-only access to those views.
|
|
270
|
+
|
|
271
|
+
On top of that static core it adds **live and agentic layers**:
|
|
272
|
+
|
|
273
|
+
- a **background monitor** that watches a repository and re-analyzes changed files
|
|
274
|
+
incrementally across a Go/Python worker pool, with a FIFO diff DB and a durable
|
|
275
|
+
change log ([docs/monitor.md](docs/monitor.md));
|
|
276
|
+
- an optional **MCP agent tier** that enriches each file (summaries, quality /
|
|
277
|
+
security findings, symbol docs) alongside the deterministic metrics;
|
|
278
|
+
- a **document-intelligence engine** (DocumentParser) combining static metrics with
|
|
279
|
+
a dynamic agent/code loop and a full evaluation stack
|
|
280
|
+
([docs/document-engine-agents.md](docs/document-engine-agents.md));
|
|
281
|
+
- a **unified database** that merges every per-source layer into one queryable `.db`
|
|
282
|
+
+ `.sql`.
|
|
283
|
+
|
|
284
|
+
It never executes the code it analyzes, never modifies the source tree, never stores
|
|
285
|
+
raw file payloads, and degrades honestly — when a format can only be partially
|
|
286
|
+
understood, it records what it could determine and marks the rest, rather than
|
|
287
|
+
fabricating results.
|
|
288
|
+
|
|
289
|
+
> **⚠️ Runs in a container or VM only.** The CLI entrypoints (`file-analyzer` /
|
|
290
|
+
> `python -m src.main` and the monitor `file-analyzer-monitor` / `python -m src`)
|
|
291
|
+
> **refuse to run directly on bare-metal host hardware** — they start only inside a
|
|
292
|
+
> container (Docker/Podman/containerd/LXC/Kubernetes) or a virtual machine, exiting
|
|
293
|
+
> with code **3** otherwise. Use the Docker workflow below (recommended), or set
|
|
294
|
+
> `FILE_ANALYZER_ALLOW_BARE_METAL=1` to opt out on an already-isolated box. The MCP
|
|
295
|
+
> server is unaffected. Full details: **[docs/runtime-containment.md](docs/runtime-containment.md)**.
|
|
296
|
+
|
|
297
|
+
## What it produces
|
|
298
|
+
|
|
299
|
+
Running the engine over a repository yields two artifacts (both carry the `v_*`
|
|
300
|
+
views):
|
|
301
|
+
|
|
302
|
+
- `repository.db` — a binary SQLite database, opened in place, read-only.
|
|
303
|
+
- `repository_schema.sql` — a portable text dump (SQLite or PostgreSQL dialect).
|
|
304
|
+
|
|
305
|
+
## Quick start
|
|
306
|
+
|
|
307
|
+
The engine must run inside a container or VM (see the note above). The one-line
|
|
308
|
+
Docker recipe below satisfies that automatically. To run the Python CLI directly,
|
|
309
|
+
do it inside a VM/container, or export `FILE_ANALYZER_ALLOW_BARE_METAL=1` first:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
pip install -r requirements.txt
|
|
313
|
+
|
|
314
|
+
# Analyze a repository (the source must be a git repo, or pass --no-git).
|
|
315
|
+
python -m src.main /path/to/repo --out ./artifacts
|
|
316
|
+
|
|
317
|
+
# Postgres-loadable dump instead of SQLite:
|
|
318
|
+
python -m src.main /path/to/repo --out ./artifacts --dialect postgresql
|
|
319
|
+
|
|
320
|
+
# All flags (works on any host — --help is exempt from the containment guard):
|
|
321
|
+
python -m src.main --help
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Flags: `--out`, `--db`, `--sql`, `--dialect {sqlite,postgresql}`, `--temp`
|
|
325
|
+
(staging dir; defaults under `--out`, so a read-only source still analyzes),
|
|
326
|
+
`--workers`, `--no-archives`, `--no-git`, `--keep-temp`, `--quiet` (stdout carries
|
|
327
|
+
only the final JSON — for pipes/agents). Prints a JSON summary on success.
|
|
328
|
+
|
|
329
|
+
### Install as a command
|
|
330
|
+
|
|
331
|
+
`pip`/`pipx`-install to get a `file-analyzer` command invocable from any directory
|
|
332
|
+
(no `python -m`, no specific cwd):
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
pipx install . # or: pip install .
|
|
336
|
+
file-analyzer /path/to/repo --out ./artifacts --quiet
|
|
337
|
+
file-analyzer-mcp # start the MCP server (extras: pip install ".[agent]")
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Or one-line Docker (no local Python)
|
|
341
|
+
|
|
342
|
+
The Dockerfile's `engine` stage runs the analyzer over a repo mounted at
|
|
343
|
+
`/workspace` and writes artifacts to `/artifacts`:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
docker build --target engine -t file-analyzer .
|
|
347
|
+
docker run --rm -v "$PWD:/workspace:ro" -v "$PWD/artifacts:/artifacts" \
|
|
348
|
+
file-analyzer /workspace --out /artifacts --quiet
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Then query the result:
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
sqlite3 ./artifacts/repository.db "SELECT * FROM v_extension_distribution;"
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## Use with AI agents (MCP)
|
|
358
|
+
|
|
359
|
+
`file-analyzer` ships an [MCP](https://modelcontextprotocol.io) server so agents
|
|
360
|
+
(Claude Code/Desktop, opencode, Cursor, Cline, Windsurf, …) can drive the engine.
|
|
361
|
+
The intended loop is **analyze once, then ask questions with SQL** over the `v_*`
|
|
362
|
+
views — the agent writes ordinary `SELECT`s instead of parsing walls of text.
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
pip install -r requirements-agent.txt # the MCP SDK
|
|
366
|
+
python -m mcp_server # stdio transport (or: file-analyzer-mcp)
|
|
367
|
+
|
|
368
|
+
# register with Claude Code (other agents take the same command in their config):
|
|
369
|
+
claude mcp add file-analyzer -- python -m mcp_server
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Tools: `analyze_repository`, `query`, `list_views`, `read_views`,
|
|
373
|
+
`describe_schema`, `run_component`, `list_components`. `query` is read-only
|
|
374
|
+
(`mode=ro` + `PRAGMA query_only`, single `SELECT`/`WITH` only); `read_views`
|
|
375
|
+
bulk-reads many `v_*` views at once, splitting them across the native Go and Java
|
|
376
|
+
readers concurrently (with a concurrent pure-Python fallback).
|
|
377
|
+
|
|
378
|
+
Not using MCP? The CLI is agent-friendly too: pass **`--quiet`** so stdout carries
|
|
379
|
+
only the final JSON (progress goes to stderr), and see **[`AGENTS.md`](AGENTS.md)**
|
|
380
|
+
for the driving guide and **[`tools.json`](tools.json)** for function-calling
|
|
381
|
+
(Grok/DeepSeek/OpenAI-style) tool definitions.
|
|
382
|
+
|
|
383
|
+
## Using the pipeline as a library
|
|
384
|
+
|
|
385
|
+
Import the public classes from the `src` package (run from the repo root so `src`
|
|
386
|
+
is importable):
|
|
387
|
+
|
|
388
|
+
```python
|
|
389
|
+
from src import (RepositoryAnalyzer, PolyglotCodeAnalyzer, ImportLinkageAnalyzer,
|
|
390
|
+
SchemaAnalyzer, DataAnalyzer, RepositoryDatabaseGenerator,
|
|
391
|
+
AnalysisEngine)
|
|
392
|
+
|
|
393
|
+
engine = AnalysisEngine()
|
|
394
|
+
summary = engine.run("/path/to/repo", out_dir="./artifacts")
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### Package layout
|
|
398
|
+
|
|
399
|
+
| package | role |
|
|
400
|
+
|------------------------|---------------------------------------------------------------------------|
|
|
401
|
+
| `src/core/` | orchestration glue — `analysis_engine`, `repository_analyzer`, `import_linkage`, `db_generator` (re-exported at the package top level). |
|
|
402
|
+
| `src/prog_lang/` | per-language source analyzers (classes, functions, imports, symbols). |
|
|
403
|
+
| `src/schema/` | SQL DDL / IDL schema analyzers → `schema_*` tables. |
|
|
404
|
+
| `src/data/` | data-artifact profiler (metadata / stats / sampling only) → `data_*` tables. |
|
|
405
|
+
| `src/database/` | database-file analyzers (merges schema + data for DB formats). |
|
|
406
|
+
| `src/archive/` | archive traversal (nested, bounded depth). |
|
|
407
|
+
| `src/binary/` | machine-code and binary-format analyzers. |
|
|
408
|
+
| `src/config/`, `src/text/`, `src/markup/`, `src/document/`, `src/script/`, `src/shell/`, `src/misc/` | format-family analyzers for the long tail of file types. |
|
|
409
|
+
| `src/convert/` | opaque → renderable format conversion helpers. |
|
|
410
|
+
| `src/router/` | pure-Python routing / staging that dispatches files to analyzers. |
|
|
411
|
+
| `src/views/` | the views + reads layer (single source of truth — see below). |
|
|
412
|
+
| `src/tables/` | canonical reference tables — the extension catalog (`file_extensions.json`) and the IANA timezone tables (`iana_local_timezones.json`, `iana_global_timezones.json`). |
|
|
413
|
+
|
|
414
|
+
## The views layer (`src/views`)
|
|
415
|
+
|
|
416
|
+
The analysis views are defined **once**, in Python, and installed into every
|
|
417
|
+
database the engine produces (and mirrored into the `.sql` dump). The Go and Java
|
|
418
|
+
readers embed no query SQL — they **discover** the installed `VIEW` objects from
|
|
419
|
+
the database catalog. Add or change a view in
|
|
420
|
+
[`src/views/catalog.py`](src/views/catalog.py) and every reader, plus the
|
|
421
|
+
Postgres/Docker backend, picks it up with no code changes.
|
|
422
|
+
|
|
423
|
+
| module | role |
|
|
424
|
+
|---------------|----------------------------------------------------------------------------|
|
|
425
|
+
| `catalog.py` | the view catalog: `VIEW_CATALOG` of `ViewDef(name, tables, select)`; DB object names are `v_<name>`. |
|
|
426
|
+
| `builder.py` | turns the catalog into real objects: `install_views_sqlite(db)`, `append_views_to_sql_dump(sql)`, `views_ddl(dialect)`, `write_sql_artifacts(dir)`. |
|
|
427
|
+
| `reader.py` | Python reads over the installed views: `list_views`, `read_view`, `read_all_views`. |
|
|
428
|
+
| `native_reader.py` | concurrent bulk reads: `read_views_native` splits the views across the Go (`go/`) and Java (`java/`) readers and runs them at the same wall-clock time; `read_views_python` is the toolchain-free concurrent fallback. |
|
|
429
|
+
| `__main__.py` | CLI (`python -m src.views …`). |
|
|
430
|
+
| `sql/` | generated artifacts: `views.sqlite.sql`, `views.pgsql.sql`, `catalog.json`. |
|
|
431
|
+
| `go/`, `java/` | native concurrent view readers (`-json` mode) that `native_reader.py` builds on demand. |
|
|
432
|
+
| `go/`, `java/`| the Go + Java reader programs (below). |
|
|
433
|
+
|
|
434
|
+
A view is created only when **all of its base tables are present**, so a database
|
|
435
|
+
lacking the `schema_*` / `data_*` families simply never gets (and never errors on)
|
|
436
|
+
those views. This gives readers a clean contract: *a view exists in the DB ⟺ its
|
|
437
|
+
base tables exist*, so they can enumerate `type='view'` and `SELECT *` with zero
|
|
438
|
+
skip-logic. Installation is **additive, idempotent, and the only write**: it creates
|
|
439
|
+
read-only `VIEW` objects over existing tables and never touches table data.
|
|
440
|
+
|
|
441
|
+
```bash
|
|
442
|
+
python -m src.views install repository.db
|
|
443
|
+
python -m src.views dump repository_schema.sql
|
|
444
|
+
python -m src.views list repository.db
|
|
445
|
+
python -m src.views read repository.db --view v_extension_distribution
|
|
446
|
+
python -m src.views artifacts src/views/sql # (re)generate sql/ artifacts
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### View catalog — 33 views over the `v_` prefix
|
|
450
|
+
|
|
451
|
+
- **core (10):** `file_inventory`, `extension_distribution`, `folder_tree_depth`,
|
|
452
|
+
`import_internal_vs_external`, `import_edges`, `top_classes_by_methods`,
|
|
453
|
+
`functions_defined_vs_imported`, `symbols_by_kind`, `introspection_by_language`,
|
|
454
|
+
`tensor_members_by_kind`.
|
|
455
|
+
- **schema (12):** `schema_databases_by_engine`, `schema_tables_by_engine`,
|
|
456
|
+
`schema_tables_by_kind`, `schema_top_column_types`, `schema_keys_by_type`,
|
|
457
|
+
`schema_foreign_key_edges`, `schema_constraints_by_type`,
|
|
458
|
+
`schema_triggers_by_timing`, `schema_methods_by_language`,
|
|
459
|
+
`schema_types_by_category`, `schema_top_indexed_tables`,
|
|
460
|
+
`schema_entities_per_file`.
|
|
461
|
+
- **data (11):** `data_datasets_by_modality`, `data_datasets_by_category`,
|
|
462
|
+
`data_datasets_by_format`, `data_analysis_status`, `data_largest_tabular`,
|
|
463
|
+
`data_columns_by_inferred_type`, `data_top_correlations`,
|
|
464
|
+
`data_tensors_by_dtype`, `data_largest_tensors`, `data_properties_by_group`,
|
|
465
|
+
`data_entities_per_file`.
|
|
466
|
+
|
|
467
|
+
## The concurrent readers (Go + Java)
|
|
468
|
+
|
|
469
|
+
Two independent programs — one **Go**, one **Java** — open the artifact and read
|
|
470
|
+
every discovered view across a pool of workers, concurrently and **strictly
|
|
471
|
+
read-only**. They are functionally equivalent: same discovered views, same read-only
|
|
472
|
+
guarantees, same CLI flags.
|
|
473
|
+
|
|
474
|
+
### Read-only guarantees
|
|
475
|
+
|
|
476
|
+
Zero writes, zero changes, zero commits by the workers. Enforced in layers:
|
|
477
|
+
|
|
478
|
+
1. **Open mode** — the database is opened `mode=ro` (`SQLITE_OPEN_READONLY`).
|
|
479
|
+
2. **Engine pragma** — every pooled connection sets `PRAGMA query_only = true`.
|
|
480
|
+
3. **Start-up canary** — before any worker starts, the program attempts a write
|
|
481
|
+
(`CREATE TABLE __readonly_canary__`) and *requires it to fail*. If the write
|
|
482
|
+
ever succeeds, the program aborts. You'll see `read-only : verified (write
|
|
483
|
+
canary rejected)` on success.
|
|
484
|
+
4. **Query-only code paths** — workers only ever call the read API (`db.Query*` in
|
|
485
|
+
Go, `Statement.executeQuery` in Java). No `Exec`/`executeUpdate`, no
|
|
486
|
+
transactions, no commits.
|
|
487
|
+
|
|
488
|
+
Each reader accepts either the `.db`/`.sqlite` (opened in place, read-only) or the
|
|
489
|
+
`.sql` dump (loaded **once** into a private temp snapshot the workers then read;
|
|
490
|
+
the original file is never modified and the temp file is deleted on exit).
|
|
491
|
+
|
|
492
|
+
### CLI (identical for both readers)
|
|
493
|
+
|
|
494
|
+
| flag | default | meaning |
|
|
495
|
+
|-------------|----------------|----------------------------------------------------|
|
|
496
|
+
| `-source` | `repository.db`| path to the `.db` or `.sql` produced by the engine |
|
|
497
|
+
| `-workers` | CPU count | number of concurrent workers (goroutines / threads)|
|
|
498
|
+
| `-repeat` | `1` | replay the whole view set N times for sustained load|
|
|
499
|
+
| `-verbose` | off | print every result body (default: once per view) |
|
|
500
|
+
|
|
501
|
+
### Go
|
|
502
|
+
|
|
503
|
+
Pure-Go SQLite driver (`modernc.org/sqlite`) — no cgo / no gcc needed.
|
|
504
|
+
|
|
505
|
+
```bash
|
|
506
|
+
cd src/views/go
|
|
507
|
+
go mod tidy # fetches modernc.org/sqlite
|
|
508
|
+
go build -o repo-reader .
|
|
509
|
+
# repository.db lives four levels up (repo root), from src/views/go:
|
|
510
|
+
./repo-reader -source ../../../repository.db -workers 6 -repeat 2
|
|
511
|
+
./repo-reader -source ../../../repository_schema.sql -workers 4
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### Java (JDK 17+)
|
|
515
|
+
|
|
516
|
+
Needs the SQLite JDBC driver (`org.xerial:sqlite-jdbc`) and its runtime dependency
|
|
517
|
+
`org.slf4j:slf4j-api` — both jars ship alongside the source in `src/views/java`.
|
|
518
|
+
|
|
519
|
+
```bash
|
|
520
|
+
cd src/views/java
|
|
521
|
+
javac -cp "sqlite-jdbc-3.45.3.0.jar" RepositoryReader.java
|
|
522
|
+
# Windows classpath separator is ';', Unix is ':'
|
|
523
|
+
java -cp ".;sqlite-jdbc-3.45.3.0.jar;slf4j-api-2.0.13.jar" RepositoryReader -source ../../../repository.db -workers 6 -repeat 2 # Windows
|
|
524
|
+
java -cp ".:sqlite-jdbc-3.45.3.0.jar:slf4j-api-2.0.13.jar" RepositoryReader -source ../../../repository.db -workers 6 -repeat 2 # Unix
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
> sqlite-jdbc 3.45.x prints a one-line `SLF4J: No providers were found` notice and
|
|
528
|
+
> defaults to a no-op logger — harmless. Add `slf4j-nop` to silence it.
|
|
529
|
+
|
|
530
|
+
## Docker — Postgres backend + frontend + views
|
|
531
|
+
|
|
532
|
+
`docker-compose.yml` (the default compose file, so no `-f` needed) brings up
|
|
533
|
+
Postgres, a one-shot `loader`, and pgAdmin, loading every artifact the engine
|
|
534
|
+
produced (see the compose file header for usage).
|
|
535
|
+
|
|
536
|
+
An **optional containerized engine** (compose `engine` profile, Dockerfile `engine`
|
|
537
|
+
stage) *produces* those artifacts by running `python -m src.main` against a mounted
|
|
538
|
+
source repository — so the whole flow can run in containers:
|
|
539
|
+
|
|
540
|
+
```bash
|
|
541
|
+
# 1. produce artifacts from a source repo into ./artifacts
|
|
542
|
+
SOURCE_DIR=/path/to/repo ARTIFACTS_DIR=./artifacts \
|
|
543
|
+
docker compose --profile engine run --build engine
|
|
544
|
+
|
|
545
|
+
# 2. bring up Postgres + loader to ingest ./artifacts
|
|
546
|
+
ARTIFACTS_DIR=./artifacts docker compose up --build
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
The `engine` service runs `python -m src.main` and accepts **any** of its
|
|
550
|
+
arguments. Pass them as one `ENGINE_ARGS` string (shell-split and appended to the
|
|
551
|
+
entrypoint), or inline after the service name:
|
|
552
|
+
|
|
553
|
+
```bash
|
|
554
|
+
# via ENGINE_ARGS (overrides the default command):
|
|
555
|
+
SOURCE_DIR=/path/to/repo \
|
|
556
|
+
ENGINE_ARGS="/workspace --out /artifacts --dialect postgresql --no-git --workers 8" \
|
|
557
|
+
docker compose --profile engine run --build engine
|
|
558
|
+
|
|
559
|
+
# or inline (replaces the command for that run):
|
|
560
|
+
docker compose --profile engine run --build engine \
|
|
561
|
+
/workspace --out /artifacts --dialect postgresql
|
|
562
|
+
|
|
563
|
+
# see every flag:
|
|
564
|
+
docker compose --profile engine run --build engine --help
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
The views are wired in two ways:
|
|
568
|
+
|
|
569
|
+
- **`.sql` dumps** (postgresql dialect) already contain the appended
|
|
570
|
+
`CREATE OR REPLACE VIEW` statements, so `psql` creates them on load.
|
|
571
|
+
- **`.db` artifacts** go through `pgloader`, which copies *tables only*; the loader
|
|
572
|
+
then applies [`src/views/sql/views.pgsql.sql`](src/views/sql/views.pgsql.sql)
|
|
573
|
+
(bind-mounted in) to (re)create the views per database. Views over absent tables
|
|
574
|
+
are skipped, matching the SQLite-side contract.
|
|
575
|
+
|
|
576
|
+
An **optional containerized Go reader** (compose `reader` profile) runs the same
|
|
577
|
+
view-reading worker against a mounted artifact:
|
|
578
|
+
|
|
579
|
+
```bash
|
|
580
|
+
docker compose --profile reader run --build reader
|
|
581
|
+
# point at another artifact / tune workers:
|
|
582
|
+
docker compose --profile reader run --build reader -source /artifacts/some_archive.db -workers 8
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
## License
|
|
586
|
+
|
|
587
|
+
Licensed under the Apache License, Version 2.0 — see [LICENSE](LICENSE). The
|
|
588
|
+
bundled `sqlite-jdbc` (Apache-2.0) and `slf4j-api` (MIT) jars under
|
|
589
|
+
`src/views/java/` are redistributed under their own licenses; see [NOTICE](NOTICE)
|
|
590
|
+
for attribution.
|