### Setup sem Source: https://github.com/ataraxy-labs/sem/blob/main/docs/index.html Commands to set up sem for the first time, including creating a wrapper script, setting git config, and installing a pre-commit hook. ```bash sem setup ✓ Created wrapper script ✓ Set git config --global diff.external = sem ✓ Pre-commit hook installed ``` -------------------------------- ### Installation Source: https://github.com/ataraxy-labs/sem/blob/main/docs/index.html Install sem using npm. ```bash npm install -g sem ``` -------------------------------- ### Command Examples Source: https://github.com/ataraxy-labs/sem/blob/main/docs/index.html Various command examples for sem, showcasing different functionalities. ```bash sem config set theme.dark sem config get theme sem --help sem --version ``` -------------------------------- ### sem context example Source: https://github.com/ataraxy-labs/sem/blob/main/docs/index.html Example output of the `sem context` command. ```text sem context Smart context for AI. Token-budgeted context window: the entity, its dependencies, and dependents. Fits in any LLM prompt. context for authenticateUser (budget: 8000) target: ~705 tokens dependencies: ~256 tokens dependents: ~812 tokens ``` -------------------------------- ### sem log example Source: https://github.com/ataraxy-labs/sem/blob/main/docs/index.html Example output of the `sem log` command. ```text sem log How did it evolve? Git history for a single entity. See every commit that touched a specific function. │ ae576ab Rohan 02-05 added │ a105183 Rohan 02-08 modified (logic) │ a1a6fbf Rohan 04-03 modified (logic) ``` -------------------------------- ### sem blame example Source: https://github.com/ataraxy-labs/sem/blob/main/docs/index.html Example output of the `sem blame` command. ```text sem blame │ ⊕ render_inline_diff a1a6fbf Rohan 04-03 │ ⊕ format_terminal a1a6fbf Rohan 04-03 ``` -------------------------------- ### sem entities example Source: https://github.com/ataraxy-labs/sem/blob/main/docs/index.html Example output of the `sem entities` command. ```text sem entities What's under a path? Lists every function, class, method, and type with line ranges. entities: src/auth/login.ts function validateToken (L12:24) function authenticateUser (L26:45) interface AuthConfig (L47:52) ``` -------------------------------- ### sem impact example Source: https://github.com/ataraxy-labs/sem/blob/main/docs/index.html Example output of the `sem impact` command. ```text sem impact What breaks? Cross-file dependency graph shows every entity that depends on a given function, plus affected tests. ⊕ function authenticateUser → depends on: db.findUser, rateLimiter ← used by: loginRoute, authMiddleware ! 42 entities transitively affected ``` -------------------------------- ### Install with Homebrew Source: https://github.com/ataraxy-labs/sem/blob/main/docs/llms.txt Installs the sem CLI using the Homebrew package manager. ```bash brew install sem-cli ``` -------------------------------- ### sem command example with flags Source: https://github.com/ataraxy-labs/sem/blob/main/docs/details.html Shows an example of using a specific sem command with its associated flags. ```bash sem build --target=release --jobs=4 ``` -------------------------------- ### Git Diff Example Source: https://github.com/ataraxy-labs/sem/blob/main/docs/index.html Demonstrates how sem can display git diffs with syntax highlighting. ```diff git diff --color=always | sem diff ``` -------------------------------- ### MCP server and sem setup Source: https://github.com/ataraxy-labs/sem/blob/main/docs/changelog.html Details about the new `sem-mcp` crate, MCP tools, and `sem setup` command. ```text New `sem-mcp` crate: an MCP server exposing 6 tools (`sem_entities`, `sem_diff`, `sem_blame`, `sem_impact`, `sem_log`, `sem_context`) for AI agent integration. New `sem setup` command replaces `git diff` globally and installs a pre-commit hook showing entity-level blast radius. `sem unsetup` to revert. ``` -------------------------------- ### Basic Usage Source: https://github.com/ataraxy-labs/sem/blob/main/docs/index.html Example of using sem to list files with colorized output. ```bash sem ls -l --color=auto ``` -------------------------------- ### Install MCP Binary Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Command to install the MCP binary from the local sem/crates directory. ```bash cd sem/crates cargo install --path sem-mcp ``` -------------------------------- ### Install sem-core and sem-cli Source: https://github.com/ataraxy-labs/sem/blob/main/docs/changelog.html Instructions for installing the sem-core and sem-cli packages via Cargo or Homebrew. ```bash brew install sem-cli # or ``` ```bash cargo install sem-cli ``` -------------------------------- ### Install sem using npm Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Installs the sem npm wrapper as a development dependency. ```bash npm install --save-dev @ataraxy-labs/sem ``` -------------------------------- ### Example Usage of sem command Source: https://github.com/ataraxy-labs/sem/blob/main/docs/details.html Demonstrates a typical command-line interaction with the 'sem' tool, showing its output and structure. ```bash sem --help sem --version sem --config path/to/config.yaml sem --output path/to/output.json sem --verbose sem --quiet sem --log path/to/log.txt sem --no-color sem --force sem --yes sem --no sem --dry-run sem --debug sem --trace sem --help sem --help ``` -------------------------------- ### JSON Output Example Source: https://github.com/ataraxy-labs/sem/blob/main/docs/llms.txt Example of the JSON output format when using the 'sem diff --format json' command. ```bash sem diff --format json ``` ```json { "summary": { "fileCount": 2, "added": 1, "modified": 1, "deleted": 1, "total": 3 }, "changes": [ { "entityId": "src/auth.ts::function::validateToken", "changeType": "added", "entityType": "function", "entityName": "validateToken", "filePath": "src/auth.ts" } ] } ``` -------------------------------- ### Install sem using Bun Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Adds the sem package using Bun and trusts it to allow the postinstall script to download the binary. ```bash bun add -d @ataraxy-labs/sem bun pm trust @ataraxy-labs/sem ``` -------------------------------- ### sem diff command syntax examples Source: https://github.com/ataraxy-labs/sem/blob/main/docs/changelog.html Examples demonstrating the full git diff syntax support in `sem diff`, including single ref, two-dot range, three-dot merge-base, pathspec filtering, and `--cached`. ```bash sem diff HEAD~3 sem diff main..feature sem diff main...feature sem diff -- src/ sem diff --cached ``` -------------------------------- ### sem diff markdown output example Source: https://github.com/ataraxy-labs/sem/blob/main/docs/changelog.html Example of using `sem diff --format markdown` to render entity changes as markdown tables. ```bash sem diff --format markdown ``` -------------------------------- ### sem log command example Source: https://github.com/ataraxy-labs/sem/blob/main/docs/changelog.html Example of using the `sem log` command to trace an entity through git history. Supports `--verbose` for diffs and `--json` for machine output. ```bash sem log ``` -------------------------------- ### sem command example with output redirection Source: https://github.com/ataraxy-labs/sem/blob/main/docs/details.html Demonstrates how to redirect the output of a sem command to a JSON file. ```bash sem build --output=build/output.json ``` -------------------------------- ### Custom extensions and extensionless files Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Example of custom extensions mapping in a .semrc file. ```bash .xyz = cpp .j = json .mypy = python ``` -------------------------------- ### sem diff verbose output example Source: https://github.com/ataraxy-labs/sem/blob/main/docs/changelog.html Example of using `sem diff -v` to show inline before/after content for modified entities. ```bash sem diff -v ``` -------------------------------- ### Build sem from source Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Builds and installs the sem CLI from its source code repository, requiring Rust. ```bash cargo install --git https://github.com/Ataraxy-Labs/sem sem-cli ``` -------------------------------- ### Register file extensions for the new language Source: https://github.com/ataraxy-labs/sem/blob/main/CONTRIBUTING.md Example of how to add the file extensions for the new language to the EXTENSIONS array in Rust. ```rust static EXTENSIONS: &[&str] = &[ // ... existing extensions ... ".scala", ".sc", ]; ``` -------------------------------- ### Register the new LanguageConfig in ALL_CONFIGS Source: https://github.com/ataraxy-labs/sem/blob/main/CONTRIBUTING.md Example of how to add the new language configuration to the static ALL_CONFIGS array in Rust. ```rust static ALL_CONFIGS: &[&LanguageConfig] = &[ // ... existing configs ... &SCALA_CONFIG, ]; ``` -------------------------------- ### JSON Diff Output Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Example JSON output for the 'sem diff' command. ```json { "summary": { "fileCount": 2, "added": 1, "modified": 1, "deleted": 1, "total": 3 }, "changes": [ { "entityId": "src/auth.ts::function::validateToken", "changeType": "added", "entityType": "function", "entityName": "validateToken", "filePath": "src/auth.ts" } ] } ``` -------------------------------- ### sem diff command Source: https://github.com/ataraxy-labs/sem/blob/main/docs/details.html Example of using the sem diff command with JSON output. ```bash sem diff --format json | jq ``` -------------------------------- ### Add tree-sitter dependency to Cargo.toml Source: https://github.com/ataraxy-labs/sem/blob/main/CONTRIBUTING.md Example of how to add a tree-sitter grammar dependency to the project's Cargo.toml file. ```toml [dependencies] tree-sitter-scala = "0.23" ``` -------------------------------- ### Elixir example for call_entity_identifiers Source: https://github.com/ataraxy-labs/sem/blob/main/CONTRIBUTING.md Illustrates how Elixir uses function calls for entity definitions, requiring `call_entity_identifiers`. ```elixir defmodule MyApp do # "defmodule" is a call, not a keyword def greet(name) do # "def" is a call "Hello #{name}" end end ``` -------------------------------- ### Node.js vs Rust Performance Breakdown Source: https://github.com/ataraxy-labs/sem/blob/main/docs/changelog.html A comparison of the time taken for initial setup and execution between Node.js and Rust for a specific task, highlighting the performance advantages of Rust. ```text Node.js breakdown: ~120ms V8 startup, ~80ms module resolution, ~50ms WASM grammar load, ~40ms git subprocess spawn. Rust breakdown: ~3ms binary load, ~5ms git2 repo open, ~17ms parse + match. ``` -------------------------------- ### sem diff commands Source: https://github.com/ataraxy-labs/sem/blob/main/docs/llms.txt Examples of using the 'sem diff' command for various use cases, including comparing working changes, staged changes, specific commits, commit ranges, individual files, and different output formats. ```bash sem diff # working changes sem diff --staged # staged only sem diff --commit abc1234 # specific commit sem diff --from HEAD~5 --to HEAD # commit range sem diff file1.ts file2.ts # compare two files (no git needed) sem diff --format json # JSON output for agents/CI sem diff --format plain # git-status style sem diff --format markdown # markdown tables sem diff --stdin --format json # read file changes from stdin sem diff --file-exts .py .rs # filter by extension sem diff -v # verbose inline content diffs ``` -------------------------------- ### sem blame Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Get blame information for a file, outputting in JSON format. ```bash sem blame src/auth.ts --json ``` -------------------------------- ### sem graph commands Source: https://github.com/ataraxy-labs/sem/blob/main/docs/llms.txt Examples of using the 'sem graph' command to generate a cross-file entity dependency graph, with options to filter by entity, file extensions, and output format. ```bash sem graph sem graph --entity validateToken sem graph --file-exts .py sem graph --format json ``` -------------------------------- ### Add a getter function for tree-sitter Language Source: https://github.com/ataraxy-labs/sem/blob/main/CONTRIBUTING.md Example Rust function to return the tree-sitter Language for a specific grammar, demonstrating common patterns. ```rust fn get_scala() -> Option { Some(tree_sitter_scala::LANGUAGE.into()) } ``` -------------------------------- ### sem blame commands Source: https://github.com/ataraxy-labs/sem/blob/main/docs/llms.txt Examples of using the 'sem blame' command to show entity-level blame information for a given file, with an option for JSON output. ```bash sem blame src/auth.ts sem blame src/auth.ts --json ``` -------------------------------- ### Filter analysis by file extensions Source: https://github.com/ataraxy-labs/sem/blob/main/docs/changelog.html Example of using the --file-exts flag to scope analysis to specific file types, such as Python files. ```bash sem diff --file-exts .py ``` -------------------------------- ### sem impact commands Source: https://github.com/ataraxy-labs/sem/blob/main/docs/llms.txt Examples of using the 'sem impact' command for transitive impact analysis, showing what else is affected if a specific entity changes, with options for JSON output and filtering by file extensions. ```bash sem impact validateToken sem impact validateToken --json sem impact validateToken --file-exts .py ``` -------------------------------- ### Full impact analysis with sem impact Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Performs a full impact analysis starting from a given entity. ```bash sem impact authenticateUser ``` -------------------------------- ### Word-level inline diffs Source: https://github.com/ataraxy-labs/sem/blob/main/docs/changelog.html Example of using `sem diff --verbose` to highlight word-level changes within lines. ```bash sem diff --verbose ``` -------------------------------- ### Define the LanguageConfig for a new language Source: https://github.com/ataraxy-labs/sem/blob/main/CONTRIBUTING.md Example static LanguageConfig struct definition in Rust for Scala, specifying entity types, extensions, and the getter function. ```rust static SCALA_CONFIG: LanguageConfig = LanguageConfig { id: "scala", extensions: &[".scala", ".sc"], entity_node_types: &[ "function_definition", "class_definition", "object_definition", "trait_definition", "val_definition", "var_definition", "type_definition", ], container_node_types: &["template_body", "block"], call_entity_identifiers: &[], suppressed_nested_entities: &[], get_language: get_scala, }; ``` -------------------------------- ### Add a test for entity extraction of the new language Source: https://github.com/ataraxy-labs/sem/blob/main/CONTRIBUTING.md Example Rust test case to verify entity extraction for Scala code, including assertions on extracted entity names. ```rust #[test] fn test_scala_entity_extraction() { let code = r#"# class UserService { def getUsers(): List[User] = { db.findAll() } } object AppConfig { val version = "1.0" } trait Repository[T] { def findById(id: String): Option[T] } "#; let plugin = CodeParserPlugin; let entities = plugin.extract_entities(code, "UserService.scala"); let names: Vec<&str> = entities.iter().map(|e| e.name.as_str()).collect(); eprintln!("Scala entities: {:?}", entities.iter().map(|e| (&e.name, &e.entity_type)).collect::>()); assert!(names.contains(&"UserService"), "got: {:?}", names); assert!(names.contains(&"AppConfig"), "got: {:?}", names); assert!(names.contains(&"Repository"), "got: {:?}", names); } ``` -------------------------------- ### Use as default Git diff Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Replace `git diff` output with entity-level diffs. Agents and humans get sem output automatically without changing any commands. ```bash sem setup ``` -------------------------------- ### suppressed_nested_entities Example Source: https://github.com/ataraxy-labs/sem/blob/main/CONTRIBUTING.md Example of how to configure suppressed_nested_entities to prevent double-extraction of child entities within parent entities. ```rust suppressed_nested_entities: &[SuppressedNestedEntity { parent_entity_node_type: "block", child_entity_node_type: "attribute", }], ``` -------------------------------- ### Build Source: https://github.com/ataraxy-labs/sem/blob/main/crates/README.md Instructions to build the project in release mode. ```bash cargo build --release # Binary at target/release/sem ``` -------------------------------- ### Build and Test Source: https://github.com/ataraxy-labs/sem/blob/main/SKILL.md Commands to build the CLI binary and run tests for the sem project. ```bash cargo build --release -p sem-cli # binary at target/release/sem cargo test --workspace # 134 tests ``` -------------------------------- ### Build from source Source: https://github.com/ataraxy-labs/sem/blob/main/docs/llms.txt Clones the sem repository and builds the CLI from source using Cargo. ```bash git clone https://github.com/Ataraxy-Labs/sem cd sem/crates && cargo install --path sem-cli ``` -------------------------------- ### sem command structure Source: https://github.com/ataraxy-labs/sem/blob/main/docs/details.html Illustrates the general structure of a sem command, including global flags and command-specific arguments. ```bash sem [global flags] [command flags] ``` -------------------------------- ### Run sem using Docker Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Builds a Docker image for sem and runs a container to perform a diff operation within a mounted repository. ```bash docker build -t sem . docker run --rm -it -u "$(id -u):$(id -g)" -v "$(pwd):/repo" sem diff ``` -------------------------------- ### Tests Source: https://github.com/ataraxy-labs/sem/blob/main/crates/README.md Command to run tests and the number of tests. ```bash cargo test # 134 tests ``` -------------------------------- ### Consolidated Commands and MCP Tools Source: https://github.com/ataraxy-labs/sem/blob/main/docs/changelog.html Explanation of command consolidation and MCP tool reduction. ```text Removed redundant CLI commands (`status`, `watch`, `review`, `comment`, `label`, `history`). Final 6: `diff`, `impact`, `blame`, `log`, `entities`, `context`. MCP server trimmed from 9 to 6 tools: one tool per CLI command. Do fewer things, do them well. ``` -------------------------------- ### sem entities Source: https://github.com/ataraxy-labs/sem/blob/main/README.md List all entities under a file or directory path. ```bash sem entities ``` ```bash sem entities . ``` ```bash sem entities src/auth.ts ``` ```bash # JSON output sem entities --json ``` ```bash sem entities src/auth.ts --json ``` -------------------------------- ### MCP Server Configuration Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Configuration for the MCP server, specifying the command to run. ```json { "mcpServers": { "sem": { "command": "sem-mcp" } } } ``` -------------------------------- ### Run tests command Source: https://github.com/ataraxy-labs/sem/blob/main/CONTRIBUTING.md Command to navigate to the crates directory and run all tests. ```bash cd crates && cargo test ``` -------------------------------- ### Commands Source: https://github.com/ataraxy-labs/sem/blob/main/crates/README.md Common commands for the sem CLI, including entity-level diff, blame, graph, and impact analysis, with options for filtering by file extensions. ```bash # Entity-level diff sem diff # Entity-level blame (who last touched each function/class) sem blame src/auth.ts # Cross-file dependency graph sem graph # Impact analysis (if this entity changes, what else is affected?) sem impact validateToken # Filter to specific languages in a multi-language repo sem graph --file-exts .py sem diff --file-exts .py .rs sem impact validateToken --file-exts .py ``` -------------------------------- ### sem log Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Track how a single entity evolved through git history. ```bash sem log authenticateUser ``` ```bash # Verbose mode (show content diff between versions) sem log authenticateUser -v ``` ```bash # Limit commits scanned sem log authenticateUser --limit 20 ``` ```bash # JSON output sem log authenticateUser --json ``` -------------------------------- ### Graph Caching Performance Source: https://github.com/ataraxy-labs/sem/blob/main/docs/benchmarks.html Compares the time taken for 5 graph calls with and without caching. ```text 5 graph calls no caching (separate processes) 5 graph calls in one session (memory cache) ``` -------------------------------- ### Plain text output for semantic diff Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Formats the semantic diff output in a plain text style, similar to `git status`. ```bash sem diff --format plain ``` -------------------------------- ### Architecture Source: https://github.com/ataraxy-labs/sem/blob/main/crates/README.md The project is structured as a Cargo workspace with two main crates: sem-core (library) and sem-cli (binary). ```text sem-core/ # Library: entity extraction, structural hashing, semantic diff, # dependency graph, impact analysis, git bridge sem-cli/ # Binary: diff, blame, graph, impact commands ``` -------------------------------- ### Rust Library Dependency Source: https://github.com/ataraxy-labs/sem/blob/main/docs/llms.txt How to include 'sem-core' as a Rust library dependency in your project. ```toml [dependencies] sem-core = { git = "https://github.com/Ataraxy-Labs/sem", version = "0.3" } ``` -------------------------------- ### sem context Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Token-budgeted context for LLMs: the entity, its dependencies, and its dependents, fitted to a token budget. ```bash sem context authenticateUser ``` ```bash # Custom token budget sem context authenticateUser --budget 4000 ``` ```bash # JSON output sem context authenticateUser --json ``` -------------------------------- ### Git diff vs Sem diff Source: https://github.com/ataraxy-labs/sem/blob/main/docs/index.html Compares the output of git diff with sem diff for a specific file. ```diff git diff diff --git a/src/auth/login.ts b/src/auth/login.ts index 4a2b1c0..8f3d2e1 100644 --- a/src/auth/login.ts +++ b/src/auth/login.ts @@ -12,6 +12,18 @@ +export function validateToken(token: string) { + const decoded = jwt.verify(token, SECRET); + if (!decoded.exp || decoded.exp < Date.now()) { + throw new TokenExpiredError(); + } + return decoded; +} + @@ -24,8 +36,10 @@ export async function authenticateUser( - const user = await db.findUser(email); - if (!user) return null; + const user = await db.findUser(email); + if (!user) throw new UserNotFoundError(); + await rateLimiter.check(email); @@ -45,12 +59,0 @@ -export function legacyAuth(user, pass) { - return db.query('SELECT * FROM users - WHERE email = ? AND password = ?', - [user, pass]); -} sem diff ┌─ src/auth/login.ts ──────────────── │ │ ⊕ function validateToken [added] │ ∆ function authenticateUser [modified] │ ⊖ function legacyAuth [deleted] │ └──────────────────────────────────── 3 entities changed across 1 file ``` -------------------------------- ### Rust Library Dependency Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Adding sem-core as a Rust library dependency in Cargo.toml. ```toml [dependencies] sem-core = { git = "https://github.com/Ataraxy-Labs/sem", version = "0.5" } ``` -------------------------------- ### Quick fix for GNU Parallel name conflict (Homebrew PATH) Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Ensures the Homebrew bin directory is prioritized in the PATH to resolve potential name conflicts with GNU Parallel. ```bash # Option 3: if installed via Homebrew export PATH="$(brew --prefix)/bin:$PATH" ``` -------------------------------- ### JSON output for semantic diff Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Formats the semantic diff output as JSON, suitable for programmatic use by AI agents or CI pipelines. ```bash sem diff --format json ``` -------------------------------- ### Direct dependencies analysis with sem impact Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Shows only the direct dependencies of a given entity using `sem impact`. ```bash sem impact authenticateUser --deps ``` -------------------------------- ### Impact Analysis Comparison Source: https://github.com/ataraxy-labs/sem/blob/main/docs/benchmarks.html Compares the number of entities found by `grep` versus `sem_impact` for transitive dependencies. ```bash grep EntityGraph string matches (imports, comments, type annotations) sem_impact entities in the transitive dependency chain ``` -------------------------------- ### Compare any two files with sem diff Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Compares two arbitrary files using semantic diff, even outside of a Git repository. ```bash sem diff file1.ts file2.ts ``` -------------------------------- ### Quick fix for GNU Parallel name conflict (alias) Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Sets up a shell alias to ensure the correct sem binary is used when there's a name conflict with GNU Parallel. ```bash # Option 1: alias in your shell profile (~/.bashrc, ~/.zshrc) alias sem="$HOME/.cargo/bin/sem" ``` -------------------------------- ### tree-sitter parse command Source: https://github.com/ataraxy-labs/sem/blob/main/CONTRIBUTING.md Command to parse a file using tree-sitter and print the full AST with node types. ```bash tree-sitter parse sample.scala ``` -------------------------------- ### Test Targeting Comparison Source: https://github.com/ataraxy-labs/sem/blob/main/docs/benchmarks.html Compares the number of tests to run with `cargo test` versus `sem_impact(mode="tests")`. ```bash cargo test run everything sem_impact(mode="tests") tests that actually depend on EntityGraph ``` -------------------------------- ### Hero Terminal Animation - sem diff Source: https://github.com/ataraxy-labs/sem/blob/main/docs/index.html Simulates the output of the 'sem diff' command in a terminal, showing changes in files. ```javascript function copyCmd(el) { navigator.clipboard.writeText('brew install sem-cli'); let copied = el.querySelector('.copied'); if (copied) { copied.classList.add('show'); setTimeout(() => copied.classList.remove('show'), 1500); } } // Hero terminal typing animation (function() { const el = document.getElementById('hero-terminal'); if (!el) return; const lines = [ // --- sem diff --- { text: '$ sem diff', cls: 'cmd', pause: 500, typing: true }, { text: '', pause: 300 }, { text: '┌─ src/auth/login.ts ──────────────────────────────────', cls: 'd', pause: 50 }, { text: '│', cls: 'd', pause: 30 }, { parts: [ { text: '│ ', cls: 'd' }, { text: '⊕', cls: 'g' }, { text: ' function ', cls: 'd' }, { text: 'validateToken', cls: 'w' }, { text: ' ', cls: '' }, { text: ' [added]', cls: 'g' }, ], pause: 80 }, { parts: [ { text: '│ ', cls: 'd' }, { text: '∆', cls: 'y' }, { text: ' function ', cls: 'd' }, { text: 'authenticateUser', cls: 'w' }, { text: ' ', cls: '' }, { text: ' [modified]', cls: 'y' }, ], pause: 80 }, { parts: [ { text: '│ ', cls: 'd' }, { text: '⊖', cls: 'r' }, { text: ' function ', cls: 'd' }, { text: 'legacyAuth', cls: 'w' }, { text: ' ', cls: '' }, { text: ' [deleted]', cls: 'r' }, ], pause: 80 }, { text: '│', cls: 'd', pause: 20 }, { text: '└──────────────────────────────────────────────────────', cls: 'd', pause: 150 }, { text: '', pause: 600 }, // --- sem impact --- { text: '$ sem impact authenticateUser', cls: 'cmd', pause: 500, typing: true }, { text: '', pause: 300 }, { parts: [ { text: '⊕ function ', cls: 'd' }, { text: 'authenticateUser', cls: 'w' }, { text: ' (src/auth/login.ts:26)', cls: 'd' }, ], pause: 80 }, { text: '', pause: 40 }, { parts: [ { text: ' → depends on: ', cls: 'd' }, { text: 'db.findUser', cls: 'b' }, { text: ', ', cls: 'd' }, { text: 'rateLimiter.check', cls: 'b' }, ], pause: 80 }, { parts: [ { text: ' ← used by: ', cls: 'd' }, { text: 'loginRoute', cls: 'b' }, { text: ', ', cls: 'd' }, { text: 'authMiddleware', cls: 'b' }, ], pause: 80 }, { parts: [ { text: ' ', cls: '' }, { text: '! 42 entities transitively affected', cls: 'r' }, ], pause: 80 }, { parts: [ { text: ' ', cls: '' }, { text: '⚡ 7 tests affected', cls: 'y' }, ], pause: 150 }, { text: '', pause: 600 }, // --- sem blame --- { text: '$ sem blame src/auth/login.ts', cls: 'cmd', pause: 500, typing: true }, { text: '', pause: 300 }, { text: '┌─ src/auth/login.ts', cls: 'd', pause: 50 }, { text: '│', cls: 'd', pause: 20 }, { parts: [ { text: '│ ', cls: 'd' }, { text: '⊕', cls: 'g' }, { text: ' ', cls: '' }, { text: 'validateToken', cls: 'w' }, { text: ' ', cls: '' }, { text: 'a3f91bc', cls: 'b' }, { text: ' Alice 03-28', cls: 'd' }, ], pause: 80 }, { parts: [ { text: '│ ', cls: 'd' }, { text: '⊕', cls: 'g' }, { text: ' ', cls: '' }, { text: 'authenticateUser', cls: 'w' }, { text: ' ', cls: '' }, { text: 'f7d42e0', cls: 'b' }, { text: ' Bob 02-14', cls: 'd' }, ], pause: 80 }, { parts: [ { text: '│ ', cls: 'd' }, { text: '⊕', cls: 'g' }, { text: ' ', cls: '' }, { text: 'AuthConfig', cls: 'w' }, { text: ' ', cls: '' }, { text: 'e1a08f3', cls: 'b' }, { text: ' Alice 01-09', cls: 'd' }, ], pause: 80 }, { text: '│', cls: 'd', pause: 20 }, { text: '└──────────────────────────────────────────────────────', cls: 'd', pause: 0 }, ]; function makeSpan(text, cls) { if (!cls) return document.createTextNode(text); const s = document.createElement('span'); s.className = cls; s.textContent = text; return s; } function sleep(ms) { return new Promise(r => setTimeout(r, ms)); } async function typeText(parent, text, cls) { const node = cls ? document.createElement('span') : null; if (node) { node.className = cls; parent.appendChild(node); } const target = node || parent; for (let i = 0; i < text.length; i++) { target.textContent += text[i]; await sleep(30 + Math.random() * 30); } } async function run() { for (const line of lines) { if (line.typing) { await typeText(el, line.text, line.cls); el.appendChild(document.createTextNode('\n')); } else if (line.parts) { for (const part of line.parts) { el.appendChild(makeSpan(part.text, part.cls)); } el.appendChild(document.createTextNode('\n')); } else { el.appendChild(makeSpan(line.text, line.cls)); el.appendChild(document.createTextNode('\n')); } if (line.pause) await sleep(line.pause); } const cursor = document.createElement('span'); cursor.textContent = '█'; cursor.style.animation = 'blink 1s step-end infinite'; el.appendChild(document.createTextNode('$ ')); el.appendChild(cursor); } const observer = new IntersectionObserver((entries) => { if (entries[0].isIntersecting) { observer.disconnect(); run(); } }); observer.observe(el); })(); // Scroll-triggered fade-in (function() { const els = docume ``` -------------------------------- ### Filter semantic diff by file extensions Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Performs a semantic diff, but only considers files with the specified extensions. ```bash sem diff --file-exts .py .rs ``` -------------------------------- ### JSON output for sem impact Source: https://github.com/ataraxy-labs/sem/blob/main/README.md Outputs the results of the `sem impact` command in JSON format. ```bash sem impact authenticateUser --json ``` -------------------------------- ### Agent Accuracy Comparison Source: https://github.com/ataraxy-labs/sem/blob/main/docs/benchmarks.html Compares the accuracy of an agent using `sem diff` JSON versus raw `git diff` for various code change analysis questions. ```text sem diff git diff Q1: List added functions (F1) 93% vs 75% Q2: Files with modified entities (F1) 100% vs 55% Q3: Entity type counts (accuracy) 91% vs 13% Q4: Added/modified/deleted counts (exact) 100% vs 22% Overall average 96% vs 41% ```