Skip to content

ogma-cli: Add search command. Refs #464.#465

Merged
ivanperez-keera merged 5 commits into
nasa:developfrom
ivanperez-keera:develop-search
Jun 29, 2026
Merged

ogma-cli: Add search command. Refs #464.#465
ivanperez-keera merged 5 commits into
nasa:developfrom
ivanperez-keera:develop-search

Conversation

@ivanperez-keera

Copy link
Copy Markdown
Member

Add search command to ogma-core and expose in ogma-cli, as prescribed in the solution proposed for #464.

@ivanperez-keera ivanperez-keera force-pushed the develop-search branch 2 times, most recently from 63639c1 to 01bc1ac Compare June 29, 2026 10:03
As Ogma becomes used with larger projects, it is useful to add a search
command shows a list of all requirements and models that match a given
query.

This commit adds a new Search command to `ogma-core` that find a given
query in the input files and produces a list with the requirements or
diagrams that match the search query.
As Ogma becomes used with larger projects, it is useful to add a search
command shows a list of all requirements and models that match a given
query.

A prior commit added a new Search command to `ogma-core` that lists all
requirements and diagrams that match a given search query.

This commit exposes the command to the user in the CLI.
As Ogma becomes used with larger projects, it is useful to add a search
command shows a list of all requirements and models that match a given
query.

Prior commits added a `search` command to `ogma-cli`.

This commit updates the documentation accordingly.
@ivanperez-keera

Copy link
Copy Markdown
Member Author

Change Manager: Verified that:

  • Solution is implemented:
    • The code proposed compiles and passes all tests. Details:
    • The solution proposed produces the expected result. Details:
      The following Dockerfile uses the new search command to search for information in a project, after which it prints the message "Success":
      --- Dockerfile-verify-464
      FROM ubuntu:focal
      
      ENV DEBIAN_FRONTEND=noninteractive
      
      RUN apt-get update
      
      RUN apt-get install --yes software-properties-common
      RUN add-apt-repository ppa:hvr/ghc
      RUN apt-get update
      
      RUN apt-get install --yes ghc-8.10.4 cabal-install-2.4
      RUN apt-get install --yes libz-dev libbz2-dev libexpat-dev git g++ z3
      
      ENV PATH=/opt/ghc/8.10.4/bin:/opt/cabal/2.4/bin:/root/.cabal-sandbox/bin:$PATH
      
      WORKDIR /root/
      
      RUN cabal update
      RUN cabal v1-sandbox init
      RUN cabal v1-install alex happy
      RUN cabal v1-install BNFC
      RUN cabal v1-install copilot
      
      ADD extra-vars-state-example.json /tmp/
      ADD variables-state-example /tmp/
      ADD db-state-example.json /tmp/
      ADD project.ogma /tmp/
      
      SHELL ["/bin/bash", "-c"]
      
      CMD git clone $REPO \
        && pushd $NAME \
        && git checkout $COMMIT \
        && popd \
        && cabal v1-install --force-reinstalls $NAME/ogma-**/ \
        && cabal v1-exec -- ogma search --query "input" --project /tmp/project.ogma \
        && echo "Success"
      
      --- extra-vars-state-example.json
      { "copilot_extra_defs": [
          "input :: Stream Word32",
          "input = extern \"input\" Nothing"
          ]
      , "impl_extra_header": "#include \"extra.h\""
      }
      
      --- variables-state-example
      input
      
      --- db-state-example.json
      { "inputs":
           [ { "name": "input"
             , "type": "uint32_t"
             , "connections":
                 [ { "scope": "cfs"
                   , "topic": "SAMPLE_MID"
                   , "field": "payload"
                   }
                 , { "scope": "ros/message"
                   , "topic": "/ros2/example1"
                   }
                 ]
             }
           ]
      , "topics":
           [ { "scope": "cfs"
             , "topic": "SAMPLE_MID"
             , "type":  "sample_msg_t"
             }
           , { "scope": "ros/message"
             , "topic": "/ros2/example1"
             , "type":  "std_msgs::msg::UInt32"
             }
           ]
      , "types": [
             { "fromScope": "cfs"
             , "fromType":  "sample_msg_t"
             , "fromField": "payload"
             , "toScope":   "C"
             , "toType":    "uint32_t"
             }
           ]
      }
      
      --- project.ogma
      {
        "projectName": "Demo",
        "projectInputFiles": [
          [
            "ogma/ogma-cli/examples/diagram-001-hello-ogma/diagram-copilot.dot",
            "dot",
            "literal"
          ]
        ],
        "projectVariableFiles": "/tmp/variables-state-example",
        "projectVariableDBFile": "/tmp/db-state-example.json",
        "projectHandlerFile": null,
        "projectCommandPropVia": null,
        "projectTemplateDir": null,
        "projectTargetDir": null,
        "projectExtraJSONFile": "/tmp/extra-vars-state-example.json"
      }
      
      Command (substitute variables based on new path after merge):
      $ docker run -e "REPO=https://github.com/ivanperez-keera/ogma" -e "NAME=ogma" -e "COMMIT=70f740ab5aab78b4029a6d577a86476a3322afb3" -it ogma-verify-464
      
  • Implementation is documented. Details:
    The new modules and top-level definitions are documented. The Cabal package description is updated to match.
  • Change history is clear.
  • Commit messages are clear.
  • Changelogs are updated.
  • Examples are updated. Details:
    No updates needed; change adds command but does not affect existing examples.
  • Author is internal or has provided signed CLA.
  • Required version bumps are evaluated. Details:
    Bump not needed; this PR extends the API, but does not alter existing functions or definitions.

@ivanperez-keera ivanperez-keera merged commit 0ab558e into nasa:develop Jun 29, 2026
6 checks passed
@ivanperez-keera ivanperez-keera deleted the develop-search branch June 29, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant