{"id":18447083,"url":"https://github.com/zot/sourcecodex","last_synced_at":"2025-04-15T02:45:55.293Z","repository":{"id":18845043,"uuid":"22061017","full_name":"zot/SourceCodex","owner":"zot","description":"Rapidly get callers/callees/defs and search for terms source code projects","archived":false,"fork":false,"pushed_at":"2014-07-24T10:30:37.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T02:45:52.535Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zot.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-21T10:50:59.000Z","updated_at":"2014-07-21T10:58:31.000Z","dependencies_parsed_at":"2022-08-31T11:13:27.124Z","dependency_job_id":null,"html_url":"https://github.com/zot/SourceCodex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zot%2FSourceCodex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zot%2FSourceCodex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zot%2FSourceCodex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zot%2FSourceCodex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zot","download_url":"https://codeload.github.com/zot/SourceCodex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997087,"owners_count":21195797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T07:11:54.207Z","updated_at":"2025-04-15T02:45:55.277Z","avatar_url":"https://github.com/zot.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"* SourceCodex\nA very simple platform for searching calls/callers (and terms) in code projects\n\n** Features\n- Searches for callers/callees and patterns\n- Fast enough to use for incremental completion\n- Simple to use (command line tool)\n- Simple design (only two source files: a shell script and a CoffeeScript program)\n- Supports JavaScript and CoffeeScript\n- Easy to extend for additional languages\n- Zero admin (command line option to monitor project changes means no service needed)\n- Small number of dependencies (POSIX/cygwin, node.js, and several node.js projects)\n\n** USAGE\n#+BEGIN_SRC example\nsourcecodex [ -h | -i PATTERN | -s PATTERN | -p PATTERN | -l LIM OFF | -t PATTERN | -v | -q | -n | -d | -r | -u | -m | -c | -j | --callers F | --calls F | --defs ] [DIR]\nDIR is the directory containing the files to index.\nIf DIR is given, a new \".sourcecodex\" database is created\nin DIR if it does not exist\nOPTIONS:\n  -h            Print this message\n  -i PATTERN    Ignore files matching pattern\n  -s PATTERN    Search for token pattern in files and return matched lines in grep format\n  -p PATTERN    Search for prefix token pattern in files and return matched lines in grep format\n  -l LIM OFF    Limit the number of search results to LIM and discard the first OFF\n  -t PATTERN    Find all tokens matching pattern\n  -v            Inccrease verbosity\n  -q            Turn off progress notifications\n  -n            Notify of changes (implies -q): 'DELETE'|'CREATE'|'MODIFY' FILE\n  -d            Delete the .sourcecodex database\n  -r            Delete and rebuild database\n  -u            Update and then exit\n  -m            Update and continue monitoring for changes\n  -c            Index CoffeeScript callers and callees\n  -j            Index JavaScript callers and callees\n  --callers F   List call sites of F: FILE:LINE:COL:FUNC:CONTENTS\n  --calls F     List F's call sites: FILE:LINE:COL:FUNC:CONTENTS\n  --defs        List defs: FILE:LINE:COL:FUNC:CONTENTS\n#+END_SRC\n\n** Architecture\n- built on SQLite\n  - allows background updating\n  - other programs can access/change the database\n- extensible\n  - update/monitor command can output events like inotifywatch (CREATE/MODIFY/DELETE file)\n  - other programs can query/change the database\n\n** Schema\nThere are 5 main tables: files, lines, lines_terms, defs, and calls.\n\n#+BEGIN_SRC SQL\ncreate table files (path primary key, stamp);\ncreate virtual table lines using fts4 (path, line_number, line);\ncreate virtual table lines_terms using fts4aux(lines);\ncreate table defs(file, code, line_number, col);\ncreate table calls(file, code, call, line_number, col);\n#+END_SRC\n\nFiles tracks the indexed files.\n\nLines stores all of the lines of the tracked files and maintains a full-text index.\n\nLines_terms lets you access the internals of the index like the terms (tokens).\n\nDefs tracks the definitions in the files.\n\nCalls tracks the calls to the definitions in the files.\n\n** Todo\n- index referenced variables\n  - add column to defs and calls to specify type of def or call (func or var)\n- support full regexp search\n  - maybe just narrow down the lines with a pattern and then pump them through grep\n  - maybe based on Russ Cox's work\n- remove POSIX deps (add bat file for search command)\n\n** References\n- Smalltalk: On the Smalltalk Browser (80s), http://onsmalltalk.com/on-the-smalltalk-browser\n- Tern (sourcecodex uses Tern's parser)\n- Russ Cox's work\n  - codesearch: https://code.google.com/p/codesearch/\n  - trigram analysis: http://swtch.com/~rsc/regexp/regexp4.html\n- beagrep: http://baohaojun.github.io/beagrep.html\n  - beagrep looks very similar, but the author says it's very difficult to install on windows\n- some similar tools do not do callers/callees\n  - (opengrok, gnu global): https://github.com/OpenGrok/OpenGrok/wiki/Comparison-with-Similar-Tools\n- Cscope: http://en.wikipedia.org/wiki/Cscope http://cscope.sourceforge.net/history.html\n- Other code search tools: http://beyondgrep.com/more-tools/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzot%2Fsourcecodex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzot%2Fsourcecodex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzot%2Fsourcecodex/lists"}