footprinter-cli 1.0.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.
- footprinter/__init__.py +8 -0
- footprinter/access.py +444 -0
- footprinter/api/__init__.py +1 -0
- footprinter/api/db.py +61 -0
- footprinter/api/entities.py +250 -0
- footprinter/api/search.py +47 -0
- footprinter/api/semantic.py +33 -0
- footprinter/api/server.py +66 -0
- footprinter/api/status.py +15 -0
- footprinter/bundled/__init__.py +0 -0
- footprinter/bundled/config.example.yaml +161 -0
- footprinter/bundled/patterns/context_patterns.yaml +18 -0
- footprinter/bundled/patterns/extensions.yaml +283 -0
- footprinter/bundled/patterns/filename_patterns.yaml +61 -0
- footprinter/bundled/patterns/mime_mappings.yaml +68 -0
- footprinter/bundled/patterns/salesforce_rules.yaml +84 -0
- footprinter/bundled/patterns/security_patterns.yaml +27 -0
- footprinter/cli/__init__.py +128 -0
- footprinter/cli/__main__.py +6 -0
- footprinter/cli/_common.py +332 -0
- footprinter/cli/_policy_helpers.py +646 -0
- footprinter/cli/_prompt.py +220 -0
- footprinter/cli/api_cmd.py +32 -0
- footprinter/cli/connect.py +591 -0
- footprinter/cli/data.py +879 -0
- footprinter/cli/delete.py +128 -0
- footprinter/cli/ingest.py +579 -0
- footprinter/cli/mcp_cmd.py +750 -0
- footprinter/cli/mcp_setup.py +306 -0
- footprinter/cli/search.py +393 -0
- footprinter/cli/search_cmd.py +69 -0
- footprinter/cli/setup.py +1836 -0
- footprinter/cli/status.py +729 -0
- footprinter/cli/status_cmd.py +104 -0
- footprinter/cli/upsert.py +794 -0
- footprinter/cli/vectorize_cmd.py +215 -0
- footprinter/cli/view.py +322 -0
- footprinter/connectors/__init__.py +171 -0
- footprinter/connectors/config_utils.py +141 -0
- footprinter/db/__init__.py +37 -0
- footprinter/db/browser.py +198 -0
- footprinter/db/chats.py +610 -0
- footprinter/db/clients.py +307 -0
- footprinter/db/emails.py +279 -0
- footprinter/db/files.py +741 -0
- footprinter/db/folders.py +659 -0
- footprinter/db/messages.py +192 -0
- footprinter/db/policies.py +151 -0
- footprinter/db/projects.py +673 -0
- footprinter/db/search.py +573 -0
- footprinter/db/sql_utils.py +168 -0
- footprinter/db/status.py +320 -0
- footprinter/db/uploads.py +70 -0
- footprinter/ingest/__init__.py +0 -0
- footprinter/ingest/adapters/__init__.py +33 -0
- footprinter/ingest/adapters/browser.py +54 -0
- footprinter/ingest/adapters/chat.py +57 -0
- footprinter/ingest/adapters/ingest.py +146 -0
- footprinter/ingest/adapters/local_files.py +68 -0
- footprinter/ingest/adapters/local_folders.py +52 -0
- footprinter/ingest/adapters/protocol.py +174 -0
- footprinter/ingest/browser_indexer.py +216 -0
- footprinter/ingest/chat_dedup.py +156 -0
- footprinter/ingest/chat_indexer.py +515 -0
- footprinter/ingest/chat_parsers/__init__.py +8 -0
- footprinter/ingest/chat_parsers/chatgpt_parser.py +229 -0
- footprinter/ingest/chat_parsers/claude_parser.py +161 -0
- footprinter/ingest/cli.py +827 -0
- footprinter/ingest/content_extractors.py +117 -0
- footprinter/ingest/database.py +36 -0
- footprinter/ingest/db/__init__.py +1 -0
- footprinter/ingest/db/connector_schema.py +47 -0
- footprinter/ingest/db/migration.py +328 -0
- footprinter/ingest/db/schema.py +1043 -0
- footprinter/ingest/db/security.py +6 -0
- footprinter/ingest/file_indexer.py +261 -0
- footprinter/ingest/file_scanner.py +277 -0
- footprinter/ingest/folder_indexer.py +226 -0
- footprinter/ingest/full_content_extractor.py +321 -0
- footprinter/ingest/orchestrator.py +125 -0
- footprinter/ingest/pipe_runner.py +217 -0
- footprinter/ingest/processing.py +165 -0
- footprinter/ingest/registry.py +201 -0
- footprinter/ingest/run_record.py +91 -0
- footprinter/ingest/status.py +346 -0
- footprinter/mcp/__init__.py +0 -0
- footprinter/mcp/__main__.py +5 -0
- footprinter/mcp/db.py +57 -0
- footprinter/mcp/errors.py +102 -0
- footprinter/mcp/extraction.py +226 -0
- footprinter/mcp/server.py +39 -0
- footprinter/mcp/tools/__init__.py +0 -0
- footprinter/mcp/tools/navigation.py +70 -0
- footprinter/mcp/tools/read.py +75 -0
- footprinter/mcp/tools/search.py +158 -0
- footprinter/mcp/tools/semantic.py +79 -0
- footprinter/mcp/tools/status.py +15 -0
- footprinter/paths.py +91 -0
- footprinter/permissions.py +1160 -0
- footprinter/semantic/__init__.py +13 -0
- footprinter/semantic/chunking.py +52 -0
- footprinter/semantic/embeddings.py +23 -0
- footprinter/semantic/hybrid_search.py +273 -0
- footprinter/semantic/vector_store.py +471 -0
- footprinter/services/__init__.py +49 -0
- footprinter/services/access_service.py +342 -0
- footprinter/services/chat_service.py +85 -0
- footprinter/services/client_service.py +267 -0
- footprinter/services/content_service.py +181 -0
- footprinter/services/email_service.py +89 -0
- footprinter/services/file_service.py +83 -0
- footprinter/services/folder_service.py +122 -0
- footprinter/services/includes.py +19 -0
- footprinter/services/ingest_service.py +231 -0
- footprinter/services/project_service.py +262 -0
- footprinter/services/roles.py +25 -0
- footprinter/services/search_service.py +177 -0
- footprinter/services/semantic_service.py +360 -0
- footprinter/services/status_service.py +18 -0
- footprinter/services/visit_service.py +65 -0
- footprinter/source_registry.py +194 -0
- footprinter/utils/__init__.py +7 -0
- footprinter/utils/hash_utils.py +59 -0
- footprinter/utils/logging_config.py +68 -0
- footprinter/utils/mime.py +30 -0
- footprinter/utils/text.py +6 -0
- footprinter/utils/time.py +11 -0
- footprinter/visibility.py +1272 -0
- footprinter_cli-1.0.0.dist-info/LICENSE +21 -0
- footprinter_cli-1.0.0.dist-info/METADATA +229 -0
- footprinter_cli-1.0.0.dist-info/RECORD +134 -0
- footprinter_cli-1.0.0.dist-info/WHEEL +5 -0
- footprinter_cli-1.0.0.dist-info/entry_points.txt +2 -0
- footprinter_cli-1.0.0.dist-info/top_level.txt +1 -0
footprinter/paths.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""Single source-of-truth path resolution for Footprinter.
|
|
2
|
+
|
|
3
|
+
Defaults to ``~/.footprinter/`` (installable-package compatible).
|
|
4
|
+
Every path can be overridden via environment variable.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import importlib.resources
|
|
8
|
+
import logging
|
|
9
|
+
import os
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def get_home() -> Path:
|
|
14
|
+
"""Return FOOTPRINTER_HOME, creating it if needed.
|
|
15
|
+
|
|
16
|
+
Priority: ``$FOOTPRINTER_HOME`` env var > ``~/.footprinter/`` default.
|
|
17
|
+
"""
|
|
18
|
+
override = os.environ.get("FOOTPRINTER_HOME")
|
|
19
|
+
home = Path(override) if override else Path.home() / ".footprinter"
|
|
20
|
+
home.mkdir(parents=True, exist_ok=True)
|
|
21
|
+
return home
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def get_config_path() -> Path:
|
|
25
|
+
"""Return the config file path. Respects FOOTPRINTER_CONFIG env var."""
|
|
26
|
+
env = os.environ.get("FOOTPRINTER_CONFIG")
|
|
27
|
+
return Path(env) if env else get_home() / "config.yaml"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def get_db_path() -> Path:
|
|
31
|
+
"""Return the database path, creating the parent dir. Respects FOOTPRINTER_DB_PATH env var."""
|
|
32
|
+
env = os.environ.get("FOOTPRINTER_DB_PATH")
|
|
33
|
+
path = Path(env) if env else get_home() / "footprinter.db"
|
|
34
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
35
|
+
return path
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def get_chroma_path() -> Path:
|
|
39
|
+
"""Return the ChromaDB storage path."""
|
|
40
|
+
return get_home() / "chroma"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def get_log_path() -> Path:
|
|
44
|
+
"""Return the setup log path."""
|
|
45
|
+
return get_home() / "setup.log"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def get_run_logs_dir() -> Path:
|
|
49
|
+
"""Return the run logs directory (~/.footprinter/logs/), creating it if needed."""
|
|
50
|
+
d = get_home() / "logs"
|
|
51
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
52
|
+
return d
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def prune_run_logs(keep: int = 20) -> int:
|
|
56
|
+
"""Remove old run log files, keeping the *keep* most recent.
|
|
57
|
+
|
|
58
|
+
Only targets ``run_*.log`` files. Returns the number of files removed.
|
|
59
|
+
"""
|
|
60
|
+
log_dir = get_run_logs_dir()
|
|
61
|
+
logs = sorted(log_dir.glob("run_*.log"))
|
|
62
|
+
to_remove = logs[: max(0, len(logs) - keep)]
|
|
63
|
+
for path in to_remove:
|
|
64
|
+
path.unlink()
|
|
65
|
+
if to_remove:
|
|
66
|
+
logging.getLogger("footprinter").debug(
|
|
67
|
+
"Pruned %d old run log(s) from %s",
|
|
68
|
+
len(to_remove),
|
|
69
|
+
log_dir,
|
|
70
|
+
)
|
|
71
|
+
return len(to_remove)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def get_last_run_path() -> Path:
|
|
75
|
+
"""Return the path to the last run record (~/.footprinter/last_run.json)."""
|
|
76
|
+
return get_home() / "last_run.json"
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def get_run_lock_path() -> Path:
|
|
80
|
+
"""Return the path to the run lockfile (~/.footprinter/run.lock)."""
|
|
81
|
+
return get_home() / "run.lock"
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def get_bundled_path(name: str) -> Path:
|
|
85
|
+
"""Return path to a bundled resource file shipped with the package."""
|
|
86
|
+
return importlib.resources.files("footprinter.bundled") / name
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def get_bundled_patterns_dir() -> Path:
|
|
90
|
+
"""Return path to the bundled patterns directory."""
|
|
91
|
+
return importlib.resources.files("footprinter.bundled") / "patterns"
|