@vfarcic/dot-ai 0.50.0 → 0.51.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.
@@ -39,7 +39,7 @@ export declare class CapabilityInferenceEngine {
39
39
  * @param resourceName - Full resource name (e.g., "resourcegroups.azure.upbound.io")
40
40
  * @throws Error if capability inference fails for any reason
41
41
  */
42
- inferCapabilities(resourceName: string, schema?: string, metadata?: any): Promise<ResourceCapability>;
42
+ inferCapabilities(resourceName: string, resourceDefinition?: string): Promise<ResourceCapability>;
43
43
  /**
44
44
  * Use AI to infer capabilities from all available resource context
45
45
  *
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/core/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAK7C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAEjC,YAAY,EAAE,MAAM,CAAC;IAGrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAGtC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAGhB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAGrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,iBAAiB,CAAoB;gBAEjC,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM;IAKhE;;;;;OAKG;IACG,iBAAiB,CACrB,YAAY,EAAE,MAAM,EACpB,M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zB;;;;OAIG;YACW,oBAAoB;IA0BlC;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAwD/B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAyB/B;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;CAQ1D"}
@@ -63,16 +63,15 @@ class CapabilityInferenceEngine {
63
63
  * @param resourceName - Full resource name (e.g., "resourcegroups.azure.upbound.io")
64
64
  * @throws Error if capability inference fails for any reason
65
65
  */
66
- async inferCapabilities(resourceName, schema, metadata) {
66
+ async inferCapabilities(resourceName, resourceDefinition) {
67
67
  const requestId = `capability-inference-${Date.now()}`;
68
68
  this.logger.info('Starting capability inference', {
69
69
  requestId,
70
70
  resource: resourceName,
71
- hasSchema: !!schema,
72
- hasMetadata: !!metadata
71
+ hasDefinition: !!resourceDefinition
73
72
  });
74
73
  // Use AI to analyze all available information
75
- const aiResult = await this.inferWithAI(resourceName, schema, metadata, requestId);
74
+ const aiResult = await this.inferWithAI(resourceName, resourceDefinition, requestId);
76
75
  // Convert AI result to final capability structure
77
76
  const finalCapability = this.buildResourceCapability(resourceName, aiResult);
78
77
  this.logger.info('Capability inference completed', {
@@ -90,9 +89,9 @@ class CapabilityInferenceEngine {
90
89
  *
91
90
  * @throws Error if AI inference fails
92
91
  */
93
- async inferWithAI(resourceName, schema, metadata, requestId) {
92
+ async inferWithAI(resourceName, resourceDefinition, requestId) {
94
93
  try {
95
- const prompt = await this.buildInferencePrompt(resourceName, schema, metadata);
94
+ const prompt = await this.buildInferencePrompt(resourceName, resourceDefinition);
96
95
  const response = await this.claudeIntegration.sendMessage(prompt);
97
96
  return this.parseCapabilitiesFromAI(response.content);
98
97
  }
@@ -109,7 +108,7 @@ class CapabilityInferenceEngine {
109
108
  *
110
109
  * @throws Error if prompt template cannot be loaded
111
110
  */
112
- async buildInferencePrompt(resourceName, schema, metadata) {
111
+ async buildInferencePrompt(resourceName, resourceDefinition) {
113
112
  // Load prompt template using standard pattern from existing codebase
114
113
  const promptPath = path.join(__dirname, '..', '..', 'prompts', 'capability-inference.md');
115
114
  if (!fs.existsSync(promptPath)) {
@@ -123,15 +122,9 @@ class CapabilityInferenceEngine {
123
122
  throw new Error(`Failed to read capability inference prompt: ${error instanceof Error ? error.message : String(error)}`);
124
123
  }
125
124
  // Replace template variables using standard pattern
126
- const analysisContext = schema && metadata ?
127
- 'Schema and metadata available' :
128
- schema ? 'Schema only' :
129
- metadata ? 'Metadata only' : 'Limited context';
130
125
  const finalPrompt = template
131
126
  .replace(/\{resourceName\}/g, resourceName)
132
- .replace(/\{analysisContext\}/g, analysisContext)
133
- .replace(/\{schema\}/g, schema || 'No schema provided')
134
- .replace(/\{metadata\}/g, metadata ? JSON.stringify(metadata, null, 2) : 'No metadata provided');
127
+ .replace(/\{resourceDefinition\}/g, resourceDefinition || 'No resource definition provided');
135
128
  return finalPrompt;
136
129
  }
137
130
  /**
@@ -13,18 +13,6 @@ export interface ResourceMap {
13
13
  resources: EnhancedResource[];
14
14
  custom: EnhancedCRD[];
15
15
  }
16
- export interface CRD {
17
- name: string;
18
- group: string;
19
- version: string;
20
- schema: any;
21
- metadata?: {
22
- labels: any;
23
- annotations: any;
24
- description: string;
25
- categories: string[];
26
- };
27
- }
28
16
  export interface EnhancedCRD {
29
17
  name: string;
30
18
  group: string;
@@ -132,7 +120,6 @@ export declare class KubernetesDiscovery {
132
120
  discoverCRDs(options?: {
133
121
  group?: string;
134
122
  }): Promise<EnhancedCRD[]>;
135
- discoverCRDDetails(): Promise<CRD[]>;
136
123
  getAPIResources(options?: {
137
124
  group?: string;
138
125
  }): Promise<EnhancedResource[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/core/discovery.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAEL,aAAa,EAEd,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,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IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAalC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS1D;;OAEG;YACW,uBAAuB;IAsDrC;;OAEG;YACW,8BAA8B;IAkB5C;;OAEG;YACW,8BAA8B;IAiE5C;;OAEG;IACH,OAAO,CAAC,wBAAwB;CAgBjC"}
@@ -305,30 +305,6 @@ class KubernetesDiscovery {
305
305
  throw new Error(classified.enhancedMessage);
306
306
  }
307
307
  }
308
- async discoverCRDDetails() {
309
- if (!this.connected) {
310
- throw new Error('Not connected to cluster');
311
- }
312
- try {
313
- const apiExtensions = this.kc.makeApiClient(k8s.ApiextensionsV1Api);
314
- const crdList = await apiExtensions.listCustomResourceDefinition();
315
- return crdList.items.map((crd) => ({
316
- name: crd.metadata?.name || '',
317
- group: crd.spec.group,
318
- version: crd.spec.versions[0]?.name || '',
319
- schema: crd.spec.versions[0]?.schema || {},
320
- metadata: {
321
- labels: crd.metadata?.labels || {},
322
- annotations: crd.metadata?.annotations || {},
323
- description: crd.spec.versions[0]?.schema?.openAPIV3Schema?.description || '',
324
- categories: crd.spec.names?.categories || []
325
- }
326
- }));
327
- }
328
- catch (error) {
329
- return [];
330
- }
331
- }
332
308
  async getAPIResources(options) {
333
309
  if (!this.connected) {
334
310
  throw new Error('Not connected to cluster');
@@ -1 +1 @@
1
- {"version":3,"file":"organizational-data.d.ts","sourceRoot":"","sources":["../../src/tools/organizational-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAUhD,eAAO,MAAM,6BAA6B,kBAAkB,CAAC;AAC7D,eAAO,MAAM,oCAAoC,8aAA0a,CAAC;AAG5d,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;CAwBjD,CAAC;AAu1EF;;GAEG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,KAAK,GAAG,IAAI,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,CAsHd"}
1
+ {"version":3,"file":"organizational-data.d.ts","sourceRoot":"","sources":["../../src/tools/organizational-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAUhD,eAAO,MAAM,6BAA6B,kBAAkB,CAAC;AAC7D,eAAO,MAAM,oCAAoC,8aAA0a,CAAC;AAG5d,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;CAwBjD,CAAC;AAg4EF;;GAEG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,KAAK,GAAG,IAAI,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,CAsHd"}
@@ -1120,6 +1120,26 @@ async function handleProcessingMode(session, args, logger, requestId, capability
1120
1120
  // Begin actual capability scanning - clear response from previous step
1121
1121
  return await handleScanning(session, { ...args, response: undefined }, logger, requestId, capabilityService);
1122
1122
  }
1123
+ /**
1124
+ * Create user-friendly error message for resource definition failures
1125
+ */
1126
+ function createResourceDefinitionErrorMessage(resourceName, error) {
1127
+ const errorMessage = error instanceof Error ? error.message : String(error);
1128
+ let userFriendlyMessage = `Cannot analyze resource '${resourceName}': `;
1129
+ if (errorMessage.includes('not found') || errorMessage.includes('NotFound')) {
1130
+ userFriendlyMessage += `Resource does not exist in cluster. Please ensure the CRD is installed.`;
1131
+ }
1132
+ else if (errorMessage.includes('connection refused') || errorMessage.includes('timeout')) {
1133
+ userFriendlyMessage += `Cannot connect to Kubernetes cluster. Please check cluster connectivity.`;
1134
+ }
1135
+ else if (errorMessage.includes('forbidden') || errorMessage.includes('Forbidden')) {
1136
+ userFriendlyMessage += `Insufficient permissions to read resource definitions. Please check RBAC settings.`;
1137
+ }
1138
+ else {
1139
+ userFriendlyMessage += `${errorMessage}`;
1140
+ }
1141
+ return userFriendlyMessage;
1142
+ }
1123
1143
  /**
1124
1144
  * Handle scanning step (actual capability analysis)
1125
1145
  */
@@ -1285,40 +1305,44 @@ async function handleScanning(session, args, logger, requestId, capabilityServic
1285
1305
  else {
1286
1306
  throw new Error('Invalid selectedResources in session state');
1287
1307
  }
1288
- // Get actual CRD schema and metadata for comprehensive analysis
1289
- let resourceSchema;
1290
- let resourceMetadata;
1308
+ // Get complete resource definition for comprehensive analysis
1309
+ let resourceDefinition;
1291
1310
  try {
1292
- // Import and connect to discovery engine
1311
+ // Import and connect to discovery engine for kubectl access
1293
1312
  const { KubernetesDiscovery } = await Promise.resolve().then(() => __importStar(require('../core/discovery')));
1294
1313
  const discovery = new KubernetesDiscovery();
1295
1314
  await discovery.connect();
1296
- // Get CRD definition with schema and metadata if it's a custom resource
1315
+ // Get complete CRD definition if it's a custom resource
1297
1316
  if (resourceName.includes('.')) {
1298
- const crdList = await discovery.discoverCRDDetails();
1299
- const matchingCRD = crdList.find((crd) => crd.name === resourceName);
1300
- if (matchingCRD) {
1301
- resourceSchema = JSON.stringify(matchingCRD.schema, null, 2);
1302
- resourceMetadata = matchingCRD.metadata;
1303
- logger.info('Found CRD schema and metadata for capability analysis', {
1304
- requestId,
1305
- sessionId: session.sessionId,
1306
- resource: resourceName,
1307
- hasSchema: !!resourceSchema,
1308
- hasMetadata: !!resourceMetadata,
1309
- metadataLabels: Object.keys(resourceMetadata?.labels || {}),
1310
- categories: resourceMetadata?.categories?.length || 0
1311
- });
1312
- }
1317
+ const crdOutput = await discovery.executeKubectl(['get', 'crd', resourceName, '-o', 'yaml']);
1318
+ resourceDefinition = crdOutput;
1319
+ logger.info('Found complete CRD definition for capability analysis', {
1320
+ requestId,
1321
+ sessionId: session.sessionId,
1322
+ resource: resourceName,
1323
+ hasDefinition: !!resourceDefinition,
1324
+ definitionSize: resourceDefinition?.length || 0
1325
+ });
1326
+ }
1327
+ else {
1328
+ // For core resources, use kubectl explain to get schema information
1329
+ const explainOutput = await discovery.explainResource(resourceName);
1330
+ resourceDefinition = explainOutput;
1331
+ logger.info('Found core resource explanation for capability analysis', {
1332
+ requestId,
1333
+ sessionId: session.sessionId,
1334
+ resource: resourceName,
1335
+ hasDefinition: !!resourceDefinition
1336
+ });
1313
1337
  }
1314
1338
  }
1315
1339
  catch (error) {
1316
- logger.warn('Could not retrieve CRD schema and metadata, using name-based inference', {
1340
+ logger.error('Failed to retrieve resource definition for capability analysis', error, {
1317
1341
  requestId,
1318
1342
  sessionId: session.sessionId,
1319
- resource: resourceName,
1320
- error: error instanceof Error ? error.message : String(error)
1343
+ resource: resourceName
1321
1344
  });
1345
+ throw new Error(createResourceDefinitionErrorMessage(resourceName, error));
1322
1346
  }
1323
1347
  logger.info('Analyzing resource for capability inference', {
1324
1348
  requestId,
@@ -1328,7 +1352,7 @@ async function handleScanning(session, args, logger, requestId, capabilityServic
1328
1352
  });
1329
1353
  if (session.processingMode === 'manual') {
1330
1354
  // Manual mode: Show capability data for user review
1331
- const capability = await engine.inferCapabilities(resourceName, resourceSchema, resourceMetadata);
1355
+ const capability = await engine.inferCapabilities(resourceName, resourceDefinition);
1332
1356
  const capabilityId = CapabilityInferenceEngine.generateCapabilityId(resourceName);
1333
1357
  return {
1334
1358
  success: true,
@@ -1411,21 +1435,19 @@ async function handleScanning(session, args, logger, requestId, capabilityServic
1411
1435
  progress: progressData
1412
1436
  }, args);
1413
1437
  };
1414
- // Get all CRD definitions once for efficiency
1415
- let availableCRDs = [];
1438
+ // Setup kubectl access for getting complete resource definitions
1439
+ let discovery;
1416
1440
  try {
1417
1441
  const { KubernetesDiscovery } = await Promise.resolve().then(() => __importStar(require('../core/discovery')));
1418
- const discovery = new KubernetesDiscovery();
1442
+ discovery = new KubernetesDiscovery();
1419
1443
  await discovery.connect();
1420
- availableCRDs = await discovery.discoverCRDDetails();
1421
- logger.info('Retrieved CRD definitions for batch processing', {
1444
+ logger.info('Connected to Kubernetes for batch resource definition retrieval', {
1422
1445
  requestId,
1423
- sessionId: session.sessionId,
1424
- totalCRDs: availableCRDs.length
1446
+ sessionId: session.sessionId
1425
1447
  });
1426
1448
  }
1427
1449
  catch (error) {
1428
- logger.warn('Could not retrieve CRDs for batch processing, falling back to name-based inference', {
1450
+ logger.warn('Could not connect to Kubernetes for batch processing, falling back to name-based inference', {
1429
1451
  requestId,
1430
1452
  sessionId: session.sessionId,
1431
1453
  error: error instanceof Error ? error.message : String(error)
@@ -1434,14 +1456,33 @@ async function handleScanning(session, args, logger, requestId, capabilityServic
1434
1456
  // Process each resource in the batch with progress tracking
1435
1457
  for (let i = 0; i < resources.length; i++) {
1436
1458
  const currentResource = resources[i];
1437
- // Get CRD schema and metadata for this resource
1438
- let currentSchema;
1439
- let currentMetadata;
1440
- if (currentResource.includes('.')) {
1441
- const matchingCRD = availableCRDs.find((crd) => crd.name === currentResource);
1442
- if (matchingCRD) {
1443
- currentSchema = JSON.stringify(matchingCRD.schema, null, 2);
1444
- currentMetadata = matchingCRD.metadata;
1459
+ // Get complete resource definition for this resource
1460
+ let currentResourceDefinition;
1461
+ if (discovery) {
1462
+ try {
1463
+ if (currentResource.includes('.')) {
1464
+ // Get complete CRD definition
1465
+ currentResourceDefinition = await discovery.executeKubectl(['get', 'crd', currentResource, '-o', 'yaml']);
1466
+ }
1467
+ else {
1468
+ // Get core resource explanation
1469
+ currentResourceDefinition = await discovery.explainResource(currentResource);
1470
+ }
1471
+ }
1472
+ catch (error) {
1473
+ logger.error(`Failed to get resource definition for ${currentResource}`, error, {
1474
+ requestId,
1475
+ sessionId: session.sessionId,
1476
+ resource: currentResource
1477
+ });
1478
+ // Add to errors array and skip processing this resource
1479
+ errors.push({
1480
+ resource: currentResource,
1481
+ error: createResourceDefinitionErrorMessage(currentResource, error),
1482
+ timestamp: new Date().toISOString()
1483
+ });
1484
+ // Skip processing this resource
1485
+ continue;
1445
1486
  }
1446
1487
  }
1447
1488
  // Update progress before processing
@@ -1453,7 +1494,7 @@ async function handleScanning(session, args, logger, requestId, capabilityServic
1453
1494
  resource: currentResource,
1454
1495
  percentage: Math.round(((i + 1) / totalResources) * 100)
1455
1496
  });
1456
- const capability = await engine.inferCapabilities(currentResource, currentSchema, currentMetadata);
1497
+ const capability = await engine.inferCapabilities(currentResource, currentResourceDefinition);
1457
1498
  const capabilityId = CapabilityInferenceEngine.generateCapabilityId(currentResource);
1458
1499
  // Store capability in Vector DB
1459
1500
  await capabilityService.storeCapability(capability);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vfarcic/dot-ai",
3
- "version": "0.50.0",
3
+ "version": "0.51.0",
4
4
  "description": "Universal Kubernetes application deployment agent with CLI and MCP interfaces",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,56 +1,57 @@
1
- # Capability Inference Prompt
1
+ # Generic Kubernetes Resource Capability Analysis
2
2
 
3
- Analyze this Kubernetes resource and identify its capabilities for semantic resource matching.
3
+ Analyze this Kubernetes resource and identify its capabilities for semantic matching and AI recommendations.
4
4
 
5
5
  ## Resource Information
6
6
  - **Resource**: {resourceName}
7
- - **Analysis Context**: {analysisContext}
8
7
 
9
- ## Resource Schema
8
+ ## Resource Definition
10
9
  ```yaml
11
- {schema}
12
- ```
13
-
14
- ## Resource Metadata
15
- ```json
16
- {metadata}
10
+ {resourceDefinition}
17
11
  ```
18
12
 
19
13
  ## Analysis Instructions
20
14
 
21
- Please identify the following capabilities for this resource:
22
-
23
- ### 1. Primary Capabilities
24
- What does this resource actually do? Consider all domains:
25
- - **Database**: postgresql, mysql, redis, mongodb, database, managed database
26
- - **Storage**: object storage, block storage, backup, storage
27
- - **Application**: web service, api, microservice, application
28
- - **Networking**: ingress, load balancer, service mesh, networking
29
- - **Observability**: metrics, logging, tracing, monitoring
30
- - **Security**: authentication, authorization, certificates, security
31
- - **Compute**: containers, serverless, batch, compute
32
- - **Other**: Any domain-specific capabilities
33
-
34
- ### 2. Cloud Providers Supported
35
- Which cloud providers does this resource support?
36
- - **Specific**: azure, aws, gcp, digitalocean, etc.
37
- - **Multi-cloud**: if it works across multiple providers
38
- - **On-premises**: if it supports on-prem deployments
15
+ Analyze the provided resource definition to understand what this resource does and extract its capabilities. Use only information present in the definition - do not guess or assume.
16
+
17
+ ### 1. Functional Capabilities
18
+ From the resource definition, identify what this resource enables users to do:
19
+ - Look at schema properties, descriptions, and field names
20
+ - Identify the core functionality (e.g., "database", "storage", "networking")
21
+ - Be specific about technologies (e.g., "postgresql" vs generic "database")
22
+ - Extract capabilities from field names, descriptions, and structure
23
+
24
+ ### 2. Provider/Platform Support
25
+ Identify what platforms or providers this resource works with:
26
+ - Look for provider-specific configuration sections or fields
27
+ - Check for multi-provider abstractions vs single-provider resources
28
+ - Identify on-premises vs cloud-only resources
29
+ - Only list providers explicitly mentioned or configured in the definition
39
30
 
40
31
  ### 3. Abstraction Level
41
- What abstractions does this resource provide?
42
- - **managed service**: Fully managed, minimal configuration
43
- - **high availability**: Built-in HA and redundancy
44
- - **auto scaling**: Automatic scaling capabilities
45
- - **backup**: Built-in backup and restore
46
- - **monitoring**: Built-in observability
47
- - **security**: Built-in security features
48
-
49
- ### 4. User Complexity Assessment
50
- How complex is this resource for end users?
51
- - **low**: Simple, high-level, minimal configuration needed
52
- - **medium**: Moderate complexity, some configuration required
53
- - **high**: Complex, requires detailed knowledge and extensive configuration
32
+ Determine what abstractions this resource provides:
33
+ - High-level managed services with minimal configuration
34
+ - Infrastructure abstractions (auto-scaling, high availability, etc.)
35
+ - Integration capabilities (backup, monitoring, security features)
36
+ - Look at required vs optional fields to gauge abstraction level
37
+
38
+ ### 4. User Experience Complexity
39
+ Assess complexity considering both configuration and assembly requirements:
40
+
41
+ **Configuration Complexity:**
42
+ - Number and difficulty of required fields
43
+ - Technical knowledge needed for the resource itself
44
+ - Clarity of purpose and abstractions provided
45
+
46
+ **Assembly Complexity:**
47
+ - **Standalone**: Resource works independently, creates/manages all dependencies
48
+ - **Coordinated**: Requires 2-3 other resources to be functional
49
+ - **Orchestrated**: Needs many resources and complex relationships to work
50
+
51
+ **Final Complexity Rating:**
52
+ - **Low**: Simple configuration AND works standalone or with minimal dependencies
53
+ - **Medium**: Moderate configuration OR needs some coordination with other resources
54
+ - **High**: Complex configuration OR requires orchestrating many resources OR both
54
55
 
55
56
  ## Response Format
56
57