Skip to main content

Investigate your Knack.app's metadata to find where data objects and fields are used throughout your application

Project description

KnackSleuth

Detective work for your Knack applications. 🕵️

KnackSleuth investigates your Knack app metadata to uncover where objects, fields, and connections are used throughout your application. Like a good detective, it traces every lead—from data relationships and view dependencies to hidden references in formulas and filters.

Whether you're refactoring a complex app, auditing data dependencies, or trying to understand the ripple effects of a schema change, KnackSleuth does the investigative work so you don't have to.

Installation

Using uvx (Recommended)

Run KnackSleuth without installation using uvx:

uvx knack-sleuth --help

Install with uv

Install as a tool with uv:

uv tool install knack-sleuth
knack-sleuth --help

Install with pip

pip install knack-sleuth
knack-sleuth --help

Usage

Note: If you haven't installed knack-sleuth, replace knack-sleuth with uvx knack-sleuth in the examples below.

Download Metadata

Download and save your Knack application metadata to a local file:

# Download with default filename ({APP_ID}_metadata.json)
knack-sleuth download-metadata

# Specify custom filename
knack-sleuth download-metadata my_app_backup.json

# Force fresh download (ignore cache)
knack-sleuth download-metadata --refresh

This is useful for:

  • Creating backups of your app structure
  • Working offline with the metadata
  • Sharing app structure with others
  • Version control / tracking changes over time

The file is saved as formatted JSON (indented) for easy reading and version control.

Show Object Coupling

View the coupling relationships for a specific object - see which objects depend on it and which objects it depends on:

# Using object key
knack-sleuth show-coupling object_12 path/to/knack_export.json

# Using object name
knack-sleuth show-coupling "Object Name" path/to/knack_export.json

# From API
knack-sleuth show-coupling object_34 --app-id YOUR_APP_ID

This displays:

  • Afferent Coupling (Ca): Objects that depend on this object (incoming connections with ← arrows)
  • Efferent Coupling (Ce): Objects this object depends on (outgoing connections with → arrows)
  • Connection details: field names, keys, and relationship types

Perfect for understanding an object's role in your data model from its perspective.

List All Objects

Get an overview of all objects in your Knack application:

# Using a local JSON file
knack-sleuth list-objects path/to/knack_export.json

# Fetching from API
knack-sleuth list-objects --app-id YOUR_APP_ID

# Using environment variables
knack-sleuth list-objects

# Sort by row count (largest first)
knack-sleuth list-objects --sort-by-rows path/to/knack_export.json

This displays a table showing:

  • Object key and name
  • Number of rows (records) in each object
  • Number of fields in each object
  • Ca (Afferent coupling): Number of inbound connections - how many other objects depend on this one
  • Ce (Efferent coupling): Number of outbound connections - how many other objects this one depends on
  • Total connections (Ca + Ce)

Sorting:

  • Default: Alphabetically by object name
  • --sort-by-rows: Sort by row count (largest first) to quickly identify your biggest tables

Coupling Insights:

  • High Ca, Low Ce = Hub/core objects that many others depend on (stable, reusable)
  • Low Ca, High Ce = Highly coupled objects with many dependencies (potentially fragile)
  • High Ca + High Ce = Central, complex objects (review for potential refactoring)

Search for Object Usages

Search for all places where an object is used in your Knack application.

Using a Local JSON File

# Search by object key
knack-sleuth search-object object_12 path/to/knack_export.json

# Search by object name
knack-sleuth search-object "Object Name" path/to/knack_export.json

# Hide field-level usages (show only object-level)
knack-sleuth search-object object_12 path/to/knack_export.json --no-fields

Fetching from Knack API

You can fetch metadata directly from the Knack API instead of using a local file:

# Using command-line options
knack-sleuth search-object object_12 --app-id YOUR_APP_ID

# Using environment variables
export KNACK_APP_ID=your_app_id
knack-sleuth search-object object_12

# Or use a .env file in the project root:
# KNACK_APP_ID=your_app_id
knack-sleuth search-object object_12

# Force refresh cached data (ignore cache)
knack-sleuth search-object object_12 --refresh

Caching Behavior:

  • API responses are automatically cached to {APP_ID}_app_metadata_{YYYYMMDDHHMM}.json
  • Cached data is reused for 24 hours to avoid unnecessary API calls
  • Use --refresh to force fetching fresh data from the API
  • Cache files are stored in the current working directory

The command will show:

  • Object-level usages: Where the object appears in connections, views, and other metadata
  • Field-level usages: Where each field is used (columns, sorts, formulas, etc.) - can be disabled with --no-fields
  • Builder Pages to Review: Direct links to scenes in the Knack builder where this object is used

Builder Integration

The search results include clickable links to the Knack builder pages where the object is used:

# Classic builder URLs (default)
export KNACK_NEXT_GEN_BUILDER=false
knack-sleuth search-object object_12
# → https://builder.knack.com/your-account/portal/pages/scene_7

# Next-Gen builder URLs
export KNACK_NEXT_GEN_BUILDER=true
knack-sleuth search-object object_12
# → https://builder-next.knack.com/your-account/portal/pages/scene_7

Options

  • --app-id TEXT: Knack application ID (or use KNACK_APP_ID env var)
  • --refresh: Force refresh cached API data (ignore 24-hour cache)
  • --show-fields / --no-fields: Control whether to show field-level usages (default: show)
  • --help: Show help message

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

knack_sleuth-0.1.7.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

knack_sleuth-0.1.7-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file knack_sleuth-0.1.7.tar.gz.

File metadata

  • Download URL: knack_sleuth-0.1.7.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for knack_sleuth-0.1.7.tar.gz
Algorithm Hash digest
SHA256 1e5e6309b15ae6d847c34a6b0e7dce25cf76a752f22103a874c519d9bb5b3fe5
MD5 1920a643b6b679ddb9054e1ae4eb774b
BLAKE2b-256 8aecfce70a16110a64cf0585429fdc4728345da6ae1bf11d1ebfb62867dbc0da

See more details on using hashes here.

Provenance

The following attestation bundles were made for knack_sleuth-0.1.7.tar.gz:

Publisher: publish.yml on mcmasty/knack-sleuth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file knack_sleuth-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: knack_sleuth-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for knack_sleuth-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 cde7f5c52d2c2da9ce65a2605b4b301d7803402e2e5acd2feba951f9a944fe3c
MD5 1b9476048f1763a357b22f2792a55fdd
BLAKE2b-256 c342090291dfa029f6f74da217e24bb09a0a21c29670be87341f4d4555d23f40

See more details on using hashes here.

Provenance

The following attestation bundles were made for knack_sleuth-0.1.7-py3-none-any.whl:

Publisher: publish.yml on mcmasty/knack-sleuth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page