Add dev container configuration with docker-compose, Dockerfile, and entrypoint script - Create .devcontainer/devcontainer.json for VS Code dev container - Create .devcontainer/docker-compose.yml for container setup - Add Dockerfile with Python, Go, Rust, R, and jj tools - Add docker-entrypoint.sh to initialize .ai_index and start mcp-server - Add Makefile for container management and MCP operations - Add .gitignore entries for AI index - Add OpenCode global instructions - Add basic MCP server and tool for listing Go imports - Add Zed integration configuration - Update README with project vision and structure
28 lines
842 B
Python
28 lines
842 B
Python
#!/usr/bin/env python3
|
|
import sys, json
|
|
|
|
def get_imports_go(filepath: str) -> list[str]:
|
|
try:
|
|
with open(filepath) as f:
|
|
lines = f.readlines()
|
|
imports = []
|
|
in_import_block = False
|
|
for line in lines:
|
|
stripped = line.strip()
|
|
if stripped == "import (":
|
|
in_import_block = True
|
|
continue
|
|
if stripped == ")" and in_import_block:
|
|
break
|
|
if in_import_block and stripped.startswith('"'):
|
|
imports.append(stripped.strip('"'))
|
|
return imports
|
|
except Exception as e:
|
|
return [f"error: {e}"]
|
|
|
|
if __name__ == "__main__":
|
|
args = json.loads(sys.argv[1])
|
|
filepath = args.get("file", "")
|
|
result = get_imports_go(filepath)
|
|
print(json.dumps({"result": result}, indent=2))
|