@appaflytech/zeyrek-ai-mcp 0.0.18 → 0.0.20
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 +13 -14
- package/dist/config.js +2 -0
- package/dist/knowledge/componentCatalog.js +204 -836
- package/dist/knowledge/componentEvents.js +75 -368
- package/dist/knowledge/mobileComponentCatalog.js +331 -0
- package/dist/knowledge/mobileComponentEvents.js +50 -0
- package/dist/knowledge/normalize.js +63 -66
- package/dist/knowledge/platform/lint.js +205 -0
- package/dist/knowledge/platform/mobile.js +78 -0
- package/dist/knowledge/platform/mobileRules.js +121 -0
- package/dist/knowledge/platform/mobileTabs.js +108 -0
- package/dist/knowledge/platform/profile.js +20 -0
- package/dist/knowledge/platform/resolve.js +122 -0
- package/dist/knowledge/platform/web.js +38 -0
- package/dist/knowledge/rules.js +6 -29
- package/dist/knowledge/styleResolve.js +1 -1
- package/dist/knowledge/styleResolveNative.js +410 -0
- package/dist/knowledge/themeResolve.js +3 -3
- package/dist/platform/capture/actions.js +333 -0
- package/dist/platform/capture/browser.js +1 -0
- package/dist/platform/{screenshot.js → capture/capture.js} +23 -509
- package/dist/platform/capture/index.js +10 -0
- package/dist/platform/capture/readiness.js +103 -0
- package/dist/platform/capture/summary.js +77 -0
- package/dist/platform/capture/target.js +5 -0
- package/dist/platform/capture/targets/studio-mobile.js +15 -0
- package/dist/platform/capture/targets/studio-web.js +5 -0
- package/dist/platform/domSummary.js +1 -1
- package/dist/platform/responses.js +1 -2
- package/dist/platform/strictArguments.js +2 -22
- package/dist/platform/writeDiff.js +31 -58
- package/dist/resources/examples/mobile-app-shell-drawer.json +209 -0
- package/dist/resources/examples/mobile-app-shell-stack.json +123 -0
- package/dist/resources/examples/mobile-app-shell-tab.json +174 -0
- package/dist/resources/examples/mobile-list-detail-form.json +656 -0
- package/dist/resources/guides/component.md +6 -9
- package/dist/resources/guides/functions.md +3 -32
- package/dist/resources/guides/getting-started.md +0 -35
- package/dist/resources/guides/layout.md +11 -7
- package/dist/resources/guides/mobile.md +215 -0
- package/dist/resources/guides/page.md +71 -49
- package/dist/resources/guides/translation.md +6 -5
- package/dist/resources/schema-fingerprint.json +2 -2
- package/dist/resources/schemas/GlobalFunctionUpdateResultDto.json +0 -18
- package/dist/server.js +2 -0
- package/dist/tools/applications.js +60 -3
- package/dist/tools/components.js +50 -10
- package/dist/tools/designSchemaPatch.js +18 -13
- package/dist/tools/externalComponents.js +25 -4
- package/dist/tools/flows.js +51 -38
- package/dist/tools/functions.js +10 -20
- package/dist/tools/layouts.js +41 -9
- package/dist/tools/microservices.js +11 -39
- package/dist/tools/mobile.js +203 -0
- package/dist/tools/pages.js +127 -95
- package/dist/tools/platformInfo.js +2 -1
- package/dist/tools/profileWrite.js +45 -0
- package/dist/tools/schemaOps.js +2 -2
- package/dist/tools/screenWrite.js +2 -2
- package/dist/tools/screens.js +9 -3
- package/dist/tools/workflows.js +12 -39
- package/package.json +2 -7
- package/dist/platform/diagnostics.js +0 -85
- package/dist/platform/ifExists.js +0 -129
- package/dist/platform/writeView.js +0 -17
package/dist/tools/flows.js
CHANGED
|
@@ -5,14 +5,14 @@ import { flowBindings, normalizeFlowSteps, targetlessSetterWarnings, unknownSett
|
|
|
5
5
|
import { flowBodyWarnings } from '../knowledge/coverage.js';
|
|
6
6
|
import { PlatformApiError } from '../platform/errors.js';
|
|
7
7
|
import { handle } from '../platform/responses.js';
|
|
8
|
-
import {
|
|
8
|
+
import { writeDiff, withWriteDiff } from '../platform/writeDiff.js';
|
|
9
9
|
import { resolvePatchOperations } from '../knowledge/outlines.js';
|
|
10
10
|
import { patchResult, baseVersionOf } from '../platform/patch.js';
|
|
11
11
|
import fastJsonPatch from 'fast-json-patch';
|
|
12
12
|
import { policyRules, flowExpressionSites } from '../knowledge/rules.js';
|
|
13
13
|
import { functionCallRefs } from '../knowledge/functionGuards.js';
|
|
14
|
-
import { existingMatch, ifExistsParam, platformRename, withRename } from '../platform/ifExists.js';
|
|
15
14
|
import { randomUUID } from 'node:crypto';
|
|
15
|
+
import { flowProfileWarnings } from './profileWrite.js';
|
|
16
16
|
import { z } from 'zod';
|
|
17
17
|
/**
|
|
18
18
|
* Akış yazması yanıtında gövdeyi geri döndürmüyor, bu yüzden diff için akışı bir kez okuruz.
|
|
@@ -20,18 +20,14 @@ import { z } from 'zod';
|
|
|
20
20
|
* `flow_create` 200 döndü, `flow_get` adımı gösterdi ama `args` içinde kodu taşıyan alan yoktu —
|
|
21
21
|
* teşhis ~10 dakika sürdü ve tek belirti filtrenin hiçbir şey yapmamasıydı. Okuma başarısız
|
|
22
22
|
* olursa yazma yine başarılıdır: diff bir teşhis eklentisidir, yazmanın sonucu değil.
|
|
23
|
-
*
|
|
24
|
-
* Okunan kayıt da döner: `ifExists:'duplicate'` yazmasında platform ada/slug'a ' (1)' ekler ve yanıtın
|
|
25
|
-
* gönderilen adı değil KAYDEDİLEN adı göstermesi gerekir (flow-upsert-ve-baglar S-10).
|
|
26
23
|
*/
|
|
27
|
-
async function flowWriteDrops(platform, host, project, environment, applicationId, hostId, flowId, sent
|
|
24
|
+
async function flowWriteDrops(platform, host, project, environment, applicationId, hostId, flowId, sent) {
|
|
28
25
|
try {
|
|
29
26
|
const saved = unwrap(await platform.tenant('GET', project, flowPath(host, applicationId, hostId, flowId), { environment }));
|
|
30
|
-
|
|
31
|
-
return { ...writeDiff(rename.sent, saved), saved, ...(rename.renamed ? { renamed: rename.renamed } : {}) };
|
|
27
|
+
return writeDiff(sent, saved);
|
|
32
28
|
}
|
|
33
29
|
catch {
|
|
34
|
-
return
|
|
30
|
+
return { dropped: [], normalized: [] };
|
|
35
31
|
}
|
|
36
32
|
}
|
|
37
33
|
const stepsParam = z.array(z.record(z.unknown())).describe("Adım listesi (StepManagementSchema: { stepId, name, type, kind, args, branches }). DİKKAT: branches[].nextStepId bir GUID değil, hedef adımın stepId STRING'idir; dal ADI motorun anahtarıdır ve start/setter/code/function adımlarında 'always' olmak zorundadır. Tam şablon: ngapps://examples/flow-load-table (ya da flow_get çıktısı); adım tipleri ve setter/parameters şekli platform_guide('page') Kural 1c. Kullanıcı fonksiyonu çağırmak için 'function' adımı: { type:'function', args:{ functionId:'<function_list id>', functionName:'<ad>', parameters:[{ name:'<bildirimdeki ad>', value:{ type:'static'|'property'|'storage'|'state'|'code', ref } }] } } → çıktı Steps.<adımAdı>.data (ngapps://examples/flow-call-function, platform_guide('functions')).");
|
|
@@ -74,7 +70,8 @@ function flowListResult(flows, record) {
|
|
|
74
70
|
...(danglingBindings.length > 0 ? { danglingBindings } : {})
|
|
75
71
|
};
|
|
76
72
|
}
|
|
77
|
-
const
|
|
73
|
+
const ifExistsParam = z.enum(['error', 'update', 'duplicate']).default('error').describe("Barındırıcıda aynı ad ya da slug'da (büyük/küçük harf duyarsız) akış varsa ne olacağı. 'error' (varsayılan): yazmaz, mevcut akışın id'sini döner. 'update': mevcut akışı bu gövdeyle günceller (id'si ve olay bağları korunur). 'duplicate': platformun ürün davranışı — ikinci kayıt açılır, platform ada/slug'a ' (1)' sayacını ekler (Studio'daki 'New Flow (1)' ile aynı kural).");
|
|
74
|
+
const upper = (value) => String(value ?? '').toUpperCase();
|
|
78
75
|
/**
|
|
79
76
|
* Barındırıcının akışları, önbelleksiz liste ucundan (`GET /pages|layouts/{id}/flows`). Layout ve
|
|
80
77
|
* sayfa tasarım kaydı önbellekten gelir ve zarfsız akış yazmasından sonra akışı hemen taşımaz;
|
|
@@ -107,21 +104,36 @@ async function listHostFlows(platform, host, project, environment, applicationId
|
|
|
107
104
|
* tam da zaman aşımında kopya üretirdi.
|
|
108
105
|
*/
|
|
109
106
|
async function existingFlowMatch(platform, host, project, environment, applicationId, hostId, hostRecord, name, slug, flowId, ifExists) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
});
|
|
107
|
+
if (ifExists === 'duplicate')
|
|
108
|
+
return undefined;
|
|
109
|
+
let flows;
|
|
110
|
+
try {
|
|
111
|
+
flows = await listHostFlows(platform, host, project, environment, applicationId, hostId, async () => hostRecord);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
throw new PlatformApiError(`FLOW-026: barındırıcının mevcut akışları okunamadı, akış YAZILMADI (${error instanceof Error ? error.message : String(error)}). Liste okunmadan yazmak aynı adla ikinci akış açabilir; flow_list ile tekrar deneyin ya da bilerek ikinci akış istiyorsanız ifExists:'duplicate' verin.`);
|
|
115
|
+
}
|
|
116
|
+
const matches = flows.filter(flow => upper(flow.name) === upper(name) || upper(flow.slug) === upper(slug));
|
|
117
|
+
const [match] = matches;
|
|
118
|
+
if (match === undefined)
|
|
119
|
+
return undefined;
|
|
120
|
+
const describe = (flow) => `${String(flow.id)} ('${String(flow.name)}', slug '${String(flow.slug)}')`;
|
|
121
|
+
const copyPattern = new RegExp(`^${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')} \\(\\d+\\)$`, 'i');
|
|
122
|
+
const copies = flows.filter(flow => copyPattern.test(String(flow.name ?? '')));
|
|
123
|
+
const copyNote = copies.length > 0
|
|
124
|
+
? ` Barındırıcıda bu adın sayaçlı eşleri de var: ${copies.map(describe).join(' · ')} — bağı olup olmadığını flow_list (bindings) ile kontrol edip gerekirse silin.`
|
|
125
|
+
: '';
|
|
126
|
+
if (ifExists === 'error') {
|
|
127
|
+
const where = host === 'page' ? 'sayfada' : host === 'layout' ? "layout'ta" : "widget'ta";
|
|
128
|
+
throw new PlatformApiError(`FLOW-026: bu ${where} aynı ad ya da slug'da akış zaten var: ${matches.map(describe).join(' · ')}. İstek gönderilmedi — gönderilseydi platform ürün kuralı gereği ikinci bir akış açardı (çakışan ad ya da slug'a ' (1)' sayacı eklenerek; yalnız harf farkı varsa sayaçsız). Mevcut akışı güncellemek için aynı çağrıyı ifExists:'update' ile tekrarlayın; bilerek ikinci akış istiyorsanız ifExists:'duplicate'.${copyNote}`, 409);
|
|
129
|
+
}
|
|
130
|
+
if (matches.length > 1) {
|
|
131
|
+
throw new PlatformApiError(`FLOW-026: ad ve slug farklı akışlara çıkıyor (${matches.map(describe).join(' · ')}); hangisinin güncelleneceği belirsiz, istek gönderilmedi. flowId ile flow_update kullanın.${copyNote}`, 409);
|
|
132
|
+
}
|
|
133
|
+
if (flowId !== undefined && flowId.toLowerCase() !== String(match.id).toLowerCase()) {
|
|
134
|
+
throw new PlatformApiError(`FLOW-026: verilen flowId (${flowId}) aynı adlı mevcut akışla (${describe(match)}) çelişiyor; istek gönderilmedi. Mevcut akışı güncellemek için flowId'yi vermeyin ya da ${String(match.id)} verin.`, 409);
|
|
135
|
+
}
|
|
136
|
+
return match;
|
|
125
137
|
}
|
|
126
138
|
async function requiredParameterWarnings(platform, project, environment, applicationId, steps) {
|
|
127
139
|
const warnings = [];
|
|
@@ -345,7 +357,7 @@ export function registerFlowTools(server, platform) {
|
|
|
345
357
|
steps: stepsParam,
|
|
346
358
|
errorSteps: stepsParam.optional(),
|
|
347
359
|
flowId: guid.optional().describe('Verilmezse platform üretir; şemaya önceden bağlamak için kendiniz üretebilirsiniz'),
|
|
348
|
-
ifExists:
|
|
360
|
+
ifExists: ifExistsParam,
|
|
349
361
|
policyOverride: policyOverrideParam
|
|
350
362
|
},
|
|
351
363
|
annotations: writes
|
|
@@ -381,20 +393,17 @@ export function registerFlowTools(server, platform) {
|
|
|
381
393
|
}
|
|
382
394
|
// Diff YALNIZ çağıranın yazdığı alanları kapsar; `id` ve barındırıcı bağı (`pageId` vb.)
|
|
383
395
|
// gövdeye gateway koyar, kullanıcının düzeltebileceği bir şey değildir.
|
|
384
|
-
const drops = await flowWriteDrops(platform, host, project, environment, applicationId, hostId, writtenFlowId, { name: flow.name, slug: flow.slug, steps: flow.steps, errorSteps: flow.errorSteps }
|
|
385
|
-
|
|
396
|
+
const drops = await flowWriteDrops(platform, host, project, environment, applicationId, hostId, writtenFlowId, { name: flow.name, slug: flow.slug, steps: flow.steps, errorSteps: flow.errorSteps });
|
|
397
|
+
const platformWarnings = await flowProfileWarnings(platform, applicationId, [...(flow.steps ?? []), ...(flow.errorSteps ?? [])]);
|
|
398
|
+
return attachFindings(withWriteDiff(withNormalization({
|
|
386
399
|
host,
|
|
387
400
|
hostId,
|
|
388
401
|
outcome: existing === undefined ? 'created' : 'updated',
|
|
389
|
-
flow: {
|
|
390
|
-
id: writtenFlowId,
|
|
391
|
-
name: typeof drops.saved?.name === 'string' ? drops.saved.name : name,
|
|
392
|
-
slug: typeof drops.saved?.slug === 'string' ? drops.saved.slug : slug,
|
|
393
|
-
steps: steps.length
|
|
394
|
-
},
|
|
402
|
+
flow: { id: writtenFlowId, name, slug, steps: steps.length },
|
|
395
403
|
...(parameterWarnings.length > 0 ? { parameterWarnings } : {}),
|
|
396
|
-
|
|
397
|
-
|
|
404
|
+
...(platformWarnings.length > 0 ? { platformWarnings } : {}),
|
|
405
|
+
hint: "Akışı bir olaya bağlamak için: page_schema_patch (layout'ta layout_schema_patch, widget'ta component_schema_patch) ops:[{op:'set_event', target:<elementId>, event:'<component_get events listesindeki ad>', eventValue:<flow id>}]. Olay adları komponente özeldir ve 'on' ÖNEKİ ALMAZ (button → 'click', form → 'submit', table → 'mount'/'select'/'sort'…); uydurma ad 200 döner ama bağ sessizce ölü kalır — gateway PAGE-008 ile yakalar."
|
|
406
|
+
}, normalized), drops), findings);
|
|
398
407
|
}));
|
|
399
408
|
server.registerTool('flow_update', {
|
|
400
409
|
title: 'Akış güncelle',
|
|
@@ -446,7 +455,9 @@ export function registerFlowTools(server, platform) {
|
|
|
446
455
|
...(steps === undefined ? {} : { steps }),
|
|
447
456
|
...(errorSteps === undefined ? {} : { errorSteps })
|
|
448
457
|
});
|
|
449
|
-
|
|
458
|
+
const platformWarnings = await flowProfileWarnings(platform, applicationId, [...(flow.steps ?? []), ...(flow.errorSteps ?? [])]);
|
|
459
|
+
return attachFindings(withWriteDiff(withNormalization({ host, hostId, flow: flowSummary(flow), ...(parameterWarnings.length > 0 ? { parameterWarnings } : {}),
|
|
460
|
+
...(platformWarnings.length > 0 ? { platformWarnings } : {}) }, normalized), drops), findings);
|
|
450
461
|
}));
|
|
451
462
|
server.registerTool('flow_patch', {
|
|
452
463
|
title: "Akışa patch uygula",
|
|
@@ -495,6 +506,7 @@ export function registerFlowTools(server, platform) {
|
|
|
495
506
|
});
|
|
496
507
|
const written = patchResult(saved, flow);
|
|
497
508
|
const drops = await flowWriteDrops(platform, host, project, environment, applicationId, hostId, flowId, { steps: flow.steps, errorSteps: flow.errorSteps });
|
|
509
|
+
const platformWarnings = await flowProfileWarnings(platform, applicationId, [...(flow.steps ?? []), ...(flow.errorSteps ?? [])]);
|
|
498
510
|
return attachFindings(withWriteDiff(withNormalization({
|
|
499
511
|
host,
|
|
500
512
|
hostId,
|
|
@@ -502,7 +514,8 @@ export function registerFlowTools(server, platform) {
|
|
|
502
514
|
newVersion: written.newVersion,
|
|
503
515
|
patchTargets: resolved.targets,
|
|
504
516
|
flow: flowSummary(written.data),
|
|
505
|
-
...(parameterWarnings.length > 0 ? { parameterWarnings } : {})
|
|
517
|
+
...(parameterWarnings.length > 0 ? { parameterWarnings } : {}),
|
|
518
|
+
...(platformWarnings.length > 0 ? { platformWarnings } : {})
|
|
506
519
|
}, [...normalized, ...resolved.notes.map(note => `patch yolu seçiciden indekse çözüldü: ${note}`)]), drops), findings);
|
|
507
520
|
}));
|
|
508
521
|
server.registerTool('flow_delete', {
|
package/dist/tools/functions.js
CHANGED
|
@@ -16,7 +16,7 @@ import { z } from 'zod';
|
|
|
16
16
|
const sourceParam = z.enum(['workflow', 'studio']).describe("Nerede çalışır: 'workflow' → SUNUCU (workflow/middleware/automation ifadeleri, Jint), tenant geneli, çıplak adla çağrılır (toplamHesapla(1, 2)), applicationId/scope/pageId VERİLMEZ, isAsync olamaz. 'studio' → TARAYICI ({{ }} bağlaması, UI flow code/function adımı), uygulamaya ait, Functions.toplamHesapla(1, 2) ile çağrılır, applicationId + scope zorunlu. Kaynak sonradan DEĞİŞMEZ");
|
|
17
17
|
const scopeParam = z.enum(['application', 'page']).describe("Yalnız source:'studio'. application: uygulamanın her sayfasında görünür. page: yalnız o sayfanın tarayıcı bağlamında, pageId zorunlu (K2). Ad uygulama içinde kapsamlar arası benzersizdir (K3)");
|
|
18
18
|
const nameParam = z.string().min(1).describe("Fonksiyon adı; studio'da Functions.<ad>(…), workflow'da <ad>(…) ile çağrılır. JS tanımlayıcısı olmalı, ayrılmış sözcük olamaz; studio'da 'Functions', workflow'da motor global adları (system, input, Now…) yasaktır (FN-001, istek gitmeden). Aynı ad iki kaynakta yan yana yaşayabilir (ayrı ad alanları); aynı kaynak içinde tekrarı platform 422 ile reddeder");
|
|
19
|
-
const bodyParam = z.string().min(1).max(65536).describe("Fonksiyon GÖVDESİ, iki kaynakta aynı biçim: düz JavaScript deyimleri, 'return' içerebilir — 'function' sarmalı ya da arrow YAZILMAZ ('return fiyat * adet'). Gövde çağrıldığı yerin bağlamını kapanış olarak görür: tarayıcıda Page/state/Steps/komponent adları, sunucuda input/adım çıktıları/system.* (K7). Parametre adları gövdede doğrudan kullanılır.
|
|
19
|
+
const bodyParam = z.string().min(1).max(65536).describe("Fonksiyon GÖVDESİ, iki kaynakta aynı biçim: düz JavaScript deyimleri, 'return' içerebilir — 'function' sarmalı ya da arrow YAZILMAZ ('return fiyat * adet'). Gövde çağrıldığı yerin bağlamını kapanış olarak görür: tarayıcıda Page/state/Steps/komponent adları, sunucuda input/adım çıktıları/system.* (K7). Parametre adları gövdede doğrudan kullanılır. Platform kaydetmeden önce SÖZDİZİMİNİ denetler (422 GlobalFunctionBodyInvalid, ayrıştırıcı mesajıyla). En çok 64 KB");
|
|
20
20
|
const parameterParam = z.object({
|
|
21
21
|
name: z.string().min(1).describe('Parametre adı — JS tanımlayıcısı, fonksiyon içinde benzersiz; gövdede bu adla okunur'),
|
|
22
22
|
type: z.enum(['text', 'number', 'boolean', 'date', 'object', 'array', 'any']).optional()
|
|
@@ -64,10 +64,7 @@ export function describeSignatureChange(current, next) {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
function signatureWarning(name, source, change, dependents) {
|
|
67
|
-
const callers = [
|
|
68
|
-
.map(bucket => (dependents[bucket].length ? `${bucket}: ${dependents[bucket].join(', ')}` : ''))
|
|
69
|
-
.filter(Boolean)
|
|
70
|
-
.join('; ');
|
|
67
|
+
const callers = [dependents.flows.length ? `flows: ${dependents.flows.join(', ')}` : '', dependents.workflows.length ? `workflows: ${dependents.workflows.join(', ')}` : ''].filter(Boolean).join('; ');
|
|
71
68
|
const what = [
|
|
72
69
|
change.name ? `ad '${change.name[0]}' → '${change.name[1]}'` : '',
|
|
73
70
|
change.parameters ? `parametreler [${change.parameters[0].join(', ')}] → [${change.parameters[1].join(', ')}]` : ''
|
|
@@ -78,12 +75,11 @@ function signatureWarning(name, source, change, dependents) {
|
|
|
78
75
|
return `İmza değişti (${what}) ve fonksiyonu ${dependents.total} kayıt kullanıyor (${callers}): ${effect}. Güncelleme yapıldı; çağıran ifadeleri gözden geçirin — dependency_graph(module:'global-function').`;
|
|
79
76
|
}
|
|
80
77
|
/**
|
|
81
|
-
* `GET global-functions/{id}/dependencies` KOVALI grafiği döner (`{ flows, workflows
|
|
78
|
+
* `GET global-functions/{id}/dependencies` KOVALI grafiği döner (`{ flows, workflows }`); düz dizi
|
|
82
79
|
* şekli de düzleştirilir — yapısal (`args.functionId`) ve metinsel (`Functions.<ad>(` / çıplak `<ad>(`)
|
|
83
80
|
* bağımlılıklar aynı listede gelir. Etiket Studio rozetleriyle aynıdır: komponent olayı `Sahip › Komponent · olay`,
|
|
84
81
|
* sayfa/layout olayı `Sahip · olay`, bağı olmayan akış `Sahip › akış adı` (sahip sayfa/layout/widget; eski yanıtta
|
|
85
|
-
* sahipsiz); automation düğümü `ad (automation)`.
|
|
86
|
-
* çağıran fonksiyon adıyla yazılır.
|
|
82
|
+
* sahipsiz); automation düğümü `ad (automation)`.
|
|
87
83
|
*/
|
|
88
84
|
export function summarizeDependents(payload) {
|
|
89
85
|
const data = (() => {
|
|
@@ -98,7 +94,7 @@ export function summarizeDependents(payload) {
|
|
|
98
94
|
const name = String(entry.name ?? entry.slug ?? entry.id ?? '?');
|
|
99
95
|
const host = text(entry.hostName);
|
|
100
96
|
const component = text(entry.componentName);
|
|
101
|
-
const event = text(entry.eventTitle) ?? text(entry.eventName)
|
|
97
|
+
const event = text(entry.eventTitle) ?? text(entry.eventName);
|
|
102
98
|
const label = component
|
|
103
99
|
? [host, [component, event].filter(Boolean).join(' · ')].filter(Boolean).join(' › ')
|
|
104
100
|
: event
|
|
@@ -110,20 +106,14 @@ export function summarizeDependents(payload) {
|
|
|
110
106
|
const entries = data.filter(isRecord);
|
|
111
107
|
const moduleOf = (entry) => String(entry.module ?? entry.type ?? entry.kind ?? '').toLowerCase();
|
|
112
108
|
const isWorkflow = (entry) => moduleOf(entry).includes('workflow') || moduleOf(entry) === 'automation';
|
|
113
|
-
const isFunction = (entry) => moduleOf(entry) === 'global-function';
|
|
114
|
-
const isBinding = (entry) => text(entry.propertyName) !== undefined;
|
|
115
109
|
const workflows = names(entries.filter(isWorkflow));
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
const flows = names(entries.filter(entry => !isWorkflow(entry) && !isFunction(entry) && !isBinding(entry)));
|
|
119
|
-
return { flows, workflows, bindings, functions, total: flows.length + workflows.length + bindings.length + functions.length };
|
|
110
|
+
const flows = names(entries.filter(entry => !isWorkflow(entry)));
|
|
111
|
+
return { flows, workflows, total: flows.length + workflows.length };
|
|
120
112
|
}
|
|
121
113
|
const record = isRecord(data) ? data : {};
|
|
122
114
|
const flows = names(record.flows);
|
|
123
115
|
const workflows = names(record.workflows);
|
|
124
|
-
|
|
125
|
-
const functions = names(record.functions);
|
|
126
|
-
return { flows, workflows, bindings, functions, total: flows.length + workflows.length + bindings.length + functions.length };
|
|
116
|
+
return { flows, workflows, total: flows.length + workflows.length };
|
|
127
117
|
}
|
|
128
118
|
function usageHint(name, source, scope) {
|
|
129
119
|
if (source === 'workflow') {
|
|
@@ -278,7 +268,7 @@ export function registerFunctionTools(server, platform) {
|
|
|
278
268
|
data: saved,
|
|
279
269
|
signature: functionSignature(saved.name ? saved : definition),
|
|
280
270
|
signatureChange,
|
|
281
|
-
dependents: dependents ?? { flows: [], workflows: [],
|
|
271
|
+
dependents: dependents ?? { flows: [], workflows: [], total: 0 },
|
|
282
272
|
...(dependents === undefined ? { dependentsNote: 'Bağımlılık ucu okunamadı; çağıran akış olup olmadığı bilinmiyor.' } : {}),
|
|
283
273
|
...(renamedReferences !== undefined ? { renamedReferences } : {}),
|
|
284
274
|
...(dependents !== undefined && dependents.total > 0 && callersBreak
|
|
@@ -331,7 +321,7 @@ export function registerFunctionTools(server, platform) {
|
|
|
331
321
|
return {
|
|
332
322
|
deleted: id,
|
|
333
323
|
source,
|
|
334
|
-
dependents: dependents ?? { flows: [], workflows: [],
|
|
324
|
+
dependents: dependents ?? { flows: [], workflows: [], total: 0 },
|
|
335
325
|
...(dependents === undefined ? { dependentsNote: 'Bağımlılık ucu okunamadı; çağıran akış olup olmadığı bilinmiyor.' } : {}),
|
|
336
326
|
...(dependents !== undefined && dependents.total > 0
|
|
337
327
|
? { note: `${dependents.total} çağıran kırıldı (acknowledgeDependents): ${[...dependents.flows, ...dependents.workflows].join(', ')} — ifadeleri düzeltin ya da fonksiyonu aynı adla yeniden tanımlayın.` }
|
package/dist/tools/layouts.js
CHANGED
|
@@ -9,6 +9,8 @@ import { applyPropTypesToSchema, isSetPropTypeOp, setPropTypeErrors } from '../k
|
|
|
9
9
|
import { writeDiff, withWriteDiff } from '../platform/writeDiff.js';
|
|
10
10
|
import { PlatformApiError } from '../platform/errors.js';
|
|
11
11
|
import { handle } from '../platform/responses.js';
|
|
12
|
+
import { applicationTypeField, resolveProfile } from '../knowledge/platform/resolve.js';
|
|
13
|
+
import { screenProfileWarnings } from './profileWrite.js';
|
|
12
14
|
import { z } from 'zod';
|
|
13
15
|
const patchOperationsParam = z.array(z.record(z.unknown())).min(1)
|
|
14
16
|
.describe("JSON Patch listesi (RFC 6902): { op, path, value }. Yol seçici alabilir — '/views/0/children[elementId=baslik]/props/content/data'.");
|
|
@@ -46,7 +48,13 @@ export function registerLayoutTools(server, platform) {
|
|
|
46
48
|
description: "Layout'u komponent ağacı (views), widget'ları, akışları ve olaylarıyla getirir.",
|
|
47
49
|
inputSchema: { project: projectParam, environment: environmentParam, applicationId: guid, id: guid },
|
|
48
50
|
annotations: readOnly
|
|
49
|
-
}, handle(config, ({ project, environment, applicationId, id }) =>
|
|
51
|
+
}, handle(config, async ({ project, environment, applicationId, id }) => {
|
|
52
|
+
const response = await platform.tenant('GET', project, `/layouts/${applicationId}/${id}`, { environment });
|
|
53
|
+
const typeField = applicationTypeField(await resolveProfile(platform, applicationId));
|
|
54
|
+
return response && typeof response === 'object' && !Array.isArray(response) && Object.keys(typeField).length > 0
|
|
55
|
+
? { ...response, ...typeField }
|
|
56
|
+
: response;
|
|
57
|
+
}));
|
|
50
58
|
server.registerTool('layout_schema_get', {
|
|
51
59
|
title: "Layout komponent ağacını oku",
|
|
52
60
|
description: "Layout'un komponent ağacını (views) okur — page_schema_get'in layout karşılığı. Ağaçta hedefli değişiklik için layout_schema_patch (sayfa ile aynı micro-op sözlüğü, PATCH /layouts/{app}/{id}/schema). Ad/parametre/olay alanlarında ya da düz JSON Patch yolu gerektiğinde layout_patch — o araç buradaki updatedAt'i expectedUpdatedAt olarak kabul eder. Tam ağacı kendiniz yazacaksanız layout_update.",
|
|
@@ -61,20 +69,21 @@ export function registerLayoutTools(server, platform) {
|
|
|
61
69
|
annotations: readOnly
|
|
62
70
|
}, handle(config, async ({ project, environment, applicationId, id, mode, componentId }) => {
|
|
63
71
|
const layout = await fetchHost(platform, 'layout', project, environment, applicationId, id);
|
|
72
|
+
const typeField = applicationTypeField(await resolveProfile(platform, applicationId));
|
|
64
73
|
const audit = layout.audit;
|
|
65
74
|
const updatedAt = audit?.updatedAt ?? audit?.createdAt;
|
|
66
75
|
const views = (layout.views ?? []);
|
|
67
76
|
if (mode === 'full')
|
|
68
|
-
return { updatedAt, views };
|
|
77
|
+
return { updatedAt, ...typeField, views };
|
|
69
78
|
if (mode === 'subtree') {
|
|
70
79
|
if (!componentId)
|
|
71
80
|
throw new PlatformApiError("mode='subtree' için componentId zorunludur.");
|
|
72
81
|
const subtree = findNode(views, componentId);
|
|
73
82
|
if (!subtree)
|
|
74
83
|
throw new PlatformApiError(`Layout'ta '${componentId}' id'li bir komponent yok; layout_schema_get'i summary kipinde çağırıp hedefi doğrulayın.`);
|
|
75
|
-
return { updatedAt, views: subtree };
|
|
84
|
+
return { updatedAt, ...typeField, views: subtree };
|
|
76
85
|
}
|
|
77
|
-
return { updatedAt, views: views.map(node => summarize(node)) };
|
|
86
|
+
return { updatedAt, ...typeField, views: views.map(node => summarize(node)) };
|
|
78
87
|
}));
|
|
79
88
|
server.registerTool('layout_create', {
|
|
80
89
|
title: 'Layout oluştur',
|
|
@@ -91,18 +100,27 @@ export function registerLayoutTools(server, platform) {
|
|
|
91
100
|
annotations: writes
|
|
92
101
|
}, handle(config, async ({ project, environment, applicationId, name, views, events, parameters }) => {
|
|
93
102
|
assertScreenWriteGuards('layout', { schema: views, events });
|
|
103
|
+
const resolved = await resolveProfile(platform, applicationId);
|
|
94
104
|
const fixed = normalizeComponentDefaults(views);
|
|
95
105
|
const catalogNotes = await screenCatalogNotes(platform, project, environment, applicationId, views);
|
|
96
|
-
const gaps = [
|
|
106
|
+
const gaps = [
|
|
107
|
+
...(resolved.profile.layout.blocksMeaningful ? verticalGapWarnings(views ?? [], 'LAY-003 (uyarı)') : []),
|
|
108
|
+
...flexSizeWarnings(views ?? [], 'LAY-007 (uyarı)', 'LAY-008 (uyarı)'),
|
|
109
|
+
...spacingLayerWarnings(views ?? [], 'LAY-010 (uyarı)', 'LAY-011 (uyarı)'),
|
|
110
|
+
...await screenProfileWarnings(platform, resolved, project, environment, applicationId, { kind: 'layout', nodes: views ?? [] })
|
|
111
|
+
];
|
|
97
112
|
const response = await platform.tenant('POST', project, `/layouts/${applicationId}`, {
|
|
98
113
|
environment,
|
|
99
114
|
body: { name, views: views ?? [], events: events ?? [], parameters: parameters ?? null }
|
|
100
115
|
});
|
|
101
116
|
const drops = writeDiff({ name, views: views ?? [], events: events ?? [] }, response);
|
|
102
117
|
const normalized = withWriteDiff(withNormalization(response, [...componentDefaultsNote(fixed), ...catalogNotes, ...slotWarning(views)]), drops);
|
|
103
|
-
|
|
118
|
+
const typeField = applicationTypeField(resolved);
|
|
119
|
+
if (!normalized || typeof normalized !== 'object')
|
|
104
120
|
return normalized;
|
|
105
|
-
|
|
121
|
+
if (gaps.length === 0)
|
|
122
|
+
return Object.keys(typeField).length === 0 ? normalized : { ...normalized, ...typeField };
|
|
123
|
+
return { ...normalized, ...typeField, layoutWarnings: gaps };
|
|
106
124
|
}));
|
|
107
125
|
server.registerTool('layout_update', {
|
|
108
126
|
title: 'Layout güncelle',
|
|
@@ -126,7 +144,15 @@ export function registerLayoutTools(server, platform) {
|
|
|
126
144
|
const catalogNotes = await screenCatalogNotes(platform, project, environment, applicationId, overrides.views);
|
|
127
145
|
const body = layoutUpdateBody({ ...current, applicationId }, overrides);
|
|
128
146
|
await platform.tenant('PUT', project, `/layouts/${applicationId}/${id}`, { environment, body });
|
|
129
|
-
const
|
|
147
|
+
const resolved = overrides.views === undefined ? undefined : await resolveProfile(platform, applicationId);
|
|
148
|
+
const gaps = overrides.views === undefined || !resolved
|
|
149
|
+
? []
|
|
150
|
+
: [
|
|
151
|
+
...(resolved.profile.layout.blocksMeaningful ? verticalGapWarnings(body.views, 'LAY-003 (uyarı)') : []),
|
|
152
|
+
...flexSizeWarnings(body.views, 'LAY-007 (uyarı)', 'LAY-008 (uyarı)'),
|
|
153
|
+
...spacingLayerWarnings(body.views, 'LAY-010 (uyarı)', 'LAY-011 (uyarı)'),
|
|
154
|
+
...await screenProfileWarnings(platform, resolved, project, environment, applicationId, { kind: 'layout', nodes: body.views })
|
|
155
|
+
];
|
|
130
156
|
const summary = { id, changed: Object.keys(overrides), preserved: { viewNodes: body.views.length } };
|
|
131
157
|
if (gaps.length > 0)
|
|
132
158
|
summary.layoutWarnings = gaps;
|
|
@@ -193,7 +219,13 @@ export function registerLayoutTools(server, platform) {
|
|
|
193
219
|
body: { baseVersion: baseVersionOf(document, 'layout_get'), ops: netOps }
|
|
194
220
|
});
|
|
195
221
|
const written = patchResult(saved, finalDocument);
|
|
196
|
-
const
|
|
222
|
+
const profile = await resolveProfile(platform, applicationId);
|
|
223
|
+
const gaps = [
|
|
224
|
+
...(profile.profile.layout.blocksMeaningful ? verticalGapWarnings(body.views, 'LAY-003 (uyarı)') : []),
|
|
225
|
+
...flexSizeWarnings(body.views, 'LAY-007 (uyarı)', 'LAY-008 (uyarı)'),
|
|
226
|
+
...spacingLayerWarnings(body.views, 'LAY-010 (uyarı)', 'LAY-011 (uyarı)'),
|
|
227
|
+
...await screenProfileWarnings(platform, profile, project, environment, applicationId, { kind: 'layout', nodes: body.views })
|
|
228
|
+
];
|
|
197
229
|
const summary = {
|
|
198
230
|
id,
|
|
199
231
|
applied: patchOps.length,
|
|
@@ -10,15 +10,11 @@ import { policyRules } from '../knowledge/rules.js';
|
|
|
10
10
|
import { writeDiff, withWriteDiff } from '../platform/writeDiff.js';
|
|
11
11
|
import { identityHeaders } from '../platform/tokenVault.js';
|
|
12
12
|
import { PlatformApiError } from '../platform/errors.js';
|
|
13
|
-
import { existingMatch, ifExistsParam, listAll, platformRename, withOutcome, withRename } from '../platform/ifExists.js';
|
|
14
|
-
import { outlineWrite, recordWriteViewParam } from '../platform/writeView.js';
|
|
15
13
|
import { handle } from '../platform/responses.js';
|
|
16
14
|
import fastJsonPatch from 'fast-json-patch';
|
|
17
15
|
import { z } from 'zod';
|
|
18
16
|
import { constraintSummary } from '../knowledge/backendConstraints.js';
|
|
19
17
|
import { unmappedMembers, introducedUnmappedMembers, withUnmappedMembers } from '../knowledge/schemaGuard.js';
|
|
20
|
-
const MICROSERVICE_OUTLINE_KEYS = ['url', 'httpMethod', 'source', 'type'];
|
|
21
|
-
const microserviceIfExistsParam = ifExistsParam('uç', 'mevcut ucu bu tanımla tam gövde günceller (id\'si korunur; microservice_update ile aynı yazma)');
|
|
22
18
|
const policyOverrideParam = z.boolean().optional()
|
|
23
19
|
.describe('true: politika block bulgularını warn\'a indirir (bilinçli istisna; yanıtta işaretlenir)');
|
|
24
20
|
/**
|
|
@@ -291,52 +287,28 @@ export function registerMicroserviceTools(server, platform) {
|
|
|
291
287
|
}));
|
|
292
288
|
server.registerTool('microservice_create', {
|
|
293
289
|
title: 'Microservice oluştur',
|
|
294
|
-
description: "Yeni microservice tanımlar (definition = CreateMicroserviceCommand).
|
|
295
|
-
inputSchema: { project: projectParam, environment: environmentParam, applicationId: appRef, definition: definitionParam,
|
|
290
|
+
description: "Yeni microservice tanımlar (definition = CreateMicroserviceCommand). İlk kullanımdan önce platform_guide('microservice') okuyun: kaynak seçimi (table > query) ve selectFields disiplini. 'description' ZORUNLUDUR (MS-014, block): çağıranın bu uçtan ne elde ettiğini yazın. Auth/oturum gerektiren uçlarda definition.middlewareIds ile middleware bağlayın; kimlik kapsaması filtrede source:'expression' + value:'user.id' ile yapılır (platform_guide('middleware')). BU YALNIZ source:'table' UÇLARDA VAR: query kaynaklı ucun parametreleri ÇAĞRIDAN gelir (body → query-string → header) ve middleware'in kurduğu user o yola girmez — kapsamı gövdeye bırakan uç sahtelenebilir (ölçüldü 2026-09-07). Kapsanmış agregasyon ucu sorguyu bir workflow query adımından çağırır: platform_guide('microservice') §'Kimlik kapsaması × uç kaynağı'. Ucun gerçek bir tuzağı varsa (auth istemiyor, sayfalama yok, atomik değil) 'caution' alanına yazın — OPSİYONELDİR, tuzak yoksa boş bırakın. Gövde politika kontrolünden geçer. " + constraintSummary('CreateMicroserviceCommand'),
|
|
291
|
+
inputSchema: { project: projectParam, environment: environmentParam, applicationId: appRef, definition: definitionParam, policyOverride: policyOverrideParam },
|
|
296
292
|
annotations: writes
|
|
297
|
-
}, handle(config, async ({ project, environment, applicationId, definition,
|
|
293
|
+
}, handle(config, async ({ project, environment, applicationId, definition, policyOverride }) => {
|
|
298
294
|
const resolver = new RefResolver(platform, project, environment);
|
|
299
295
|
const resolvedApplicationId = await resolver.applicationId(applicationId);
|
|
300
296
|
const hydrated = await hydrateMicroserviceRefs(definition, resolver);
|
|
301
297
|
const normalized = normalizeMicroserviceDefinition(definition);
|
|
302
|
-
// Politika ÖNCE koşar: block alan istek platforma hiç gitmez, var-mı listesi de okunmaz.
|
|
303
|
-
const createFindings = enforcePolicy(evaluatePolicy(config, policyRules, 'microservice', definition, { operation: 'create' }, policyOverride));
|
|
304
|
-
const scopeFindings = await queryScopeFindings(platform, project, environment, definition);
|
|
305
|
-
const existing = await existingMatch({
|
|
306
|
-
code: 'MS-023',
|
|
307
|
-
noun: 'uç',
|
|
308
|
-
where: 'bu uygulamada',
|
|
309
|
-
name: typeof definition.name === 'string' ? definition.name : undefined,
|
|
310
|
-
slug: typeof definition.slug === 'string' ? definition.slug : undefined,
|
|
311
|
-
id: typeof definition.id === 'string' ? definition.id : undefined,
|
|
312
|
-
idParam: 'definition.id',
|
|
313
|
-
ifExists,
|
|
314
|
-
list: () => listAll(platform, project, environment, `/microservices/${resolvedApplicationId}`),
|
|
315
|
-
listTool: 'microservice_list',
|
|
316
|
-
copyCheck: 'kullanılıp kullanılmadığını dependency_graph ile kontrol edip gerekirse silin',
|
|
317
|
-
updateTool: 'id ile microservice_update'
|
|
318
|
-
});
|
|
319
|
-
// Kayıt bulunduysa yazma bir UPDATE'tir: gövde kuralları microservice_update ile aynı kipte (R-1).
|
|
320
298
|
const findings = [
|
|
321
|
-
...(
|
|
322
|
-
|
|
323
|
-
: enforcePolicy(evaluatePolicy(config, policyRules, 'microservice', definition, { operation: 'update' }, policyOverride))),
|
|
324
|
-
...scopeFindings
|
|
299
|
+
...enforcePolicy(evaluatePolicy(config, policyRules, 'microservice', definition, { operation: 'create' }, policyOverride)),
|
|
300
|
+
...await queryScopeFindings(platform, project, environment, definition)
|
|
325
301
|
];
|
|
326
|
-
const drift = unmappedMembers(
|
|
327
|
-
const payload =
|
|
328
|
-
|
|
329
|
-
: await platform.tenant('PUT', project, `/microservices/${resolvedApplicationId}/${String(existing.id)}`, { environment, body: definition });
|
|
330
|
-
const saved = payload?.data;
|
|
331
|
-
const rename = ifExists === 'duplicate' ? platformRename(definition, saved, 'dash') : { sent: definition };
|
|
332
|
-
return attachFindings(withUnmappedMembers(withWriteDiff(withResolved(withRename(withNormalization(withOutcome(outlineWrite(payload, view, MICROSERVICE_OUTLINE_KEYS), existing), normalized), rename.renamed), [...resolver.resolved, ...hydrated]), writeDiff(rename.sent, payload)), drift), findings);
|
|
302
|
+
const drift = unmappedMembers('CreateMicroserviceCommand', definition);
|
|
303
|
+
const payload = await platform.tenant('POST', project, `/microservices/${resolvedApplicationId}`, { environment, body: definition });
|
|
304
|
+
return attachFindings(withUnmappedMembers(withWriteDiff(withResolved(withNormalization(payload, normalized), [...resolver.resolved, ...hydrated]), writeDiff(definition, payload)), drift), findings);
|
|
333
305
|
}));
|
|
334
306
|
server.registerTool('microservice_update', {
|
|
335
307
|
title: 'Microservice güncelle',
|
|
336
308
|
description: 'Microservice tanımını günceller (tam gövde). Hedefli değişiklik için microservice_patch tercih edin. \'description\' ZORUNLUDUR (MS-014, block). Ucun gerçek bir tuzağı varsa (auth istemiyor, sayfalama yok, atomik değil) \'caution\' alanına yazın — OPSİYONELDİR, tuzak yoksa boş bırakın. Gövde politika kontrolünden geçer. ' + constraintSummary('UpdateMicroserviceCommand'),
|
|
337
|
-
inputSchema: { project: projectParam, environment: environmentParam, applicationId: appRef, id: guid, definition: definitionParam,
|
|
309
|
+
inputSchema: { project: projectParam, environment: environmentParam, applicationId: appRef, id: guid, definition: definitionParam, policyOverride: policyOverrideParam },
|
|
338
310
|
annotations: updates
|
|
339
|
-
}, handle(config, async ({ project, environment, applicationId, id, definition,
|
|
311
|
+
}, handle(config, async ({ project, environment, applicationId, id, definition, policyOverride }) => {
|
|
340
312
|
const resolver = new RefResolver(platform, project, environment);
|
|
341
313
|
const resolvedApplicationId = await resolver.applicationId(applicationId);
|
|
342
314
|
const hydrated = await hydrateMicroserviceRefs(definition, resolver);
|
|
@@ -347,7 +319,7 @@ export function registerMicroserviceTools(server, platform) {
|
|
|
347
319
|
];
|
|
348
320
|
const drift = unmappedMembers('UpdateMicroserviceCommand', definition);
|
|
349
321
|
const payload = await platform.tenant('PUT', project, `/microservices/${resolvedApplicationId}/${id}`, { environment, body: definition });
|
|
350
|
-
return attachFindings(withUnmappedMembers(withWriteDiff(withResolved(withNormalization(
|
|
322
|
+
return attachFindings(withUnmappedMembers(withWriteDiff(withResolved(withNormalization(payload, normalized), [...resolver.resolved, ...hydrated]), writeDiff(definition, payload)), drift), findings);
|
|
351
323
|
}));
|
|
352
324
|
server.registerTool('microservice_patch', {
|
|
353
325
|
title: 'Microservice\'e patch uygula',
|