Update configuration files, templates, and internal documentation for the provisioning repository system. Configuration Updates: - KMS configuration modernization - Plugin system settings - Service port mappings - Test cluster topologies - Installation configuration examples - VM configuration defaults - Cedar authorization policies Documentation Updates: - Library module documentation - Extension API guides - AI system documentation - Service management guides - Test environment setup - Plugin usage guides - Validator configuration documentation All changes are backward compatible.
744 lines
32 KiB
HTML
744 lines
32 KiB
HTML
<!DOCTYPE HTML>
|
||
<html lang="en" class="ayu sidebar-visible" dir="ltr">
|
||
<head>
|
||
<!-- Book generated using mdBook -->
|
||
<meta charset="UTF-8">
|
||
<title>KCL Guidelines Implementation - Provisioning Platform Documentation</title>
|
||
|
||
|
||
<!-- Custom HTML head -->
|
||
|
||
<meta name="description" content="Complete documentation for the Provisioning Platform - Infrastructure automation with Nushell, KCL, and Rust">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<meta name="theme-color" content="#ffffff">
|
||
|
||
<link rel="icon" href="../../favicon.svg">
|
||
<link rel="shortcut icon" href="../../favicon.png">
|
||
<link rel="stylesheet" href="../../css/variables.css">
|
||
<link rel="stylesheet" href="../../css/general.css">
|
||
<link rel="stylesheet" href="../../css/chrome.css">
|
||
<link rel="stylesheet" href="../../css/print.css" media="print">
|
||
|
||
<!-- Fonts -->
|
||
<link rel="stylesheet" href="../../FontAwesome/css/font-awesome.css">
|
||
<link rel="stylesheet" href="../../fonts/fonts.css">
|
||
|
||
<!-- Highlight.js Stylesheets -->
|
||
<link rel="stylesheet" id="highlight-css" href="../../highlight.css">
|
||
<link rel="stylesheet" id="tomorrow-night-css" href="../../tomorrow-night.css">
|
||
<link rel="stylesheet" id="ayu-highlight-css" href="../../ayu-highlight.css">
|
||
|
||
<!-- Custom theme stylesheets -->
|
||
|
||
|
||
<!-- Provide site root and default themes to javascript -->
|
||
<script>
|
||
const path_to_root = "../../";
|
||
const default_light_theme = "ayu";
|
||
const default_dark_theme = "navy";
|
||
</script>
|
||
<!-- Start loading toc.js asap -->
|
||
<script src="../../toc.js"></script>
|
||
</head>
|
||
<body>
|
||
<div id="mdbook-help-container">
|
||
<div id="mdbook-help-popup">
|
||
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
|
||
<div>
|
||
<p>Press <kbd>←</kbd> or <kbd>→</kbd> to navigate between chapters</p>
|
||
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
|
||
<p>Press <kbd>?</kbd> to show this help</p>
|
||
<p>Press <kbd>Esc</kbd> to hide this help</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="body-container">
|
||
<!-- Work around some values being stored in localStorage wrapped in quotes -->
|
||
<script>
|
||
try {
|
||
let theme = localStorage.getItem('mdbook-theme');
|
||
let sidebar = localStorage.getItem('mdbook-sidebar');
|
||
|
||
if (theme.startsWith('"') && theme.endsWith('"')) {
|
||
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
|
||
}
|
||
|
||
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
|
||
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
|
||
}
|
||
} catch (e) { }
|
||
</script>
|
||
|
||
<!-- Set the theme before any content is loaded, prevents flash -->
|
||
<script>
|
||
const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme;
|
||
let theme;
|
||
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
|
||
if (theme === null || theme === undefined) { theme = default_theme; }
|
||
const html = document.documentElement;
|
||
html.classList.remove('ayu')
|
||
html.classList.add(theme);
|
||
html.classList.add("js");
|
||
</script>
|
||
|
||
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
|
||
|
||
<!-- Hide / unhide sidebar before it is displayed -->
|
||
<script>
|
||
let sidebar = null;
|
||
const sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
|
||
if (document.body.clientWidth >= 1080) {
|
||
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
|
||
sidebar = sidebar || 'visible';
|
||
} else {
|
||
sidebar = 'hidden';
|
||
}
|
||
sidebar_toggle.checked = sidebar === 'visible';
|
||
html.classList.remove('sidebar-visible');
|
||
html.classList.add("sidebar-" + sidebar);
|
||
</script>
|
||
|
||
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
|
||
<!-- populated by js -->
|
||
<mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
|
||
<noscript>
|
||
<iframe class="sidebar-iframe-outer" src="../../toc.html"></iframe>
|
||
</noscript>
|
||
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
|
||
<div class="sidebar-resize-indicator"></div>
|
||
</div>
|
||
</nav>
|
||
|
||
<div id="page-wrapper" class="page-wrapper">
|
||
|
||
<div class="page">
|
||
<div id="menu-bar-hover-placeholder"></div>
|
||
<div id="menu-bar" class="menu-bar sticky">
|
||
<div class="left-buttons">
|
||
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
|
||
<i class="fa fa-bars"></i>
|
||
</label>
|
||
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
|
||
<i class="fa fa-paint-brush"></i>
|
||
</button>
|
||
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
|
||
<li role="none"><button role="menuitem" class="theme" id="default_theme">Auto</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
|
||
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
|
||
</ul>
|
||
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
|
||
<i class="fa fa-search"></i>
|
||
</button>
|
||
</div>
|
||
|
||
<h1 class="menu-title">Provisioning Platform Documentation</h1>
|
||
|
||
<div class="right-buttons">
|
||
<a href="../../print.html" title="Print this book" aria-label="Print this book">
|
||
<i id="print-button" class="fa fa-print"></i>
|
||
</a>
|
||
<a href="https://github.com/provisioning/provisioning-platform" title="Git repository" aria-label="Git repository">
|
||
<i id="git-repository-button" class="fa fa-github"></i>
|
||
</a>
|
||
<a href="https://github.com/provisioning/provisioning-platform/edit/main/provisioning/docs/src/development/kcl/KCL_GUIDELINES_IMPLEMENTATION.md" title="Suggest an edit" aria-label="Suggest an edit">
|
||
<i id="git-edit-button" class="fa fa-edit"></i>
|
||
</a>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div id="search-wrapper" class="hidden">
|
||
<form id="searchbar-outer" class="searchbar-outer">
|
||
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
|
||
</form>
|
||
<div id="searchresults-outer" class="searchresults-outer hidden">
|
||
<div id="searchresults-header" class="searchresults-header"></div>
|
||
<ul id="searchresults">
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
|
||
<script>
|
||
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
|
||
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
|
||
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
|
||
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
|
||
});
|
||
</script>
|
||
|
||
<div id="content" class="content">
|
||
<main>
|
||
<h1 id="kcl-guidelines-implementation-summary"><a class="header" href="#kcl-guidelines-implementation-summary">KCL Guidelines Implementation Summary</a></h1>
|
||
<p><strong>Date</strong>: 2025-10-03
|
||
<strong>Status</strong>: ✅ Complete
|
||
<strong>Purpose</strong>: Consolidate KCL rules and patterns for the provisioning project</p>
|
||
<hr />
|
||
<h2 id="-what-was-created"><a class="header" href="#-what-was-created">📋 What Was Created</a></h2>
|
||
<h3 id="1-comprehensive-kcl-patterns-guide"><a class="header" href="#1-comprehensive-kcl-patterns-guide">1. <strong>Comprehensive KCL Patterns Guide</strong></a></h3>
|
||
<p><strong>File</strong>: <code>.claude/kcl_idiomatic_patterns.md</code> (1,082 lines)</p>
|
||
<p><strong>Contents</strong>:</p>
|
||
<ul>
|
||
<li><strong>10 Fundamental Rules</strong> - Core principles for KCL development</li>
|
||
<li><strong>19 Design Patterns</strong> - Organized by category:
|
||
<ul>
|
||
<li>Module Organization (3 patterns)</li>
|
||
<li>Schema Design (5 patterns)</li>
|
||
<li>Validation (3 patterns)</li>
|
||
<li>Testing (2 patterns)</li>
|
||
<li>Performance (2 patterns)</li>
|
||
<li>Documentation (2 patterns)</li>
|
||
<li>Security (2 patterns)</li>
|
||
</ul>
|
||
</li>
|
||
<li><strong>6 Anti-Patterns</strong> - Common mistakes to avoid</li>
|
||
<li><strong>Quick Reference</strong> - DOs and DON’Ts</li>
|
||
<li><strong>Project Conventions</strong> - Naming, aliases, structure</li>
|
||
<li><strong>Security Patterns</strong> - Secure defaults, secret handling</li>
|
||
<li><strong>Testing Patterns</strong> - Example-driven, validation test cases</li>
|
||
</ul>
|
||
<h3 id="2-quick-rules-summary"><a class="header" href="#2-quick-rules-summary">2. <strong>Quick Rules Summary</strong></a></h3>
|
||
<p><strong>File</strong>: <code>.claude/KCL_RULES_SUMMARY.md</code> (321 lines)</p>
|
||
<p><strong>Contents</strong>:</p>
|
||
<ul>
|
||
<li>10 Fundamental Rules (condensed)</li>
|
||
<li>19 Pattern quick reference</li>
|
||
<li>Standard import aliases table</li>
|
||
<li>6 Critical anti-patterns</li>
|
||
<li>Submodule reference map</li>
|
||
<li>Naming conventions</li>
|
||
<li>Security/Validation/Documentation checklists</li>
|
||
<li>Quick start template</li>
|
||
</ul>
|
||
<h3 id="3-claudemd-integration"><a class="header" href="#3-claudemd-integration">3. <strong>CLAUDE.md Integration</strong></a></h3>
|
||
<p><strong>File</strong>: <code>CLAUDE.md</code> (updated)</p>
|
||
<p><strong>Added</strong>:</p>
|
||
<ul>
|
||
<li>KCL Development Guidelines section</li>
|
||
<li>Reference to <code>.claude/kcl_idiomatic_patterns.md</code></li>
|
||
<li>Core KCL principles summary</li>
|
||
<li>Quick KCL reference code example</li>
|
||
</ul>
|
||
<hr />
|
||
<h2 id="-core-principles-established"><a class="header" href="#-core-principles-established">🎯 Core Principles Established</a></h2>
|
||
<h3 id="1-direct-submodule-imports"><a class="header" href="#1-direct-submodule-imports">1. Direct Submodule Imports</a></h3>
|
||
<pre><code class="language-kcl">✅ import provisioning.lib as lib
|
||
❌ Settings = settings.Settings # ImmutableError
|
||
</code></pre>
|
||
<h3 id="2-schema-first-development"><a class="header" href="#2-schema-first-development">2. Schema-First Development</a></h3>
|
||
<p>Every configuration must have a schema with validation.</p>
|
||
<h3 id="3-immutability-first"><a class="header" href="#3-immutability-first">3. Immutability First</a></h3>
|
||
<p>Use KCL’s immutable-by-default, only use <code>_</code> prefix when absolutely necessary.</p>
|
||
<h3 id="4-security-by-default"><a class="header" href="#4-security-by-default">4. Security by Default</a></h3>
|
||
<ul>
|
||
<li>Secrets as references (never plaintext)</li>
|
||
<li>TLS enabled by default</li>
|
||
<li>Certificates verified by default</li>
|
||
</ul>
|
||
<h3 id="5-explicit-types"><a class="header" href="#5-explicit-types">5. Explicit Types</a></h3>
|
||
<ul>
|
||
<li>Always specify types</li>
|
||
<li>Use union types for enums</li>
|
||
<li>Mark optional with <code>?</code></li>
|
||
</ul>
|
||
<hr />
|
||
<h2 id="-rule-categories"><a class="header" href="#-rule-categories">📚 Rule Categories</a></h2>
|
||
<h3 id="module-organization-3-patterns"><a class="header" href="#module-organization-3-patterns">Module Organization (3 patterns)</a></h3>
|
||
<ol>
|
||
<li>Submodule Structure - Domain-driven organization</li>
|
||
<li>Extension Organization - Consistent hierarchy</li>
|
||
<li>kcl.mod Dependencies - Relative paths + versions</li>
|
||
</ol>
|
||
<h3 id="schema-design-5-patterns"><a class="header" href="#schema-design-5-patterns">Schema Design (5 patterns)</a></h3>
|
||
<ol start="4">
|
||
<li>Base + Provider - Generic core, specific providers</li>
|
||
<li>Configuration + Defaults - System defaults + user overrides</li>
|
||
<li>Dependency Declaration - Explicit with version ranges</li>
|
||
<li>Version Management - Metadata & update strategies</li>
|
||
<li>Workflow Definition - Declarative operations</li>
|
||
</ol>
|
||
<h3 id="validation-3-patterns"><a class="header" href="#validation-3-patterns">Validation (3 patterns)</a></h3>
|
||
<ol start="9">
|
||
<li>Multi-Field Validation - Cross-field rules</li>
|
||
<li>Regex Validation - Format validation with errors</li>
|
||
<li>Resource Constraints - Validate limits</li>
|
||
</ol>
|
||
<h3 id="testing-2-patterns"><a class="header" href="#testing-2-patterns">Testing (2 patterns)</a></h3>
|
||
<ol start="12">
|
||
<li>Example-Driven Schemas - Examples in documentation</li>
|
||
<li>Validation Test Cases - Test cases in comments</li>
|
||
</ol>
|
||
<h3 id="performance-2-patterns"><a class="header" href="#performance-2-patterns">Performance (2 patterns)</a></h3>
|
||
<ol start="14">
|
||
<li>Lazy Evaluation - Compute only when needed</li>
|
||
<li>Constant Extraction - Module-level reusables</li>
|
||
</ol>
|
||
<h3 id="documentation-2-patterns"><a class="header" href="#documentation-2-patterns">Documentation (2 patterns)</a></h3>
|
||
<ol start="16">
|
||
<li>Schema Documentation - Purpose, fields, examples</li>
|
||
<li>Inline Comments - Explain complex logic</li>
|
||
</ol>
|
||
<h3 id="security-2-patterns"><a class="header" href="#security-2-patterns">Security (2 patterns)</a></h3>
|
||
<ol start="18">
|
||
<li>Secure Defaults - Most secure by default</li>
|
||
<li>Secret References - Never embed secrets</li>
|
||
</ol>
|
||
<hr />
|
||
<h2 id="-standard-conventions"><a class="header" href="#-standard-conventions">🔧 Standard Conventions</a></h2>
|
||
<h3 id="import-aliases"><a class="header" href="#import-aliases">Import Aliases</a></h3>
|
||
<div class="table-wrapper"><table><thead><tr><th>Module</th><th>Alias</th></tr></thead><tbody>
|
||
<tr><td><code>provisioning.lib</code></td><td><code>lib</code></td></tr>
|
||
<tr><td><code>provisioning.settings</code></td><td><code>cfg</code> or <code>settings</code></td></tr>
|
||
<tr><td><code>provisioning.dependencies</code></td><td><code>deps</code> or <code>schema</code></td></tr>
|
||
<tr><td><code>provisioning.workflows</code></td><td><code>wf</code></td></tr>
|
||
<tr><td><code>provisioning.batch</code></td><td><code>batch</code></td></tr>
|
||
<tr><td><code>provisioning.version</code></td><td><code>v</code></td></tr>
|
||
<tr><td><code>provisioning.k8s_deploy</code></td><td><code>k8s</code></td></tr>
|
||
</tbody></table>
|
||
</div>
|
||
<h3 id="schema-naming"><a class="header" href="#schema-naming">Schema Naming</a></h3>
|
||
<ul>
|
||
<li><strong>Base</strong>: <code>Storage</code>, <code>Server</code>, <code>Cluster</code></li>
|
||
<li><strong>Provider</strong>: <code>Storage_aws</code>, <code>ServerDefaults_upcloud</code></li>
|
||
<li><strong>Taskserv</strong>: <code>Kubernetes</code>, <code>Containerd</code></li>
|
||
<li><strong>Config</strong>: <code>NetworkConfig</code>, <code>MonitoringConfig</code></li>
|
||
</ul>
|
||
<h3 id="file-naming"><a class="header" href="#file-naming">File Naming</a></h3>
|
||
<ul>
|
||
<li><strong>Main schema</strong>: <code>{name}.k</code></li>
|
||
<li><strong>Defaults</strong>: <code>defaults_{provider}.k</code></li>
|
||
<li><strong>Server</strong>: <code>server_{provider}.k</code></li>
|
||
<li><strong>Dependencies</strong>: <code>dependencies.k</code></li>
|
||
<li><strong>Version</strong>: <code>version.k</code></li>
|
||
</ul>
|
||
<hr />
|
||
<h2 id="-critical-anti-patterns"><a class="header" href="#-critical-anti-patterns">⚠️ Critical Anti-Patterns</a></h2>
|
||
<h3 id="1-re-exports-immutableerror"><a class="header" href="#1-re-exports-immutableerror">1. Re-exports (ImmutableError)</a></h3>
|
||
<pre><code class="language-kcl">❌ Settings = settings.Settings
|
||
</code></pre>
|
||
<h3 id="2-mutable-non-prefixed-variables"><a class="header" href="#2-mutable-non-prefixed-variables">2. Mutable Non-Prefixed Variables</a></h3>
|
||
<pre><code class="language-kcl">❌ config = { host = "local" }
|
||
config = { host = "prod" } # Error!
|
||
</code></pre>
|
||
<h3 id="3-missing-validation"><a class="header" href="#3-missing-validation">3. Missing Validation</a></h3>
|
||
<pre><code class="language-kcl">❌ schema ServerConfig:
|
||
cores: int # No check block!
|
||
</code></pre>
|
||
<h3 id="4-magic-numbers"><a class="header" href="#4-magic-numbers">4. Magic Numbers</a></h3>
|
||
<pre><code class="language-kcl">❌ timeout: int = 300 # What's 300?
|
||
</code></pre>
|
||
<h3 id="5-string-based-configuration"><a class="header" href="#5-string-based-configuration">5. String-Based Configuration</a></h3>
|
||
<pre><code class="language-kcl">❌ environment: str # Use union types!
|
||
</code></pre>
|
||
<h3 id="6-deep-nesting"><a class="header" href="#6-deep-nesting">6. Deep Nesting</a></h3>
|
||
<pre><code class="language-kcl">❌ server: { network: { interfaces: { ... } } }
|
||
</code></pre>
|
||
<hr />
|
||
<h2 id="-project-integration"><a class="header" href="#-project-integration">📊 Project Integration</a></h2>
|
||
<h3 id="files-updatedcreated"><a class="header" href="#files-updatedcreated">Files Updated/Created</a></h3>
|
||
<h4 id="created-3-files"><a class="header" href="#created-3-files">Created (3 files):</a></h4>
|
||
<ol>
|
||
<li>
|
||
<p><code>.claude/kcl_idiomatic_patterns.md</code> - 1,082 lines</p>
|
||
<ul>
|
||
<li>Comprehensive patterns guide</li>
|
||
<li>All 19 patterns with examples</li>
|
||
<li>Security and testing sections</li>
|
||
</ul>
|
||
</li>
|
||
<li>
|
||
<p><code>.claude/KCL_RULES_SUMMARY.md</code> - 321 lines</p>
|
||
<ul>
|
||
<li>Quick reference card</li>
|
||
<li>Condensed rules and patterns</li>
|
||
<li>Checklists and templates</li>
|
||
</ul>
|
||
</li>
|
||
<li>
|
||
<p><code>KCL_GUIDELINES_IMPLEMENTATION.md</code> - This file</p>
|
||
<ul>
|
||
<li>Implementation summary</li>
|
||
<li>Integration documentation</li>
|
||
</ul>
|
||
</li>
|
||
</ol>
|
||
<h4 id="updated-1-file"><a class="header" href="#updated-1-file">Updated (1 file):</a></h4>
|
||
<ol>
|
||
<li><code>CLAUDE.md</code>
|
||
<ul>
|
||
<li>Added KCL Development Guidelines section</li>
|
||
<li>Reference to comprehensive guide</li>
|
||
<li>Core principles summary</li>
|
||
</ul>
|
||
</li>
|
||
</ol>
|
||
<hr />
|
||
<h2 id="-how-to-use"><a class="header" href="#-how-to-use">🚀 How to Use</a></h2>
|
||
<h3 id="for-claude-code-ai"><a class="header" href="#for-claude-code-ai">For Claude Code AI</a></h3>
|
||
<p>CLAUDE.md now includes:</p>
|
||
<pre><code class="language-markdown">## KCL Development Guidelines
|
||
|
||
For KCL configuration language development, reference:
|
||
- @.claude/kcl_idiomatic_patterns.md (comprehensive KCL patterns and rules)
|
||
|
||
### Core KCL Principles:
|
||
1. Direct Submodule Imports
|
||
2. Schema-First Development
|
||
3. Immutability First
|
||
4. Security by Default
|
||
5. Explicit Types
|
||
</code></pre>
|
||
<h3 id="for-developers"><a class="header" href="#for-developers">For Developers</a></h3>
|
||
<p><strong>Quick Start</strong>:</p>
|
||
<ol>
|
||
<li>Read <code>.claude/KCL_RULES_SUMMARY.md</code> (5-10 minutes)</li>
|
||
<li>Reference <code>.claude/kcl_idiomatic_patterns.md</code> for details</li>
|
||
<li>Use quick start template from summary</li>
|
||
</ol>
|
||
<p><strong>When Writing KCL</strong>:</p>
|
||
<ol>
|
||
<li>Check import aliases (use standard ones)</li>
|
||
<li>Follow schema naming conventions</li>
|
||
<li>Use quick start template</li>
|
||
<li>Run through validation checklist</li>
|
||
</ol>
|
||
<p><strong>When Reviewing KCL</strong>:</p>
|
||
<ol>
|
||
<li>Check for anti-patterns</li>
|
||
<li>Verify security checklist</li>
|
||
<li>Ensure documentation complete</li>
|
||
<li>Validate against patterns</li>
|
||
</ol>
|
||
<hr />
|
||
<h2 id="-benefits"><a class="header" href="#-benefits">📈 Benefits</a></h2>
|
||
<h3 id="immediate"><a class="header" href="#immediate">Immediate</a></h3>
|
||
<ul>
|
||
<li>✅ All KCL patterns documented in one place</li>
|
||
<li>✅ Clear anti-patterns to avoid</li>
|
||
<li>✅ Standard conventions established</li>
|
||
<li>✅ Quick reference available</li>
|
||
</ul>
|
||
<h3 id="long-term"><a class="header" href="#long-term">Long-term</a></h3>
|
||
<ul>
|
||
<li>✅ Consistent KCL code across project</li>
|
||
<li>✅ Easier onboarding for new developers</li>
|
||
<li>✅ Better AI assistance (Claude follows patterns)</li>
|
||
<li>✅ Maintainable, secure configurations</li>
|
||
</ul>
|
||
<h3 id="quality-improvements"><a class="header" href="#quality-improvements">Quality Improvements</a></h3>
|
||
<ul>
|
||
<li>✅ Type safety (explicit types everywhere)</li>
|
||
<li>✅ Security by default (no plaintext secrets)</li>
|
||
<li>✅ Validation complete (check blocks required)</li>
|
||
<li>✅ Documentation complete (examples required)</li>
|
||
</ul>
|
||
<hr />
|
||
<h2 id="-related-documentation"><a class="header" href="#-related-documentation">🔗 Related Documentation</a></h2>
|
||
<h3 id="kcl-guidelines-new"><a class="header" href="#kcl-guidelines-new">KCL Guidelines (New)</a></h3>
|
||
<ul>
|
||
<li><code>.claude/kcl_idiomatic_patterns.md</code> - Full patterns guide</li>
|
||
<li><code>.claude/KCL_RULES_SUMMARY.md</code> - Quick reference</li>
|
||
<li><code>CLAUDE.md</code> - Project rules (updated with KCL section)</li>
|
||
</ul>
|
||
<h3 id="kcl-architecture"><a class="header" href="#kcl-architecture">KCL Architecture</a></h3>
|
||
<ul>
|
||
<li><code>docs/architecture/kcl-import-patterns.md</code> - Import patterns deep dive</li>
|
||
<li><code>docs/KCL_QUICK_REFERENCE.md</code> - Developer quick reference</li>
|
||
<li><code>KCL_MODULE_ORGANIZATION_SUMMARY.md</code> - Module organization</li>
|
||
</ul>
|
||
<h3 id="core-implementation"><a class="header" href="#core-implementation">Core Implementation</a></h3>
|
||
<ul>
|
||
<li><code>provisioning/kcl/main.k</code> - Core module (cleaned up)</li>
|
||
<li><code>provisioning/kcl/*.k</code> - Submodules (10 files)</li>
|
||
<li><code>provisioning/extensions/</code> - Extensions (providers, taskservs, clusters)</li>
|
||
</ul>
|
||
<hr />
|
||
<h2 id="-validation"><a class="header" href="#-validation">✅ Validation</a></h2>
|
||
<h3 id="files-verified"><a class="header" href="#files-verified">Files Verified</a></h3>
|
||
<pre><code class="language-bash"># All guides created
|
||
ls -lh .claude/*.md
|
||
# -rw-r--r-- 16K best_nushell_code.md
|
||
# -rw-r--r-- 24K kcl_idiomatic_patterns.md ✅ NEW
|
||
# -rw-r--r-- 7.4K KCL_RULES_SUMMARY.md ✅ NEW
|
||
|
||
# Line counts
|
||
wc -l .claude/kcl_idiomatic_patterns.md # 1,082 lines ✅
|
||
wc -l .claude/KCL_RULES_SUMMARY.md # 321 lines ✅
|
||
|
||
# CLAUDE.md references
|
||
grep "kcl_idiomatic_patterns" CLAUDE.md
|
||
# Line 8: - **Follow KCL idiomatic patterns from @.claude/kcl_idiomatic_patterns.md**
|
||
# Line 18: - @.claude/kcl_idiomatic_patterns.md (comprehensive KCL patterns and rules)
|
||
# Line 41: See full guide: `.claude/kcl_idiomatic_patterns.md`
|
||
</code></pre>
|
||
<h3 id="integration-confirmed"><a class="header" href="#integration-confirmed">Integration Confirmed</a></h3>
|
||
<ul>
|
||
<li>✅ CLAUDE.md references new KCL guide (3 mentions)</li>
|
||
<li>✅ Core principles summarized in CLAUDE.md</li>
|
||
<li>✅ Quick reference code example included</li>
|
||
<li>✅ Follows same structure as Nushell guide</li>
|
||
</ul>
|
||
<hr />
|
||
<h2 id="-training-claude-code"><a class="header" href="#-training-claude-code">🎓 Training Claude Code</a></h2>
|
||
<h3 id="what-claude-will-follow"><a class="header" href="#what-claude-will-follow">What Claude Will Follow</a></h3>
|
||
<p>When Claude Code reads CLAUDE.md, it will now:</p>
|
||
<ol>
|
||
<li>
|
||
<p><strong>Import Correctly</strong></p>
|
||
<ul>
|
||
<li>Use <code>import provisioning.{submodule}</code></li>
|
||
<li>Never use re-exports</li>
|
||
<li>Use standard aliases</li>
|
||
</ul>
|
||
</li>
|
||
<li>
|
||
<p><strong>Write Schemas</strong></p>
|
||
<ul>
|
||
<li>Define schema before config</li>
|
||
<li>Include check blocks</li>
|
||
<li>Use explicit types</li>
|
||
</ul>
|
||
</li>
|
||
<li>
|
||
<p><strong>Validate Properly</strong></p>
|
||
<ul>
|
||
<li>Cross-field validation</li>
|
||
<li>Regex for formats</li>
|
||
<li>Resource constraints</li>
|
||
</ul>
|
||
</li>
|
||
<li>
|
||
<p><strong>Document Thoroughly</strong></p>
|
||
<ul>
|
||
<li>Schema docstrings</li>
|
||
<li>Usage examples</li>
|
||
<li>Test cases in comments</li>
|
||
</ul>
|
||
</li>
|
||
<li>
|
||
<p><strong>Secure by Default</strong></p>
|
||
<ul>
|
||
<li>TLS enabled</li>
|
||
<li>Secret references only</li>
|
||
<li>Verify certificates</li>
|
||
</ul>
|
||
</li>
|
||
</ol>
|
||
<hr />
|
||
<h2 id="-checklists"><a class="header" href="#-checklists">📋 Checklists</a></h2>
|
||
<h3 id="for-new-kcl-files"><a class="header" href="#for-new-kcl-files">For New KCL Files</a></h3>
|
||
<p><strong>Schema Definition</strong>:</p>
|
||
<ul>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Explicit types for all fields</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Check block with validation</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Docstring with purpose</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Usage examples included</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Optional fields marked with <code>?</code></li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Sensible defaults provided</li>
|
||
</ul>
|
||
<p><strong>Imports</strong>:</p>
|
||
<ul>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Direct submodule imports</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Standard aliases used</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
No re-exports</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
kcl.mod dependencies declared</li>
|
||
</ul>
|
||
<p><strong>Security</strong>:</p>
|
||
<ul>
|
||
<li><input disabled="" type="checkbox"/>
|
||
No plaintext secrets</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Secure defaults</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
TLS enabled</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Certificates verified</li>
|
||
</ul>
|
||
<p><strong>Documentation</strong>:</p>
|
||
<ul>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Header comment with info</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Schema docstring</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Complex logic explained</li>
|
||
<li><input disabled="" type="checkbox"/>
|
||
Examples provided</li>
|
||
</ul>
|
||
<hr />
|
||
<h2 id="-next-steps-optional"><a class="header" href="#-next-steps-optional">🔄 Next Steps (Optional)</a></h2>
|
||
<h3 id="enhancement-opportunities"><a class="header" href="#enhancement-opportunities">Enhancement Opportunities</a></h3>
|
||
<ol>
|
||
<li>
|
||
<p><strong>IDE Integration</strong></p>
|
||
<ul>
|
||
<li>VS Code snippets for patterns</li>
|
||
<li>KCL LSP configuration</li>
|
||
<li>Auto-completion for aliases</li>
|
||
</ul>
|
||
</li>
|
||
<li>
|
||
<p><strong>CI/CD Validation</strong></p>
|
||
<ul>
|
||
<li>Check for anti-patterns</li>
|
||
<li>Enforce naming conventions</li>
|
||
<li>Validate security settings</li>
|
||
</ul>
|
||
</li>
|
||
<li>
|
||
<p><strong>Training Materials</strong></p>
|
||
<ul>
|
||
<li>Workshop slides</li>
|
||
<li>Video tutorials</li>
|
||
<li>Interactive examples</li>
|
||
</ul>
|
||
</li>
|
||
<li>
|
||
<p><strong>Tooling</strong></p>
|
||
<ul>
|
||
<li>KCL linter with project rules</li>
|
||
<li>Schema generator using templates</li>
|
||
<li>Documentation generator</li>
|
||
</ul>
|
||
</li>
|
||
</ol>
|
||
<hr />
|
||
<h2 id="-statistics"><a class="header" href="#-statistics">📊 Statistics</a></h2>
|
||
<h3 id="documentation-created"><a class="header" href="#documentation-created">Documentation Created</a></h3>
|
||
<ul>
|
||
<li><strong>Total Files</strong>: 3 new, 1 updated</li>
|
||
<li><strong>Total Lines</strong>: 1,403 lines (KCL guides only)</li>
|
||
<li><strong>Patterns Documented</strong>: 19</li>
|
||
<li><strong>Rules Documented</strong>: 10</li>
|
||
<li><strong>Anti-Patterns</strong>: 6</li>
|
||
<li><strong>Checklists</strong>: 3 (Security, Validation, Documentation)</li>
|
||
</ul>
|
||
<h3 id="coverage"><a class="header" href="#coverage">Coverage</a></h3>
|
||
<ul>
|
||
<li>✅ Module organization</li>
|
||
<li>✅ Schema design</li>
|
||
<li>✅ Validation patterns</li>
|
||
<li>✅ Testing patterns</li>
|
||
<li>✅ Performance patterns</li>
|
||
<li>✅ Documentation patterns</li>
|
||
<li>✅ Security patterns</li>
|
||
<li>✅ Import patterns</li>
|
||
<li>✅ Naming conventions</li>
|
||
<li>✅ Quick templates</li>
|
||
</ul>
|
||
<hr />
|
||
<h2 id="-success-criteria"><a class="header" href="#-success-criteria">🎯 Success Criteria</a></h2>
|
||
<p>All criteria met:</p>
|
||
<ul>
|
||
<li>✅ Comprehensive patterns guide created</li>
|
||
<li>✅ Quick reference summary available</li>
|
||
<li>✅ CLAUDE.md updated with KCL section</li>
|
||
<li>✅ All rules consolidated in <code>.claude</code> folder</li>
|
||
<li>✅ Follows same structure as Nushell guide</li>
|
||
<li>✅ Examples and anti-patterns included</li>
|
||
<li>✅ Security and testing patterns covered</li>
|
||
<li>✅ Project conventions documented</li>
|
||
<li>✅ Integration verified</li>
|
||
</ul>
|
||
<hr />
|
||
<h2 id="-conclusion"><a class="header" href="#-conclusion">📝 Conclusion</a></h2>
|
||
<p>Successfully created comprehensive KCL guidelines for the provisioning project:</p>
|
||
<ol>
|
||
<li><strong><code>.claude/kcl_idiomatic_patterns.md</code></strong> - Complete patterns guide (1,082 lines)</li>
|
||
<li><strong><code>.claude/KCL_RULES_SUMMARY.md</code></strong> - Quick reference (321 lines)</li>
|
||
<li><strong><code>CLAUDE.md</code></strong> - Updated with KCL section</li>
|
||
</ol>
|
||
<p>All KCL development rules are now:</p>
|
||
<ul>
|
||
<li>✅ Documented in <code>.claude</code> folder</li>
|
||
<li>✅ Referenced in CLAUDE.md</li>
|
||
<li>✅ Available to Claude Code AI</li>
|
||
<li>✅ Accessible to developers</li>
|
||
</ul>
|
||
<p><strong>The project now has a single source of truth for KCL development patterns.</strong></p>
|
||
<hr />
|
||
<p><strong>Maintained By</strong>: Architecture Team
|
||
<strong>Review Cycle</strong>: Quarterly or when KCL version updates
|
||
<strong>Last Review</strong>: 2025-10-03</p>
|
||
|
||
</main>
|
||
|
||
<nav class="nav-wrapper" aria-label="Page navigation">
|
||
<!-- Mobile navigation buttons -->
|
||
<a rel="prev" href="../../development/kcl/KCL_DEPENDENCY_PATTERNS.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
||
<i class="fa fa-angle-left"></i>
|
||
</a>
|
||
|
||
<a rel="next prefetch" href="../../development/kcl/KCL_MODULE_ORGANIZATION_SUMMARY.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||
<i class="fa fa-angle-right"></i>
|
||
</a>
|
||
|
||
<div style="clear: both"></div>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
|
||
<nav class="nav-wide-wrapper" aria-label="Page navigation">
|
||
<a rel="prev" href="../../development/kcl/KCL_DEPENDENCY_PATTERNS.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
|
||
<i class="fa fa-angle-left"></i>
|
||
</a>
|
||
|
||
<a rel="next prefetch" href="../../development/kcl/KCL_MODULE_ORGANIZATION_SUMMARY.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
|
||
<i class="fa fa-angle-right"></i>
|
||
</a>
|
||
</nav>
|
||
|
||
</div>
|
||
|
||
<!-- Livereload script (if served using the cli tool) -->
|
||
<script>
|
||
const wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||
const wsAddress = wsProtocol + "//" + location.host + "/" + "__livereload";
|
||
const socket = new WebSocket(wsAddress);
|
||
socket.onmessage = function (event) {
|
||
if (event.data === "reload") {
|
||
socket.close();
|
||
location.reload();
|
||
}
|
||
};
|
||
|
||
window.onbeforeunload = function() {
|
||
socket.close();
|
||
}
|
||
</script>
|
||
|
||
|
||
|
||
<script>
|
||
window.playground_copyable = true;
|
||
</script>
|
||
|
||
|
||
<script src="../../elasticlunr.min.js"></script>
|
||
<script src="../../mark.min.js"></script>
|
||
<script src="../../searcher.js"></script>
|
||
|
||
<script src="../../clipboard.min.js"></script>
|
||
<script src="../../highlight.js"></script>
|
||
<script src="../../book.js"></script>
|
||
|
||
<!-- Custom JS scripts -->
|
||
|
||
|
||
</div>
|
||
</body>
|
||
</html>
|