publish_rule
Publish compliance rules to activate them for control attachment and organizational use within the ComplianceCow platform.
Instructions
Publish a rule to make it available for ComplianceCow system.
CRITICAL WORKFLOW RULES:
MANDATORY: Check rule status to ensure rule is fully developed before publishing
MUST FOLLOW THESE STEPS EXACTLY
DO NOT ASSUME OR SKIP ANY STEPS
APPLICATIONS FIRST, THEN RULE
WAIT FOR USER AT EACH STEP
NO SHORTCUTS OR BYPASSING ALLOWED
RULE PUBLISHING HANDLING:
WHEN TO USE:
After successful rule creation
User wants to make rule available for others
Rule has been tested and validated
WORKFLOW (step-by-step with user confirmation):
Fetch applications and check status
Call fetch_applications() to get available applications
Extract appTypes from ALL tasks in rule spec.tasks[].appTags.appType - MUST TAKE ALL THE TASKS APPTYPE AND REMOVE DUPLICATES - CRITICAL: DO NOT SKIP ANY TASK APPTYPES
Match ALL task appTypes with applications app_type to get application_class_name
Call check_applications_publish_status() for ALL matched applications
Present consolidated applications with meaningful format Applications for your rule: [1] App Name | Type: xyz | Status: Published | Action: Republish [2] App Name | Type: abc | Status: Not Published | Action: Publish
Select applications to publish: ___
MANDATORY: WAIT for user selection before proceeding to next step
DO NOT CONTINUE without explicit user input
BLOCK execution until user provides selection
STOP HERE: Cannot proceed to step 3 without user response
HALT WORKFLOW: Wait for user to select application numbers
NEVER SKIP THIS STEP: User must select applications first
ALWAYS ASK FOR SELECTION EVEN IF ALL APPLICATIONS ARE PUBLISHED
Publish selected applications (BLOCKED until step 2 complete)
ENTRY REQUIREMENT: User selection from step 2 must be provided
PREREQUISITE CHECK: Verify user provided application numbers
CANNOT EXECUTE: Without completing step 2 user selection
Get user selection numbers
Call publish_application() for selected applications only
Inform user whether successfully published or not
CHECKPOINT: All applications must be published before rule steps
Check rule publication status (APPLICATIONS MUST BE COMPLETE FIRST)
GATE KEEPER: Cannot proceed without application publishing completion
MANDATORY PREREQUISITE: All application steps finished
BLOCKED ACCESS: No rule operations until applications handled
Call check_rule_publish_status()
Check response valid field:
True = Already published
False = Not published
Handle rule publishing based on status If valid=False (not published):
Show: "Rule is not published. Do you want to publish it? (yes/no)"
If yes: Proceed with publishing using current name
If valid=True (already published):
Show: "Rule is already published. Choose option:"
[1] Republish with same name
[2] Publish with another name
Get user choice
Handle alternative name logic If "another name" chosen:
Ask: "Enter new rule name: ___"
Call check_rule_publish_status(new_name)
If name exists: "Name already exists. Choose option:"
[1] Use same name (republish)
[2] Enter another name
If name available: Proceed with new name
Keep checking until user chooses available name or decides to republish existing
Final publication
Call publish_rule() with confirmed name
Inform user: "Published successfully" or "Publication failed"
Rule Association:
Publishes the rule to make it available for control attachment
Ask user: "Do you want to attach this rule to a ComplianceCow control? (yes/no)"
If yes: Proceed to associate the rule with control and request assessment name and control alias from the user
If no: End workflow
EXECUTION CONTROL MECHANISMS:
STEP GATE: Each step requires completion before next
USER GATE: Each step requires user input/confirmation
EXECUTION BLOCKER: No tool calls without user response
WORKFLOW ENFORCER: Steps cannot be skipped or assumed
SEQUENTIAL LOCK: Must complete in exact order
Args: rule_name: Name of the rule to publish cc_rule_name: Optional alternative name for publishing
Returns: Dict with publication status and details
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rule_name | Yes | ||
| cc_rule_name | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||