@mytechtoday/augment-extensions 0.2.0 → 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/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/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 +29 -99
- 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 +518 -106
- package/package.json +12 -3
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-rules.js","sourceRoot":"","sources":["../../src/utils/install-rules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2OA,8DAoLC;AA/ZD,gDAAkC;AAClC,2CAA6B;AAC7B,2CAA6B;AAC7B,kDAA0B;AAE1B;;;GAGG;AACH,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDpC,CAAC;AAoBF;;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AC,CAAC;QAE5E,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,2CAA2C,CAAC,EAAE,YAAY,CAAC,CAAC;QACtF,CAAC;QAED,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,YAAY;YACnB,SAAS,EAAE,SAAS;SACrB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Integration Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides integration with Model Context Protocol (MCP) servers
|
|
5
|
+
* using mcporter-inspired patterns for CLI wrapping.
|
|
6
|
+
*/
|
|
7
|
+
export interface MCPServerConfig {
|
|
8
|
+
name: string;
|
|
9
|
+
command: string;
|
|
10
|
+
args?: string[];
|
|
11
|
+
transport: 'stdio' | 'http';
|
|
12
|
+
url?: string;
|
|
13
|
+
env?: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
export interface MCPTool {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
inputSchema: any;
|
|
19
|
+
}
|
|
20
|
+
export interface MCPServerInfo {
|
|
21
|
+
config: MCPServerConfig;
|
|
22
|
+
tools: MCPTool[];
|
|
23
|
+
connected: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get MCP configuration directory
|
|
27
|
+
*/
|
|
28
|
+
export declare function getMCPConfigDir(repoRoot?: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Load MCP server configurations
|
|
31
|
+
*/
|
|
32
|
+
export declare function loadMCPConfigs(repoRoot?: string): MCPServerConfig[];
|
|
33
|
+
/**
|
|
34
|
+
* Save MCP server configurations
|
|
35
|
+
*/
|
|
36
|
+
export declare function saveMCPConfigs(configs: MCPServerConfig[], repoRoot?: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Add MCP server configuration
|
|
39
|
+
*/
|
|
40
|
+
export declare function addMCPServer(config: MCPServerConfig, repoRoot?: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Remove MCP server configuration
|
|
43
|
+
*/
|
|
44
|
+
export declare function removeMCPServer(name: string, repoRoot?: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Execute MCP server command (stdio transport)
|
|
47
|
+
*/
|
|
48
|
+
export declare function executeMCPCommand(serverName: string, toolName: string, args: any, repoRoot?: string): Promise<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Generate CLI wrapper for MCP server
|
|
51
|
+
*
|
|
52
|
+
* This creates a skill file that wraps an MCP server tool as a CLI command.
|
|
53
|
+
*/
|
|
54
|
+
export declare function generateMCPSkillWrapper(serverName: string, toolName: string, skillId: string, category: string, repoRoot?: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Discover available MCP tools from a server
|
|
57
|
+
*
|
|
58
|
+
* Note: This is a simplified version. Full implementation would require
|
|
59
|
+
* proper MCP protocol negotiation and tool discovery.
|
|
60
|
+
*/
|
|
61
|
+
export declare function discoverMCPTools(serverName: string, repoRoot?: string): Promise<MCPTool[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Check if mcporter is available
|
|
64
|
+
*/
|
|
65
|
+
export declare function isMCPorterAvailable(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Generate CLI using mcporter (if available)
|
|
68
|
+
*/
|
|
69
|
+
export declare function generateCLIWithMCPorter(serverCommand: string, outputPath: string): Promise<void>;
|
|
70
|
+
//# sourceMappingURL=mcp-integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-integration.d.ts","sourceRoot":"","sources":["../../src/utils/mcp-integration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,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