sourcefire 0.2.1__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {sourcefire-0.2.1/sourcefire.egg-info → sourcefire-0.2.2}/PKG-INFO +1 -1
  2. {sourcefire-0.2.1 → sourcefire-0.2.2}/pyproject.toml +1 -1
  3. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/cli.py +32 -0
  4. {sourcefire-0.2.1 → sourcefire-0.2.2/sourcefire.egg-info}/PKG-INFO +1 -1
  5. {sourcefire-0.2.1 → sourcefire-0.2.2}/LICENSE +0 -0
  6. {sourcefire-0.2.1 → sourcefire-0.2.2}/MANIFEST.in +0 -0
  7. {sourcefire-0.2.1 → sourcefire-0.2.2}/README.md +0 -0
  8. {sourcefire-0.2.1 → sourcefire-0.2.2}/setup.cfg +0 -0
  9. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/__init__.py +0 -0
  10. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/api/__init__.py +0 -0
  11. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/api/models.py +0 -0
  12. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/api/routes.py +0 -0
  13. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/chain/__init__.py +0 -0
  14. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/chain/prompts.py +0 -0
  15. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/chain/rag_chain.py +0 -0
  16. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/config.py +0 -0
  17. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/db.py +0 -0
  18. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/indexer/__init__.py +0 -0
  19. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/indexer/embeddings.py +0 -0
  20. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/indexer/language_profiles.py +0 -0
  21. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/indexer/metadata.py +0 -0
  22. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/indexer/pipeline.py +0 -0
  23. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/init.py +0 -0
  24. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/prompts/system.md +0 -0
  25. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/retriever/__init__.py +0 -0
  26. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/retriever/graph.py +0 -0
  27. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/retriever/search.py +0 -0
  28. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/static/.DS_Store +0 -0
  29. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/static/app.js +0 -0
  30. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/static/index.html +0 -0
  31. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/static/styles.css +0 -0
  32. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire/watcher.py +0 -0
  33. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire.egg-info/SOURCES.txt +0 -0
  34. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire.egg-info/dependency_links.txt +0 -0
  35. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire.egg-info/entry_points.txt +0 -0
  36. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire.egg-info/requires.txt +0 -0
  37. {sourcefire-0.2.1 → sourcefire-0.2.2}/sourcefire.egg-info/top_level.txt +0 -0
  38. {sourcefire-0.2.1 → sourcefire-0.2.2}/tests/test_config.py +0 -0
  39. {sourcefire-0.2.1 → sourcefire-0.2.2}/tests/test_graph.py +0 -0
  40. {sourcefire-0.2.1 → sourcefire-0.2.2}/tests/test_metadata.py +0 -0
  41. {sourcefire-0.2.1 → sourcefire-0.2.2}/tests/test_prompts.py +0 -0
  42. {sourcefire-0.2.1 → sourcefire-0.2.2}/tests/test_routes.py +0 -0
  43. {sourcefire-0.2.1 → sourcefire-0.2.2}/tests/test_search.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sourcefire
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Get instant context on any codebase. One command to index, ask questions in plain English, get answers grounded in actual code.
5
5
  Author-email: Athar Wani <athar@cravv.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sourcefire"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "Get instant context on any codebase. One command to index, ask questions in plain English, get answers grounded in actual code."
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}
@@ -6,6 +6,7 @@ import argparse
6
6
  import asyncio
7
7
  import fcntl
8
8
  import os
9
+ import socket
9
10
  import sys
10
11
  import webbrowser
11
12
  from contextlib import asynccontextmanager
@@ -73,6 +74,25 @@ def release_lock(fd: int, lock_path: Path) -> None:
73
74
  pass
74
75
 
75
76
 
77
+ def _port_available(host: str, port: int) -> bool:
78
+ """Check if a port is available."""
79
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
80
+ try:
81
+ s.bind((host, port))
82
+ return True
83
+ except OSError:
84
+ return False
85
+
86
+
87
+ def find_available_port(host: str, preferred: int, max_attempts: int = 20) -> int:
88
+ """Find an available port, starting from preferred and incrementing."""
89
+ for offset in range(max_attempts):
90
+ port = preferred + offset
91
+ if _port_available(host, port):
92
+ return port
93
+ raise RuntimeError(f"No available port found in range {preferred}-{preferred + max_attempts - 1}")
94
+
95
+
76
96
  # ---------------------------------------------------------------------------
77
97
  # App state (shared between main() and lifespan)
78
98
  # ---------------------------------------------------------------------------
@@ -268,6 +288,18 @@ def main() -> None:
268
288
  if args.port:
269
289
  config.port = args.port
270
290
 
291
+ # Find available port (auto-increment if taken)
292
+ try:
293
+ actual_port = find_available_port(config.host, config.port)
294
+ except RuntimeError:
295
+ print(f"Error: No available port found starting from {config.port}.")
296
+ release_lock(lock_fd, sourcefire_dir / ".lock")
297
+ sys.exit(1)
298
+
299
+ if actual_port != config.port:
300
+ print(f"Port {config.port} is in use, using {actual_port} instead.")
301
+ config.port = actual_port
302
+
271
303
  # Store state for lifespan access
272
304
  _app_state["config"] = config
273
305
  _app_state["project_dir"] = project_dir
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sourcefire
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Get instant context on any codebase. One command to index, ask questions in plain English, get answers grounded in actual code.
5
5
  Author-email: Athar Wani <athar@cravv.com>
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes