@girardmedia/bootspring 2.0.21 → 2.0.23
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/bin/bootspring.js +5 -0
- package/cli/org.js +474 -0
- package/cli/preseed/index.js +16 -0
- package/cli/preseed/interactive.js +143 -0
- package/cli/preseed/templates.js +227 -0
- package/cli/preseed.js +9 -301
- package/cli/seed/builders/ai-context-builder.js +85 -0
- package/cli/seed/builders/index.js +13 -0
- package/cli/seed/builders/seed-builder.js +272 -0
- package/cli/seed/extractors/content-extractors.js +383 -0
- package/cli/seed/extractors/index.js +47 -0
- package/cli/seed/extractors/metadata-extractors.js +167 -0
- package/cli/seed/extractors/section-extractor.js +54 -0
- package/cli/seed/extractors/stack-extractors.js +228 -0
- package/cli/seed/index.js +18 -0
- package/cli/seed/utils/folder-structure.js +84 -0
- package/cli/seed/utils/index.js +11 -0
- package/cli/seed.js +23 -1074
- package/core/api-client.js +77 -0
- package/core/entitlements.js +36 -0
- package/core/organizations.js +223 -0
- package/core/policies.js +51 -6
- package/core/policy-matrix.js +303 -0
- package/core/project-context.js +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +3220 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/context-McpJQa_2.d.ts +5710 -0
- package/dist/core/index.d.ts +635 -0
- package/dist/core/index.js +2593 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index-QqbeEiDm.d.ts +857 -0
- package/dist/index-UiYCgwiH.d.ts +174 -0
- package/dist/index.d.ts +453 -0
- package/dist/index.js +44228 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.js +41173 -0
- package/dist/mcp/index.js.map +1 -0
- package/generators/index.ts +82 -0
- package/intelligence/orchestrator/config/failure-signatures.js +48 -0
- package/intelligence/orchestrator/config/index.js +23 -0
- package/intelligence/orchestrator/config/pack-lifecycle.js +262 -0
- package/intelligence/orchestrator/config/phases.js +111 -0
- package/intelligence/orchestrator/config/remediation.js +150 -0
- package/intelligence/orchestrator/config/workflows.js +168 -0
- package/intelligence/orchestrator/core/index.js +16 -0
- package/intelligence/orchestrator/core/state-manager.js +88 -0
- package/intelligence/orchestrator/core/telemetry.js +24 -0
- package/intelligence/orchestrator/index.js +17 -0
- package/intelligence/orchestrator.js +17 -512
- package/mcp/contracts/mcp-contract.v1.json +1 -1
- package/package.json +16 -3
- package/src/cli/agent.ts +703 -0
- package/src/cli/analyze.ts +640 -0
- package/src/cli/audit.ts +707 -0
- package/src/cli/auth.ts +930 -0
- package/src/cli/billing.ts +364 -0
- package/src/cli/build.ts +1089 -0
- package/src/cli/business.ts +508 -0
- package/src/cli/checkpoint-utils.ts +236 -0
- package/src/cli/checkpoint.ts +757 -0
- package/src/cli/cloud-sync.ts +534 -0
- package/src/cli/content.ts +273 -0
- package/src/cli/context.ts +667 -0
- package/src/cli/dashboard.ts +133 -0
- package/src/cli/deploy.ts +704 -0
- package/src/cli/doctor.ts +480 -0
- package/src/cli/fundraise.ts +494 -0
- package/src/cli/generate.ts +346 -0
- package/src/cli/github-cmd.ts +566 -0
- package/src/cli/health.ts +599 -0
- package/src/cli/index.ts +113 -0
- package/src/cli/init.ts +838 -0
- package/src/cli/legal.ts +495 -0
- package/src/cli/log.ts +316 -0
- package/src/cli/loop.ts +1660 -0
- package/src/cli/manager.ts +878 -0
- package/src/cli/mcp.ts +275 -0
- package/src/cli/memory.ts +346 -0
- package/src/cli/metrics.ts +590 -0
- package/src/cli/monitor.ts +960 -0
- package/src/cli/mvp.ts +662 -0
- package/src/cli/onboard.ts +663 -0
- package/src/cli/orchestrator.ts +622 -0
- package/src/cli/plugin.ts +483 -0
- package/src/cli/prd.ts +671 -0
- package/src/cli/preseed-start.ts +1633 -0
- package/src/cli/preseed.ts +2434 -0
- package/src/cli/project.ts +526 -0
- package/src/cli/quality.ts +885 -0
- package/src/cli/security.ts +1079 -0
- package/src/cli/seed.ts +1224 -0
- package/src/cli/skill.ts +537 -0
- package/src/cli/suggest.ts +1225 -0
- package/src/cli/switch.ts +518 -0
- package/src/cli/task.ts +780 -0
- package/src/cli/telemetry.ts +172 -0
- package/src/cli/todo.ts +627 -0
- package/src/cli/types.ts +15 -0
- package/src/cli/update.ts +334 -0
- package/src/cli/visualize.ts +609 -0
- package/src/cli/watch.ts +895 -0
- package/src/cli/workspace.ts +709 -0
- package/src/core/action-recorder.ts +673 -0
- package/src/core/analyze-workflow.ts +1453 -0
- package/src/core/api-client.ts +1120 -0
- package/src/core/audit-workflow.ts +1681 -0
- package/src/core/auth.ts +471 -0
- package/src/core/build-orchestrator.ts +509 -0
- package/src/core/build-state.ts +621 -0
- package/src/core/checkpoint-engine.ts +482 -0
- package/src/core/config.ts +1285 -0
- package/src/core/context-loader.ts +694 -0
- package/src/core/context.ts +410 -0
- package/src/core/deploy-workflow.ts +1085 -0
- package/src/core/entitlements.ts +322 -0
- package/src/core/github-sync.ts +720 -0
- package/src/core/index.ts +981 -0
- package/src/core/ingest.ts +1186 -0
- package/src/core/metrics-engine.ts +886 -0
- package/src/core/mvp.ts +847 -0
- package/src/core/onboard-workflow.ts +1293 -0
- package/src/core/policies.ts +81 -0
- package/src/core/preseed-workflow.ts +1163 -0
- package/src/core/preseed.ts +1826 -0
- package/src/core/project-context.ts +380 -0
- package/src/core/project-state.ts +699 -0
- package/src/core/r2-sync.ts +691 -0
- package/src/core/scaffold.ts +1715 -0
- package/src/core/session.ts +286 -0
- package/src/core/task-extractor.ts +799 -0
- package/src/core/telemetry.ts +371 -0
- package/src/core/tier-enforcement.ts +737 -0
- package/src/core/utils.ts +437 -0
- package/src/index.ts +29 -0
- package/src/intelligence/agent-collab.ts +2376 -0
- package/src/intelligence/auto-suggest.ts +713 -0
- package/src/intelligence/content-gen.ts +1351 -0
- package/src/intelligence/cross-project.ts +1692 -0
- package/src/intelligence/git-memory.ts +529 -0
- package/src/intelligence/index.ts +318 -0
- package/src/intelligence/orchestrator.ts +534 -0
- package/src/intelligence/prd.ts +466 -0
- package/src/intelligence/recommendations.ts +982 -0
- package/src/intelligence/workflow-composer.ts +1472 -0
- package/src/mcp/capabilities.ts +233 -0
- package/src/mcp/index.ts +37 -0
- package/src/mcp/registry.ts +1268 -0
- package/src/mcp/response-formatter.ts +797 -0
- package/src/mcp/server.ts +240 -0
- package/src/types/agent.ts +69 -0
- package/src/types/config.ts +86 -0
- package/src/types/context.ts +77 -0
- package/src/types/index.ts +53 -0
- package/src/types/mcp.ts +91 -0
- package/src/types/skills.ts +47 -0
- package/src/types/workflow.ts +155 -0
- package/generators/index.js +0 -18
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bootspring Generators Module
|
|
3
|
+
*
|
|
4
|
+
* Provides context generation, scaffolding, and project setup.
|
|
5
|
+
*
|
|
6
|
+
* @package bootspring
|
|
7
|
+
* @module generators
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Types
|
|
12
|
+
// ============================================================================
|
|
13
|
+
|
|
14
|
+
export interface GenerateOptions {
|
|
15
|
+
cwd?: string | undefined;
|
|
16
|
+
force?: boolean | undefined;
|
|
17
|
+
verbose?: boolean | undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface GenerateResult {
|
|
21
|
+
success: boolean;
|
|
22
|
+
files: string[];
|
|
23
|
+
errors?: string[] | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface MvpAnalysis {
|
|
27
|
+
sections: Record<string, string>;
|
|
28
|
+
features: string[];
|
|
29
|
+
entities: string[];
|
|
30
|
+
routes: string[];
|
|
31
|
+
components: string[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface ParsedConfig {
|
|
35
|
+
project?: {
|
|
36
|
+
name?: string | undefined;
|
|
37
|
+
description?: string | undefined;
|
|
38
|
+
version?: string | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
stack?: {
|
|
41
|
+
framework?: string | undefined;
|
|
42
|
+
language?: string | undefined;
|
|
43
|
+
database?: string | undefined;
|
|
44
|
+
} | undefined;
|
|
45
|
+
plugins?: Record<string, unknown> | undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ParsedSeed {
|
|
49
|
+
name?: string | undefined;
|
|
50
|
+
tagline?: string | undefined;
|
|
51
|
+
problem?: string | undefined;
|
|
52
|
+
solution?: string | undefined;
|
|
53
|
+
features?: string[] | undefined;
|
|
54
|
+
userTypes?: string[] | undefined;
|
|
55
|
+
stack?: Record<string, string> | undefined;
|
|
56
|
+
phases?: Array<{
|
|
57
|
+
name: string;
|
|
58
|
+
tasks: string[];
|
|
59
|
+
}> | undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ============================================================================
|
|
63
|
+
// Module Import
|
|
64
|
+
// ============================================================================
|
|
65
|
+
|
|
66
|
+
const generator = require('./generate') as {
|
|
67
|
+
generate: (options?: GenerateOptions) => GenerateResult;
|
|
68
|
+
generateClaudeMd: (options?: GenerateOptions) => string;
|
|
69
|
+
analyzeMvpSource: (content: string) => MvpAnalysis;
|
|
70
|
+
parseConfig: (configPath: string) => ParsedConfig | null;
|
|
71
|
+
parseSeedMd: (content: string) => ParsedSeed;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// ============================================================================
|
|
75
|
+
// Exports
|
|
76
|
+
// ============================================================================
|
|
77
|
+
|
|
78
|
+
export const generate = generator.generate;
|
|
79
|
+
export const generateClaudeMd = generator.generateClaudeMd;
|
|
80
|
+
export const analyzeMvpSource = generator.analyzeMvpSource;
|
|
81
|
+
export const parseConfig = generator.parseConfig;
|
|
82
|
+
export const parseSeedMd = generator.parseSeedMd;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Failure Signatures Configuration
|
|
3
|
+
* Failure pattern signatures and severity weights
|
|
4
|
+
* @package bootspring
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Failure pattern signatures for auto-detection
|
|
9
|
+
* Maps keywords to failure types for intelligent failure classification
|
|
10
|
+
*/
|
|
11
|
+
const FAILURE_SIGNATURES = {
|
|
12
|
+
'testing': ['test', 'spec', 'jest', 'vitest', 'assertion', 'expect', 'failing', 'failed test'],
|
|
13
|
+
'security': ['vulnerability', 'auth', 'permission', 'unauthorized', 'csrf', 'xss', 'injection', 'security'],
|
|
14
|
+
'performance': ['slow', 'timeout', 'memory', 'cpu', 'latency', 'bottleneck', 'performance'],
|
|
15
|
+
'deployment': ['deploy', 'release', 'ci/cd', 'pipeline', 'staging', 'production', 'build failed'],
|
|
16
|
+
'database': ['migration', 'schema', 'query', 'prisma', 'sql', 'database', 'connection', 'deadlock'],
|
|
17
|
+
'build': ['build', 'compile', 'bundle', 'webpack', 'typescript', 'syntax error', 'module not found'],
|
|
18
|
+
'integration': ['api', 'endpoint', 'external', 'service', 'http', 'request failed', '500', '503'],
|
|
19
|
+
'timeout': ['timeout', 'deadline', 'exceeded', 'timed out', 'ETIMEDOUT']
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Severity weights for adaptive response calculation
|
|
24
|
+
*/
|
|
25
|
+
const SEVERITY_WEIGHTS = {
|
|
26
|
+
'critical': 4,
|
|
27
|
+
'high': 3,
|
|
28
|
+
'medium': 2,
|
|
29
|
+
'low': 1
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Failure strategy options for parallel execution
|
|
34
|
+
* - 'fail-fast': Stop all phases on first failure (default)
|
|
35
|
+
* - 'continue': Continue other phases, collect failures at end
|
|
36
|
+
* - 'retry': Allow retry of failed phases while others continue
|
|
37
|
+
*/
|
|
38
|
+
const PARALLEL_FAILURE_STRATEGIES = {
|
|
39
|
+
'fail-fast': 'Stop all phases when one fails',
|
|
40
|
+
'continue': 'Continue other phases, handle failures at completion',
|
|
41
|
+
'retry': 'Allow retry of failed phases'
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
module.exports = {
|
|
45
|
+
FAILURE_SIGNATURES,
|
|
46
|
+
SEVERITY_WEIGHTS,
|
|
47
|
+
PARALLEL_FAILURE_STRATEGIES
|
|
48
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator Configuration Index
|
|
3
|
+
* Re-exports all configuration constants
|
|
4
|
+
* @package bootspring
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { PHASE_AGENTS, TECHNICAL_TRIGGERS } = require('./phases');
|
|
8
|
+
const { WORKFLOWS } = require('./workflows');
|
|
9
|
+
const { REMEDIATION_PATHS } = require('./remediation');
|
|
10
|
+
const { FAILURE_SIGNATURES, SEVERITY_WEIGHTS, PARALLEL_FAILURE_STRATEGIES } = require('./failure-signatures');
|
|
11
|
+
const packLifecycle = require('./pack-lifecycle');
|
|
12
|
+
|
|
13
|
+
module.exports = {
|
|
14
|
+
PHASE_AGENTS,
|
|
15
|
+
TECHNICAL_TRIGGERS,
|
|
16
|
+
WORKFLOWS,
|
|
17
|
+
REMEDIATION_PATHS,
|
|
18
|
+
FAILURE_SIGNATURES,
|
|
19
|
+
SEVERITY_WEIGHTS,
|
|
20
|
+
PARALLEL_FAILURE_STRATEGIES,
|
|
21
|
+
// Pack lifecycle exports
|
|
22
|
+
...packLifecycle
|
|
23
|
+
};
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pack Lifecycle Configuration
|
|
3
|
+
* Manages premium pack rollout stages: draft -> QA -> canary -> GA
|
|
4
|
+
* @package bootspring
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Lifecycle stages
|
|
9
|
+
*/
|
|
10
|
+
const LIFECYCLE_STAGES = {
|
|
11
|
+
DRAFT: 'draft', // Internal development, not visible to users
|
|
12
|
+
QA: 'qa', // Internal testing, visible to team accounts
|
|
13
|
+
CANARY: 'canary', // Limited rollout (25% of eligible users)
|
|
14
|
+
GA: 'ga' // General availability (100% rollout)
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Stage order for progression
|
|
19
|
+
*/
|
|
20
|
+
const STAGE_ORDER = ['draft', 'qa', 'canary', 'ga'];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Default rollout percentages per stage
|
|
24
|
+
*/
|
|
25
|
+
const DEFAULT_ROLLOUT = {
|
|
26
|
+
draft: 0, // Not available to users
|
|
27
|
+
qa: 5, // 5% of team/enterprise users for internal QA
|
|
28
|
+
canary: 25, // 25% of eligible users
|
|
29
|
+
ga: 100 // All eligible users
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Pack lifecycle definitions
|
|
34
|
+
* Tracks current stage and rollout status for each premium pack
|
|
35
|
+
*/
|
|
36
|
+
const PACK_LIFECYCLE = {
|
|
37
|
+
'launch-pack': {
|
|
38
|
+
name: 'Launch Pack',
|
|
39
|
+
description: 'Premium guided launch workflow from freeze to production validation',
|
|
40
|
+
currentStage: 'ga',
|
|
41
|
+
stageHistory: [
|
|
42
|
+
{ stage: 'draft', date: '2026-01-15', approved_by: 'system' },
|
|
43
|
+
{ stage: 'qa', date: '2026-01-22', approved_by: 'system' },
|
|
44
|
+
{ stage: 'canary', date: '2026-02-01', approved_by: 'system' },
|
|
45
|
+
{ stage: 'ga', date: '2026-02-15', approved_by: 'system' }
|
|
46
|
+
],
|
|
47
|
+
rolloutPercentage: 100,
|
|
48
|
+
qualityGates: {
|
|
49
|
+
errorRateThreshold: 0.01, // Max 1% error rate to advance
|
|
50
|
+
minUsageCount: 10, // Min 10 uses in current stage
|
|
51
|
+
minSuccessRate: 0.95 // 95% completion rate
|
|
52
|
+
},
|
|
53
|
+
featureFlags: {}
|
|
54
|
+
},
|
|
55
|
+
'reliability-pack': {
|
|
56
|
+
name: 'Reliability Pack',
|
|
57
|
+
description: 'Premium reliability hardening workflow for incidents and regressions',
|
|
58
|
+
currentStage: 'ga',
|
|
59
|
+
stageHistory: [
|
|
60
|
+
{ stage: 'draft', date: '2026-01-15', approved_by: 'system' },
|
|
61
|
+
{ stage: 'qa', date: '2026-01-22', approved_by: 'system' },
|
|
62
|
+
{ stage: 'canary', date: '2026-02-01', approved_by: 'system' },
|
|
63
|
+
{ stage: 'ga', date: '2026-02-15', approved_by: 'system' }
|
|
64
|
+
],
|
|
65
|
+
rolloutPercentage: 100,
|
|
66
|
+
qualityGates: {
|
|
67
|
+
errorRateThreshold: 0.01,
|
|
68
|
+
minUsageCount: 10,
|
|
69
|
+
minSuccessRate: 0.95
|
|
70
|
+
},
|
|
71
|
+
featureFlags: {}
|
|
72
|
+
},
|
|
73
|
+
'growth-pack': {
|
|
74
|
+
name: 'Growth Pack',
|
|
75
|
+
description: 'Premium experimentation workflow for activation and conversion improvements',
|
|
76
|
+
currentStage: 'ga',
|
|
77
|
+
stageHistory: [
|
|
78
|
+
{ stage: 'draft', date: '2026-01-15', approved_by: 'system' },
|
|
79
|
+
{ stage: 'qa', date: '2026-01-22', approved_by: 'system' },
|
|
80
|
+
{ stage: 'canary', date: '2026-02-01', approved_by: 'system' },
|
|
81
|
+
{ stage: 'ga', date: '2026-02-15', approved_by: 'system' }
|
|
82
|
+
],
|
|
83
|
+
rolloutPercentage: 100,
|
|
84
|
+
qualityGates: {
|
|
85
|
+
errorRateThreshold: 0.01,
|
|
86
|
+
minUsageCount: 10,
|
|
87
|
+
minSuccessRate: 0.95
|
|
88
|
+
},
|
|
89
|
+
featureFlags: {}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get pack lifecycle info
|
|
95
|
+
* @param {string} packName - Pack name (e.g., 'launch-pack')
|
|
96
|
+
* @returns {object|null} Pack lifecycle info
|
|
97
|
+
*/
|
|
98
|
+
function getPackLifecycle(packName) {
|
|
99
|
+
return PACK_LIFECYCLE[packName] || null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Get current stage for a pack
|
|
104
|
+
* @param {string} packName - Pack name
|
|
105
|
+
* @returns {string} Current stage
|
|
106
|
+
*/
|
|
107
|
+
function getPackStage(packName) {
|
|
108
|
+
const lifecycle = getPackLifecycle(packName);
|
|
109
|
+
return lifecycle?.currentStage || 'draft';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Check if pack is visible to user based on stage and rollout
|
|
114
|
+
* @param {string} packName - Pack name
|
|
115
|
+
* @param {object} options - Options including tier, userId
|
|
116
|
+
* @returns {boolean} Whether pack is visible
|
|
117
|
+
*/
|
|
118
|
+
function isPackVisibleToUser(packName, options = {}) {
|
|
119
|
+
const lifecycle = getPackLifecycle(packName);
|
|
120
|
+
if (!lifecycle) return false;
|
|
121
|
+
|
|
122
|
+
const stage = lifecycle.currentStage;
|
|
123
|
+
const rollout = lifecycle.rolloutPercentage;
|
|
124
|
+
|
|
125
|
+
// Draft: never visible
|
|
126
|
+
if (stage === 'draft') return false;
|
|
127
|
+
|
|
128
|
+
// QA: only visible to team/enterprise
|
|
129
|
+
if (stage === 'qa') {
|
|
130
|
+
const tier = options.tier || 'free';
|
|
131
|
+
return ['team', 'enterprise'].includes(tier);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Canary/GA: check rollout percentage
|
|
135
|
+
if (rollout === 100) return true;
|
|
136
|
+
if (rollout === 0) return false;
|
|
137
|
+
|
|
138
|
+
// Hash user ID to determine if in rollout
|
|
139
|
+
const userId = options.userId || options.deviceId || 'anonymous';
|
|
140
|
+
const hash = simpleHash(userId + packName);
|
|
141
|
+
const bucket = hash % 100;
|
|
142
|
+
|
|
143
|
+
return bucket < rollout;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Simple hash function for rollout bucketing
|
|
148
|
+
* @param {string} str - String to hash
|
|
149
|
+
* @returns {number} Hash value 0-999999
|
|
150
|
+
*/
|
|
151
|
+
function simpleHash(str) {
|
|
152
|
+
let hash = 0;
|
|
153
|
+
for (let i = 0; i < str.length; i++) {
|
|
154
|
+
const char = str.charCodeAt(i);
|
|
155
|
+
hash = ((hash << 5) - hash) + char;
|
|
156
|
+
hash = hash & hash; // Convert to 32-bit integer
|
|
157
|
+
}
|
|
158
|
+
return Math.abs(hash);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Check if stage can be advanced based on quality gates
|
|
163
|
+
* @param {string} packName - Pack name
|
|
164
|
+
* @param {object} metrics - Current metrics { errorRate, usageCount, successRate }
|
|
165
|
+
* @returns {object} { canAdvance, reasons }
|
|
166
|
+
*/
|
|
167
|
+
function checkQualityGates(packName, metrics = {}) {
|
|
168
|
+
const lifecycle = getPackLifecycle(packName);
|
|
169
|
+
if (!lifecycle) {
|
|
170
|
+
return { canAdvance: false, reasons: ['Pack not found'] };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const gates = lifecycle.qualityGates;
|
|
174
|
+
const reasons = [];
|
|
175
|
+
|
|
176
|
+
// Check error rate
|
|
177
|
+
if (metrics.errorRate !== undefined && metrics.errorRate > gates.errorRateThreshold) {
|
|
178
|
+
reasons.push(`Error rate ${(metrics.errorRate * 100).toFixed(2)}% exceeds threshold ${(gates.errorRateThreshold * 100).toFixed(2)}%`);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Check usage count
|
|
182
|
+
if (metrics.usageCount !== undefined && metrics.usageCount < gates.minUsageCount) {
|
|
183
|
+
reasons.push(`Usage count ${metrics.usageCount} below minimum ${gates.minUsageCount}`);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Check success rate
|
|
187
|
+
if (metrics.successRate !== undefined && metrics.successRate < gates.minSuccessRate) {
|
|
188
|
+
reasons.push(`Success rate ${(metrics.successRate * 100).toFixed(2)}% below threshold ${(gates.minSuccessRate * 100).toFixed(2)}%`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return {
|
|
192
|
+
canAdvance: reasons.length === 0,
|
|
193
|
+
reasons
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Get next stage in lifecycle
|
|
199
|
+
* @param {string} currentStage - Current stage
|
|
200
|
+
* @returns {string|null} Next stage or null if at GA
|
|
201
|
+
*/
|
|
202
|
+
function getNextStage(currentStage) {
|
|
203
|
+
const index = STAGE_ORDER.indexOf(currentStage);
|
|
204
|
+
if (index === -1 || index === STAGE_ORDER.length - 1) return null;
|
|
205
|
+
return STAGE_ORDER[index + 1];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Get previous stage in lifecycle
|
|
210
|
+
* @param {string} currentStage - Current stage
|
|
211
|
+
* @returns {string|null} Previous stage or null if at draft
|
|
212
|
+
*/
|
|
213
|
+
function getPreviousStage(currentStage) {
|
|
214
|
+
const index = STAGE_ORDER.indexOf(currentStage);
|
|
215
|
+
if (index <= 0) return null;
|
|
216
|
+
return STAGE_ORDER[index - 1];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* List all pack lifecycle statuses
|
|
221
|
+
* @returns {Array} Pack status list
|
|
222
|
+
*/
|
|
223
|
+
function listPackStatuses() {
|
|
224
|
+
return Object.entries(PACK_LIFECYCLE).map(([key, pack]) => ({
|
|
225
|
+
key,
|
|
226
|
+
name: pack.name,
|
|
227
|
+
description: pack.description,
|
|
228
|
+
currentStage: pack.currentStage,
|
|
229
|
+
rolloutPercentage: pack.rolloutPercentage,
|
|
230
|
+
lastUpdate: pack.stageHistory[pack.stageHistory.length - 1]?.date
|
|
231
|
+
}));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Get stage badge for display
|
|
236
|
+
* @param {string} stage - Stage name
|
|
237
|
+
* @returns {string} Badge string
|
|
238
|
+
*/
|
|
239
|
+
function getStageBadge(stage) {
|
|
240
|
+
const badges = {
|
|
241
|
+
draft: '[draft]',
|
|
242
|
+
qa: '[QA]',
|
|
243
|
+
canary: '[canary]',
|
|
244
|
+
ga: '[GA]'
|
|
245
|
+
};
|
|
246
|
+
return badges[stage] || `[${stage}]`;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
module.exports = {
|
|
250
|
+
LIFECYCLE_STAGES,
|
|
251
|
+
STAGE_ORDER,
|
|
252
|
+
DEFAULT_ROLLOUT,
|
|
253
|
+
PACK_LIFECYCLE,
|
|
254
|
+
getPackLifecycle,
|
|
255
|
+
getPackStage,
|
|
256
|
+
isPackVisibleToUser,
|
|
257
|
+
checkQualityGates,
|
|
258
|
+
getNextStage,
|
|
259
|
+
getPreviousStage,
|
|
260
|
+
listPackStatuses,
|
|
261
|
+
getStageBadge
|
|
262
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase Agents Configuration
|
|
3
|
+
* Maps project phases to recommended agents
|
|
4
|
+
* @package bootspring
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Agent lifecycle phase mapping
|
|
9
|
+
* Maps project phases to recommended agents
|
|
10
|
+
*/
|
|
11
|
+
const PHASE_AGENTS = {
|
|
12
|
+
1: {
|
|
13
|
+
name: 'Foundation',
|
|
14
|
+
description: 'Initial setup, planning, and architecture decisions',
|
|
15
|
+
primary: ['architecture-expert', 'database-expert'],
|
|
16
|
+
supporting: ['security-expert', 'devops-expert']
|
|
17
|
+
},
|
|
18
|
+
2: {
|
|
19
|
+
name: 'Requirements',
|
|
20
|
+
description: 'Data modeling, research, and specification',
|
|
21
|
+
primary: ['database-expert', 'api-expert'],
|
|
22
|
+
supporting: ['testing-expert']
|
|
23
|
+
},
|
|
24
|
+
3: {
|
|
25
|
+
name: 'Design',
|
|
26
|
+
description: 'UI/UX, database schema, API contracts',
|
|
27
|
+
primary: ['frontend-expert', 'ui-ux-expert', 'database-expert', 'api-expert'],
|
|
28
|
+
supporting: ['security-expert']
|
|
29
|
+
},
|
|
30
|
+
4: {
|
|
31
|
+
name: 'Implementation',
|
|
32
|
+
description: 'Core feature development',
|
|
33
|
+
primary: ['backend-expert', 'frontend-expert', 'database-expert'],
|
|
34
|
+
supporting: ['performance-expert', 'code-review-expert']
|
|
35
|
+
},
|
|
36
|
+
5: {
|
|
37
|
+
name: 'Testing',
|
|
38
|
+
description: 'Quality assurance and security review',
|
|
39
|
+
primary: ['testing-expert', 'security-expert', 'code-review-expert'],
|
|
40
|
+
supporting: ['performance-expert']
|
|
41
|
+
},
|
|
42
|
+
6: {
|
|
43
|
+
name: 'Deployment',
|
|
44
|
+
description: 'CI/CD, infrastructure, and monitoring',
|
|
45
|
+
primary: ['devops-expert', 'vercel-expert'],
|
|
46
|
+
supporting: ['security-expert', 'performance-expert']
|
|
47
|
+
},
|
|
48
|
+
7: {
|
|
49
|
+
name: 'Launch',
|
|
50
|
+
description: 'Go-live and post-launch optimization',
|
|
51
|
+
primary: ['devops-expert', 'performance-expert'],
|
|
52
|
+
supporting: ['security-expert']
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Technical context triggers
|
|
58
|
+
* Maps keywords to recommended agents
|
|
59
|
+
*/
|
|
60
|
+
const TECHNICAL_TRIGGERS = {
|
|
61
|
+
'api': {
|
|
62
|
+
agents: ['api-expert', 'backend-expert', 'security-expert'],
|
|
63
|
+
indicators: ['api', 'endpoint', 'REST', 'GraphQL', 'route', 'handler'],
|
|
64
|
+
skills: ['api/route-handler', 'api/server-action']
|
|
65
|
+
},
|
|
66
|
+
'database': {
|
|
67
|
+
agents: ['database-expert', 'backend-expert'],
|
|
68
|
+
indicators: ['database', 'schema', 'prisma', 'migration', 'query', 'model', 'sql'],
|
|
69
|
+
skills: ['database/prisma']
|
|
70
|
+
},
|
|
71
|
+
'frontend': {
|
|
72
|
+
agents: ['frontend-expert', 'ui-ux-expert'],
|
|
73
|
+
indicators: ['component', 'react', 'tailwind', 'ui', 'ux', 'page', 'layout', 'css'],
|
|
74
|
+
skills: []
|
|
75
|
+
},
|
|
76
|
+
'authentication': {
|
|
77
|
+
agents: ['security-expert', 'backend-expert'],
|
|
78
|
+
indicators: ['auth', 'login', 'signup', 'session', 'clerk', 'jwt', 'oauth', 'password'],
|
|
79
|
+
skills: ['auth/clerk', 'auth/nextauth']
|
|
80
|
+
},
|
|
81
|
+
'security': {
|
|
82
|
+
agents: ['security-expert'],
|
|
83
|
+
indicators: ['security', 'vulnerability', 'OWASP', 'xss', 'csrf', 'injection', 'sanitize'],
|
|
84
|
+
skills: []
|
|
85
|
+
},
|
|
86
|
+
'performance': {
|
|
87
|
+
agents: ['performance-expert', 'database-expert'],
|
|
88
|
+
indicators: ['performance', 'speed', 'optimization', 'cache', 'slow', 'memory', 'bundle'],
|
|
89
|
+
skills: []
|
|
90
|
+
},
|
|
91
|
+
'deployment': {
|
|
92
|
+
agents: ['devops-expert', 'vercel-expert'],
|
|
93
|
+
indicators: ['deploy', 'CI/CD', 'docker', 'kubernetes', 'production', 'vercel', 'hosting'],
|
|
94
|
+
skills: []
|
|
95
|
+
},
|
|
96
|
+
'testing': {
|
|
97
|
+
agents: ['testing-expert', 'code-review-expert'],
|
|
98
|
+
indicators: ['test', 'jest', 'vitest', 'playwright', 'coverage', 'spec', 'mock'],
|
|
99
|
+
skills: ['testing/vitest']
|
|
100
|
+
},
|
|
101
|
+
'payments': {
|
|
102
|
+
agents: ['backend-expert', 'security-expert'],
|
|
103
|
+
indicators: ['stripe', 'payment', 'subscription', 'checkout', 'billing', 'invoice'],
|
|
104
|
+
skills: ['payments/stripe']
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
module.exports = {
|
|
109
|
+
PHASE_AGENTS,
|
|
110
|
+
TECHNICAL_TRIGGERS
|
|
111
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remediation Configuration
|
|
3
|
+
* Remediation workflows for common failure scenarios
|
|
4
|
+
* @package bootspring
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Remediation workflows for common failure scenarios
|
|
9
|
+
* Enhanced with severity levels, auto-trigger options, fallback phases, and preventive actions
|
|
10
|
+
*/
|
|
11
|
+
const REMEDIATION_PATHS = {
|
|
12
|
+
'testing-failure': {
|
|
13
|
+
description: 'Tests failed during workflow',
|
|
14
|
+
severity: 'high',
|
|
15
|
+
autoTrigger: true,
|
|
16
|
+
maxRetries: 3,
|
|
17
|
+
steps: [
|
|
18
|
+
{ action: 'analyze_failures', agent: 'testing-expert', description: 'Analyze test failures', timeout: 300 },
|
|
19
|
+
{ action: 'fix_issues', agent: 'code-review-expert', description: 'Review and fix failing code', timeout: 600 },
|
|
20
|
+
{ action: 'rerun_tests', agent: 'testing-expert', description: 'Re-run tests', timeout: 300 }
|
|
21
|
+
],
|
|
22
|
+
preventiveActions: [
|
|
23
|
+
'Run tests locally before committing',
|
|
24
|
+
'Check for flaky tests in CI history',
|
|
25
|
+
'Verify test environment configuration'
|
|
26
|
+
],
|
|
27
|
+
fallbackPhase: { name: 'Manual Review', agents: ['code-review-expert'], duration: '1-2 days' }
|
|
28
|
+
},
|
|
29
|
+
'security-failure': {
|
|
30
|
+
description: 'Security issues found during workflow',
|
|
31
|
+
severity: 'critical',
|
|
32
|
+
autoTrigger: true,
|
|
33
|
+
maxRetries: 2,
|
|
34
|
+
steps: [
|
|
35
|
+
{ action: 'security_audit', agent: 'security-expert', description: 'Full security audit', timeout: 600 },
|
|
36
|
+
{ action: 'remediate', agent: 'security-expert', description: 'Fix security vulnerabilities', timeout: 900 },
|
|
37
|
+
{ action: 'verify', agent: 'security-expert', description: 'Verify fixes', timeout: 300 }
|
|
38
|
+
],
|
|
39
|
+
preventiveActions: [
|
|
40
|
+
'Run security scans in pre-commit hooks',
|
|
41
|
+
'Keep dependencies updated',
|
|
42
|
+
'Review auth/authz changes carefully'
|
|
43
|
+
],
|
|
44
|
+
fallbackPhase: { name: 'Security Escalation', agents: ['security-expert', 'architecture-expert'], duration: '2-3 days' }
|
|
45
|
+
},
|
|
46
|
+
'performance-failure': {
|
|
47
|
+
description: 'Performance issues detected',
|
|
48
|
+
severity: 'medium',
|
|
49
|
+
autoTrigger: false,
|
|
50
|
+
maxRetries: 2,
|
|
51
|
+
steps: [
|
|
52
|
+
{ action: 'profile', agent: 'performance-expert', description: 'Profile application', timeout: 600 },
|
|
53
|
+
{ action: 'optimize', agent: 'performance-expert', description: 'Implement optimizations', timeout: 900 },
|
|
54
|
+
{ action: 'benchmark', agent: 'performance-expert', description: 'Benchmark improvements', timeout: 300 }
|
|
55
|
+
],
|
|
56
|
+
preventiveActions: [
|
|
57
|
+
'Set performance budgets',
|
|
58
|
+
'Monitor bundle sizes',
|
|
59
|
+
'Profile database queries'
|
|
60
|
+
],
|
|
61
|
+
fallbackPhase: { name: 'Performance Review', agents: ['performance-expert', 'database-expert'], duration: '2-3 days' }
|
|
62
|
+
},
|
|
63
|
+
'deployment-failure': {
|
|
64
|
+
description: 'Deployment failed',
|
|
65
|
+
severity: 'high',
|
|
66
|
+
autoTrigger: true,
|
|
67
|
+
maxRetries: 2,
|
|
68
|
+
steps: [
|
|
69
|
+
{ action: 'diagnose', agent: 'devops-expert', description: 'Diagnose deployment failure', timeout: 300 },
|
|
70
|
+
{ action: 'fix_config', agent: 'devops-expert', description: 'Fix configuration issues', timeout: 600 },
|
|
71
|
+
{ action: 'retry_deploy', agent: 'devops-expert', description: 'Retry deployment', timeout: 300 }
|
|
72
|
+
],
|
|
73
|
+
preventiveActions: [
|
|
74
|
+
'Deploy to staging first',
|
|
75
|
+
'Verify environment variables',
|
|
76
|
+
'Check resource limits and quotas'
|
|
77
|
+
],
|
|
78
|
+
fallbackPhase: { name: 'Deployment Rollback', agents: ['devops-expert'], duration: '0.5 days' }
|
|
79
|
+
},
|
|
80
|
+
'database-failure': {
|
|
81
|
+
description: 'Database issues detected',
|
|
82
|
+
severity: 'high',
|
|
83
|
+
autoTrigger: true,
|
|
84
|
+
maxRetries: 1,
|
|
85
|
+
steps: [
|
|
86
|
+
{ action: 'analyze_schema', agent: 'database-expert', description: 'Analyze database issues', timeout: 300 },
|
|
87
|
+
{ action: 'fix_migration', agent: 'database-expert', description: 'Fix migration issues', timeout: 600 },
|
|
88
|
+
{ action: 'verify_data', agent: 'database-expert', description: 'Verify data integrity', timeout: 300 }
|
|
89
|
+
],
|
|
90
|
+
preventiveActions: [
|
|
91
|
+
'Test migrations on copy of production data',
|
|
92
|
+
'Have rollback plan ready',
|
|
93
|
+
'Check for breaking schema changes'
|
|
94
|
+
],
|
|
95
|
+
fallbackPhase: { name: 'Database Recovery', agents: ['database-expert', 'devops-expert'], duration: '1-2 days' }
|
|
96
|
+
},
|
|
97
|
+
'build-failure': {
|
|
98
|
+
description: 'Build process failed',
|
|
99
|
+
severity: 'high',
|
|
100
|
+
autoTrigger: true,
|
|
101
|
+
maxRetries: 3,
|
|
102
|
+
steps: [
|
|
103
|
+
{ action: 'analyze_build', agent: 'devops-expert', description: 'Analyze build errors', timeout: 300 },
|
|
104
|
+
{ action: 'fix_dependencies', agent: 'backend-expert', description: 'Fix dependency issues', timeout: 600 },
|
|
105
|
+
{ action: 'rebuild', agent: 'devops-expert', description: 'Rebuild application', timeout: 300 }
|
|
106
|
+
],
|
|
107
|
+
preventiveActions: [
|
|
108
|
+
'Lock dependency versions',
|
|
109
|
+
'Verify build environment matches CI',
|
|
110
|
+
'Check for circular dependencies'
|
|
111
|
+
],
|
|
112
|
+
fallbackPhase: { name: 'Build Investigation', agents: ['devops-expert', 'backend-expert'], duration: '1 day' }
|
|
113
|
+
},
|
|
114
|
+
'integration-failure': {
|
|
115
|
+
description: 'Integration issues with external services',
|
|
116
|
+
severity: 'medium',
|
|
117
|
+
autoTrigger: false,
|
|
118
|
+
maxRetries: 2,
|
|
119
|
+
steps: [
|
|
120
|
+
{ action: 'diagnose_integration', agent: 'api-expert', description: 'Diagnose integration issues', timeout: 300 },
|
|
121
|
+
{ action: 'fix_api', agent: 'api-expert', description: 'Fix API integration', timeout: 600 },
|
|
122
|
+
{ action: 'verify_integration', agent: 'testing-expert', description: 'Verify integration works', timeout: 300 }
|
|
123
|
+
],
|
|
124
|
+
preventiveActions: [
|
|
125
|
+
'Mock external services in tests',
|
|
126
|
+
'Check API version compatibility',
|
|
127
|
+
'Verify credentials and permissions'
|
|
128
|
+
],
|
|
129
|
+
fallbackPhase: { name: 'Integration Workaround', agents: ['api-expert', 'backend-expert'], duration: '1-2 days' }
|
|
130
|
+
},
|
|
131
|
+
'timeout-failure': {
|
|
132
|
+
description: 'Operation timed out',
|
|
133
|
+
severity: 'medium',
|
|
134
|
+
autoTrigger: false,
|
|
135
|
+
maxRetries: 2,
|
|
136
|
+
steps: [
|
|
137
|
+
{ action: 'profile_operation', agent: 'performance-expert', description: 'Profile slow operation', timeout: 600 },
|
|
138
|
+
{ action: 'optimize_critical_path', agent: 'performance-expert', description: 'Optimize critical path', timeout: 600 },
|
|
139
|
+
{ action: 'adjust_timeout', agent: 'devops-expert', description: 'Adjust timeout settings', timeout: 300 }
|
|
140
|
+
],
|
|
141
|
+
preventiveActions: [
|
|
142
|
+
'Set appropriate timeout values',
|
|
143
|
+
'Add progress indicators',
|
|
144
|
+
'Consider async processing'
|
|
145
|
+
],
|
|
146
|
+
fallbackPhase: { name: 'Async Processing', agents: ['backend-expert', 'performance-expert'], duration: '1-2 days' }
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
module.exports = { REMEDIATION_PATHS };
|