Add CMMI maturity level to compliance controls
Adds an optional CMMI 0-5 maturity level field to Control to support ISO 27001 clause 9.1 effectiveness measurement and HITRUST CSF maturity requirements. The field is nullable, framework-agnostic, and exposed across all four API surfaces (GraphQL, MCP, CLI, n8n) plus the generated SoA document. Signed-off-by: Alejandro Juan <alejandrojuan@alejandrojuan.com>
This commit is contained in:
committed by
Sacha Al Himdani
parent
98487953b9
commit
da91afc2a7
@@ -35,12 +35,22 @@ mutation($input: CreateControlInput!) {
|
||||
bestPractice
|
||||
implemented
|
||||
notImplementedJustification
|
||||
maturityLevel
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var maturityLevelValues = []string{
|
||||
"NONE",
|
||||
"INITIAL",
|
||||
"MANAGED",
|
||||
"DEFINED",
|
||||
"QUANTITATIVELY_MANAGED",
|
||||
"OPTIMIZING",
|
||||
}
|
||||
|
||||
type createResponse struct {
|
||||
CreateControl struct {
|
||||
ControlEdge struct {
|
||||
@@ -52,6 +62,7 @@ type createResponse struct {
|
||||
BestPractice bool `json:"bestPractice"`
|
||||
Implemented string `json:"implemented"`
|
||||
NotImplementedJustification *string `json:"notImplementedJustification"`
|
||||
MaturityLevel *string `json:"maturityLevel"`
|
||||
} `json:"node"`
|
||||
} `json:"controlEdge"`
|
||||
} `json:"createControl"`
|
||||
@@ -66,6 +77,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
flagBestPractice bool
|
||||
flagNotImplemented bool
|
||||
flagNotImplementedJustification string
|
||||
flagMaturityLevel string
|
||||
)
|
||||
|
||||
cmd := &cobra.Command{
|
||||
@@ -114,6 +126,13 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
input["notImplementedJustification"] = flagNotImplementedJustification
|
||||
}
|
||||
|
||||
if flagMaturityLevel != "" {
|
||||
if err := cmdutil.ValidateEnum("maturity-level", flagMaturityLevel, maturityLevelValues); err != nil {
|
||||
return err
|
||||
}
|
||||
input["maturityLevel"] = flagMaturityLevel
|
||||
}
|
||||
|
||||
data, err := client.Do(
|
||||
createMutation,
|
||||
map[string]any{"input": input},
|
||||
@@ -146,6 +165,7 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd.Flags().BoolVar(&flagBestPractice, "best-practice", false, "Mark as best practice")
|
||||
cmd.Flags().BoolVar(&flagNotImplemented, "not-implemented", false, "Mark as not implemented")
|
||||
cmd.Flags().StringVar(&flagNotImplementedJustification, "not-implemented-justification", "", "Justification for non-implementation")
|
||||
cmd.Flags().StringVar(&flagMaturityLevel, "maturity-level", "", "CMMI maturity level (NONE, INITIAL, MANAGED, DEFINED, QUANTITATIVELY_MANAGED, OPTIMIZING)")
|
||||
|
||||
_ = cmd.MarkFlagRequired("framework")
|
||||
_ = cmd.MarkFlagRequired("section-title")
|
||||
|
||||
@@ -37,6 +37,8 @@ query($id: ID!, $first: Int, $after: CursorKey, $orderBy: ControlOrder, $filter:
|
||||
name
|
||||
description
|
||||
bestPractice
|
||||
implemented
|
||||
maturityLevel
|
||||
}
|
||||
}
|
||||
pageInfo {
|
||||
@@ -50,11 +52,13 @@ query($id: ID!, $first: Int, $after: CursorKey, $orderBy: ControlOrder, $filter:
|
||||
`
|
||||
|
||||
type control struct {
|
||||
ID string `json:"id"`
|
||||
SectionTitle string `json:"sectionTitle"`
|
||||
Name string `json:"name"`
|
||||
Description *string `json:"description"`
|
||||
BestPractice bool `json:"bestPractice"`
|
||||
ID string `json:"id"`
|
||||
SectionTitle string `json:"sectionTitle"`
|
||||
Name string `json:"name"`
|
||||
Description *string `json:"description"`
|
||||
BestPractice bool `json:"bestPractice"`
|
||||
Implemented string `json:"implemented"`
|
||||
MaturityLevel *string `json:"maturityLevel"`
|
||||
}
|
||||
|
||||
func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -163,15 +167,20 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if c.BestPractice {
|
||||
bp = "Yes"
|
||||
}
|
||||
maturity := "-"
|
||||
if c.MaturityLevel != nil {
|
||||
maturity = *c.MaturityLevel
|
||||
}
|
||||
rows = append(rows, []string{
|
||||
c.ID,
|
||||
c.SectionTitle,
|
||||
c.Name,
|
||||
bp,
|
||||
maturity,
|
||||
})
|
||||
}
|
||||
|
||||
t := cmdutil.NewTable("ID", "SECTION", "NAME", "BEST PRACTICE").Rows(rows...)
|
||||
t := cmdutil.NewTable("ID", "SECTION", "NAME", "BEST PRACTICE", "MATURITY").Rows(rows...)
|
||||
|
||||
_, _ = fmt.Fprintln(f.IOStreams.Out, t)
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ mutation($input: UpdateControlInput!) {
|
||||
bestPractice
|
||||
implemented
|
||||
notImplementedJustification
|
||||
maturityLevel
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,10 +50,20 @@ type updateResponse struct {
|
||||
BestPractice bool `json:"bestPractice"`
|
||||
Implemented string `json:"implemented"`
|
||||
NotImplementedJustification *string `json:"notImplementedJustification"`
|
||||
MaturityLevel *string `json:"maturityLevel"`
|
||||
} `json:"control"`
|
||||
} `json:"updateControl"`
|
||||
}
|
||||
|
||||
var maturityLevelValues = []string{
|
||||
"NONE",
|
||||
"INITIAL",
|
||||
"MANAGED",
|
||||
"DEFINED",
|
||||
"QUANTITATIVELY_MANAGED",
|
||||
"OPTIMIZING",
|
||||
}
|
||||
|
||||
func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
var (
|
||||
flagSectionTitle string
|
||||
@@ -61,6 +72,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
flagBestPractice bool
|
||||
flagNotImplemented bool
|
||||
flagNotImplementedJustification string
|
||||
flagMaturityLevel string
|
||||
)
|
||||
|
||||
cmd := &cobra.Command{
|
||||
@@ -120,6 +132,16 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
input["notImplementedJustification"] = flagNotImplementedJustification
|
||||
}
|
||||
}
|
||||
if cmd.Flags().Changed("maturity-level") {
|
||||
if flagMaturityLevel == "" {
|
||||
input["maturityLevel"] = nil
|
||||
} else {
|
||||
if err := cmdutil.ValidateEnum("maturity-level", flagMaturityLevel, maturityLevelValues); err != nil {
|
||||
return err
|
||||
}
|
||||
input["maturityLevel"] = flagMaturityLevel
|
||||
}
|
||||
}
|
||||
|
||||
if len(input) == 1 {
|
||||
return fmt.Errorf("at least one field must be specified for update")
|
||||
@@ -156,6 +178,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd.Flags().BoolVar(&flagBestPractice, "best-practice", false, "Mark as best practice")
|
||||
cmd.Flags().BoolVar(&flagNotImplemented, "not-implemented", false, "Mark as not implemented")
|
||||
cmd.Flags().StringVar(&flagNotImplementedJustification, "not-implemented-justification", "", "Justification for non-implementation")
|
||||
cmd.Flags().StringVar(&flagMaturityLevel, "maturity-level", "", "CMMI maturity level (NONE, INITIAL, MANAGED, DEFINED, QUANTITATIVELY_MANAGED, OPTIMIZING). Empty string clears the value.")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ query($id: ID!) {
|
||||
name
|
||||
description
|
||||
bestPractice
|
||||
implemented
|
||||
notImplementedJustification
|
||||
maturityLevel
|
||||
framework {
|
||||
id
|
||||
name
|
||||
@@ -47,13 +50,16 @@ query($id: ID!) {
|
||||
|
||||
type viewResponse struct {
|
||||
Node *struct {
|
||||
Typename string `json:"__typename"`
|
||||
ID string `json:"id"`
|
||||
SectionTitle string `json:"sectionTitle"`
|
||||
Name string `json:"name"`
|
||||
Description *string `json:"description"`
|
||||
BestPractice bool `json:"bestPractice"`
|
||||
Framework struct {
|
||||
Typename string `json:"__typename"`
|
||||
ID string `json:"id"`
|
||||
SectionTitle string `json:"sectionTitle"`
|
||||
Name string `json:"name"`
|
||||
Description *string `json:"description"`
|
||||
BestPractice bool `json:"bestPractice"`
|
||||
Implemented string `json:"implemented"`
|
||||
NotImplementedJustification *string `json:"notImplementedJustification"`
|
||||
MaturityLevel *string `json:"maturityLevel"`
|
||||
Framework struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"framework"`
|
||||
@@ -138,6 +144,16 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
||||
bp = "Yes"
|
||||
}
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Best Practice:"), bp)
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Implemented:"), c.Implemented)
|
||||
if c.Implemented == "NOT_IMPLEMENTED" && c.NotImplementedJustification != nil && *c.NotImplementedJustification != "" {
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Justification:"), *c.NotImplementedJustification)
|
||||
}
|
||||
|
||||
maturity := "Not set"
|
||||
if c.MaturityLevel != nil {
|
||||
maturity = *c.MaturityLevel
|
||||
}
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Maturity:"), maturity)
|
||||
|
||||
_, _ = fmt.Fprintln(out)
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Created:"), cmdutil.FormatTime(c.CreatedAt))
|
||||
|
||||
Reference in New Issue
Block a user