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
80 changes: 80 additions & 0 deletions org-profile-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<div align="center">

# Arhitekton

**Building open-source tools for developers**

[![GitHub Org](https://img.shields.io/badge/GitHub-Arhitekton-181717?style=flat&logo=github)](https://github.com/Arhitekton)

</div>

---

## About

Arhitekton is an open-source organization focused on building tools that make developers' lives easier. We work across three areas:

- **Open-source tooling** — developer utilities, CLI tools, and libraries you can use and contribute to
- **Web applications** — full-stack web projects built with modern technologies
- **Mobile applications** — cross-platform mobile experiences

We believe good tooling should be free, accessible, and community-driven.

---

## Projects

| Project | Description | Status |
|---|---|---|
| [Code Visualizer](https://github.com/Arhitekton/GitCodeVisualizer) | Analyze source code and generate interactive dependency graphs | 🚧 Active |

> More projects coming soon.

---

## Contributors

<table>
<tr>
<td align="center">
<a href="https://github.com/millareskenneth">
<img src="https://github.com/millareskenneth.png" width="80" alt="millareskenneth" style="border-radius:50%"/><br/>
<sub><b>millareskenneth</b></sub>
</a><br/>
<sub>Fullstack Developer</sub>
</td>
<td align="center">
<a href="https://github.com/kimalfredmolina">
<img src="https://github.com/kimalfredmolina.png" width="80" alt="kimalfredmolina" style="border-radius:50%"/><br/>
<sub><b>kimalfredmolina</b></sub>
</a><br/>
<sub>Fullstack Developer</sub>
</td>
</tr>
</table>

---

## Contributing

We welcome contributions of all kinds — bug fixes, features, documentation, or ideas.

1. Browse open issues across our repositories
2. Fork the repo and create a branch (`feat/your-feature`)
3. Open a pull request with a clear description

Please follow the contribution guidelines in each project's `CONTRIBUTING.md`.

---

## License

All projects under Arhitekton are open-source and released under the [MIT License](https://opensource.org/licenses/MIT) unless stated otherwise.

---

<div align="center">

*Built with care by the Arhitekton team*

</div>
134 changes: 134 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"packageManager": "npm@10.9.2",
"dependencies": {
"commander": "13.1.0",
"open": "^10.1.0",
"typescript": "5.8.3"
},
"devDependencies": {
Expand Down
18 changes: 13 additions & 5 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Command } from 'commander'
import { VERSION } from './index.js'
import { analyze } from './analyze.js'
import { renderToTerminal } from './renderer.js'
import { serveGraph } from './serve.js'
import { generateHtmlReport } from './html-report.js'

const program = new Command()
Expand All @@ -12,25 +13,32 @@ program
.description('Analyze source code and generate interactive dependency graphs')
.version(VERSION)
.argument('[directory]', 'source directory to analyze', '.')
.option('--html', 'generate an interactive HTML report in the report/ directory')
.option('--out-dir <dir>', 'output directory for the HTML report', 'report')
.option('--html', 'open an interactive graph in the browser (live server, no files written)')
.option('--save', 'write the HTML report to disk instead of serving it')
.option('--out-dir <dir>', 'output directory when using --save', 'report')
.option('--port <number>', 'port for the live server (default: 4242)', '4242')
.option('--show-external', 'include external npm packages in the output')
.option('--ignore <dirs>', 'comma-separated list of directory names to ignore', '')
.action(async (
directory: string,
options: { html?: boolean; outDir?: string; showExternal?: boolean; ignore?: string },
options: { html?: boolean; save?: boolean; outDir?: string; port?: string; showExternal?: boolean; ignore?: string },
) => {
const ignore = options.ignore ? options.ignore.split(',').map((d) => d.trim()).filter(Boolean) : []

try {
const graph = await analyze(directory, { ignore })

if (options.html) {
if (options.save) {
const { htmlFile, jsonFile } = await generateHtmlReport(graph, { outDir: options.outDir })
console.log(`\n HTML report generated:`)
console.log(`\n HTML report saved:`)
console.log(` ${htmlFile}`)
console.log(` ${jsonFile}`)
console.log(`\n Open in browser: file://${htmlFile}\n`)
} else if (options.html) {
const port = parseInt(options.port ?? '4242', 10)
const url = await serveGraph(graph, { port })
console.log(`\n Serving graph at ${url}`)
console.log(` Press Ctrl+C to stop.\n`)
} else {
renderToTerminal(graph, { showExternal: options.showExternal })
}
Expand Down
6 changes: 3 additions & 3 deletions src/html-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ interface SerializedGraph {
cycles: string[][]
}

function serialize(graph: DependencyGraph): SerializedGraph {
export function serializeGraph(graph: DependencyGraph): SerializedGraph {
return {
nodes: [...graph.nodes.values()].map((n) => ({
id: n.id,
Expand All @@ -58,7 +58,7 @@ function serialize(graph: DependencyGraph): SerializedGraph {
// HTML template
// ---------------------------------------------------------------------------

function buildHtml(title: string, graphJson: string): string {
export function buildHtml(title: string, graphJson: string): string {
return /* html */ `<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -603,7 +603,7 @@ export async function generateHtmlReport(

await mkdir(outDir, { recursive: true })

const serialized = serialize(graph)
const serialized = serializeGraph(graph)
const graphJson = JSON.stringify(serialized, null, 2)

const jsonFile = join(outDir, 'graph.json')
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export { extractDependencies } from './extractor.js'
export { buildGraph } from './graph.js'
export { renderToTerminal } from './renderer.js'
export { generateHtmlReport } from './html-report.js'
export { serveGraph } from './serve.js'

export type { AnalyzeOptions } from './analyze.js'
export type { ScanOptions } from './scanner.js'
Expand All @@ -15,3 +16,4 @@ export type { Dependency } from './extractor.js'
export type { DependencyGraph, GraphNode, GraphEdge } from './graph.js'
export type { RenderOptions } from './renderer.js'
export type { HtmlReportOptions, HtmlReportResult } from './html-report.js'
export type { ServeOptions } from './serve.js'
Loading
Loading