Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,34 @@ uses [Semantic Versioning](https://semver.org/).
to directories through the module path in `go.mod` (and local `replace`
directives), and standard-library or third-party calls are dropped.
`_test.go` files and `vendor/` are skipped.
- **Zig analyzer.** Functions, containers (`struct`, `enum`, `union`,
`opaque`), their member functions (`Point.add`), and generic type functions
(`fn List(comptime T: type) type { return struct {...}; }`) become
components. Edges cover calls (plain, `alias.fn()`, and method calls on
`Self`, parameters, and locals whose type can be inferred), `T{...}`
literals, and types named in parameters, return types, fields, and
annotated locals. `@import("x.zig")` aliases and re-exports
(`const T = @import("x.zig").T;`) resolve to the file that declares the
name, as do module names that the root `build.zig` registers with
`addModule`; `std`, `builtin`, and third-party packages are dropped. `test`
blocks and `zig-cache/`, `.zig-cache/`, `zig-out/` are skipped, `build.zig`
is also a build artifact, and `build.zig.zon` is a manifest.
- **Vue single-file components.** Each `.vue` file becomes a component
(`ArticleList.vue::ArticleList`), and its options-API members (`methods`,
`computed`, `watch`, lifecycle hooks such as `mounted` or `setup`) become
its methods. `<script>` and `<script setup>` blocks go through the
JavaScript or TypeScript analyzer (`lang="ts"`), keeping the `.vue` file's
line numbers. Edges link a component to the `.vue` files and modules it
imports (relative paths and the `@/` alias), to the components its template
uses (`<article-preview>` or `<ArticlePreview>`), and to the members and
script functions its template expressions call or bind.
- **Autotools build files.** `configure.ac`, `Makefile.am` (and other `*.am`),
`acinclude.m4`, and macros under `m4/` are build artifacts. A `Makefile.am`
gets a unit per library or program it builds (`libfoo.la`), linked to the
sources in its `_SOURCES` lists, and `SUBDIRS` links to the sub-directory
`Makefile.am`s. A `configure.ac` gets a unit per `AC_ARG_ENABLE` /
`AC_ARG_WITH` option and links to the `Makefile.am`s that `AC_CONFIG_FILES`
generates.

### Changed

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ Full list in the [CHANGELOG](./CHANGELOG.md).
## Features

**Languages.** Python, Java, JavaScript, TypeScript, C, C++, C#, Kotlin,
PHP, Ruby, Scala, Rust, Dart (Flutter-aware), Go.
PHP, Ruby, Scala, Rust, Dart (Flutter-aware), Go, Zig, Vue (single-file
components).

**Hierarchical decomposition.** The dependency graph is clustered into a
module tree, recursively, so a 1.4M-line repository gets the same treatment
Expand Down
2 changes: 1 addition & 1 deletion codewiki/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def cli(ctx):

AI agents write the documentation from your dependency graph. Supports
Python, Java, JavaScript, TypeScript, C, C++, C#, Kotlin, PHP, Ruby,
Scala, Rust, Dart, and Go.
Scala, Rust, Dart, Go, Zig, and Vue.
"""
# Ensure context object exists
ctx.ensure_object(dict)
Expand Down
4 changes: 3 additions & 1 deletion codewiki/cli/utils/repo_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
".rs", # Rust
".dart", # Dart
".go", # Go
".zig", # Zig
".vue", # Vue single-file components
}


Expand Down Expand Up @@ -67,7 +69,7 @@ def validate_repository(repo_path: Path) -> tuple[Path, list[tuple[str, int]]]:
raise RepositoryError(
f"No supported code files found in {repo_path}\n\n"
"CodeWiki supports: Python, Java, JavaScript, TypeScript, C, C++, C#, Kotlin, PHP, "
"Ruby, Scala, Rust, Dart, Go\n\n"
"Ruby, Scala, Rust, Dart, Go, Zig, Vue\n\n"
"Please navigate to a code repository or specify a custom directory:\n"
" cd /path/to/your/project\n"
" codewiki generate"
Expand Down
2 changes: 2 additions & 0 deletions codewiki/cli/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ def detect_supported_languages(directory: Path) -> list[tuple[str, int]]:
"Rust": [".rs"],
"Dart": [".dart"],
"Go": [".go"],
"Zig": [".zig"],
"Vue": [".vue"],
}

# Directories to exclude from counting
Expand Down
2 changes: 2 additions & 0 deletions codewiki/mcp/tools/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ def _detect_via_mtime(
".rs",
".dart",
".go",
".zig",
".vue",
}

changed: list[str] = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def _filter_supported_languages(self, code_files: list[dict]) -> list[dict]:
Filter code files to only include supported languages.

Supports Python, JavaScript, TypeScript, Java, C#, C, C++, PHP, Ruby, Kotlin,
Scala, Rust, Dart, and Go.
Scala, Rust, Dart, Go, Zig, and Vue single-file components.
"""
supported_languages = {
"python",
Expand All @@ -357,6 +357,8 @@ def _filter_supported_languages(self, code_files: list[dict]) -> list[dict]:
"kotlin",
"scala",
"dart",
"zig",
"vue",
}

return [
Expand All @@ -382,6 +384,8 @@ def _get_supported_languages(self) -> list[str]:
"rust",
"dart",
"go",
"zig",
"vue",
]

def _cleanup_repository(self, temp_dir: str):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ def _analyze_code_file(self, repo_dir: str, file_info: dict):
self._analyze_dart_file(file_path, content, repo_dir)
elif language == "go":
self._analyze_go_file(file_path, content, repo_dir)
elif language == "zig":
self._analyze_zig_file(file_path, content, repo_dir)
elif language == "vue":
self._analyze_vue_file(file_path, content, repo_dir)
# else:
# logger.warning(
# f"Unsupported language for call graph analysis: {language} for file {file_path}"
Expand Down Expand Up @@ -612,6 +616,54 @@ def _analyze_dart_file(self, file_path: str, content: str, repo_dir: str):
except Exception:
logger.exception(f"Failed to analyze Dart file {file_path}")

def _analyze_zig_file(self, file_path: str, content: str, repo_dir: str):
"""
Analyze Zig file using tree-sitter based analyzer.

Args:
file_path: Path to the Zig file
content: File content string
repo_dir: Repository base directory
"""
from codewiki.src.be.dependency_analyzer.analyzers.zig import analyze_zig_file

try:
functions, relationships = analyze_zig_file(str(file_path), content, repo_path=repo_dir)

for func in functions:
func_id = func.id if func.id else f"{file_path}:{func.name}"
self.functions[func_id] = func

self.call_relationships.extend(relationships)
except Exception:
logger.exception(f"Failed to analyze Zig file {file_path}")

def _analyze_vue_file(self, file_path: str, content: str, repo_dir: str):
"""
Analyze a Vue single-file component.

The <script> blocks go through the JavaScript/TypeScript analyzers; the
component itself, its options-API members, and its template usage are
added by the Vue analyzer.

Args:
file_path: Path to the .vue file
content: File content string
repo_dir: Repository base directory
"""
from codewiki.src.be.dependency_analyzer.analyzers.vue import analyze_vue_file

try:
functions, relationships = analyze_vue_file(str(file_path), content, repo_path=repo_dir)

for func in functions:
func_id = func.id if func.id else f"{file_path}:{func.name}"
self.functions[func_id] = func

self.call_relationships.extend(relationships)
except Exception:
logger.exception(f"Failed to analyze Vue file {file_path}")

def _analyze_go_file(self, file_path: str, content: str, repo_dir: str):
"""
Analyze Go file using tree-sitter based analyzer.
Expand Down Expand Up @@ -1094,6 +1146,10 @@ def _generate_visualization_data(self) -> dict:
node_classes.append("lang-dart")
elif file_ext == ".go":
node_classes.append("lang-go")
elif file_ext == ".zig":
node_classes.append("lang-zig")
elif file_ext == ".vue":
node_classes.append("lang-vue")

cytoscape_elements.append(
{
Expand Down
Loading
Loading