fraim-framework 2.0.65 ā 2.0.67
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/dist/registry/ai-manager-rules/customer-development-phases/phase1-customer-profiling.md +101 -0
- package/dist/registry/ai-manager-rules/customer-development-phases/phase2-platform-discovery.md +235 -0
- package/dist/registry/ai-manager-rules/customer-development-phases/phase3-prospect-qualification.md +243 -0
- package/dist/registry/ai-manager-rules/customer-development-phases/phase4-inventory-compilation.md +206 -0
- package/dist/registry/ai-manager-rules/design-phases/design-completeness-review.md +73 -0
- package/dist/registry/ai-manager-rules/design-phases/design-design.md +145 -0
- package/dist/registry/ai-manager-rules/design-phases/design.md +108 -0
- package/dist/registry/ai-manager-rules/design-phases/finalize.md +60 -0
- package/dist/registry/ai-manager-rules/design-phases/validate.md +125 -0
- package/dist/registry/ai-manager-rules/design.json +97 -0
- package/dist/registry/ai-manager-rules/implement-phases/code.md +323 -0
- package/dist/registry/ai-manager-rules/implement-phases/completeness-review.md +94 -0
- package/dist/registry/ai-manager-rules/implement-phases/finalize.md +177 -0
- package/dist/registry/ai-manager-rules/implement-phases/implement-code.md +283 -0
- package/dist/registry/ai-manager-rules/implement-phases/implement-completeness-review.md +120 -0
- package/dist/registry/ai-manager-rules/implement-phases/implement-regression.md +173 -0
- package/dist/registry/ai-manager-rules/implement-phases/implement-repro.md +104 -0
- package/dist/registry/ai-manager-rules/implement-phases/implement-scoping.md +100 -0
- package/dist/registry/ai-manager-rules/implement-phases/implement-smoke.md +237 -0
- package/dist/registry/ai-manager-rules/implement-phases/implement-spike.md +121 -0
- package/dist/registry/ai-manager-rules/implement-phases/implement-validate.md +375 -0
- package/dist/registry/ai-manager-rules/implement-phases/quality-review.md +304 -0
- package/dist/registry/ai-manager-rules/implement-phases/regression.md +159 -0
- package/dist/registry/ai-manager-rules/implement-phases/repro.md +101 -0
- package/dist/registry/ai-manager-rules/implement-phases/scoping.md +93 -0
- package/dist/registry/ai-manager-rules/implement-phases/smoke.md +225 -0
- package/dist/registry/ai-manager-rules/implement-phases/spike.md +118 -0
- package/dist/registry/ai-manager-rules/implement-phases/validate.md +347 -0
- package/dist/registry/ai-manager-rules/implement.json +153 -0
- package/dist/registry/ai-manager-rules/retrospective.md +116 -0
- package/dist/registry/ai-manager-rules/shared-phases/address-pr-feedback.md +188 -0
- package/dist/registry/ai-manager-rules/shared-phases/finalize.md +169 -0
- package/dist/registry/ai-manager-rules/shared-phases/submit-pr.md +202 -0
- package/dist/registry/ai-manager-rules/shared-phases/wait-for-pr-review.md +170 -0
- package/dist/registry/ai-manager-rules/spec-phases/finalize.md +60 -0
- package/dist/registry/ai-manager-rules/spec-phases/spec-competitor-analysis.md +105 -0
- package/dist/registry/ai-manager-rules/spec-phases/spec-completeness-review.md +66 -0
- package/dist/registry/ai-manager-rules/spec-phases/spec-spec.md +139 -0
- package/dist/registry/ai-manager-rules/spec-phases/spec.md +102 -0
- package/dist/registry/ai-manager-rules/spec-phases/validate.md +118 -0
- package/dist/registry/ai-manager-rules/spec.json +112 -0
- package/dist/registry/ai-manager-rules/test.json +98 -0
- package/dist/registry/ai-manager-rules/user-survey-phases/phase1-survey-scoping.md +60 -0
- package/dist/registry/ai-manager-rules/user-survey-phases/phase2-survey-build-linkedin.md +23 -0
- package/dist/registry/ai-manager-rules/user-survey-phases/phase3-survey-build-reddit.md +22 -0
- package/dist/registry/ai-manager-rules/user-survey-phases/phase4-survey-build-x.md +21 -0
- package/dist/registry/ai-manager-rules/user-survey-phases/phase5-survey-build-facebook.md +19 -0
- package/dist/registry/ai-manager-rules/user-survey-phases/phase6-survey-build-custom.md +15 -0
- package/dist/registry/ai-manager-rules/user-survey-phases/phase7-survey-dispatch.md +45 -0
- package/dist/registry/delivery/address-feedback.md +83 -0
- package/dist/registry/delivery/retrospective.md +78 -0
- package/dist/registry/delivery/submit.md +79 -0
- package/dist/registry/providers/ado.json +19 -0
- package/dist/registry/providers/delivery-conversation.json +9 -0
- package/dist/registry/providers/delivery-pr.json +9 -0
- package/dist/registry/providers/github.json +19 -0
- package/dist/registry/rules/agent-success-criteria.md +101 -0
- package/dist/registry/rules/agent-testing-guidelines.md +502 -0
- package/dist/registry/rules/architecture.md +126 -0
- package/dist/registry/rules/communication.md +122 -0
- package/dist/registry/rules/continuous-learning.md +55 -0
- package/dist/registry/rules/debugging-multitenancy-issues.md +85 -0
- package/dist/registry/rules/ephemeral-execution.md +54 -0
- package/dist/registry/rules/git-safe-commands.md +34 -0
- package/dist/registry/rules/hitl-ppe-record-analysis.md +302 -0
- package/dist/registry/rules/integrity-and-test-ethics.md +275 -0
- package/dist/registry/rules/local-development.md +275 -0
- package/dist/registry/rules/mandatory-pre-completion-reflection.md +193 -0
- package/dist/registry/rules/merge-requirements.md +238 -0
- package/dist/registry/rules/simplicity.md +118 -0
- package/dist/registry/rules/software-development-lifecycle.md +105 -0
- package/dist/registry/rules/spike-first-development.md +205 -0
- package/dist/registry/rules/successful-debugging-patterns.md +488 -0
- package/dist/registry/scripts/build-scripts-generator.js +205 -0
- package/dist/registry/scripts/cleanup-branch.js +287 -0
- package/dist/registry/scripts/evaluate-code-quality.js +66 -0
- package/dist/registry/scripts/exec-with-timeout.js +142 -0
- package/dist/registry/scripts/fraim-config.js +61 -0
- package/dist/registry/scripts/generate-engagement-emails.js +705 -0
- package/dist/registry/scripts/generic-issues-api.js +100 -0
- package/dist/registry/scripts/newsletter-helpers.js +671 -0
- package/dist/registry/scripts/openapi-generator.js +664 -0
- package/dist/registry/scripts/performance/profile-server.js +390 -0
- package/dist/registry/scripts/profile-server.js +389 -0
- package/dist/registry/scripts/run-thank-you-workflow.js +92 -0
- package/dist/registry/scripts/send-newsletter-simple.js +85 -0
- package/dist/registry/scripts/send-thank-you-emails.js +54 -0
- package/dist/registry/scripts/validate-openapi-limits.js +311 -0
- package/dist/registry/scripts/validate-test-coverage.js +262 -0
- package/dist/registry/scripts/verify-test-coverage.js +66 -0
- package/dist/registry/stubs/workflows/azure/cost-optimization.md +11 -0
- package/dist/registry/stubs/workflows/bootstrap/create-architecture.md +11 -0
- package/dist/registry/stubs/workflows/bootstrap/detect-broken-windows.md +11 -0
- package/dist/registry/stubs/workflows/bootstrap/evaluate-code-quality.md +11 -0
- package/dist/registry/stubs/workflows/bootstrap/verify-test-coverage.md +11 -0
- package/dist/registry/stubs/workflows/brainstorming/blue-sky-brainstorming.md +11 -0
- package/dist/registry/stubs/workflows/brainstorming/codebase-brainstorming.md +11 -0
- package/dist/registry/stubs/workflows/business-development/create-business-plan.md +11 -0
- package/dist/registry/stubs/workflows/business-development/ideate-business-opportunity.md +11 -0
- package/dist/registry/stubs/workflows/business-development/price-product.md +18 -0
- package/dist/registry/stubs/workflows/compliance/detect-compliance-requirements.md +11 -0
- package/dist/registry/stubs/workflows/compliance/generate-audit-evidence.md +11 -0
- package/dist/registry/stubs/workflows/compliance/soc2-evidence-generator.md +11 -0
- package/dist/registry/stubs/workflows/customer-development/insight-analysis.md +11 -0
- package/dist/registry/stubs/workflows/customer-development/insight-triage.md +11 -0
- package/dist/registry/stubs/workflows/customer-development/interview-preparation.md +11 -0
- package/dist/registry/stubs/workflows/customer-development/linkedin-outreach.md +11 -0
- package/dist/registry/stubs/workflows/customer-development/strategic-brainstorming.md +11 -0
- package/dist/registry/stubs/workflows/customer-development/thank-customers.md +11 -0
- package/dist/registry/stubs/workflows/customer-development/user-survey-dispatch.md +11 -0
- package/dist/registry/stubs/workflows/customer-development/users-to-target.md +11 -0
- package/dist/registry/stubs/workflows/customer-development/weekly-newsletter.md +11 -0
- package/dist/registry/stubs/workflows/deploy/cloud-deployment.md +11 -0
- package/dist/registry/stubs/workflows/improve-fraim/contribute.md +11 -0
- package/dist/registry/stubs/workflows/improve-fraim/file-issue.md +11 -0
- package/dist/registry/stubs/workflows/learning/build-skillset.md +11 -0
- package/dist/registry/stubs/workflows/learning/synthesize-learnings.md +11 -0
- package/dist/registry/stubs/workflows/legal/contract-review-analysis.md +11 -0
- package/dist/registry/stubs/workflows/legal/nda.md +11 -0
- package/dist/registry/stubs/workflows/legal/patent-filing.md +11 -0
- package/dist/registry/stubs/workflows/legal/saas-contract-development.md +11 -0
- package/dist/registry/stubs/workflows/legal/trademark-filing.md +11 -0
- package/dist/registry/stubs/workflows/marketing/content-creation.md +11 -0
- package/dist/registry/stubs/workflows/marketing/convert-to-pdf.md +11 -0
- package/dist/registry/stubs/workflows/marketing/create-modern-website.md +11 -0
- package/dist/registry/stubs/workflows/marketing/domain-registration.md +11 -0
- package/dist/registry/stubs/workflows/marketing/evangelize.md +11 -0
- package/dist/registry/stubs/workflows/marketing/hbr-article.md +11 -0
- package/dist/registry/stubs/workflows/marketing/launch-checklist.md +11 -0
- package/dist/registry/stubs/workflows/marketing/marketing-strategy.md +11 -0
- package/dist/registry/stubs/workflows/marketing/storytelling.md +11 -0
- package/dist/registry/stubs/workflows/performance/analyze-performance.md +11 -0
- package/dist/registry/stubs/workflows/product-building/design.md +11 -0
- package/dist/registry/stubs/workflows/product-building/implement.md +11 -0
- package/dist/registry/stubs/workflows/product-building/iterate-on-pr-comments.md +11 -0
- package/dist/registry/stubs/workflows/product-building/prep-issue.md +11 -0
- package/dist/registry/stubs/workflows/product-building/prototype.md +11 -0
- package/dist/registry/stubs/workflows/product-building/resolve.md +11 -0
- package/dist/registry/stubs/workflows/product-building/retrospect.md +11 -0
- package/dist/registry/stubs/workflows/product-building/spec.md +11 -0
- package/dist/registry/stubs/workflows/product-building/test.md +11 -0
- package/dist/registry/stubs/workflows/productivity-report/productivity-report.md +11 -0
- package/dist/registry/stubs/workflows/quality-assurance/browser-validation.md +11 -0
- package/dist/registry/stubs/workflows/quality-assurance/iterative-improvement-cycle.md +11 -0
- package/dist/registry/stubs/workflows/replicate/replicate-discovery.md +11 -0
- package/dist/registry/stubs/workflows/replicate/replicate-to-issues.md +11 -0
- package/dist/registry/stubs/workflows/reviewer/review-implementation-vs-design-spec.md +11 -0
- package/dist/registry/stubs/workflows/reviewer/review-implementation-vs-feature-spec.md +11 -0
- package/dist/registry/stubs/workflows/startup-credits/aws-activate-application.md +11 -0
- package/dist/registry/stubs/workflows/startup-credits/google-cloud-application.md +11 -0
- package/dist/registry/stubs/workflows/startup-credits/microsoft-azure-application.md +11 -0
- package/dist/registry/templates/bootstrap/ARCHITECTURE-TEMPLATE.md +53 -0
- package/dist/registry/templates/bootstrap/CODE-QUALITY-REPORT-TEMPLATE.md +37 -0
- package/dist/registry/templates/bootstrap/TEST-COVERAGE-REPORT-TEMPLATE.md +35 -0
- package/dist/registry/templates/business-development/IDEATION-REPORT-TEMPLATE.md +29 -0
- package/dist/registry/templates/business-development/PRICING-STRATEGY-TEMPLATE.md +126 -0
- package/dist/registry/templates/customer-development/customer-interview-template.md +99 -0
- package/dist/registry/templates/customer-development/customer-persona-template.md +69 -0
- package/dist/registry/templates/customer-development/follow-up-email-templates.md +132 -0
- package/dist/registry/templates/customer-development/insight-analysis-template.md +74 -0
- package/dist/registry/templates/customer-development/prospect-inventory-template.csv +3 -0
- package/dist/registry/templates/customer-development/search-strategy-template.md +123 -0
- package/dist/registry/templates/customer-development/strategic-recommendations-template.md +53 -0
- package/dist/registry/templates/customer-development/thank-you-email-template.html +124 -0
- package/dist/registry/templates/customer-development/thank-you-note-template.md +16 -0
- package/dist/registry/templates/customer-development/triage-log-template.md +278 -0
- package/dist/registry/templates/customer-development/weekly-newsletter-template.html +204 -0
- package/dist/registry/templates/evidence/Design-Evidence.md +30 -0
- package/dist/registry/templates/evidence/Implementation-BugEvidence.md +122 -0
- package/dist/registry/templates/evidence/Implementation-FeatureEvidence.md +160 -0
- package/dist/registry/templates/evidence/Spec-Evidence.md +19 -0
- package/dist/registry/templates/help/HelpNeeded.md +14 -0
- package/dist/registry/templates/legal/NDA-TEMPLATE.md +170 -0
- package/dist/registry/templates/legal/PATENT-TEMPLATE.md +372 -0
- package/dist/registry/templates/legal/TRADEMARK-TEMPLATE.md +339 -0
- package/dist/registry/templates/legal/contract-review-checklist.md +193 -0
- package/dist/registry/templates/legal/review-report-template.md +198 -0
- package/dist/registry/templates/legal/saas-terms-template.md +174 -0
- package/dist/registry/templates/legal/sow-template.md +117 -0
- package/dist/registry/templates/legal/template-variables.md +131 -0
- package/dist/registry/templates/marketing/DOMAIN-REGISTRATION-TEMPLATE.md +194 -0
- package/dist/registry/templates/marketing/EVANGELIZE-TEMPLATE.md +102 -0
- package/dist/registry/templates/marketing/HBR-ARTICLE-TEMPLATE.md +66 -0
- package/dist/registry/templates/marketing/STORYTELLING-TEMPLATE.md +130 -0
- package/dist/registry/templates/marketing/WEBSITE-TEMPLATE.md +262 -0
- package/dist/registry/templates/marketing/github-pages-workflow.yml +64 -0
- package/dist/registry/templates/replicate/implementation-checklist.md +39 -0
- package/dist/registry/templates/replicate/use-cases-template.md +88 -0
- package/dist/registry/templates/retrospective/RETROSPECTIVE-TEMPLATE.md +55 -0
- package/dist/registry/templates/specs/BUGSPEC-TEMPLATE.md +37 -0
- package/dist/registry/templates/specs/FEATURESPEC-TEMPLATE.md +66 -0
- package/dist/registry/templates/specs/TECHSPEC-TEMPLATE.md +39 -0
- package/dist/registry/workflows/azure/cost-optimization.md +772 -0
- package/dist/registry/workflows/bootstrap/create-architecture.md +37 -0
- package/dist/registry/workflows/bootstrap/detect-broken-windows.md +300 -0
- package/dist/registry/workflows/bootstrap/evaluate-code-quality.md +35 -0
- package/dist/registry/workflows/bootstrap/verify-test-coverage.md +36 -0
- package/dist/registry/workflows/brainstorming/blue-sky-brainstorming.md +211 -0
- package/dist/registry/workflows/brainstorming/codebase-brainstorming.md +159 -0
- package/dist/registry/workflows/business-development/create-business-plan.md +737 -0
- package/dist/registry/workflows/business-development/ideate-business-opportunity.md +55 -0
- package/dist/registry/workflows/business-development/price-product.md +325 -0
- package/dist/registry/workflows/compliance/detect-compliance-requirements.md +80 -0
- package/dist/registry/workflows/compliance/generate-audit-evidence.md +80 -0
- package/dist/registry/workflows/compliance/soc2-evidence-generator.md +332 -0
- package/dist/registry/workflows/customer-development/insight-analysis.md +156 -0
- package/dist/registry/workflows/customer-development/insight-triage.md +933 -0
- package/dist/registry/workflows/customer-development/interview-preparation.md +452 -0
- package/dist/registry/workflows/customer-development/linkedin-outreach.md +599 -0
- package/dist/registry/workflows/customer-development/strategic-brainstorming.md +146 -0
- package/dist/registry/workflows/customer-development/thank-customers.md +203 -0
- package/dist/registry/workflows/customer-development/user-survey-dispatch.md +312 -0
- package/dist/registry/workflows/customer-development/users-to-target.md +427 -0
- package/dist/registry/workflows/customer-development/weekly-newsletter.md +366 -0
- package/dist/registry/workflows/deploy/cloud-deployment.md +310 -0
- package/dist/registry/workflows/improve-fraim/contribute.md +32 -0
- package/dist/registry/workflows/improve-fraim/file-issue.md +32 -0
- package/dist/registry/workflows/learning/build-skillset.md +212 -0
- package/dist/registry/workflows/learning/synthesize-learnings.md +369 -0
- package/dist/registry/workflows/legal/contract-review-analysis.md +382 -0
- package/dist/registry/workflows/legal/nda.md +69 -0
- package/dist/registry/workflows/legal/patent-filing.md +76 -0
- package/dist/registry/workflows/legal/saas-contract-development.md +204 -0
- package/dist/registry/workflows/legal/trademark-filing.md +77 -0
- package/dist/registry/workflows/marketing/content-creation.md +40 -0
- package/dist/registry/workflows/marketing/convert-to-pdf.md +265 -0
- package/dist/registry/workflows/marketing/create-modern-website.md +456 -0
- package/dist/registry/workflows/marketing/domain-registration.md +323 -0
- package/dist/registry/workflows/marketing/evangelize.md +426 -0
- package/dist/registry/workflows/marketing/hbr-article.md +73 -0
- package/dist/registry/workflows/marketing/launch-checklist.md +37 -0
- package/dist/registry/workflows/marketing/marketing-strategy.md +45 -0
- package/dist/registry/workflows/marketing/storytelling.md +65 -0
- package/dist/registry/workflows/performance/analyze-performance.md +65 -0
- package/dist/registry/workflows/product-building/design.md +263 -0
- package/dist/registry/workflows/product-building/implement.md +771 -0
- package/dist/registry/workflows/product-building/iterate-on-pr-comments.md +70 -0
- package/dist/registry/workflows/product-building/prep-issue.md +41 -0
- package/dist/registry/workflows/product-building/prototype.md +60 -0
- package/dist/registry/workflows/product-building/resolve.md +175 -0
- package/dist/registry/workflows/product-building/retrospect.md +86 -0
- package/dist/registry/workflows/product-building/spec.md +303 -0
- package/dist/registry/workflows/product-building/test.md +125 -0
- package/dist/registry/workflows/productivity-report/productivity-report.md +263 -0
- package/dist/registry/workflows/quality-assurance/browser-validation.md +221 -0
- package/dist/registry/workflows/quality-assurance/iterative-improvement-cycle.md +562 -0
- package/dist/registry/workflows/replicate/replicate-discovery.md +336 -0
- package/dist/registry/workflows/replicate/replicate-to-issues.md +319 -0
- package/dist/registry/workflows/reviewer/review-implementation-vs-design-spec.md +694 -0
- package/dist/registry/workflows/reviewer/review-implementation-vs-feature-spec.md +734 -0
- package/dist/registry/workflows/startup-credits/aws-activate-application.md +535 -0
- package/dist/registry/workflows/startup-credits/google-cloud-application.md +647 -0
- package/dist/registry/workflows/startup-credits/microsoft-azure-application.md +538 -0
- package/package.json +2 -1
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
#!/usr/bin/env npx tsx
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
const child_process_1 = require("child_process");
|
|
38
|
+
const fs_1 = require("fs");
|
|
39
|
+
const path_1 = require("path");
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
function loadClientConfig() {
|
|
42
|
+
const configPath = (0, path_1.join)(process.cwd(), '.fraim', 'config.json');
|
|
43
|
+
if (!(0, fs_1.existsSync)(configPath)) {
|
|
44
|
+
throw new Error('.fraim/config.json not found. Run fraim init first.');
|
|
45
|
+
}
|
|
46
|
+
return JSON.parse((0, fs_1.readFileSync)(configPath, 'utf-8'));
|
|
47
|
+
}
|
|
48
|
+
function getEnvOr(keys, fallback) {
|
|
49
|
+
for (const key of keys) {
|
|
50
|
+
const value = process.env[key];
|
|
51
|
+
if (value && value.length)
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
return fallback;
|
|
55
|
+
}
|
|
56
|
+
function checkAzureCLI() {
|
|
57
|
+
try {
|
|
58
|
+
(0, child_process_1.execSync)('az --version', { stdio: 'pipe' });
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function checkAzureAuth() {
|
|
66
|
+
try {
|
|
67
|
+
(0, child_process_1.execSync)('az account show', { stdio: 'pipe' });
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async function getAppServicePlanMetrics(appName, resourceGroup) {
|
|
75
|
+
try {
|
|
76
|
+
console.log('\n--- āļø App Service Plan Metrics ---');
|
|
77
|
+
// Get App Service Plan ID
|
|
78
|
+
const planIdCmd = `az webapp show --name ${appName} --resource-group ${resourceGroup} --query "appServicePlanId" -o tsv`;
|
|
79
|
+
const planId = (0, child_process_1.execSync)(planIdCmd, { encoding: 'utf8' }).trim();
|
|
80
|
+
const planName = planId.split('/').pop();
|
|
81
|
+
console.log(`š Plan: ${planName}`);
|
|
82
|
+
// Get CPU and Memory metrics for last 5 minutes
|
|
83
|
+
console.log('š Fetching CPU and Memory metrics (last 5 minutes)...');
|
|
84
|
+
const metricsCmd = `az monitor metrics list --resource "${planId}" --metrics CpuPercentage MemoryPercentage --interval PT1M --query "value[].{name:name.value, data:timeseries[0].data}" -o json`;
|
|
85
|
+
const metricsOutput = (0, child_process_1.execSync)(metricsCmd, { encoding: 'utf8' });
|
|
86
|
+
const metrics = JSON.parse(metricsOutput);
|
|
87
|
+
for (const metric of metrics) {
|
|
88
|
+
const latestData = metric.data[metric.data.length - 1];
|
|
89
|
+
const value = latestData?.average || latestData?.total || 'N/A';
|
|
90
|
+
console.log(` ${metric.name}: ${typeof value === 'number' ? value.toFixed(2) + '%' : value}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.log(`ā ļø Could not fetch App Service Plan metrics: ${error.message.split('\n')[0]}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async function getAppServiceMetrics(appName, resourceGroup) {
|
|
98
|
+
try {
|
|
99
|
+
console.log('\n--- š„ļø App Service Metrics ---');
|
|
100
|
+
// Get subscription ID
|
|
101
|
+
const subscriptionId = (0, child_process_1.execSync)('az account show --query id -o tsv', { encoding: 'utf8' }).trim();
|
|
102
|
+
// Get app-level metrics using Azure CLI
|
|
103
|
+
console.log('š Fetching App Service metrics (last 5 minutes)...');
|
|
104
|
+
const root = '/';
|
|
105
|
+
const appResourceId = `${root}subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.Web/sites/${appName}`;
|
|
106
|
+
const appMetricsCmd = `az monitor metrics list --resource "${appResourceId}" --metrics CpuTime Requests Http2xx Http4xx Http5xx --interval PT1M --query "value[].{name:name.value, data:timeseries[0].data}" -o json`;
|
|
107
|
+
const appMetricsOutput = (0, child_process_1.execSync)(appMetricsCmd, { encoding: 'utf8' });
|
|
108
|
+
const appMetrics = JSON.parse(appMetricsOutput);
|
|
109
|
+
for (const metric of appMetrics) {
|
|
110
|
+
const latestData = metric.data[metric.data.length - 1];
|
|
111
|
+
const value = latestData?.total || latestData?.average || 'N/A';
|
|
112
|
+
let displayValue = value;
|
|
113
|
+
if (typeof value === 'number') {
|
|
114
|
+
if (metric.name === 'CpuTime') {
|
|
115
|
+
displayValue = `${value.toFixed(2)}s`;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
displayValue = value.toString();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
console.log(` ${metric.name}: ${displayValue}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
console.log(`ā ļø Could not fetch App Service metrics: ${error.message.split('\n')[0]}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async function getProcessInformation(appName) {
|
|
129
|
+
try {
|
|
130
|
+
console.log('\n--- āļø Process Information (Kudu API) ---');
|
|
131
|
+
// Get access token for Kudu API
|
|
132
|
+
const token = (0, child_process_1.execSync)('az account get-access-token --resource https://management.azure.com/ --query accessToken -o tsv', { encoding: 'utf8' }).trim();
|
|
133
|
+
// Import axios dynamically
|
|
134
|
+
const axios = (await Promise.resolve().then(() => __importStar(require('axios')))).default;
|
|
135
|
+
// Get process list from Kudu
|
|
136
|
+
console.log('š Fetching running processes...');
|
|
137
|
+
const processResponse = await axios.get(`https://${appName}.scm.azurewebsites.net/api/processes`, {
|
|
138
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
139
|
+
timeout: 10000
|
|
140
|
+
});
|
|
141
|
+
const processes = processResponse.data;
|
|
142
|
+
// Sort by CPU usage and show top processes
|
|
143
|
+
const sortedProcesses = processes
|
|
144
|
+
.filter((p) => p.cpu_usage !== undefined)
|
|
145
|
+
.sort((a, b) => (b.cpu_usage || 0) - (a.cpu_usage || 0))
|
|
146
|
+
.slice(0, 10);
|
|
147
|
+
console.log('\nš„ Top 10 Processes by CPU Usage:');
|
|
148
|
+
console.log('PID\tCPU%\tMemory(MB)\tName');
|
|
149
|
+
console.log('---\t----\t---------\t----');
|
|
150
|
+
for (const process of sortedProcesses) {
|
|
151
|
+
const pid = process.id || 'N/A';
|
|
152
|
+
const cpu = process.cpu_usage ? process.cpu_usage.toFixed(2) : '0.00';
|
|
153
|
+
const memory = process.working_set ? (process.working_set / 1024 / 1024).toFixed(1) : 'N/A';
|
|
154
|
+
const name = process.name || 'Unknown';
|
|
155
|
+
console.log(`${pid}\t${cpu}\t${memory}\t\t${name.substring(0, 30)}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
console.log(`ā ļø Could not fetch process information: ${error.message.split('\n')[0]}`);
|
|
160
|
+
console.log(' This might be due to authentication issues or Kudu API being unavailable.');
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async function getSystemInformation(appName) {
|
|
164
|
+
try {
|
|
165
|
+
console.log('\n--- š„ļø System Information ---');
|
|
166
|
+
const token = (0, child_process_1.execSync)('az account get-access-token --resource https://management.azure.com/ --query accessToken -o tsv', { encoding: 'utf8' }).trim();
|
|
167
|
+
const axios = (await Promise.resolve().then(() => __importStar(require('axios')))).default;
|
|
168
|
+
// Get system info using Kudu command API
|
|
169
|
+
console.log('š Fetching system information...');
|
|
170
|
+
const commands = [
|
|
171
|
+
{ name: 'Memory Info', cmd: 'cat /proc/meminfo | head -10' },
|
|
172
|
+
{ name: 'CPU Info', cmd: 'cat /proc/cpuinfo | grep "model name" | head -1' },
|
|
173
|
+
{ name: 'Disk Usage', cmd: 'df -h | head -5' },
|
|
174
|
+
{ name: 'Load Average', cmd: 'uptime' }
|
|
175
|
+
];
|
|
176
|
+
for (const command of commands) {
|
|
177
|
+
try {
|
|
178
|
+
const response = await axios.post(`https://${appName}.scm.azurewebsites.net/api/command`, {
|
|
179
|
+
command: command.cmd,
|
|
180
|
+
dir: path.join(path.sep, 'home')
|
|
181
|
+
}, {
|
|
182
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
183
|
+
timeout: 5000
|
|
184
|
+
});
|
|
185
|
+
console.log(`\n${command.name}:`);
|
|
186
|
+
const output = response.data.Output || response.data.Error || 'No output';
|
|
187
|
+
console.log(output.split('\n').map((line) => ` ${line}`).join('\n'));
|
|
188
|
+
}
|
|
189
|
+
catch (cmdError) {
|
|
190
|
+
console.log(`\n${command.name}: Could not retrieve (${cmdError.message.split('\n')[0]})`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
console.log(`ā ļø Could not fetch system information: ${error.message.split('\n')[0]}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async function getApplicationLogs(appName, resourceGroup) {
|
|
199
|
+
try {
|
|
200
|
+
console.log('\n--- š Recent Application Logs ---');
|
|
201
|
+
// Get recent logs using Azure CLI
|
|
202
|
+
console.log('š Fetching recent application logs...');
|
|
203
|
+
const logsCmd = `az webapp log tail --name ${appName} --resource-group ${resourceGroup} --provider application --timeout 5`;
|
|
204
|
+
try {
|
|
205
|
+
const logs = (0, child_process_1.execSync)(logsCmd, { encoding: 'utf8', timeout: 10000 });
|
|
206
|
+
console.log('Recent logs:');
|
|
207
|
+
console.log(logs.split('\n').slice(-20).map(line => ` ${line}`).join('\n'));
|
|
208
|
+
}
|
|
209
|
+
catch (logError) {
|
|
210
|
+
console.log('ā ļø Could not fetch logs - they may not be enabled or available');
|
|
211
|
+
console.log(' Enable application logging in Azure portal for better diagnostics');
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
console.log(`ā ļø Could not fetch application logs: ${error.message.split('\n')[0]}`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
async function profileLocalEnvironment() {
|
|
219
|
+
console.log('\n--- š Local Environment Profiling ---');
|
|
220
|
+
try {
|
|
221
|
+
// Basic system information
|
|
222
|
+
console.log('š» System Information:');
|
|
223
|
+
if (process.platform === 'win32') {
|
|
224
|
+
try {
|
|
225
|
+
const systemInfo = (0, child_process_1.execSync)('systeminfo | findstr /C:"Total Physical Memory" /C:"Available Physical Memory" /C:"Processor"', { encoding: 'utf8' });
|
|
226
|
+
console.log(systemInfo.split('\n').map(line => ` ${line.trim()}`).filter(line => line).join('\n'));
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
console.log(' Could not retrieve Windows system info');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
try {
|
|
234
|
+
const memInfo = (0, child_process_1.execSync)('free -h', { encoding: 'utf8' });
|
|
235
|
+
const cpuInfo = (0, child_process_1.execSync)('cat /proc/cpuinfo | grep "model name" | head -1', { encoding: 'utf8' });
|
|
236
|
+
console.log(' Memory:');
|
|
237
|
+
console.log(memInfo.split('\n').map(line => ` ${line}`).join('\n'));
|
|
238
|
+
console.log(' CPU:');
|
|
239
|
+
console.log(` ${cpuInfo.trim()}`);
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
console.log(' Could not retrieve Linux system info');
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// Node.js process information
|
|
246
|
+
console.log('\nš¢ Node.js Process Information:');
|
|
247
|
+
console.log(` Node Version: ${process.version}`);
|
|
248
|
+
console.log(` Platform: ${process.platform}`);
|
|
249
|
+
console.log(` Architecture: ${process.arch}`);
|
|
250
|
+
console.log(` Memory Usage:`);
|
|
251
|
+
const memUsage = process.memoryUsage();
|
|
252
|
+
console.log(` RSS: ${(memUsage.rss / 1024 / 1024).toFixed(2)} MB`);
|
|
253
|
+
console.log(` Heap Used: ${(memUsage.heapUsed / 1024 / 1024).toFixed(2)} MB`);
|
|
254
|
+
console.log(` Heap Total: ${(memUsage.heapTotal / 1024 / 1024).toFixed(2)} MB`);
|
|
255
|
+
console.log(` External: ${(memUsage.external / 1024 / 1024).toFixed(2)} MB`);
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
console.log(`ā ļø Error profiling local environment: ${error.message}`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
async function main() {
|
|
262
|
+
const config = loadClientConfig();
|
|
263
|
+
// Azure configuration with environment variable fallbacks
|
|
264
|
+
const azureConfig = {
|
|
265
|
+
prodAppName: config.azure?.prodAppName || getEnvOr(['FRAIM_AZURE_PROD_APP_NAME'], 'fraim-app-prod'),
|
|
266
|
+
prodResourceGroup: config.azure?.prodResourceGroup || getEnvOr(['FRAIM_AZURE_PROD_RESOURCE_GROUP'], 'fraim-prod-rg'),
|
|
267
|
+
preprodAppName: config.azure?.preprodAppName || getEnvOr(['FRAIM_AZURE_PREPROD_APP_NAME'], 'fraim-app-pre-prod'),
|
|
268
|
+
preprodResourceGroup: config.azure?.preprodResourceGroup || getEnvOr(['FRAIM_AZURE_PREPROD_RESOURCE_GROUP'], 'fraim-pre-prod-rg'),
|
|
269
|
+
localAppName: config.azure?.localAppName || getEnvOr(['FRAIM_AZURE_LOCAL_APP_NAME'], 'local'),
|
|
270
|
+
localResourceGroup: config.azure?.localResourceGroup || getEnvOr(['FRAIM_AZURE_LOCAL_RESOURCE_GROUP'], 'local')
|
|
271
|
+
};
|
|
272
|
+
const CONFIGS = {
|
|
273
|
+
prod: {
|
|
274
|
+
env: 'prod',
|
|
275
|
+
appName: azureConfig.prodAppName,
|
|
276
|
+
resourceGroup: azureConfig.prodResourceGroup
|
|
277
|
+
},
|
|
278
|
+
preprod: {
|
|
279
|
+
env: 'preprod',
|
|
280
|
+
appName: azureConfig.preprodAppName,
|
|
281
|
+
resourceGroup: azureConfig.preprodResourceGroup
|
|
282
|
+
},
|
|
283
|
+
local: {
|
|
284
|
+
env: 'local',
|
|
285
|
+
appName: azureConfig.localAppName,
|
|
286
|
+
resourceGroup: azureConfig.localResourceGroup
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
const args = process.argv.slice(2);
|
|
290
|
+
let profileConfig = CONFIGS.local;
|
|
291
|
+
const includeLogs = args.includes('--logs');
|
|
292
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
293
|
+
console.log(`
|
|
294
|
+
š Azure App Service Profiler
|
|
295
|
+
|
|
296
|
+
Usage:
|
|
297
|
+
npx tsx profile-server.ts [options]
|
|
298
|
+
|
|
299
|
+
Options:
|
|
300
|
+
--prod Profile production environment
|
|
301
|
+
--preprod Profile pre-production environment
|
|
302
|
+
--local Profile local environment (default)
|
|
303
|
+
--logs Include application logs in analysis
|
|
304
|
+
--help, -h Show this help message
|
|
305
|
+
|
|
306
|
+
Examples:
|
|
307
|
+
# Profile production server
|
|
308
|
+
npx tsx profile-server.ts --prod
|
|
309
|
+
|
|
310
|
+
# Profile with logs
|
|
311
|
+
npx tsx profile-server.ts --prod --logs
|
|
312
|
+
|
|
313
|
+
# Profile local environment
|
|
314
|
+
npx tsx profile-server.ts --local
|
|
315
|
+
|
|
316
|
+
Requirements:
|
|
317
|
+
- Azure CLI (az) installed and authenticated
|
|
318
|
+
- Proper permissions to access App Service resources
|
|
319
|
+
- For Kudu API access: Contributor role on the App Service
|
|
320
|
+
|
|
321
|
+
Configuration:
|
|
322
|
+
Reads Azure settings from .fraim/config.json or environment variables:
|
|
323
|
+
- FRAIM_AZURE_PROD_APP_NAME
|
|
324
|
+
- FRAIM_AZURE_PROD_RESOURCE_GROUP
|
|
325
|
+
- FRAIM_AZURE_PREPROD_APP_NAME
|
|
326
|
+
- FRAIM_AZURE_PREPROD_RESOURCE_GROUP
|
|
327
|
+
`);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
if (args.includes('--prod'))
|
|
331
|
+
profileConfig = CONFIGS.prod;
|
|
332
|
+
else if (args.includes('--preprod'))
|
|
333
|
+
profileConfig = CONFIGS.preprod;
|
|
334
|
+
else if (args.includes('--local'))
|
|
335
|
+
profileConfig = CONFIGS.local;
|
|
336
|
+
console.log(`\nš Starting Server Profiling`);
|
|
337
|
+
console.log(`š Environment: ${profileConfig.env.toUpperCase()}`);
|
|
338
|
+
console.log(`š·ļø App: ${profileConfig.appName}`);
|
|
339
|
+
console.log(`š Resource Group: ${profileConfig.resourceGroup}`);
|
|
340
|
+
if (profileConfig.env === 'local') {
|
|
341
|
+
await profileLocalEnvironment();
|
|
342
|
+
console.log('\nā
Local profiling completed');
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
// Check prerequisites for Azure profiling
|
|
346
|
+
console.log('\nš Checking prerequisites...');
|
|
347
|
+
if (!checkAzureCLI()) {
|
|
348
|
+
console.error('ā Azure CLI not found. Please install Azure CLI first.');
|
|
349
|
+
console.error(' Download from: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli');
|
|
350
|
+
process.exit(1);
|
|
351
|
+
}
|
|
352
|
+
console.log('ā
Azure CLI found');
|
|
353
|
+
if (!checkAzureAuth()) {
|
|
354
|
+
console.error('ā Not authenticated with Azure. Please run: az login');
|
|
355
|
+
process.exit(1);
|
|
356
|
+
}
|
|
357
|
+
console.log('ā
Azure authentication verified');
|
|
358
|
+
try {
|
|
359
|
+
// Verify app exists
|
|
360
|
+
console.log(`\nš Verifying App Service: ${profileConfig.appName}`);
|
|
361
|
+
(0, child_process_1.execSync)(`az webapp show --name ${profileConfig.appName} --resource-group ${profileConfig.resourceGroup} --query name -o tsv`, { stdio: 'pipe' });
|
|
362
|
+
console.log('ā
App Service found');
|
|
363
|
+
// Run profiling analysis
|
|
364
|
+
await getAppServicePlanMetrics(profileConfig.appName, profileConfig.resourceGroup);
|
|
365
|
+
await getAppServiceMetrics(profileConfig.appName, profileConfig.resourceGroup);
|
|
366
|
+
await getProcessInformation(profileConfig.appName);
|
|
367
|
+
await getSystemInformation(profileConfig.appName);
|
|
368
|
+
if (includeLogs) {
|
|
369
|
+
await getApplicationLogs(profileConfig.appName, profileConfig.resourceGroup);
|
|
370
|
+
}
|
|
371
|
+
console.log('\nā
Server profiling completed successfully');
|
|
372
|
+
console.log('\nš” Tips:');
|
|
373
|
+
console.log(' - Use --logs flag to include application logs');
|
|
374
|
+
console.log(' - High CPU usage may indicate performance bottlenecks');
|
|
375
|
+
console.log(' - High memory usage may indicate memory leaks');
|
|
376
|
+
console.log(' - Check process list for unexpected or resource-heavy processes');
|
|
377
|
+
}
|
|
378
|
+
catch (error) {
|
|
379
|
+
console.error(`\nā Profiling failed: ${error.message}`);
|
|
380
|
+
console.error('\nTroubleshooting:');
|
|
381
|
+
console.error(' - Verify app name and resource group are correct');
|
|
382
|
+
console.error(' - Ensure you have proper permissions (Contributor role)');
|
|
383
|
+
console.error(' - Check if the App Service is running');
|
|
384
|
+
console.error(' - Try: az webapp list --query "[].{name:name, resourceGroup:resourceGroup}"');
|
|
385
|
+
process.exit(1);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
// Run the main function
|
|
389
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Runner script for thank-you email workflow
|
|
5
|
+
* Called by AI agents to generate thank-you emails
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
const generate_engagement_emails_1 = require("./generate-engagement-emails");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
async function main() {
|
|
12
|
+
console.log('šÆ Starting thank-you email generation workflow...\n');
|
|
13
|
+
// Step 1: Get resolved issues
|
|
14
|
+
console.log('š Step 1: Retrieving resolved issues...');
|
|
15
|
+
const issues = await (0, generate_engagement_emails_1.getResolvedIssues)();
|
|
16
|
+
console.log(`\nā
Found ${issues.length} resolved issues\n`);
|
|
17
|
+
// Step 2: Extract customer information
|
|
18
|
+
console.log('š§ Step 2: Extracting customer information...\n');
|
|
19
|
+
const customerMap = new Map();
|
|
20
|
+
for (const issue of issues) {
|
|
21
|
+
// Extract email and name from issue body or title
|
|
22
|
+
let customerEmail = null;
|
|
23
|
+
let customerName = null;
|
|
24
|
+
// Try to extract from body first
|
|
25
|
+
const bodyEmailMatch = issue.body?.match(/\*\*Reported by:\*\*\s+(.+?)\s+\((.+?)\)/);
|
|
26
|
+
if (bodyEmailMatch) {
|
|
27
|
+
customerName = bodyEmailMatch[1].trim();
|
|
28
|
+
customerEmail = bodyEmailMatch[2].trim();
|
|
29
|
+
}
|
|
30
|
+
// Try to extract from title (format: "email: summary")
|
|
31
|
+
if (!customerEmail) {
|
|
32
|
+
const titleEmailMatch = issue.title.match(/^([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}):/);
|
|
33
|
+
if (titleEmailMatch) {
|
|
34
|
+
customerEmail = titleEmailMatch[1];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (!customerEmail) {
|
|
38
|
+
console.log(`ā ļø Issue #${issue.number}: Could not extract customer email, skipping`);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
// Normalize email to lowercase for consistent matching
|
|
42
|
+
const normalizedEmail = customerEmail.toLowerCase();
|
|
43
|
+
// Add or update customer data
|
|
44
|
+
if (!customerMap.has(normalizedEmail)) {
|
|
45
|
+
customerMap.set(normalizedEmail, {
|
|
46
|
+
email: normalizedEmail,
|
|
47
|
+
name: customerName || 'Valued Customer',
|
|
48
|
+
issues: []
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const customerData = customerMap.get(normalizedEmail);
|
|
52
|
+
customerData.issues.push({
|
|
53
|
+
number: issue.number,
|
|
54
|
+
title: issue.title,
|
|
55
|
+
body: issue.body || ''
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
console.log(`š Found ${customerMap.size} unique customers\n`);
|
|
59
|
+
// Step 3: Lookup executive data for each customer
|
|
60
|
+
console.log('š Step 3: Looking up executive data...\n');
|
|
61
|
+
const entries = Array.from(customerMap.entries());
|
|
62
|
+
for (const [email, customerData] of entries) {
|
|
63
|
+
try {
|
|
64
|
+
const executive = await (0, generate_engagement_emails_1.findExecutiveByEmail)(email);
|
|
65
|
+
if (executive) {
|
|
66
|
+
customerData.executiveId = executive.id;
|
|
67
|
+
customerData.executiveName = executive.name;
|
|
68
|
+
if (executive.id) {
|
|
69
|
+
const personaEmail = await (0, generate_engagement_emails_1.getPersonaEmailForExecutive)(executive.id);
|
|
70
|
+
customerData.personaEmail = personaEmail;
|
|
71
|
+
console.log(`ā
${email}: Found executive ${executive.name} (${executive.id}), Persona email: ${personaEmail}`);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
console.log(`ā ļø ${email}: Found executive ${executive.name} but no ID`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
console.log(`ā ļø ${email}: No executive record found in database`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error(`ā ${email}: Error looking up executive:`, error);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
console.log('\nš Customer Data Summary:\n');
|
|
86
|
+
console.log(JSON.stringify(Array.from(customerMap.values()), null, 2));
|
|
87
|
+
// Save to temp file for AI agent to process
|
|
88
|
+
const outputPath = (0, path_1.join)(process.cwd(), 'temp-customer-data.json');
|
|
89
|
+
(0, fs_1.writeFileSync)(outputPath, JSON.stringify(Array.from(customerMap.values()), null, 2));
|
|
90
|
+
console.log(`\nš¾ Customer data saved to: ${outputPath}`);
|
|
91
|
+
}
|
|
92
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Send Newsletter - Deterministic Script
|
|
5
|
+
*
|
|
6
|
+
* Simple script that users run after approving newsletter JSON.
|
|
7
|
+
* No decisions, just sends the newsletter.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* npm run send-newsletter # Send to all executives and potential customers
|
|
11
|
+
* npm run send-newsletter -- --showonly # List recipients without sending
|
|
12
|
+
* npm run send-newsletter -- --no-potential-customers # Send only to active executives
|
|
13
|
+
* npm run send-newsletter -- --only-potential-customers # Send only to potential customers
|
|
14
|
+
* npm run send-newsletter -- --email=user@example.com # Send to specific email
|
|
15
|
+
* npm run send-newsletter -- exec-XXX exec-YYY # Send to specific executive IDs
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const newsletter_helpers_1 = require("./newsletter-helpers");
|
|
19
|
+
const fs_1 = require("fs");
|
|
20
|
+
const path_1 = require("path");
|
|
21
|
+
async function main() {
|
|
22
|
+
console.log('š§ Weekly Newsletter Sender\n');
|
|
23
|
+
// Parse command line arguments
|
|
24
|
+
const args = process.argv.slice(2);
|
|
25
|
+
const showOnly = args.includes('--showonly');
|
|
26
|
+
const excludePotentialCustomers = args.includes('--no-potential-customers');
|
|
27
|
+
const onlyPotentialCustomers = args.includes('--only-potential-customers');
|
|
28
|
+
const filterEmails = [];
|
|
29
|
+
const filterExecIds = [];
|
|
30
|
+
// Parse email filters (--email=address)
|
|
31
|
+
args.forEach(arg => {
|
|
32
|
+
if (arg.startsWith('--email=')) {
|
|
33
|
+
filterEmails.push(arg.substring(8));
|
|
34
|
+
}
|
|
35
|
+
else if (arg.startsWith('exec-')) {
|
|
36
|
+
filterExecIds.push(arg);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
// Find the most recent newsletter
|
|
40
|
+
const newslettersDir = (0, path_1.join)(process.cwd(), 'docs', 'customer-development', 'newsletters');
|
|
41
|
+
if (!(0, fs_1.existsSync)(newslettersDir)) {
|
|
42
|
+
console.error('ā Error: No newsletters directory found');
|
|
43
|
+
console.error(' Expected: docs/customer-development/newsletters/');
|
|
44
|
+
console.error(' Generate a newsletter first using the AI agent workflow');
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
const files = (0, fs_1.readdirSync)(newslettersDir)
|
|
48
|
+
.filter(f => f.startsWith('newsletter-') && f.endsWith('.json'))
|
|
49
|
+
.sort()
|
|
50
|
+
.reverse(); // Most recent first
|
|
51
|
+
if (files.length === 0) {
|
|
52
|
+
console.error('ā Error: No newsletter files found');
|
|
53
|
+
console.error(' Generate a newsletter first using the AI agent workflow');
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
const latestNewsletter = files[0];
|
|
57
|
+
const newsletterPath = (0, path_1.join)(newslettersDir, latestNewsletter);
|
|
58
|
+
console.log(`š Found newsletter: ${latestNewsletter}`);
|
|
59
|
+
if (showOnly) {
|
|
60
|
+
console.log(`š Listing recipients (--showonly mode - no emails will be sent)...\n`);
|
|
61
|
+
}
|
|
62
|
+
else if (filterEmails.length > 0 || filterExecIds.length > 0) {
|
|
63
|
+
console.log(`š§ Sending to filtered recipients...\n`);
|
|
64
|
+
console.log(`ā ļø This will send real emails. Make sure the newsletter is approved!`);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
if (onlyPotentialCustomers) {
|
|
68
|
+
console.log(`š§ Sending to potential customers only...\n`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
console.log(`š§ Sending to all active executives${excludePotentialCustomers ? '' : ' and potential customers'}...\n`);
|
|
72
|
+
}
|
|
73
|
+
console.log(`ā ļø This will send real emails. Make sure the newsletter is approved!`);
|
|
74
|
+
}
|
|
75
|
+
console.log(` Preview: ${newsletterPath.replace('.json', '.html')}\n`);
|
|
76
|
+
// Determine what to include based on flags
|
|
77
|
+
const includePotentialCustomers = onlyPotentialCustomers || !excludePotentialCustomers;
|
|
78
|
+
const includeExecutives = !onlyPotentialCustomers;
|
|
79
|
+
// Send newsletter (or show only)
|
|
80
|
+
await (0, newsletter_helpers_1.sendNewsletterToExecutives)(newsletterPath, filterEmails.length > 0 ? filterEmails : undefined, filterExecIds.length > 0 ? filterExecIds : undefined, includePotentialCustomers, showOnly, includeExecutives);
|
|
81
|
+
}
|
|
82
|
+
main().catch(error => {
|
|
83
|
+
console.error('ā Error:', error.message);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Send Thank-You Emails from Candidates JSON File
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* npm run send-thank-you -- <filename> [exec-id-1] [exec-id-2] ...
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
* npm run send-thank-you -- docs/customer-development/thank-you-notes/thank-you-candidates-2025-10-29.json
|
|
11
|
+
* npm run send-thank-you -- docs/customer-development/thank-you-notes/thank-you-candidates-2025-10-29.json exec-123 exec-456
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const generate_engagement_emails_1 = require("./generate-engagement-emails");
|
|
15
|
+
async function main() {
|
|
16
|
+
const args = process.argv.slice(2);
|
|
17
|
+
if (args.length === 0) {
|
|
18
|
+
console.error('ā Error: Missing required argument: filename');
|
|
19
|
+
console.error('');
|
|
20
|
+
console.error('Usage: npm run send-thank-you -- <filename> [exec-id-1] [exec-id-2] ...');
|
|
21
|
+
console.error('');
|
|
22
|
+
console.error('Examples:');
|
|
23
|
+
console.error(' npm run send-thank-you -- docs/customer-development/thank-you-notes/thank-you-candidates-2025-10-29.json');
|
|
24
|
+
console.error(' npm run send-thank-you -- docs/customer-development/thank-you-notes/thank-you-candidates-2025-10-29.json exec-1760627251980-31qmjy5y4');
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
const filename = args[0];
|
|
28
|
+
const execIds = args.slice(1).filter(arg => arg.startsWith('exec-'));
|
|
29
|
+
if (execIds.length === 0) {
|
|
30
|
+
// Send to all pending candidates
|
|
31
|
+
console.log(`š§ Sending emails from: ${filename}`);
|
|
32
|
+
console.log(`šÆ Sending to ALL pending candidates`);
|
|
33
|
+
await (0, generate_engagement_emails_1.sendCustomerMail)(filename);
|
|
34
|
+
}
|
|
35
|
+
else if (execIds.length === 1) {
|
|
36
|
+
// Send to specific executive
|
|
37
|
+
console.log(`š§ Sending emails from: ${filename}`);
|
|
38
|
+
console.log(`šÆ Sending to executive: ${execIds[0]}`);
|
|
39
|
+
await (0, generate_engagement_emails_1.sendCustomerMail)(filename, execIds[0]);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Multiple executives - send to each one
|
|
43
|
+
console.log(`š§ Sending emails from: ${filename}`);
|
|
44
|
+
console.log(`šÆ Sending to ${execIds.length} executives: ${execIds.join(', ')}`);
|
|
45
|
+
for (const execId of execIds) {
|
|
46
|
+
console.log(`\nš§ Processing executive: ${execId}`);
|
|
47
|
+
await (0, generate_engagement_emails_1.sendCustomerMail)(filename, execId);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
main().catch(error => {
|
|
52
|
+
console.error('ā Error:', error);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
});
|