@mytechtoday/augment-extensions 0.2.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +614 -39
- package/augment-extensions/coding-standards/bash/README.md +196 -0
- package/augment-extensions/coding-standards/bash/module.json +163 -0
- package/augment-extensions/coding-standards/bash/rules/naming-conventions.md +336 -0
- package/augment-extensions/coding-standards/bash/rules/universal-standards.md +289 -0
- package/augment-extensions/coding-standards/css/README.md +40 -0
- package/augment-extensions/coding-standards/css/examples/css-examples.css +550 -0
- package/augment-extensions/coding-standards/css/module.json +44 -0
- package/augment-extensions/coding-standards/css/rules/css-modern-features.md +448 -0
- package/augment-extensions/coding-standards/css/rules/css-standards.md +492 -0
- package/augment-extensions/coding-standards/html/README.md +40 -0
- package/augment-extensions/coding-standards/html/examples/html-examples.html +267 -0
- package/augment-extensions/coding-standards/html/examples/responsive-layout.html +505 -0
- package/augment-extensions/coding-standards/html/module.json +44 -0
- package/augment-extensions/coding-standards/html/rules/html-standards.md +349 -0
- package/augment-extensions/coding-standards/html-css-js/README.md +194 -0
- package/augment-extensions/coding-standards/html-css-js/examples/async-examples.js +487 -0
- package/augment-extensions/coding-standards/html-css-js/examples/css-examples.css +550 -0
- package/augment-extensions/coding-standards/html-css-js/examples/dom-examples.js +667 -0
- package/augment-extensions/coding-standards/html-css-js/examples/html-examples.html +267 -0
- package/augment-extensions/coding-standards/html-css-js/examples/javascript-examples.js +612 -0
- package/augment-extensions/coding-standards/html-css-js/examples/responsive-layout.html +505 -0
- package/augment-extensions/coding-standards/html-css-js/module.json +48 -0
- package/augment-extensions/coding-standards/html-css-js/rules/async-patterns.md +515 -0
- package/augment-extensions/coding-standards/html-css-js/rules/css-modern-features.md +448 -0
- package/augment-extensions/coding-standards/html-css-js/rules/css-standards.md +492 -0
- package/augment-extensions/coding-standards/html-css-js/rules/dom-manipulation.md +439 -0
- package/augment-extensions/coding-standards/html-css-js/rules/html-standards.md +349 -0
- package/augment-extensions/coding-standards/html-css-js/rules/javascript-standards.md +486 -0
- package/augment-extensions/coding-standards/html-css-js/rules/performance.md +463 -0
- package/augment-extensions/coding-standards/html-css-js/rules/tooling.md +543 -0
- package/augment-extensions/coding-standards/js/README.md +46 -0
- package/augment-extensions/coding-standards/js/examples/async-examples.js +487 -0
- package/augment-extensions/coding-standards/js/examples/dom-examples.js +667 -0
- package/augment-extensions/coding-standards/js/examples/javascript-examples.js +612 -0
- package/augment-extensions/coding-standards/js/module.json +49 -0
- package/augment-extensions/coding-standards/js/rules/async-patterns.md +515 -0
- package/augment-extensions/coding-standards/js/rules/dom-manipulation.md +439 -0
- package/augment-extensions/coding-standards/js/rules/javascript-standards.md +486 -0
- package/augment-extensions/coding-standards/js/rules/performance.md +463 -0
- package/augment-extensions/coding-standards/js/rules/tooling.md +543 -0
- package/augment-extensions/coding-standards/php/README.md +248 -0
- package/augment-extensions/coding-standards/php/examples/api-endpoint-example.php +204 -0
- package/augment-extensions/coding-standards/php/examples/cli-command-example.php +206 -0
- package/augment-extensions/coding-standards/php/examples/legacy-refactoring-example.php +234 -0
- package/augment-extensions/coding-standards/php/examples/web-application-example.php +211 -0
- package/augment-extensions/coding-standards/php/examples/woocommerce-extension-example.php +215 -0
- package/augment-extensions/coding-standards/php/examples/wordpress-plugin-example.php +189 -0
- package/augment-extensions/coding-standards/php/module.json +166 -0
- package/augment-extensions/coding-standards/php/rules/api-development.md +480 -0
- package/augment-extensions/coding-standards/php/rules/category-configuration.md +332 -0
- package/augment-extensions/coding-standards/php/rules/cli-tools.md +472 -0
- package/augment-extensions/coding-standards/php/rules/cms-integration.md +561 -0
- package/augment-extensions/coding-standards/php/rules/code-quality.md +402 -0
- package/augment-extensions/coding-standards/php/rules/documentation.md +425 -0
- package/augment-extensions/coding-standards/php/rules/ecommerce.md +627 -0
- package/augment-extensions/coding-standards/php/rules/error-handling.md +336 -0
- package/augment-extensions/coding-standards/php/rules/legacy-migration.md +677 -0
- package/augment-extensions/coding-standards/php/rules/naming-conventions.md +279 -0
- package/augment-extensions/coding-standards/php/rules/performance.md +392 -0
- package/augment-extensions/coding-standards/php/rules/psr-standards.md +186 -0
- package/augment-extensions/coding-standards/php/rules/security.md +358 -0
- package/augment-extensions/coding-standards/php/rules/testing.md +403 -0
- package/augment-extensions/coding-standards/php/rules/type-declarations.md +331 -0
- package/augment-extensions/coding-standards/php/rules/web-applications.md +426 -0
- package/augment-extensions/coding-standards/powershell/README.md +154 -0
- package/augment-extensions/coding-standards/powershell/examples/admin-example.ps1 +272 -0
- package/augment-extensions/coding-standards/powershell/examples/automation-example.ps1 +173 -0
- package/augment-extensions/coding-standards/powershell/examples/cloud-example.ps1 +243 -0
- package/augment-extensions/coding-standards/powershell/examples/cross-platform-example.ps1 +297 -0
- package/augment-extensions/coding-standards/powershell/examples/dsc-example.ps1 +224 -0
- package/augment-extensions/coding-standards/powershell/examples/legacy-migration-example.ps1 +340 -0
- package/augment-extensions/coding-standards/powershell/examples/module-example.psm1 +255 -0
- package/augment-extensions/coding-standards/powershell/module.json +165 -0
- package/augment-extensions/coding-standards/powershell/rules/administrative-tools.md +439 -0
- package/augment-extensions/coding-standards/powershell/rules/automation-scripts.md +240 -0
- package/augment-extensions/coding-standards/powershell/rules/cloud-orchestration.md +384 -0
- package/augment-extensions/coding-standards/powershell/rules/configuration-schema.md +383 -0
- package/augment-extensions/coding-standards/powershell/rules/cross-platform-scripts.md +482 -0
- package/augment-extensions/coding-standards/powershell/rules/dsc-configurations.md +296 -0
- package/augment-extensions/coding-standards/powershell/rules/error-handling.md +314 -0
- package/augment-extensions/coding-standards/powershell/rules/legacy-migrations.md +466 -0
- package/augment-extensions/coding-standards/powershell/rules/modules-functions.md +244 -0
- package/augment-extensions/coding-standards/powershell/rules/naming-conventions.md +266 -0
- package/augment-extensions/coding-standards/powershell/rules/performance-optimization.md +209 -0
- package/augment-extensions/coding-standards/powershell/rules/security-practices.md +314 -0
- package/augment-extensions/coding-standards/powershell/rules/testing-guidelines.md +268 -0
- package/augment-extensions/coding-standards/powershell/rules/universal-standards.md +197 -0
- package/augment-extensions/coding-standards/python/README.md +12 -8
- package/augment-extensions/coding-standards/python/examples/best-practices.py +373 -0
- package/augment-extensions/coding-standards/python/module.json +8 -4
- package/augment-extensions/coding-standards/python/rules/async-patterns.md +884 -0
- package/augment-extensions/coding-standards/python/rules/documentation.md +831 -0
- package/augment-extensions/coding-standards/python/rules/error-handling.md +855 -68
- package/augment-extensions/coding-standards/python/rules/testing.md +409 -0
- package/augment-extensions/coding-standards/python/rules/tooling.md +446 -0
- package/augment-extensions/coding-standards/python/rules/type-hints.md +115 -50
- package/augment-extensions/collections/html-css-js/README.md +82 -0
- package/augment-extensions/collections/html-css-js/collection.json +41 -0
- package/augment-extensions/domain-rules/database/README.md +161 -0
- package/augment-extensions/domain-rules/database/examples/flat-database-example.md +793 -0
- package/augment-extensions/domain-rules/database/examples/hybrid-database-example.md +1132 -0
- package/augment-extensions/domain-rules/database/examples/nosql-document-example.md +868 -0
- package/augment-extensions/domain-rules/database/examples/nosql-graph-example.md +805 -0
- package/augment-extensions/domain-rules/database/examples/relational-schema-example.md +621 -0
- package/augment-extensions/domain-rules/database/examples/vector-database-example.md +965 -0
- package/augment-extensions/domain-rules/database/module.json +28 -0
- package/augment-extensions/domain-rules/database/rules/flat-databases.md +624 -0
- package/augment-extensions/domain-rules/database/rules/nosql-databases.md +588 -0
- package/augment-extensions/domain-rules/database/rules/nosql-document-stores.md +856 -0
- package/augment-extensions/domain-rules/database/rules/nosql-graph-databases.md +778 -0
- package/augment-extensions/domain-rules/database/rules/nosql-key-value-stores.md +963 -0
- package/augment-extensions/domain-rules/database/rules/performance-optimization.md +1076 -0
- package/augment-extensions/domain-rules/database/rules/relational-databases.md +697 -0
- package/augment-extensions/domain-rules/database/rules/relational-indexing.md +671 -0
- package/augment-extensions/domain-rules/database/rules/relational-query-optimization.md +607 -0
- package/augment-extensions/domain-rules/database/rules/relational-schema-design.md +907 -0
- package/augment-extensions/domain-rules/database/rules/relational-transactions.md +783 -0
- package/augment-extensions/domain-rules/database/rules/security-standards.md +980 -0
- package/augment-extensions/domain-rules/database/rules/universal-best-practices.md +485 -0
- package/augment-extensions/domain-rules/database/rules/vector-databases.md +521 -0
- package/augment-extensions/domain-rules/database/rules/vector-embeddings.md +858 -0
- package/augment-extensions/domain-rules/database/rules/vector-indexing.md +934 -0
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-latte/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-latte/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-mocha/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-mocha/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/dracula/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/dracula/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-dark/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-dark/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-light/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-light/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/high-contrast/README.md +27 -0
- package/augment-extensions/domain-rules/design/color/themes/high-contrast/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/monokai/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/monokai/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/nord/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/nord/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/one-dark/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/one-dark/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/one-light/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/one-light/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/solarized-dark/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/solarized-dark/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/solarized-light/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/solarized-light/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/tokyo-night/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/tokyo-night/module.json +26 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/README.md +136 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/SCHEMA-VALIDATION-REPORT.md +216 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/brand-kit-example.yaml +292 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/campaign-brief-example.yaml +389 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/content-calendar-example.yaml +643 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/email-newsletter-example.md +376 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/landing-page-example.md +934 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/ppc-ad-copy-example.md +301 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/seo-blog-post-example.md +347 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/social-media-campaign-example.md +606 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/module.json +50 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/affiliate-influencer-marketing.md +593 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/asset-management.md +418 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/brand-consistency.md +210 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/content-marketing.md +337 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/conversion-optimization.md +455 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/direct-sales.md +499 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/email-marketing.md +439 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/legal-compliance.md +227 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/ppc-advertising.md +569 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/seo-optimization.md +470 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/social-media-marketing.md +414 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/universal-marketing.md +177 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/asset-inventory.schema.json +247 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/brand-kit.schema.json +326 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/campaign-brief.schema.json +342 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/color-palette.schema.json +223 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/content-template.schema.json +383 -0
- package/augment-extensions/domain-rules/mcp/README.md +150 -0
- package/augment-extensions/domain-rules/mcp/examples/compressed-example.md +522 -0
- package/augment-extensions/domain-rules/mcp/examples/graph-augmented-example.md +520 -0
- package/augment-extensions/domain-rules/mcp/examples/hybrid-example.md +570 -0
- package/augment-extensions/domain-rules/mcp/examples/state-based-example.md +427 -0
- package/augment-extensions/domain-rules/mcp/examples/token-based-example.md +435 -0
- package/augment-extensions/domain-rules/mcp/examples/vector-based-example.md +502 -0
- package/augment-extensions/domain-rules/mcp/module.json +49 -0
- package/augment-extensions/domain-rules/mcp/rules/compressed-mcp.md +595 -0
- package/augment-extensions/domain-rules/mcp/rules/configuration.md +345 -0
- package/augment-extensions/domain-rules/mcp/rules/graph-augmented-mcp.md +687 -0
- package/augment-extensions/domain-rules/mcp/rules/hybrid-mcp.md +636 -0
- package/augment-extensions/domain-rules/mcp/rules/state-based-mcp.md +484 -0
- package/augment-extensions/domain-rules/mcp/rules/testing-validation.md +360 -0
- package/augment-extensions/domain-rules/mcp/rules/token-based-mcp.md +393 -0
- package/augment-extensions/domain-rules/mcp/rules/universal-rules.md +194 -0
- package/augment-extensions/domain-rules/mcp/rules/vector-based-mcp.md +625 -0
- package/augment-extensions/workflows/beads/module.json +4 -3
- package/augment-extensions/workflows/beads-integration/IMPLEMENTATION-STATUS.md +145 -0
- package/augment-extensions/workflows/beads-integration/README.md +143 -0
- package/augment-extensions/workflows/beads-integration/config/defaults.json +32 -0
- package/augment-extensions/workflows/beads-integration/config/schema.json +140 -0
- package/augment-extensions/workflows/beads-integration/examples/basic-task-generation.md +293 -0
- package/augment-extensions/workflows/beads-integration/module.json +75 -0
- package/augment-extensions/workflows/beads-integration/rules/core-rules.md +219 -0
- package/augment-extensions/workflows/beads-integration/rules/effectiveness-standards.md +256 -0
- package/augment-extensions/workflows/beads-integration/rules/task-generation.md +607 -0
- package/augment-extensions/workflows/database/README.md +195 -0
- package/augment-extensions/workflows/database/ai-prompt-testing.md +295 -0
- package/augment-extensions/workflows/database/examples/migration-example.md +498 -0
- package/augment-extensions/workflows/database/examples/optimization-example.md +496 -0
- package/augment-extensions/workflows/database/examples/schema-design-example.md +444 -0
- package/augment-extensions/workflows/database/module.json +42 -0
- package/augment-extensions/workflows/database/rules/data-migration.md +249 -0
- package/augment-extensions/workflows/database/rules/documentation-standards.md +339 -0
- package/augment-extensions/workflows/database/rules/migration-workflow.md +352 -0
- package/augment-extensions/workflows/database/rules/optimization-workflow.md +435 -0
- package/augment-extensions/workflows/database/rules/schema-design-workflow.md +535 -0
- package/augment-extensions/workflows/database/rules/testing-patterns.md +305 -0
- package/augment-extensions/workflows/database/rules/workflow.md +458 -0
- package/augment-extensions/workflows/openspec/module.json +4 -3
- package/augment-extensions/writing-standards/screenplay/README.md +300 -0
- package/augment-extensions/writing-standards/screenplay/_templates/README.md +121 -0
- package/augment-extensions/writing-standards/screenplay/_templates/genre-template.md +153 -0
- package/augment-extensions/writing-standards/screenplay/_templates/style-template.md +243 -0
- package/augment-extensions/writing-standards/screenplay/_templates/theme-template.md +213 -0
- package/augment-extensions/writing-standards/screenplay/examples/aaa-hollywood-scene.fountain +164 -0
- package/augment-extensions/writing-standards/screenplay/examples/beat-sheet-example.yaml +95 -0
- package/augment-extensions/writing-standards/screenplay/examples/character-profile-example.yaml +116 -0
- package/augment-extensions/writing-standards/screenplay/examples/commercial-30sec.fountain +151 -0
- package/augment-extensions/writing-standards/screenplay/examples/independent-monologue.fountain +67 -0
- package/augment-extensions/writing-standards/screenplay/examples/news-segment.fountain +142 -0
- package/augment-extensions/writing-standards/screenplay/examples/plot-outline-example.yaml +184 -0
- package/augment-extensions/writing-standards/screenplay/examples/tv-episode-teaser.fountain +204 -0
- package/augment-extensions/writing-standards/screenplay/genres/README.md +181 -0
- package/augment-extensions/writing-standards/screenplay/genres/examples/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/genres/module.json +70 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/action.md +399 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/adventure.md +407 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/animation.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/biographical.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/comedy.md +401 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/documentary.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/drama.md +409 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/fantasy.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/historical.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/horror.md +268 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/musical.md +294 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/mystery.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/noir.md +294 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/romance.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/sci-fi.md +289 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/superhero.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/thriller.md +294 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/western.md +293 -0
- package/augment-extensions/writing-standards/screenplay/module.json +124 -0
- package/augment-extensions/writing-standards/screenplay/rules/aaa-hollywood-films.md +339 -0
- package/augment-extensions/writing-standards/screenplay/rules/ai-integration-testing.md +329 -0
- package/augment-extensions/writing-standards/screenplay/rules/character-development.md +169 -0
- package/augment-extensions/writing-standards/screenplay/rules/commercials.md +437 -0
- package/augment-extensions/writing-standards/screenplay/rules/dialogue-writing.md +263 -0
- package/augment-extensions/writing-standards/screenplay/rules/diversity-inclusion.md +261 -0
- package/augment-extensions/writing-standards/screenplay/rules/examples-guide.md +315 -0
- package/augment-extensions/writing-standards/screenplay/rules/formatting-validation.md +413 -0
- package/augment-extensions/writing-standards/screenplay/rules/fountain-format.md +372 -0
- package/augment-extensions/writing-standards/screenplay/rules/independent-films.md +374 -0
- package/augment-extensions/writing-standards/screenplay/rules/live-tv-productions.md +443 -0
- package/augment-extensions/writing-standards/screenplay/rules/narrative-structures.md +207 -0
- package/augment-extensions/writing-standards/screenplay/rules/news-broadcasts.md +444 -0
- package/augment-extensions/writing-standards/screenplay/rules/pacing-timing.md +331 -0
- package/augment-extensions/writing-standards/screenplay/rules/quality-review-checklist.md +334 -0
- package/augment-extensions/writing-standards/screenplay/rules/quick-reference.md +299 -0
- package/augment-extensions/writing-standards/screenplay/rules/screen-continuity.md +263 -0
- package/augment-extensions/writing-standards/screenplay/rules/streaming-content.md +412 -0
- package/augment-extensions/writing-standards/screenplay/rules/trope-management.md +370 -0
- package/augment-extensions/writing-standards/screenplay/rules/tv-series.md +374 -0
- package/augment-extensions/writing-standards/screenplay/rules/universal-formatting.md +339 -0
- package/augment-extensions/writing-standards/screenplay/rules/vscode-integration.md +277 -0
- package/augment-extensions/writing-standards/screenplay/rules/web-content.md +393 -0
- package/augment-extensions/writing-standards/screenplay/schemas/beat-sheet.json +332 -0
- package/augment-extensions/writing-standards/screenplay/schemas/character-profile.json +247 -0
- package/augment-extensions/writing-standards/screenplay/schemas/feature-selection.json +200 -0
- package/augment-extensions/writing-standards/screenplay/schemas/plot-outline.json +233 -0
- package/augment-extensions/writing-standards/screenplay/schemas/screenplay-config.json +245 -0
- package/augment-extensions/writing-standards/screenplay/schemas/trope-inventory.json +221 -0
- package/augment-extensions/writing-standards/screenplay/styles/README.md +159 -0
- package/augment-extensions/writing-standards/screenplay/styles/examples/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/styles/examples/style-applications.md +1449 -0
- package/augment-extensions/writing-standards/screenplay/styles/module.json +64 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/dialogue-centric.md +520 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/ensemble.md +499 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/epic.md +497 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/experimental.md +492 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/flashback.md +509 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/linear.md +490 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/minimalist.md +499 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/non-linear.md +501 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/poetic.md +499 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/realistic.md +498 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/satirical.md +499 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/surreal.md +508 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/voice-over.md +500 -0
- package/augment-extensions/writing-standards/screenplay/themes/README.md +158 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/common-mistakes-and-fixes.md +643 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/complete-scene-example.md +311 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/individual-theme-examples.md +562 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/multi-theme-weaving.md +538 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/theme-application-guide.md +432 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/theme-integration-across-acts.md +637 -0
- package/augment-extensions/writing-standards/screenplay/themes/module.json +66 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/ambition.md +458 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/betrayal.md +490 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/environment.md +458 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/fate.md +459 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/friendship.md +491 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/growth.md +491 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/identity.md +490 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/isolation.md +464 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/justice.md +461 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/love.md +489 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/power.md +494 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/redemption.md +483 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/revenge.md +489 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/survival.md +496 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/technology.md +463 -0
- package/cli/MODULES.md +302 -0
- package/cli/dist/cli.js +168 -10
- package/cli/dist/cli.js.map +1 -1
- package/cli/dist/commands/catalog.d.ts +13 -0
- package/cli/dist/commands/catalog.d.ts.map +1 -0
- package/cli/dist/commands/catalog.js +104 -0
- package/cli/dist/commands/catalog.js.map +1 -0
- package/cli/dist/commands/gui.d.ts +6 -0
- package/cli/dist/commands/gui.d.ts.map +1 -0
- package/cli/dist/commands/gui.js +211 -0
- package/cli/dist/commands/gui.js.map +1 -0
- package/cli/dist/commands/init.d.ts.map +1 -1
- package/cli/dist/commands/init.js +12 -0
- package/cli/dist/commands/init.js.map +1 -1
- package/cli/dist/commands/install-rules.d.ts +14 -0
- package/cli/dist/commands/install-rules.d.ts.map +1 -0
- package/cli/dist/commands/install-rules.js +127 -0
- package/cli/dist/commands/install-rules.js.map +1 -0
- package/cli/dist/commands/link.d.ts.map +1 -1
- package/cli/dist/commands/link.js +9 -11
- package/cli/dist/commands/link.js.map +1 -1
- package/cli/dist/commands/list.d.ts.map +1 -1
- package/cli/dist/commands/list.js +11 -28
- package/cli/dist/commands/list.js.map +1 -1
- package/cli/dist/commands/mcp.d.ts +48 -0
- package/cli/dist/commands/mcp.d.ts.map +1 -0
- package/cli/dist/commands/mcp.js +229 -0
- package/cli/dist/commands/mcp.js.map +1 -0
- package/cli/dist/commands/self-remove.d.ts +7 -0
- package/cli/dist/commands/self-remove.d.ts.map +1 -0
- package/cli/dist/commands/self-remove.js +179 -0
- package/cli/dist/commands/self-remove.js.map +1 -0
- package/cli/dist/commands/show.d.ts +19 -0
- package/cli/dist/commands/show.d.ts.map +1 -1
- package/cli/dist/commands/show.js +478 -63
- package/cli/dist/commands/show.js.map +1 -1
- package/cli/dist/commands/skill.d.ts +67 -0
- package/cli/dist/commands/skill.d.ts.map +1 -0
- package/cli/dist/commands/skill.js +513 -0
- package/cli/dist/commands/skill.js.map +1 -0
- package/cli/dist/commands/unlink.d.ts +6 -0
- package/cli/dist/commands/unlink.d.ts.map +1 -0
- package/cli/dist/commands/unlink.js +115 -0
- package/cli/dist/commands/unlink.js.map +1 -0
- package/cli/dist/commands/validate.d.ts +6 -0
- package/cli/dist/commands/validate.d.ts.map +1 -0
- package/cli/dist/commands/validate.js +159 -0
- package/cli/dist/commands/validate.js.map +1 -0
- package/cli/dist/types/gui.d.ts +62 -0
- package/cli/dist/types/gui.d.ts.map +1 -0
- package/cli/dist/types/gui.js +30 -0
- package/cli/dist/types/gui.js.map +1 -0
- package/cli/dist/utils/catalog-sync.d.ts +22 -0
- package/cli/dist/utils/catalog-sync.d.ts.map +1 -0
- package/cli/dist/utils/catalog-sync.js +157 -0
- package/cli/dist/utils/catalog-sync.js.map +1 -0
- package/cli/dist/utils/character-count.d.ts +56 -0
- package/cli/dist/utils/character-count.d.ts.map +1 -0
- package/cli/dist/utils/character-count.js +190 -0
- package/cli/dist/utils/character-count.js.map +1 -0
- package/cli/dist/utils/documentation-validator.d.ts +18 -0
- package/cli/dist/utils/documentation-validator.d.ts.map +1 -0
- package/cli/dist/utils/documentation-validator.js +233 -0
- package/cli/dist/utils/documentation-validator.js.map +1 -0
- package/cli/dist/utils/gui-helpers.d.ts +23 -0
- package/cli/dist/utils/gui-helpers.d.ts.map +1 -0
- package/cli/dist/utils/gui-helpers.js +159 -0
- package/cli/dist/utils/gui-helpers.js.map +1 -0
- package/cli/dist/utils/install-rules.d.ts +32 -0
- package/cli/dist/utils/install-rules.d.ts.map +1 -0
- package/cli/dist/utils/install-rules.js +375 -0
- package/cli/dist/utils/install-rules.js.map +1 -0
- package/cli/dist/utils/mcp-integration.d.ts +70 -0
- package/cli/dist/utils/mcp-integration.d.ts.map +1 -0
- package/cli/dist/utils/mcp-integration.js +292 -0
- package/cli/dist/utils/mcp-integration.js.map +1 -0
- package/cli/dist/utils/module-system.d.ts +232 -0
- package/cli/dist/utils/module-system.d.ts.map +1 -0
- package/cli/dist/utils/module-system.js +900 -0
- package/cli/dist/utils/module-system.js.map +1 -0
- package/cli/dist/utils/modules-catalog.d.ts +33 -0
- package/cli/dist/utils/modules-catalog.d.ts.map +1 -0
- package/cli/dist/utils/modules-catalog.js +163 -0
- package/cli/dist/utils/modules-catalog.js.map +1 -0
- package/cli/dist/utils/rule-install-hooks.d.ts +19 -0
- package/cli/dist/utils/rule-install-hooks.d.ts.map +1 -0
- package/cli/dist/utils/rule-install-hooks.js +224 -0
- package/cli/dist/utils/rule-install-hooks.js.map +1 -0
- package/cli/dist/utils/skill-system.d.ts +95 -0
- package/cli/dist/utils/skill-system.d.ts.map +1 -0
- package/cli/dist/utils/skill-system.js +313 -0
- package/cli/dist/utils/skill-system.js.map +1 -0
- package/modules.md +559 -105
- package/package.json +17 -6
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# PowerShell Naming Conventions
|
|
2
|
+
|
|
3
|
+
Comprehensive naming standards for PowerShell code following Microsoft best practices.
|
|
4
|
+
|
|
5
|
+
## Function and Cmdlet Names
|
|
6
|
+
|
|
7
|
+
### Verb-Noun Pattern
|
|
8
|
+
|
|
9
|
+
**ALWAYS** use approved verbs with singular nouns:
|
|
10
|
+
|
|
11
|
+
```powershell
|
|
12
|
+
# ✅ Correct
|
|
13
|
+
Get-User
|
|
14
|
+
Set-Configuration
|
|
15
|
+
New-LogEntry
|
|
16
|
+
Remove-TempFile
|
|
17
|
+
|
|
18
|
+
# ❌ Incorrect
|
|
19
|
+
GetUser # Missing hyphen
|
|
20
|
+
Get-Users # Plural noun
|
|
21
|
+
Fetch-User # Unapproved verb
|
|
22
|
+
Get_User # Underscore instead of hyphen
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Approved Verbs
|
|
26
|
+
|
|
27
|
+
Use `Get-Verb` to see all approved verbs. Common categories:
|
|
28
|
+
|
|
29
|
+
**Common Verbs:**
|
|
30
|
+
- `Get`, `Set`, `New`, `Remove`
|
|
31
|
+
- `Add`, `Clear`, `Copy`, `Move`
|
|
32
|
+
- `Find`, `Search`, `Select`, `Show`
|
|
33
|
+
- `Start`, `Stop`, `Restart`, `Suspend`
|
|
34
|
+
- `Read`, `Write`, `Update`, `Invoke`
|
|
35
|
+
|
|
36
|
+
**Data Verbs:**
|
|
37
|
+
- `Backup`, `Restore`, `Save`, `Sync`
|
|
38
|
+
- `Compare`, `Convert`, `Export`, `Import`
|
|
39
|
+
- `Merge`, `Split`, `Compress`, `Expand`
|
|
40
|
+
|
|
41
|
+
**Lifecycle Verbs:**
|
|
42
|
+
- `Initialize`, `Register`, `Unregister`
|
|
43
|
+
- `Enable`, `Disable`, `Install`, `Uninstall`
|
|
44
|
+
|
|
45
|
+
**Diagnostic Verbs:**
|
|
46
|
+
- `Test`, `Trace`, `Measure`, `Debug`
|
|
47
|
+
- `Confirm`, `Assert`, `Validate`
|
|
48
|
+
|
|
49
|
+
### Verb Selection Guidelines
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
# ✅ Use Get for retrieval
|
|
53
|
+
Get-UserProfile
|
|
54
|
+
|
|
55
|
+
# ✅ Use Set for modification
|
|
56
|
+
Set-UserProfile
|
|
57
|
+
|
|
58
|
+
# ✅ Use New for creation
|
|
59
|
+
New-UserProfile
|
|
60
|
+
|
|
61
|
+
# ✅ Use Remove for deletion
|
|
62
|
+
Remove-UserProfile
|
|
63
|
+
|
|
64
|
+
# ✅ Use Test for validation (returns boolean)
|
|
65
|
+
Test-UserExists
|
|
66
|
+
|
|
67
|
+
# ✅ Use Invoke for execution
|
|
68
|
+
Invoke-UserScript
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Variable Names
|
|
72
|
+
|
|
73
|
+
### PascalCase for Variables
|
|
74
|
+
|
|
75
|
+
```powershell
|
|
76
|
+
# ✅ Correct
|
|
77
|
+
$UserName = "john.doe"
|
|
78
|
+
$FilePath = "C:\Logs\app.log"
|
|
79
|
+
$MaxRetryCount = 3
|
|
80
|
+
$IsEnabled = $true
|
|
81
|
+
|
|
82
|
+
# ❌ Incorrect
|
|
83
|
+
$username # camelCase
|
|
84
|
+
$file_path # snake_case
|
|
85
|
+
$MAXRETRYCOUNT # ALL CAPS (reserved for constants)
|
|
86
|
+
$is-enabled # kebab-case
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Descriptive Names
|
|
90
|
+
|
|
91
|
+
```powershell
|
|
92
|
+
# ✅ Descriptive
|
|
93
|
+
$DatabaseConnectionString
|
|
94
|
+
$UserEmailAddress
|
|
95
|
+
$MaximumRetryAttempts
|
|
96
|
+
|
|
97
|
+
# ❌ Too short/cryptic
|
|
98
|
+
$dcs
|
|
99
|
+
$email
|
|
100
|
+
$max
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Boolean Variables
|
|
104
|
+
|
|
105
|
+
Prefix with `Is`, `Has`, `Should`, `Can`:
|
|
106
|
+
|
|
107
|
+
```powershell
|
|
108
|
+
$IsValid = $true
|
|
109
|
+
$HasPermission = $false
|
|
110
|
+
$ShouldContinue = $true
|
|
111
|
+
$CanWrite = Test-Path $path -PathType Leaf
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Collections
|
|
115
|
+
|
|
116
|
+
Use plural nouns:
|
|
117
|
+
|
|
118
|
+
```powershell
|
|
119
|
+
$Users = @()
|
|
120
|
+
$Files = Get-ChildItem
|
|
121
|
+
$ErrorMessages = @()
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Parameter Names
|
|
125
|
+
|
|
126
|
+
### PascalCase and Descriptive
|
|
127
|
+
|
|
128
|
+
```powershell
|
|
129
|
+
function Get-UserData
|
|
130
|
+
{
|
|
131
|
+
[CmdletBinding()]
|
|
132
|
+
param(
|
|
133
|
+
[Parameter(Mandatory)]
|
|
134
|
+
[string]$UserName,
|
|
135
|
+
|
|
136
|
+
[Parameter()]
|
|
137
|
+
[string]$DomainName = 'contoso.com',
|
|
138
|
+
|
|
139
|
+
[Parameter()]
|
|
140
|
+
[switch]$IncludeGroups
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Common Parameter Names
|
|
146
|
+
|
|
147
|
+
Follow PowerShell conventions:
|
|
148
|
+
|
|
149
|
+
```powershell
|
|
150
|
+
# ✅ Standard names
|
|
151
|
+
-Path # File/folder paths
|
|
152
|
+
-Name # Object names
|
|
153
|
+
-ComputerName # Remote computer
|
|
154
|
+
-Credential # PSCredential object
|
|
155
|
+
-Force # Override confirmations
|
|
156
|
+
-WhatIf # Simulation mode
|
|
157
|
+
-Confirm # Confirmation prompts
|
|
158
|
+
-Verbose # Verbose output
|
|
159
|
+
-Debug # Debug output
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Constants and Enums
|
|
163
|
+
|
|
164
|
+
### ALL_CAPS with Underscores
|
|
165
|
+
|
|
166
|
+
```powershell
|
|
167
|
+
# Constants
|
|
168
|
+
$MAX_RETRY_COUNT = 5
|
|
169
|
+
$DEFAULT_TIMEOUT_SECONDS = 30
|
|
170
|
+
$API_BASE_URL = 'https://api.example.com'
|
|
171
|
+
|
|
172
|
+
# Enums
|
|
173
|
+
enum LogLevel
|
|
174
|
+
{
|
|
175
|
+
DEBUG
|
|
176
|
+
INFO
|
|
177
|
+
WARNING
|
|
178
|
+
ERROR
|
|
179
|
+
CRITICAL
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## File Names
|
|
184
|
+
|
|
185
|
+
### Script Files (.ps1)
|
|
186
|
+
|
|
187
|
+
```powershell
|
|
188
|
+
# ✅ Correct
|
|
189
|
+
Get-UserReport.ps1
|
|
190
|
+
Deploy-Application.ps1
|
|
191
|
+
Backup-Database.ps1
|
|
192
|
+
|
|
193
|
+
# ❌ Incorrect
|
|
194
|
+
getUserReport.ps1 # camelCase
|
|
195
|
+
get_user_report.ps1 # snake_case
|
|
196
|
+
script1.ps1 # Non-descriptive
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Module Files
|
|
200
|
+
|
|
201
|
+
```powershell
|
|
202
|
+
# Module manifest (.psd1)
|
|
203
|
+
MyModule.psd1
|
|
204
|
+
|
|
205
|
+
# Module script (.psm1)
|
|
206
|
+
MyModule.psm1
|
|
207
|
+
|
|
208
|
+
# Module folder
|
|
209
|
+
MyModule/
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Class Names
|
|
213
|
+
|
|
214
|
+
### PascalCase
|
|
215
|
+
|
|
216
|
+
```powershell
|
|
217
|
+
class UserAccount
|
|
218
|
+
{
|
|
219
|
+
[string]$UserName
|
|
220
|
+
[string]$Email
|
|
221
|
+
[datetime]$CreatedDate
|
|
222
|
+
|
|
223
|
+
UserAccount([string]$userName, [string]$email)
|
|
224
|
+
{
|
|
225
|
+
$this.UserName = $userName
|
|
226
|
+
$this.Email = $email
|
|
227
|
+
$this.CreatedDate = Get-Date
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Anti-Patterns
|
|
233
|
+
|
|
234
|
+
### Avoid These
|
|
235
|
+
|
|
236
|
+
```powershell
|
|
237
|
+
# ❌ Hungarian notation
|
|
238
|
+
$strUserName
|
|
239
|
+
$intCount
|
|
240
|
+
$arrUsers
|
|
241
|
+
|
|
242
|
+
# ❌ Abbreviations (unless widely known)
|
|
243
|
+
$usr
|
|
244
|
+
$cnt
|
|
245
|
+
$msg
|
|
246
|
+
|
|
247
|
+
# ❌ Single letters (except loop counters)
|
|
248
|
+
$x
|
|
249
|
+
$y
|
|
250
|
+
$z
|
|
251
|
+
|
|
252
|
+
# ✅ Loop counters are OK
|
|
253
|
+
for ($i = 0; $i -lt 10; $i++)
|
|
254
|
+
{
|
|
255
|
+
# Process
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Best Practices
|
|
260
|
+
|
|
261
|
+
1. **Be consistent** - Follow the same pattern throughout your codebase
|
|
262
|
+
2. **Be descriptive** - Names should explain purpose without comments
|
|
263
|
+
3. **Use approved verbs** - Check with `Get-Verb`
|
|
264
|
+
4. **Avoid abbreviations** - Unless universally understood (URL, API, SQL)
|
|
265
|
+
5. **Follow PowerShell conventions** - Match built-in cmdlet patterns
|
|
266
|
+
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# PowerShell Performance Optimization
|
|
2
|
+
|
|
3
|
+
Comprehensive performance optimization techniques for efficient PowerShell code.
|
|
4
|
+
|
|
5
|
+
## Pipeline Efficiency
|
|
6
|
+
|
|
7
|
+
### Use Pipeline Correctly
|
|
8
|
+
|
|
9
|
+
**PREFER** pipeline over loops when possible:
|
|
10
|
+
|
|
11
|
+
```powershell
|
|
12
|
+
# ✅ GOOD: Pipeline (faster)
|
|
13
|
+
Get-ChildItem -Path C:\Logs -Filter *.log | Where-Object { $_.Length -gt 1MB } | Remove-Item
|
|
14
|
+
|
|
15
|
+
# ❌ BAD: ForEach loop (slower)
|
|
16
|
+
$files = Get-ChildItem -Path C:\Logs -Filter *.log
|
|
17
|
+
foreach ($file in $files) {
|
|
18
|
+
if ($file.Length -gt 1MB) {
|
|
19
|
+
Remove-Item $file
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Filter Left, Format Right
|
|
25
|
+
|
|
26
|
+
**ALWAYS** filter as early as possible:
|
|
27
|
+
|
|
28
|
+
```powershell
|
|
29
|
+
# ✅ GOOD: Filter at source
|
|
30
|
+
Get-ChildItem -Path C:\Logs -Filter *.log | Where-Object { $_.Length -gt 1MB }
|
|
31
|
+
|
|
32
|
+
# ❌ BAD: Get everything then filter
|
|
33
|
+
Get-ChildItem -Path C:\Logs | Where-Object { $_.Name -like '*.log' -and $_.Length -gt 1MB }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Avoid Unnecessary Pipeline Operations
|
|
37
|
+
|
|
38
|
+
```powershell
|
|
39
|
+
# ✅ GOOD: Direct assignment
|
|
40
|
+
$processes = Get-Process
|
|
41
|
+
|
|
42
|
+
# ❌ BAD: Unnecessary ForEach-Object
|
|
43
|
+
$processes = Get-Process | ForEach-Object { $_ }
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Loop Performance
|
|
47
|
+
|
|
48
|
+
### foreach vs ForEach-Object
|
|
49
|
+
|
|
50
|
+
**USE** `foreach` statement for better performance:
|
|
51
|
+
|
|
52
|
+
```powershell
|
|
53
|
+
# ✅ GOOD: foreach statement (fastest)
|
|
54
|
+
$items = 1..10000
|
|
55
|
+
foreach ($item in $items) {
|
|
56
|
+
$result = $item * 2
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# ❌ SLOWER: ForEach-Object cmdlet
|
|
60
|
+
$items = 1..10000
|
|
61
|
+
$items | ForEach-Object {
|
|
62
|
+
$result = $_ * 2
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**WHEN** to use ForEach-Object:
|
|
67
|
+
- Processing pipeline input
|
|
68
|
+
- Need to stream large datasets
|
|
69
|
+
- Want lazy evaluation
|
|
70
|
+
|
|
71
|
+
### Avoid Nested Loops
|
|
72
|
+
|
|
73
|
+
```powershell
|
|
74
|
+
# ✅ GOOD: Use hashtable for lookups
|
|
75
|
+
$userLookup = @{}
|
|
76
|
+
foreach ($user in $users) {
|
|
77
|
+
$userLookup[$user.Id] = $user
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
foreach ($order in $orders) {
|
|
81
|
+
$user = $userLookup[$order.UserId] # O(1) lookup
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
# ❌ BAD: Nested loops
|
|
85
|
+
foreach ($order in $orders) {
|
|
86
|
+
foreach ($user in $users) { # O(n²) complexity
|
|
87
|
+
if ($user.Id -eq $order.UserId) {
|
|
88
|
+
# Process
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Memory Management
|
|
95
|
+
|
|
96
|
+
### Use [System.Collections.Generic.List] for Dynamic Arrays
|
|
97
|
+
|
|
98
|
+
```powershell
|
|
99
|
+
# ✅ GOOD: Generic List (efficient)
|
|
100
|
+
$list = [System.Collections.Generic.List[string]]::new()
|
|
101
|
+
foreach ($item in 1..10000) {
|
|
102
|
+
$list.Add("Item $item")
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
# ❌ BAD: Array concatenation (slow)
|
|
106
|
+
$array = @()
|
|
107
|
+
foreach ($item in 1..10000) {
|
|
108
|
+
$array += "Item $item" # Creates new array each time
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Dispose of Large Objects
|
|
113
|
+
|
|
114
|
+
```powershell
|
|
115
|
+
# ✅ GOOD: Explicit disposal
|
|
116
|
+
$stream = [System.IO.StreamReader]::new('large-file.txt')
|
|
117
|
+
try {
|
|
118
|
+
$content = $stream.ReadToEnd()
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
$stream.Dispose()
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
# ✅ BETTER: Using statement (PowerShell 7+)
|
|
125
|
+
using ($stream = [System.IO.StreamReader]::new('large-file.txt')) {
|
|
126
|
+
$content = $stream.ReadToEnd()
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Clear Variables When Done
|
|
131
|
+
|
|
132
|
+
```powershell
|
|
133
|
+
# Clear large variables
|
|
134
|
+
$largeData = Get-LargeDataset
|
|
135
|
+
# Process data
|
|
136
|
+
$largeData = $null
|
|
137
|
+
[System.GC]::Collect() # Force garbage collection (use sparingly)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## String Operations
|
|
141
|
+
|
|
142
|
+
### Use StringBuilder for Concatenation
|
|
143
|
+
|
|
144
|
+
```powershell
|
|
145
|
+
# ✅ GOOD: StringBuilder
|
|
146
|
+
$sb = [System.Text.StringBuilder]::new()
|
|
147
|
+
foreach ($item in 1..1000) {
|
|
148
|
+
[void]$sb.AppendLine("Line $item")
|
|
149
|
+
}
|
|
150
|
+
$result = $sb.ToString()
|
|
151
|
+
|
|
152
|
+
# ❌ BAD: String concatenation
|
|
153
|
+
$result = ''
|
|
154
|
+
foreach ($item in 1..1000) {
|
|
155
|
+
$result += "Line $item`n" # Creates new string each time
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Use -join for Arrays
|
|
160
|
+
|
|
161
|
+
```powershell
|
|
162
|
+
# ✅ GOOD: -join operator
|
|
163
|
+
$items = 1..1000
|
|
164
|
+
$result = $items -join ', '
|
|
165
|
+
|
|
166
|
+
# ❌ BAD: String concatenation in loop
|
|
167
|
+
$result = ''
|
|
168
|
+
foreach ($item in $items) {
|
|
169
|
+
$result += "$item, "
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Cmdlet-Specific Optimizations
|
|
174
|
+
|
|
175
|
+
### Use -Filter Instead of Where-Object
|
|
176
|
+
|
|
177
|
+
```powershell
|
|
178
|
+
# ✅ GOOD: Server-side filtering
|
|
179
|
+
Get-ChildItem -Path C:\Logs -Filter *.log
|
|
180
|
+
|
|
181
|
+
# ❌ BAD: Client-side filtering
|
|
182
|
+
Get-ChildItem -Path C:\Logs | Where-Object { $_.Extension -eq '.log' }
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Use -ReadCount for Large Files
|
|
186
|
+
|
|
187
|
+
```powershell
|
|
188
|
+
# ✅ GOOD: Process in batches
|
|
189
|
+
Get-Content -Path large-file.txt -ReadCount 1000 | ForEach-Object {
|
|
190
|
+
# Process batch of 1000 lines
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
# ❌ BAD: Load entire file
|
|
194
|
+
$content = Get-Content -Path large-file.txt
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Best Practices Summary
|
|
198
|
+
|
|
199
|
+
1. **Filter early** - Use -Filter parameter when available
|
|
200
|
+
2. **Use foreach statement** - Faster than ForEach-Object for arrays
|
|
201
|
+
3. **Avoid array concatenation** - Use Generic.List for dynamic arrays
|
|
202
|
+
4. **Use StringBuilder** - For string concatenation in loops
|
|
203
|
+
5. **Dispose resources** - Clean up streams, connections, large objects
|
|
204
|
+
6. **Measure performance** - Use Measure-Command to profile
|
|
205
|
+
7. **Avoid nested loops** - Use hashtables for lookups
|
|
206
|
+
8. **Stream large files** - Use -ReadCount or StreamReader
|
|
207
|
+
9. **Cache results** - Don't repeat expensive operations
|
|
208
|
+
10. **Use .NET types** - When PowerShell cmdlets are too slow
|
|
209
|
+
|