OpenSite/Guides/Discover commands

From BathAfrica Documentation
Jump to navigation Jump to search
OpenSite 0.0.1 · DevelopmentSource scope and availability


List registered command names and execute one documented read-only setting query.

Stable identifier
opensite.help.discover-commands

Prerequisites

An embedded OpenSite host. A command listing is metadata, not proof that every command is available or authorized.

Steps

List the registry

Use opensite.commands() in Python, or opensite-cli commands in a terminal.

Inspect an entry

Use opensite-cli commands show opensite.document.set_quantity to inspect its descriptor. Check arguments, version and capability before executing it.

Run a small read operation

Read locale.language using settings.get. Preserve the returned field rather than guessing text formatting.

Handle availability

Unknown, unavailable and unauthorized are different failures. Listing a plugin descriptor does not necessarily load the plugin.

Expected result

Document/material command names are printed and the language setting is returned.

Limitations

The development CLI’s allow-all policy is not a production account entitlement. Ordinary local workspace operations and protected engineering capabilities have different policy rules.

Complete example

import opensite

commands = opensite.commands()
for name in sorted(commands):
    if "material" in name or "document" in name:
        print(name)
language = opensite.execute("settings.get", {"key": "locale.language"})
print("Language setting:", language["value"])