Knack Audit Toolkit - Free Tool: Find broken View/Scene references in your Custom JS (Python Script + Chrome Extension)


Hey All,

I recently went down a rabbit hole trying to clean up some large, long lived Knack apps. I realized I had a lot of Custom JavaScript referencing Views and Scenes (view_12, scene_45) that I had deleted at some point.

I wanted a way to audit my code and find these “dead links” automatically. These don’t usually break the code, but they sure make it messy.

I started with a Python script but eventually wrapped the logic into a full Chrome Extension. I’m sharing the journey and the tools here in case it saves anyone else some debugging time.

The Problem

If you write custom JS, you often reference specific IDs to hide elements, add listeners, or manipulate data. If you delete or change that View in the builder, your code may break silently, or it’s just unused code in JS Panel in the builder.

Tool 1: The “Power User” Python Script

First, I built two Python scripts. Script 1 analyzes you code (reading a .js file locally.) It finds all Scene, View, and Field IDs. Script 2 takes your App ID as an input, fetches the public schema, and cross-references it against your code.

  • Best for: Developers who want to run this via command line or for bulk checking.
  • How it works: It hits the public loader endpoint to map your live app, then scans your JS file for missing IDs.
  • Knack Audit Toolkit

Tool 2: The Chrome Extension (Easier!)

I realized not everyone wants to run Python, so I converted the logic into a Browser Extension.

  • Best for: Quick checks while you are working in the Builder or the Live App.
  • How it works: You click the extension button, hit “Scan,” and it downloads a CSV report telling you exactly which IDs in your code are EXISTS (Valid) and which are BROKEN (Dead links).
  • Smart Fetch: It tries to fetch your JS automatically. If it can’t (due to browser security/CORS), it simply asks you to paste the code, then runs the audit instantly.

:memo: Important Notes & Disclaimers

  1. Unofficial Tool: This is a community project and is not officially supported by Knack. It relies on the public loader.knack.com endpoint. If Knack significantly changes their architecture in the future, this tool may need updates to keep working.
  2. Security & Privacy: This tool is Open Source. It runs entirely locally in your browser. No data from your app or your code is sent to any external server.
  3. Coming Soon: Right now, this tool specifically audits your JavaScript. I am working on adding CSS auditing in the coming days so you can find those broken display: none rules too!

Download / Open Source

I’ve put the source code on GitHub. Feel free to fork it, improve it, or check the code to see how it works.

icon48 Knack Audit Toolkit

Hope this helps someone else clean up their spaghetti code!

Cheers,
Erik

2 Likes

Here’s a fun tidbit, since we are using the public api and the extension gets the app id from the browser, you don’t need to sign in to an app to audit it. Just go to one of it’s pages.

1 Like