feat(orient): 10-second codebase orientation brief (closes #160)#165
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
8 tasks
4221b53 to
8398537
Compare
Wolfvin
added a commit
that referenced
this pull request
Jul 3, 2026
) Issue #172 requested verification that sync_command_count.py was run on PR #162 (deps-audit), not manual count bump. What was done: - Rebased feat/issue-158-deps-audit-osv on latest main (39 commits behind) - Resolved conflicts in 6 doc files (all were command-count numbers): * README.md, SKILL.md, SKILL-QUICK.md, pyproject.toml, skill.json, scripts/graph_model.py * Took main's version for count numbers, then re-applied my changes (graph_model NODE_TYPE_DEPENDENCY_VULN/EDGE_TYPE_HAS_VULN constants, README deps-audit row, SKILL-QUICK deps-audit entry) - Ran `python3 scripts/sync_command_count.py --apply`: * Command count: 76 (was 71 in original PR — main has moved +5 commands from other merged PRs: orient #165, large-file-threshold #163, etc.) * MCP tools: 74 (56 static + 18 dynamic) - Verified `sync_command_count.py --check` reports 'All documentation files are in sync with COMMAND_REGISTRY' - Re-ran deps_audit tests: 47 passed, 0 failed Definition of Done (issue #172): - [x] PR #162 rebased on latest main - [x] sync_command_count.py --apply run — output counts match docs files - [x] Counts corrected: 71 → 76 commands, MCP tools updated accordingly - [x] PR #162 is mergeable (no conflicts, tests pass) Note: sync_command_count.py works fine when invoked directly (it imports COMMAND_REGISTRY without going through codelens.py main). However, `codelens.py --command-count` currently crashes with an argparse 'conflicting option string: -f' error — this is a pre-existing bug in main unrelated to this PR (the `affected` command defines `-f --filter` which conflicts with the global `--format -f` alias). Flagged in PR description for BOS awareness but NOT fixed here (out of scope for #172).
4 tasks
8398537 to
a7b7359
Compare
3 tasks
Add `codelens orient` command that produces a structured repo orientation brief answering the first 4 questions a developer asks when entering an unfamiliar repo: 1. What framework/stack is this? (framework_db.detect_frameworks_brief) 2. How do I run, build, and test it? (manifest_parser.extract_commands) 3. Where do I start reading? (file_ranker.rank_start_here_files) 4. What CI/Docker infrastructure exists? (inline detection) Pure-filesystem: no subprocess, no network, no LSP. Reads manifest files, walks the source tree once, emits a structured brief. Architecture (per issue #160 spec, with one deviation — see below): - scripts/commands/orient.py — command module + entry point/CI detection - scripts/orient_lib/ — analyzer sub-package - framework_db.py — data-driven framework lookup table (5 ecosystems, 60+ frameworks) - manifest_parser.py — run/build/test command extraction - file_ranker.py — Start Here scoring logic Deviation from issue spec: package named `orient_lib` not `orient` to avoid a Python import collision — `commands/orient.py` and a top-level `orient/` package both claim the `orient` module name, triggering a circular import. Documented in PR description. Output formats: - --format json (default): structured JSON matching issue #160 schema - --format compact: single-line brief for LLM context (<=300 tokens) - --format text: human-readable multi-line brief Framework detection covers (DoD minimum): Next.js, React, Express, FastAPI, Django, Flask, Gin, Axum, Spring Boot — plus 50+ more across Node.js, Python, Go, Rust, Java. sync_command_count.py --apply run: command count 70 -> 71 across README, SKILL.md, SKILL-QUICK.md, pyproject.toml, skill.json, graph_model.py. Tests: 31 new tests in tests/test_orient.py covering all 5 sub-features + output schema + compact rendering. All pass. Test suite: 1405 passed, 76 skipped, 1 failed (pre-existing test_codelensignore failure, fails identically on main, unrelated).
|
Wolfvin
added a commit
that referenced
this pull request
Jul 3, 2026
) Issue #172 requested verification that sync_command_count.py was run on PR #162 (deps-audit), not manual count bump. What was done: - Rebased feat/issue-158-deps-audit-osv on latest main (39 commits behind) - Resolved conflicts in 6 doc files (all were command-count numbers): * README.md, SKILL.md, SKILL-QUICK.md, pyproject.toml, skill.json, scripts/graph_model.py * Took main's version for count numbers, then re-applied my changes (graph_model NODE_TYPE_DEPENDENCY_VULN/EDGE_TYPE_HAS_VULN constants, README deps-audit row, SKILL-QUICK deps-audit entry) - Ran `python3 scripts/sync_command_count.py --apply`: * Command count: 76 (was 71 in original PR — main has moved +5 commands from other merged PRs: orient #165, large-file-threshold #163, etc.) * MCP tools: 74 (56 static + 18 dynamic) - Verified `sync_command_count.py --check` reports 'All documentation files are in sync with COMMAND_REGISTRY' - Re-ran deps_audit tests: 47 passed, 0 failed Definition of Done (issue #172): - [x] PR #162 rebased on latest main - [x] sync_command_count.py --apply run — output counts match docs files - [x] Counts corrected: 71 → 76 commands, MCP tools updated accordingly - [x] PR #162 is mergeable (no conflicts, tests pass) Note: sync_command_count.py works fine when invoked directly (it imports COMMAND_REGISTRY without going through codelens.py main). However, `codelens.py --command-count` currently crashes with an argparse 'conflicting option string: -f' error — this is a pre-existing bug in main unrelated to this PR (the `affected` command defines `-f --filter` which conflicts with the global `--format -f` alias). Flagged in PR description for BOS awareness but NOT fixed here (out of scope for #172).
Wolfvin
added a commit
that referenced
this pull request
Jul 3, 2026
Issue #173: PR #166 was written when main had 70 commands. After rebasing on latest main (which merged orient #165, affected #142, and others), the runtime COMMAND_REGISTRY now reports 77 commands. Ran sync_command_count.py --apply to regenerate all count references: - README.md: 5 substitutions - SKILL-QUICK.md: 5 substitutions - SKILL.md: 2 substitutions - pyproject.toml: 1 substitution - scripts/graph_model.py: 1 substitution - skill.json: 1 substitution Also resolved rebase conflicts in: - scripts/mcp_server.py: merged Phase 1 (staleness) + Phase 4 (worktree) banner methods — both coexist on the MCP server - scripts/sync/__init__.py: merged worktree (Phase 4) + pending (Phase 1) exports into unified __all__ Pre-existing finding (NOT caused by this PR): the 'affected' command (PR #142, already on main) uses -f for --filter, which conflicts with the global --format/-f flag added by codelens.py. This breaks ALL CLI invocations that trigger argparse registration (e.g. 'codelens affected --help'). Flagged for BOS — separate issue needed.
5 tasks
Wolfvin
added a commit
that referenced
this pull request
Jul 3, 2026
) Issue #172 requested verification that sync_command_count.py was run on PR #162 (deps-audit), not manual count bump. What was done: - Rebased feat/issue-158-deps-audit-osv on latest main (39 commits behind) - Resolved conflicts in 6 doc files (all were command-count numbers): * README.md, SKILL.md, SKILL-QUICK.md, pyproject.toml, skill.json, scripts/graph_model.py * Took main's version for count numbers, then re-applied my changes (graph_model NODE_TYPE_DEPENDENCY_VULN/EDGE_TYPE_HAS_VULN constants, README deps-audit row, SKILL-QUICK deps-audit entry) - Ran `python3 scripts/sync_command_count.py --apply`: * Command count: 76 (was 71 in original PR — main has moved +5 commands from other merged PRs: orient #165, large-file-threshold #163, etc.) * MCP tools: 74 (56 static + 18 dynamic) - Verified `sync_command_count.py --check` reports 'All documentation files are in sync with COMMAND_REGISTRY' - Re-ran deps_audit tests: 47 passed, 0 failed Definition of Done (issue #172): - [x] PR #162 rebased on latest main - [x] sync_command_count.py --apply run — output counts match docs files - [x] Counts corrected: 71 → 76 commands, MCP tools updated accordingly - [x] PR #162 is mergeable (no conflicts, tests pass) Note: sync_command_count.py works fine when invoked directly (it imports COMMAND_REGISTRY without going through codelens.py main). However, `codelens.py --command-count` currently crashes with an argparse 'conflicting option string: -f' error — this is a pre-existing bug in main unrelated to this PR (the `affected` command defines `-f --filter` which conflicts with the global `--format -f` alias). Flagged in PR description for BOS awareness but NOT fixed here (out of scope for #172).
Wolfvin
added a commit
that referenced
this pull request
Jul 3, 2026
) Issue #172 requested verification that sync_command_count.py was run on PR #162 (deps-audit), not manual count bump. What was done: - Rebased feat/issue-158-deps-audit-osv on latest main (39 commits behind) - Resolved conflicts in 6 doc files (all were command-count numbers): * README.md, SKILL.md, SKILL-QUICK.md, pyproject.toml, skill.json, scripts/graph_model.py * Took main's version for count numbers, then re-applied my changes (graph_model NODE_TYPE_DEPENDENCY_VULN/EDGE_TYPE_HAS_VULN constants, README deps-audit row, SKILL-QUICK deps-audit entry) - Ran `python3 scripts/sync_command_count.py --apply`: * Command count: 76 (was 71 in original PR — main has moved +5 commands from other merged PRs: orient #165, large-file-threshold #163, etc.) * MCP tools: 74 (56 static + 18 dynamic) - Verified `sync_command_count.py --check` reports 'All documentation files are in sync with COMMAND_REGISTRY' - Re-ran deps_audit tests: 47 passed, 0 failed Definition of Done (issue #172): - [x] PR #162 rebased on latest main - [x] sync_command_count.py --apply run — output counts match docs files - [x] Counts corrected: 71 → 76 commands, MCP tools updated accordingly - [x] PR #162 is mergeable (no conflicts, tests pass) Note: sync_command_count.py works fine when invoked directly (it imports COMMAND_REGISTRY without going through codelens.py main). However, `codelens.py --command-count` currently crashes with an argparse 'conflicting option string: -f' error — this is a pre-existing bug in main unrelated to this PR (the `affected` command defines `-f --filter` which conflicts with the global `--format -f` alias). Flagged in PR description for BOS awareness but NOT fixed here (out of scope for #172).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Adds a new
codelens orientcommand that produces a 10-second structured codebase orientation brief. It answers the first four questions a developer asks when entering an unfamiliar repo:framework_db.detect_frameworks_brief()manifest_parser.extract_commands()file_ranker.rank_start_here_files()commands/orient.pyPure-filesystem: no subprocess, no network, no LSP. Reads manifest files + walks the source tree once.
Why
CodeLens is a deep-analysis tool (taint, callgraph, secrets, dead-code). There is currently no command that answers the first questions a developer asks when entering an unfamiliar repo. Issue #160 asks for a zero-setup, pure-static "repo orientation brief" ported from codeglance (TypeScript, MIT — logic ported, no code copied).
Files touched
New files (6):
scripts/commands/orient.py— command module + entry-point/CI/Docker detection + output rendering (text/json/compact)scripts/orient_lib/__init__.py— analyzer sub-package markerscripts/orient_lib/framework_db.py— data-driven framework lookup table (5 ecosystems, 60+ frameworks)scripts/orient_lib/manifest_parser.py— run/build/test command extraction from package.json, Makefile, pyproject.toml, Cargo.toml, go.mod, pom.xml/build.gradlescripts/orient_lib/file_ranker.py— Start Here scoring logic (filename/depth/line-count/directory-context)tests/test_orient.py— 31 tests covering all 5 sub-features + output schema + compact renderingModified files (7):
scripts/codelens.py— add"orient"to the skip-global-format command list (same pattern asdoctor/sessions, 2-line change at L1289 + L1291)README.md,SKILL.md,SKILL-QUICK.md,pyproject.toml,skill.json,scripts/graph_model.py— command count sync 70 → 71 (auto-generated bypython3 scripts/sync_command_count.py --apply)Architecture deviation from issue spec
Issue #160 specifies
scripts/orient/framework_db.pyetc. I named the packagescripts/orient_lib/instead ofscripts/orient/to avoid a Python import collision:commands/orient.pyand a top-levelorient/package both claim theorientmodule name, triggering a circular import (cannot import name 'detect_frameworks_brief' from partially initialized module 'orient'). Theorient_libname sidesteps this without touching the command name. Documented inscripts/orient_lib/__init__.pydocstring.Definition of Done checklist
codelens orient .produces structured output for Node.js, Python, and Go repos (verified via fixture tests + manual run on CodeLens itself)--format json(default),--format compact(single-line ≤300 tokens),--format text(human-readable) all worksync_command_count.py --applyrun after registration (70 → 71)@WHO,@WHAT,@PART,@ENTRY) on all new files@FLOW: ORIENT,@CALLS,@MUTATESon entry functioncmd_orient()Verification
pytest tests/test_orient.py -v— 31 tests, all passTest classes:
TestFrameworkDetection(4) — Node.js/Python/Go/unknown ecosystemTestCommandExtraction(3) — npm scripts / pytest+ruff / go standardTestEntryPointDetection(4) — per-ecosystem + max-8 capTestStartHereRanking(5) — top-N, skip tests/migrations, integer scoresTestInfraDetection(8) — CI/Docker/env/test-framework/linterTestOutputSchema(6) — all top-level + nested block shapesTestCompactFormat(1) — single-line renderingFull test suite regression — 1405 passed, 76 skipped, 1 pre-existing failure
The 1 failure (
tests/test_codelensignore.py::TestBackwardCompat::test_actual_target_dir_is_ignored) is pre-existing — verified by checking outmainand running the same test: it fails identically. Unrelated to this PR.Manual test:
codelens orient .on CodeLens itselfCodeLens itself has no Python web framework (correct — it's a CLI tool), so
primary=Noneandecosystem=Pythonis the right answer. CI detection finds the 5 workflow files in.github/workflows/.Fixture tests on 3 ecosystems (from
tests/test_orient.py)Issue link
Closes #160 — #160
Findings
scripts/orient/→scripts/orient_lib/rename. Issue [FEAT] codelens orient — 10-second codebase orientation brief #160 spec asks forscripts/orient/framework_db.pyetc. A top-levelorient/package collides withcommands/orient.pyat import time (both claim theorientmodule name → circular import). Renamed toorient_lib/and documented the reason in the package docstring. If the maintainers prefer the spec name, the alternative is to rename the command module (e.g.,commands/orient_cmd.pyregistering asorient) — but that breaks thecommands/<name>.pyconvention.test_framework/linterdetection is config-file-based, not dependency-based. For example, a Node.js project withjestindevDependenciesbut nojest.config.jswill reporttest_framework: None. This matches codeglance's behavior (config files are the source of truth) and keeps the detector filesystem-only. If dependency-based detection is desired later, it would be a follow-up enhancement.file_set_hashfor Start Here is not stable across runs becauseos.walkdirectory order is not guaranteed. The scores are stable (deterministic per file), but the order of files with equal scores may vary. For the orient use case (top-N recommendation) this is acceptable — all tied files are equally good starting points.