@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 +0,0 @@
1
- {"version":3,"file":"search-result-formatter.js","sourceRoot":"","sources":["../../src/tools/search-result-formatter.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,qBAAqB;IACf,iBAAiB,GAAG,GAAG,CAAC;IAEzC;;OAEG;IACH,aAAa,CACX,MAAqB,EACrB,KAAa,EACb,aAAqB,EACrB,gBAAyB;QAEzB,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QAE7D,MAAM,QAAQ,GAAmB;YAC/B,SAAS,EAAE,aAAa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jE,IAAI,eAAe,GAAG,SAAS,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;YAC7C,uDAAuD;YACvD,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC;QACpE,CAAC;QAED,OAAO,SAAS,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC;IAClC,CAAC;IAED;;OAEG;IACK,wBAAwB,CAAC,IAAY;QAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACpD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC,CAAC;QAEpC,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC9C,OAAO,SAAS,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,OAAe,EAAE,QAAkB;QACnD,IAAI,WAAW,GAAG,OAAO,CAAC;QAE1B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,sDAAsD;YACtD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YACvE,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,WAAW,CAAC,GAAW;QAC7B,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;CACF"}
@@ -1,9 +0,0 @@
1
- import { SearchResponse } from '../types/search.js';
2
- export declare class SearchTool {
3
- private cache;
4
- private keywordSearch;
5
- private formatter;
6
- constructor();
7
- search(query: string, integrationPhase?: string): Promise<SearchResponse>;
8
- }
9
- //# sourceMappingURL=search-tool.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search-tool.d.ts","sourceRoot":"","sources":["../../src/tools/search-tool.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,qBAAa,UAAU;IACrB,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,SAAS,CAAwB;;IAQnC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAkChF"}
@@ -1,32 +0,0 @@
1
- import { KeywordSearch } from '../search/keyword-search.js';
2
- import { SearchResultFormatter } from './search-result-formatter.js';
3
- import { FileCache } from '../cache/file-cache.js';
4
- export class SearchTool {
5
- cache;
6
- keywordSearch;
7
- formatter;
8
- constructor() {
9
- this.cache = new FileCache();
10
- this.keywordSearch = new KeywordSearch();
11
- this.formatter = new SearchResultFormatter();
12
- }
13
- async search(query, integrationPhase) {
14
- const startTime = Date.now();
15
- // Load cached documents
16
- const docs = await this.cache.getAllCachedDocs();
17
- let chunks = docs.flatMap(d => d.chunks);
18
- // Filter by integration phase if specified
19
- if (integrationPhase) {
20
- chunks = chunks.filter(c => c.metadata?.integrationPhase === integrationPhase);
21
- }
22
- // Perform keyword search
23
- const scoredChunks = this.keywordSearch.search(query, chunks, 5);
24
- const executionTime = Date.now() - startTime;
25
- // Format results
26
- const response = this.formatter.formatResults(scoredChunks, query, executionTime, integrationPhase);
27
- // Log search metrics
28
- console.error(`Search: "${query}" returned ${response.results.length} results in ${executionTime}ms`);
29
- return response;
30
- }
31
- }
32
- //# sourceMappingURL=search-tool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search-tool.js","sourceRoot":"","sources":["../../src/tools/search-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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CAAC,KAAK,CACX,YAAY,KAAK,cAAc,QAAQ,CAAC,OAAO,CAAC,MAAM,eAAe,aAAa,IAAI,CACvF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -1,54 +0,0 @@
1
- export interface TemplateMetadata {
2
- description?: string;
3
- author?: string;
4
- version?: string;
5
- lastModified?: string;
6
- }
7
- export interface LoadedTemplate {
8
- content: string;
9
- metadata: TemplateMetadata;
10
- filePath: string;
11
- }
12
- export interface TemplateInfo {
13
- operation: string;
14
- language: string;
15
- filePath: string;
16
- }
17
- export declare class TemplateLoader {
18
- private readonly templateDir;
19
- private templateCache;
20
- constructor(templateDir?: string);
21
- /**
22
- * Load a template by operation and language
23
- */
24
- loadTemplate(operation: string, language: string): Promise<string>;
25
- /**
26
- * Load template with metadata
27
- */
28
- loadTemplateWithMetadata(operation: string, language: string): Promise<LoadedTemplate>;
29
- /**
30
- * Substitute variables in template
31
- */
32
- substituteVariables(template: string, variables: Record<string, string>): string;
33
- /**
34
- * List all available templates
35
- */
36
- listAvailableTemplates(): Promise<TemplateInfo[]>;
37
- /**
38
- * Parse metadata from template header comments
39
- */
40
- private parseMetadata;
41
- /**
42
- * Generate cache key for operation/language
43
- */
44
- private getCacheKey;
45
- /**
46
- * Clear template cache
47
- */
48
- clearCache(): void;
49
- /**
50
- * Clear specific template from cache
51
- */
52
- clearCacheForTemplate(operation: string, language: string): void;
53
- }
54
- //# sourceMappingURL=template-loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-loader.d.ts","sourceRoot":"","sources":["../../src/tools/template-loader.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,aAAa,CAA8B;gBAEvC,WAAW,CAAC,EAAE,MAAM;IAMhC;;OAEG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA8CxE;;OAEG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,cAAc,CAAC;IAc1B;;OAEG;IACH,mBAAmB,CACjB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,MAAM;IAYT;;OAEG;IACG,sBAAsB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAmCvD;;OAEG;IACH,OAAO,CAAC,aAAa;IAoBrB;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;CAIjE"}
@@ -1,148 +0,0 @@
1
- import { promises as fs } from 'fs';
2
- import path from 'path';
3
- import { fileURLToPath } from 'url';
4
- import { dirname } from 'path';
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = dirname(__filename);
7
- export class TemplateLoader {
8
- templateDir;
9
- templateCache;
10
- constructor(templateDir) {
11
- // Default to templates/ directory in mcp-server package
12
- this.templateDir = templateDir || path.join(__dirname, '../../templates');
13
- this.templateCache = new Map();
14
- }
15
- /**
16
- * Load a template by operation and language
17
- */
18
- async loadTemplate(operation, language) {
19
- const cacheKey = this.getCacheKey(operation, language);
20
- // Check cache first
21
- if (this.templateCache.has(cacheKey)) {
22
- return this.templateCache.get(cacheKey).content;
23
- }
24
- // Construct template file path
25
- const templatePath = path.join(this.templateDir, operation, `${language}.template`);
26
- try {
27
- // Validate template exists
28
- await fs.access(templatePath);
29
- // Read template content
30
- const content = await fs.readFile(templatePath, 'utf-8');
31
- // Parse metadata from header comments
32
- const metadata = this.parseMetadata(content);
33
- // Cache the template
34
- const loadedTemplate = {
35
- content,
36
- metadata,
37
- filePath: templatePath,
38
- };
39
- this.templateCache.set(cacheKey, loadedTemplate);
40
- return content;
41
- }
42
- catch (error) {
43
- if (error.code === 'ENOENT') {
44
- throw new Error(`Template not found: ${operation}/${language}.template`);
45
- }
46
- throw new Error(`Failed to load template ${operation}/${language}: ${error.message}`);
47
- }
48
- }
49
- /**
50
- * Load template with metadata
51
- */
52
- async loadTemplateWithMetadata(operation, language) {
53
- const cacheKey = this.getCacheKey(operation, language);
54
- // Check cache first
55
- if (this.templateCache.has(cacheKey)) {
56
- return this.templateCache.get(cacheKey);
57
- }
58
- // Load template (which will cache it)
59
- await this.loadTemplate(operation, language);
60
- return this.templateCache.get(cacheKey);
61
- }
62
- /**
63
- * Substitute variables in template
64
- */
65
- substituteVariables(template, variables) {
66
- let result = template;
67
- for (const [key, value] of Object.entries(variables)) {
68
- // Replace all occurrences of {{KEY}} with value
69
- const regex = new RegExp(`\\{\\{${key}\\}\\}`, 'g');
70
- result = result.replace(regex, value);
71
- }
72
- return result;
73
- }
74
- /**
75
- * List all available templates
76
- */
77
- async listAvailableTemplates() {
78
- const templates = [];
79
- try {
80
- // Read operation directories
81
- const operations = await fs.readdir(this.templateDir, {
82
- withFileTypes: true,
83
- });
84
- for (const operation of operations) {
85
- if (!operation.isDirectory())
86
- continue;
87
- const operationPath = path.join(this.templateDir, operation.name);
88
- // Read template files in operation directory
89
- const files = await fs.readdir(operationPath);
90
- for (const file of files) {
91
- if (file.endsWith('.template')) {
92
- const language = file.replace('.template', '');
93
- templates.push({
94
- operation: operation.name,
95
- language,
96
- filePath: path.join(operationPath, file),
97
- });
98
- }
99
- }
100
- }
101
- return templates;
102
- }
103
- catch (error) {
104
- throw new Error(`Failed to list templates: ${error.message}`);
105
- }
106
- }
107
- /**
108
- * Parse metadata from template header comments
109
- */
110
- parseMetadata(content) {
111
- const metadata = {};
112
- // Extract header comment block (first 20 lines)
113
- const lines = content.split('\n').slice(0, 20);
114
- for (const line of lines) {
115
- // Look for metadata patterns in comments
116
- const descMatch = line.match(/@description\s+(.+)/i);
117
- const authorMatch = line.match(/@author\s+(.+)/i);
118
- const versionMatch = line.match(/@version\s+(.+)/i);
119
- if (descMatch)
120
- metadata.description = descMatch[1].trim();
121
- if (authorMatch)
122
- metadata.author = authorMatch[1].trim();
123
- if (versionMatch)
124
- metadata.version = versionMatch[1].trim();
125
- }
126
- return metadata;
127
- }
128
- /**
129
- * Generate cache key for operation/language
130
- */
131
- getCacheKey(operation, language) {
132
- return `${operation}:${language}`;
133
- }
134
- /**
135
- * Clear template cache
136
- */
137
- clearCache() {
138
- this.templateCache.clear();
139
- }
140
- /**
141
- * Clear specific template from cache
142
- */
143
- clearCacheForTemplate(operation, language) {
144
- const cacheKey = this.getCacheKey(operation, language);
145
- this.templateCache.delete(cacheKey);
146
- }
147
- }
148
- //# sourceMappingURL=template-loader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-loader.js","sourceRoot":"","sources":["../../src/tools/template-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,C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AAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAE/C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,yCAAyC;YACzC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;YACrD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;YAClD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;YAEpD,IAAI,SAAS;gBAAE,QAAQ,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC1D,IAAI,WAAW;gBAAE,QAAQ,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACzD,IAAI,YAAY;gBAAE,QAAQ,CAAC,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9D,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;OAEG;IACK,WAAW,CAAC,SAAiB,EAAE,QAAgB;QACrD,OAAO,GAAG,SAAS,IAAI,QAAQ,EAAE,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,UAAU;QACR,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,qBAAqB,CAAC,SAAiB,EAAE,QAAgB;QACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACvD,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -1,21 +0,0 @@
1
- export interface SearchResult {
2
- title: string;
3
- snippet: string;
4
- sourceUrl: string;
5
- relevanceScore: number;
6
- highlights: string[];
7
- }
8
- export interface SearchResponse {
9
- results: SearchResult[];
10
- metadata: SearchMetadata;
11
- message?: string;
12
- suggestions?: string[];
13
- }
14
- export interface SearchMetadata {
15
- queryTime: number;
16
- totalResults: number;
17
- returned: number;
18
- query: string;
19
- integrationPhase?: string;
20
- }
21
- //# sourceMappingURL=search.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/types/search.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=search.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/types/search.ts"],"names":[],"mappings":""}
@@ -1,98 +0,0 @@
1
- # Grubtech Integration Code Templates
2
-
3
- This directory contains code templates for generating integration code snippets.
4
-
5
- ## Directory Structure
6
-
7
- ```
8
- templates/
9
- ├── {operation}/
10
- │ ├── {language}.template
11
- │ └── ...
12
- ```
13
-
14
- ## Supported Operations
15
-
16
- - `authenticate` - API authentication
17
- - `create_menu` - Menu synchronization
18
- - `receive_order` - Order webhook endpoint
19
- - `update_order_status` - Order status updates
20
- - `update_item_availability` - Item availability updates
21
-
22
- ## Supported Languages
23
-
24
- - `typescript` - TypeScript/Node.js
25
- - `python` - Python 3.8+
26
- - `java` - Java 17+ with Spring Boot
27
- - `curl` - cURL commands
28
-
29
- ## Template Format
30
-
31
- ### File Naming
32
-
33
- Templates must follow the naming convention: `{language}.template`
34
-
35
- Example: `typescript.template`, `python.template`
36
-
37
- ### Variable Placeholders
38
-
39
- Use double curly braces for variables: `{{VARIABLE_NAME}}`
40
-
41
- Example:
42
- ```typescript
43
- const API_KEY = '{{API_KEY}}';
44
- const PARTNER_ID = '{{PARTNER_ID}}';
45
- ```
46
-
47
- ### Metadata (Optional)
48
-
49
- Include metadata in header comments using JSDoc-style tags:
50
-
51
- ```typescript
52
- /**
53
- * @description Grubtech API Authentication - TypeScript
54
- * @author Grubtech Integration Team
55
- * @version 1.0.0
56
- */
57
- ```
58
-
59
- Supported metadata tags:
60
- - `@description` - Template description
61
- - `@author` - Template author
62
- - `@version` - Template version
63
-
64
- ### Template Requirements
65
-
66
- 1. **Syntactically Valid**: Templates must be valid code in their language
67
- 2. **Comments**: Include explanatory comments for each section
68
- 3. **Error Handling**: Include error handling examples
69
- 4. **Complete Examples**: Provide runnable code with example data
70
- 5. **Placeholders**: Use clear, descriptive placeholder names
71
-
72
- ## Adding New Templates
73
-
74
- 1. Create operation directory: `templates/{operation}/`
75
- 2. Add template file: `{language}.template`
76
- 3. Include header metadata
77
- 4. Add variable placeholders using `{{VARIABLE}}`
78
- 5. Test syntax validity
79
- 6. Update this README
80
-
81
- ## Template Loader
82
-
83
- Templates are loaded via the `TemplateLoader` class:
84
-
85
- ```typescript
86
- import { TemplateLoader } from './tools/template-loader.js';
87
-
88
- const loader = new TemplateLoader();
89
-
90
- // Load template
91
- const template = await loader.loadTemplate('authenticate', 'typescript');
92
-
93
- // Substitute variables
94
- const code = loader.substituteVariables(template, {
95
- API_KEY: 'my-key',
96
- PARTNER_ID: 'partner-123',
97
- });
98
- ```
@@ -1,97 +0,0 @@
1
- #!/bin/bash
2
-
3
- # @description Grubtech API Authentication - cURL
4
- # @author Grubtech Integration Team
5
- # @version 1.0.0
6
- #
7
- # This example demonstrates how to authenticate with the Grubtech API
8
- # using an API key to obtain an access token.
9
- #
10
- # Prerequisites:
11
- # - curl command-line tool
12
- # - jq (for JSON parsing, optional but recommended)
13
- # - Valid Grubtech API key
14
- #
15
- # Replace the following placeholders:
16
- # - {{API_KEY}}: Your Grubtech API key
17
- # - {{PARTNER_ID}}: Your partner identifier
18
-
19
- API_KEY="{{API_KEY}}"
20
- PARTNER_ID="{{PARTNER_ID}}"
21
- BASE_URL="https://api.grubtech.io"
22
-
23
- # Authenticate with Grubtech API and obtain access token
24
- authenticate() {
25
- echo "Authenticating with Grubtech API..."
26
-
27
- # Make authentication request
28
- RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
29
- "${BASE_URL}/v1/auth/token" \
30
- -H "Content-Type: application/json" \
31
- -H "x-api-key: ${API_KEY}" \
32
- -d "{
33
- \"partnerId\": \"${PARTNER_ID}\",
34
- \"grantType\": \"api_key\"
35
- }")
36
-
37
- # Extract HTTP status code and body
38
- HTTP_CODE=$(echo "$RESPONSE" | tail -n 1)
39
- BODY=$(echo "$RESPONSE" | sed '$d')
40
-
41
- # Check for errors
42
- if [ "$HTTP_CODE" -ne 200 ]; then
43
- echo "Authentication failed: HTTP $HTTP_CODE"
44
- echo "Response: $BODY"
45
- return 1
46
- fi
47
-
48
- # Extract token from response (using jq if available)
49
- if command -v jq &> /dev/null; then
50
- TOKEN=$(echo "$BODY" | jq -r '.token')
51
- EXPIRES_IN=$(echo "$BODY" | jq -r '.expiresIn')
52
-
53
- echo "Authentication successful!"
54
- echo "Token expires in: ${EXPIRES_IN} seconds"
55
- else
56
- # Fallback: manual parsing (less reliable)
57
- TOKEN=$(echo "$BODY" | grep -o '"token":"[^"]*' | cut -d'"' -f4)
58
- echo "Authentication successful!"
59
- echo "Note: Install jq for better JSON parsing"
60
- fi
61
-
62
- echo "$TOKEN"
63
- }
64
-
65
- # Example: Use token in subsequent API requests
66
- example_api_call() {
67
- local TOKEN=$1
68
-
69
- echo "Making example API call..."
70
-
71
- curl -s -X GET \
72
- "${BASE_URL}/v1/menus" \
73
- -H "Authorization: Bearer ${TOKEN}" \
74
- -H "Content-Type: application/json"
75
- }
76
-
77
- # Main execution
78
- main() {
79
- # Authenticate and get token
80
- ACCESS_TOKEN=$(authenticate)
81
-
82
- if [ -z "$ACCESS_TOKEN" ]; then
83
- echo "Failed to obtain access token"
84
- exit 1
85
- fi
86
-
87
- echo ""
88
- echo "Access Token: ${ACCESS_TOKEN:0:20}..."
89
- echo ""
90
-
91
- # Use token for API calls
92
- MENUS=$(example_api_call "$ACCESS_TOKEN")
93
- echo "Menus: $MENUS"
94
- }
95
-
96
- # Run main function
97
- main
@@ -1,155 +0,0 @@
1
- /**
2
- * @description Grubtech API Authentication - Java (Spring Boot)
3
- * @author Grubtech Integration Team
4
- * @version 1.0.0
5
- *
6
- * This example demonstrates how to authenticate with the Grubtech API
7
- * using an API key to obtain an access token.
8
- *
9
- * Prerequisites:
10
- * - Java 17+
11
- * - Spring Boot 3.x
12
- * - Spring WebFlux (for WebClient)
13
- *
14
- * Dependencies (Maven):
15
- * <dependency>
16
- * <groupId>org.springframework.boot</groupId>
17
- * <artifactId>spring-boot-starter-webflux</artifactId>
18
- * </dependency>
19
- *
20
- * Replace the following placeholders:
21
- * - {{API_KEY}}: Your Grubtech API key
22
- * - {{PARTNER_ID}}: Your partner identifier
23
- */
24
-
25
- package com.example.grubtech;
26
-
27
- import org.springframework.http.HttpHeaders;
28
- import org.springframework.http.MediaType;
29
- import org.springframework.web.reactive.function.client.WebClient;
30
- import reactor.core.publisher.Mono;
31
-
32
- import java.util.HashMap;
33
- import java.util.Map;
34
-
35
- public class GrubtechAuthentication {
36
-
37
- private static final String API_KEY = "{{API_KEY}}";
38
- private static final String PARTNER_ID = "{{PARTNER_ID}}";
39
- private static final String BASE_URL = "https://api.grubtech.io";
40
-
41
- private final WebClient webClient;
42
-
43
- public GrubtechAuthentication() {
44
- this.webClient = WebClient.builder()
45
- .baseUrl(BASE_URL)
46
- .build();
47
- }
48
-
49
- /**
50
- * Authenticate with Grubtech API and obtain access token
51
- *
52
- * @return Access token for API requests
53
- * @throws RuntimeException if authentication fails
54
- */
55
- public String authenticate() {
56
- try {
57
- // Construct authentication request body
58
- Map<String, String> requestBody = new HashMap<>();
59
- requestBody.put("partnerId", PARTNER_ID);
60
- requestBody.put("grantType", "api_key");
61
-
62
- // Make authentication request
63
- AuthResponse response = webClient.post()
64
- .uri("/v1/auth/token")
65
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
66
- .header("x-api-key", API_KEY)
67
- .bodyValue(requestBody)
68
- .retrieve()
69
- .onStatus(
70
- status -> !status.is2xxSuccessful(),
71
- clientResponse -> clientResponse.bodyToMono(String.class)
72
- .flatMap(errorBody -> Mono.error(
73
- new RuntimeException(
74
- "Authentication failed: " +
75
- clientResponse.statusCode() +
76
- " - " + errorBody
77
- )
78
- ))
79
- )
80
- .bodyToMono(AuthResponse.class)
81
- .block();
82
-
83
- if (response == null || response.getToken() == null) {
84
- throw new RuntimeException("No token received from authentication");
85
- }
86
-
87
- System.out.println("Authentication successful!");
88
- System.out.println("Token expires in: " + response.getExpiresIn() + " seconds");
89
-
90
- return response.getToken();
91
-
92
- } catch (Exception e) {
93
- System.err.println("Authentication error: " + e.getMessage());
94
- throw e;
95
- }
96
- }
97
-
98
- /**
99
- * Example: Use token in subsequent API requests
100
- *
101
- * @param token Access token from authenticate()
102
- * @return API response
103
- */
104
- public Map<String, Object> exampleApiCall(String token) {
105
- return webClient.get()
106
- .uri("/v1/menus")
107
- .header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
108
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
109
- .retrieve()
110
- .onStatus(
111
- status -> !status.is2xxSuccessful(),
112
- clientResponse -> Mono.error(
113
- new RuntimeException("API call failed: " + clientResponse.statusCode())
114
- )
115
- )
116
- .bodyToMono(Map.class)
117
- .block();
118
- }
119
-
120
- /**
121
- * Response model for authentication endpoint
122
- */
123
- public static class AuthResponse {
124
- private String token;
125
- private int expiresIn;
126
- private String tokenType;
127
-
128
- // Getters and setters
129
- public String getToken() { return token; }
130
- public void setToken(String token) { this.token = token; }
131
-
132
- public int getExpiresIn() { return expiresIn; }
133
- public void setExpiresIn(int expiresIn) { this.expiresIn = expiresIn; }
134
-
135
- public String getTokenType() { return tokenType; }
136
- public void setTokenType(String tokenType) { this.tokenType = tokenType; }
137
- }
138
-
139
- // Main method for testing
140
- public static void main(String[] args) {
141
- try {
142
- GrubtechAuthentication auth = new GrubtechAuthentication();
143
-
144
- // Authenticate and get token
145
- String token = auth.authenticate();
146
-
147
- // Use token for API calls
148
- Map<String, Object> menus = auth.exampleApiCall(token);
149
- System.out.println("Menus: " + menus);
150
-
151
- } catch (Exception e) {
152
- System.exit(1);
153
- }
154
- }
155
- }