fraim-framework 2.0.56 → 2.0.58

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.
Files changed (224) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/bin/fraim-mcp.js +14 -0
  3. package/bin/fraim.js +23 -0
  4. package/dist/src/cli/commands/init-project.js +10 -4
  5. package/dist/src/cli/commands/mcp.js +65 -0
  6. package/dist/src/cli/setup/mcp-config-generator.js +19 -16
  7. package/dist/src/fraim/issue-tracking/ado-provider.js +304 -0
  8. package/dist/src/fraim/issue-tracking/factory.js +63 -0
  9. package/dist/src/fraim/issue-tracking/github-provider.js +200 -0
  10. package/dist/src/fraim/issue-tracking/types.js +7 -0
  11. package/dist/src/fraim/issue-tracking-config.js +83 -0
  12. package/dist/src/local-mcp-server/stdio-server.js +207 -0
  13. package/dist/src/utils/workflow-parser.js +81 -0
  14. package/package.json +17 -12
  15. package/registry/scripts/pdf-styles.css +172 -0
  16. package/registry/scripts/prep-issue.sh +46 -4
  17. package/registry/scripts/profile-server.ts +131 -130
  18. package/registry/stubs/workflows/customer-development/user-survey-dispatch.md +1 -1
  19. package/registry/stubs/workflows/customer-development/users-to-target.md +1 -1
  20. package/registry/stubs/workflows/product-building/design.md +1 -1
  21. package/registry/stubs/workflows/product-building/implement.md +1 -1
  22. package/Claude.md +0 -1
  23. package/dist/registry/ai-manager-rules/customer-development-phases/phase1-customer-profiling.md +0 -101
  24. package/dist/registry/ai-manager-rules/customer-development-phases/phase2-platform-discovery.md +0 -235
  25. package/dist/registry/ai-manager-rules/customer-development-phases/phase3-prospect-qualification.md +0 -243
  26. package/dist/registry/ai-manager-rules/customer-development-phases/phase4-inventory-compilation.md +0 -206
  27. package/dist/registry/ai-manager-rules/design-phases/design-completeness-review.md +0 -73
  28. package/dist/registry/ai-manager-rules/design-phases/design-design.md +0 -145
  29. package/dist/registry/ai-manager-rules/implement-phases/implement-code.md +0 -283
  30. package/dist/registry/ai-manager-rules/implement-phases/implement-completeness-review.md +0 -120
  31. package/dist/registry/ai-manager-rules/implement-phases/implement-regression.md +0 -173
  32. package/dist/registry/ai-manager-rules/implement-phases/implement-repro.md +0 -104
  33. package/dist/registry/ai-manager-rules/implement-phases/implement-scoping.md +0 -100
  34. package/dist/registry/ai-manager-rules/implement-phases/implement-smoke.md +0 -237
  35. package/dist/registry/ai-manager-rules/implement-phases/implement-spike.md +0 -121
  36. package/dist/registry/ai-manager-rules/implement-phases/implement-validate.md +0 -375
  37. package/dist/registry/ai-manager-rules/retrospective.md +0 -116
  38. package/dist/registry/ai-manager-rules/shared-phases/address-pr-feedback.md +0 -188
  39. package/dist/registry/ai-manager-rules/shared-phases/submit-pr.md +0 -202
  40. package/dist/registry/ai-manager-rules/shared-phases/wait-for-pr-review.md +0 -170
  41. package/dist/registry/ai-manager-rules/spec-phases/spec-competitor-analysis.md +0 -105
  42. package/dist/registry/ai-manager-rules/spec-phases/spec-completeness-review.md +0 -66
  43. package/dist/registry/ai-manager-rules/spec-phases/spec-spec.md +0 -139
  44. package/dist/registry/ai-manager-rules/user-survey-phases/phase1-survey-scoping.md +0 -60
  45. package/dist/registry/ai-manager-rules/user-survey-phases/phase2-survey-build-linkedin.md +0 -23
  46. package/dist/registry/ai-manager-rules/user-survey-phases/phase3-survey-build-reddit.md +0 -22
  47. package/dist/registry/ai-manager-rules/user-survey-phases/phase4-survey-build-x.md +0 -21
  48. package/dist/registry/ai-manager-rules/user-survey-phases/phase5-survey-build-facebook.md +0 -19
  49. package/dist/registry/ai-manager-rules/user-survey-phases/phase6-survey-build-custom.md +0 -15
  50. package/dist/registry/ai-manager-rules/user-survey-phases/phase7-survey-dispatch.md +0 -45
  51. package/dist/registry/providers/ado.json +0 -19
  52. package/dist/registry/providers/github.json +0 -19
  53. package/dist/registry/scripts/cleanup-branch.js +0 -287
  54. package/dist/registry/scripts/evaluate-code-quality.js +0 -66
  55. package/dist/registry/scripts/exec-with-timeout.js +0 -142
  56. package/dist/registry/scripts/generate-engagement-emails.js +0 -705
  57. package/dist/registry/scripts/newsletter-helpers.js +0 -671
  58. package/dist/registry/scripts/profile-server.js +0 -388
  59. package/dist/registry/scripts/run-thank-you-workflow.js +0 -92
  60. package/dist/registry/scripts/send-newsletter-simple.js +0 -85
  61. package/dist/registry/scripts/send-thank-you-emails.js +0 -54
  62. package/dist/registry/scripts/validate-openapi-limits.js +0 -311
  63. package/dist/registry/scripts/validate-test-coverage.js +0 -262
  64. package/dist/registry/scripts/verify-test-coverage.js +0 -66
  65. package/dist/registry/templates/bootstrap/ARCHITECTURE-TEMPLATE.md +0 -53
  66. package/dist/registry/templates/bootstrap/CODE-QUALITY-REPORT-TEMPLATE.md +0 -37
  67. package/dist/registry/templates/bootstrap/TEST-COVERAGE-REPORT-TEMPLATE.md +0 -35
  68. package/dist/registry/templates/business-development/IDEATION-REPORT-TEMPLATE.md +0 -29
  69. package/dist/registry/templates/business-development/PRICING-STRATEGY-TEMPLATE.md +0 -126
  70. package/dist/registry/templates/customer-development/customer-interview-template.md +0 -99
  71. package/dist/registry/templates/customer-development/customer-persona-template.md +0 -69
  72. package/dist/registry/templates/customer-development/follow-up-email-templates.md +0 -132
  73. package/dist/registry/templates/customer-development/insight-analysis-template.md +0 -74
  74. package/dist/registry/templates/customer-development/prospect-inventory-template.csv +0 -3
  75. package/dist/registry/templates/customer-development/search-strategy-template.md +0 -123
  76. package/dist/registry/templates/customer-development/strategic-recommendations-template.md +0 -53
  77. package/dist/registry/templates/customer-development/thank-you-email-template.html +0 -124
  78. package/dist/registry/templates/customer-development/thank-you-note-template.md +0 -16
  79. package/dist/registry/templates/customer-development/triage-log-template.md +0 -278
  80. package/dist/registry/templates/customer-development/weekly-newsletter-template.html +0 -204
  81. package/dist/registry/templates/evidence/Design-Evidence.md +0 -30
  82. package/dist/registry/templates/evidence/Implementation-BugEvidence.md +0 -94
  83. package/dist/registry/templates/evidence/Implementation-FeatureEvidence.md +0 -129
  84. package/dist/registry/templates/evidence/Spec-Evidence.md +0 -19
  85. package/dist/registry/templates/help/HelpNeeded.md +0 -14
  86. package/dist/registry/templates/legal/NDA-TEMPLATE.md +0 -170
  87. package/dist/registry/templates/legal/PATENT-TEMPLATE.md +0 -372
  88. package/dist/registry/templates/legal/TRADEMARK-TEMPLATE.md +0 -339
  89. package/dist/registry/templates/legal/contract-review-checklist.md +0 -193
  90. package/dist/registry/templates/legal/review-report-template.md +0 -198
  91. package/dist/registry/templates/legal/saas-terms-template.md +0 -174
  92. package/dist/registry/templates/legal/sow-template.md +0 -117
  93. package/dist/registry/templates/legal/template-variables.md +0 -131
  94. package/dist/registry/templates/marketing/DOMAIN-REGISTRATION-TEMPLATE.md +0 -194
  95. package/dist/registry/templates/marketing/HBR-ARTICLE-TEMPLATE.md +0 -66
  96. package/dist/registry/templates/marketing/STORYTELLING-TEMPLATE.md +0 -130
  97. package/dist/registry/templates/marketing/WEBSITE-TEMPLATE.md +0 -262
  98. package/dist/registry/templates/marketing/github-pages-workflow.yml +0 -64
  99. package/dist/registry/templates/replicate/implementation-checklist.md +0 -39
  100. package/dist/registry/templates/replicate/use-cases-template.md +0 -88
  101. package/dist/registry/templates/retrospective/RETROSPECTIVE-TEMPLATE.md +0 -55
  102. package/dist/registry/templates/specs/BUGSPEC-TEMPLATE.md +0 -37
  103. package/dist/registry/templates/specs/FEATURESPEC-TEMPLATE.md +0 -66
  104. package/dist/registry/templates/specs/TECHSPEC-TEMPLATE.md +0 -39
  105. package/dist/registry/workflows/bootstrap/create-architecture.md +0 -38
  106. package/dist/registry/workflows/bootstrap/detect-broken-windows.md +0 -300
  107. package/dist/registry/workflows/bootstrap/evaluate-code-quality.md +0 -35
  108. package/dist/registry/workflows/bootstrap/verify-test-coverage.md +0 -36
  109. package/dist/registry/workflows/brainstorming/blue-sky-brainstorming.md +0 -211
  110. package/dist/registry/workflows/brainstorming/codebase-brainstorming.md +0 -165
  111. package/dist/registry/workflows/business-development/create-business-plan.md +0 -737
  112. package/dist/registry/workflows/business-development/ideate-business-opportunity.md +0 -55
  113. package/dist/registry/workflows/business-development/price-product.md +0 -325
  114. package/dist/registry/workflows/compliance/detect-compliance-requirements.md +0 -78
  115. package/dist/registry/workflows/compliance/generate-audit-evidence.md +0 -75
  116. package/dist/registry/workflows/compliance/soc2-evidence-generator.md +0 -332
  117. package/dist/registry/workflows/customer-development/insight-analysis.md +0 -156
  118. package/dist/registry/workflows/customer-development/insight-triage.md +0 -938
  119. package/dist/registry/workflows/customer-development/interview-preparation.md +0 -452
  120. package/dist/registry/workflows/customer-development/linkedin-outreach.md +0 -593
  121. package/dist/registry/workflows/customer-development/strategic-brainstorming.md +0 -146
  122. package/dist/registry/workflows/customer-development/thank-customers.md +0 -203
  123. package/dist/registry/workflows/customer-development/user-survey-dispatch.md +0 -60
  124. package/dist/registry/workflows/customer-development/users-to-target.md +0 -112
  125. package/dist/registry/workflows/customer-development/weekly-newsletter.md +0 -366
  126. package/dist/registry/workflows/deploy/cloud-deployment.md +0 -310
  127. package/dist/registry/workflows/improve-fraim/contribute.md +0 -32
  128. package/dist/registry/workflows/improve-fraim/file-issue.md +0 -32
  129. package/dist/registry/workflows/learning/build-skillset.md +0 -212
  130. package/dist/registry/workflows/learning/synthesize-learnings.md +0 -284
  131. package/dist/registry/workflows/legal/contract-review-analysis.md +0 -382
  132. package/dist/registry/workflows/legal/nda.md +0 -69
  133. package/dist/registry/workflows/legal/patent-filing.md +0 -76
  134. package/dist/registry/workflows/legal/saas-contract-development.md +0 -213
  135. package/dist/registry/workflows/legal/trademark-filing.md +0 -77
  136. package/dist/registry/workflows/marketing/content-creation.md +0 -37
  137. package/dist/registry/workflows/marketing/convert-to-pdf.md +0 -235
  138. package/dist/registry/workflows/marketing/create-modern-website.md +0 -456
  139. package/dist/registry/workflows/marketing/domain-registration.md +0 -323
  140. package/dist/registry/workflows/marketing/hbr-article.md +0 -73
  141. package/dist/registry/workflows/marketing/launch-checklist.md +0 -37
  142. package/dist/registry/workflows/marketing/marketing-strategy.md +0 -45
  143. package/dist/registry/workflows/marketing/storytelling.md +0 -65
  144. package/dist/registry/workflows/performance/analyze-performance.md +0 -65
  145. package/dist/registry/workflows/product-building/design.md +0 -103
  146. package/dist/registry/workflows/product-building/implement.md +0 -74
  147. package/dist/registry/workflows/product-building/iterate-on-pr-comments.md +0 -70
  148. package/dist/registry/workflows/product-building/prep-issue.md +0 -41
  149. package/dist/registry/workflows/product-building/prototype.md +0 -65
  150. package/dist/registry/workflows/product-building/resolve.md +0 -168
  151. package/dist/registry/workflows/product-building/retrospect.md +0 -86
  152. package/dist/registry/workflows/product-building/spec.md +0 -181
  153. package/dist/registry/workflows/product-building/test.md +0 -125
  154. package/dist/registry/workflows/productivity-report/productivity-report.md +0 -263
  155. package/dist/registry/workflows/quality-assurance/browser-validation.md +0 -221
  156. package/dist/registry/workflows/quality-assurance/iterative-improvement-cycle.md +0 -562
  157. package/dist/registry/workflows/replicate/replicate-discovery.md +0 -336
  158. package/dist/registry/workflows/replicate/replicate-to-issues.md +0 -324
  159. package/dist/registry/workflows/reviewer/review-implementation-vs-design-spec.md +0 -638
  160. package/dist/registry/workflows/reviewer/review-implementation-vs-feature-spec.md +0 -675
  161. package/dist/registry/workflows/startup-credits/aws-activate-application.md +0 -535
  162. package/dist/registry/workflows/startup-credits/google-cloud-application.md +0 -647
  163. package/dist/registry/workflows/startup-credits/microsoft-azure-application.md +0 -538
  164. package/dist/scripts/build-stub-registry.js +0 -108
  165. package/dist/src/ai-manager/ai-manager.js +0 -480
  166. package/dist/src/ai-manager/phase-flow.js +0 -357
  167. package/dist/src/ai-manager/types.js +0 -5
  168. package/dist/src/fraim-mcp-server.js +0 -1885
  169. package/dist/tests/debug-tools.js +0 -80
  170. package/dist/tests/shared-server-utils.js +0 -57
  171. package/dist/tests/test-add-ide.js +0 -283
  172. package/dist/tests/test-ai-coach-edge-cases.js +0 -420
  173. package/dist/tests/test-ai-coach-mcp-integration.js +0 -450
  174. package/dist/tests/test-ai-coach-performance.js +0 -328
  175. package/dist/tests/test-ai-coach-phase-content.js +0 -264
  176. package/dist/tests/test-ai-coach-workflows.js +0 -514
  177. package/dist/tests/test-cli.js +0 -228
  178. package/dist/tests/test-client-scripts-validation.js +0 -167
  179. package/dist/tests/test-complete-setup-flow.js +0 -110
  180. package/dist/tests/test-config-system.js +0 -279
  181. package/dist/tests/test-debug-session.js +0 -134
  182. package/dist/tests/test-end-to-end-hybrid-validation.js +0 -328
  183. package/dist/tests/test-enhanced-session-init.js +0 -188
  184. package/dist/tests/test-first-run-journey.js +0 -368
  185. package/dist/tests/test-fraim-issues.js +0 -59
  186. package/dist/tests/test-genericization.js +0 -44
  187. package/dist/tests/test-hybrid-script-execution.js +0 -340
  188. package/dist/tests/test-ide-detector.js +0 -46
  189. package/dist/tests/test-improved-setup.js +0 -121
  190. package/dist/tests/test-mcp-config-generator.js +0 -99
  191. package/dist/tests/test-mcp-connection.js +0 -107
  192. package/dist/tests/test-mcp-issue-integration.js +0 -156
  193. package/dist/tests/test-mcp-lifecycle-methods.js +0 -240
  194. package/dist/tests/test-mcp-shared-server.js +0 -308
  195. package/dist/tests/test-mcp-template-processing.js +0 -160
  196. package/dist/tests/test-modular-issue-tracking.js +0 -165
  197. package/dist/tests/test-node-compatibility.js +0 -95
  198. package/dist/tests/test-npm-install.js +0 -68
  199. package/dist/tests/test-package-size.js +0 -108
  200. package/dist/tests/test-pr-review-workflow.js +0 -307
  201. package/dist/tests/test-prep-issue.js +0 -129
  202. package/dist/tests/test-productivity-integration.js +0 -157
  203. package/dist/tests/test-script-location-independence.js +0 -198
  204. package/dist/tests/test-script-sync.js +0 -557
  205. package/dist/tests/test-server-utils.js +0 -32
  206. package/dist/tests/test-session-rehydration.js +0 -148
  207. package/dist/tests/test-setup-integration.js +0 -98
  208. package/dist/tests/test-setup-scenarios.js +0 -322
  209. package/dist/tests/test-standalone.js +0 -143
  210. package/dist/tests/test-stub-registry.js +0 -136
  211. package/dist/tests/test-sync-stubs.js +0 -143
  212. package/dist/tests/test-sync-version-update.js +0 -93
  213. package/dist/tests/test-telemetry.js +0 -193
  214. package/dist/tests/test-token-validator.js +0 -30
  215. package/dist/tests/test-user-journey.js +0 -236
  216. package/dist/tests/test-users-to-target-workflow.js +0 -253
  217. package/dist/tests/test-utils.js +0 -109
  218. package/dist/tests/test-wizard.js +0 -71
  219. package/dist/tests/test-workflow-discovery.js +0 -242
  220. package/labels.json +0 -52
  221. package/registry/agent-guardrails.md +0 -63
  222. package/registry/fraim.md +0 -48
  223. package/setup.js +0 -171
  224. package/tsconfig.json +0 -23
