From 02a3fa4cad2c323f2258550f61246fb1c99e2edf Mon Sep 17 00:00:00 2001 From: bendtherules Date: Wed, 8 Apr 2026 16:09:01 +0530 Subject: [PATCH] refactor: Rename all file/folders to camelCase --- .vscode/launch.json | 2 +- AGENTS.md | 9 +++++---- agent.ts | 2 +- .../graph_explorer.ts => agentTools/graphExplorer.ts | 0 agentTools/index.ts | 9 +++++++++ {agent_tools => agentTools}/reranker.ts | 0 .../sectionRetriever.ts | 0 .../spec_retriever.ts => agentTools/specRetriever.ts | 0 agent_tools/index.ts | 9 --------- package.json | 2 +- setup/{build_graph.ts => buildGraph.ts} | 0 ...ernal-method-link.ts => htmlAddInternalMethodLink.ts} | 0 setup/{init_engine262.sh => initEngine262.sh} | 2 +- setup/{strip-spec-container.ts => stripSpecContainer.ts} | 0 test/manual/test-spec-retriever.ts | 2 +- 15 files changed, 19 insertions(+), 18 deletions(-) rename agent_tools/graph_explorer.ts => agentTools/graphExplorer.ts (100%) create mode 100644 agentTools/index.ts rename {agent_tools => agentTools}/reranker.ts (100%) rename agent_tools/section_retriever.ts => agentTools/sectionRetriever.ts (100%) rename agent_tools/spec_retriever.ts => agentTools/specRetriever.ts (100%) delete mode 100644 agent_tools/index.ts rename setup/{build_graph.ts => buildGraph.ts} (100%) rename setup/{html-add-internal-method-link.ts => htmlAddInternalMethodLink.ts} (100%) rename setup/{init_engine262.sh => initEngine262.sh} (94%) rename setup/{strip-spec-container.ts => stripSpecContainer.ts} (100%) diff --git a/.vscode/launch.json b/.vscode/launch.json index 9b67ebb..5a5e281 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -34,7 +34,7 @@ "name": "Debug: Build Graph", "type": "bun", "request": "launch", - "program": "${workspaceFolder}/setup/build_graph.ts", + "program": "${workspaceFolder}/setup/buildGraph.ts", "cwd": "${workspaceFolder}", "stopOnEntry": false, "watchMode": false diff --git a/AGENTS.md b/AGENTS.md index 4362509..520aab2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,12 +22,13 @@ Users ask questions like: *"How does the if statement work?"* or *"Which functio ``` ask262/ ├── agent.ts # Main ReAct agent - answers user queries +├── agentTools/ # Agent tool implementations ├── constants.ts # Directory paths and file locations ├── config.json # API keys and endpoints (user-created) ├── setup/ │ ├── ingest.ts # Ingests spec HTML into vector index -│ ├── build_graph.ts # Builds knowledge graph (spec → code mappings) -│ └── strip-spec-container.ts # Cleans spec HTML files +│ ├── buildGraph.ts # Builds knowledge graph (spec → code mappings) +│ └── stripSpecContainer.ts # Cleans spec HTML files ├── spec-built/multipage/ # ECMAScript spec HTML files (ecmarkup output) ├── engine262/src/ # JavaScript engine implementation code ├── storage/ # Vector index persistence (LlamaIndex) @@ -37,7 +38,7 @@ ask262/ **Key Files:** - `agent.ts`: ReAct agent with two tools - `spec_retriever` (vector search) and `graph_explorer` (graph navigation) - `setup/ingest.ts`: Parses HTML files, extracts `emu-clause` sections, chunks them, creates embeddings -- `setup/build_graph.ts`: Parses spec sections and code functions, creates nodes/edges showing which functions implement which spec sections +- `setup/buildGraph.ts`: Parses spec sections and code functions, creates nodes/edges showing which functions implement which spec sections - `constants.ts`: Defines `STORAGE_DIR`, `SPEC_DIR`, `CODE_DIR`, `GRAPH_FILE` ## Commands @@ -45,7 +46,7 @@ ask262/ **Manual:** ```bash bun run setup/ingest.ts # Direct ingest execution -bun run setup/build_graph.ts # Direct graph build +bun run setup/buildGraph.ts # Direct graph build bun run agent.ts "Your question here" # Direct agent execution ``` diff --git a/agent.ts b/agent.ts index cd0e57c..5dd2ab9 100644 --- a/agent.ts +++ b/agent.ts @@ -10,7 +10,7 @@ import { createGraphExplorerTool, createSectionRetrieverTool, createSpecRetrieverTool, -} from "./agent_tools"; +} from "./agentTools"; import { EMBEDDING_MODEL, GRAPH_FILE, STORAGE_DIR } from "./constants"; const embeddings = new OllamaEmbeddings({ diff --git a/agent_tools/graph_explorer.ts b/agentTools/graphExplorer.ts similarity index 100% rename from agent_tools/graph_explorer.ts rename to agentTools/graphExplorer.ts diff --git a/agentTools/index.ts b/agentTools/index.ts new file mode 100644 index 0000000..f21decb --- /dev/null +++ b/agentTools/index.ts @@ -0,0 +1,9 @@ +/** + * Agent tools index file. + * Exports all tool factory functions and utilities. + */ + +export { createGraphExplorerTool } from "./graphExplorer"; +export { type RerankResult, rerankDocuments } from "./reranker"; +export { createSectionRetrieverTool } from "./sectionRetriever"; +export { createSpecRetrieverTool } from "./specRetriever"; diff --git a/agent_tools/reranker.ts b/agentTools/reranker.ts similarity index 100% rename from agent_tools/reranker.ts rename to agentTools/reranker.ts diff --git a/agent_tools/section_retriever.ts b/agentTools/sectionRetriever.ts similarity index 100% rename from agent_tools/section_retriever.ts rename to agentTools/sectionRetriever.ts diff --git a/agent_tools/spec_retriever.ts b/agentTools/specRetriever.ts similarity index 100% rename from agent_tools/spec_retriever.ts rename to agentTools/specRetriever.ts diff --git a/agent_tools/index.ts b/agent_tools/index.ts deleted file mode 100644 index fa949ea..0000000 --- a/agent_tools/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Agent tools index file. - * Exports all tool factory functions and utilities. - */ - -export { createGraphExplorerTool } from "./graph_explorer"; -export { type RerankResult, rerankDocuments } from "./reranker"; -export { createSectionRetrieverTool } from "./section_retriever"; -export { createSpecRetrieverTool } from "./spec_retriever"; diff --git a/package.json b/package.json index 3b71f76..7ef3447 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "ingest": "bun run setup/ingest.ts", "verify-db": "bun run test/manual/verify-db.ts", "agent": "bun run agent.ts", - "build": "bun run setup/build_graph.ts", + "build": "bun run setup/buildGraph.ts", "test": "bun test" }, "keywords": [], diff --git a/setup/build_graph.ts b/setup/buildGraph.ts similarity index 100% rename from setup/build_graph.ts rename to setup/buildGraph.ts diff --git a/setup/html-add-internal-method-link.ts b/setup/htmlAddInternalMethodLink.ts similarity index 100% rename from setup/html-add-internal-method-link.ts rename to setup/htmlAddInternalMethodLink.ts diff --git a/setup/init_engine262.sh b/setup/initEngine262.sh similarity index 94% rename from setup/init_engine262.sh rename to setup/initEngine262.sh index 1774b6a..c3daef5 100755 --- a/setup/init_engine262.sh +++ b/setup/initEngine262.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Add the engine262 repository as a git subtree (squashed) -# Usage: ./setup/init_engine262.sh +# Usage: ./setup/initEngine262.sh # This will add the repository at ./engine262 using a squashed subtree set -euo pipefail diff --git a/setup/strip-spec-container.ts b/setup/stripSpecContainer.ts similarity index 100% rename from setup/strip-spec-container.ts rename to setup/stripSpecContainer.ts diff --git a/test/manual/test-spec-retriever.ts b/test/manual/test-spec-retriever.ts index bf87830..5ceeaf9 100644 --- a/test/manual/test-spec-retriever.ts +++ b/test/manual/test-spec-retriever.ts @@ -5,7 +5,7 @@ import * as lancedbSdk from "@lancedb/lancedb"; import { OllamaEmbeddings } from "@langchain/ollama"; -import { createSpecRetrieverTool } from "../../agent_tools"; +import { createSpecRetrieverTool } from "../../agentTools"; import { EMBEDDING_MODEL, STORAGE_DIR } from "../../constants"; async function main() {