@equilateral_ai/mindmeld 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +300 -0
  2. package/hooks/README.md +494 -0
  3. package/hooks/pre-compact.js +392 -0
  4. package/hooks/session-start.js +264 -0
  5. package/package.json +90 -0
  6. package/scripts/harvest.js +561 -0
  7. package/scripts/init-project.js +437 -0
  8. package/scripts/inject.js +388 -0
  9. package/src/collaboration/CollaborationPrompt.js +460 -0
  10. package/src/core/AlertEngine.js +813 -0
  11. package/src/core/AlertNotifier.js +363 -0
  12. package/src/core/CorrelationAnalyzer.js +774 -0
  13. package/src/core/CurationEngine.js +688 -0
  14. package/src/core/LLMPatternDetector.js +508 -0
  15. package/src/core/LoadBearingDetector.js +242 -0
  16. package/src/core/NotificationService.js +1032 -0
  17. package/src/core/PatternValidator.js +355 -0
  18. package/src/core/README.md +160 -0
  19. package/src/core/RapportOrchestrator.js +446 -0
  20. package/src/core/RelevanceDetector.js +577 -0
  21. package/src/core/StandardsIngestion.js +575 -0
  22. package/src/core/TeamLoadBearingDetector.js +431 -0
  23. package/src/database/dbOperations.js +105 -0
  24. package/src/handlers/activity/activityGetMe.js +98 -0
  25. package/src/handlers/activity/activityGetTeam.js +130 -0
  26. package/src/handlers/alerts/alertsAcknowledge.js +91 -0
  27. package/src/handlers/alerts/alertsGet.js +250 -0
  28. package/src/handlers/collaborators/collaboratorAdd.js +201 -0
  29. package/src/handlers/collaborators/collaboratorInvite.js +218 -0
  30. package/src/handlers/collaborators/collaboratorList.js +88 -0
  31. package/src/handlers/collaborators/collaboratorRemove.js +127 -0
  32. package/src/handlers/collaborators/inviteAccept.js +122 -0
  33. package/src/handlers/context/contextGet.js +57 -0
  34. package/src/handlers/context/invariantsGet.js +74 -0
  35. package/src/handlers/context/loopsGet.js +82 -0
  36. package/src/handlers/context/notesCreate.js +74 -0
  37. package/src/handlers/context/purposeGet.js +78 -0
  38. package/src/handlers/correlations/correlationsDeveloperGet.js +226 -0
  39. package/src/handlers/correlations/correlationsGet.js +93 -0
  40. package/src/handlers/correlations/correlationsProjectGet.js +161 -0
  41. package/src/handlers/github/githubConnectionStatus.js +49 -0
  42. package/src/handlers/github/githubDiscoverPatterns.js +364 -0
  43. package/src/handlers/github/githubOAuthCallback.js +166 -0
  44. package/src/handlers/github/githubOAuthStart.js +59 -0
  45. package/src/handlers/github/githubPatternsReview.js +109 -0
  46. package/src/handlers/github/githubReposList.js +105 -0
  47. package/src/handlers/helpers/checkSuperAdmin.js +85 -0
  48. package/src/handlers/helpers/dbOperations.js +53 -0
  49. package/src/handlers/helpers/errorHandler.js +49 -0
  50. package/src/handlers/helpers/index.js +106 -0
  51. package/src/handlers/helpers/lambdaWrapper.js +60 -0
  52. package/src/handlers/helpers/responseUtil.js +55 -0
  53. package/src/handlers/helpers/subscriptionTiers.js +1168 -0
  54. package/src/handlers/notifications/getPreferences.js +84 -0
  55. package/src/handlers/notifications/sendNotification.js +170 -0
  56. package/src/handlers/notifications/updatePreferences.js +316 -0
  57. package/src/handlers/patterns/patternUsagePost.js +182 -0
  58. package/src/handlers/patterns/patternViolationPost.js +185 -0
  59. package/src/handlers/projects/projectCreate.js +107 -0
  60. package/src/handlers/projects/projectDelete.js +82 -0
  61. package/src/handlers/projects/projectGet.js +95 -0
  62. package/src/handlers/projects/projectUpdate.js +118 -0
  63. package/src/handlers/reports/aiLeverage.js +206 -0
  64. package/src/handlers/reports/engineeringInvestment.js +132 -0
  65. package/src/handlers/reports/riskForecast.js +186 -0
  66. package/src/handlers/reports/standardsRoi.js +162 -0
  67. package/src/handlers/scheduled/analyzeCorrelations.js +178 -0
  68. package/src/handlers/scheduled/analyzeGitHistory.js +510 -0
  69. package/src/handlers/scheduled/generateAlerts.js +135 -0
  70. package/src/handlers/scheduled/refreshActivity.js +21 -0
  71. package/src/handlers/scheduled/scanCompliance.js +334 -0
  72. package/src/handlers/sessions/sessionEndPost.js +180 -0
  73. package/src/handlers/sessions/sessionStandardsPost.js +135 -0
  74. package/src/handlers/stripe/addonManagePost.js +240 -0
  75. package/src/handlers/stripe/billingPortalPost.js +93 -0
  76. package/src/handlers/stripe/enterpriseCheckoutPost.js +272 -0
  77. package/src/handlers/stripe/seatsUpdatePost.js +185 -0
  78. package/src/handlers/stripe/subscriptionCancelDelete.js +169 -0
  79. package/src/handlers/stripe/subscriptionCreatePost.js +221 -0
  80. package/src/handlers/stripe/subscriptionUpdatePut.js +163 -0
  81. package/src/handlers/stripe/webhookPost.js +454 -0
  82. package/src/handlers/users/cognitoPostConfirmation.js +150 -0
  83. package/src/handlers/users/userEntitlementsGet.js +89 -0
  84. package/src/handlers/users/userGet.js +114 -0
  85. package/src/handlers/webhooks/githubWebhook.js +223 -0
  86. package/src/index.js +969 -0
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Helpers Index
3
+ * Tim-Combo pattern: Re-export all helpers from single entry point
4
+ *
5
+ * Usage: const { wrapHandler, executeQuery, createSuccessResponse, handleError } = require('./helpers');
6
+ */
7
+
8
+ const { wrapHandler } = require('./lambdaWrapper');
9
+ const { executeQuery } = require('./dbOperations');
10
+ const { createSuccessResponse, createErrorResponse } = require('./responseUtil');
11
+ const { handleError } = require('./errorHandler');
12
+ const {
13
+ getTierConfig,
14
+ SUBSCRIPTION_TIERS,
15
+ getStripePriceId,
16
+ checkEarlyAdopterEligibility,
17
+ getEarlyAdopterDiscount,
18
+ calculateEarlyAdopterPrice,
19
+ requiresCommunityContribution,
20
+ getPrivateTierVariant,
21
+ calculateTierCost,
22
+ checkSubscriptionLimits,
23
+ // Billing type functions
24
+ BILLING_TYPES,
25
+ usesStripeBilling,
26
+ usesInvoiceBilling,
27
+ isInternalClient,
28
+ checkCollaboratorBillingLimits,
29
+ getBillingTypeDisplayName,
30
+ // Enterprise subscription functions
31
+ ENTERPRISE_PACKAGES,
32
+ ENTERPRISE_ADDONS,
33
+ VOLUME_DISCOUNTS,
34
+ getVolumeDiscount,
35
+ validateSeatCount,
36
+ calculateEnterpriseCost,
37
+ getEnterprisePackage,
38
+ getEnterpriseAddon,
39
+ getAllEnterpriseAddons,
40
+ hasEnterpriseFeature,
41
+ getEnterpriseFeatures,
42
+ checkEnterpriseSeatLimits,
43
+ getEnterprisePriceId,
44
+ getAddonPriceId
45
+ } = require('./subscriptionTiers');
46
+ const checkSuperAdmin = require('./checkSuperAdmin');
47
+
48
+ module.exports = {
49
+ // Lambda wrapper
50
+ wrapHandler,
51
+
52
+ // Database operations
53
+ executeQuery,
54
+
55
+ // Response utilities
56
+ createSuccessResponse,
57
+ createErrorResponse,
58
+
59
+ // Error handling
60
+ handleError,
61
+
62
+ // Subscription tiers
63
+ getTierConfig,
64
+ SUBSCRIPTION_TIERS,
65
+ getStripePriceId,
66
+ calculateTierCost,
67
+
68
+ // Early adopter discount
69
+ checkEarlyAdopterEligibility,
70
+ getEarlyAdopterDiscount,
71
+ calculateEarlyAdopterPrice,
72
+
73
+ // Community vs Private tiers
74
+ requiresCommunityContribution,
75
+ getPrivateTierVariant,
76
+
77
+ // Subscription limits
78
+ checkSubscriptionLimits,
79
+
80
+ // Billing type functions
81
+ BILLING_TYPES,
82
+ usesStripeBilling,
83
+ usesInvoiceBilling,
84
+ isInternalClient,
85
+ checkCollaboratorBillingLimits,
86
+ getBillingTypeDisplayName,
87
+
88
+ // Enterprise subscription functions
89
+ ENTERPRISE_PACKAGES,
90
+ ENTERPRISE_ADDONS,
91
+ VOLUME_DISCOUNTS,
92
+ getVolumeDiscount,
93
+ validateSeatCount,
94
+ calculateEnterpriseCost,
95
+ getEnterprisePackage,
96
+ getEnterpriseAddon,
97
+ getAllEnterpriseAddons,
98
+ hasEnterpriseFeature,
99
+ getEnterpriseFeatures,
100
+ checkEnterpriseSeatLimits,
101
+ getEnterprisePriceId,
102
+ getAddonPriceId,
103
+
104
+ // Authorization
105
+ checkSuperAdmin
106
+ };
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Lambda Wrapper Helper
3
+ * Standardizes request/response handling for all Rapport handlers
4
+ */
5
+
6
+ function wrapHandler(handler) {
7
+ return async (event, context) => {
8
+ try {
9
+ // Parse body if present
10
+ let body = {};
11
+ if (event.body) {
12
+ try {
13
+ body = JSON.parse(event.body);
14
+ } catch (e) {
15
+ console.error('Failed to parse body:', e);
16
+ return {
17
+ statusCode: 400,
18
+ headers: {
19
+ 'Content-Type': 'application/json',
20
+ 'Access-Control-Allow-Origin': '*'
21
+ },
22
+ body: JSON.stringify({
23
+ success: false,
24
+ message: 'Invalid JSON in request body'
25
+ })
26
+ };
27
+ }
28
+ }
29
+
30
+ // Call handler with standardized parameters
31
+ const result = await handler({
32
+ queryStringParameters: event.queryStringParameters || {},
33
+ pathParameters: event.pathParameters || {},
34
+ body: body,
35
+ requestContext: event.requestContext,
36
+ headers: event.headers || {},
37
+ httpMethod: event.httpMethod
38
+ });
39
+
40
+ return result;
41
+
42
+ } catch (error) {
43
+ console.error('Wrapper Error:', error);
44
+ return {
45
+ statusCode: 500,
46
+ headers: {
47
+ 'Content-Type': 'application/json',
48
+ 'Access-Control-Allow-Origin': '*'
49
+ },
50
+ body: JSON.stringify({
51
+ success: false,
52
+ message: 'Internal server error',
53
+ error: process.env.NODE_ENV === 'dev' ? error.message : undefined
54
+ })
55
+ };
56
+ }
57
+ };
58
+ }
59
+
60
+ module.exports = { wrapHandler };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Response Utility Helper
3
+ * Standard response formatting for all Rapport handlers
4
+ */
5
+
6
+ /**
7
+ * Create success response
8
+ * @param {object} data - Response data (should include Records array)
9
+ * @param {string} message - Success message
10
+ * @param {object} meta - Metadata (Total_Records, Request_ID, etc.)
11
+ * @returns {object} Lambda response
12
+ */
13
+ function createSuccessResponse(data, message, meta = {}) {
14
+ return {
15
+ statusCode: 200,
16
+ headers: {
17
+ 'Content-Type': 'application/json',
18
+ 'Access-Control-Allow-Origin': '*',
19
+ 'Access-Control-Allow-Methods': 'GET,POST,PUT,DELETE,OPTIONS',
20
+ 'Access-Control-Allow-Headers': 'Content-Type,Authorization'
21
+ },
22
+ body: JSON.stringify({
23
+ success: true,
24
+ message,
25
+ data,
26
+ meta
27
+ })
28
+ };
29
+ }
30
+
31
+ /**
32
+ * Create error response
33
+ * @param {number} statusCode - HTTP status code
34
+ * @param {string} message - Error message
35
+ * @param {object} details - Additional error details
36
+ * @returns {object} Lambda response
37
+ */
38
+ function createErrorResponse(statusCode, message, details = {}) {
39
+ return {
40
+ statusCode,
41
+ headers: {
42
+ 'Content-Type': 'application/json',
43
+ 'Access-Control-Allow-Origin': '*',
44
+ 'Access-Control-Allow-Methods': 'GET,POST,PUT,DELETE,OPTIONS',
45
+ 'Access-Control-Allow-Headers': 'Content-Type,Authorization'
46
+ },
47
+ body: JSON.stringify({
48
+ success: false,
49
+ message,
50
+ details
51
+ })
52
+ };
53
+ }
54
+
55
+ module.exports = { createSuccessResponse, createErrorResponse };