illustrator-mcp-server 1.2.12 → 1.3.1
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.ja.md +7 -1
- package/README.md +9 -2
- package/dist/bundle.cjs +399 -115
- package/dist/jsx/helpers/common.jsx +34 -0
- package/dist/tools/export/export-pdf.d.ts.map +1 -1
- package/dist/tools/export/export-pdf.js +128 -33
- package/dist/tools/export/export-pdf.js.map +1 -1
- package/dist/tools/export/export.js +2 -2
- package/dist/tools/modify/create-crop-marks.d.ts +3 -0
- package/dist/tools/modify/create-crop-marks.d.ts.map +1 -0
- package/dist/tools/modify/create-crop-marks.js +226 -0
- package/dist/tools/modify/create-crop-marks.js.map +1 -0
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +2 -0
- package/dist/tools/registry.js.map +1 -1
- package/package.json +1 -1
package/dist/bundle.cjs
CHANGED
|
@@ -30279,8 +30279,8 @@ function createTempFiles() {
|
|
|
30279
30279
|
async function writeParams(paramsPath, params) {
|
|
30280
30280
|
await fs.writeFile(paramsPath, JSON.stringify(params ?? {}), "utf-8");
|
|
30281
30281
|
}
|
|
30282
|
-
async function writeJsx(scriptPath,
|
|
30283
|
-
await fs.writeFile(scriptPath, BOM +
|
|
30282
|
+
async function writeJsx(scriptPath, jsxCode60) {
|
|
30283
|
+
await fs.writeFile(scriptPath, BOM + jsxCode60, "utf-8");
|
|
30284
30284
|
}
|
|
30285
30285
|
async function writeAppleScript(scptPath, scriptPath, options) {
|
|
30286
30286
|
const lines = ['tell application "Adobe Illustrator"'];
|
|
@@ -30406,11 +30406,11 @@ function getExecFailureMessage(error48, stderr, timeout, transport = "osascript"
|
|
|
30406
30406
|
if (transport === "powershell") return parsePowerShellError(stderr || error48.message);
|
|
30407
30407
|
return parseOsascriptError(stderr || error48.message);
|
|
30408
30408
|
}
|
|
30409
|
-
async function executeViaOsascript(
|
|
30409
|
+
async function executeViaOsascript(jsxCode60, params, timeout, activate) {
|
|
30410
30410
|
const files = createTempFiles();
|
|
30411
30411
|
try {
|
|
30412
30412
|
await writeParams(files.paramsPath, params);
|
|
30413
|
-
const fullJsx = await buildJsx(
|
|
30413
|
+
const fullJsx = await buildJsx(jsxCode60, files.paramsPath, files.resultPath);
|
|
30414
30414
|
await writeJsx(files.scriptPath, fullJsx);
|
|
30415
30415
|
await writeAppleScript(files.runnerPath, files.scriptPath, { activate });
|
|
30416
30416
|
await new Promise((resolve2, reject) => {
|
|
@@ -30427,11 +30427,11 @@ async function executeViaOsascript(jsxCode59, params, timeout, activate) {
|
|
|
30427
30427
|
await cleanupTempFiles(files);
|
|
30428
30428
|
}
|
|
30429
30429
|
}
|
|
30430
|
-
async function executeViaPowerShell(
|
|
30430
|
+
async function executeViaPowerShell(jsxCode60, params, timeout, activate) {
|
|
30431
30431
|
const files = createTempFiles();
|
|
30432
30432
|
try {
|
|
30433
30433
|
await writeParams(files.paramsPath, params);
|
|
30434
|
-
const fullJsx = await buildJsx(
|
|
30434
|
+
const fullJsx = await buildJsx(jsxCode60, files.paramsPath, files.resultPath);
|
|
30435
30435
|
await writeJsx(files.scriptPath, fullJsx);
|
|
30436
30436
|
await writePowerShellScript(files.runnerPath, files.scriptPath, { activate });
|
|
30437
30437
|
await new Promise((resolve2, reject) => {
|
|
@@ -30470,24 +30470,24 @@ async function readAndValidateResult(resultPath) {
|
|
|
30470
30470
|
}
|
|
30471
30471
|
return result;
|
|
30472
30472
|
}
|
|
30473
|
-
async function executeJsxRaw(
|
|
30473
|
+
async function executeJsxRaw(jsxCode60, params, timeout = TIMEOUT_NORMAL, activate = false) {
|
|
30474
30474
|
const transport = getTransport();
|
|
30475
30475
|
switch (transport) {
|
|
30476
30476
|
case "osascript":
|
|
30477
|
-
return await executeViaOsascript(
|
|
30477
|
+
return await executeViaOsascript(jsxCode60, params, timeout, activate);
|
|
30478
30478
|
case "powershell":
|
|
30479
|
-
return await executeViaPowerShell(
|
|
30479
|
+
return await executeViaPowerShell(jsxCode60, params, timeout, activate);
|
|
30480
30480
|
default: {
|
|
30481
30481
|
const _ = transport;
|
|
30482
30482
|
throw new Error(`Unknown transport: ${_}`);
|
|
30483
30483
|
}
|
|
30484
30484
|
}
|
|
30485
30485
|
}
|
|
30486
|
-
async function executeJsx(
|
|
30486
|
+
async function executeJsx(jsxCode60, params, options) {
|
|
30487
30487
|
pendingCount++;
|
|
30488
30488
|
try {
|
|
30489
30489
|
return await jsxLimit(() => executeJsxRaw(
|
|
30490
|
-
|
|
30490
|
+
jsxCode60,
|
|
30491
30491
|
params,
|
|
30492
30492
|
options?.timeout ?? TIMEOUT_NORMAL,
|
|
30493
30493
|
options?.activate ?? false
|
|
@@ -30499,8 +30499,8 @@ async function executeJsx(jsxCode59, params, options) {
|
|
|
30499
30499
|
}
|
|
30500
30500
|
}
|
|
30501
30501
|
}
|
|
30502
|
-
async function executeJsxHeavy(
|
|
30503
|
-
return executeJsx(
|
|
30502
|
+
async function executeJsxHeavy(jsxCode60, params) {
|
|
30503
|
+
return executeJsx(jsxCode60, params, { timeout: TIMEOUT_HEAVY, activate: true });
|
|
30504
30504
|
}
|
|
30505
30505
|
|
|
30506
30506
|
// src/tools/session.ts
|
|
@@ -30994,10 +30994,10 @@ function ensureToolParams(params) {
|
|
|
30994
30994
|
function formatToolResult(result) {
|
|
30995
30995
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
30996
30996
|
}
|
|
30997
|
-
async function executeToolJsx(
|
|
30997
|
+
async function executeToolJsx(jsxCode60, params, options) {
|
|
30998
30998
|
const baseParams = ensureToolParams(params);
|
|
30999
30999
|
const resolvedParams = options?.resolveCoordinate ? { ...baseParams, coordinate_system: await resolveCoordinateSystem(baseParams.coordinate_system) } : baseParams;
|
|
31000
|
-
const result = options?.heavy ? await executeJsxHeavy(
|
|
31000
|
+
const result = options?.heavy ? await executeJsxHeavy(jsxCode60, resolvedParams) : await executeJsx(jsxCode60, resolvedParams, { activate: options?.activate ?? false });
|
|
31001
31001
|
return formatToolResult(result);
|
|
31002
31002
|
}
|
|
31003
31003
|
|
|
@@ -34219,7 +34219,7 @@ if (preflight) {
|
|
|
34219
34219
|
|
|
34220
34220
|
if (useIsolatedExport) {
|
|
34221
34221
|
// \u9078\u629E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u30B3\u30D4\u30FC
|
|
34222
|
-
|
|
34222
|
+
executeMenuCommandSafe("copy");
|
|
34223
34223
|
|
|
34224
34224
|
// \u5BFE\u8C61\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E bounds \u3092\u53D6\u5F97\uFF08[left, top, right, bottom] in document coords\uFF09
|
|
34225
34225
|
var vb = targetItem.visibleBounds;
|
|
@@ -34232,7 +34232,7 @@ if (preflight) {
|
|
|
34232
34232
|
tempDoc.artboards[0].artboardRect = [0, objH, objW, 0];
|
|
34233
34233
|
|
|
34234
34234
|
// \u30DA\u30FC\u30B9\u30C8
|
|
34235
|
-
|
|
34235
|
+
executeMenuCommandSafe("paste");
|
|
34236
34236
|
|
|
34237
34237
|
// \u30DA\u30FC\u30B9\u30C8\u3055\u308C\u305F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u30A2\u30FC\u30C8\u30DC\u30FC\u30C9\u4E2D\u592E\u306B\u914D\u7F6E
|
|
34238
34238
|
if (tempDoc.selection && tempDoc.selection.length > 0) {
|
|
@@ -34467,6 +34467,68 @@ if (preflight) {
|
|
|
34467
34467
|
}
|
|
34468
34468
|
var options = params.options || {};
|
|
34469
34469
|
|
|
34470
|
+
// --- \u65E5\u672C\u5F0F\u30C8\u30F3\u30DC: TrimMark \u30B3\u30DE\u30F3\u30C9\u3067\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u4E0A\u306B\u751F\u6210 ---
|
|
34471
|
+
// PDFSaveOptions.pageMarksType = PageMarksTypes.Japanese \u306F
|
|
34472
|
+
// Illustrator \u30D0\u30FC\u30B8\u30E7\u30F3\u306B\u3088\u3063\u3066\u6B63\u3057\u304F\u53CD\u6620\u3055\u308C\u306A\u3044\u5834\u5408\u304C\u3042\u308B\u3002
|
|
34473
|
+
// \u305D\u306E\u305F\u3081\u65E5\u672C\u5F0F\u30C8\u30F3\u30DC\u306F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u4E0A\u306B\u30D1\u30B9\u3068\u3057\u3066\u751F\u6210\u3057\u3001
|
|
34474
|
+
// \u30A2\u30FC\u30C8\u30DC\u30FC\u30C9\u3092\u4E00\u6642\u62E1\u5F35\u3057\u3066 PDF \u306B\u542B\u3081\u308B\u3002\u66F8\u304D\u51FA\u3057\u5F8C\u306B\u5FA9\u5143\u3059\u308B\u3002
|
|
34475
|
+
var usedDocumentMarks = false;
|
|
34476
|
+
var trimMarkGroups = [];
|
|
34477
|
+
var origAbRect = null;
|
|
34478
|
+
var abIdx = doc.artboards.getActiveArtboardIndex();
|
|
34479
|
+
if (options.marks_style === "japanese" && options.trim_marks === true) {
|
|
34480
|
+
try {
|
|
34481
|
+
app.preferences.setBooleanPreference("cropMarkStyle", true);
|
|
34482
|
+
|
|
34483
|
+
var groupCountBefore = doc.groupItems.length;
|
|
34484
|
+
|
|
34485
|
+
var abRect = doc.artboards[abIdx].artboardRect;
|
|
34486
|
+
origAbRect = abRect.slice();
|
|
34487
|
+
var tempRect = doc.pathItems.rectangle(abRect[1], abRect[0], abRect[2] - abRect[0], abRect[1] - abRect[3]);
|
|
34488
|
+
tempRect.filled = false;
|
|
34489
|
+
tempRect.stroked = false;
|
|
34490
|
+
|
|
34491
|
+
doc.selection = null;
|
|
34492
|
+
tempRect.selected = true;
|
|
34493
|
+
executeTrimMark();
|
|
34494
|
+
|
|
34495
|
+
try { tempRect.remove(); } catch (re) { /* consumed by command */ }
|
|
34496
|
+
doc.selection = null;
|
|
34497
|
+
|
|
34498
|
+
var newGroupCount = doc.groupItems.length - groupCountBefore;
|
|
34499
|
+
for (var g = 0; g < newGroupCount; g++) {
|
|
34500
|
+
trimMarkGroups.push(doc.groupItems[g]);
|
|
34501
|
+
}
|
|
34502
|
+
|
|
34503
|
+
// TrimMark \u304C\u30B0\u30EB\u30FC\u30D7\u3092\u751F\u6210\u3057\u306A\u304B\u3063\u305F\u5834\u5408\u306F\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF
|
|
34504
|
+
if (trimMarkGroups.length === 0) {
|
|
34505
|
+
throw new Error("TrimMark command produced no marks");
|
|
34506
|
+
}
|
|
34507
|
+
|
|
34508
|
+
// \u30C8\u30F3\u30DC\u304C\u53CE\u307E\u308B\u3088\u3046\u306B\u30A2\u30FC\u30C8\u30DC\u30FC\u30C9\u3092\u4E00\u6642\u62E1\u5F35
|
|
34509
|
+
if (trimMarkGroups.length > 0) {
|
|
34510
|
+
var mb = trimMarkGroups[0].geometricBounds.slice();
|
|
34511
|
+
for (var g = 1; g < trimMarkGroups.length; g++) {
|
|
34512
|
+
var gb = trimMarkGroups[g].geometricBounds;
|
|
34513
|
+
if (gb[0] < mb[0]) mb[0] = gb[0];
|
|
34514
|
+
if (gb[1] > mb[1]) mb[1] = gb[1];
|
|
34515
|
+
if (gb[2] > mb[2]) mb[2] = gb[2];
|
|
34516
|
+
if (gb[3] < mb[3]) mb[3] = gb[3];
|
|
34517
|
+
}
|
|
34518
|
+
doc.artboards[abIdx].artboardRect = [mb[0] - 1, mb[1] + 1, mb[2] + 1, mb[3] - 1];
|
|
34519
|
+
}
|
|
34520
|
+
|
|
34521
|
+
usedDocumentMarks = true;
|
|
34522
|
+
} catch (tmErr) {
|
|
34523
|
+
// TrimMark \u30B3\u30DE\u30F3\u30C9\u5931\u6557\u6642\u306F PDFSaveOptions \u306B\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF
|
|
34524
|
+
usedDocumentMarks = false;
|
|
34525
|
+
// \u30A2\u30FC\u30C8\u30DC\u30FC\u30C9\u3092\u5FA9\u5143\uFF08\u9014\u4E2D\u3067\u62E1\u5F35\u6E08\u307F\u306E\u5834\u5408\uFF09
|
|
34526
|
+
if (origAbRect) {
|
|
34527
|
+
try { doc.artboards[abIdx].artboardRect = origAbRect; } catch (restoreErr) {}
|
|
34528
|
+
}
|
|
34529
|
+
}
|
|
34530
|
+
}
|
|
34531
|
+
|
|
34470
34532
|
var pdfOpts = new PDFSaveOptions();
|
|
34471
34533
|
|
|
34472
34534
|
// Apply preset if specified
|
|
@@ -34478,43 +34540,53 @@ if (preflight) {
|
|
|
34478
34540
|
pdfOpts.preserveEditability = false;
|
|
34479
34541
|
}
|
|
34480
34542
|
|
|
34481
|
-
// \u30C8\u30F3\u30DC\u7A2E\u985E
|
|
34482
|
-
if (
|
|
34483
|
-
|
|
34543
|
+
// \u30C8\u30F3\u30DC\u7A2E\u985E
|
|
34544
|
+
if (usedDocumentMarks) {
|
|
34545
|
+
// \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u4E0A\u306B\u30C8\u30F3\u30DC\u3092\u751F\u6210\u6E08\u307F \u2192 PDF \u306E\u30DE\u30FC\u30AF\u306F OFF
|
|
34546
|
+
pdfOpts.trimMarks = false;
|
|
34484
34547
|
} else if (options.marks_style === "roman") {
|
|
34485
34548
|
pdfOpts.pageMarksType = PageMarksTypes.Roman;
|
|
34486
|
-
|
|
34487
|
-
|
|
34488
|
-
|
|
34489
|
-
|
|
34490
|
-
|
|
34549
|
+
if (options.trim_marks === true) {
|
|
34550
|
+
pdfOpts.trimMarks = true;
|
|
34551
|
+
} else {
|
|
34552
|
+
pdfOpts.trimMarks = false;
|
|
34553
|
+
}
|
|
34491
34554
|
} else {
|
|
34492
|
-
|
|
34555
|
+
// marks_style \u672A\u6307\u5B9A or \u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF
|
|
34556
|
+
if (options.marks_style === "japanese") {
|
|
34557
|
+
// TrimMark \u30B3\u30DE\u30F3\u30C9\u5931\u6557\u6642\u306E\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF
|
|
34558
|
+
pdfOpts.pageMarksType = PageMarksTypes.Japanese;
|
|
34559
|
+
}
|
|
34560
|
+
if (options.trim_marks === true) {
|
|
34561
|
+
pdfOpts.trimMarks = true;
|
|
34562
|
+
} else {
|
|
34563
|
+
pdfOpts.trimMarks = false;
|
|
34564
|
+
}
|
|
34493
34565
|
}
|
|
34494
34566
|
|
|
34495
|
-
// \u65E5\u672C\u5F0F\u30C8\u30F3\u30DC\
|
|
34496
|
-
if (options.marks_style === "japanese" && options.trim_marks === true) {
|
|
34497
|
-
// \u30EC\u30B8\u30B9\u30C8\u30EC\u30FC\u30B7\u30E7\u30F3\u30DE\u30FC\u30AF\uFF08\u30BB\u30F3\u30BF\u30FC\u30C8\u30F3\u30DC\uFF09\u304C\u672A\u6307\u5B9A\u306A\u3089\u81EA\u52D5ON
|
|
34567
|
+
// \u65E5\u672C\u5F0F\u30C8\u30F3\u30DC\uFF08PDFSaveOptions \u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u6642\uFF09\u306E\u5FC5\u9808\u8A2D\u5B9A\u3092\u81EA\u52D5\u9069\u7528
|
|
34568
|
+
if (options.marks_style === "japanese" && options.trim_marks === true && !usedDocumentMarks) {
|
|
34498
34569
|
if (typeof options.registration_marks === "undefined") {
|
|
34499
34570
|
pdfOpts.registrationMarks = true;
|
|
34500
34571
|
}
|
|
34501
|
-
// \u88C1\u3061\u843D\u3068\u3057\u304C\u672A\u6307\u5B9A\u306A\u30893mm\u81EA\u52D5\u8A2D\u5B9A\uFF08\u5916\u30C8\u30F3\u30DC\u306E\u8868\u793A\u306B\u5FC5\u8981\uFF09
|
|
34502
34572
|
if (options.bleed !== true) {
|
|
34503
34573
|
var bleedPt = 8.504; // 3mm
|
|
34504
34574
|
pdfOpts.bleedOffsetRect = [bleedPt, bleedPt, bleedPt, bleedPt];
|
|
34505
34575
|
}
|
|
34506
34576
|
}
|
|
34507
34577
|
|
|
34508
|
-
// \u30C8\u30F3\u30DC\u306E\u592A\u3055\uFF08\u6587\u5B57\u5217\u30FB\u6570\u5024\u4E21\u5BFE\u5FDC\uFF09
|
|
34509
|
-
|
|
34510
|
-
|
|
34511
|
-
|
|
34512
|
-
|
|
34513
|
-
|
|
34514
|
-
|
|
34515
|
-
|
|
34516
|
-
|
|
34517
|
-
|
|
34578
|
+
// \u30C8\u30F3\u30DC\u306E\u592A\u3055\uFF08\u6587\u5B57\u5217\u30FB\u6570\u5024\u4E21\u5BFE\u5FDC\uFF09 \u2014 \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30DE\u30FC\u30AF\u6642\u306F\u4E0D\u8981
|
|
34579
|
+
if (!usedDocumentMarks) {
|
|
34580
|
+
var tw = String(options.trim_mark_weight);
|
|
34581
|
+
if (tw === "0.125") {
|
|
34582
|
+
pdfOpts.trimMarkWeight = PDFTrimMarkWeight.TRIMMARKWEIGHT0125;
|
|
34583
|
+
} else if (tw === "0.25") {
|
|
34584
|
+
pdfOpts.trimMarkWeight = PDFTrimMarkWeight.TRIMMARKWEIGHT025;
|
|
34585
|
+
} else if (tw === "0.5") {
|
|
34586
|
+
pdfOpts.trimMarkWeight = PDFTrimMarkWeight.TRIMMARKWEIGHT05;
|
|
34587
|
+
} else if (options.trim_marks === true) {
|
|
34588
|
+
pdfOpts.trimMarkWeight = PDFTrimMarkWeight.TRIMMARKWEIGHT0125;
|
|
34589
|
+
}
|
|
34518
34590
|
}
|
|
34519
34591
|
|
|
34520
34592
|
// \u30EC\u30B8\u30B9\u30C8\u30EC\u30FC\u30B7\u30E7\u30F3\u30DE\u30FC\u30AF
|
|
@@ -34532,10 +34604,9 @@ if (preflight) {
|
|
|
34532
34604
|
pdfOpts.pageInformation = options.page_information;
|
|
34533
34605
|
}
|
|
34534
34606
|
|
|
34535
|
-
// Bleed
|
|
34536
|
-
if (options.bleed === true) {
|
|
34537
|
-
|
|
34538
|
-
var bleedPt = 8.504;
|
|
34607
|
+
// Bleed \u2014 \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u30DE\u30FC\u30AF\u6642\u306F\u30A2\u30FC\u30C8\u30DC\u30FC\u30C9\u62E1\u5F35\u6E08\u307F\u306A\u306E\u3067 bleed \u4E0D\u8981
|
|
34608
|
+
if (options.bleed === true && !usedDocumentMarks) {
|
|
34609
|
+
var bleedPt = 8.504; // 3mm
|
|
34539
34610
|
pdfOpts.bleedOffsetRect = [bleedPt, bleedPt, bleedPt, bleedPt];
|
|
34540
34611
|
}
|
|
34541
34612
|
|
|
@@ -34586,14 +34657,38 @@ if (preflight) {
|
|
|
34586
34657
|
if (!parentFolder.exists) {
|
|
34587
34658
|
writeResultFile(RESULT_PATH, { error: true, message: "Output directory does not exist: " + parentFolder.fsName });
|
|
34588
34659
|
} else {
|
|
34589
|
-
|
|
34660
|
+
var saveError = null;
|
|
34661
|
+
try {
|
|
34662
|
+
doc.saveAs(outFile, pdfOpts);
|
|
34663
|
+
} catch (saveErr) {
|
|
34664
|
+
saveError = saveErr;
|
|
34665
|
+
} finally {
|
|
34666
|
+
// \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u5143\u306E\u72B6\u614B\u306B\u5FA9\u5143\uFF08saveAs \u306E\u6210\u5426\u306B\u304B\u304B\u308F\u3089\u305A\u5FC5\u305A\u5B9F\u884C\uFF09
|
|
34667
|
+
if (usedDocumentMarks) {
|
|
34668
|
+
for (var g = 0; g < trimMarkGroups.length; g++) {
|
|
34669
|
+
try { trimMarkGroups[g].remove(); } catch (re) {}
|
|
34670
|
+
}
|
|
34671
|
+
if (origAbRect) {
|
|
34672
|
+
try { doc.artboards[abIdx].artboardRect = origAbRect; } catch (restoreErr) {}
|
|
34673
|
+
}
|
|
34674
|
+
}
|
|
34675
|
+
}
|
|
34590
34676
|
|
|
34591
|
-
|
|
34592
|
-
|
|
34593
|
-
if (!verifyFile.exists) {
|
|
34594
|
-
writeResultFile(RESULT_PATH, { error: true, message: "PDF export completed but output file was not created. The path may not be writable: " + outputPath });
|
|
34677
|
+
if (saveError) {
|
|
34678
|
+
writeResultFile(RESULT_PATH, { error: true, message: "PDF export failed: " + saveError.message, line: saveError.line });
|
|
34595
34679
|
} else {
|
|
34596
|
-
|
|
34680
|
+
// \u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u5F8C\u306B\u30D5\u30A1\u30A4\u30EB\u5B58\u5728\u3092\u691C\u8A3C
|
|
34681
|
+
var verifyFile = new File(outputPath);
|
|
34682
|
+
if (!verifyFile.exists) {
|
|
34683
|
+
writeResultFile(RESULT_PATH, { error: true, message: "PDF export completed but output file was not created. The path may not be writable: " + outputPath });
|
|
34684
|
+
} else {
|
|
34685
|
+
var result = { success: true, output_path: outputPath };
|
|
34686
|
+
if (usedDocumentMarks) {
|
|
34687
|
+
result.japanese_marks_method = "document_trimmark";
|
|
34688
|
+
result.japanese_marks_note = "Japanese crop marks were generated as document paths via TrimMark command for reliable rendering, then removed after export.";
|
|
34689
|
+
}
|
|
34690
|
+
writeResultFile(RESULT_PATH, result);
|
|
34691
|
+
}
|
|
34597
34692
|
}
|
|
34598
34693
|
}
|
|
34599
34694
|
} catch (e) {
|
|
@@ -38127,8 +38222,196 @@ function register39(server) {
|
|
|
38127
38222
|
);
|
|
38128
38223
|
}
|
|
38129
38224
|
|
|
38130
|
-
// src/tools/modify/create-
|
|
38225
|
+
// src/tools/modify/create-crop-marks.ts
|
|
38131
38226
|
var jsxCode39 = `
|
|
38227
|
+
var preflight = preflightChecks();
|
|
38228
|
+
if (preflight) {
|
|
38229
|
+
writeResultFile(RESULT_PATH, preflight);
|
|
38230
|
+
} else {
|
|
38231
|
+
try {
|
|
38232
|
+
var params = readParamsFile(PARAMS_PATH);
|
|
38233
|
+
var doc = app.activeDocument;
|
|
38234
|
+
var useSelection = params.use_selection === true;
|
|
38235
|
+
|
|
38236
|
+
// --- Determine crop mark style ---
|
|
38237
|
+
var style = params.style || "auto";
|
|
38238
|
+
var locale = params.locale || "";
|
|
38239
|
+
var resolvedStyle = "western";
|
|
38240
|
+
|
|
38241
|
+
var japaneseLocales = ["ja", "ja-jp", "ja_jp"];
|
|
38242
|
+
|
|
38243
|
+
if (style === "japanese") {
|
|
38244
|
+
resolvedStyle = "japanese";
|
|
38245
|
+
} else if (style === "western") {
|
|
38246
|
+
resolvedStyle = "western";
|
|
38247
|
+
} else {
|
|
38248
|
+
// auto: detect from locale
|
|
38249
|
+
var localeLower = locale.toLowerCase().replace(/_/g, "-");
|
|
38250
|
+
for (var i = 0; i < japaneseLocales.length; i++) {
|
|
38251
|
+
if (localeLower === japaneseLocales[i] || localeLower.indexOf("ja") === 0) {
|
|
38252
|
+
resolvedStyle = "japanese";
|
|
38253
|
+
break;
|
|
38254
|
+
}
|
|
38255
|
+
}
|
|
38256
|
+
if (!locale) {
|
|
38257
|
+
try {
|
|
38258
|
+
var aiLocale = app.locale;
|
|
38259
|
+
if (aiLocale && aiLocale.toLowerCase().indexOf("ja") === 0) {
|
|
38260
|
+
resolvedStyle = "japanese";
|
|
38261
|
+
}
|
|
38262
|
+
} catch (e) {}
|
|
38263
|
+
}
|
|
38264
|
+
}
|
|
38265
|
+
|
|
38266
|
+
// Set crop mark style preference
|
|
38267
|
+
app.preferences.setBooleanPreference("cropMarkStyle", resolvedStyle === "japanese");
|
|
38268
|
+
|
|
38269
|
+
if (useSelection) {
|
|
38270
|
+
// --- \u9078\u629E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u30E2\u30FC\u30C9 ---
|
|
38271
|
+
var sel = doc.selection;
|
|
38272
|
+
if (!sel || sel.length === 0) {
|
|
38273
|
+
writeResultFile(RESULT_PATH, { error: true, message: "No objects selected. Select one or more objects to create crop marks for." });
|
|
38274
|
+
} else {
|
|
38275
|
+
var groupCountBefore = doc.groupItems.length;
|
|
38276
|
+
|
|
38277
|
+
executeTrimMark();
|
|
38278
|
+
doc.selection = null;
|
|
38279
|
+
|
|
38280
|
+
var newGroups = doc.groupItems.length - groupCountBefore;
|
|
38281
|
+
if (newGroups === 0) {
|
|
38282
|
+
writeResultFile(RESULT_PATH, { error: true, message: "TrimMark command ran but created no marks. The selected object may not be suitable for crop marks." });
|
|
38283
|
+
} else {
|
|
38284
|
+
var styleName = (resolvedStyle === "japanese") ? "Japanese (\u65E5\u672C\u5F0F\u30C8\u30F3\u30DC)" : "Western (\u897F\u6D0B\u5F0F\u30C8\u30F3\u30DC)";
|
|
38285
|
+
writeResultFile(RESULT_PATH, {
|
|
38286
|
+
success: true,
|
|
38287
|
+
mode: "selection",
|
|
38288
|
+
crop_mark_style: resolvedStyle,
|
|
38289
|
+
style_display_name: styleName,
|
|
38290
|
+
mark_groups_created: newGroups,
|
|
38291
|
+
artboard_modified: false,
|
|
38292
|
+
description: "Crop marks created for the selected object(s). Artboard was not modified."
|
|
38293
|
+
});
|
|
38294
|
+
}
|
|
38295
|
+
}
|
|
38296
|
+
} else {
|
|
38297
|
+
// --- \u30A2\u30FC\u30C8\u30DC\u30FC\u30C9\u30E2\u30FC\u30C9 ---
|
|
38298
|
+
var abIndex = (typeof params.artboard_index === "number") ? params.artboard_index : doc.artboards.getActiveArtboardIndex();
|
|
38299
|
+
if (abIndex < 0 || abIndex >= doc.artboards.length) {
|
|
38300
|
+
writeResultFile(RESULT_PATH, { error: true, message: "Invalid artboard index: " + abIndex });
|
|
38301
|
+
} else {
|
|
38302
|
+
var ab = doc.artboards[abIndex];
|
|
38303
|
+
var abRect = ab.artboardRect;
|
|
38304
|
+
var origAbRect = abRect.slice(); // \u5143\u306E\u30A2\u30FC\u30C8\u30DC\u30FC\u30C9\u77E9\u5F62\u3092\u4FDD\u5B58
|
|
38305
|
+
var abWidth = abRect[2] - abRect[0];
|
|
38306
|
+
var abHeight = abRect[1] - abRect[3];
|
|
38307
|
+
|
|
38308
|
+
// \u30A2\u30FC\u30C8\u30DC\u30FC\u30C9\u30B5\u30A4\u30BA\u306E\u4E00\u6642\u77E9\u5F62\u3092\u4F5C\u6210
|
|
38309
|
+
var tempRect = doc.pathItems.rectangle(abRect[1], abRect[0], abWidth, abHeight);
|
|
38310
|
+
tempRect.filled = false;
|
|
38311
|
+
tempRect.stroked = false;
|
|
38312
|
+
|
|
38313
|
+
doc.artboards.setActiveArtboardIndex(abIndex);
|
|
38314
|
+
|
|
38315
|
+
var groupCountBefore = doc.groupItems.length;
|
|
38316
|
+
|
|
38317
|
+
doc.selection = null;
|
|
38318
|
+
tempRect.selected = true;
|
|
38319
|
+
|
|
38320
|
+
executeTrimMark();
|
|
38321
|
+
|
|
38322
|
+
try { tempRect.remove(); } catch (removeErr) {}
|
|
38323
|
+
doc.selection = null;
|
|
38324
|
+
|
|
38325
|
+
// \u30C8\u30F3\u30DC\u30B0\u30EB\u30FC\u30D7\u306E\u53C2\u7167\u3092\u53D6\u5F97
|
|
38326
|
+
var newGroupCount = doc.groupItems.length - groupCountBefore;
|
|
38327
|
+
if (newGroupCount === 0) {
|
|
38328
|
+
writeResultFile(RESULT_PATH, { error: true, message: "TrimMark command ran but created no marks." });
|
|
38329
|
+
} else {
|
|
38330
|
+
var trimMarkGroups = [];
|
|
38331
|
+
for (var g = 0; g < newGroupCount; g++) {
|
|
38332
|
+
trimMarkGroups.push(doc.groupItems[g]);
|
|
38333
|
+
}
|
|
38334
|
+
|
|
38335
|
+
// \u30C8\u30F3\u30DC\u5168\u4F53\u306E\u5916\u63A5\u77E9\u5F62\u3092\u8A08\u7B97\u3057\u3066\u30A2\u30FC\u30C8\u30DC\u30FC\u30C9\u3092\u62E1\u5F35
|
|
38336
|
+
if (trimMarkGroups.length > 0) {
|
|
38337
|
+
var mb = trimMarkGroups[0].geometricBounds.slice();
|
|
38338
|
+
for (var g = 1; g < trimMarkGroups.length; g++) {
|
|
38339
|
+
var gb = trimMarkGroups[g].geometricBounds;
|
|
38340
|
+
if (gb[0] < mb[0]) mb[0] = gb[0];
|
|
38341
|
+
if (gb[1] > mb[1]) mb[1] = gb[1];
|
|
38342
|
+
if (gb[2] > mb[2]) mb[2] = gb[2];
|
|
38343
|
+
if (gb[3] < mb[3]) mb[3] = gb[3];
|
|
38344
|
+
}
|
|
38345
|
+
// \u30A2\u30FC\u30C8\u30DC\u30FC\u30C9\u3092\u30C8\u30F3\u30DC\u304C\u53CE\u307E\u308B\u30B5\u30A4\u30BA\u306B\u62E1\u5F35\uFF08\u5C11\u3057\u4F59\u88D5\u3092\u6301\u305F\u305B\u308B: 1pt\uFF09
|
|
38346
|
+
ab.artboardRect = [mb[0] - 1, mb[1] + 1, mb[2] + 1, mb[3] - 1];
|
|
38347
|
+
}
|
|
38348
|
+
|
|
38349
|
+
var newAbRect = ab.artboardRect;
|
|
38350
|
+
var styleName = (resolvedStyle === "japanese") ? "Japanese (\u65E5\u672C\u5F0F\u30C8\u30F3\u30DC)" : "Western (\u897F\u6D0B\u5F0F\u30C8\u30F3\u30DC)";
|
|
38351
|
+
var detectionMethod = "";
|
|
38352
|
+
if (style === "japanese" || style === "western") {
|
|
38353
|
+
detectionMethod = "explicitly specified";
|
|
38354
|
+
} else if (locale) {
|
|
38355
|
+
detectionMethod = "detected from locale: " + locale;
|
|
38356
|
+
} else {
|
|
38357
|
+
detectionMethod = "detected from Illustrator locale";
|
|
38358
|
+
}
|
|
38359
|
+
|
|
38360
|
+
writeResultFile(RESULT_PATH, {
|
|
38361
|
+
success: true,
|
|
38362
|
+
mode: "artboard",
|
|
38363
|
+
crop_mark_style: resolvedStyle,
|
|
38364
|
+
style_display_name: styleName,
|
|
38365
|
+
detection_method: detectionMethod,
|
|
38366
|
+
mark_groups_created: newGroupCount,
|
|
38367
|
+
artboard_index: abIndex,
|
|
38368
|
+
artboard_name: ab.name,
|
|
38369
|
+
artboard_modified: true,
|
|
38370
|
+
original_artboard_size: { width: abWidth, height: abHeight },
|
|
38371
|
+
new_artboard_size: {
|
|
38372
|
+
width: newAbRect[2] - newAbRect[0],
|
|
38373
|
+
height: newAbRect[1] - newAbRect[3]
|
|
38374
|
+
},
|
|
38375
|
+
description: (resolvedStyle === "japanese")
|
|
38376
|
+
? "Japanese crop marks created. Artboard expanded to include all marks."
|
|
38377
|
+
: "Western crop marks created. Artboard expanded to include all marks."
|
|
38378
|
+
});
|
|
38379
|
+
}
|
|
38380
|
+
}
|
|
38381
|
+
}
|
|
38382
|
+
} catch (e) {
|
|
38383
|
+
writeResultFile(RESULT_PATH, { error: true, message: "Failed to create crop marks: " + e.message, line: e.line });
|
|
38384
|
+
}
|
|
38385
|
+
}
|
|
38386
|
+
`;
|
|
38387
|
+
function register40(server) {
|
|
38388
|
+
server.registerTool(
|
|
38389
|
+
"create_crop_marks",
|
|
38390
|
+
{
|
|
38391
|
+
title: "Create Crop Marks (\u30C8\u30F3\u30DC)",
|
|
38392
|
+
description: "Create crop marks (\u30C8\u30F3\u30DC / trim marks) on the active artboard or selected objects. By default, creates marks for the artboard and expands the artboard to include all marks. With use_selection=true, creates marks for the currently selected object(s) without modifying the artboard. Automatically selects Japanese-style (\u65E5\u672C\u5F0F) or Western-style crop marks based on locale. Note: Illustrator will be activated (brought to foreground) during execution.",
|
|
38393
|
+
inputSchema: {
|
|
38394
|
+
style: external_exports.enum(["auto", "japanese", "western"]).optional().default("auto").describe(
|
|
38395
|
+
'Crop mark style. "japanese" = double-line marks with 3mm bleed indication (\u65E5\u672C\u5F0F\u30C8\u30F3\u30DC). "western" = single-line marks (\u897F\u6D0B\u5F0F\u30C8\u30F3\u30DC). "auto" = detect from locale parameter or Illustrator locale.'
|
|
38396
|
+
),
|
|
38397
|
+
locale: external_exports.string().optional().describe(
|
|
38398
|
+
`User locale (e.g. "ja", "ja-JP", "en-US", "de-DE"). Used to auto-detect crop mark style when style is "auto". Japanese locales (ja*) \u2192 Japanese marks, others \u2192 Western marks. If omitted, falls back to Illustrator's own locale setting.`
|
|
38399
|
+
),
|
|
38400
|
+
use_selection: external_exports.boolean().optional().default(false).describe(
|
|
38401
|
+
"If true, create crop marks for the currently selected object(s) instead of the artboard. The artboard will NOT be modified. If false (default), creates marks for the artboard and expands it to fit."
|
|
38402
|
+
),
|
|
38403
|
+
artboard_index: external_exports.number().int().min(0).optional().describe("Target artboard index (0-based). Defaults to the currently active artboard. Ignored when use_selection is true.")
|
|
38404
|
+
},
|
|
38405
|
+
annotations: WRITE_ANNOTATIONS
|
|
38406
|
+
},
|
|
38407
|
+
async (params) => {
|
|
38408
|
+
return executeToolJsx(jsxCode39, params, { activate: true });
|
|
38409
|
+
}
|
|
38410
|
+
);
|
|
38411
|
+
}
|
|
38412
|
+
|
|
38413
|
+
// src/tools/modify/create-document.ts
|
|
38414
|
+
var jsxCode40 = `
|
|
38132
38415
|
try {
|
|
38133
38416
|
var verErr = checkIllustratorVersion();
|
|
38134
38417
|
if (verErr) {
|
|
@@ -38158,7 +38441,7 @@ try {
|
|
|
38158
38441
|
writeResultFile(RESULT_PATH, { error: true, message: "Failed to create document: " + e.message, line: e.line });
|
|
38159
38442
|
}
|
|
38160
38443
|
`;
|
|
38161
|
-
function
|
|
38444
|
+
function register41(server) {
|
|
38162
38445
|
server.registerTool(
|
|
38163
38446
|
"create_document",
|
|
38164
38447
|
{
|
|
@@ -38172,7 +38455,7 @@ function register40(server) {
|
|
|
38172
38455
|
annotations: WRITE_ANNOTATIONS
|
|
38173
38456
|
},
|
|
38174
38457
|
async (params) => {
|
|
38175
|
-
const result = await executeJsx(
|
|
38458
|
+
const result = await executeJsx(jsxCode40, params, { activate: true });
|
|
38176
38459
|
invalidateAutoDetectCache();
|
|
38177
38460
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
38178
38461
|
}
|
|
@@ -38180,7 +38463,7 @@ function register40(server) {
|
|
|
38180
38463
|
}
|
|
38181
38464
|
|
|
38182
38465
|
// src/tools/modify/close-document.ts
|
|
38183
|
-
var
|
|
38466
|
+
var jsxCode41 = `
|
|
38184
38467
|
try {
|
|
38185
38468
|
var verErr = checkIllustratorVersion();
|
|
38186
38469
|
if (verErr) {
|
|
@@ -38201,7 +38484,7 @@ try {
|
|
|
38201
38484
|
writeResultFile(RESULT_PATH, { error: true, message: "Failed to close document: " + e.message, line: e.line });
|
|
38202
38485
|
}
|
|
38203
38486
|
`;
|
|
38204
|
-
function
|
|
38487
|
+
function register42(server) {
|
|
38205
38488
|
server.registerTool(
|
|
38206
38489
|
"close_document",
|
|
38207
38490
|
{
|
|
@@ -38213,7 +38496,7 @@ function register41(server) {
|
|
|
38213
38496
|
annotations: DESTRUCTIVE_ANNOTATIONS
|
|
38214
38497
|
},
|
|
38215
38498
|
async (params) => {
|
|
38216
|
-
const result = await executeJsx(
|
|
38499
|
+
const result = await executeJsx(jsxCode41, params, { activate: true });
|
|
38217
38500
|
invalidateAutoDetectCache();
|
|
38218
38501
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
38219
38502
|
}
|
|
@@ -38221,7 +38504,7 @@ function register41(server) {
|
|
|
38221
38504
|
}
|
|
38222
38505
|
|
|
38223
38506
|
// src/tools/modify/save-document.ts
|
|
38224
|
-
var
|
|
38507
|
+
var jsxCode42 = `
|
|
38225
38508
|
var preflight = preflightChecks();
|
|
38226
38509
|
if (preflight) {
|
|
38227
38510
|
writeResultFile(RESULT_PATH, preflight);
|
|
@@ -38269,7 +38552,7 @@ if (preflight) {
|
|
|
38269
38552
|
}
|
|
38270
38553
|
}
|
|
38271
38554
|
`;
|
|
38272
|
-
function
|
|
38555
|
+
function register43(server) {
|
|
38273
38556
|
server.registerTool(
|
|
38274
38557
|
"save_document",
|
|
38275
38558
|
{
|
|
@@ -38282,14 +38565,14 @@ function register42(server) {
|
|
|
38282
38565
|
annotations: WRITE_IDEMPOTENT_ANNOTATIONS
|
|
38283
38566
|
},
|
|
38284
38567
|
async (params) => {
|
|
38285
|
-
const result = await executeJsx(
|
|
38568
|
+
const result = await executeJsx(jsxCode42, params, { activate: true });
|
|
38286
38569
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
38287
38570
|
}
|
|
38288
38571
|
);
|
|
38289
38572
|
}
|
|
38290
38573
|
|
|
38291
38574
|
// src/tools/modify/open-document.ts
|
|
38292
|
-
var
|
|
38575
|
+
var jsxCode43 = `
|
|
38293
38576
|
try {
|
|
38294
38577
|
var verErr = checkIllustratorVersion();
|
|
38295
38578
|
if (verErr) {
|
|
@@ -38328,7 +38611,7 @@ try {
|
|
|
38328
38611
|
writeResultFile(RESULT_PATH, { error: true, message: "open_document failed: " + e.message, line: e.line });
|
|
38329
38612
|
}
|
|
38330
38613
|
`;
|
|
38331
|
-
function
|
|
38614
|
+
function register44(server) {
|
|
38332
38615
|
server.registerTool(
|
|
38333
38616
|
"open_document",
|
|
38334
38617
|
{
|
|
@@ -38341,7 +38624,7 @@ function register43(server) {
|
|
|
38341
38624
|
annotations: WRITE_ANNOTATIONS
|
|
38342
38625
|
},
|
|
38343
38626
|
async (params) => {
|
|
38344
|
-
const result = await executeJsx(
|
|
38627
|
+
const result = await executeJsx(jsxCode43, params, { activate: true });
|
|
38345
38628
|
invalidateAutoDetectCache();
|
|
38346
38629
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
38347
38630
|
}
|
|
@@ -38349,7 +38632,7 @@ function register43(server) {
|
|
|
38349
38632
|
}
|
|
38350
38633
|
|
|
38351
38634
|
// src/tools/modify/group-objects.ts
|
|
38352
|
-
var
|
|
38635
|
+
var jsxCode44 = `
|
|
38353
38636
|
var preflight = preflightChecks();
|
|
38354
38637
|
if (preflight) {
|
|
38355
38638
|
writeResultFile(RESULT_PATH, preflight);
|
|
@@ -38397,7 +38680,7 @@ if (preflight) {
|
|
|
38397
38680
|
}
|
|
38398
38681
|
}
|
|
38399
38682
|
`;
|
|
38400
|
-
function
|
|
38683
|
+
function register45(server) {
|
|
38401
38684
|
server.registerTool(
|
|
38402
38685
|
"group_objects",
|
|
38403
38686
|
{
|
|
@@ -38411,14 +38694,14 @@ function register44(server) {
|
|
|
38411
38694
|
annotations: WRITE_ANNOTATIONS
|
|
38412
38695
|
},
|
|
38413
38696
|
async (params) => {
|
|
38414
|
-
const result = await executeJsx(
|
|
38697
|
+
const result = await executeJsx(jsxCode44, params, { activate: true });
|
|
38415
38698
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
38416
38699
|
}
|
|
38417
38700
|
);
|
|
38418
38701
|
}
|
|
38419
38702
|
|
|
38420
38703
|
// src/tools/modify/ungroup-objects.ts
|
|
38421
|
-
var
|
|
38704
|
+
var jsxCode45 = `
|
|
38422
38705
|
var preflight = preflightChecks();
|
|
38423
38706
|
if (preflight) {
|
|
38424
38707
|
writeResultFile(RESULT_PATH, preflight);
|
|
@@ -38461,7 +38744,7 @@ if (preflight) {
|
|
|
38461
38744
|
}
|
|
38462
38745
|
}
|
|
38463
38746
|
`;
|
|
38464
|
-
function
|
|
38747
|
+
function register46(server) {
|
|
38465
38748
|
server.registerTool(
|
|
38466
38749
|
"ungroup_objects",
|
|
38467
38750
|
{
|
|
@@ -38473,14 +38756,14 @@ function register45(server) {
|
|
|
38473
38756
|
annotations: DESTRUCTIVE_ANNOTATIONS
|
|
38474
38757
|
},
|
|
38475
38758
|
async (params) => {
|
|
38476
|
-
const result = await executeJsx(
|
|
38759
|
+
const result = await executeJsx(jsxCode45, params, { activate: true });
|
|
38477
38760
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
38478
38761
|
}
|
|
38479
38762
|
);
|
|
38480
38763
|
}
|
|
38481
38764
|
|
|
38482
38765
|
// src/tools/modify/duplicate-objects.ts
|
|
38483
|
-
var
|
|
38766
|
+
var jsxCode46 = `
|
|
38484
38767
|
var preflight = preflightChecks();
|
|
38485
38768
|
if (preflight) {
|
|
38486
38769
|
writeResultFile(RESULT_PATH, preflight);
|
|
@@ -38539,7 +38822,7 @@ if (preflight) {
|
|
|
38539
38822
|
}
|
|
38540
38823
|
}
|
|
38541
38824
|
`;
|
|
38542
|
-
function
|
|
38825
|
+
function register47(server) {
|
|
38543
38826
|
server.registerTool(
|
|
38544
38827
|
"duplicate_objects",
|
|
38545
38828
|
{
|
|
@@ -38557,14 +38840,14 @@ function register46(server) {
|
|
|
38557
38840
|
annotations: WRITE_ANNOTATIONS
|
|
38558
38841
|
},
|
|
38559
38842
|
async (params) => {
|
|
38560
|
-
const result = await executeJsx(
|
|
38843
|
+
const result = await executeJsx(jsxCode46, params, { activate: true });
|
|
38561
38844
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
38562
38845
|
}
|
|
38563
38846
|
);
|
|
38564
38847
|
}
|
|
38565
38848
|
|
|
38566
38849
|
// src/tools/read/list-fonts.ts
|
|
38567
|
-
var
|
|
38850
|
+
var jsxCode47 = `
|
|
38568
38851
|
try {
|
|
38569
38852
|
var verErr = checkIllustratorVersion();
|
|
38570
38853
|
if (verErr) {
|
|
@@ -38602,7 +38885,7 @@ try {
|
|
|
38602
38885
|
writeResultFile(RESULT_PATH, { error: true, message: "list_fonts failed: " + e.message, line: e.line });
|
|
38603
38886
|
}
|
|
38604
38887
|
`;
|
|
38605
|
-
function
|
|
38888
|
+
function register48(server) {
|
|
38606
38889
|
server.registerTool(
|
|
38607
38890
|
"list_fonts",
|
|
38608
38891
|
{
|
|
@@ -38615,14 +38898,14 @@ function register47(server) {
|
|
|
38615
38898
|
annotations: READ_ANNOTATIONS
|
|
38616
38899
|
},
|
|
38617
38900
|
async (params) => {
|
|
38618
|
-
const result = await executeJsx(
|
|
38901
|
+
const result = await executeJsx(jsxCode47, params);
|
|
38619
38902
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
38620
38903
|
}
|
|
38621
38904
|
);
|
|
38622
38905
|
}
|
|
38623
38906
|
|
|
38624
38907
|
// src/tools/modify/manage-artboards.ts
|
|
38625
|
-
var
|
|
38908
|
+
var jsxCode48 = `
|
|
38626
38909
|
var preflight = preflightChecks();
|
|
38627
38910
|
if (preflight) {
|
|
38628
38911
|
writeResultFile(RESULT_PATH, preflight);
|
|
@@ -38711,7 +38994,7 @@ if (preflight) {
|
|
|
38711
38994
|
}
|
|
38712
38995
|
}
|
|
38713
38996
|
`;
|
|
38714
|
-
function
|
|
38997
|
+
function register49(server) {
|
|
38715
38998
|
server.registerTool(
|
|
38716
38999
|
"manage_artboards",
|
|
38717
39000
|
{
|
|
@@ -38734,14 +39017,14 @@ function register48(server) {
|
|
|
38734
39017
|
annotations: DESTRUCTIVE_ANNOTATIONS
|
|
38735
39018
|
},
|
|
38736
39019
|
async (params) => {
|
|
38737
|
-
const result = await executeJsx(
|
|
39020
|
+
const result = await executeJsx(jsxCode48, params, { activate: true });
|
|
38738
39021
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
38739
39022
|
}
|
|
38740
39023
|
);
|
|
38741
39024
|
}
|
|
38742
39025
|
|
|
38743
39026
|
// src/tools/modify/set-z-order.ts
|
|
38744
|
-
var
|
|
39027
|
+
var jsxCode49 = `
|
|
38745
39028
|
var preflight = preflightChecks();
|
|
38746
39029
|
if (preflight) {
|
|
38747
39030
|
writeResultFile(RESULT_PATH, preflight);
|
|
@@ -38773,7 +39056,7 @@ if (preflight) {
|
|
|
38773
39056
|
}
|
|
38774
39057
|
}
|
|
38775
39058
|
`;
|
|
38776
|
-
function
|
|
39059
|
+
function register50(server) {
|
|
38777
39060
|
server.registerTool(
|
|
38778
39061
|
"set_z_order",
|
|
38779
39062
|
{
|
|
@@ -38786,14 +39069,14 @@ function register49(server) {
|
|
|
38786
39069
|
annotations: WRITE_ANNOTATIONS
|
|
38787
39070
|
},
|
|
38788
39071
|
async (params) => {
|
|
38789
|
-
const result = await executeJsx(
|
|
39072
|
+
const result = await executeJsx(jsxCode49, params, { activate: true });
|
|
38790
39073
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
38791
39074
|
}
|
|
38792
39075
|
);
|
|
38793
39076
|
}
|
|
38794
39077
|
|
|
38795
39078
|
// src/tools/modify/move-to-layer.ts
|
|
38796
|
-
var
|
|
39079
|
+
var jsxCode50 = `
|
|
38797
39080
|
var preflight = preflightChecks();
|
|
38798
39081
|
if (preflight) {
|
|
38799
39082
|
writeResultFile(RESULT_PATH, preflight);
|
|
@@ -38840,7 +39123,7 @@ if (preflight) {
|
|
|
38840
39123
|
}
|
|
38841
39124
|
}
|
|
38842
39125
|
`;
|
|
38843
|
-
function
|
|
39126
|
+
function register51(server) {
|
|
38844
39127
|
server.registerTool(
|
|
38845
39128
|
"move_to_layer",
|
|
38846
39129
|
{
|
|
@@ -38854,7 +39137,7 @@ function register50(server) {
|
|
|
38854
39137
|
annotations: WRITE_ANNOTATIONS
|
|
38855
39138
|
},
|
|
38856
39139
|
async (params) => {
|
|
38857
|
-
const result = await executeJsx(
|
|
39140
|
+
const result = await executeJsx(jsxCode50, params, { activate: true });
|
|
38858
39141
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
38859
39142
|
}
|
|
38860
39143
|
);
|
|
@@ -38925,7 +39208,7 @@ if (preflight) {
|
|
|
38925
39208
|
}
|
|
38926
39209
|
}
|
|
38927
39210
|
`;
|
|
38928
|
-
function
|
|
39211
|
+
function register52(server) {
|
|
38929
39212
|
server.registerTool(
|
|
38930
39213
|
"apply_graphic_style",
|
|
38931
39214
|
{
|
|
@@ -38959,7 +39242,7 @@ function register51(server) {
|
|
|
38959
39242
|
}
|
|
38960
39243
|
|
|
38961
39244
|
// src/tools/modify/manage-swatches.ts
|
|
38962
|
-
var
|
|
39245
|
+
var jsxCode51 = `
|
|
38963
39246
|
${COLOR_HELPERS_JSX}
|
|
38964
39247
|
|
|
38965
39248
|
var preflight = preflightChecks();
|
|
@@ -39006,7 +39289,7 @@ if (preflight) {
|
|
|
39006
39289
|
}
|
|
39007
39290
|
}
|
|
39008
39291
|
`;
|
|
39009
|
-
function
|
|
39292
|
+
function register53(server) {
|
|
39010
39293
|
server.registerTool(
|
|
39011
39294
|
"manage_swatches",
|
|
39012
39295
|
{
|
|
@@ -39020,7 +39303,7 @@ function register52(server) {
|
|
|
39020
39303
|
annotations: DESTRUCTIVE_ANNOTATIONS
|
|
39021
39304
|
},
|
|
39022
39305
|
async (params) => {
|
|
39023
|
-
const result = await executeJsx(
|
|
39306
|
+
const result = await executeJsx(jsxCode51, params, { activate: true });
|
|
39024
39307
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
39025
39308
|
}
|
|
39026
39309
|
);
|
|
@@ -39102,7 +39385,7 @@ if (preflight) {
|
|
|
39102
39385
|
}
|
|
39103
39386
|
}
|
|
39104
39387
|
`;
|
|
39105
|
-
function
|
|
39388
|
+
function register54(server) {
|
|
39106
39389
|
server.registerTool(
|
|
39107
39390
|
"apply_text_style",
|
|
39108
39391
|
{
|
|
@@ -39137,7 +39420,7 @@ function register53(server) {
|
|
|
39137
39420
|
}
|
|
39138
39421
|
|
|
39139
39422
|
// src/tools/modify/create-gradient.ts
|
|
39140
|
-
var
|
|
39423
|
+
var jsxCode52 = `
|
|
39141
39424
|
${COLOR_HELPERS_JSX}
|
|
39142
39425
|
|
|
39143
39426
|
var preflight = preflightChecks();
|
|
@@ -39202,7 +39485,7 @@ if (preflight) {
|
|
|
39202
39485
|
}
|
|
39203
39486
|
`;
|
|
39204
39487
|
var stopColorSchema = external_exports.discriminatedUnion("type", [cmykColorSchema, rgbColorSchema, grayColorSchema]);
|
|
39205
|
-
function
|
|
39488
|
+
function register55(server) {
|
|
39206
39489
|
server.registerTool(
|
|
39207
39490
|
"create_gradient",
|
|
39208
39491
|
{
|
|
@@ -39225,14 +39508,14 @@ function register54(server) {
|
|
|
39225
39508
|
annotations: WRITE_ANNOTATIONS
|
|
39226
39509
|
},
|
|
39227
39510
|
async (params) => {
|
|
39228
|
-
const result = await executeJsx(
|
|
39511
|
+
const result = await executeJsx(jsxCode52, params, { activate: true });
|
|
39229
39512
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
39230
39513
|
}
|
|
39231
39514
|
);
|
|
39232
39515
|
}
|
|
39233
39516
|
|
|
39234
39517
|
// src/tools/modify/manage-linked-images.ts
|
|
39235
|
-
var
|
|
39518
|
+
var jsxCode53 = `
|
|
39236
39519
|
var preflight = preflightChecks();
|
|
39237
39520
|
if (preflight) {
|
|
39238
39521
|
writeResultFile(RESULT_PATH, preflight);
|
|
@@ -39307,7 +39590,7 @@ if (preflight) {
|
|
|
39307
39590
|
}
|
|
39308
39591
|
}
|
|
39309
39592
|
`;
|
|
39310
|
-
function
|
|
39593
|
+
function register56(server) {
|
|
39311
39594
|
server.registerTool(
|
|
39312
39595
|
"manage_linked_images",
|
|
39313
39596
|
{
|
|
@@ -39321,14 +39604,14 @@ function register55(server) {
|
|
|
39321
39604
|
annotations: DESTRUCTIVE_ANNOTATIONS
|
|
39322
39605
|
},
|
|
39323
39606
|
async (params) => {
|
|
39324
|
-
const result = await executeJsx(
|
|
39607
|
+
const result = await executeJsx(jsxCode53, params, { activate: true });
|
|
39325
39608
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
39326
39609
|
}
|
|
39327
39610
|
);
|
|
39328
39611
|
}
|
|
39329
39612
|
|
|
39330
39613
|
// src/tools/modify/undo.ts
|
|
39331
|
-
var
|
|
39614
|
+
var jsxCode54 = `
|
|
39332
39615
|
try {
|
|
39333
39616
|
var verErr = checkIllustratorVersion();
|
|
39334
39617
|
if (verErr) {
|
|
@@ -39356,7 +39639,7 @@ try {
|
|
|
39356
39639
|
writeResultFile(RESULT_PATH, { error: true, message: "undo failed: " + e.message, line: e.line });
|
|
39357
39640
|
}
|
|
39358
39641
|
`;
|
|
39359
|
-
function
|
|
39642
|
+
function register57(server) {
|
|
39360
39643
|
server.registerTool(
|
|
39361
39644
|
"undo",
|
|
39362
39645
|
{
|
|
@@ -39369,14 +39652,14 @@ function register56(server) {
|
|
|
39369
39652
|
annotations: DESTRUCTIVE_ANNOTATIONS
|
|
39370
39653
|
},
|
|
39371
39654
|
async (params) => {
|
|
39372
|
-
const result = await executeJsx(
|
|
39655
|
+
const result = await executeJsx(jsxCode54, params, { activate: true });
|
|
39373
39656
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
39374
39657
|
}
|
|
39375
39658
|
);
|
|
39376
39659
|
}
|
|
39377
39660
|
|
|
39378
39661
|
// src/tools/modify/manage-datasets.ts
|
|
39379
|
-
var
|
|
39662
|
+
var jsxCode55 = `
|
|
39380
39663
|
function parseCsvLine(line) {
|
|
39381
39664
|
var result = [];
|
|
39382
39665
|
var current = "";
|
|
@@ -39659,7 +39942,7 @@ if (preflight) {
|
|
|
39659
39942
|
}
|
|
39660
39943
|
}
|
|
39661
39944
|
`;
|
|
39662
|
-
function
|
|
39945
|
+
function register58(server) {
|
|
39663
39946
|
server.registerTool(
|
|
39664
39947
|
"manage_datasets",
|
|
39665
39948
|
{
|
|
@@ -39685,14 +39968,14 @@ function register57(server) {
|
|
|
39685
39968
|
annotations: WRITE_ANNOTATIONS
|
|
39686
39969
|
},
|
|
39687
39970
|
async (params) => {
|
|
39688
|
-
const result = await executeJsx(
|
|
39971
|
+
const result = await executeJsx(jsxCode55, params, { activate: true });
|
|
39689
39972
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
39690
39973
|
}
|
|
39691
39974
|
);
|
|
39692
39975
|
}
|
|
39693
39976
|
|
|
39694
39977
|
// src/tools/modify/place-symbol.ts
|
|
39695
|
-
var
|
|
39978
|
+
var jsxCode56 = `
|
|
39696
39979
|
var preflight = preflightChecks();
|
|
39697
39980
|
if (preflight) {
|
|
39698
39981
|
writeResultFile(RESULT_PATH, preflight);
|
|
@@ -39747,7 +40030,7 @@ if (preflight) {
|
|
|
39747
40030
|
}
|
|
39748
40031
|
}
|
|
39749
40032
|
`;
|
|
39750
|
-
function
|
|
40033
|
+
function register59(server) {
|
|
39751
40034
|
server.registerTool(
|
|
39752
40035
|
"place_symbol",
|
|
39753
40036
|
{
|
|
@@ -39764,14 +40047,14 @@ function register58(server) {
|
|
|
39764
40047
|
annotations: WRITE_ANNOTATIONS
|
|
39765
40048
|
},
|
|
39766
40049
|
async (params) => {
|
|
39767
|
-
const result = await executeJsx(
|
|
40050
|
+
const result = await executeJsx(jsxCode56, params, { activate: true });
|
|
39768
40051
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
39769
40052
|
}
|
|
39770
40053
|
);
|
|
39771
40054
|
}
|
|
39772
40055
|
|
|
39773
40056
|
// src/tools/modify/create-path-text.ts
|
|
39774
|
-
var
|
|
40057
|
+
var jsxCode57 = `
|
|
39775
40058
|
var preflight = preflightChecks();
|
|
39776
40059
|
if (preflight) {
|
|
39777
40060
|
writeResultFile(RESULT_PATH, preflight);
|
|
@@ -39823,7 +40106,7 @@ if (preflight) {
|
|
|
39823
40106
|
}
|
|
39824
40107
|
}
|
|
39825
40108
|
`;
|
|
39826
|
-
function
|
|
40109
|
+
function register60(server) {
|
|
39827
40110
|
server.registerTool(
|
|
39828
40111
|
"create_path_text",
|
|
39829
40112
|
{
|
|
@@ -39842,14 +40125,14 @@ function register59(server) {
|
|
|
39842
40125
|
annotations: WRITE_ANNOTATIONS
|
|
39843
40126
|
},
|
|
39844
40127
|
async (params) => {
|
|
39845
|
-
const result = await executeJsx(
|
|
40128
|
+
const result = await executeJsx(jsxCode57, params, { activate: true });
|
|
39846
40129
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
39847
40130
|
}
|
|
39848
40131
|
);
|
|
39849
40132
|
}
|
|
39850
40133
|
|
|
39851
40134
|
// src/tools/modify/select-objects.ts
|
|
39852
|
-
var
|
|
40135
|
+
var jsxCode58 = `
|
|
39853
40136
|
var preflight = preflightChecks();
|
|
39854
40137
|
if (preflight) {
|
|
39855
40138
|
writeResultFile(RESULT_PATH, preflight);
|
|
@@ -39899,7 +40182,7 @@ if (preflight) {
|
|
|
39899
40182
|
}
|
|
39900
40183
|
}
|
|
39901
40184
|
`;
|
|
39902
|
-
function
|
|
40185
|
+
function register61(server) {
|
|
39903
40186
|
server.registerTool(
|
|
39904
40187
|
"select_objects",
|
|
39905
40188
|
{
|
|
@@ -39913,14 +40196,14 @@ function register60(server) {
|
|
|
39913
40196
|
annotations: WRITE_IDEMPOTENT_ANNOTATIONS
|
|
39914
40197
|
},
|
|
39915
40198
|
async (params) => {
|
|
39916
|
-
const result = await executeJsx(
|
|
40199
|
+
const result = await executeJsx(jsxCode58, params, { activate: true });
|
|
39917
40200
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
39918
40201
|
}
|
|
39919
40202
|
);
|
|
39920
40203
|
}
|
|
39921
40204
|
|
|
39922
40205
|
// src/tools/read/convert-coordinate.ts
|
|
39923
|
-
var
|
|
40206
|
+
var jsxCode59 = `
|
|
39924
40207
|
var preflight = preflightChecks();
|
|
39925
40208
|
if (preflight) {
|
|
39926
40209
|
writeResultFile(RESULT_PATH, preflight);
|
|
@@ -39957,7 +40240,7 @@ if (preflight) {
|
|
|
39957
40240
|
}
|
|
39958
40241
|
}
|
|
39959
40242
|
`;
|
|
39960
|
-
function
|
|
40243
|
+
function register62(server) {
|
|
39961
40244
|
server.registerTool(
|
|
39962
40245
|
"convert_coordinate",
|
|
39963
40246
|
{
|
|
@@ -39974,7 +40257,7 @@ function register61(server) {
|
|
|
39974
40257
|
annotations: READ_ANNOTATIONS
|
|
39975
40258
|
},
|
|
39976
40259
|
async (params) => {
|
|
39977
|
-
const result = await executeJsx(
|
|
40260
|
+
const result = await executeJsx(jsxCode59, params);
|
|
39978
40261
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
39979
40262
|
}
|
|
39980
40263
|
);
|
|
@@ -40043,10 +40326,11 @@ function registerAllTools(server) {
|
|
|
40043
40326
|
register59(server);
|
|
40044
40327
|
register60(server);
|
|
40045
40328
|
register61(server);
|
|
40329
|
+
register62(server);
|
|
40046
40330
|
}
|
|
40047
40331
|
|
|
40048
40332
|
// src/prompts/quick-layout.ts
|
|
40049
|
-
function
|
|
40333
|
+
function register63(server) {
|
|
40050
40334
|
server.registerPrompt(
|
|
40051
40335
|
"quick-layout",
|
|
40052
40336
|
{
|
|
@@ -40089,7 +40373,7 @@ Always respond in the user's language.`
|
|
|
40089
40373
|
}
|
|
40090
40374
|
|
|
40091
40375
|
// src/prompts/print-preflight-workflow.ts
|
|
40092
|
-
function
|
|
40376
|
+
function register64(server) {
|
|
40093
40377
|
server.registerPrompt(
|
|
40094
40378
|
"print-preflight-workflow",
|
|
40095
40379
|
{
|
|
@@ -40142,8 +40426,8 @@ Always respond in the user's language.`
|
|
|
40142
40426
|
|
|
40143
40427
|
// src/prompts/registry.ts
|
|
40144
40428
|
function registerAllPrompts(server) {
|
|
40145
|
-
register62(server);
|
|
40146
40429
|
register63(server);
|
|
40430
|
+
register64(server);
|
|
40147
40431
|
}
|
|
40148
40432
|
|
|
40149
40433
|
// src/server.ts
|