faf-cli 3.0.1 → 3.0.3
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/README.md +177 -31
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +46 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/auto.d.ts.map +1 -1
- package/dist/commands/auto.js +102 -0
- package/dist/commands/auto.js.map +1 -1
- package/dist/commands/fam.d.ts +15 -0
- package/dist/commands/fam.d.ts.map +1 -0
- package/dist/commands/fam.js +247 -0
- package/dist/commands/fam.js.map +1 -0
- package/dist/compiler/faf-compiler.d.ts.map +1 -1
- package/dist/compiler/faf-compiler.js +76 -4
- package/dist/compiler/faf-compiler.js.map +1 -1
- package/dist/core/platform-adapters.d.ts +76 -0
- package/dist/core/platform-adapters.d.ts.map +1 -0
- package/dist/core/platform-adapters.js +407 -0
- package/dist/core/platform-adapters.js.map +1 -0
- package/dist/core/universal-intelligence-generator.d.ts +156 -0
- package/dist/core/universal-intelligence-generator.d.ts.map +1 -0
- package/dist/core/universal-intelligence-generator.js +352 -0
- package/dist/core/universal-intelligence-generator.js.map +1 -0
- package/dist/family/detectors/n8n.d.ts +10 -0
- package/dist/family/detectors/n8n.d.ts.map +1 -0
- package/dist/family/detectors/n8n.js +95 -0
- package/dist/family/detectors/n8n.js.map +1 -0
- package/dist/family/detectors/next.d.ts +8 -0
- package/dist/family/detectors/next.d.ts.map +1 -0
- package/dist/family/detectors/next.js +86 -0
- package/dist/family/detectors/next.js.map +1 -0
- package/dist/family/detectors/react.d.ts +8 -0
- package/dist/family/detectors/react.d.ts.map +1 -0
- package/dist/family/detectors/react.js +73 -0
- package/dist/family/detectors/react.js.map +1 -0
- package/dist/family/detectors/svelte.d.ts +8 -0
- package/dist/family/detectors/svelte.d.ts.map +1 -0
- package/dist/family/detectors/svelte.js +90 -0
- package/dist/family/detectors/svelte.js.map +1 -0
- package/dist/family/detectors/typescript.d.ts +8 -0
- package/dist/family/detectors/typescript.d.ts.map +1 -0
- package/dist/family/detectors/typescript.js +102 -0
- package/dist/family/detectors/typescript.js.map +1 -0
- package/dist/family/detectors/vite.d.ts +8 -0
- package/dist/family/detectors/vite.d.ts.map +1 -0
- package/dist/family/detectors/vite.js +89 -0
- package/dist/family/detectors/vite.js.map +1 -0
- package/dist/family/index.d.ts +21 -0
- package/dist/family/index.d.ts.map +1 -0
- package/dist/family/index.js +73 -0
- package/dist/family/index.js.map +1 -0
- package/dist/family/registry.d.ts +57 -0
- package/dist/family/registry.d.ts.map +1 -0
- package/dist/family/registry.js +154 -0
- package/dist/family/registry.js.map +1 -0
- package/dist/family/types.d.ts +94 -0
- package/dist/family/types.d.ts.map +1 -0
- package/dist/family/types.js +8 -0
- package/dist/family/types.js.map +1 -0
- package/dist/tests/manual-validation.d.ts +8 -0
- package/dist/tests/manual-validation.d.ts.map +1 -0
- package/dist/tests/manual-validation.js +114 -0
- package/dist/tests/manual-validation.js.map +1 -0
- package/dist/utils/file-utils.d.ts +38 -0
- package/dist/utils/file-utils.d.ts.map +1 -1
- package/dist/utils/file-utils.js +148 -0
- package/dist/utils/file-utils.js.map +1 -1
- package/package.json +21 -4
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🏆 PLATFORM ADAPTERS
|
|
3
|
+
*
|
|
4
|
+
* Each platform (Opal, Make.com, etc.) is just an input adapter
|
|
5
|
+
* The pattern is ALWAYS the same: interrogation → extraction → filtering → generation
|
|
6
|
+
* The output is ALWAYS .faf
|
|
7
|
+
*
|
|
8
|
+
* FOUNDATIONAL FIRST, UNIVERSAL BY DEFAULT
|
|
9
|
+
*/
|
|
10
|
+
import { UniversalIntelligenceGenerator, RawIntelligence, StructuredIntelligence } from './universal-intelligence-generator';
|
|
11
|
+
/**
|
|
12
|
+
* Google Opal Mini-App Generator
|
|
13
|
+
*
|
|
14
|
+
* Opal format: Visual node-based mini-apps
|
|
15
|
+
* Architecture: User inputs → prompts → AI model calls → outputs
|
|
16
|
+
*/
|
|
17
|
+
export declare class OpalMiniAppGenerator extends UniversalIntelligenceGenerator {
|
|
18
|
+
detect(filePath: string): Promise<boolean>;
|
|
19
|
+
extract(filePath: string): Promise<RawIntelligence>;
|
|
20
|
+
filter(raw: RawIntelligence): Promise<StructuredIntelligence>;
|
|
21
|
+
private detectOpalPattern;
|
|
22
|
+
private extractInputs;
|
|
23
|
+
private extractOutputs;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Make.com Scenario Generator
|
|
27
|
+
*
|
|
28
|
+
* Make format: Blueprint JSON with 'name', 'flow', and 'metadata'
|
|
29
|
+
* Architecture: Triggers → modules (in flow array) → actions
|
|
30
|
+
*
|
|
31
|
+
* Actual Make.com Blueprint Structure (validated 2025-10-10):
|
|
32
|
+
* {
|
|
33
|
+
* "name": "Scenario Name",
|
|
34
|
+
* "flow": [ // Array of module objects
|
|
35
|
+
* {
|
|
36
|
+
* "id": 1,
|
|
37
|
+
* "module": "gateway:CustomWebHook",
|
|
38
|
+
* "version": 1,
|
|
39
|
+
* "metadata": { "designer": { "x": 0, "y": 0 } }
|
|
40
|
+
* }
|
|
41
|
+
* ],
|
|
42
|
+
* "metadata": {
|
|
43
|
+
* "version": 1,
|
|
44
|
+
* "scenario": { "roundtrips": 1, "maxErrors": 3, ... },
|
|
45
|
+
* "designer": { "orphans": [] }
|
|
46
|
+
* },
|
|
47
|
+
* "scheduling": { "type": "indefinitely", "interval": 15 },
|
|
48
|
+
* "created": "ISO timestamp",
|
|
49
|
+
* "last_edit": "ISO timestamp"
|
|
50
|
+
* }
|
|
51
|
+
*/
|
|
52
|
+
export declare class MakeScenarioGenerator extends UniversalIntelligenceGenerator {
|
|
53
|
+
detect(filePath: string): Promise<boolean>;
|
|
54
|
+
extract(filePath: string): Promise<RawIntelligence>;
|
|
55
|
+
filter(raw: RawIntelligence): Promise<StructuredIntelligence>;
|
|
56
|
+
private detectMakePattern;
|
|
57
|
+
private extractTriggers;
|
|
58
|
+
private extractActions;
|
|
59
|
+
private extractIntegrations;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Code Project Generator
|
|
63
|
+
*
|
|
64
|
+
* Handles traditional code projects (package.json, requirements.txt, etc.)
|
|
65
|
+
* This is what FAF already does well - just formalizing it in the universal pattern
|
|
66
|
+
*/
|
|
67
|
+
export declare class CodeProjectGenerator extends UniversalIntelligenceGenerator {
|
|
68
|
+
detect(filePath: string): Promise<boolean>;
|
|
69
|
+
extract(filePath: string): Promise<RawIntelligence>;
|
|
70
|
+
filter(raw: RawIntelligence): Promise<StructuredIntelligence>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Export all adapters for registration
|
|
74
|
+
*/
|
|
75
|
+
export declare const PLATFORM_ADAPTERS: readonly [typeof OpalMiniAppGenerator, typeof MakeScenarioGenerator, typeof CodeProjectGenerator];
|
|
76
|
+
//# sourceMappingURL=platform-adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-adapters.d.ts","sourceRoot":"","sources":["../../src/core/platform-adapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,8BAA8B,EAC9B,eAAe,EACf,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,8BAA8B;IAEhE,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAc1C,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAuBnD,MAAM,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAgDnE,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,cAAc;CAGvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,qBAAsB,SAAQ,8BAA8B;IAEjE,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAc1C,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IA2BnD,MAAM,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAiDnE,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,mBAAmB;CAc5B;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,8BAA8B;IAEhE,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAsB1C,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAyBnD,MAAM,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,sBAAsB,CAAC;CA8CpE;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,mGAIpB,CAAC"}
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 🏆 PLATFORM ADAPTERS
|
|
4
|
+
*
|
|
5
|
+
* Each platform (Opal, Make.com, etc.) is just an input adapter
|
|
6
|
+
* The pattern is ALWAYS the same: interrogation → extraction → filtering → generation
|
|
7
|
+
* The output is ALWAYS .faf
|
|
8
|
+
*
|
|
9
|
+
* FOUNDATIONAL FIRST, UNIVERSAL BY DEFAULT
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.PLATFORM_ADAPTERS = exports.CodeProjectGenerator = exports.MakeScenarioGenerator = exports.OpalMiniAppGenerator = void 0;
|
|
46
|
+
const universal_intelligence_generator_1 = require("./universal-intelligence-generator");
|
|
47
|
+
/**
|
|
48
|
+
* Google Opal Mini-App Generator
|
|
49
|
+
*
|
|
50
|
+
* Opal format: Visual node-based mini-apps
|
|
51
|
+
* Architecture: User inputs → prompts → AI model calls → outputs
|
|
52
|
+
*/
|
|
53
|
+
class OpalMiniAppGenerator extends universal_intelligence_generator_1.UniversalIntelligenceGenerator {
|
|
54
|
+
async detect(filePath) {
|
|
55
|
+
// Detect Opal mini-app config
|
|
56
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
57
|
+
try {
|
|
58
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
59
|
+
const json = JSON.parse(content);
|
|
60
|
+
// Opal configs have 'steps' and 'model' fields (hypothetical structure)
|
|
61
|
+
return !!(json.steps && json.model);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async extract(filePath) {
|
|
68
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
69
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
70
|
+
const opalConfig = JSON.parse(content);
|
|
71
|
+
return {
|
|
72
|
+
data: {
|
|
73
|
+
config: opalConfig,
|
|
74
|
+
pattern: this.detectOpalPattern(opalConfig),
|
|
75
|
+
steps: opalConfig.steps || [],
|
|
76
|
+
model: opalConfig.model,
|
|
77
|
+
inputs: this.extractInputs(opalConfig),
|
|
78
|
+
outputs: this.extractOutputs(opalConfig),
|
|
79
|
+
},
|
|
80
|
+
confidence: 85,
|
|
81
|
+
metadata: {
|
|
82
|
+
source_type: 'opal-miniapp',
|
|
83
|
+
source_file: filePath,
|
|
84
|
+
extracted_at: new Date().toISOString(),
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
async filter(raw) {
|
|
89
|
+
const { config, pattern, steps, model } = raw.data;
|
|
90
|
+
const structured = {
|
|
91
|
+
project: {
|
|
92
|
+
name: config.name || 'Opal Mini-App',
|
|
93
|
+
type: 'opal-miniapp',
|
|
94
|
+
goal: config.description || 'AI-powered mini-application',
|
|
95
|
+
},
|
|
96
|
+
architecture: {
|
|
97
|
+
pattern,
|
|
98
|
+
components: steps.map((s) => s.type || s.action),
|
|
99
|
+
},
|
|
100
|
+
tech_stack: {
|
|
101
|
+
platform: 'Google Opal',
|
|
102
|
+
ai_model: model || 'Gemini',
|
|
103
|
+
},
|
|
104
|
+
human_context: {
|
|
105
|
+
who: 'Opal Mini-App Creator',
|
|
106
|
+
what: config.name || 'Opal Mini-App',
|
|
107
|
+
why: config.description || 'AI-powered task automation',
|
|
108
|
+
where: 'Google Opal Platform',
|
|
109
|
+
when: 'Development',
|
|
110
|
+
how: `Visual workflow with ${steps.length} steps using ${model}`,
|
|
111
|
+
},
|
|
112
|
+
source_data: raw.data,
|
|
113
|
+
scores: this.calculateScores({
|
|
114
|
+
project: {
|
|
115
|
+
name: config.name,
|
|
116
|
+
type: 'opal-miniapp',
|
|
117
|
+
goal: config.description,
|
|
118
|
+
},
|
|
119
|
+
human_context: {
|
|
120
|
+
who: 'Opal Mini-App Creator',
|
|
121
|
+
what: config.name,
|
|
122
|
+
why: config.description,
|
|
123
|
+
where: 'Google Opal Platform',
|
|
124
|
+
when: 'Development',
|
|
125
|
+
how: `Visual workflow with ${steps.length} steps`,
|
|
126
|
+
},
|
|
127
|
+
}),
|
|
128
|
+
generated: new Date().toISOString(),
|
|
129
|
+
faf_version: '3.0.1',
|
|
130
|
+
};
|
|
131
|
+
return structured;
|
|
132
|
+
}
|
|
133
|
+
detectOpalPattern(config) {
|
|
134
|
+
// Pattern detection based on steps
|
|
135
|
+
const stepTypes = (config.steps || []).map((s) => s.type || s.action);
|
|
136
|
+
if (stepTypes.includes('research') || stepTypes.includes('search')) {
|
|
137
|
+
return 'Research Assistant';
|
|
138
|
+
}
|
|
139
|
+
if (stepTypes.includes('image')) {
|
|
140
|
+
return 'Image Generation';
|
|
141
|
+
}
|
|
142
|
+
if (stepTypes.includes('text')) {
|
|
143
|
+
return 'Text Processing';
|
|
144
|
+
}
|
|
145
|
+
return 'Generic Mini-App';
|
|
146
|
+
}
|
|
147
|
+
extractInputs(config) {
|
|
148
|
+
return (config.inputs || []).map((i) => i.name || i.label);
|
|
149
|
+
}
|
|
150
|
+
extractOutputs(config) {
|
|
151
|
+
return (config.outputs || []).map((o) => o.type || o.format);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.OpalMiniAppGenerator = OpalMiniAppGenerator;
|
|
155
|
+
/**
|
|
156
|
+
* Make.com Scenario Generator
|
|
157
|
+
*
|
|
158
|
+
* Make format: Blueprint JSON with 'name', 'flow', and 'metadata'
|
|
159
|
+
* Architecture: Triggers → modules (in flow array) → actions
|
|
160
|
+
*
|
|
161
|
+
* Actual Make.com Blueprint Structure (validated 2025-10-10):
|
|
162
|
+
* {
|
|
163
|
+
* "name": "Scenario Name",
|
|
164
|
+
* "flow": [ // Array of module objects
|
|
165
|
+
* {
|
|
166
|
+
* "id": 1,
|
|
167
|
+
* "module": "gateway:CustomWebHook",
|
|
168
|
+
* "version": 1,
|
|
169
|
+
* "metadata": { "designer": { "x": 0, "y": 0 } }
|
|
170
|
+
* }
|
|
171
|
+
* ],
|
|
172
|
+
* "metadata": {
|
|
173
|
+
* "version": 1,
|
|
174
|
+
* "scenario": { "roundtrips": 1, "maxErrors": 3, ... },
|
|
175
|
+
* "designer": { "orphans": [] }
|
|
176
|
+
* },
|
|
177
|
+
* "scheduling": { "type": "indefinitely", "interval": 15 },
|
|
178
|
+
* "created": "ISO timestamp",
|
|
179
|
+
* "last_edit": "ISO timestamp"
|
|
180
|
+
* }
|
|
181
|
+
*/
|
|
182
|
+
class MakeScenarioGenerator extends universal_intelligence_generator_1.UniversalIntelligenceGenerator {
|
|
183
|
+
async detect(filePath) {
|
|
184
|
+
// Detect Make.com scenario blueprint export
|
|
185
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
186
|
+
try {
|
|
187
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
188
|
+
const json = JSON.parse(content);
|
|
189
|
+
// Make blueprints have 'name' and 'flow' (array of modules)
|
|
190
|
+
return !!(json.name && Array.isArray(json.flow) && json.metadata);
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
async extract(filePath) {
|
|
197
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
198
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
199
|
+
const blueprint = JSON.parse(content);
|
|
200
|
+
// Extract modules from flow array
|
|
201
|
+
const modules = blueprint.flow || [];
|
|
202
|
+
return {
|
|
203
|
+
data: {
|
|
204
|
+
blueprint,
|
|
205
|
+
pattern: this.detectMakePattern(blueprint),
|
|
206
|
+
modules,
|
|
207
|
+
triggers: this.extractTriggers(modules),
|
|
208
|
+
actions: this.extractActions(modules),
|
|
209
|
+
integrations: this.extractIntegrations(modules),
|
|
210
|
+
scheduling: blueprint.scheduling,
|
|
211
|
+
},
|
|
212
|
+
confidence: 90,
|
|
213
|
+
metadata: {
|
|
214
|
+
source_type: 'make-scenario',
|
|
215
|
+
source_file: filePath,
|
|
216
|
+
extracted_at: new Date().toISOString(),
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
async filter(raw) {
|
|
221
|
+
const { blueprint, pattern, modules, triggers, actions, integrations, scheduling } = raw.data;
|
|
222
|
+
const structured = {
|
|
223
|
+
project: {
|
|
224
|
+
name: blueprint.name || 'Make.com Scenario',
|
|
225
|
+
type: 'make-scenario',
|
|
226
|
+
goal: `${pattern} connecting ${integrations.length} services`,
|
|
227
|
+
},
|
|
228
|
+
architecture: {
|
|
229
|
+
pattern,
|
|
230
|
+
components: modules.map((m) => m.module || m.type),
|
|
231
|
+
},
|
|
232
|
+
tech_stack: {
|
|
233
|
+
platform: 'Make.com',
|
|
234
|
+
integrations: integrations.join(', '),
|
|
235
|
+
scheduling: scheduling?.type || 'Manual',
|
|
236
|
+
},
|
|
237
|
+
human_context: {
|
|
238
|
+
who: 'Make.com User',
|
|
239
|
+
what: blueprint.name || 'Make.com Scenario',
|
|
240
|
+
why: `Automate ${pattern.toLowerCase()} workflow`,
|
|
241
|
+
where: 'Make.com Cloud Platform',
|
|
242
|
+
when: scheduling?.type === 'indefinitely' ? `Every ${scheduling.interval} minutes` : 'Manual trigger',
|
|
243
|
+
how: `${modules.length} modules connecting ${integrations.length} services`,
|
|
244
|
+
},
|
|
245
|
+
source_data: raw.data,
|
|
246
|
+
scores: this.calculateScores({
|
|
247
|
+
project: {
|
|
248
|
+
name: blueprint.name,
|
|
249
|
+
type: 'make-scenario',
|
|
250
|
+
goal: `${pattern} connecting ${integrations.length} services`,
|
|
251
|
+
},
|
|
252
|
+
human_context: {
|
|
253
|
+
who: 'Make.com User',
|
|
254
|
+
what: blueprint.name,
|
|
255
|
+
why: `Automate ${pattern.toLowerCase()} workflow`,
|
|
256
|
+
where: 'Make.com Cloud Platform',
|
|
257
|
+
when: scheduling?.type || 'Manual',
|
|
258
|
+
how: `${modules.length} modules`,
|
|
259
|
+
},
|
|
260
|
+
}),
|
|
261
|
+
generated: new Date().toISOString(),
|
|
262
|
+
faf_version: '3.0.1',
|
|
263
|
+
};
|
|
264
|
+
return structured;
|
|
265
|
+
}
|
|
266
|
+
detectMakePattern(blueprint) {
|
|
267
|
+
const modules = blueprint.flow || [];
|
|
268
|
+
const moduleTypes = modules.map((m) => m.module || '');
|
|
269
|
+
if (moduleTypes.some((t) => t.includes('WebHook'))) {
|
|
270
|
+
return 'Webhook-triggered Automation';
|
|
271
|
+
}
|
|
272
|
+
if (blueprint.scheduling?.type === 'indefinitely') {
|
|
273
|
+
return 'Scheduled Automation';
|
|
274
|
+
}
|
|
275
|
+
if (moduleTypes.some((t) => t.toLowerCase().includes('openai') || t.toLowerCase().includes('anthropic'))) {
|
|
276
|
+
return 'AI-powered Automation';
|
|
277
|
+
}
|
|
278
|
+
if (moduleTypes.some((t) => t.includes('HTTP'))) {
|
|
279
|
+
return 'API Integration';
|
|
280
|
+
}
|
|
281
|
+
return 'General Automation';
|
|
282
|
+
}
|
|
283
|
+
extractTriggers(modules) {
|
|
284
|
+
// First module is typically the trigger in Make.com
|
|
285
|
+
return modules.length > 0 ? [modules[0]] : [];
|
|
286
|
+
}
|
|
287
|
+
extractActions(modules) {
|
|
288
|
+
// All modules except the first (trigger)
|
|
289
|
+
return modules.slice(1);
|
|
290
|
+
}
|
|
291
|
+
extractIntegrations(modules) {
|
|
292
|
+
const services = new Set();
|
|
293
|
+
modules.forEach((m) => {
|
|
294
|
+
// Module format: "app:ModuleName" (e.g., "gateway:CustomWebHook")
|
|
295
|
+
const moduleName = m.module || '';
|
|
296
|
+
const app = moduleName.split(':')[0];
|
|
297
|
+
if (app && app !== 'builtin') {
|
|
298
|
+
services.add(app);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
return Array.from(services);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
exports.MakeScenarioGenerator = MakeScenarioGenerator;
|
|
305
|
+
/**
|
|
306
|
+
* Code Project Generator
|
|
307
|
+
*
|
|
308
|
+
* Handles traditional code projects (package.json, requirements.txt, etc.)
|
|
309
|
+
* This is what FAF already does well - just formalizing it in the universal pattern
|
|
310
|
+
*/
|
|
311
|
+
class CodeProjectGenerator extends universal_intelligence_generator_1.UniversalIntelligenceGenerator {
|
|
312
|
+
async detect(filePath) {
|
|
313
|
+
// Detect if this is a project directory with package.json, requirements.txt, etc.
|
|
314
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
|
|
315
|
+
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
316
|
+
try {
|
|
317
|
+
const stats = await fs.stat(filePath);
|
|
318
|
+
if (!stats.isDirectory())
|
|
319
|
+
return false;
|
|
320
|
+
// Check for common project files
|
|
321
|
+
const files = await fs.readdir(filePath);
|
|
322
|
+
return files.some(f => f === 'package.json' ||
|
|
323
|
+
f === 'requirements.txt' ||
|
|
324
|
+
f === 'Cargo.toml' ||
|
|
325
|
+
f === 'go.mod');
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
async extract(filePath) {
|
|
332
|
+
// Use existing framework detector
|
|
333
|
+
const { detectFramework } = await Promise.resolve().then(() => __importStar(require('../framework-detector')));
|
|
334
|
+
const detection = await detectFramework(filePath);
|
|
335
|
+
// Use existing TURBO-CAT for format discovery
|
|
336
|
+
const { getAllFormats } = await Promise.resolve().then(() => __importStar(require('../utils/turbo-cat-pyramid')));
|
|
337
|
+
const formats = getAllFormats();
|
|
338
|
+
return {
|
|
339
|
+
data: {
|
|
340
|
+
framework: detection.framework,
|
|
341
|
+
language: detection.language,
|
|
342
|
+
ecosystem: detection.ecosystem,
|
|
343
|
+
formats: formats.slice(0, 10), // Sample
|
|
344
|
+
},
|
|
345
|
+
confidence: detection.confidence,
|
|
346
|
+
metadata: {
|
|
347
|
+
source_type: 'code-project',
|
|
348
|
+
source_file: filePath,
|
|
349
|
+
extracted_at: new Date().toISOString(),
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
async filter(raw) {
|
|
354
|
+
const { framework, language, ecosystem } = raw.data;
|
|
355
|
+
// This would integrate with existing `faf init` flow
|
|
356
|
+
// For now, minimal structure:
|
|
357
|
+
const structured = {
|
|
358
|
+
project: {
|
|
359
|
+
name: 'Code Project',
|
|
360
|
+
type: 'code-project',
|
|
361
|
+
goal: `${framework} application`,
|
|
362
|
+
main_language: language,
|
|
363
|
+
},
|
|
364
|
+
tech_stack: {
|
|
365
|
+
framework,
|
|
366
|
+
language,
|
|
367
|
+
ecosystem,
|
|
368
|
+
},
|
|
369
|
+
human_context: {
|
|
370
|
+
who: 'Developer',
|
|
371
|
+
what: `${framework} application`,
|
|
372
|
+
why: 'Software development',
|
|
373
|
+
where: 'Development',
|
|
374
|
+
when: 'In progress',
|
|
375
|
+
how: `Using ${framework} with ${language}`,
|
|
376
|
+
},
|
|
377
|
+
scores: this.calculateScores({
|
|
378
|
+
project: {
|
|
379
|
+
name: 'Code Project',
|
|
380
|
+
type: 'code-project',
|
|
381
|
+
goal: `${framework} application`,
|
|
382
|
+
},
|
|
383
|
+
human_context: {
|
|
384
|
+
who: 'Developer',
|
|
385
|
+
what: `${framework} application`,
|
|
386
|
+
why: 'Software development',
|
|
387
|
+
where: 'Development',
|
|
388
|
+
when: 'In progress',
|
|
389
|
+
how: `Using ${framework}`,
|
|
390
|
+
},
|
|
391
|
+
}),
|
|
392
|
+
generated: new Date().toISOString(),
|
|
393
|
+
faf_version: '3.0.1',
|
|
394
|
+
};
|
|
395
|
+
return structured;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
exports.CodeProjectGenerator = CodeProjectGenerator;
|
|
399
|
+
/**
|
|
400
|
+
* Export all adapters for registration
|
|
401
|
+
*/
|
|
402
|
+
exports.PLATFORM_ADAPTERS = [
|
|
403
|
+
OpalMiniAppGenerator,
|
|
404
|
+
MakeScenarioGenerator,
|
|
405
|
+
CodeProjectGenerator,
|
|
406
|
+
];
|
|
407
|
+
//# sourceMappingURL=platform-adapters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-adapters.js","sourceRoot":"","sources":["../../src/core/platform-adapters.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yFAI4C;AAE5C;;;;;GAKG;AACH,MAAa,oBAAqB,SAAQ,iEAA8B;IAEtE,KAAK,CAAC,MAAM,CAAC,QAAgB;QAC3B,8BAA8B;QAC9B,MAAM,EAAE,GAAG,wDAAa,aAAa,GAAC,CAAC;QACvC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACrD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAEjC,wEAAwE;YACxE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,KAAK,C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pB,IAAI,EAAE,aAAa;gBACnB,GAAG,EAAE,SAAS,SAAS,SAAS,QAAQ,EAAE;aAC3C;YACD,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC;gBAC3B,OAAO,EAAE;oBACP,IAAI,EAAE,cAAc;oBACpB,IAAI,EAAE,cAAc;oBACpB,IAAI,EAAE,GAAG,SAAS,cAAc;iBACjC;gBACD,aAAa,EAAE;oBACb,GAAG,EAAE,WAAW;oBAChB,IAAI,EAAE,GAAG,SAAS,cAAc;oBAChC,GAAG,EAAE,sBAAsB;oBAC3B,KAAK,EAAE,aAAa;oBACpB,IAAI,EAAE,aAAa;oBACnB,GAAG,EAAE,SAAS,SAAS,EAAE;iBAC1B;aACF,CAAC;YACF,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,WAAW,EAAE,OAAO;SACrB,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AA/FD,oDA+FC;AAED;;GAEG;AACU,QAAA,iBAAiB,GAAG;IAC/B,oBAAoB;IACpB,qBAAqB;IACrB,oBAAoB;CACZ,CAAC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🏆 UNIVERSAL INTELLIGENCE GENERATOR
|
|
3
|
+
*
|
|
4
|
+
* THE foundational pattern that applies to EVERYTHING:
|
|
5
|
+
* - Code projects (package.json, tsconfig, etc.)
|
|
6
|
+
* - Automation workflows (n8n, Make, Opal, OpenAI)
|
|
7
|
+
* - Documentation centers (markdown, wikis)
|
|
8
|
+
* - API specifications (OpenAPI, GraphQL)
|
|
9
|
+
* - ANY project that needs AI context
|
|
10
|
+
*
|
|
11
|
+
* Pattern: interrogation → extraction → filtering → generation
|
|
12
|
+
* Output: ALWAYS .faf (universal container for structured intelligence)
|
|
13
|
+
*
|
|
14
|
+
* FOUNDATIONAL FIRST, UNIVERSAL BY DEFAULT
|
|
15
|
+
*/
|
|
16
|
+
export interface IntelligenceSource {
|
|
17
|
+
type: SourceType;
|
|
18
|
+
filePath: string;
|
|
19
|
+
metadata?: Record<string, any>;
|
|
20
|
+
}
|
|
21
|
+
export type SourceType = 'code-project' | 'n8n-workflow' | 'make-scenario' | 'opal-miniapp' | 'openai-assistant' | 'documentation' | 'api-spec' | 'custom';
|
|
22
|
+
export interface RawIntelligence {
|
|
23
|
+
data: any;
|
|
24
|
+
confidence: number;
|
|
25
|
+
metadata: {
|
|
26
|
+
source_type: SourceType;
|
|
27
|
+
source_file: string;
|
|
28
|
+
extracted_at: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface StructuredIntelligence {
|
|
32
|
+
project: {
|
|
33
|
+
name: string;
|
|
34
|
+
type: string;
|
|
35
|
+
goal: string;
|
|
36
|
+
main_language?: string;
|
|
37
|
+
};
|
|
38
|
+
architecture?: {
|
|
39
|
+
pattern: string;
|
|
40
|
+
components: string[];
|
|
41
|
+
};
|
|
42
|
+
tech_stack?: Record<string, string>;
|
|
43
|
+
human_context: {
|
|
44
|
+
who: string;
|
|
45
|
+
what: string;
|
|
46
|
+
why: string;
|
|
47
|
+
where: string;
|
|
48
|
+
when: string;
|
|
49
|
+
how: string;
|
|
50
|
+
};
|
|
51
|
+
source_data?: any;
|
|
52
|
+
scores: {
|
|
53
|
+
faf_score: number;
|
|
54
|
+
ai_compatibility_score: number;
|
|
55
|
+
completeness_score: number;
|
|
56
|
+
};
|
|
57
|
+
generated: string;
|
|
58
|
+
faf_version: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Base class implementing the universal pattern
|
|
62
|
+
*
|
|
63
|
+
* All input adapters (n8n, Make, Opal, etc.) extend this
|
|
64
|
+
*/
|
|
65
|
+
export declare abstract class UniversalIntelligenceGenerator {
|
|
66
|
+
/**
|
|
67
|
+
* PHASE 1: INTERROGATION
|
|
68
|
+
*
|
|
69
|
+
* "What is this? What type of intelligence source?"
|
|
70
|
+
*
|
|
71
|
+
* Detects the input type and determines if we can process it
|
|
72
|
+
*/
|
|
73
|
+
abstract detect(filePath: string): Promise<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* PHASE 2: EXTRACTION
|
|
76
|
+
*
|
|
77
|
+
* "Pull the raw intelligence from the source"
|
|
78
|
+
*
|
|
79
|
+
* Platform-specific parsing happens here
|
|
80
|
+
* Output is raw, unstructured data
|
|
81
|
+
*/
|
|
82
|
+
abstract extract(filePath: string): Promise<RawIntelligence>;
|
|
83
|
+
/**
|
|
84
|
+
* PHASE 3: FILTERING
|
|
85
|
+
*
|
|
86
|
+
* "Transform raw data → structured intelligence"
|
|
87
|
+
* "Validate, score, enrich"
|
|
88
|
+
*
|
|
89
|
+
* This is where POOR → RICH transformation happens:
|
|
90
|
+
* - Auto-correct typos
|
|
91
|
+
* - Fill missing context (6 W's)
|
|
92
|
+
* - Ask clarifying questions (minimal friction)
|
|
93
|
+
* - Calculate quality scores
|
|
94
|
+
*/
|
|
95
|
+
abstract filter(raw: RawIntelligence): Promise<StructuredIntelligence>;
|
|
96
|
+
/**
|
|
97
|
+
* PHASE 4: GENERATION
|
|
98
|
+
*
|
|
99
|
+
* "Output championship .faf"
|
|
100
|
+
*
|
|
101
|
+
* Converts structured intelligence → YAML .faf file
|
|
102
|
+
* Target: 85%+ score (🥉 Bronze or better)
|
|
103
|
+
*/
|
|
104
|
+
generate(intelligence: StructuredIntelligence): string;
|
|
105
|
+
/**
|
|
106
|
+
* THE COMPLETE FLOW
|
|
107
|
+
*
|
|
108
|
+
* Orchestrates all 4 phases
|
|
109
|
+
*/
|
|
110
|
+
process(filePath: string): Promise<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Helper: Convert structured intelligence → YAML
|
|
113
|
+
*/
|
|
114
|
+
protected toYAML(intelligence: StructuredIntelligence): string;
|
|
115
|
+
/**
|
|
116
|
+
* Helper: Calculate quality scores
|
|
117
|
+
*
|
|
118
|
+
* Used in FILTERING phase
|
|
119
|
+
*/
|
|
120
|
+
protected calculateScores(data: Partial<StructuredIntelligence>): {
|
|
121
|
+
faf_score: number;
|
|
122
|
+
ai_compatibility_score: number;
|
|
123
|
+
completeness_score: number;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Example: n8n Workflow Intelligence Generator
|
|
128
|
+
*
|
|
129
|
+
* Extends the universal pattern for n8n-specific processing
|
|
130
|
+
*/
|
|
131
|
+
export declare class N8nIntelligenceGenerator extends UniversalIntelligenceGenerator {
|
|
132
|
+
detect(filePath: string): Promise<boolean>;
|
|
133
|
+
extract(filePath: string): Promise<RawIntelligence>;
|
|
134
|
+
filter(raw: RawIntelligence): Promise<StructuredIntelligence>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Example: OpenAI Assistant Intelligence Generator
|
|
138
|
+
*
|
|
139
|
+
* Same universal pattern, different input adapter
|
|
140
|
+
*/
|
|
141
|
+
export declare class OpenAIAssistantGenerator extends UniversalIntelligenceGenerator {
|
|
142
|
+
detect(filePath: string): Promise<boolean>;
|
|
143
|
+
extract(filePath: string): Promise<RawIntelligence>;
|
|
144
|
+
filter(raw: RawIntelligence): Promise<StructuredIntelligence>;
|
|
145
|
+
private extractActions;
|
|
146
|
+
private extractTools;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Factory: Auto-detect and return appropriate generator
|
|
150
|
+
*/
|
|
151
|
+
export declare function createGenerator(filePath: string): Promise<UniversalIntelligenceGenerator | null>;
|
|
152
|
+
/**
|
|
153
|
+
* Main entry point: Process any file → .faf
|
|
154
|
+
*/
|
|
155
|
+
export declare function generateFafFromAny(filePath: string): Promise<string>;
|
|
156
|
+
//# sourceMappingURL=universal-intelligence-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"universal-intelligence-generator.d.ts","sourceRoot":"","sources":["../../src/core/universal-intelligence-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE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