From ffe2d130a324f42dff358c37cfbfbde9c6dd9faa Mon Sep 17 00:00:00 2001 From: Jan Halfar Date: Wed, 21 Oct 2026 21:31:19 +0200 Subject: [PATCH] feat: schema validator --- CLAUDE.md | 32 +- README.md | 24 +- cmd/configvalidator/main.go | 159 ++++ cmd/demo/main.go | 22 + cmd/htmlschema-lsp/main.go | 25 + cmd/htmlschema-lsp/protocol.go | 135 ++++ cmd/htmlschema-lsp/server.go | 410 ++++++++++ cmd/htmlschema-lsp/server_test.go | 187 +++++ cmd/htmlschema-lsp/text.go | 200 +++++ cmd/validator/validator.go | 68 +- cmd/walker/config-example.yaml | 10 +- cmd/walker/walker.go | 90 ++- config/config_test.go | 2 +- config/form.go | 296 +++++++ config/validate.go | 335 ++++++++ config/validate_test.go | 128 +++ editors/zed-htmlschema/.gitignore | 3 + editors/zed-htmlschema/Cargo.toml | 14 + editors/zed-htmlschema/README.md | 39 + editors/zed-htmlschema/extension.toml | 13 + editors/zed-htmlschema/src/lib.rs | 28 + extract.go | 8 +- go.mod | 17 +- go.sum | 24 +- goswiftrpc.yaml | 23 + gotsrpc.yaml | 11 + gotsrpc.yml | 30 - gotsrpc_gen.go | 398 +++++----- gotsrpcclient_gen.go | 71 +- htmlschema/SPEC.md | 705 +++++++++++++++++ htmlschema/attributerules.go | 70 -- htmlschema/compile.go | 725 +++++++++++++++++ htmlschema/compile_test.go | 113 +++ .../demo/schema/components/category-tile.html | 8 + .../schema/components/feature-section.html | 14 + .../demo/schema/components/product-tile.html | 18 + htmlschema/demo/schema/default.html | 17 + htmlschema/demo/schema/groups/category.html | 76 ++ htmlschema/demo/schema/groups/index.html | 51 ++ htmlschema/demo/schema/groups/product.html | 123 +++ .../demo/schema/partials/breadcrumbs.html | 6 + htmlschema/demo/schema/partials/head.html | 15 + .../demo/schema/partials/page-baseline.html | 2 + .../demo/schema/partials/site-footer.html | 7 + .../demo/schema/partials/site-header.html | 9 + .../products/cars/car-01-turbo-turtle.json | 35 + .../products/cars/car-01-turbo-turtle.png | Bin 0 -> 13997 bytes .../products/cars/car-01-turbo-turtle.svg | 12 + .../products/cars/car-02-banana-roadster.json | 35 + .../products/cars/car-02-banana-roadster.png | Bin 0 -> 14050 bytes .../products/cars/car-02-banana-roadster.svg | 12 + .../cars/car-03-the-grocery-getter.json | 35 + .../cars/car-03-the-grocery-getter.png | Bin 0 -> 12777 bytes .../cars/car-03-the-grocery-getter.svg | 12 + ...n-wagon-of-endless-road-trips-edition.json | 35 + ...on-wagon-of-endless-road-trips-edition.png | Bin 0 -> 13972 bytes ...on-wagon-of-endless-road-trips-edition.svg | 12 + .../cars/car-05-puddle-jumper-4x4.json | 35 + .../cars/car-05-puddle-jumper-4x4.png | Bin 0 -> 14576 bytes .../cars/car-05-puddle-jumper-4x4.svg | 12 + .../cars/car-06-moonwalker-coupe.json | 35 + .../products/cars/car-06-moonwalker-coupe.png | Bin 0 -> 12865 bytes .../products/cars/car-06-moonwalker-coupe.svg | 12 + .../products/cars/car-07-sofa-on-wheels.json | 35 + .../products/cars/car-07-sofa-on-wheels.png | Bin 0 -> 13850 bytes .../products/cars/car-07-sofa-on-wheels.svg | 12 + .../products/cars/car-08-parking-wizard.json | 35 + .../products/cars/car-08-parking-wizard.png | Bin 0 -> 14229 bytes .../products/cars/car-08-parking-wizard.svg | 12 + .../products/cars/car-09-crypto-cruiser.json | 35 + .../products/cars/car-09-crypto-cruiser.png | Bin 0 -> 13098 bytes .../products/cars/car-09-crypto-cruiser.svg | 12 + .../cars/car-10-grandma-s-rocket.json | 35 + .../products/cars/car-10-grandma-s-rocket.png | Bin 0 -> 13606 bytes .../products/cars/car-10-grandma-s-rocket.svg | 12 + .../catalogue/products/cars/category.json | 6 + .../catalogue/products/robots/category.json | 6 + .../robots/robot-01-clanky-the-butlerbot.json | 35 + .../robots/robot-01-clanky-the-butlerbot.png | Bin 0 -> 19789 bytes .../robots/robot-01-clanky-the-butlerbot.svg | 14 + .../robots/robot-02-vacuumulator-3000.json | 35 + .../robots/robot-02-vacuumulator-3000.png | Bin 0 -> 17719 bytes .../robots/robot-02-vacuumulator-3000.svg | 14 + .../robots/robot-03-sir-beeps-a-lot.json | 35 + .../robots/robot-03-sir-beeps-a-lot.png | Bin 0 -> 17013 bytes .../robots/robot-03-sir-beeps-a-lot.svg | 14 + .../products/robots/robot-04-gardenator.json | 35 + .../products/robots/robot-04-gardenator.png | Bin 0 -> 19515 bytes .../products/robots/robot-04-gardenator.svg | 14 + .../products/robots/robot-05-disco-dan.json | 35 + .../products/robots/robot-05-disco-dan.png | Bin 0 -> 17519 bytes .../products/robots/robot-05-disco-dan.svg | 14 + .../robots/robot-06-philosophotron.json | 35 + .../robots/robot-06-philosophotron.png | Bin 0 -> 17358 bytes .../robots/robot-06-philosophotron.svg | 14 + .../products/robots/robot-07-tiny-tim.json | 35 + .../products/robots/robot-07-tiny-tim.png | Bin 0 -> 20364 bytes .../products/robots/robot-07-tiny-tim.svg | 14 + .../products/robots/robot-08-chef-bolt.json | 35 + .../products/robots/robot-08-chef-bolt.png | Bin 0 -> 18215 bytes .../products/robots/robot-08-chef-bolt.svg | 14 + .../products/robots/robot-09-nanny-nine.json | 35 + .../products/robots/robot-09-nanny-nine.png | Bin 0 -> 17369 bytes .../products/robots/robot-09-nanny-nine.svg | 14 + .../robots/robot-10-lazybot-deluxe.json | 8 + .../robots/robot-10-lazybot-deluxe.png | Bin 0 -> 20430 bytes .../robots/robot-10-lazybot-deluxe.svg | 14 + htmlschema/demo/server/loader.go | 109 +++ htmlschema/demo/server/server.go | 414 ++++++++++ htmlschema/demo/server/static/style.css | 278 +++++++ .../demo/server/templates/category.html | 23 + htmlschema/demo/server/templates/footer.html | 13 + htmlschema/demo/server/templates/head.html | 50 ++ htmlschema/demo/server/templates/index.html | 47 ++ .../demo/server/templates/notfound.html | 6 + htmlschema/demo/server/templates/product.html | 33 + htmlschema/demo/server/vo.go | 40 + .../example/htdocs/catalogue/category.html | 22 - .../example/htdocs/catalogue/product-a.html | 9 - .../example/htdocs/catalogue/product-b.html | 8 - htmlschema/example/htdocs/content/page-a.html | 36 - htmlschema/example/htdocs/index.html | 36 - htmlschema/example/schema/components/nav.html | 12 - htmlschema/example/schema/content.html | 19 - .../schema/groups/catalogue/category.html | 17 - .../schema/groups/catalogue/product.html | 21 - .../example/schema/groups/content/index.html | 58 -- htmlschema/example/schema/groups/default.html | 24 - htmlschema/example/server.go | 49 -- htmlschema/example/server_test.go | 42 - htmlschema/examples_test.go | 220 ++++++ htmlschema/groups.go | 73 -- htmlschema/groups_test.go | 22 - htmlschema/htmlschema.go | 26 - htmlschema/ld.go | 229 ++++++ htmlschema/loader.go | 229 ------ htmlschema/loader_test.go | 35 - htmlschema/match.go | 84 ++ htmlschema/page.go | 218 ++++++ htmlschema/pagedata.go | 145 ++++ htmlschema/pagedata_test.go | 47 ++ htmlschema/report.go | 120 +++ htmlschema/root.go | 260 +++++++ htmlschema/rules.go | 256 ++++++ htmlschema/score.go | 126 +++ htmlschema/syntax.go | 131 ++++ htmlschema/syntax_test.go | 50 ++ htmlschema/trace.go | 145 ++++ htmlschema/trace_test.go | 119 +++ htmlschema/validate.go | 735 +++++++++--------- htmlschema/validate_test.go | 228 ++++++ htmlschema/vocabulary.go | 170 ++++ macos/Packages/GraphLayout/Package.resolved | 13 - macos/Packages/GraphLayout/Package.swift | 27 - .../Sources/GraphLayout/GraphLayout.swift | 73 -- macos/Walker.entitlements | 8 +- macos/Walker.xcodeproj/project.pbxproj | 59 +- .../xcshareddata/swiftpm/Package.resolved | 14 - macos/Walker/Generated/GoTime.swift | 23 + .../Walker/Generated}/GotsRPC.swift | 4 +- macos/Walker/Generated/HTMLSchemaVO.swift | 291 +++++++ macos/Walker/Generated/ServiceClient.swift | 386 +++++++++ macos/Walker/Generated/Walker.swift | 98 +++ macos/Walker/Generated/WalkerVo.swift | 688 ++++++++++++++++ macos/Walker/Model/ConfigTool.swift | 106 +++ macos/Walker/Model/Formatting.swift | 35 +- macos/Walker/Model/GraphModel.swift | 225 ------ macos/Walker/Model/LiveMetrics.swift | 242 ++++++ macos/Walker/Model/LocalWalkers.swift | 246 ++++++ macos/Walker/Model/PromText.swift | 79 ++ macos/Walker/Model/SchemaDevModel.swift | 470 +++++++++++ macos/Walker/Model/Server.swift | 20 + macos/Walker/Model/ServerModel.swift | 65 +- macos/Walker/Model/ServerStore.swift | 67 +- macos/Walker/Views/Breadcrumbs.swift | 6 +- macos/Walker/Views/BrokenLinksView.swift | 16 +- macos/Walker/Views/ConfigFormView.swift | 298 +++++++ macos/Walker/Views/ContentView.swift | 114 ++- macos/Walker/Views/CrawlProgressBar.swift | 11 +- macos/Walker/Views/FolderInspector.swift | 6 +- macos/Walker/Views/GraphView.swift | 635 --------------- macos/Walker/Views/JSONHighlighter.swift | 286 +++++++ macos/Walker/Views/LinksView.swift | 12 +- macos/Walker/Views/LiveMetricsView.swift | 222 ++++++ macos/Walker/Views/LocalWalkerViews.swift | 381 +++++++++ macos/Walker/Views/OpenGraphView.swift | 214 +++++ macos/Walker/Views/OverviewView.swift | 75 +- macos/Walker/Views/PageDataView.swift | 308 ++++++++ macos/Walker/Views/PerformanceView.swift | 32 +- macos/Walker/Views/PerformanceViews.swift | 4 +- macos/Walker/Views/Previews.swift | 93 ++- macos/Walker/Views/RedirectsView.swift | 10 +- macos/Walker/Views/ResultInspector.swift | 49 +- macos/Walker/Views/ResultsSidebar.swift | 10 +- macos/Walker/Views/ResultsView.swift | 6 +- macos/Walker/Views/SchemaDevView.swift | 411 ++++++++++ macos/Walker/Views/SchemaTreeView.swift | 716 +++++++++++++++++ macos/Walker/Views/SchemaWebView.swift | 277 +++++++ macos/Walker/Views/ServerDetailView.swift | 62 +- macos/Walker/Views/SettingsView.swift | 21 +- macos/Walker/Views/SourceLink.swift | 78 ++ macos/Walker/Views/StatusBar.swift | 125 +++ macos/Walker/WalkerApp.swift | 11 +- metrics.go | 56 +- metrics_test.go | 48 +- mise.toml | 49 ++ reports/reports.go | 3 +- reports/schema.go | 2 +- reports/seo.go | 3 - schemaservice.go | 213 +++++ schemaservice_test.go | 80 ++ scrape.go | 10 +- scrapeloop.go | 118 ++- service.go | 65 +- service_test.go | 8 +- serviceinterface.go | 37 + swift/ServiceClient.swift | 270 ------- swift/VO.swift | 618 --------------- swift/VoSchema.swift | 122 --- swift/VoTime.swift | 13 - swift/VoWalker.swift | 93 --- validationmetrics.go | 86 +- vo/graph.go | 56 ++ vo/graph_test.go | 26 + vo/schema.go | 30 + vo/scraperesult.go | 2 +- walker.go | 28 +- walker_test.go | 51 +- 228 files changed, 16629 insertions(+), 3926 deletions(-) create mode 100644 cmd/configvalidator/main.go create mode 100644 cmd/demo/main.go create mode 100644 cmd/htmlschema-lsp/main.go create mode 100644 cmd/htmlschema-lsp/protocol.go create mode 100644 cmd/htmlschema-lsp/server.go create mode 100644 cmd/htmlschema-lsp/server_test.go create mode 100644 cmd/htmlschema-lsp/text.go create mode 100644 config/form.go create mode 100644 config/validate.go create mode 100644 config/validate_test.go create mode 100644 editors/zed-htmlschema/.gitignore create mode 100644 editors/zed-htmlschema/Cargo.toml create mode 100644 editors/zed-htmlschema/README.md create mode 100644 editors/zed-htmlschema/extension.toml create mode 100644 editors/zed-htmlschema/src/lib.rs create mode 100644 goswiftrpc.yaml create mode 100644 gotsrpc.yaml delete mode 100644 gotsrpc.yml create mode 100644 htmlschema/SPEC.md delete mode 100644 htmlschema/attributerules.go create mode 100644 htmlschema/compile.go create mode 100644 htmlschema/compile_test.go create mode 100644 htmlschema/demo/schema/components/category-tile.html create mode 100644 htmlschema/demo/schema/components/feature-section.html create mode 100644 htmlschema/demo/schema/components/product-tile.html create mode 100644 htmlschema/demo/schema/default.html create mode 100644 htmlschema/demo/schema/groups/category.html create mode 100644 htmlschema/demo/schema/groups/index.html create mode 100644 htmlschema/demo/schema/groups/product.html create mode 100644 htmlschema/demo/schema/partials/breadcrumbs.html create mode 100644 htmlschema/demo/schema/partials/head.html create mode 100644 htmlschema/demo/schema/partials/page-baseline.html create mode 100644 htmlschema/demo/schema/partials/site-footer.html create mode 100644 htmlschema/demo/schema/partials/site-header.html create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-01-turbo-turtle.json create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-01-turbo-turtle.png create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-01-turbo-turtle.svg create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-02-banana-roadster.json create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-02-banana-roadster.png create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-02-banana-roadster.svg create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-03-the-grocery-getter.json create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-03-the-grocery-getter.png create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-03-the-grocery-getter.svg create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-04-the-extremely-long-named-family-station-wagon-of-endless-road-trips-edition.json create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-04-the-extremely-long-named-family-station-wagon-of-endless-road-trips-edition.png create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-04-the-extremely-long-named-family-station-wagon-of-endless-road-trips-edition.svg create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-05-puddle-jumper-4x4.json create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-05-puddle-jumper-4x4.png create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-05-puddle-jumper-4x4.svg create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-06-moonwalker-coupe.json create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-06-moonwalker-coupe.png create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-06-moonwalker-coupe.svg create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-07-sofa-on-wheels.json create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-07-sofa-on-wheels.png create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-07-sofa-on-wheels.svg create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-08-parking-wizard.json create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-08-parking-wizard.png create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-08-parking-wizard.svg create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-09-crypto-cruiser.json create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-09-crypto-cruiser.png create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-09-crypto-cruiser.svg create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-10-grandma-s-rocket.json create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-10-grandma-s-rocket.png create mode 100644 htmlschema/demo/server/catalogue/products/cars/car-10-grandma-s-rocket.svg create mode 100644 htmlschema/demo/server/catalogue/products/cars/category.json create mode 100644 htmlschema/demo/server/catalogue/products/robots/category.json create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-01-clanky-the-butlerbot.json create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-01-clanky-the-butlerbot.png create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-01-clanky-the-butlerbot.svg create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-02-vacuumulator-3000.json create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-02-vacuumulator-3000.png create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-02-vacuumulator-3000.svg create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-03-sir-beeps-a-lot.json create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-03-sir-beeps-a-lot.png create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-03-sir-beeps-a-lot.svg create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-04-gardenator.json create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-04-gardenator.png create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-04-gardenator.svg create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-05-disco-dan.json create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-05-disco-dan.png create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-05-disco-dan.svg create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-06-philosophotron.json create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-06-philosophotron.png create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-06-philosophotron.svg create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-07-tiny-tim.json create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-07-tiny-tim.png create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-07-tiny-tim.svg create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-08-chef-bolt.json create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-08-chef-bolt.png create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-08-chef-bolt.svg create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-09-nanny-nine.json create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-09-nanny-nine.png create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-09-nanny-nine.svg create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-10-lazybot-deluxe.json create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-10-lazybot-deluxe.png create mode 100644 htmlschema/demo/server/catalogue/products/robots/robot-10-lazybot-deluxe.svg create mode 100644 htmlschema/demo/server/loader.go create mode 100644 htmlschema/demo/server/server.go create mode 100644 htmlschema/demo/server/static/style.css create mode 100644 htmlschema/demo/server/templates/category.html create mode 100644 htmlschema/demo/server/templates/footer.html create mode 100644 htmlschema/demo/server/templates/head.html create mode 100644 htmlschema/demo/server/templates/index.html create mode 100644 htmlschema/demo/server/templates/notfound.html create mode 100644 htmlschema/demo/server/templates/product.html create mode 100644 htmlschema/demo/server/vo.go delete mode 100644 htmlschema/example/htdocs/catalogue/category.html delete mode 100644 htmlschema/example/htdocs/catalogue/product-a.html delete mode 100644 htmlschema/example/htdocs/catalogue/product-b.html delete mode 100644 htmlschema/example/htdocs/content/page-a.html delete mode 100644 htmlschema/example/htdocs/index.html delete mode 100644 htmlschema/example/schema/components/nav.html delete mode 100644 htmlschema/example/schema/content.html delete mode 100644 htmlschema/example/schema/groups/catalogue/category.html delete mode 100644 htmlschema/example/schema/groups/catalogue/product.html delete mode 100644 htmlschema/example/schema/groups/content/index.html delete mode 100644 htmlschema/example/schema/groups/default.html delete mode 100644 htmlschema/example/server.go delete mode 100644 htmlschema/example/server_test.go create mode 100644 htmlschema/examples_test.go delete mode 100644 htmlschema/groups.go delete mode 100644 htmlschema/groups_test.go delete mode 100644 htmlschema/htmlschema.go create mode 100644 htmlschema/ld.go delete mode 100644 htmlschema/loader.go delete mode 100644 htmlschema/loader_test.go create mode 100644 htmlschema/match.go create mode 100644 htmlschema/page.go create mode 100644 htmlschema/pagedata.go create mode 100644 htmlschema/pagedata_test.go create mode 100644 htmlschema/report.go create mode 100644 htmlschema/root.go create mode 100644 htmlschema/rules.go create mode 100644 htmlschema/score.go create mode 100644 htmlschema/syntax.go create mode 100644 htmlschema/syntax_test.go create mode 100644 htmlschema/trace.go create mode 100644 htmlschema/trace_test.go create mode 100644 htmlschema/validate_test.go create mode 100644 htmlschema/vocabulary.go delete mode 100644 macos/Packages/GraphLayout/Package.resolved delete mode 100644 macos/Packages/GraphLayout/Package.swift delete mode 100644 macos/Packages/GraphLayout/Sources/GraphLayout/GraphLayout.swift delete mode 100644 macos/Walker.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 macos/Walker/Generated/GoTime.swift rename {swift => macos/Walker/Generated}/GotsRPC.swift (98%) create mode 100644 macos/Walker/Generated/HTMLSchemaVO.swift create mode 100644 macos/Walker/Generated/ServiceClient.swift create mode 100644 macos/Walker/Generated/Walker.swift create mode 100644 macos/Walker/Generated/WalkerVo.swift create mode 100644 macos/Walker/Model/ConfigTool.swift delete mode 100644 macos/Walker/Model/GraphModel.swift create mode 100644 macos/Walker/Model/LiveMetrics.swift create mode 100644 macos/Walker/Model/LocalWalkers.swift create mode 100644 macos/Walker/Model/PromText.swift create mode 100644 macos/Walker/Model/SchemaDevModel.swift create mode 100644 macos/Walker/Views/ConfigFormView.swift delete mode 100644 macos/Walker/Views/GraphView.swift create mode 100644 macos/Walker/Views/JSONHighlighter.swift create mode 100644 macos/Walker/Views/LiveMetricsView.swift create mode 100644 macos/Walker/Views/LocalWalkerViews.swift create mode 100644 macos/Walker/Views/OpenGraphView.swift create mode 100644 macos/Walker/Views/PageDataView.swift create mode 100644 macos/Walker/Views/SchemaDevView.swift create mode 100644 macos/Walker/Views/SchemaTreeView.swift create mode 100644 macos/Walker/Views/SchemaWebView.swift create mode 100644 macos/Walker/Views/SourceLink.swift create mode 100644 macos/Walker/Views/StatusBar.swift create mode 100644 mise.toml create mode 100644 schemaservice.go create mode 100644 schemaservice_test.go create mode 100644 serviceinterface.go delete mode 100644 swift/ServiceClient.swift delete mode 100644 swift/VO.swift delete mode 100644 swift/VoSchema.swift delete mode 100644 swift/VoTime.swift delete mode 100644 swift/VoWalker.swift create mode 100644 vo/schema.go diff --git a/CLAUDE.md b/CLAUDE.md index 24b3e68..8c533bc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,14 +10,17 @@ Walker crawls a website and collects performance, SEO and broken-link data. It s ```sh go build ./... # build everything -go run ./cmd/walker path/to/config.yaml # run the crawler + web UI (default addr :3001) -go run ./cmd/validator schema.html https://host/page # validate one page against an htmlschema file +go run ./cmd/walker path/to/config.yaml # run the crawler + web UI (default addr :3001), -exit-on-stdin-close for the macOS app +go run ./cmd/validator schema-root group https://host/page # validate one page, exit 3 on error findings go test ./... # all tests go test ./config -run TestLoad # single test -go test ./htmlschema/... -v # schema loader/group validator + example server +go test ./htmlschema/... -v # syntax, lint, rules + golden tests of the SPEC.md examples +go install ./cmd/htmlschema-lsp # language server for schema files, Zed extension in editors/zed-htmlschema +go run ./cmd/configvalidator config.yaml # validate a walker config: unknown keys, types, schema root - exit 3 on errors +go run ./cmd/demo # demo shop on :8080 (reads templates, css, catalogue from source on every request), schema in htmlschema/demo/schema, group header x-next-js-app ``` -The `Makefile` holds only ad-hoc deploy targets (cross-compile, then scp to a stage host); it isn't a build system. The `Dockerfile` builds both binaries and bakes in `cmd/walker/config-example.yaml`. +`mise.toml` pins Go and `gotsrpc` (keep it in sync with `go.mod`) and wraps the commands above as tasks (`mise tasks`; `mise run generate` regenerates the Go proxy and the Swift client; `goswiftrpc` is pre-alpha without mise support, so `generate:swift` runs `go install github.com/foomo/goswiftrpc/cmd/goswiftrpc@latest` first). The `Makefile` holds only ad-hoc deploy targets (cross-compile, then scp to a stage host); it isn't a build system. The `Dockerfile` builds both binaries and bakes in `cmd/walker/config-example.yaml`. ## Configuration @@ -27,11 +30,11 @@ The `Makefile` holds only ad-hoc deploy targets (cross-compile, then scp to a st - `interval` / `offset` (durations): wall-clock-aligned scrape schedule, see `schedule.go`. `0` means restart immediately. - Other keys: `ignore` (path prefixes), `ignorequerieswith`, `ignoreallqueries`, `ignorerobots`, `depth`, `paging`, `groupheader`, `schemaroot`. -Most `cmd/walker/*.yaml` files are local, site-specific configs and are usually untracked. +Most `cmd/walker/*.yaml` files are local, site-specific configs and are usually untracked. `config.Validate` checks a config file with line numbers (`Load` silently ignores unknown keys), `config.ReadForm`/`WriteForm` turn it into a form and back while keeping comments and unknown keys. ## Architecture -**Actor-style core (`walker.go`, `scrapeloop.go`).** `NewWalker` starts one goroutine, `scrapeloop`, which owns all crawl state: the job map, results and the client pool. Public methods (`Walk`, `Stop`, `GetStatus`, `GetStatuses`) never touch that state directly. Each one sends a request on a channel and waits for the reply on that same channel. Keep it this way: new features that read or change crawl state should add a channel case to the `select` in `scrapeloop`, not shared fields or mutexes. `GetStatuses()` returns the last completed cycle and the running one (`nil` while idle between scheduled cycles), and the reports render both. `GetStatus()` returns the current cycle. +**Actor-style core (`walker.go`, `scrapeloop.go`).** `NewWalker` starts one goroutine, `scrapeloop`, which owns all crawl state: the job map, results and the client pool. Public methods (`Walk`, `Stop`, `Restart`, `GetStatus`, `GetStatuses`) never touch that state directly. Each one sends a request on a channel and waits for the reply on that same channel. Keep it this way: new features that read or change crawl state should add a channel case to the `select` in `scrapeloop`, not shared fields or mutexes. `GetStatuses()` returns the last completed cycle and the running one (`nil` while idle between scheduled cycles), and the reports render both. `GetStatus()` returns the current cycle. `Restart()` starts a new cycle right away (service `RestartScrape`, the "New Scrape" button of the overview); requests still in flight of an aborted cycle free their clients, their results are dropped (`dispatched` remembers the cycle of each busy client). **Scraping (`scrape.go`).** `scrapeloop` hands each job a free `poolClient` from `clientPool` (one `http.Client` per unit of concurrency, optional cookie jar, TLS verification disabled, redirect chain recorded via request context) and calls `scrape` in its own goroutine. Results come back over `chanResult`. `scrape` parses the HTML with goquery and runs `extract.go`, which pulls out title, description, h1, canonical and JSON-LD into `vo.Structure`. It also collects links (including links inside `