@mytechtoday/augment-extensions 0.1.2 → 0.4.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/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/domain-rules/wordpress/README.md +163 -0
- package/augment-extensions/domain-rules/wordpress/module.json +32 -0
- package/augment-extensions/domain-rules/wordpress/rules/coding-standards.md +617 -0
- package/augment-extensions/domain-rules/wordpress/rules/directory-structure.md +270 -0
- package/augment-extensions/domain-rules/wordpress/rules/file-patterns.md +423 -0
- package/augment-extensions/domain-rules/wordpress/rules/gutenberg-blocks.md +493 -0
- package/augment-extensions/domain-rules/wordpress/rules/performance.md +568 -0
- package/augment-extensions/domain-rules/wordpress/rules/plugin-development.md +510 -0
- package/augment-extensions/domain-rules/wordpress/rules/project-detection.md +251 -0
- package/augment-extensions/domain-rules/wordpress/rules/rest-api.md +501 -0
- package/augment-extensions/domain-rules/wordpress/rules/security.md +564 -0
- package/augment-extensions/domain-rules/wordpress/rules/theme-development.md +388 -0
- package/augment-extensions/domain-rules/wordpress/rules/woocommerce.md +441 -0
- package/augment-extensions/domain-rules/wordpress-plugin/README.md +139 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/ajax-plugin.md +1599 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/custom-post-type-plugin.md +1727 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/gutenberg-block-plugin.md +428 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/gutenberg-block.md +422 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/mvc-plugin.md +1623 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/object-oriented-plugin.md +1343 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/rest-endpoint.md +734 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/settings-page-plugin.md +1350 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/simple-procedural-plugin.md +503 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/singleton-plugin.md +971 -0
- package/augment-extensions/domain-rules/wordpress-plugin/module.json +53 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/activation-hooks.md +770 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/admin-interface.md +874 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/ajax-handlers.md +629 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/asset-management.md +559 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/context-providers.md +709 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/cron-jobs.md +736 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/database-management.md +1057 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/documentation-standards.md +463 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/frontend-functionality.md +478 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/gutenberg-blocks.md +818 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/internationalization.md +416 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/migration.md +667 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/performance-optimization.md +878 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/plugin-architecture.md +693 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/plugin-structure.md +352 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/rest-api.md +818 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/scaffolding-workflow.md +624 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/security-best-practices.md +866 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/testing-patterns.md +1165 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/testing.md +414 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/vscode-integration.md +751 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/woocommerce-integration.md +949 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/wordpress-org-submission.md +458 -0
- package/augment-extensions/examples/gutenberg-block-plugin/README.md +101 -0
- package/augment-extensions/examples/gutenberg-block-plugin/examples/testimonial-block.md +428 -0
- package/augment-extensions/examples/gutenberg-block-plugin/module.json +40 -0
- package/augment-extensions/examples/rest-api-plugin/README.md +98 -0
- package/augment-extensions/examples/rest-api-plugin/examples/task-manager-api.md +1299 -0
- package/augment-extensions/examples/rest-api-plugin/module.json +40 -0
- package/augment-extensions/examples/woocommerce-extension/README.md +98 -0
- package/augment-extensions/examples/woocommerce-extension/examples/product-customizer.md +763 -0
- package/augment-extensions/examples/woocommerce-extension/module.json +40 -0
- package/augment-extensions/workflows/beads/module.json +4 -3
- 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/workflows/wordpress-plugin/README.md +232 -0
- package/augment-extensions/workflows/wordpress-plugin/ai-prompts.md +839 -0
- package/augment-extensions/workflows/wordpress-plugin/bead-decomposition-patterns.md +854 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/complete-plugin-example.md +540 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/custom-post-type-example.md +1083 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/feature-addition-workflow.md +669 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/plugin-creation-workflow.md +597 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/secure-form-handler-example.md +925 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/security-audit-workflow.md +752 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/wordpress-org-submission-workflow.md +773 -0
- package/augment-extensions/workflows/wordpress-plugin/module.json +49 -0
- package/augment-extensions/workflows/wordpress-plugin/rules/best-practices.md +942 -0
- package/augment-extensions/workflows/wordpress-plugin/rules/development-workflow.md +702 -0
- package/augment-extensions/workflows/wordpress-plugin/rules/submission-workflow.md +728 -0
- package/augment-extensions/workflows/wordpress-plugin/rules/testing-workflow.md +775 -0
- package/augment-extensions/writing-standards/screenplay/README.md +171 -0
- package/augment-extensions/writing-standards/screenplay/examples/aaa-hollywood-scene.fountain +164 -0
- package/augment-extensions/writing-standards/screenplay/module.json +124 -0
- package/augment-extensions/writing-standards/screenplay/rules/universal-formatting.md +339 -0
- package/cli/MODULES.md +302 -0
- package/cli/dist/cli.js +142 -9
- 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.map +1 -1
- package/cli/dist/commands/show.js +42 -71
- 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/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/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 +153 -0
- package/cli/dist/utils/module-system.d.ts.map +1 -0
- package/cli/dist/utils/module-system.js +528 -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 +534 -70
- package/package.json +12 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Module, ValidationResult } from './module-system';
|
|
2
|
+
/**
|
|
3
|
+
* Validate module README.md has required sections
|
|
4
|
+
*/
|
|
5
|
+
export declare function validateReadmeStructure(modulePath: string): ValidationResult;
|
|
6
|
+
/**
|
|
7
|
+
* Validate module has comprehensive documentation
|
|
8
|
+
*/
|
|
9
|
+
export declare function validateModuleDocumentation(module: Module): ValidationResult;
|
|
10
|
+
/**
|
|
11
|
+
* Extract module overview from README.md
|
|
12
|
+
*/
|
|
13
|
+
export declare function extractModuleOverview(modulePath: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Extract character count from README.md
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractCharacterCountFromReadme(modulePath: string): number | null;
|
|
18
|
+
//# sourceMappingURL=documentation-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentation-validator.d.ts","sourceRoot":"","sources":["../../src/utils/documentation-validator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAW3D;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAuC5E;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAsG5E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAoChE;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAwBjF"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.validateReadmeStructure = validateReadmeStructure;
|
|
37
|
+
exports.validateModuleDocumentation = validateModuleDocumentation;
|
|
38
|
+
exports.extractModuleOverview = extractModuleOverview;
|
|
39
|
+
exports.extractCharacterCountFromReadme = extractCharacterCountFromReadme;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
/**
|
|
43
|
+
* Required sections in README.md
|
|
44
|
+
*/
|
|
45
|
+
const REQUIRED_README_SECTIONS = [
|
|
46
|
+
'Overview',
|
|
47
|
+
'Contents',
|
|
48
|
+
'Character Count'
|
|
49
|
+
];
|
|
50
|
+
/**
|
|
51
|
+
* Validate module README.md has required sections
|
|
52
|
+
*/
|
|
53
|
+
function validateReadmeStructure(modulePath) {
|
|
54
|
+
const errors = [];
|
|
55
|
+
const warnings = [];
|
|
56
|
+
const readmePath = path.join(modulePath, 'README.md');
|
|
57
|
+
if (!fs.existsSync(readmePath)) {
|
|
58
|
+
errors.push('README.md file is missing');
|
|
59
|
+
return { valid: false, errors, warnings };
|
|
60
|
+
}
|
|
61
|
+
const content = fs.readFileSync(readmePath, 'utf-8');
|
|
62
|
+
// Check for required sections
|
|
63
|
+
for (const section of REQUIRED_README_SECTIONS) {
|
|
64
|
+
// Look for markdown headers (# Section or ## Section)
|
|
65
|
+
const sectionPattern = new RegExp(`^#{1,3}\\s+${section}`, 'mi');
|
|
66
|
+
if (!sectionPattern.test(content)) {
|
|
67
|
+
errors.push(`README.md missing required section: ${section}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Check for empty README
|
|
71
|
+
if (content.trim().length < 100) {
|
|
72
|
+
warnings.push('README.md appears to be too short (< 100 characters)');
|
|
73
|
+
}
|
|
74
|
+
// Check for module name in title
|
|
75
|
+
const titlePattern = /^#\s+(.+)/m;
|
|
76
|
+
const titleMatch = content.match(titlePattern);
|
|
77
|
+
if (!titleMatch) {
|
|
78
|
+
warnings.push('README.md missing title (# heading)');
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
valid: errors.length === 0,
|
|
82
|
+
errors,
|
|
83
|
+
warnings
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Validate module has comprehensive documentation
|
|
88
|
+
*/
|
|
89
|
+
function validateModuleDocumentation(module) {
|
|
90
|
+
const errors = [];
|
|
91
|
+
const warnings = [];
|
|
92
|
+
// Validate README.md structure
|
|
93
|
+
const readmeValidation = validateReadmeStructure(module.path);
|
|
94
|
+
errors.push(...readmeValidation.errors);
|
|
95
|
+
warnings.push(...readmeValidation.warnings);
|
|
96
|
+
// Check for rule files
|
|
97
|
+
if (module.rules.length === 0) {
|
|
98
|
+
errors.push('Module has no rule files in rules/ directory');
|
|
99
|
+
}
|
|
100
|
+
// Check for examples (optional but recommended for certain module types)
|
|
101
|
+
if (module.examples.length === 0) {
|
|
102
|
+
if (module.metadata.type === 'examples') {
|
|
103
|
+
errors.push('Examples module must have files in examples/ directory');
|
|
104
|
+
}
|
|
105
|
+
else if (module.metadata.type === 'coding-standards') {
|
|
106
|
+
warnings.push('Coding standards module should have examples in examples/ directory (recommended)');
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
warnings.push('Module has no examples in examples/ directory (optional but recommended)');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Validate each rule file has content
|
|
113
|
+
const rulesDir = path.join(module.path, 'rules');
|
|
114
|
+
for (const ruleFile of module.rules) {
|
|
115
|
+
const rulePath = path.join(rulesDir, ruleFile);
|
|
116
|
+
const content = fs.readFileSync(rulePath, 'utf-8');
|
|
117
|
+
if (content.trim().length < 100) {
|
|
118
|
+
warnings.push(`Rule file ${ruleFile} appears to be too short (< 100 characters)`);
|
|
119
|
+
}
|
|
120
|
+
// Check for markdown headers
|
|
121
|
+
if (!content.match(/^#{1,3}\s+/m)) {
|
|
122
|
+
warnings.push(`Rule file ${ruleFile} missing markdown headers`);
|
|
123
|
+
}
|
|
124
|
+
// Check for code examples in rule files (recommended)
|
|
125
|
+
if (!content.match(/```/)) {
|
|
126
|
+
warnings.push(`Rule file ${ruleFile} has no code examples (recommended for clarity)`);
|
|
127
|
+
}
|
|
128
|
+
// Check for actionable content (should have lists or steps)
|
|
129
|
+
if (!content.match(/^[-*]\s+/m) && !content.match(/^\d+\.\s+/m)) {
|
|
130
|
+
warnings.push(`Rule file ${ruleFile} lacks actionable content (lists or numbered steps recommended)`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Validate module.json completeness
|
|
134
|
+
if (!module.metadata.displayName) {
|
|
135
|
+
errors.push('module.json missing displayName field');
|
|
136
|
+
}
|
|
137
|
+
if (!module.metadata.description) {
|
|
138
|
+
errors.push('module.json missing description field');
|
|
139
|
+
}
|
|
140
|
+
else if (module.metadata.description.length < 20) {
|
|
141
|
+
warnings.push('module.json description is too short (< 20 characters)');
|
|
142
|
+
}
|
|
143
|
+
else if (module.metadata.description.length > 200) {
|
|
144
|
+
warnings.push('module.json description is too long (> 200 characters) - consider shortening');
|
|
145
|
+
}
|
|
146
|
+
if (!module.metadata.tags || module.metadata.tags.length === 0) {
|
|
147
|
+
warnings.push('module.json missing tags field (recommended for discoverability)');
|
|
148
|
+
}
|
|
149
|
+
if (!module.metadata.augment?.characterCount) {
|
|
150
|
+
warnings.push('module.json missing augment.characterCount field (required for catalog)');
|
|
151
|
+
}
|
|
152
|
+
if (!module.metadata.augment?.priority) {
|
|
153
|
+
warnings.push('module.json missing augment.priority field (recommended: high, medium, or low)');
|
|
154
|
+
}
|
|
155
|
+
// Validate README.md has usage examples
|
|
156
|
+
const readmePath = path.join(module.path, 'README.md');
|
|
157
|
+
if (fs.existsSync(readmePath)) {
|
|
158
|
+
const readmeContent = fs.readFileSync(readmePath, 'utf-8');
|
|
159
|
+
// Check for usage section
|
|
160
|
+
if (!readmeContent.match(/^#{1,3}\s+Usage/mi)) {
|
|
161
|
+
warnings.push('README.md missing Usage section (recommended)');
|
|
162
|
+
}
|
|
163
|
+
// Check for installation/setup section
|
|
164
|
+
if (!readmeContent.match(/^#{1,3}\s+(Installation|Setup)/mi)) {
|
|
165
|
+
warnings.push('README.md missing Installation or Setup section (recommended)');
|
|
166
|
+
}
|
|
167
|
+
// Check for examples in README
|
|
168
|
+
if (!readmeContent.match(/```/)) {
|
|
169
|
+
warnings.push('README.md has no code examples (recommended)');
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
valid: errors.length === 0,
|
|
174
|
+
errors,
|
|
175
|
+
warnings
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Extract module overview from README.md
|
|
180
|
+
*/
|
|
181
|
+
function extractModuleOverview(modulePath) {
|
|
182
|
+
const readmePath = path.join(modulePath, 'README.md');
|
|
183
|
+
if (!fs.existsSync(readmePath)) {
|
|
184
|
+
return '';
|
|
185
|
+
}
|
|
186
|
+
const content = fs.readFileSync(readmePath, 'utf-8');
|
|
187
|
+
// Extract first paragraph after title
|
|
188
|
+
const lines = content.split('\n');
|
|
189
|
+
let overview = '';
|
|
190
|
+
let foundTitle = false;
|
|
191
|
+
for (const line of lines) {
|
|
192
|
+
if (line.match(/^#\s+/)) {
|
|
193
|
+
foundTitle = true;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (foundTitle && line.trim().length > 0 && !line.match(/^#{1,3}\s+/)) {
|
|
197
|
+
overview += line + ' ';
|
|
198
|
+
// Stop at next heading or after a reasonable length
|
|
199
|
+
if (overview.length > 200) {
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// Stop at next heading
|
|
204
|
+
if (foundTitle && line.match(/^#{1,3}\s+/)) {
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return overview.trim();
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Extract character count from README.md
|
|
212
|
+
*/
|
|
213
|
+
function extractCharacterCountFromReadme(modulePath) {
|
|
214
|
+
const readmePath = path.join(modulePath, 'README.md');
|
|
215
|
+
if (!fs.existsSync(readmePath)) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
const content = fs.readFileSync(readmePath, 'utf-8');
|
|
219
|
+
// Look for character count patterns
|
|
220
|
+
const patterns = [
|
|
221
|
+
/Character Count[:\s]+~?(\d{1,3}(?:,\d{3})*)/i,
|
|
222
|
+
/~(\d{1,3}(?:,\d{3})*)\s+characters/i,
|
|
223
|
+
/Total:\s+~?(\d{1,3}(?:,\d{3})*)/i
|
|
224
|
+
];
|
|
225
|
+
for (const pattern of patterns) {
|
|
226
|
+
const match = content.match(pattern);
|
|
227
|
+
if (match) {
|
|
228
|
+
return parseInt(match[1].replace(/,/g, ''), 10);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=documentation-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentation-validator.js","sourceRoot":"","sources":["../../src/utils/documentation-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,0DAuCC;AAKD,kEAsGC;AAKD,sDAoCC;AAKD,0EAwBC;AAxOD,uCAAyB;AACzB,2CAA6B;AAG7B;;GAEG;AACH,MAAM,wBAAwB,GAAG;IAC/B,UAAU;IACV,UAAU;IACV,iBAAiB;CAClB,CAAC;AAEF;;GAEG;AACH,SAAgB,uBAAuB,CAAC,UAAkB;IACxD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAEtD,IAAI,CAAC,EAAE,C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O,CAAC,CAAC;IAErD,oCAAoC;IACpC,MAAM,QAAQ,GAAG;QACf,8CAA8C;QAC9C,qCAAqC;QACrC,kCAAkC;KACnC,CAAC;IAEF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface InstallRulesOptions {
|
|
2
|
+
targetDir?: string;
|
|
3
|
+
skipIfExists?: boolean;
|
|
4
|
+
verbose?: boolean;
|
|
5
|
+
force?: boolean;
|
|
6
|
+
interactive?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface InstallRulesResult {
|
|
9
|
+
success: boolean;
|
|
10
|
+
created: boolean;
|
|
11
|
+
skipped: boolean;
|
|
12
|
+
updated?: boolean;
|
|
13
|
+
error?: string;
|
|
14
|
+
errorType?: 'PERMISSION_DENIED' | 'DISK_FULL' | 'CONFLICT' | 'UNKNOWN';
|
|
15
|
+
path?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Error types for better error handling
|
|
19
|
+
*/
|
|
20
|
+
export declare class InstallRulesError extends Error {
|
|
21
|
+
type: 'PERMISSION_DENIED' | 'DISK_FULL' | 'CONFLICT' | 'UNKNOWN';
|
|
22
|
+
originalError?: Error | undefined;
|
|
23
|
+
constructor(message: string, type: 'PERMISSION_DENIED' | 'DISK_FULL' | 'CONFLICT' | 'UNKNOWN', originalError?: Error | undefined);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Install character count management rule to .augment/rules directory
|
|
27
|
+
*
|
|
28
|
+
* @param options - Installation options
|
|
29
|
+
* @returns Installation result
|
|
30
|
+
*/
|
|
31
|
+
export declare function installCharacterCountRule(options?: InstallRulesOptions): Promise<InstallRulesResult>;
|
|
32
|
+
//# sourceMappingURL=install-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-rules.d.ts","sourceRoot":"","sources":["../../src/utils/install-rules.ts"],"names":[],"mappings":"AAkEA,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,mBAAmB,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAGjC,IAAI,EAAE,mBAAmB,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS;IAChE,aAAa,CAAC,EAAE,KAAK;gBAF5B,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,mBAAmB,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,EAChE,aAAa,CAAC,EAAE,KAAK,YAAA;CAK/B;AAqID;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAkL7B"}
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.InstallRulesError = void 0;
|
|
40
|
+
exports.installCharacterCountRule = installCharacterCountRule;
|
|
41
|
+
const fs = __importStar(require("fs/promises"));
|
|
42
|
+
const fsSync = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
45
|
+
/**
|
|
46
|
+
* Character count management rule content
|
|
47
|
+
* This is embedded to avoid hardcoded paths and ensure cross-platform compatibility
|
|
48
|
+
*/
|
|
49
|
+
const CHARACTER_COUNT_RULE_CONTENT = `---
|
|
50
|
+
type: "always_apply"
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
# Character Count Management for .augment/ Directory
|
|
54
|
+
|
|
55
|
+
## Target Range
|
|
56
|
+
|
|
57
|
+
**Total character count of all files in \`.augment/\` directory: 48,599 - 49,299 characters**
|
|
58
|
+
|
|
59
|
+
## Extension System
|
|
60
|
+
|
|
61
|
+
**For content exceeding the character limit, use Augment Extensions:**
|
|
62
|
+
|
|
63
|
+
This repository provides an extension module system that allows unlimited content storage outside the \`.augment/\` folder. See [AGENTS.md](../../AGENTS.md) for details on how to use extension modules.
|
|
64
|
+
|
|
65
|
+
## Verification Command
|
|
66
|
+
|
|
67
|
+
\`\`\`powershell
|
|
68
|
+
Get-ChildItem -Path ".augment" -Recurse -File | Get-Content -Raw | Measure-Object -Character | Select-Object -ExpandProperty Characters
|
|
69
|
+
\`\`\`
|
|
70
|
+
|
|
71
|
+
## Character Reduction Priority (When Over Target)
|
|
72
|
+
|
|
73
|
+
### 1. Condense Examples (First Priority)
|
|
74
|
+
- Make examples more concise
|
|
75
|
+
- Keep 1-2 examples per concept maximum
|
|
76
|
+
|
|
77
|
+
### 2. Remove Examples (Second Priority)
|
|
78
|
+
- Remove least critical examples
|
|
79
|
+
|
|
80
|
+
### 3. Reduce Redundancy (Third Priority)
|
|
81
|
+
- Remove duplicate content
|
|
82
|
+
- Consolidate similar sections
|
|
83
|
+
|
|
84
|
+
### 4. Streamline Content (Fourth Priority)
|
|
85
|
+
- Use more concise language
|
|
86
|
+
- Combine related bullet points
|
|
87
|
+
|
|
88
|
+
## Content Preservation Rules
|
|
89
|
+
|
|
90
|
+
### NEVER Remove
|
|
91
|
+
- Core requirements and constraints
|
|
92
|
+
- Critical validation rules
|
|
93
|
+
|
|
94
|
+
### Always Preserve
|
|
95
|
+
- Specific, actionable guidance
|
|
96
|
+
- Technical accuracy and precision
|
|
97
|
+
|
|
98
|
+
## Validation Process
|
|
99
|
+
|
|
100
|
+
Before committing changes to \`.augment/\` files:
|
|
101
|
+
1. Run character count verification command
|
|
102
|
+
2. Verify total is within 48,599 - 49,299 range
|
|
103
|
+
3. If outside range, apply reduction/addition priorities
|
|
104
|
+
`;
|
|
105
|
+
/**
|
|
106
|
+
* Error types for better error handling
|
|
107
|
+
*/
|
|
108
|
+
class InstallRulesError extends Error {
|
|
109
|
+
constructor(message, type, originalError) {
|
|
110
|
+
super(message);
|
|
111
|
+
this.type = type;
|
|
112
|
+
this.originalError = originalError;
|
|
113
|
+
this.name = 'InstallRulesError';
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.InstallRulesError = InstallRulesError;
|
|
117
|
+
/**
|
|
118
|
+
* Check if directory exists and is writable
|
|
119
|
+
*/
|
|
120
|
+
async function checkDirectoryWritable(dirPath) {
|
|
121
|
+
try {
|
|
122
|
+
await fs.access(dirPath, fsSync.constants.W_OK);
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create directory with proper error handling
|
|
131
|
+
*/
|
|
132
|
+
async function createDirectorySafe(dirPath, verbose = false) {
|
|
133
|
+
try {
|
|
134
|
+
await fs.mkdir(dirPath, { recursive: true });
|
|
135
|
+
if (verbose) {
|
|
136
|
+
console.log(chalk_1.default.green(`✓ Created directory: ${dirPath}`));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
// Check for specific error types
|
|
141
|
+
if (error.code === 'EACCES' || error.code === 'EPERM') {
|
|
142
|
+
throw new InstallRulesError(`Permission denied: Cannot create directory ${dirPath}`, 'PERMISSION_DENIED', error);
|
|
143
|
+
}
|
|
144
|
+
else if (error.code === 'ENOSPC') {
|
|
145
|
+
throw new InstallRulesError(`Disk full: Cannot create directory ${dirPath}`, 'DISK_FULL', error);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
throw new InstallRulesError(`Failed to create directory ${dirPath}: ${error.message}`, 'UNKNOWN', error);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Write file with proper error handling and rollback support
|
|
154
|
+
*/
|
|
155
|
+
async function writeFileSafe(filePath, content, verbose = false) {
|
|
156
|
+
const backupPath = `${filePath}.backup`;
|
|
157
|
+
let backupCreated = false;
|
|
158
|
+
try {
|
|
159
|
+
// Create backup if file exists
|
|
160
|
+
if (fsSync.existsSync(filePath)) {
|
|
161
|
+
await fs.copyFile(filePath, backupPath);
|
|
162
|
+
backupCreated = true;
|
|
163
|
+
if (verbose) {
|
|
164
|
+
console.log(chalk_1.default.gray(`Created backup: ${backupPath}`));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Write the file
|
|
168
|
+
await fs.writeFile(filePath, content, 'utf-8');
|
|
169
|
+
// Remove backup on success
|
|
170
|
+
if (backupCreated) {
|
|
171
|
+
await fs.unlink(backupPath);
|
|
172
|
+
}
|
|
173
|
+
if (verbose) {
|
|
174
|
+
console.log(chalk_1.default.green(`✓ Wrote file: ${filePath}`));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
// Rollback on error
|
|
179
|
+
if (backupCreated) {
|
|
180
|
+
try {
|
|
181
|
+
await fs.copyFile(backupPath, filePath);
|
|
182
|
+
await fs.unlink(backupPath);
|
|
183
|
+
if (verbose) {
|
|
184
|
+
console.log(chalk_1.default.yellow('Rolled back changes from backup'));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
catch (rollbackError) {
|
|
188
|
+
console.error(chalk_1.default.red('Failed to rollback changes'), rollbackError);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Throw appropriate error
|
|
192
|
+
if (error.code === 'EACCES' || error.code === 'EPERM') {
|
|
193
|
+
throw new InstallRulesError(`Permission denied: Cannot write to ${filePath}`, 'PERMISSION_DENIED', error);
|
|
194
|
+
}
|
|
195
|
+
else if (error.code === 'ENOSPC') {
|
|
196
|
+
throw new InstallRulesError(`Disk full: Cannot write to ${filePath}`, 'DISK_FULL', error);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
throw new InstallRulesError(`Failed to write file ${filePath}: ${error.message}`, 'UNKNOWN', error);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Prompt user for conflict resolution
|
|
205
|
+
*/
|
|
206
|
+
async function promptConflictResolution(existingContent, newContent, verbose) {
|
|
207
|
+
// For now, return 'skip' - in future, could use inquirer for interactive prompts
|
|
208
|
+
if (verbose) {
|
|
209
|
+
console.log(chalk_1.default.yellow('\n⚠ Conflict detected:'));
|
|
210
|
+
console.log(chalk_1.default.gray(' Existing rule has different content'));
|
|
211
|
+
console.log(chalk_1.default.gray(' Use --force to replace, or manually update the file'));
|
|
212
|
+
}
|
|
213
|
+
return 'skip';
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Install character count management rule to .augment/rules directory
|
|
217
|
+
*
|
|
218
|
+
* @param options - Installation options
|
|
219
|
+
* @returns Installation result
|
|
220
|
+
*/
|
|
221
|
+
async function installCharacterCountRule(options = {}) {
|
|
222
|
+
const { targetDir = process.cwd(), skipIfExists = true, verbose = false, force = false, interactive = false } = options;
|
|
223
|
+
try {
|
|
224
|
+
// Ensure paths use platform-appropriate separators (cross-platform)
|
|
225
|
+
const augmentDir = path.join(targetDir, '.augment');
|
|
226
|
+
const rulesDir = path.join(augmentDir, 'rules');
|
|
227
|
+
const rulePath = path.join(rulesDir, 'character-count-management.md');
|
|
228
|
+
// Check if rule already exists
|
|
229
|
+
const ruleExists = fsSync.existsSync(rulePath);
|
|
230
|
+
if (ruleExists) {
|
|
231
|
+
// Read existing content
|
|
232
|
+
const existingContent = await fs.readFile(rulePath, 'utf-8');
|
|
233
|
+
// Check if content is identical
|
|
234
|
+
if (existingContent.trim() === CHARACTER_COUNT_RULE_CONTENT.trim()) {
|
|
235
|
+
if (verbose) {
|
|
236
|
+
console.log(chalk_1.default.gray('ℹ Character count rule is up to date'));
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
success: true,
|
|
240
|
+
created: false,
|
|
241
|
+
skipped: true,
|
|
242
|
+
path: rulePath
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
// Content is different - handle conflict
|
|
246
|
+
if (force) {
|
|
247
|
+
// Force replace
|
|
248
|
+
if (verbose) {
|
|
249
|
+
console.log(chalk_1.default.yellow('⚠ Replacing existing rule (--force)'));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else if (skipIfExists) {
|
|
253
|
+
// Skip if exists
|
|
254
|
+
if (verbose) {
|
|
255
|
+
console.log(chalk_1.default.gray('ℹ Character count rule already exists, skipping...'));
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
success: true,
|
|
259
|
+
created: false,
|
|
260
|
+
skipped: true,
|
|
261
|
+
path: rulePath
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
else if (interactive) {
|
|
265
|
+
// Prompt user for resolution
|
|
266
|
+
const resolution = await promptConflictResolution(existingContent, CHARACTER_COUNT_RULE_CONTENT, verbose);
|
|
267
|
+
if (resolution === 'skip') {
|
|
268
|
+
return {
|
|
269
|
+
success: true,
|
|
270
|
+
created: false,
|
|
271
|
+
skipped: true,
|
|
272
|
+
path: rulePath
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
else if (resolution === 'keep') {
|
|
276
|
+
return {
|
|
277
|
+
success: true,
|
|
278
|
+
created: false,
|
|
279
|
+
skipped: true,
|
|
280
|
+
path: rulePath
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
// 'replace' falls through to write
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
// Default: skip with warning
|
|
287
|
+
if (verbose) {
|
|
288
|
+
console.log(chalk_1.default.yellow('⚠ Character count rule exists with different content, skipping...'));
|
|
289
|
+
console.log(chalk_1.default.gray(' Use --force to replace'));
|
|
290
|
+
}
|
|
291
|
+
return {
|
|
292
|
+
success: true,
|
|
293
|
+
created: false,
|
|
294
|
+
skipped: true,
|
|
295
|
+
path: rulePath
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// Create .augment directory if it doesn't exist
|
|
300
|
+
if (!fsSync.existsSync(augmentDir)) {
|
|
301
|
+
await createDirectorySafe(augmentDir, verbose);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
// Check if directory is writable
|
|
305
|
+
const isWritable = await checkDirectoryWritable(augmentDir);
|
|
306
|
+
if (!isWritable) {
|
|
307
|
+
throw new InstallRulesError(`Permission denied: .augment directory is not writable`, 'PERMISSION_DENIED');
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
// Create rules directory if it doesn't exist
|
|
311
|
+
if (!fsSync.existsSync(rulesDir)) {
|
|
312
|
+
await createDirectorySafe(rulesDir, verbose);
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
// Check if directory is writable
|
|
316
|
+
const isWritable = await checkDirectoryWritable(rulesDir);
|
|
317
|
+
if (!isWritable) {
|
|
318
|
+
throw new InstallRulesError(`Permission denied: .augment/rules directory is not writable`, 'PERMISSION_DENIED');
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// Write the rule file with rollback support
|
|
322
|
+
await writeFileSafe(rulePath, CHARACTER_COUNT_RULE_CONTENT, verbose);
|
|
323
|
+
if (verbose) {
|
|
324
|
+
console.log(chalk_1.default.green('✓ Installed character count management rule'));
|
|
325
|
+
}
|
|
326
|
+
return {
|
|
327
|
+
success: true,
|
|
328
|
+
created: !ruleExists,
|
|
329
|
+
updated: ruleExists,
|
|
330
|
+
skipped: false,
|
|
331
|
+
path: rulePath
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
catch (error) {
|
|
335
|
+
// Handle InstallRulesError with specific error types
|
|
336
|
+
if (error instanceof InstallRulesError) {
|
|
337
|
+
if (verbose) {
|
|
338
|
+
console.error(chalk_1.default.red('✗ Failed to install character count rule:'));
|
|
339
|
+
console.error(chalk_1.default.red(` ${error.message}`));
|
|
340
|
+
// Provide helpful suggestions based on error type
|
|
341
|
+
if (error.type === 'PERMISSION_DENIED') {
|
|
342
|
+
console.error(chalk_1.default.yellow('\n Suggestions:'));
|
|
343
|
+
console.error(chalk_1.default.yellow(' - Check file/directory permissions'));
|
|
344
|
+
console.error(chalk_1.default.yellow(' - Run with appropriate privileges (sudo on Unix)'));
|
|
345
|
+
console.error(chalk_1.default.yellow(' - Ensure .augment directory is not read-only'));
|
|
346
|
+
}
|
|
347
|
+
else if (error.type === 'DISK_FULL') {
|
|
348
|
+
console.error(chalk_1.default.yellow('\n Suggestions:'));
|
|
349
|
+
console.error(chalk_1.default.yellow(' - Free up disk space'));
|
|
350
|
+
console.error(chalk_1.default.yellow(' - Check disk quota'));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return {
|
|
354
|
+
success: false,
|
|
355
|
+
created: false,
|
|
356
|
+
skipped: false,
|
|
357
|
+
error: error.message,
|
|
358
|
+
errorType: error.type
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
// Handle generic errors
|
|
362
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
363
|
+
if (verbose) {
|
|
364
|
+
console.error(chalk_1.default.red('✗ Failed to install character count rule:'), errorMessage);
|
|
365
|
+
}
|
|
366
|
+
return {
|
|
367
|
+
success: false,
|
|
368
|
+
created: false,
|
|
369
|
+
skipped: false,
|
|
370
|
+
error: errorMessage,
|
|
371
|
+
errorType: 'UNKNOWN'
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
//# sourceMappingURL=install-rules.js.map
|