-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(console): initial tui for component-definition read (#608)
* feat!(tui): initial commit * chore(deps): update actions/upload-artifact action to v4.3.6 (#575) | datasource | package | from | to | | ----------- | ----------------------- | ------ | ------ | | github-tags | actions/upload-artifact | v4.3.4 | v4.3.6 | Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update module github.com/open-policy-agent/opa to v0.67.1 (#577) | datasource | package | from | to | | ---------- | -------------------------------- | ------- | ------- | | go | github.com/open-policy-agent/opa | v0.67.0 | v0.67.1 | Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Megan Wolf <[email protected]> * chore(deps): update github/codeql-action action to v3.26.0 (#582) | datasource | package | from | to | | ----------- | -------------------- | -------- | ------- | | github-tags | github/codeql-action | v3.25.15 | v3.26.0 | Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(generate): proposed transition of generation annotation to props (#574) * fix(generate): generation annotation in a prop * fix(generate): introduce framework flag to generate * chore(docs): add generation ns docs * feat(validation-result)!: bump to go-oscal v0.6.0 jsonschema v6 update (#544) * feat(validation-result)!: remove validation-result in favor of new go-oscal behavior chore(go-oscal): update w/ go-oscal jsonschema v6 changes * docs(reference): update jsonschema url, run go mod tidy to remove lingering jsonschemav5 inderect dep * test: update w/ current branch sha from go-oscal * chore(deps): bump go-oscal to v0.6.0 * fix(unit): cleanup whitespaces for composed artifact --------- Co-authored-by: Brandt Keller <[email protected]> * fix(validate): get non-namespace scoped resources (#585) * fix(validate): get non-namespace scoped resources * fix(validate): alternate cluster-scoped resource get, schema mods * fix: updated conditional statement * docs: updated k8s domain doc * chore(deps): update dependency commitlint to v19.4.0 (#583) | datasource | package | from | to | | ---------- | ---------- | ------ | ------ | | npm | commitlint | 19.3.0 | 19.4.0 | Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(docs): initial SSP generation research docs (#548) * feat: initial-ssp-generate-doc * updated some wording * split ssp docs, updated some assessment result spellings. * ssp doc updates * broke assessment results at somepoint * updated note location * chore(docs): minor adjustments to intent and terms * chore(docs): cleanup testing artifacts * chore(docs): fix typos and add to dict --------- Co-authored-by: Brandt Keller <[email protected]> Co-authored-by: Brandt Keller <[email protected]> * chore(main): release 0.5.0 (#578) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore(docs): update issue template with expected deliverables line item (#590) * chore(deps): update anchore/sbom-action action to v0.17.1 (#593) | datasource | package | from | to | | ----------- | ------------------- | ------- | ------- | | github-tags | anchore/sbom-action | v0.17.0 | v0.17.1 | Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update github/codeql-action action to v3.26.1 (#595) | datasource | package | from | to | | ----------- | -------------------- | ------- | ------- | | github-tags | github/codeql-action | v3.26.0 | v3.26.1 | Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(docs): updated namespace doc locations and associated prop namespace url (#602) * fix: updated ns docs, ns prop * fix: remove test file feat: more tui design feat: more tui design feat: more tui design feat: more tui design * fix: removed debug bin * fix: removed rest files * fix: removed rest files * fix: fixed test expectations * feat: tui sizing, fixes * feat: updated keybindings, help * docs: tui docs * docs: updated tui docs * fix: nil handling for empty control * fix: additional nil pointer errors * fix: renamed to console * docs: updated console docs, lula-config --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Brandt Keller <[email protected]> Co-authored-by: Cole (Mike) Winberry <[email protected]> Co-authored-by: Brandt Keller <[email protected]> Co-authored-by: Andy Mills <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
488cd91
commit a0338af
Showing
27 changed files
with
2,192 additions
and
8 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
title: lula console | ||
description: Lula CLI command reference for <code>lula console</code>. | ||
type: docs | ||
--- | ||
## lula console | ||
|
||
Console terminal user interface for OSCAL models | ||
|
||
### Synopsis | ||
|
||
|
||
The Lula Console is a text-based terminal user interface that allows users to | ||
interact with the OSCAL documents in a more intuitive and visual way. | ||
|
||
|
||
``` | ||
lula console [flags] | ||
``` | ||
|
||
### Examples | ||
|
||
``` | ||
To view an OSCAL model in the Console: | ||
lula console -f /path/to/oscal-component.yaml | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
-h, --help help for console | ||
-f, --input-file string the path to the target OSCAL model | ||
``` | ||
|
||
### Options inherited from parent commands | ||
|
||
``` | ||
-l, --log-level string Log level when running Lula. Valid options are: warn, info, debug, trace (default "info") | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [lula](/cli/cli-commands/lula/) - Risk Management as Code | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Console | ||
|
||
The Lula Console is a text-based terminal user interface that allows users to interact with the OSCAL documents in a more intuitive and visual way. | ||
|
||
See the sub-pages for more information on interacting with OSCAL models in the Console. | ||
|
||
>[!NOTE] | ||
>The Console is currently in development and is subject to change. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Component Definition | ||
|
||
The Component Definition view currently allows for a read-only experience of the OSCAL Component Definition model. The view is tailored to the usage of the Component Definition in the context of Lula, and is not intended to be a comprehensive view of the model. | ||
|
||
## Usage | ||
|
||
To view an OSCAL Component Definition model in the Console: | ||
```shell | ||
lula console -f /path/to/oscal-component.yaml | ||
``` | ||
|
||
## Keys | ||
|
||
The Component Definition model responds to the following keys for navigation and interaction: | ||
|
||
| Key | Description | | ||
|-----|-------------| | ||
| `?` | Toggle help | | ||
| `ctrl+c` | Quit | | ||
| `tab` | Tab right between models | | ||
| `shift+tab` | Tab left between models | | ||
| `←/h` | Navigate left in model| | ||
| `→/l` | Navigate right in model | | ||
| `↑/k` | Move up in list OR scroll up | | ||
| `↓/j` | Move down in list OR scroll down | | ||
| `/` | Filter list | | ||
| `↳` | Select item | | ||
| `esc` | Cancel | | ||
|
||
## View | ||
|
||
<img align="right" src="../../images/component-defn-console.gif" alt="component definition console" style="width:100%; height:auto;"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
log_level: debug | ||
log_level: info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package console | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/defenseunicorns/lula/src/internal/tui" | ||
"github.com/defenseunicorns/lula/src/pkg/common/oscal" | ||
"github.com/defenseunicorns/lula/src/pkg/message" | ||
"github.com/spf13/cobra" | ||
|
||
tea "github.com/charmbracelet/bubbletea" | ||
) | ||
|
||
type flags struct { | ||
InputFile string // -f --input-file | ||
} | ||
|
||
var opts = &flags{} | ||
|
||
var consoleHelp = ` | ||
To view an OSCAL model in the Console: | ||
lula console -f /path/to/oscal-component.yaml | ||
` | ||
|
||
var consoleLong = ` | ||
The Lula Console is a text-based terminal user interface that allows users to | ||
interact with the OSCAL documents in a more intuitive and visual way. | ||
` | ||
|
||
var consoleCmd = &cobra.Command{ | ||
Use: "console", | ||
Aliases: []string{"ui"}, | ||
Short: "Console terminal user interface for OSCAL models", | ||
Long: consoleLong, | ||
Example: consoleHelp, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
// Get the OSCAL model from the file | ||
data, err := os.ReadFile(opts.InputFile) | ||
if err != nil { | ||
message.Fatalf(err, "error reading file: %v", err) | ||
} | ||
oscalModel, err := oscal.NewOscalModel(data) | ||
if err != nil { | ||
message.Fatalf(err, "error creating oscal model from file: %v", err) | ||
} | ||
|
||
// Add debugging | ||
// TODO: need to integrate with the log file handled by messages | ||
if message.GetLogLevel() == message.DebugLevel { | ||
f, err := tea.LogToFile("debug.log", "debug") | ||
if err != nil { | ||
message.Fatalf(err, err.Error()) | ||
} | ||
defer f.Close() | ||
} | ||
|
||
p := tea.NewProgram(tui.NewOSCALModel(*oscalModel), tea.WithAltScreen(), tea.WithMouseCellMotion()) | ||
|
||
if _, err := p.Run(); err != nil { | ||
message.Fatalf(err, err.Error()) | ||
} | ||
}, | ||
} | ||
|
||
func ConsoleCommand() *cobra.Command { | ||
consoleCmd.Flags().StringVarP(&opts.InputFile, "input-file", "f", "", "the path to the target OSCAL model") | ||
consoleCmd.MarkFlagRequired("input-file") | ||
return consoleCmd | ||
} |
Oops, something went wrong.