@@ -1,388 +0,0 @@
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 appResourceId = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.Web/sites/${appName}`;
105
- 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`;
106
- const appMetricsOutput = (0, child_process_1.execSync)(appMetricsCmd, { encoding: 'utf8' });
107
- const appMetrics = JSON.parse(appMetricsOutput);
108
- for (const metric of appMetrics) {
109
- const latestData = metric.data[metric.data.length - 1];
110
- const value = latestData?.total || latestData?.average || 'N/A';
111
- let displayValue = value;
112
- if (typeof value === 'number') {
113
- if (metric.name === 'CpuTime') {
114
- displayValue = `${value.toFixed(2)}s`;
115
- }
116
- else {
117
- displayValue = value.toString();
118
- }
119
- }
120
- console.log(` ${metric.name}: ${displayValue}`);
121
- }
122
- }
123
- catch (error) {
124
- console.log(`āš ļø Could not fetch App Service metrics: ${error.message.split('\n')[0]}`);
125
- }
126
- }
127
- async function getProcessInformation(appName) {
128
- try {
129
- console.log('\n--- āš™ļø Process Information (Kudu API) ---');
130
- // Get access token for Kudu API
131
- const token = (0, child_process_1.execSync)('az account get-access-token --resource https://management.azure.com/ --query accessToken -o tsv', { encoding: 'utf8' }).trim();
132
- // Import axios dynamically
133
- const axios = (await Promise.resolve().then(() => __importStar(require('axios')))).default;
134
- // Get process list from Kudu
135
- console.log('šŸ“‹ Fetching running processes...');
136
- const processResponse = await axios.get(`https://${appName}.scm.azurewebsites.net/api/processes`, {
137
- headers: { Authorization: `Bearer ${token}` },
138
- timeout: 10000
139
- });
140
- const processes = processResponse.data;
141
- // Sort by CPU usage and show top processes
142
- const sortedProcesses = processes
143
- .filter((p) => p.cpu_usage !== undefined)
144
- .sort((a, b) => (b.cpu_usage || 0) - (a.cpu_usage || 0))
145
- .slice(0, 10);
146
- console.log('\nšŸ”„ Top 10 Processes by CPU Usage:');
147
- console.log('PID\tCPU%\tMemory(MB)\tName');
148
- console.log('---\t----\t---------\t----');
149
- for (const process of sortedProcesses) {
150
- const pid = process.id || 'N/A';
151
- const cpu = process.cpu_usage ? process.cpu_usage.toFixed(2) : '0.00';
152
- const memory = process.working_set ? (process.working_set / 1024 / 1024).toFixed(1) : 'N/A';
153
- const name = process.name || 'Unknown';
154
- console.log(`${pid}\t${cpu}\t${memory}\t\t${name.substring(0, 30)}`);
155
- }
156
- }
157
- catch (error) {
158
- console.log(`āš ļø Could not fetch process information: ${error.message.split('\n')[0]}`);
159
- console.log(' This might be due to authentication issues or Kudu API being unavailable.');
160
- }
161
- }
162
- async function getSystemInformation(appName) {
163
- try {
164
- console.log('\n--- šŸ–„ļø System Information ---');
165
- const token = (0, child_process_1.execSync)('az account get-access-token --resource https://management.azure.com/ --query accessToken -o tsv', { encoding: 'utf8' }).trim();
166
- const axios = (await Promise.resolve().then(() => __importStar(require('axios')))).default;
167
- // Get system info using Kudu command API
168
- console.log('šŸ“Š Fetching system information...');
169
- const commands = [
170
- { name: 'Memory Info', cmd: 'cat /proc/meminfo | head -10' },
171
- { name: 'CPU Info', cmd: 'cat /proc/cpuinfo | grep "model name" | head -1' },
172
- { name: 'Disk Usage', cmd: 'df -h | head -5' },
173
- { name: 'Load Average', cmd: 'uptime' }
174
- ];
175
- for (const command of commands) {
176
- try {
177
- const response = await axios.post(`https://${appName}.scm.azurewebsites.net/api/command`, {
178
- command: command.cmd,
179
- dir: path.join('/', 'home')
180
- }, {
181
- headers: { Authorization: `Bearer ${token}` },
182
- timeout: 5000
183
- });
184
- console.log(`\n${command.name}:`);
185
- const output = response.data.Output || response.data.Error || 'No output';
186
- console.log(output.split('\n').map((line) => ` ${line}`).join('\n'));
187
- }
188
- catch (cmdError) {
189
- console.log(`\n${command.name}: Could not retrieve (${cmdError.message.split('\n')[0]})`);
190
- }
191
- }
192
- }
193
- catch (error) {
194
- console.log(`āš ļø Could not fetch system information: ${error.message.split('\n')[0]}`);
195
- }
196
- }
197
- async function getApplicationLogs(appName, resourceGroup) {
198
- try {
199
- console.log('\n--- šŸ“‹ Recent Application Logs ---');
200
- // Get recent logs using Azure CLI
201
- console.log('šŸ“„ Fetching recent application logs...');
202
- const logsCmd = `az webapp log tail --name ${appName} --resource-group ${resourceGroup} --provider application --timeout 5`;
203
- try {
204
- const logs = (0, child_process_1.execSync)(logsCmd, { encoding: 'utf8', timeout: 10000 });
205
- console.log('Recent logs:');
206
- console.log(logs.split('\n').slice(-20).map(line => ` ${line}`).join('\n'));
207
- }
208
- catch (logError) {
209
- console.log('āš ļø Could not fetch logs - they may not be enabled or available');
210
- console.log(' Enable application logging in Azure portal for better diagnostics');
211
- }
212
- }
213
- catch (error) {
214
- console.log(`āš ļø Could not fetch application logs: ${error.message.split('\n')[0]}`);
215
- }
216
- }
217
- async function profileLocalEnvironment() {
218
- console.log('\n--- šŸ  Local Environment Profiling ---');
219
- try {
220
- // Basic system information
221
- console.log('šŸ’» System Information:');
222
- if (process.platform === 'win32') {
223
- try {
224
- const systemInfo = (0, child_process_1.execSync)('systeminfo | findstr /C:"Total Physical Memory" /C:"Available Physical Memory" /C:"Processor"', { encoding: 'utf8' });
225
- console.log(systemInfo.split('\n').map(line => ` ${line.trim()}`).filter(line => line).join('\n'));
226
- }
227
- catch {
228
- console.log(' Could not retrieve Windows system info');
229
- }
230
- }
231
- else {
232
- try {
233
- const memInfo = (0, child_process_1.execSync)('free -h', { encoding: 'utf8' });
234
- const cpuInfo = (0, child_process_1.execSync)('cat /proc/cpuinfo | grep "model name" | head -1', { encoding: 'utf8' });
235
- console.log(' Memory:');
236
- console.log(memInfo.split('\n').map(line => ` ${line}`).join('\n'));
237
- console.log(' CPU:');
238
- console.log(` ${cpuInfo.trim()}`);
239
- }
240
- catch {
241
- console.log(' Could not retrieve Linux system info');
242
- }
243
- }
244
- // Node.js process information
245
- console.log('\n🟢 Node.js Process Information:');
246
- console.log(` Node Version: ${process.version}`);
247
- console.log(` Platform: ${process.platform}`);
248
- console.log(` Architecture: ${process.arch}`);
249
- console.log(` Memory Usage:`);
250
- const memUsage = process.memoryUsage();
251
- console.log(` RSS: ${(memUsage.rss / 1024 / 1024).toFixed(2)} MB`);
252
- console.log(` Heap Used: ${(memUsage.heapUsed / 1024 / 1024).toFixed(2)} MB`);
253
- console.log(` Heap Total: ${(memUsage.heapTotal / 1024 / 1024).toFixed(2)} MB`);
254
- console.log(` External: ${(memUsage.external / 1024 / 1024).toFixed(2)} MB`);
255
- }
256
- catch (error) {
257
- console.log(`āš ļø Error profiling local environment: ${error.message}`);
258
- }
259
- }
260
- async function main() {
261
- const config = loadClientConfig();
262
- // Azure configuration with environment variable fallbacks
263
- const azureConfig = {
264
- prodAppName: config.azure?.prodAppName || getEnvOr(['FRAIM_AZURE_PROD_APP_NAME'], 'fraim-app-prod'),
265
- prodResourceGroup: config.azure?.prodResourceGroup || getEnvOr(['FRAIM_AZURE_PROD_RESOURCE_GROUP'], 'fraim-prod-rg'),
266
- preprodAppName: config.azure?.preprodAppName || getEnvOr(['FRAIM_AZURE_PREPROD_APP_NAME'], 'fraim-app-pre-prod'),
267
- preprodResourceGroup: config.azure?.preprodResourceGroup || getEnvOr(['FRAIM_AZURE_PREPROD_RESOURCE_GROUP'], 'fraim-pre-prod-rg'),
268
- localAppName: config.azure?.localAppName || getEnvOr(['FRAIM_AZURE_LOCAL_APP_NAME'], 'local'),
269
- localResourceGroup: config.azure?.localResourceGroup || getEnvOr(['FRAIM_AZURE_LOCAL_RESOURCE_GROUP'], 'local')
270
- };
271
- const CONFIGS = {
272
- prod: {
273
- env: 'prod',
274
- appName: azureConfig.prodAppName,
275
- resourceGroup: azureConfig.prodResourceGroup
276
- },
277
- preprod: {
278
- env: 'preprod',
279
- appName: azureConfig.preprodAppName,
280
- resourceGroup: azureConfig.preprodResourceGroup
281
- },
282
- local: {
283
- env: 'local',
284
- appName: azureConfig.localAppName,
285
- resourceGroup: azureConfig.localResourceGroup
286
- }
287
- };
288
- const args = process.argv.slice(2);
289
- let profileConfig = CONFIGS.local;
290
- const includeLogs = args.includes('--logs');
291
- if (args.includes('--help') || args.includes('-h')) {
292
- console.log(`
293
- šŸ” Azure App Service Profiler
294
-
295
- Usage:
296
- npx tsx profile-server.ts [options]
297
-
298
- Options:
299
- --prod Profile production environment
300
- --preprod Profile pre-production environment
301
- --local Profile local environment (default)
302
- --logs Include application logs in analysis
303
- --help, -h Show this help message
304
-
305
- Examples:
306
- # Profile production server
307
- npx tsx profile-server.ts --prod
308
-
309
- # Profile with logs
310
- npx tsx profile-server.ts --prod --logs
311
-
312
- # Profile local environment
313
- npx tsx profile-server.ts --local
314
-
315
- Requirements:
316
- - Azure CLI (az) installed and authenticated
317
- - Proper permissions to access App Service resources
318
- - For Kudu API access: Contributor role on the App Service
319
-
320
- Configuration:
321
- Reads Azure settings from .fraim/config.json or environment variables:
322
- - FRAIM_AZURE_PROD_APP_NAME
323
- - FRAIM_AZURE_PROD_RESOURCE_GROUP
324
- - FRAIM_AZURE_PREPROD_APP_NAME
325
- - FRAIM_AZURE_PREPROD_RESOURCE_GROUP
326
- `);
327
- return;
328
- }
329
- if (args.includes('--prod'))
330
- profileConfig = CONFIGS.prod;
331
- else if (args.includes('--preprod'))
332
- profileConfig = CONFIGS.preprod;
333
- else if (args.includes('--local'))
334
- profileConfig = CONFIGS.local;
335
- console.log(`\nšŸš€ Starting Server Profiling`);
336
- console.log(`šŸ“Š Environment: ${profileConfig.env.toUpperCase()}`);
337
- console.log(`šŸ·ļø App: ${profileConfig.appName}`);
338
- console.log(`šŸ“ Resource Group: ${profileConfig.resourceGroup}`);
339
- if (profileConfig.env === 'local') {
340
- await profileLocalEnvironment();
341
- console.log('\nāœ… Local profiling completed');
342
- return;
343
- }
344
- // Check prerequisites for Azure profiling
345
- console.log('\nšŸ” Checking prerequisites...');
346
- if (!checkAzureCLI()) {
347
- console.error('āŒ Azure CLI not found. Please install Azure CLI first.');
348
- console.error(' Download from: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli');
349
- process.exit(1);
350
- }
351
- console.log('āœ… Azure CLI found');
352
- if (!checkAzureAuth()) {
353
- console.error('āŒ Not authenticated with Azure. Please run: az login');
354
- process.exit(1);
355
- }
356
- console.log('āœ… Azure authentication verified');
357
- try {
358
- // Verify app exists
359
- console.log(`\nšŸ” Verifying App Service: ${profileConfig.appName}`);
360
- (0, child_process_1.execSync)(`az webapp show --name ${profileConfig.appName} --resource-group ${profileConfig.resourceGroup} --query name -o tsv`, { stdio: 'pipe' });
361
- console.log('āœ… App Service found');
362
- // Run profiling analysis
363
- await getAppServicePlanMetrics(profileConfig.appName, profileConfig.resourceGroup);
364
- await getAppServiceMetrics(profileConfig.appName, profileConfig.resourceGroup);
365
- await getProcessInformation(profileConfig.appName);
366
- await getSystemInformation(profileConfig.appName);
367
- if (includeLogs) {
368
- await getApplicationLogs(profileConfig.appName, profileConfig.resourceGroup);
369
- }
370
- console.log('\nāœ… Server profiling completed successfully');
371
- console.log('\nšŸ’” Tips:');
372
- console.log(' - Use --logs flag to include application logs');
373
- console.log(' - High CPU usage may indicate performance bottlenecks');
374
- console.log(' - High memory usage may indicate memory leaks');
375
- console.log(' - Check process list for unexpected or resource-heavy processes');
376
- }
377
- catch (error) {
378
- console.error(`\nāŒ Profiling failed: ${error.message}`);
379
- console.error('\nTroubleshooting:');
380
- console.error(' - Verify app name and resource group are correct');
381
- console.error(' - Ensure you have proper permissions (Contributor role)');
382
- console.error(' - Check if the App Service is running');
383
- console.error(' - Try: az webapp list --query "[].{name:name, resourceGroup:resourceGroup}"');
384
- process.exit(1);
385
- }
386
- }
387
- // Run the main function
388
- main().catch(console.error);
@@ -1,92 +0,0 @@
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);
@@ -1,85 +0,0 @@
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
- });
@@ -1,54 +0,0 @@
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
- });