Skip to content

Support scripts section in entity manifest for manifest-defined ScriptEntryConfig #303

@bburda

Description

@bburda

Summary

DefaultScriptProvider supports manifest-defined scripts via ScriptsConfig.entries, but there is no way to populate these entries from configuration. The entries vector is always empty unless populated programmatically in C++.

The entity manifest (sensor_manifest.yaml, turtlebot3_manifest.yaml, etc.) already defines the full entity hierarchy (areas, components, apps, functions) via ManifestParser. Scripts should be loadable from the same manifest file as a new top-level section.


Proposed solution

Extend the entity manifest YAML with an optional scripts: section:

# In sensor_manifest.yaml (alongside existing areas/components/apps/functions)
scripts:
  - id: "run-diagnostics"
    name: "Run Diagnostics"
    description: "Check health of all sensors"
    path: "/opt/scripts/run-diagnostics.sh"
    format: "bash"
    timeout_sec: 30
    entity_filter: ["compute-unit"]
    env:
      GATEWAY_URL: "http://localhost:8080"
  - id: "inject-nan"
    name: "Inject NaN Fault"
    description: "Enable NaN values on all sensors"
    path: "/opt/scripts/inject-nan.sh"
    format: "bash"
    timeout_sec: 30
    entity_filter: ["compute-unit"]

Implementation scope:

  1. Add parse_scripts() to ManifestParser - parse scripts: section into std::vector<ScriptEntryConfig>
  2. Extend Manifest struct with scripts field
  3. In gateway_node.cpp, after manifest parsing, populate scripts_config.entries from manifest.scripts
  4. Scripts loaded from manifest are managed: true (immutable, not deletable via API)
  5. Unit tests for script manifest parsing
  6. Update manifest documentation with scripts section reference

This follows the existing pattern - ManifestParser already uses yaml-cpp and parses Areas/Components/Apps/Functions. Adding scripts is a natural extension.


Additional context

Needed for selfpatch/selfpatch_demos#42 (Scripts API demo integration). All three demos need manifest-defined scripts to showcase the Scripts API feature.

Currently ScriptsConfig.entries fields per entry: id, name, description, path, format, timeout_sec, entity_filter (string vector), env (string map), args (JSON array), parameters_schema (optional JSON).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions