@chanaka_nakandala/integration-agent 1.1.0 → 2.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 (65) hide show
  1. package/README.md +369 -60
  2. package/dist/index.js +22 -486
  3. package/dist/index.js.map +1 -1
  4. package/dist/{cli/init-command.d.ts → init-command.d.ts} +2 -2
  5. package/dist/init-command.d.ts.map +1 -0
  6. package/dist/{cli/init-command.js → init-command.js} +72 -46
  7. package/dist/init-command.js.map +1 -0
  8. package/package.json +5 -11
  9. package/agent-personas/ba-agent.yaml +0 -682
  10. package/agent-personas/developer-agent.yaml +0 -585
  11. package/dist/cache/file-cache.d.ts +0 -10
  12. package/dist/cache/file-cache.d.ts.map +0 -1
  13. package/dist/cache/file-cache.js +0 -79
  14. package/dist/cache/file-cache.js.map +0 -1
  15. package/dist/cli/init-command.d.ts.map +0 -1
  16. package/dist/cli/init-command.js.map +0 -1
  17. package/dist/scrapers/docs-scraper.d.ts +0 -28
  18. package/dist/scrapers/docs-scraper.d.ts.map +0 -1
  19. package/dist/scrapers/docs-scraper.js +0 -200
  20. package/dist/scrapers/docs-scraper.js.map +0 -1
  21. package/dist/search/keyword-search.d.ts +0 -39
  22. package/dist/search/keyword-search.d.ts.map +0 -1
  23. package/dist/search/keyword-search.js +0 -127
  24. package/dist/search/keyword-search.js.map +0 -1
  25. package/dist/tools/code-generation-tool.d.ts +0 -33
  26. package/dist/tools/code-generation-tool.d.ts.map +0 -1
  27. package/dist/tools/code-generation-tool.js +0 -62
  28. package/dist/tools/code-generation-tool.js.map +0 -1
  29. package/dist/tools/search-result-formatter.d.ts +0 -27
  30. package/dist/tools/search-result-formatter.d.ts.map +0 -1
  31. package/dist/tools/search-result-formatter.js +0 -89
  32. package/dist/tools/search-result-formatter.js.map +0 -1
  33. package/dist/tools/search-tool.d.ts +0 -9
  34. package/dist/tools/search-tool.d.ts.map +0 -1
  35. package/dist/tools/search-tool.js +0 -32
  36. package/dist/tools/search-tool.js.map +0 -1
  37. package/dist/tools/template-loader.d.ts +0 -54
  38. package/dist/tools/template-loader.d.ts.map +0 -1
  39. package/dist/tools/template-loader.js +0 -148
  40. package/dist/tools/template-loader.js.map +0 -1
  41. package/dist/types/search.d.ts +0 -21
  42. package/dist/types/search.d.ts.map +0 -1
  43. package/dist/types/search.js +0 -2
  44. package/dist/types/search.js.map +0 -1
  45. package/templates/README.md +0 -98
  46. package/templates/authenticate/curl.template +0 -97
  47. package/templates/authenticate/java.template +0 -155
  48. package/templates/authenticate/python.template +0 -111
  49. package/templates/authenticate/typescript.template +0 -98
  50. package/templates/create_menu/curl.template +0 -145
  51. package/templates/create_menu/java.template +0 -285
  52. package/templates/create_menu/python.template +0 -159
  53. package/templates/create_menu/typescript.template +0 -184
  54. package/templates/receive_order/curl.template +0 -138
  55. package/templates/receive_order/java.template +0 -263
  56. package/templates/receive_order/python.template +0 -157
  57. package/templates/receive_order/typescript.template +0 -194
  58. package/templates/update_item_availability/curl.template +0 -143
  59. package/templates/update_item_availability/java.template +0 -279
  60. package/templates/update_item_availability/python.template +0 -203
  61. package/templates/update_item_availability/typescript.template +0 -194
  62. package/templates/update_order_status/curl.template +0 -138
  63. package/templates/update_order_status/java.template +0 -202
  64. package/templates/update_order_status/python.template +0 -142
  65. package/templates/update_order_status/typescript.template +0 -139
@@ -1,159 +0,0 @@
1
- """
2
- Grubtech Menu Sync - Python
3
-
4
- This example demonstrates how to push menu data to Grubtech API.
5
-
6
- Prerequisites:
7
- - Python 3.8+
8
- - requests library (pip install requests)
9
- - Valid access token from authentication
10
-
11
- Replace the following placeholders:
12
- - {{AUTH_TOKEN}}: Access token from authentication step
13
- - {{MENU_DATA}}: Your menu data in the required format
14
- """
15
-
16
- import requests
17
- import sys
18
- from typing import Dict, Any, List
19
-
20
- AUTH_TOKEN = '{{AUTH_TOKEN}}'
21
- BASE_URL = 'https://api.grubtech.io'
22
-
23
- # Example menu data structure
24
- # Replace this with your actual menu data
25
- MENU_DATA: Dict[str, Any] = {
26
- 'name': 'Restaurant Menu',
27
- 'description': 'Main menu with categories and items',
28
- 'categories': [
29
- {
30
- 'id': 'cat-1',
31
- 'name': 'Appetizers',
32
- 'description': 'Start your meal right',
33
- 'sortOrder': 1,
34
- 'items': [
35
- {
36
- 'id': 'item-1',
37
- 'name': 'Spring Rolls',
38
- 'description': 'Crispy vegetable spring rolls',
39
- 'price': 8.99,
40
- 'available': True,
41
- 'modifiers': [
42
- {
43
- 'id': 'mod-1',
44
- 'name': 'Extra Sauce',
45
- 'price': 1.50,
46
- 'available': True,
47
- },
48
- ],
49
- },
50
- ],
51
- },
52
- {
53
- 'id': 'cat-2',
54
- 'name': 'Main Courses',
55
- 'description': 'Delicious entrees',
56
- 'sortOrder': 2,
57
- 'items': [
58
- {
59
- 'id': 'item-2',
60
- 'name': 'Grilled Chicken',
61
- 'description': 'Tender chicken with herbs',
62
- 'price': 15.99,
63
- 'available': True,
64
- 'modifiers': [],
65
- },
66
- ],
67
- },
68
- ],
69
- }
70
-
71
-
72
- def create_menu(menu_data: Dict[str, Any]) -> str:
73
- """
74
- Push menu data to Grubtech API
75
-
76
- Args:
77
- menu_data: Menu data dictionary
78
-
79
- Returns:
80
- str: Menu ID from response
81
-
82
- Raises:
83
- Exception: If menu creation fails
84
- """
85
- try:
86
- # Validate menu data before sending
87
- if not menu_data.get('categories') or len(menu_data['categories']) == 0:
88
- raise ValueError('Menu must have at least one category')
89
-
90
- # Make menu creation request
91
- url = f'{BASE_URL}/v1/menus'
92
- headers = {
93
- 'Authorization': f'Bearer {AUTH_TOKEN}',
94
- 'Content-Type': 'application/json',
95
- }
96
-
97
- response = requests.post(url, json=menu_data, headers=headers, timeout=30)
98
-
99
- # Check for errors
100
- if not response.ok:
101
- raise Exception(
102
- f'Menu creation failed: {response.status_code} - {response.text}'
103
- )
104
-
105
- # Extract menu ID from response
106
- data: Dict[str, Any] = response.json()
107
- menu_id = data['menuId']
108
-
109
- print(f'✅ Menu created successfully!')
110
- print(f'Menu ID: {menu_id}')
111
- print(f'Status: {data.get("status", "unknown")}')
112
-
113
- return menu_id
114
-
115
- except requests.RequestException as e:
116
- print(f'❌ Menu creation error: {e}', file=sys.stderr)
117
- raise
118
- except Exception as e:
119
- print(f'❌ Unexpected error: {e}', file=sys.stderr)
120
- raise
121
-
122
-
123
- def update_menu(menu_id: str, menu_data: Dict[str, Any]) -> None:
124
- """
125
- Update existing menu
126
-
127
- Args:
128
- menu_id: ID of the menu to update
129
- menu_data: Updated menu data
130
- """
131
- try:
132
- url = f'{BASE_URL}/v1/menus/{menu_id}'
133
- headers = {
134
- 'Authorization': f'Bearer {AUTH_TOKEN}',
135
- 'Content-Type': 'application/json',
136
- }
137
-
138
- response = requests.put(url, json=menu_data, headers=headers, timeout=30)
139
-
140
- if not response.ok:
141
- raise Exception(f'Menu update failed: {response.status_code} - {response.text}')
142
-
143
- print(f'✅ Menu updated successfully!')
144
-
145
- except Exception as e:
146
- print(f'❌ Menu update error: {e}', file=sys.stderr)
147
- raise
148
-
149
-
150
- if __name__ == '__main__':
151
- try:
152
- # Create new menu
153
- menu_id = create_menu(MENU_DATA)
154
-
155
- # Optionally update the menu
156
- # update_menu(menu_id, MENU_DATA)
157
-
158
- except Exception as e:
159
- sys.exit(1)
@@ -1,184 +0,0 @@
1
- /**
2
- * Grubtech Menu Sync - TypeScript
3
- *
4
- * This example demonstrates how to push menu data to Grubtech API.
5
- *
6
- * Prerequisites:
7
- * - Node.js 18+ with fetch API
8
- * - Valid access token from authentication
9
- *
10
- * Replace the following placeholders:
11
- * - {{AUTH_TOKEN}}: Access token from authentication step
12
- * - {{MENU_DATA}}: Your menu data in the required format
13
- */
14
-
15
- const AUTH_TOKEN = '{{AUTH_TOKEN}}';
16
- const BASE_URL = 'https://api.grubtech.io';
17
-
18
- interface MenuItem {
19
- id: string;
20
- name: string;
21
- description: string;
22
- price: number;
23
- available: boolean;
24
- modifiers?: Modifier[];
25
- }
26
-
27
- interface Modifier {
28
- id: string;
29
- name: string;
30
- price: number;
31
- available: boolean;
32
- }
33
-
34
- interface MenuCategory {
35
- id: string;
36
- name: string;
37
- description: string;
38
- sortOrder: number;
39
- items: MenuItem[];
40
- }
41
-
42
- interface MenuData {
43
- name: string;
44
- description: string;
45
- categories: MenuCategory[];
46
- }
47
-
48
- interface MenuResponse {
49
- menuId: string;
50
- status: string;
51
- message: string;
52
- }
53
-
54
- /**
55
- * Example menu data structure
56
- * Replace this with your actual menu data
57
- */
58
- const MENU_DATA: MenuData = {
59
- name: 'Restaurant Menu',
60
- description: 'Main menu with categories and items',
61
- categories: [
62
- {
63
- id: 'cat-1',
64
- name: 'Appetizers',
65
- description: 'Start your meal right',
66
- sortOrder: 1,
67
- items: [
68
- {
69
- id: 'item-1',
70
- name: 'Spring Rolls',
71
- description: 'Crispy vegetable spring rolls',
72
- price: 8.99,
73
- available: true,
74
- modifiers: [
75
- {
76
- id: 'mod-1',
77
- name: 'Extra Sauce',
78
- price: 1.50,
79
- available: true,
80
- },
81
- ],
82
- },
83
- ],
84
- },
85
- {
86
- id: 'cat-2',
87
- name: 'Main Courses',
88
- description: 'Delicious entrees',
89
- sortOrder: 2,
90
- items: [
91
- {
92
- id: 'item-2',
93
- name: 'Grilled Chicken',
94
- description: 'Tender chicken with herbs',
95
- price: 15.99,
96
- available: true,
97
- modifiers: [],
98
- },
99
- ],
100
- },
101
- ],
102
- };
103
-
104
- /**
105
- * Push menu data to Grubtech API
106
- */
107
- async function createMenu(menuData: MenuData): Promise<string> {
108
- try {
109
- // Validate menu data before sending
110
- if (!menuData.categories || menuData.categories.length === 0) {
111
- throw new Error('Menu must have at least one category');
112
- }
113
-
114
- // Make menu creation request
115
- const response = await fetch(`${BASE_URL}/v1/menus`, {
116
- method: 'POST',
117
- headers: {
118
- 'Authorization': `Bearer ${AUTH_TOKEN}`,
119
- 'Content-Type': 'application/json',
120
- },
121
- body: JSON.stringify(menuData),
122
- });
123
-
124
- // Check for errors
125
- if (!response.ok) {
126
- const errorBody = await response.text();
127
- throw new Error(
128
- `Menu creation failed: ${response.status} - ${errorBody}`
129
- );
130
- }
131
-
132
- // Extract menu ID from response
133
- const data: MenuResponse = await response.json();
134
- const menuId = data.menuId;
135
-
136
- console.log('✅ Menu created successfully!');
137
- console.log(`Menu ID: ${menuId}`);
138
- console.log(`Status: ${data.status}`);
139
-
140
- return menuId;
141
- } catch (error) {
142
- console.error('❌ Menu creation error:', error);
143
- throw error;
144
- }
145
- }
146
-
147
- /**
148
- * Update existing menu
149
- */
150
- async function updateMenu(menuId: string, menuData: MenuData): Promise<void> {
151
- try {
152
- const response = await fetch(`${BASE_URL}/v1/menus/${menuId}`, {
153
- method: 'PUT',
154
- headers: {
155
- 'Authorization': `Bearer ${AUTH_TOKEN}`,
156
- 'Content-Type': 'application/json',
157
- },
158
- body: JSON.stringify(menuData),
159
- });
160
-
161
- if (!response.ok) {
162
- const errorBody = await response.text();
163
- throw new Error(`Menu update failed: ${response.status} - ${errorBody}`);
164
- }
165
-
166
- console.log('✅ Menu updated successfully!');
167
- } catch (error) {
168
- console.error('❌ Menu update error:', error);
169
- throw error;
170
- }
171
- }
172
-
173
- // Main execution
174
- (async () => {
175
- try {
176
- // Create new menu
177
- const menuId = await createMenu(MENU_DATA);
178
-
179
- // Optionally update the menu
180
- // await updateMenu(menuId, MENU_DATA);
181
- } catch (error) {
182
- process.exit(1);
183
- }
184
- })();
@@ -1,138 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Grubtech Order Receive Webhook - cURL (Testing)
4
- #
5
- # This example demonstrates how to test your webhook endpoint
6
- # by simulating an order from Grubtech.
7
- #
8
- # Prerequisites:
9
- # - curl command-line tool
10
- # - openssl (for signature calculation)
11
- #
12
- # Replace the following placeholders:
13
- # - {{WEBHOOK_SECRET}}: Your webhook secret
14
-
15
- WEBHOOK_SECRET="{{WEBHOOK_SECRET}}"
16
- WEBHOOK_URL="http://localhost:3000/webhooks/grubtech/orders"
17
-
18
- # Example order payload
19
- ORDER_PAYLOAD='{
20
- "orderId": "ord-123456",
21
- "partnerOrderId": "POS-789",
22
- "status": "pending",
23
- "createdAt": "2025-10-08T12:00:00Z",
24
- "customer": {
25
- "name": "John Doe",
26
- "phone": "+1234567890",
27
- "email": "john@example.com"
28
- },
29
- "delivery": {
30
- "type": "delivery",
31
- "address": "123 Main St, Apt 4B",
32
- "city": "Dubai",
33
- "instructions": "Ring doorbell twice"
34
- },
35
- "items": [
36
- {
37
- "id": "item-1",
38
- "name": "Spring Rolls",
39
- "quantity": 2,
40
- "price": 8.99,
41
- "modifiers": [
42
- {
43
- "id": "mod-1",
44
- "name": "Extra Sauce",
45
- "price": 1.50
46
- }
47
- ]
48
- }
49
- ],
50
- "totals": {
51
- "subtotal": 19.48,
52
- "tax": 1.95,
53
- "deliveryFee": 5.00,
54
- "total": 26.43
55
- },
56
- "payment": {
57
- "method": "card",
58
- "status": "paid"
59
- }
60
- }'
61
-
62
- # Calculate signature using HMAC-SHA256
63
- calculate_signature() {
64
- local payload=$1
65
- echo -n "$payload" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | sed 's/^.* //'
66
- }
67
-
68
- # Test webhook endpoint
69
- test_webhook() {
70
- echo "Testing webhook endpoint..."
71
- echo "URL: $WEBHOOK_URL"
72
- echo ""
73
-
74
- # Calculate signature
75
- SIGNATURE=$(calculate_signature "$ORDER_PAYLOAD")
76
- echo "Signature: $SIGNATURE"
77
- echo ""
78
-
79
- # Send webhook request
80
- RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
81
- "$WEBHOOK_URL" \
82
- -H "Content-Type: application/json" \
83
- -H "X-Grubtech-Signature: $SIGNATURE" \
84
- -d "$ORDER_PAYLOAD")
85
-
86
- # Extract HTTP status code and body
87
- HTTP_CODE=$(echo "$RESPONSE" | tail -n 1)
88
- BODY=$(echo "$RESPONSE" | sed '$d')
89
-
90
- echo "Response Code: $HTTP_CODE"
91
- echo "Response Body:"
92
- echo "$BODY" | jq '.' 2>/dev/null || echo "$BODY"
93
-
94
- # Check if accepted
95
- if [ "$HTTP_CODE" -eq 200 ]; then
96
- echo ""
97
- echo "✅ Order accepted!"
98
- else
99
- echo ""
100
- echo "❌ Order rejected or error occurred"
101
- fi
102
- }
103
-
104
- # Test invalid signature
105
- test_invalid_signature() {
106
- echo ""
107
- echo "Testing invalid signature..."
108
-
109
- RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
110
- "$WEBHOOK_URL" \
111
- -H "Content-Type: application/json" \
112
- -H "X-Grubtech-Signature: invalid_signature_12345" \
113
- -d "$ORDER_PAYLOAD")
114
-
115
- HTTP_CODE=$(echo "$RESPONSE" | tail -n 1)
116
- BODY=$(echo "$RESPONSE" | sed '$d')
117
-
118
- echo "Response Code: $HTTP_CODE"
119
- echo "Response Body: $BODY"
120
-
121
- if [ "$HTTP_CODE" -eq 401 ]; then
122
- echo "✅ Invalid signature correctly rejected"
123
- else
124
- echo "❌ Unexpected response for invalid signature"
125
- fi
126
- }
127
-
128
- # Main execution
129
- main() {
130
- # Test with valid signature
131
- test_webhook
132
-
133
- # Test with invalid signature
134
- test_invalid_signature
135
- }
136
-
137
- # Run tests
138
- main