@mytechtoday/augment-extensions 0.4.0 → 0.7.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 +6 -6
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-latte/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-latte/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-mocha/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-mocha/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/dracula/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/dracula/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-dark/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-dark/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-light/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-light/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/high-contrast/README.md +27 -0
- package/augment-extensions/domain-rules/design/color/themes/high-contrast/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/monokai/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/monokai/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/nord/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/nord/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/one-dark/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/one-dark/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/one-light/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/one-light/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/solarized-dark/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/solarized-dark/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/solarized-light/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/solarized-light/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/tokyo-night/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/tokyo-night/module.json +26 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/README.md +136 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/SCHEMA-VALIDATION-REPORT.md +216 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/brand-kit-example.yaml +292 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/campaign-brief-example.yaml +389 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/content-calendar-example.yaml +643 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/email-newsletter-example.md +376 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/landing-page-example.md +934 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/ppc-ad-copy-example.md +301 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/seo-blog-post-example.md +347 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/social-media-campaign-example.md +606 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/module.json +50 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/affiliate-influencer-marketing.md +593 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/asset-management.md +418 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/brand-consistency.md +210 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/content-marketing.md +337 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/conversion-optimization.md +455 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/direct-sales.md +499 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/email-marketing.md +439 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/legal-compliance.md +227 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/ppc-advertising.md +569 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/seo-optimization.md +470 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/social-media-marketing.md +414 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/universal-marketing.md +177 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/asset-inventory.schema.json +247 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/brand-kit.schema.json +326 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/campaign-brief.schema.json +342 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/color-palette.schema.json +223 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/content-template.schema.json +383 -0
- package/augment-extensions/workflows/beads-integration/IMPLEMENTATION-STATUS.md +145 -0
- package/augment-extensions/workflows/beads-integration/README.md +143 -0
- package/augment-extensions/workflows/beads-integration/config/defaults.json +32 -0
- package/augment-extensions/workflows/beads-integration/config/schema.json +140 -0
- package/augment-extensions/workflows/beads-integration/examples/basic-task-generation.md +293 -0
- package/augment-extensions/workflows/beads-integration/module.json +75 -0
- package/augment-extensions/workflows/beads-integration/rules/core-rules.md +219 -0
- package/augment-extensions/workflows/beads-integration/rules/effectiveness-standards.md +256 -0
- package/augment-extensions/workflows/beads-integration/rules/task-generation.md +607 -0
- package/augment-extensions/writing-standards/screenplay/README.md +135 -6
- package/augment-extensions/writing-standards/screenplay/_templates/README.md +121 -0
- package/augment-extensions/writing-standards/screenplay/_templates/genre-template.md +153 -0
- package/augment-extensions/writing-standards/screenplay/_templates/style-template.md +243 -0
- package/augment-extensions/writing-standards/screenplay/_templates/theme-template.md +213 -0
- package/augment-extensions/writing-standards/screenplay/examples/beat-sheet-example.yaml +95 -0
- package/augment-extensions/writing-standards/screenplay/examples/character-profile-example.yaml +116 -0
- package/augment-extensions/writing-standards/screenplay/examples/commercial-30sec.fountain +151 -0
- package/augment-extensions/writing-standards/screenplay/examples/independent-monologue.fountain +67 -0
- package/augment-extensions/writing-standards/screenplay/examples/news-segment.fountain +142 -0
- package/augment-extensions/writing-standards/screenplay/examples/plot-outline-example.yaml +184 -0
- package/augment-extensions/writing-standards/screenplay/examples/tv-episode-teaser.fountain +204 -0
- package/augment-extensions/writing-standards/screenplay/genres/README.md +181 -0
- package/augment-extensions/writing-standards/screenplay/genres/examples/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/genres/module.json +70 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/action.md +399 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/adventure.md +407 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/animation.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/biographical.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/comedy.md +401 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/documentary.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/drama.md +409 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/fantasy.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/historical.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/horror.md +268 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/musical.md +294 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/mystery.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/noir.md +294 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/romance.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/sci-fi.md +289 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/superhero.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/thriller.md +294 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/western.md +293 -0
- package/augment-extensions/writing-standards/screenplay/module.json +1 -1
- package/augment-extensions/writing-standards/screenplay/rules/aaa-hollywood-films.md +339 -0
- package/augment-extensions/writing-standards/screenplay/rules/ai-integration-testing.md +329 -0
- package/augment-extensions/writing-standards/screenplay/rules/character-development.md +169 -0
- package/augment-extensions/writing-standards/screenplay/rules/commercials.md +437 -0
- package/augment-extensions/writing-standards/screenplay/rules/dialogue-writing.md +263 -0
- package/augment-extensions/writing-standards/screenplay/rules/diversity-inclusion.md +261 -0
- package/augment-extensions/writing-standards/screenplay/rules/examples-guide.md +315 -0
- package/augment-extensions/writing-standards/screenplay/rules/formatting-validation.md +413 -0
- package/augment-extensions/writing-standards/screenplay/rules/fountain-format.md +372 -0
- package/augment-extensions/writing-standards/screenplay/rules/independent-films.md +374 -0
- package/augment-extensions/writing-standards/screenplay/rules/live-tv-productions.md +443 -0
- package/augment-extensions/writing-standards/screenplay/rules/narrative-structures.md +207 -0
- package/augment-extensions/writing-standards/screenplay/rules/news-broadcasts.md +444 -0
- package/augment-extensions/writing-standards/screenplay/rules/pacing-timing.md +331 -0
- package/augment-extensions/writing-standards/screenplay/rules/quality-review-checklist.md +334 -0
- package/augment-extensions/writing-standards/screenplay/rules/quick-reference.md +299 -0
- package/augment-extensions/writing-standards/screenplay/rules/screen-continuity.md +263 -0
- package/augment-extensions/writing-standards/screenplay/rules/streaming-content.md +412 -0
- package/augment-extensions/writing-standards/screenplay/rules/trope-management.md +370 -0
- package/augment-extensions/writing-standards/screenplay/rules/tv-series.md +374 -0
- package/augment-extensions/writing-standards/screenplay/rules/vscode-integration.md +277 -0
- package/augment-extensions/writing-standards/screenplay/rules/web-content.md +393 -0
- package/augment-extensions/writing-standards/screenplay/schemas/beat-sheet.json +332 -0
- package/augment-extensions/writing-standards/screenplay/schemas/character-profile.json +247 -0
- package/augment-extensions/writing-standards/screenplay/schemas/feature-selection.json +200 -0
- package/augment-extensions/writing-standards/screenplay/schemas/plot-outline.json +233 -0
- package/augment-extensions/writing-standards/screenplay/schemas/screenplay-config.json +245 -0
- package/augment-extensions/writing-standards/screenplay/schemas/trope-inventory.json +221 -0
- package/augment-extensions/writing-standards/screenplay/styles/README.md +159 -0
- package/augment-extensions/writing-standards/screenplay/styles/examples/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/styles/examples/style-applications.md +1449 -0
- package/augment-extensions/writing-standards/screenplay/styles/module.json +64 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/dialogue-centric.md +520 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/ensemble.md +499 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/epic.md +497 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/experimental.md +492 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/flashback.md +509 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/linear.md +490 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/minimalist.md +499 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/non-linear.md +501 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/poetic.md +499 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/realistic.md +498 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/satirical.md +499 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/surreal.md +508 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/voice-over.md +500 -0
- package/augment-extensions/writing-standards/screenplay/themes/README.md +158 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/common-mistakes-and-fixes.md +643 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/complete-scene-example.md +311 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/individual-theme-examples.md +562 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/multi-theme-weaving.md +538 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/theme-application-guide.md +432 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/theme-integration-across-acts.md +637 -0
- package/augment-extensions/writing-standards/screenplay/themes/module.json +66 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/ambition.md +458 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/betrayal.md +490 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/environment.md +458 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/fate.md +459 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/friendship.md +491 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/growth.md +491 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/identity.md +490 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/isolation.md +464 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/justice.md +461 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/love.md +489 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/power.md +494 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/redemption.md +483 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/revenge.md +489 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/survival.md +496 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/technology.md +463 -0
- package/cli/dist/cli.js +30 -1
- package/cli/dist/cli.js.map +1 -1
- package/cli/dist/commands/show.d.ts +23 -0
- package/cli/dist/commands/show.d.ts.map +1 -1
- package/cli/dist/commands/show.js +928 -10
- package/cli/dist/commands/show.js.map +1 -1
- package/cli/dist/types/gui.d.ts +62 -0
- package/cli/dist/types/gui.d.ts.map +1 -0
- package/cli/dist/types/gui.js +30 -0
- package/cli/dist/types/gui.js.map +1 -0
- package/cli/dist/utils/config-system.d.ts +111 -0
- package/cli/dist/utils/config-system.d.ts.map +1 -0
- package/cli/dist/utils/config-system.js +239 -0
- package/cli/dist/utils/config-system.js.map +1 -0
- package/cli/dist/utils/gui-helpers.d.ts +23 -0
- package/cli/dist/utils/gui-helpers.d.ts.map +1 -0
- package/cli/dist/utils/gui-helpers.js +159 -0
- package/cli/dist/utils/gui-helpers.js.map +1 -0
- package/cli/dist/utils/hook-system.d.ts +84 -0
- package/cli/dist/utils/hook-system.d.ts.map +1 -0
- package/cli/dist/utils/hook-system.js +151 -0
- package/cli/dist/utils/hook-system.js.map +1 -0
- package/cli/dist/utils/inspection-cache.d.ts +56 -0
- package/cli/dist/utils/inspection-cache.d.ts.map +1 -0
- package/cli/dist/utils/inspection-cache.js +166 -0
- package/cli/dist/utils/inspection-cache.js.map +1 -0
- package/cli/dist/utils/inspection-handlers.d.ts +75 -0
- package/cli/dist/utils/inspection-handlers.d.ts.map +1 -0
- package/cli/dist/utils/inspection-handlers.js +171 -0
- package/cli/dist/utils/inspection-handlers.js.map +1 -0
- package/cli/dist/utils/module-system.d.ts +81 -1
- package/cli/dist/utils/module-system.d.ts.map +1 -1
- package/cli/dist/utils/module-system.js +393 -16
- package/cli/dist/utils/module-system.js.map +1 -1
- package/cli/dist/utils/plugin-system.d.ts +133 -0
- package/cli/dist/utils/plugin-system.d.ts.map +1 -0
- package/cli/dist/utils/plugin-system.js +210 -0
- package/cli/dist/utils/plugin-system.js.map +1 -0
- package/cli/dist/utils/progress.d.ts +67 -0
- package/cli/dist/utils/progress.d.ts.map +1 -0
- package/cli/dist/utils/progress.js +146 -0
- package/cli/dist/utils/progress.js.map +1 -0
- package/cli/dist/utils/stream-reader.d.ts +34 -0
- package/cli/dist/utils/stream-reader.d.ts.map +1 -0
- package/cli/dist/utils/stream-reader.js +147 -0
- package/cli/dist/utils/stream-reader.js.map +1 -0
- package/cli/dist/utils/vscode-editor.d.ts +45 -0
- package/cli/dist/utils/vscode-editor.d.ts.map +1 -0
- package/cli/dist/utils/vscode-editor.js +171 -0
- package/cli/dist/utils/vscode-editor.js.map +1 -0
- package/cli/dist/utils/vscode-links.d.ts +49 -0
- package/cli/dist/utils/vscode-links.d.ts.map +1 -0
- package/cli/dist/utils/vscode-links.js +167 -0
- package/cli/dist/utils/vscode-links.js.map +1 -0
- package/modules.md +44 -2
- package/package.json +6 -4
|
@@ -1,11 +1,57 @@
|
|
|
1
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
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
39
|
exports.showCommand = showCommand;
|
|
40
|
+
exports.showModuleCommand = showModuleCommand;
|
|
7
41
|
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
const highlight_js_1 = __importDefault(require("highlight.js"));
|
|
8
45
|
const module_system_1 = require("../utils/module-system");
|
|
46
|
+
const inspection_cache_1 = require("../utils/inspection-cache");
|
|
47
|
+
const stream_reader_1 = require("../utils/stream-reader");
|
|
48
|
+
const progress_1 = require("../utils/progress");
|
|
49
|
+
const vscode_links_1 = require("../utils/vscode-links");
|
|
50
|
+
const vscode_editor_1 = require("../utils/vscode-editor");
|
|
51
|
+
/**
|
|
52
|
+
* Legacy show command - displays basic module information
|
|
53
|
+
* @deprecated Use showModuleCommand for enhanced inspection
|
|
54
|
+
*/
|
|
9
55
|
async function showCommand(moduleName, options) {
|
|
10
56
|
try {
|
|
11
57
|
const module = (0, module_system_1.findModule)(moduleName);
|
|
@@ -62,16 +108,888 @@ async function showCommand(moduleName, options) {
|
|
|
62
108
|
process.exit(1);
|
|
63
109
|
}
|
|
64
110
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Enhanced module inspection command with advanced features
|
|
113
|
+
* Supports module overview, content viewing, and file inspection
|
|
114
|
+
*/
|
|
115
|
+
async function showModuleCommand(moduleName, filePath, options) {
|
|
116
|
+
try {
|
|
117
|
+
// Validate module name
|
|
118
|
+
if (!moduleName || moduleName.trim() === '') {
|
|
119
|
+
console.error(chalk_1.default.red('Error: Module name is required'));
|
|
120
|
+
console.log(chalk_1.default.gray('\nUsage: augx show module <module-name> [file-path] [options]'));
|
|
121
|
+
console.log(chalk_1.default.gray('Example: augx show module php-standards'));
|
|
122
|
+
console.log(chalk_1.default.gray(' augx show module php-standards rules/psr-standards.md'));
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
// Disable cache if --no-cache flag is set
|
|
126
|
+
if (options.noCache) {
|
|
127
|
+
inspection_cache_1.moduleInspectionCache.setEnabled(false);
|
|
128
|
+
}
|
|
129
|
+
// Discover and validate module using enhanced discovery
|
|
130
|
+
const module = (0, module_system_1.findModuleEnhanced)(moduleName);
|
|
131
|
+
if (!module) {
|
|
132
|
+
console.error(chalk_1.default.red(`Module not found: ${moduleName}`));
|
|
133
|
+
// Suggest similar modules using enhanced suggestions
|
|
134
|
+
const suggestions = (0, module_system_1.getModuleSuggestions)(moduleName, 5);
|
|
135
|
+
if (suggestions.length > 0) {
|
|
136
|
+
console.log(chalk_1.default.yellow('\nDid you mean one of these?'));
|
|
137
|
+
suggestions.forEach(suggestion => {
|
|
138
|
+
console.log(chalk_1.default.cyan(` • ${suggestion.fullName}`));
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
console.log(chalk_1.default.gray('\nUse "augx list" to see all available modules.'));
|
|
142
|
+
process.exit(1);
|
|
143
|
+
}
|
|
144
|
+
// Route to appropriate handler based on options and arguments
|
|
145
|
+
if (filePath) {
|
|
146
|
+
// Individual file inspection
|
|
147
|
+
await showModuleFile(module, filePath, options);
|
|
148
|
+
}
|
|
149
|
+
else if (options.content) {
|
|
150
|
+
// Aggregated content view
|
|
151
|
+
await showModuleContent(module, options);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
// Module overview (default)
|
|
155
|
+
await showModuleOverview(module, options);
|
|
156
|
+
}
|
|
157
|
+
// Re-enable cache after command completes
|
|
158
|
+
if (options.noCache) {
|
|
159
|
+
inspection_cache_1.moduleInspectionCache.setEnabled(true);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
console.error(chalk_1.default.red('Error inspecting module:'), error);
|
|
164
|
+
if (error instanceof Error) {
|
|
165
|
+
console.error(chalk_1.default.gray(error.message));
|
|
166
|
+
}
|
|
167
|
+
// Re-enable cache on error
|
|
168
|
+
if (options.noCache) {
|
|
169
|
+
inspection_cache_1.moduleInspectionCache.setEnabled(true);
|
|
170
|
+
}
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Display module overview with metadata and file listing
|
|
176
|
+
*/
|
|
177
|
+
async function showModuleOverview(module, options) {
|
|
178
|
+
// Try to get from cache first
|
|
179
|
+
const cacheKey = `overview:${module.fullName}`;
|
|
180
|
+
let extendedMetadata = inspection_cache_1.moduleInspectionCache.get(cacheKey, module.path);
|
|
181
|
+
if (!extendedMetadata) {
|
|
182
|
+
// Extract comprehensive metadata
|
|
183
|
+
extendedMetadata = (0, module_system_1.extractModuleMetadata)(module.path);
|
|
184
|
+
if (!extendedMetadata) {
|
|
185
|
+
console.error(chalk_1.default.red('Failed to extract module metadata'));
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
// Cache the result
|
|
189
|
+
inspection_cache_1.moduleInspectionCache.set(cacheKey, extendedMetadata, module.path);
|
|
190
|
+
}
|
|
191
|
+
// Handle JSON output format
|
|
192
|
+
if (options.json || options.format === 'json') {
|
|
193
|
+
const jsonOutput = {
|
|
194
|
+
name: module.fullName,
|
|
195
|
+
version: extendedMetadata.version,
|
|
196
|
+
type: extendedMetadata.type,
|
|
197
|
+
description: extendedMetadata.description,
|
|
198
|
+
displayName: extendedMetadata.displayName,
|
|
199
|
+
tags: extendedMetadata.tags,
|
|
200
|
+
path: module.path,
|
|
201
|
+
files: {
|
|
202
|
+
total: extendedMetadata.files?.total || 0,
|
|
203
|
+
rules: extendedMetadata.files?.rules || 0,
|
|
204
|
+
examples: extendedMetadata.files?.examples || 0,
|
|
205
|
+
other: extendedMetadata.files?.other || 0
|
|
206
|
+
},
|
|
207
|
+
size: {
|
|
208
|
+
totalBytes: extendedMetadata.size?.totalBytes || 0,
|
|
209
|
+
totalCharacters: extendedMetadata.size?.totalCharacters || 0
|
|
210
|
+
},
|
|
211
|
+
lastModified: extendedMetadata.lastModified,
|
|
212
|
+
augment: extendedMetadata.augment
|
|
213
|
+
};
|
|
214
|
+
console.log(JSON.stringify(jsonOutput, null, 2));
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
// Handle Markdown output format
|
|
218
|
+
if (options.format === 'markdown') {
|
|
219
|
+
console.log(`# ${module.fullName}\n`);
|
|
220
|
+
console.log(`**Version:** ${extendedMetadata.version}\n`);
|
|
221
|
+
console.log(`**Type:** ${extendedMetadata.type}\n`);
|
|
222
|
+
console.log(`**Description:** ${extendedMetadata.description}\n`);
|
|
223
|
+
if (extendedMetadata.tags && extendedMetadata.tags.length > 0) {
|
|
224
|
+
console.log(`**Tags:** ${extendedMetadata.tags.join(', ')}\n`);
|
|
225
|
+
}
|
|
226
|
+
console.log(`## Files\n`);
|
|
227
|
+
console.log(`- Total: ${extendedMetadata.files?.total || 0}`);
|
|
228
|
+
console.log(`- Rules: ${extendedMetadata.files?.rules || 0}`);
|
|
229
|
+
console.log(`- Examples: ${extendedMetadata.files?.examples || 0}`);
|
|
230
|
+
console.log(`- Other: ${extendedMetadata.files?.other || 0}\n`);
|
|
231
|
+
console.log(`## Size\n`);
|
|
232
|
+
const totalBytes = extendedMetadata.size?.totalBytes || 0;
|
|
233
|
+
const totalChars = extendedMetadata.size?.totalCharacters || 0;
|
|
234
|
+
console.log(`- Total: ${formatBytes(totalBytes)} (${totalBytes.toLocaleString()} bytes)`);
|
|
235
|
+
console.log(`- Characters: ${totalChars.toLocaleString()}\n`);
|
|
236
|
+
if (extendedMetadata.lastModified) {
|
|
237
|
+
console.log(`**Last Modified:** ${formatDate(extendedMetadata.lastModified)}\n`);
|
|
238
|
+
}
|
|
239
|
+
console.log(`**Location:** \`${module.path}\`\n`);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
// Handle plain text output format (ASCII-only, no colors)
|
|
243
|
+
if (options.format === 'text') {
|
|
244
|
+
console.log();
|
|
245
|
+
console.log(`Module: ${module.fullName}`);
|
|
246
|
+
console.log('='.repeat(60));
|
|
247
|
+
console.log();
|
|
248
|
+
console.log('Metadata:');
|
|
249
|
+
console.log(` Name: ${extendedMetadata.displayName}`);
|
|
250
|
+
console.log(` Version: ${extendedMetadata.version}`);
|
|
251
|
+
console.log(` Type: ${extendedMetadata.type}`);
|
|
252
|
+
console.log(` Description: ${extendedMetadata.description}`);
|
|
253
|
+
if (extendedMetadata.tags && extendedMetadata.tags.length > 0) {
|
|
254
|
+
console.log(` Tags: ${extendedMetadata.tags.join(', ')}`);
|
|
255
|
+
}
|
|
256
|
+
console.log();
|
|
257
|
+
console.log('Files:');
|
|
258
|
+
console.log(` Total: ${extendedMetadata.files?.total || 0}`);
|
|
259
|
+
console.log(` Rules: ${extendedMetadata.files?.rules || 0}`);
|
|
260
|
+
console.log(` Examples: ${extendedMetadata.files?.examples || 0}`);
|
|
261
|
+
console.log(` Other: ${extendedMetadata.files?.other || 0}`);
|
|
262
|
+
console.log();
|
|
263
|
+
console.log('Size:');
|
|
264
|
+
const totalBytes = extendedMetadata.size?.totalBytes || 0;
|
|
265
|
+
const totalChars = extendedMetadata.size?.totalCharacters || 0;
|
|
266
|
+
console.log(` Total: ${formatBytes(totalBytes)} (${totalBytes.toLocaleString()} bytes)`);
|
|
267
|
+
console.log(` Characters: ${totalChars.toLocaleString()}`);
|
|
268
|
+
console.log();
|
|
269
|
+
if (extendedMetadata.lastModified) {
|
|
270
|
+
console.log('Last Modified:');
|
|
271
|
+
console.log(` ${formatDate(extendedMetadata.lastModified)}`);
|
|
272
|
+
console.log();
|
|
273
|
+
}
|
|
274
|
+
console.log('Location:');
|
|
275
|
+
console.log(` ${module.path}`);
|
|
276
|
+
console.log();
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
// Colored text output format (default)
|
|
280
|
+
console.log();
|
|
281
|
+
console.log(chalk_1.default.bold.blue(`📦 ${module.fullName}`));
|
|
282
|
+
console.log(chalk_1.default.gray('─'.repeat(60)));
|
|
283
|
+
console.log();
|
|
284
|
+
// Basic metadata
|
|
285
|
+
console.log(chalk_1.default.bold('Metadata:'));
|
|
286
|
+
console.log(chalk_1.default.gray(` Name: ${extendedMetadata.displayName}`));
|
|
287
|
+
console.log(chalk_1.default.gray(` Version: ${extendedMetadata.version}`));
|
|
288
|
+
console.log(chalk_1.default.gray(` Type: ${extendedMetadata.type}`));
|
|
289
|
+
console.log(chalk_1.default.gray(` Description: ${extendedMetadata.description}`));
|
|
290
|
+
if (extendedMetadata.tags && extendedMetadata.tags.length > 0) {
|
|
291
|
+
console.log(chalk_1.default.gray(` Tags: ${extendedMetadata.tags.join(', ')}`));
|
|
292
|
+
}
|
|
293
|
+
console.log();
|
|
294
|
+
// File statistics
|
|
295
|
+
console.log(chalk_1.default.bold('Files:'));
|
|
296
|
+
console.log(chalk_1.default.gray(` Total: ${extendedMetadata.files?.total || 0}`));
|
|
297
|
+
console.log(chalk_1.default.cyan(` Rules: ${extendedMetadata.files?.rules || 0}`));
|
|
298
|
+
console.log(chalk_1.default.green(` Examples: ${extendedMetadata.files?.examples || 0}`));
|
|
299
|
+
console.log(chalk_1.default.gray(` Other: ${extendedMetadata.files?.other || 0}`));
|
|
300
|
+
console.log();
|
|
301
|
+
// Size statistics
|
|
302
|
+
console.log(chalk_1.default.bold('Size:'));
|
|
303
|
+
const totalBytes = extendedMetadata.size?.totalBytes || 0;
|
|
304
|
+
const totalChars = extendedMetadata.size?.totalCharacters || 0;
|
|
305
|
+
console.log(chalk_1.default.gray(` Total: ${formatBytes(totalBytes)} (${totalBytes.toLocaleString()} bytes)`));
|
|
306
|
+
console.log(chalk_1.default.gray(` Characters: ${totalChars.toLocaleString()}`));
|
|
307
|
+
console.log();
|
|
308
|
+
// Last modified
|
|
309
|
+
if (extendedMetadata.lastModified) {
|
|
310
|
+
console.log(chalk_1.default.bold('Last Modified:'));
|
|
311
|
+
console.log(chalk_1.default.gray(` ${formatDate(extendedMetadata.lastModified)}`));
|
|
312
|
+
console.log();
|
|
313
|
+
}
|
|
314
|
+
// Augment configuration
|
|
315
|
+
if (extendedMetadata.augment) {
|
|
316
|
+
console.log(chalk_1.default.bold('Augment Configuration:'));
|
|
317
|
+
if (extendedMetadata.augment.priority) {
|
|
318
|
+
console.log(chalk_1.default.gray(` Priority: ${extendedMetadata.augment.priority}`));
|
|
319
|
+
}
|
|
320
|
+
if (extendedMetadata.augment.category) {
|
|
321
|
+
console.log(chalk_1.default.gray(` Category: ${extendedMetadata.augment.category}`));
|
|
322
|
+
}
|
|
323
|
+
if (extendedMetadata.augment.characterCount !== undefined) {
|
|
324
|
+
console.log(chalk_1.default.gray(` Char Count: ${extendedMetadata.augment.characterCount.toLocaleString()}`));
|
|
325
|
+
}
|
|
326
|
+
console.log();
|
|
327
|
+
}
|
|
328
|
+
// Path information
|
|
329
|
+
console.log(chalk_1.default.bold('Location:'));
|
|
330
|
+
console.log(chalk_1.default.gray(` ${module.path}`));
|
|
331
|
+
console.log();
|
|
332
|
+
// Helpful commands
|
|
333
|
+
console.log(chalk_1.default.bold('Commands:'));
|
|
334
|
+
console.log(chalk_1.default.gray(` View content: augx show module ${module.fullName} --content`));
|
|
335
|
+
console.log(chalk_1.default.gray(` List files: augx show module ${module.fullName} --filter "*.md"`));
|
|
336
|
+
console.log(chalk_1.default.gray(` Search content: augx show module ${module.fullName} --search "keyword"`));
|
|
337
|
+
console.log();
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Format bytes to human-readable format
|
|
341
|
+
*/
|
|
342
|
+
function formatBytes(bytes) {
|
|
343
|
+
if (bytes === 0)
|
|
344
|
+
return '0 B';
|
|
345
|
+
const k = 1024;
|
|
346
|
+
const sizes = ['B', 'KB', 'MB', 'GB'];
|
|
347
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
348
|
+
return `${(bytes / Math.pow(k, i)).toFixed(2)} ${sizes[i]}`;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Format date to human-readable format
|
|
352
|
+
*/
|
|
353
|
+
function formatDate(date) {
|
|
354
|
+
const now = new Date();
|
|
355
|
+
const diffMs = now.getTime() - date.getTime();
|
|
356
|
+
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
|
357
|
+
if (diffDays === 0) {
|
|
358
|
+
return `Today at ${date.toLocaleTimeString()}`;
|
|
359
|
+
}
|
|
360
|
+
else if (diffDays === 1) {
|
|
361
|
+
return `Yesterday at ${date.toLocaleTimeString()}`;
|
|
362
|
+
}
|
|
363
|
+
else if (diffDays < 7) {
|
|
364
|
+
return `${diffDays} days ago`;
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
return date.toLocaleDateString();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Display aggregated content from all module files
|
|
372
|
+
*/
|
|
373
|
+
async function showModuleContent(module, options) {
|
|
374
|
+
const { listModuleFiles } = await Promise.resolve().then(() => __importStar(require('../utils/module-system')));
|
|
375
|
+
// Get all markdown files from the module
|
|
376
|
+
const files = listModuleFiles(module.path, {
|
|
377
|
+
recursive: true,
|
|
378
|
+
filter: options.filter || '*.md',
|
|
379
|
+
groupByDirectory: true,
|
|
380
|
+
depth: options.depth
|
|
381
|
+
});
|
|
382
|
+
if (files.length === 0) {
|
|
383
|
+
console.log(chalk_1.default.yellow('No markdown files found in module'));
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
// Apply search filter if provided
|
|
387
|
+
let searchResults = [];
|
|
388
|
+
if (options.search) {
|
|
389
|
+
searchResults = performSearch(files, options.search);
|
|
390
|
+
if (searchResults.length === 0) {
|
|
391
|
+
console.log(chalk_1.default.yellow(`No matches found for: "${options.search}"`));
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
// Handle search results display
|
|
396
|
+
if (options.search && searchResults.length > 0) {
|
|
397
|
+
displaySearchResults(module, searchResults, options);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
// Handle JSON output format
|
|
401
|
+
if (options.json || options.format === 'json') {
|
|
402
|
+
const jsonOutput = {
|
|
403
|
+
module: module.fullName,
|
|
404
|
+
fileCount: files.length,
|
|
405
|
+
files: files.map(f => ({
|
|
406
|
+
path: f.relativePath,
|
|
407
|
+
size: f.size,
|
|
408
|
+
modified: f.modified,
|
|
409
|
+
type: f.type
|
|
410
|
+
})),
|
|
411
|
+
content: files.map(f => {
|
|
412
|
+
let content = fs.readFileSync(f.path, 'utf-8');
|
|
413
|
+
if (options.secure) {
|
|
414
|
+
content = redactSensitiveData(content, false);
|
|
415
|
+
}
|
|
416
|
+
return {
|
|
417
|
+
file: f.relativePath,
|
|
418
|
+
content: content
|
|
419
|
+
};
|
|
420
|
+
})
|
|
421
|
+
};
|
|
422
|
+
console.log(JSON.stringify(jsonOutput, null, 2));
|
|
423
|
+
// Log redactions summary if secure mode is enabled
|
|
424
|
+
if (options.secure) {
|
|
425
|
+
console.error(chalk_1.default.yellow('\n⚠️ Sensitive data has been redacted from output'));
|
|
426
|
+
}
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
// Handle Markdown output format
|
|
430
|
+
if (options.format === 'markdown') {
|
|
431
|
+
console.log(`# ${module.fullName}\n`);
|
|
432
|
+
console.log(`**Module Type:** ${module.metadata.type}\n`);
|
|
433
|
+
console.log(`**Version:** ${module.metadata.version}\n`);
|
|
434
|
+
if (options.secure) {
|
|
435
|
+
console.log(`**Security:** Sensitive data redacted\n`);
|
|
436
|
+
}
|
|
437
|
+
console.log(`---\n`);
|
|
438
|
+
for (const file of files) {
|
|
439
|
+
console.log(`## ${file.relativePath}\n`);
|
|
440
|
+
let content = fs.readFileSync(file.path, 'utf-8');
|
|
441
|
+
if (options.secure) {
|
|
442
|
+
content = redactSensitiveData(content, false);
|
|
443
|
+
}
|
|
444
|
+
console.log(content);
|
|
445
|
+
console.log('\n---\n');
|
|
446
|
+
}
|
|
447
|
+
if (options.secure) {
|
|
448
|
+
console.log(`\n> ⚠️ Sensitive data has been redacted from this output\n`);
|
|
449
|
+
}
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
// Handle plain text output format (ASCII-only, no colors)
|
|
453
|
+
if (options.format === 'text') {
|
|
454
|
+
console.log();
|
|
455
|
+
console.log(`Aggregated Content: ${module.fullName}`);
|
|
456
|
+
console.log('='.repeat(60));
|
|
457
|
+
console.log();
|
|
458
|
+
console.log(`Files: ${files.length}`);
|
|
459
|
+
if (options.secure) {
|
|
460
|
+
console.log('Security: Sensitive data redacted');
|
|
461
|
+
}
|
|
462
|
+
console.log();
|
|
463
|
+
for (const file of files) {
|
|
464
|
+
console.log(`File: ${file.relativePath}`);
|
|
465
|
+
console.log(`Size: ${formatBytes(file.size)} | Modified: ${formatDate(file.modified)}`);
|
|
466
|
+
console.log('-'.repeat(60));
|
|
467
|
+
console.log();
|
|
468
|
+
let content = fs.readFileSync(file.path, 'utf-8');
|
|
469
|
+
if (options.secure) {
|
|
470
|
+
content = redactSensitiveData(content, false);
|
|
471
|
+
}
|
|
472
|
+
console.log(content);
|
|
473
|
+
console.log();
|
|
474
|
+
console.log('='.repeat(60));
|
|
475
|
+
console.log();
|
|
476
|
+
}
|
|
477
|
+
const totalSize = files.reduce((sum, f) => sum + f.size, 0);
|
|
478
|
+
console.log('Summary:');
|
|
479
|
+
console.log(` Total files: ${files.length}`);
|
|
480
|
+
console.log(` Total size: ${formatBytes(totalSize)}`);
|
|
481
|
+
if (options.secure) {
|
|
482
|
+
console.log();
|
|
483
|
+
console.log('WARNING: Sensitive data has been redacted from this output');
|
|
484
|
+
}
|
|
485
|
+
console.log();
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
// Colored text output format (default)
|
|
489
|
+
console.log();
|
|
490
|
+
console.log(chalk_1.default.bold.blue(`📄 Aggregated Content: ${module.fullName}`));
|
|
491
|
+
console.log(chalk_1.default.gray('─'.repeat(60)));
|
|
492
|
+
console.log();
|
|
493
|
+
// Apply pagination if requested
|
|
494
|
+
const pageSize = options.pageSize || 10;
|
|
495
|
+
const currentPage = options.page || 1;
|
|
496
|
+
const totalPages = Math.ceil(files.length / pageSize);
|
|
497
|
+
let filesToDisplay = files;
|
|
498
|
+
let paginationInfo = '';
|
|
499
|
+
if (options.page) {
|
|
500
|
+
const startIndex = (currentPage - 1) * pageSize;
|
|
501
|
+
const endIndex = Math.min(startIndex + pageSize, files.length);
|
|
502
|
+
filesToDisplay = files.slice(startIndex, endIndex);
|
|
503
|
+
paginationInfo = ` (Page ${currentPage} of ${totalPages})`;
|
|
504
|
+
}
|
|
505
|
+
console.log(chalk_1.default.bold(`Files: ${files.length}${paginationInfo}`));
|
|
506
|
+
if (options.secure) {
|
|
507
|
+
console.log(chalk_1.default.yellow('🔒 Security: Sensitive data redacted'));
|
|
508
|
+
}
|
|
509
|
+
console.log();
|
|
510
|
+
// Display each file with section headers
|
|
511
|
+
for (const file of filesToDisplay) {
|
|
512
|
+
console.log(chalk_1.default.bold.cyan(`┌─ ${file.relativePath}`));
|
|
513
|
+
console.log(chalk_1.default.gray(`│ Size: ${formatBytes(file.size)} | Modified: ${formatDate(file.modified)}`));
|
|
514
|
+
console.log(chalk_1.default.bold.cyan('└' + '─'.repeat(58)));
|
|
515
|
+
console.log();
|
|
516
|
+
let content = fs.readFileSync(file.path, 'utf-8');
|
|
517
|
+
if (options.secure) {
|
|
518
|
+
content = redactSensitiveData(content, false);
|
|
519
|
+
}
|
|
520
|
+
// Preserve markdown formatting
|
|
521
|
+
console.log(content);
|
|
522
|
+
console.log();
|
|
523
|
+
console.log(chalk_1.default.gray('─'.repeat(60)));
|
|
524
|
+
console.log();
|
|
525
|
+
}
|
|
526
|
+
// Summary
|
|
527
|
+
const totalSize = files.reduce((sum, f) => sum + f.size, 0);
|
|
528
|
+
console.log(chalk_1.default.bold('Summary:'));
|
|
529
|
+
console.log(chalk_1.default.gray(` Total files: ${files.length}`));
|
|
530
|
+
console.log(chalk_1.default.gray(` Displayed: ${filesToDisplay.length}`));
|
|
531
|
+
console.log(chalk_1.default.gray(` Total size: ${formatBytes(totalSize)}`));
|
|
532
|
+
if (options.page && totalPages > 1) {
|
|
533
|
+
console.log();
|
|
534
|
+
console.log(chalk_1.default.bold('Pagination:'));
|
|
535
|
+
console.log(chalk_1.default.gray(` Current page: ${currentPage} of ${totalPages}`));
|
|
536
|
+
if (currentPage < totalPages) {
|
|
537
|
+
console.log(chalk_1.default.cyan(` Next page: augx show module ${module.fullName} --content --page ${currentPage + 1}`));
|
|
538
|
+
}
|
|
539
|
+
if (currentPage > 1) {
|
|
540
|
+
console.log(chalk_1.default.cyan(` Prev page: augx show module ${module.fullName} --content --page ${currentPage - 1}`));
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
if (options.secure) {
|
|
544
|
+
console.log();
|
|
545
|
+
console.log(chalk_1.default.yellow('⚠️ Sensitive data has been redacted from this output'));
|
|
546
|
+
}
|
|
547
|
+
console.log();
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Display individual file content with line numbers and optional syntax highlighting
|
|
551
|
+
*/
|
|
552
|
+
async function showModuleFile(module, filePath, options) {
|
|
553
|
+
// Resolve file path (support both absolute and relative paths)
|
|
554
|
+
let fullPath;
|
|
555
|
+
if (path.isAbsolute(filePath)) {
|
|
556
|
+
fullPath = filePath;
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
559
|
+
// Try relative to module path
|
|
560
|
+
fullPath = path.join(module.path, filePath);
|
|
561
|
+
}
|
|
562
|
+
// Check if file exists
|
|
563
|
+
if (!fs.existsSync(fullPath)) {
|
|
564
|
+
console.error(chalk_1.default.red(`File not found: ${filePath}`));
|
|
565
|
+
console.log(chalk_1.default.gray(`\nSearched in: ${fullPath}`));
|
|
566
|
+
console.log(chalk_1.default.gray(`Module path: ${module.path}`));
|
|
567
|
+
process.exit(1);
|
|
568
|
+
}
|
|
569
|
+
// Handle --open flag: Open file in VS Code editor
|
|
570
|
+
if (options.open) {
|
|
571
|
+
try {
|
|
572
|
+
if (!(0, vscode_editor_1.isVSCodeAvailable)()) {
|
|
573
|
+
console.error(chalk_1.default.red('VS Code CLI is not available. Please install VS Code and ensure "code" is in your PATH.'));
|
|
574
|
+
process.exit(1);
|
|
575
|
+
}
|
|
576
|
+
await (0, vscode_editor_1.openInEditor)(fullPath);
|
|
577
|
+
console.log(chalk_1.default.green(`✓ Opened ${path.basename(fullPath)} in VS Code editor`));
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
catch (error) {
|
|
581
|
+
console.error(chalk_1.default.red(`Failed to open file: ${error instanceof Error ? error.message : String(error)}`));
|
|
582
|
+
process.exit(1);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
// Handle --preview flag: Open file in VS Code preview pane
|
|
586
|
+
if (options.preview) {
|
|
587
|
+
try {
|
|
588
|
+
if (!(0, vscode_editor_1.isVSCodeAvailable)()) {
|
|
589
|
+
console.error(chalk_1.default.red('VS Code CLI is not available. Please install VS Code and ensure "code" is in your PATH.'));
|
|
590
|
+
process.exit(1);
|
|
591
|
+
}
|
|
592
|
+
await (0, vscode_editor_1.openInPreview)(fullPath);
|
|
593
|
+
console.log(chalk_1.default.green(`✓ Opened ${path.basename(fullPath)} in VS Code preview pane`));
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
catch (error) {
|
|
597
|
+
console.error(chalk_1.default.red(`Failed to open file: ${error instanceof Error ? error.message : String(error)}`));
|
|
598
|
+
process.exit(1);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
const stats = fs.statSync(fullPath);
|
|
602
|
+
const fileSizeThreshold = 1024 * 1024; // 1MB threshold for streaming
|
|
603
|
+
// Use streaming for large files
|
|
604
|
+
let content;
|
|
605
|
+
if (stats.size > fileSizeThreshold) {
|
|
606
|
+
// Show progress for large files
|
|
607
|
+
const spinner = new progress_1.Spinner(`Reading large file (${formatBytes(stats.size)})...`);
|
|
608
|
+
spinner.start();
|
|
609
|
+
try {
|
|
610
|
+
// Stream large files
|
|
611
|
+
const chunks = [];
|
|
612
|
+
await (0, stream_reader_1.readFileStreaming)(fullPath, async (chunk, streamStats) => {
|
|
613
|
+
chunks.push(chunk);
|
|
614
|
+
const progress = (streamStats.bytesRead / stats.size) * 100;
|
|
615
|
+
spinner.setText(`Reading large file: ${progress.toFixed(1)}% (${formatBytes(streamStats.bytesRead)}/${formatBytes(stats.size)})`);
|
|
616
|
+
}, { highWaterMark: 64 * 1024 });
|
|
617
|
+
content = chunks.join('');
|
|
618
|
+
spinner.stop(chalk_1.default.green('✓ File loaded successfully'));
|
|
619
|
+
}
|
|
620
|
+
catch (error) {
|
|
621
|
+
spinner.stop(chalk_1.default.red('✗ Failed to read file'));
|
|
622
|
+
throw error;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
// Read small files normally
|
|
627
|
+
content = fs.readFileSync(fullPath, 'utf-8');
|
|
628
|
+
}
|
|
629
|
+
// Apply redaction if secure flag is set
|
|
630
|
+
if (options.secure) {
|
|
631
|
+
content = redactSensitiveData(content, true);
|
|
632
|
+
}
|
|
633
|
+
const lines = content.split('\n');
|
|
634
|
+
// Get relative path for display
|
|
635
|
+
const relativePath = path.relative(module.path, fullPath);
|
|
636
|
+
// Handle JSON output format
|
|
637
|
+
if (options.json || options.format === 'json') {
|
|
638
|
+
const jsonOutput = {
|
|
639
|
+
module: module.fullName,
|
|
640
|
+
file: relativePath,
|
|
641
|
+
path: fullPath,
|
|
642
|
+
size: stats.size,
|
|
643
|
+
modified: stats.mtime,
|
|
644
|
+
lines: lines.length,
|
|
645
|
+
content: content
|
|
646
|
+
};
|
|
647
|
+
console.log(JSON.stringify(jsonOutput, null, 2));
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
// Handle Markdown output format
|
|
651
|
+
if (options.format === 'markdown') {
|
|
652
|
+
console.log(`# ${relativePath}\n`);
|
|
653
|
+
console.log(`**Module:** ${module.fullName}\n`);
|
|
654
|
+
console.log(`**Size:** ${formatBytes(stats.size)} | **Lines:** ${lines.length}\n`);
|
|
655
|
+
console.log('```');
|
|
656
|
+
console.log(content);
|
|
657
|
+
console.log('```');
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
// Handle plain text output format (ASCII-only, no colors, no line numbers)
|
|
661
|
+
if (options.format === 'text') {
|
|
662
|
+
console.log();
|
|
663
|
+
console.log(`File: ${relativePath}`);
|
|
664
|
+
console.log('='.repeat(60));
|
|
665
|
+
console.log();
|
|
666
|
+
console.log('File Information:');
|
|
667
|
+
console.log(` Module: ${module.fullName}`);
|
|
668
|
+
console.log(` Path: ${relativePath}`);
|
|
669
|
+
console.log(` Size: ${formatBytes(stats.size)}`);
|
|
670
|
+
console.log(` Lines: ${lines.length}`);
|
|
671
|
+
console.log(` Modified: ${formatDate(stats.mtime)}`);
|
|
672
|
+
const detectedLang = detectLanguage(fullPath);
|
|
673
|
+
if (detectedLang) {
|
|
674
|
+
console.log(` Language: ${detectedLang}`);
|
|
675
|
+
}
|
|
676
|
+
console.log();
|
|
677
|
+
console.log('Content:');
|
|
678
|
+
console.log('-'.repeat(60));
|
|
679
|
+
console.log();
|
|
680
|
+
console.log(content);
|
|
681
|
+
console.log();
|
|
682
|
+
console.log('='.repeat(60));
|
|
683
|
+
console.log();
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
// Colored text output format (default) with line numbers
|
|
687
|
+
const workspaceRoot = (0, vscode_links_1.getWorkspaceRoot)();
|
|
688
|
+
const clickablePath = (0, vscode_links_1.formatClickablePath)(fullPath, { workspaceRoot });
|
|
689
|
+
console.log();
|
|
690
|
+
console.log(chalk_1.default.bold.blue(`📄 ${relativePath}`));
|
|
691
|
+
console.log(chalk_1.default.gray(` ${clickablePath}`));
|
|
692
|
+
console.log(chalk_1.default.gray('─'.repeat(60)));
|
|
693
|
+
console.log();
|
|
694
|
+
console.log(chalk_1.default.bold('File Information:'));
|
|
695
|
+
console.log(chalk_1.default.gray(` Module: ${module.fullName}`));
|
|
696
|
+
console.log(chalk_1.default.gray(` Path: ${relativePath}`));
|
|
697
|
+
console.log(chalk_1.default.gray(` Full: ${clickablePath}`));
|
|
698
|
+
console.log(chalk_1.default.gray(` Size: ${formatBytes(stats.size)}`));
|
|
699
|
+
console.log(chalk_1.default.gray(` Lines: ${lines.length}`));
|
|
700
|
+
console.log(chalk_1.default.gray(` Modified: ${formatDate(stats.mtime)}`));
|
|
701
|
+
// Display detected language
|
|
702
|
+
const detectedLang = detectLanguage(fullPath);
|
|
703
|
+
if (detectedLang) {
|
|
704
|
+
console.log(chalk_1.default.gray(` Language: ${detectedLang}`));
|
|
705
|
+
}
|
|
706
|
+
console.log();
|
|
707
|
+
console.log(chalk_1.default.bold('Content:'));
|
|
708
|
+
console.log(chalk_1.default.gray('─'.repeat(60)));
|
|
709
|
+
console.log();
|
|
710
|
+
// Apply syntax highlighting if enabled (default: enabled)
|
|
711
|
+
const enableHighlighting = options.format !== 'text' && process.stdout.isTTY;
|
|
712
|
+
if (enableHighlighting && detectedLang) {
|
|
713
|
+
// Try to apply syntax highlighting
|
|
714
|
+
try {
|
|
715
|
+
const highlighted = applySyntaxHighlighting(content, fullPath, true);
|
|
716
|
+
const highlightedLines = highlighted.split('\n');
|
|
717
|
+
// Display with line numbers
|
|
718
|
+
const lineNumberWidth = highlightedLines.length.toString().length;
|
|
719
|
+
highlightedLines.forEach((line, index) => {
|
|
720
|
+
const lineNumber = (index + 1).toString().padStart(lineNumberWidth, ' ');
|
|
721
|
+
console.log(chalk_1.default.gray(`${lineNumber} │ `) + line);
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
catch (error) {
|
|
725
|
+
// Fallback to plain display if highlighting fails
|
|
726
|
+
const lineNumberWidth = lines.length.toString().length;
|
|
727
|
+
lines.forEach((line, index) => {
|
|
728
|
+
const lineNumber = (index + 1).toString().padStart(lineNumberWidth, ' ');
|
|
729
|
+
console.log(chalk_1.default.gray(`${lineNumber} │ `) + line);
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
else {
|
|
734
|
+
// Display content with line numbers (no highlighting)
|
|
735
|
+
const lineNumberWidth = lines.length.toString().length;
|
|
736
|
+
lines.forEach((line, index) => {
|
|
737
|
+
const lineNumber = (index + 1).toString().padStart(lineNumberWidth, ' ');
|
|
738
|
+
console.log(chalk_1.default.gray(`${lineNumber} │ `) + line);
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
console.log();
|
|
742
|
+
console.log(chalk_1.default.gray('─'.repeat(60)));
|
|
743
|
+
console.log();
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Display search results with highlighting and context
|
|
747
|
+
*/
|
|
748
|
+
function displaySearchResults(module, searchResults, options) {
|
|
749
|
+
const searchTerm = options.search || '';
|
|
750
|
+
// JSON output
|
|
751
|
+
if (options.json || options.format === 'json') {
|
|
752
|
+
const jsonOutput = {
|
|
753
|
+
module: module.fullName,
|
|
754
|
+
searchTerm: searchTerm,
|
|
755
|
+
totalMatches: searchResults.reduce((sum, r) => sum + r.matches.length, 0),
|
|
756
|
+
results: searchResults.map(r => ({
|
|
757
|
+
file: r.file.relativePath,
|
|
758
|
+
matchCount: r.matches.length,
|
|
759
|
+
matches: r.matches.map(m => ({
|
|
760
|
+
line: m.line,
|
|
761
|
+
text: m.text
|
|
762
|
+
}))
|
|
763
|
+
}))
|
|
764
|
+
};
|
|
765
|
+
console.log(JSON.stringify(jsonOutput, null, 2));
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
// Text output
|
|
769
|
+
console.log();
|
|
770
|
+
console.log(chalk_1.default.bold.blue(`🔍 Search Results: "${searchTerm}"`));
|
|
771
|
+
console.log(chalk_1.default.gray('─'.repeat(60)));
|
|
772
|
+
console.log();
|
|
773
|
+
const totalMatches = searchResults.reduce((sum, r) => sum + r.matches.length, 0);
|
|
774
|
+
console.log(chalk_1.default.bold(`Found ${totalMatches} matches in ${searchResults.length} files`));
|
|
775
|
+
console.log();
|
|
776
|
+
for (const result of searchResults) {
|
|
777
|
+
console.log(chalk_1.default.bold.cyan(`📄 ${result.file.relativePath}`));
|
|
778
|
+
console.log(chalk_1.default.gray(` ${result.matches.length} matches`));
|
|
779
|
+
console.log();
|
|
780
|
+
for (const match of result.matches) {
|
|
781
|
+
console.log(chalk_1.default.gray(` Line ${match.line}:`));
|
|
782
|
+
console.log(' ' + highlightSearchTerm(match.text, searchTerm));
|
|
783
|
+
console.log();
|
|
784
|
+
}
|
|
785
|
+
console.log(chalk_1.default.gray('─'.repeat(60)));
|
|
786
|
+
console.log();
|
|
787
|
+
}
|
|
788
|
+
console.log(chalk_1.default.bold('Summary:'));
|
|
789
|
+
console.log(chalk_1.default.gray(` Total matches: ${totalMatches}`));
|
|
790
|
+
console.log(chalk_1.default.gray(` Files with matches: ${searchResults.length}`));
|
|
791
|
+
console.log();
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Perform search within module files
|
|
795
|
+
*/
|
|
796
|
+
function performSearch(files, searchTerm) {
|
|
797
|
+
const results = [];
|
|
68
798
|
const searchLower = searchTerm.toLowerCase();
|
|
69
|
-
|
|
70
|
-
.
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
799
|
+
for (const file of files) {
|
|
800
|
+
const content = fs.readFileSync(file.path, 'utf-8');
|
|
801
|
+
const lines = content.split('\n');
|
|
802
|
+
const matches = [];
|
|
803
|
+
lines.forEach((line, index) => {
|
|
804
|
+
if (line.toLowerCase().includes(searchLower)) {
|
|
805
|
+
// Get context lines (2 before, 2 after)
|
|
806
|
+
const contextBefore = lines.slice(Math.max(0, index - 2), index);
|
|
807
|
+
const contextAfter = lines.slice(index + 1, Math.min(lines.length, index + 3));
|
|
808
|
+
matches.push({
|
|
809
|
+
line: index + 1,
|
|
810
|
+
text: line,
|
|
811
|
+
context: [...contextBefore, line, ...contextAfter]
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
if (matches.length > 0) {
|
|
816
|
+
results.push({ file, matches });
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
return results;
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Highlight search term in text
|
|
823
|
+
*/
|
|
824
|
+
function highlightSearchTerm(text, searchTerm) {
|
|
825
|
+
const regex = new RegExp(`(${searchTerm})`, 'gi');
|
|
826
|
+
return text.replace(regex, chalk_1.default.yellow.bold('$1'));
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Apply syntax highlighting to code content
|
|
830
|
+
* Detects language from file extension and applies appropriate highlighting
|
|
831
|
+
*/
|
|
832
|
+
function applySyntaxHighlighting(content, filePath, enableColors = true) {
|
|
833
|
+
if (!enableColors) {
|
|
834
|
+
return content;
|
|
835
|
+
}
|
|
836
|
+
try {
|
|
837
|
+
// Detect language from file extension
|
|
838
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
839
|
+
const languageMap = {
|
|
840
|
+
'.ts': 'typescript',
|
|
841
|
+
'.js': 'javascript',
|
|
842
|
+
'.jsx': 'javascript',
|
|
843
|
+
'.tsx': 'typescript',
|
|
844
|
+
'.py': 'python',
|
|
845
|
+
'.php': 'php',
|
|
846
|
+
'.rb': 'ruby',
|
|
847
|
+
'.go': 'go',
|
|
848
|
+
'.rs': 'rust',
|
|
849
|
+
'.java': 'java',
|
|
850
|
+
'.c': 'c',
|
|
851
|
+
'.cpp': 'cpp',
|
|
852
|
+
'.cs': 'csharp',
|
|
853
|
+
'.sh': 'bash',
|
|
854
|
+
'.ps1': 'powershell',
|
|
855
|
+
'.md': 'markdown',
|
|
856
|
+
'.json': 'json',
|
|
857
|
+
'.yaml': 'yaml',
|
|
858
|
+
'.yml': 'yaml',
|
|
859
|
+
'.xml': 'xml',
|
|
860
|
+
'.html': 'html',
|
|
861
|
+
'.css': 'css',
|
|
862
|
+
'.scss': 'scss',
|
|
863
|
+
'.sql': 'sql'
|
|
864
|
+
};
|
|
865
|
+
const language = languageMap[ext];
|
|
866
|
+
if (language) {
|
|
867
|
+
const highlighted = highlight_js_1.default.highlight(content, { language, ignoreIllegals: true });
|
|
868
|
+
return highlighted.value;
|
|
869
|
+
}
|
|
870
|
+
// Auto-detect if no extension match
|
|
871
|
+
const autoDetected = highlight_js_1.default.highlightAuto(content);
|
|
872
|
+
return autoDetected.value;
|
|
873
|
+
}
|
|
874
|
+
catch (error) {
|
|
875
|
+
// If highlighting fails, return original content
|
|
876
|
+
return content;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Convert ANSI color codes from highlight.js to chalk colors
|
|
881
|
+
* This is a simplified version - highlight.js uses HTML-like tags
|
|
882
|
+
*/
|
|
883
|
+
function convertHighlightToChalk(highlightedCode) {
|
|
884
|
+
// highlight.js returns HTML-like output, we need to convert to terminal colors
|
|
885
|
+
// For now, return as-is since we're using it in terminal context
|
|
886
|
+
// A more sophisticated implementation would parse the HTML and apply chalk colors
|
|
887
|
+
return highlightedCode;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Detect language from file extension
|
|
891
|
+
*/
|
|
892
|
+
function detectLanguage(filePath) {
|
|
893
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
894
|
+
const languageMap = {
|
|
895
|
+
'.ts': 'TypeScript',
|
|
896
|
+
'.js': 'JavaScript',
|
|
897
|
+
'.jsx': 'JavaScript (JSX)',
|
|
898
|
+
'.tsx': 'TypeScript (TSX)',
|
|
899
|
+
'.py': 'Python',
|
|
900
|
+
'.php': 'PHP',
|
|
901
|
+
'.rb': 'Ruby',
|
|
902
|
+
'.go': 'Go',
|
|
903
|
+
'.rs': 'Rust',
|
|
904
|
+
'.java': 'Java',
|
|
905
|
+
'.c': 'C',
|
|
906
|
+
'.cpp': 'C++',
|
|
907
|
+
'.cs': 'C#',
|
|
908
|
+
'.sh': 'Bash',
|
|
909
|
+
'.ps1': 'PowerShell',
|
|
910
|
+
'.md': 'Markdown',
|
|
911
|
+
'.json': 'JSON',
|
|
912
|
+
'.yaml': 'YAML',
|
|
913
|
+
'.yml': 'YAML',
|
|
914
|
+
'.xml': 'XML',
|
|
915
|
+
'.html': 'HTML',
|
|
916
|
+
'.css': 'CSS',
|
|
917
|
+
'.scss': 'SCSS',
|
|
918
|
+
'.sql': 'SQL'
|
|
919
|
+
};
|
|
920
|
+
return languageMap[ext] || null;
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Get similar modules for legacy showCommand
|
|
924
|
+
* @deprecated Use getModuleSuggestions from module-system instead
|
|
925
|
+
*/
|
|
926
|
+
async function getSimilarModules(searchTerm) {
|
|
927
|
+
const suggestions = (0, module_system_1.getModuleSuggestions)(searchTerm, 5);
|
|
928
|
+
return suggestions.map(m => m.fullName);
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Redaction patterns for sensitive data
|
|
932
|
+
*/
|
|
933
|
+
const REDACTION_PATTERNS = [
|
|
934
|
+
// API Keys
|
|
935
|
+
{ pattern: /\b([A-Za-z0-9_-]*API[_-]?KEY[_-]?[A-Za-z0-9_-]*)\s*[:=]\s*['"]?([A-Za-z0-9_\-\/+=]{16,})['"]?/gi, name: 'API_KEY' },
|
|
936
|
+
{ pattern: /\b(api[_-]?key)\s*[:=]\s*['"]?([A-Za-z0-9_\-\/+=]{16,})['"]?/gi, name: 'API_KEY' },
|
|
937
|
+
// Secrets
|
|
938
|
+
{ pattern: /\b([A-Za-z0-9_-]*SECRET[_-]?[A-Za-z0-9_-]*)\s*[:=]\s*['"]?([A-Za-z0-9_\-\/+=]{16,})['"]?/gi, name: 'SECRET' },
|
|
939
|
+
{ pattern: /\b(secret)\s*[:=]\s*['"]?([A-Za-z0-9_\-\/+=]{16,})['"]?/gi, name: 'SECRET' },
|
|
940
|
+
// Tokens
|
|
941
|
+
{ pattern: /\b([A-Za-z0-9_-]*TOKEN[_-]?[A-Za-z0-9_-]*)\s*[:=]\s*['"]?([A-Za-z0-9_\-\/+=]{16,})['"]?/gi, name: 'TOKEN' },
|
|
942
|
+
{ pattern: /\b(token)\s*[:=]\s*['"]?([A-Za-z0-9_\-\/+=]{16,})['"]?/gi, name: 'TOKEN' },
|
|
943
|
+
{ pattern: /\b(bearer)\s+([A-Za-z0-9_\-\/+=]{16,})/gi, name: 'BEARER_TOKEN' },
|
|
944
|
+
// Passwords
|
|
945
|
+
{ pattern: /\b([A-Za-z0-9_-]*PASSWORD[_-]?[A-Za-z0-9_-]*)\s*[:=]\s*['"]?([^\s'"]{8,})['"]?/gi, name: 'PASSWORD' },
|
|
946
|
+
{ pattern: /\b(password|passwd|pwd)\s*[:=]\s*['"]?([^\s'"]{8,})['"]?/gi, name: 'PASSWORD' },
|
|
947
|
+
// Private Keys
|
|
948
|
+
{ pattern: /(-----BEGIN\s+(?:RSA\s+)?PRIVATE\s+KEY-----[\s\S]*?-----END\s+(?:RSA\s+)?PRIVATE\s+KEY-----)/gi, name: 'PRIVATE_KEY' },
|
|
949
|
+
// AWS Keys
|
|
950
|
+
{ pattern: /\b(AKIA[0-9A-Z]{16})\b/g, name: 'AWS_ACCESS_KEY' },
|
|
951
|
+
{ pattern: /\b([A-Za-z0-9/+=]{40})\b/g, name: 'AWS_SECRET_KEY' },
|
|
952
|
+
// GitHub Tokens
|
|
953
|
+
{ pattern: /\b(ghp_[A-Za-z0-9]{36})\b/g, name: 'GITHUB_TOKEN' },
|
|
954
|
+
{ pattern: /\b(gho_[A-Za-z0-9]{36})\b/g, name: 'GITHUB_OAUTH' },
|
|
955
|
+
{ pattern: /\b(ghu_[A-Za-z0-9]{36})\b/g, name: 'GITHUB_USER_TOKEN' },
|
|
956
|
+
{ pattern: /\b(ghs_[A-Za-z0-9]{36})\b/g, name: 'GITHUB_SERVER_TOKEN' },
|
|
957
|
+
{ pattern: /\b(ghr_[A-Za-z0-9]{36})\b/g, name: 'GITHUB_REFRESH_TOKEN' },
|
|
958
|
+
// Generic credentials
|
|
959
|
+
{ pattern: /\b(credentials?)\s*[:=]\s*['"]?([^\s'"]{16,})['"]?/gi, name: 'CREDENTIALS' },
|
|
960
|
+
{ pattern: /\b(auth)\s*[:=]\s*['"]?([A-Za-z0-9_\-\/+=]{16,})['"]?/gi, name: 'AUTH' }
|
|
961
|
+
];
|
|
962
|
+
/**
|
|
963
|
+
* Redact sensitive data from content
|
|
964
|
+
*/
|
|
965
|
+
function redactSensitiveData(content, logRedactions = false) {
|
|
966
|
+
let redactedContent = content;
|
|
967
|
+
const redactions = [];
|
|
968
|
+
for (const { pattern, name } of REDACTION_PATTERNS) {
|
|
969
|
+
const matches = content.match(pattern);
|
|
970
|
+
if (matches && matches.length > 0) {
|
|
971
|
+
redactedContent = redactedContent.replace(pattern, (match, ...args) => {
|
|
972
|
+
// For patterns with capture groups, preserve the key name but redact the value
|
|
973
|
+
if (args.length >= 2) {
|
|
974
|
+
const keyName = args[0];
|
|
975
|
+
return `${keyName}=[REDACTED_${name}]`;
|
|
976
|
+
}
|
|
977
|
+
// For patterns without capture groups, redact the entire match
|
|
978
|
+
return `[REDACTED_${name}]`;
|
|
979
|
+
});
|
|
980
|
+
if (logRedactions) {
|
|
981
|
+
redactions.push({ pattern: name, count: matches.length });
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
// Log redactions if requested
|
|
986
|
+
if (logRedactions && redactions.length > 0) {
|
|
987
|
+
console.log(chalk_1.default.yellow('\n⚠️ Sensitive data redacted:'));
|
|
988
|
+
for (const { pattern, count } of redactions) {
|
|
989
|
+
console.log(chalk_1.default.gray(` ${pattern}: ${count} occurrence(s)`));
|
|
990
|
+
}
|
|
991
|
+
console.log();
|
|
992
|
+
}
|
|
993
|
+
return redactedContent;
|
|
76
994
|
}
|
|
77
995
|
//# sourceMappingURL=show.js.map
|