Skip to content

Repository files navigation

pb

CILicense: BSD-3-Clause

Analyze PowerBuilder codebases through an interactive web UI — browse objects, trace call graphs, inspect DataWindows, and query relationships. Backed by a DuckDB database, you can also run SQL directly or hand the schema to an LLM.

PB Code Analysis — retail box, floppy disks, CD-ROM, user guide, quick start guide

What we're working with.

Quick start

Prerequisites:GHCup (GHC + Cabal), pnpm, and uv.

# Index and explore in one step — builds parser, indexes, opens browser
./pb explore /path/to/src

Or separately:

./pb index /path/to/src # parse → import → analyze (incremental)
./pb explore # open browser (reuses existing pb.duckdb)

The Haskell parser is built automatically on first run. Subsequent runs only re-parse files whose content has changed.

Input can be a directory of .sr* source files, a single .pbl library, or a directory of .pbl files — extraction happens transparently.

CLI

CommandDescription
pb index DIRParse, import, and analyze a source tree (incremental)
pb explore [DIR]Start the web UI; index DIR first if given
pb extract DIR -o OUTExtract .pbl files to per-library directories
pb dead-code [DB]List non-public procedures unreachable from entry points
pb impact TABLE [COL]Show all PB objects affected by a DB table/column change
pb query NAME [DB]Run a canned SQL query against the database
pb analyze [DB]Re-run graph metrics on an existing database
pb check-corpusVerify both corpora parse with zero errors
pb cleanRemove build artifacts (cabal, node_modules, Python caches)

Common flags: --db FILE (default pb.duckdb), --reset (full re-parse), --ddl [SCHEMA:]FILE (DDL catalog, repeatable), --sql-dialect DIALECT (default oracle), --default-namespace NS.

Explorer

The interactive explorer is a SolidJS SPA backed by FastAPI and DuckDB.

ViewDescription
DashboardCodebase overview — metrics, charts, health
ObjectsBrowse all parsed objects with detail views
ProceduresFunctions, subroutines, events — full AST body rendering
DataWindowsControls, bands, retrieval args, SQL lineage
TablesDatabase tables referenced by DataWindows
DiagramsInheritance, call graphs, DW-table dependencies, heatmaps
QueriesRun canned SQL queries or write your own
SearchFull-text search across objects and procedures
ExploreWrite and run ad-hoc SQL against the database

File types

ExtensionObject typeNotes
.srwWindowPowerScript
.srsStructurePowerScript
.sruUserObjectPowerScript
.srfFunctionPowerScript
.srmMenuPowerScript
.sraApplicationPowerScript
.srpPipelineData pipeline / ETL
.srjProjectBuild configuration
.srdDataWindowSeparate parser (different syntax)

Further reading

  • doc/architecture.md — component map, data flow, cross-component interfaces, testing, and build sequence.
  • doc/vision.md — architectural rationale, LLM integration workflow, DuckDB schema design, and the full operational pipeline.
  • doc/spec.md — parser specification: lexical rules, token forms, file structure, and DataWindow syntax.
  • doc/development.md — build overview, test commands, adding queries, and corpus/debt analysis.
  • AGENTS.md — development protocol: staged verification loop, corpus gates, module placement guide, and code index.

License

BSD-3-Clause — Copyright (c) 2026, Thomas Marsh

About

PowerBuilder (PowerScript + DataWindow) parser and analysis tooling

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages