@primeuicom/mcp 1.2.0 → 1.2.2

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/dist/service.js CHANGED
@@ -3739,6 +3739,17 @@ import { readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
3739
3739
  import path13 from "path";
3740
3740
  var PACKAGE_JSON_RELATIVE_PATH2 = "package.json";
3741
3741
  var VIRTUAL_ROUTE_SEGMENT = "__primeui-component-export";
3742
+ var COMPONENT_PAGES_PREFIX = "src/components/pages/";
3743
+ var COMPONENT_UI_PREFIX = "src/components/ui/";
3744
+ var COMPONENT_SHARED_PREFIX = "src/components/shared/";
3745
+ var NATURAL_SUPPORT_PREFIXES = [
3746
+ COMPONENT_UI_PREFIX,
3747
+ "src/lib/",
3748
+ "src/types/",
3749
+ "src/contexts/"
3750
+ ];
3751
+ var PUBLIC_PREFIX = "public/";
3752
+ var PUBLIC_ASSET_REFERENCE_RE = /["'`(]\/([^"'`()\s]+\.(?:avif|gif|ico|jpeg|jpg|json|mp4|otf|png|svg|ttf|txt|webm|webmanifest|webp|woff|woff2|xml))(?:\?[^"'`()\s]*)?["'`)]/giu;
3742
3753
  function normalizeComponentId(componentId) {
3743
3754
  const trimmed = componentId.trim();
3744
3755
  if (!trimmed) {
@@ -3753,38 +3764,257 @@ function normalizeManifestFilePath(filePath) {
3753
3764
  }
3754
3765
  return toPosixPath(trimmed).replace(/^\.\/+/, "");
3755
3766
  }
3767
+ function uniqueNormalizedManifestFiles(files) {
3768
+ return [...new Set(files.map(normalizeManifestFilePath))];
3769
+ }
3770
+ function getSuccessfulExportableFiles(manifest) {
3771
+ return manifest.export.exportables.flatMap(
3772
+ (exportable) => exportable.isReadyToExport && exportable.manifest.success ? exportable.manifest.files : []
3773
+ );
3774
+ }
3775
+ function getComponentCopyManifestFiles(manifest) {
3776
+ return uniqueNormalizedManifestFiles([
3777
+ ...manifest.page.manifest.files,
3778
+ ...getSuccessfulExportableFiles(manifest)
3779
+ ]);
3780
+ }
3756
3781
  function isVirtualRouteFile(relativePath) {
3757
- return relativePath.split("/").includes(VIRTUAL_ROUTE_SEGMENT);
3782
+ const segments = relativePath.split("/");
3783
+ return segments[0] === "src" && segments[1] === "app" && segments.includes(VIRTUAL_ROUTE_SEGMENT);
3784
+ }
3785
+ function getVirtualComponentRelativePath(relativePath, componentId) {
3786
+ const prefix = `${COMPONENT_PAGES_PREFIX}${VIRTUAL_ROUTE_SEGMENT}/${componentId}/`;
3787
+ if (!relativePath.startsWith(prefix)) {
3788
+ return null;
3789
+ }
3790
+ const componentRelativePath = relativePath.slice(prefix.length);
3791
+ return componentRelativePath || null;
3792
+ }
3793
+ function getComponentPageSourceArea(relativePath) {
3794
+ if (!relativePath.startsWith(COMPONENT_PAGES_PREFIX)) {
3795
+ return null;
3796
+ }
3797
+ const rest = relativePath.slice(COMPONENT_PAGES_PREFIX.length);
3798
+ const slashIndex = rest.indexOf("/");
3799
+ if (slashIndex <= 0) {
3800
+ return null;
3801
+ }
3802
+ const sourceArea = rest.slice(0, slashIndex);
3803
+ return sourceArea === VIRTUAL_ROUTE_SEGMENT ? null : sourceArea;
3804
+ }
3805
+ function getSourceAreaComponentRelativePath(relativePath, sourceAreas) {
3806
+ const sourceArea = getComponentPageSourceArea(relativePath);
3807
+ if (!sourceArea || !sourceAreas.has(sourceArea)) {
3808
+ return null;
3809
+ }
3810
+ const prefix = `${COMPONENT_PAGES_PREFIX}${sourceArea}/`;
3811
+ const componentRelativePath = relativePath.slice(prefix.length);
3812
+ return componentRelativePath || null;
3813
+ }
3814
+ function isComponentEntryFile(relativePath, componentId) {
3815
+ if (!relativePath.startsWith(COMPONENT_PAGES_PREFIX)) {
3816
+ return false;
3817
+ }
3818
+ const extension = path13.extname(relativePath);
3819
+ if (!extension) {
3820
+ return false;
3821
+ }
3822
+ const basename = path13.basename(relativePath, extension);
3823
+ if (basename === componentId) {
3824
+ return true;
3825
+ }
3826
+ return basename === "index" && path13.basename(path13.dirname(relativePath)) === componentId;
3827
+ }
3828
+ function isManifestSupportFile(relativePath) {
3829
+ return NATURAL_SUPPORT_PREFIXES.some(
3830
+ (prefix) => relativePath.startsWith(prefix)
3831
+ );
3832
+ }
3833
+ function isEnvFile(relativePath) {
3834
+ return relativePath === ".env" || relativePath.startsWith(".env.");
3835
+ }
3836
+ function isSearchRuntimeFile(relativePath) {
3837
+ return relativePath.startsWith("src/app/api/search/") || relativePath.startsWith("src/lib/search/") || relativePath.startsWith("src/lib/search-runtime/") || relativePath.startsWith("src/search/");
3838
+ }
3839
+ function isProjectLevelFile(relativePath) {
3840
+ return isEnvFile(relativePath) || isSearchRuntimeFile(relativePath) || relativePath.startsWith("scripts/") || relativePath.startsWith("src/app/") || relativePath.startsWith("src/components/header/") || relativePath.startsWith("src/components/footer/") || relativePath.startsWith("src/components/layout/");
3841
+ }
3842
+ function toComponentSharedTargetPath(componentRelativePath) {
3843
+ return `${COMPONENT_SHARED_PREFIX}${componentRelativePath}`;
3844
+ }
3845
+ function toImportPath(relativePath) {
3846
+ const withoutExtension = relativePath.replace(/\.[cm]?[jt]sx?$/u, "");
3847
+ const withoutIndex = withoutExtension.replace(/\/index$/u, "");
3848
+ return `@/${withoutIndex.replace(/^src\//u, "")}`;
3849
+ }
3850
+ function escapeRegExp(value) {
3851
+ return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
3758
3852
  }
3759
- function splitManifestFiles(files) {
3760
- const manifestFiles = files.map(normalizeManifestFilePath);
3761
- const copyableFiles = [];
3853
+ function sourceImportSpecifiers(relativePath) {
3854
+ const withAlias = toImportPath(relativePath);
3855
+ const specifiers = [withAlias];
3856
+ if (withAlias.endsWith("/index")) {
3857
+ specifiers.push(withAlias.replace(/\/index$/u, ""));
3858
+ }
3859
+ return [...new Set(specifiers)];
3860
+ }
3861
+ function rewriteComponentLocalImports(content, transfers) {
3862
+ let updated = content;
3863
+ for (const transfer of transfers) {
3864
+ const targetSpecifier = toImportPath(transfer.targetPath);
3865
+ for (const sourceSpecifier of sourceImportSpecifiers(transfer.sourcePath)) {
3866
+ updated = updated.replace(
3867
+ new RegExp(escapeRegExp(sourceSpecifier), "gu"),
3868
+ targetSpecifier
3869
+ );
3870
+ }
3871
+ }
3872
+ return updated;
3873
+ }
3874
+ function collectReferencedPublicAssetFiles(content) {
3875
+ const referencedFiles = /* @__PURE__ */ new Set();
3876
+ let match = null;
3877
+ PUBLIC_ASSET_REFERENCE_RE.lastIndex = 0;
3878
+ while ((match = PUBLIC_ASSET_REFERENCE_RE.exec(content)) !== null) {
3879
+ const referencedPath = match[1]?.trim();
3880
+ if (referencedPath) {
3881
+ referencedFiles.add(
3882
+ `${PUBLIC_PREFIX}${normalizeManifestFilePath(referencedPath)}`
3883
+ );
3884
+ }
3885
+ }
3886
+ return [...referencedFiles];
3887
+ }
3888
+ function findComponentSourceAreas(relativePaths) {
3889
+ const sourceAreas = /* @__PURE__ */ new Set();
3890
+ for (const relativePath of relativePaths) {
3891
+ const sourceArea = getComponentPageSourceArea(relativePath);
3892
+ if (sourceArea) {
3893
+ sourceAreas.add(sourceArea);
3894
+ }
3895
+ }
3896
+ return sourceAreas;
3897
+ }
3898
+ function getComponentLocalTargetPath(input) {
3899
+ const virtualRelativePath = getVirtualComponentRelativePath(
3900
+ input.relativePath,
3901
+ input.componentId
3902
+ );
3903
+ if (virtualRelativePath) {
3904
+ return toComponentSharedTargetPath(virtualRelativePath);
3905
+ }
3906
+ const sourceAreaRelativePath = getSourceAreaComponentRelativePath(
3907
+ input.relativePath,
3908
+ input.sourceAreas
3909
+ );
3910
+ if (sourceAreaRelativePath) {
3911
+ return toComponentSharedTargetPath(sourceAreaRelativePath);
3912
+ }
3913
+ return null;
3914
+ }
3915
+ function getTransferTargetPath(input) {
3916
+ if (input.relativePath === PACKAGE_JSON_RELATIVE_PATH2 || isVirtualRouteFile(input.relativePath) || isProjectLevelFile(input.relativePath)) {
3917
+ return null;
3918
+ }
3919
+ const componentLocalTargetPath = getComponentLocalTargetPath(input);
3920
+ if (componentLocalTargetPath) {
3921
+ return componentLocalTargetPath;
3922
+ }
3923
+ if (isManifestSupportFile(input.relativePath)) {
3924
+ return input.relativePath;
3925
+ }
3926
+ if (input.relativePath.startsWith(PUBLIC_PREFIX) && input.referencedPublicFiles.has(input.relativePath)) {
3927
+ return input.relativePath;
3928
+ }
3929
+ return null;
3930
+ }
3931
+ async function collectReferencedPublicFiles(input) {
3932
+ const referencedPublicFiles = /* @__PURE__ */ new Set();
3933
+ for (const relativePath of input.graphInternalFiles) {
3934
+ if (!input.manifestFileSet.has(relativePath)) {
3935
+ continue;
3936
+ }
3937
+ const sourcePath = path13.join(input.exportPath, relativePath);
3938
+ let content = "";
3939
+ try {
3940
+ content = await readFile7(sourcePath, "utf-8");
3941
+ } catch {
3942
+ continue;
3943
+ }
3944
+ for (const referencedFile of collectReferencedPublicAssetFiles(content)) {
3945
+ if (input.manifestFileSet.has(referencedFile)) {
3946
+ referencedPublicFiles.add(referencedFile);
3947
+ }
3948
+ }
3949
+ }
3950
+ return referencedPublicFiles;
3951
+ }
3952
+ function buildFileTransfers(input) {
3953
+ const sourceAreas = findComponentSourceAreas([...input.graphInternalFiles]);
3954
+ const transfers = [];
3955
+ const usedTargetPaths = /* @__PURE__ */ new Set();
3956
+ for (const relativePath of input.files) {
3957
+ const isGraphFile = input.graphInternalFiles.has(relativePath);
3958
+ const isReferencedPublicFile = input.referencedPublicFiles.has(relativePath);
3959
+ if (!isGraphFile && !isReferencedPublicFile) {
3960
+ continue;
3961
+ }
3962
+ const targetPath = getTransferTargetPath({
3963
+ relativePath,
3964
+ componentId: input.componentId,
3965
+ sourceAreas,
3966
+ referencedPublicFiles: input.referencedPublicFiles
3967
+ });
3968
+ if (!targetPath || usedTargetPaths.has(targetPath)) {
3969
+ continue;
3970
+ }
3971
+ usedTargetPaths.add(targetPath);
3972
+ transfers.push({
3973
+ sourcePath: relativePath,
3974
+ targetPath
3975
+ });
3976
+ }
3977
+ return transfers.sort((a, b) => a.targetPath.localeCompare(b.targetPath));
3978
+ }
3979
+ function toSkippedFile(targetPath, reason) {
3980
+ return {
3981
+ targetPath,
3982
+ reason
3983
+ };
3984
+ }
3985
+ function splitManifestFiles(input) {
3986
+ const manifestFiles = input.files.map(normalizeManifestFilePath);
3987
+ const copyableFileSet = new Set(input.copyableFiles);
3988
+ const componentEntryFiles = [];
3762
3989
  const skippedFiles = [];
3763
3990
  for (const relativePath of manifestFiles) {
3764
3991
  if (relativePath === PACKAGE_JSON_RELATIVE_PATH2) {
3765
- skippedFiles.push({
3766
- targetPath: relativePath,
3767
- reason: "package_json_managed_as_dependencies"
3768
- });
3992
+ skippedFiles.push(
3993
+ toSkippedFile(relativePath, "package_json_managed_as_dependencies")
3994
+ );
3769
3995
  continue;
3770
3996
  }
3771
3997
  if (isVirtualRouteFile(relativePath)) {
3772
- skippedFiles.push({
3773
- targetPath: relativePath,
3774
- reason: "virtual_component_route"
3775
- });
3998
+ skippedFiles.push(toSkippedFile(relativePath, "virtual_component_route"));
3776
3999
  continue;
3777
4000
  }
3778
- copyableFiles.push(relativePath);
4001
+ if (isComponentEntryFile(relativePath, input.componentId)) {
4002
+ componentEntryFiles.push(relativePath);
4003
+ }
4004
+ if (!copyableFileSet.has(relativePath)) {
4005
+ skippedFiles.push(
4006
+ toSkippedFile(relativePath, "not_component_dependency")
4007
+ );
4008
+ }
3779
4009
  }
3780
4010
  return {
3781
4011
  manifestFiles,
3782
- copyableFiles,
4012
+ componentEntryFiles,
3783
4013
  skippedFiles
3784
4014
  };
3785
4015
  }
3786
4016
  async function createConflictReportEntry2(input) {
3787
- const sourceBuffer = await readFile7(input.sourceFilePath);
4017
+ const sourceBuffer = input.sourceBuffer ?? await readFile7(input.sourceFilePath);
3788
4018
  let targetBuffer = null;
3789
4019
  try {
3790
4020
  targetBuffer = await readFile7(input.targetFilePath);
@@ -3833,7 +4063,7 @@ function buildMessage(input) {
3833
4063
  }
3834
4064
  if (input.skippedFiles.length > 0) {
3835
4065
  parts.push(
3836
- `${input.skippedFiles.length} manifest file(s) skipped, including virtual route or package metadata entries.`
4066
+ `${input.skippedFiles.length} manifest file(s) skipped, including virtual route, package metadata, or non-component context entries.`
3837
4067
  );
3838
4068
  }
3839
4069
  if (input.missingManifestFiles.length > 0) {
@@ -3852,7 +4082,7 @@ function buildMessage(input) {
3852
4082
  );
3853
4083
  }
3854
4084
  parts.push(
3855
- "The virtual component export page was skipped; manually insert the copied component into a real target page."
4085
+ `The virtual component export page was skipped; manually import ${input.componentImportPath} into a real target page.`
3856
4086
  );
3857
4087
  return parts.join(" ");
3858
4088
  }
@@ -3883,13 +4113,16 @@ async function copyRegistryComponentFromExport(input) {
3883
4113
  `Component export manifest mismatch: expected componentId "${normalizedComponentId}", got "${manifest.component.componentId}".`
3884
4114
  );
3885
4115
  }
3886
- const { manifestFiles, copyableFiles, skippedFiles } = splitManifestFiles(
3887
- manifest.page.manifest.files
3888
- );
3889
- const candidateFiles = await resolveManifestCandidateFiles({
4116
+ const initialSelection = splitManifestFiles({
4117
+ files: getComponentCopyManifestFiles(manifest),
4118
+ componentId: normalizedComponentId,
4119
+ copyableFiles: []
4120
+ });
4121
+ const manifestFileSet = new Set(initialSelection.manifestFiles);
4122
+ const componentEntryCandidates = await resolveManifestCandidateFiles({
3890
4123
  exportPath,
3891
4124
  manifestOwnerLabel: `registry component "${normalizedComponentId}"`,
3892
- files: copyableFiles,
4125
+ files: initialSelection.componentEntryFiles,
3893
4126
  requireExisting: false
3894
4127
  });
3895
4128
  const newFiles = [];
@@ -3897,7 +4130,58 @@ async function copyRegistryComponentFromExport(input) {
3897
4130
  const conflictFiles = [];
3898
4131
  const conflictReportEntries = [];
3899
4132
  const missingManifestFiles = /* @__PURE__ */ new Set();
3900
- const existingCandidateFiles = [];
4133
+ const existingComponentEntryFiles = [];
4134
+ for (const sourceFilePath of componentEntryCandidates) {
4135
+ const relativeToExport = toProjectRelative(exportPath, sourceFilePath);
4136
+ if (await fileExists2(sourceFilePath)) {
4137
+ existingComponentEntryFiles.push(sourceFilePath);
4138
+ continue;
4139
+ }
4140
+ missingManifestFiles.add(relativeToExport);
4141
+ }
4142
+ const dependencyGraph = existingComponentEntryFiles.length > 0 ? await buildImportGraph({
4143
+ projectRoot: exportPath,
4144
+ entryFiles: existingComponentEntryFiles,
4145
+ followInternalImports: true
4146
+ }) : { internalFiles: [], externalPackages: [] };
4147
+ const graphInternalFiles = new Set(
4148
+ dependencyGraph.internalFiles.map(
4149
+ (filePath) => toProjectRelative(exportPath, filePath)
4150
+ )
4151
+ );
4152
+ const referencedPublicFiles = await collectReferencedPublicFiles({
4153
+ exportPath,
4154
+ graphInternalFiles,
4155
+ manifestFileSet
4156
+ });
4157
+ const fileTransfers = buildFileTransfers({
4158
+ files: initialSelection.manifestFiles,
4159
+ componentId: normalizedComponentId,
4160
+ graphInternalFiles,
4161
+ referencedPublicFiles
4162
+ });
4163
+ const copyableSourceFiles = fileTransfers.map((transfer) => transfer.sourcePath);
4164
+ const copyableFiles = fileTransfers.map((transfer) => transfer.targetPath);
4165
+ const transferBySourcePath = new Map(
4166
+ fileTransfers.map((transfer) => [transfer.sourcePath, transfer])
4167
+ );
4168
+ const componentEntryTransfer = fileTransfers.find(
4169
+ (transfer) => initialSelection.componentEntryFiles.includes(transfer.sourcePath)
4170
+ );
4171
+ const componentImportPath = toImportPath(
4172
+ componentEntryTransfer?.targetPath ?? `${COMPONENT_SHARED_PREFIX}${normalizedComponentId}.tsx`
4173
+ );
4174
+ const { manifestFiles, skippedFiles } = splitManifestFiles({
4175
+ files: initialSelection.manifestFiles,
4176
+ componentId: normalizedComponentId,
4177
+ copyableFiles: copyableSourceFiles
4178
+ });
4179
+ const candidateFiles = await resolveManifestCandidateFiles({
4180
+ exportPath,
4181
+ manifestOwnerLabel: `registry component "${normalizedComponentId}"`,
4182
+ files: copyableSourceFiles,
4183
+ requireExisting: false
4184
+ });
3901
4185
  for (const sourceFilePath of candidateFiles) {
3902
4186
  const relativeToExport = toProjectRelative(exportPath, sourceFilePath);
3903
4187
  const sourceExists = await fileExists2(sourceFilePath);
@@ -3905,10 +4189,21 @@ async function copyRegistryComponentFromExport(input) {
3905
4189
  missingManifestFiles.add(relativeToExport);
3906
4190
  continue;
3907
4191
  }
3908
- existingCandidateFiles.push(sourceFilePath);
3909
- const targetFilePath = path13.join(input.projectRoot, relativeToExport);
4192
+ const transfer = transferBySourcePath.get(relativeToExport);
4193
+ if (!transfer) {
4194
+ continue;
4195
+ }
4196
+ const targetRelativePath = transfer.targetPath;
4197
+ const targetFilePath = path13.join(input.projectRoot, targetRelativePath);
3910
4198
  ensureSafeTargetPath(input.projectRoot, targetFilePath);
3911
4199
  const sourceBuffer = await readFile7(sourceFilePath);
4200
+ const rewrittenSourceBuffer = isBinaryBuffer(sourceBuffer) ? sourceBuffer : Buffer.from(
4201
+ rewriteComponentLocalImports(
4202
+ sourceBuffer.toString("utf-8"),
4203
+ fileTransfers
4204
+ ),
4205
+ "utf-8"
4206
+ );
3912
4207
  let targetBuffer = null;
3913
4208
  try {
3914
4209
  targetBuffer = await readFile7(targetFilePath);
@@ -3917,19 +4212,20 @@ async function copyRegistryComponentFromExport(input) {
3917
4212
  }
3918
4213
  if (!targetBuffer) {
3919
4214
  await ensureDir(path13.dirname(targetFilePath));
3920
- await writeFile6(targetFilePath, sourceBuffer);
3921
- newFiles.push(relativeToExport);
4215
+ await writeFile6(targetFilePath, rewrittenSourceBuffer);
4216
+ newFiles.push(targetRelativePath);
3922
4217
  continue;
3923
4218
  }
3924
- if (sourceBuffer.equals(targetBuffer)) {
3925
- identicalFiles.push(relativeToExport);
4219
+ if (rewrittenSourceBuffer.equals(targetBuffer)) {
4220
+ identicalFiles.push(targetRelativePath);
3926
4221
  continue;
3927
4222
  }
3928
4223
  const entry = await createConflictReportEntry2({
3929
4224
  sourceFilePath,
3930
4225
  targetFilePath,
3931
4226
  exportPath,
3932
- projectRoot: input.projectRoot
4227
+ projectRoot: input.projectRoot,
4228
+ sourceBuffer: rewrittenSourceBuffer
3933
4229
  });
3934
4230
  if (entry) {
3935
4231
  conflictReportEntries.push(entry);
@@ -3939,11 +4235,6 @@ async function copyRegistryComponentFromExport(input) {
3939
4235
  });
3940
4236
  }
3941
4237
  }
3942
- const dependencyGraph = existingCandidateFiles.length > 0 ? await buildImportGraph({
3943
- projectRoot: exportPath,
3944
- entryFiles: existingCandidateFiles,
3945
- followInternalImports: false
3946
- }) : { externalPackages: [] };
3947
4238
  const { addedDependencies, dependenciesVersionConflicts } = await applyDependencyRequirementsToPackageJson({
3948
4239
  exportPackageJsonPath: path13.join(exportPath, PACKAGE_JSON_RELATIVE_PATH2),
3949
4240
  userPackageJsonPath: path13.join(
@@ -3975,6 +4266,7 @@ async function copyRegistryComponentFromExport(input) {
3975
4266
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
3976
4267
  exportId,
3977
4268
  componentId: normalizedComponentId,
4269
+ componentImportPath,
3978
4270
  manifestFiles,
3979
4271
  copyableFiles,
3980
4272
  skippedFiles,
@@ -3996,6 +4288,7 @@ async function copyRegistryComponentFromExport(input) {
3996
4288
  status,
3997
4289
  message: buildMessage({
3998
4290
  componentId: normalizedComponentId,
4291
+ componentImportPath,
3999
4292
  status,
4000
4293
  reportPath,
4001
4294
  newFiles: sortedNewFiles,
@@ -4011,6 +4304,7 @@ async function copyRegistryComponentFromExport(input) {
4011
4304
  exportPath,
4012
4305
  manifestPath,
4013
4306
  component: manifest.component,
4307
+ componentImportPath,
4014
4308
  manifestFiles,
4015
4309
  copyableFiles,
4016
4310
  newFiles: sortedNewFiles,
@@ -4033,7 +4327,7 @@ async function copyRegistryComponentFromExport(input) {
4033
4327
  },
4034
4328
  guidance: {
4035
4329
  artifacts: guidanceArtifacts,
4036
- requiredActions: "Do not install the skipped virtual component export page as a route. Manually import the copied component/support files into a real target page, install newly added dependencies, and resolve any reported conflicts or dependency version mismatches before treating the registry component transfer as complete."
4330
+ requiredActions: `Do not install the skipped virtual component export page as a route. Manually import ${componentImportPath} into a real target page, install newly added dependencies, and resolve any reported conflicts or dependency version mismatches before treating the registry component transfer as complete.`
4037
4331
  }
4038
4332
  };
4039
4333
  }
@@ -4853,8 +5147,12 @@ var skippedCopyFileSchema = z4.object({
4853
5147
  targetPath: z4.string().describe(
4854
5148
  "Relative target path intentionally not copied into user project root."
4855
5149
  ),
4856
- reason: z4.enum(["package_json_managed_as_dependencies", "virtual_component_route"]).describe(
4857
- "Machine-readable reason for skipping this file. package_json_managed_as_dependencies means package.json was handled as dependency guidance instead of direct file copy. virtual_component_route means the internal component-export route was intentionally not installed into the target app."
5150
+ reason: z4.enum([
5151
+ "package_json_managed_as_dependencies",
5152
+ "virtual_component_route",
5153
+ "not_component_dependency"
5154
+ ]).describe(
5155
+ "Machine-readable reason for skipping this file. package_json_managed_as_dependencies means package.json was handled as dependency guidance instead of direct file copy. virtual_component_route means the internal component-export route was intentionally not installed into the target app. not_component_dependency means the manifest file belongs to page/template context outside the selected registry component dependency set."
4858
5156
  )
4859
5157
  });
4860
5158
  var runtimeGuidanceArtifactSchema = z4.object({
@@ -5512,10 +5810,12 @@ WHEN TO USE:
5512
5810
  BEHAVIOR:
5513
5811
  - Reads the component sidecar manifest saved by create_component_export.
5514
5812
  - Validates that manifest.component.componentId matches input.componentId.
5515
- - Copies files strictly from page.manifest.files in the component sidecar manifest.
5813
+ - Copies only the selected registry component import graph, narrowly referenced public assets, and safe support files from the component sidecar manifest/export.
5814
+ - Remaps component-local files into src/components/shared/** and returns componentImportPath for manual insertion.
5516
5815
  - Skips virtual route files that include __primeui-component-export, because those are reference/insertion hints and must not be installed as normal app routes.
5816
+ - Skips app/search/layout/header/footer/env/project-shell files instead of copying whole exportable buckets.
5517
5817
  - Never copies package.json directly. package.json is used only to add missing dependency entries and report dependency version conflicts.
5518
- - Preserves export-relative paths for copied files in this first version.
5818
+ - Keeps safe support files on their natural target paths, such as src/components/ui/**, src/lib/**, src/types/**, and src/contexts/**.
5519
5819
  - Never overwrites existing conflicting files.
5520
5820
  - Writes full conflict details to .primeui/temp/exports/[exportId].copy-registry-component-report-[copyId].json.
5521
5821
  - Reports copied files, identical files, conflicts, skipped files, dependency additions, dependency version conflicts, missing manifest files, and manual insertion guidance.
@@ -5546,11 +5846,14 @@ ${WORKFLOW_SUMMARY}`,
5546
5846
  component: componentExportComponentSchema.describe(
5547
5847
  "Component metadata from the validated component sidecar manifest."
5548
5848
  ),
5849
+ componentImportPath: z4.string().describe(
5850
+ "Canonical import path for the copied registry component entrypoint, for example @/components/shared/hero--pricing."
5851
+ ),
5549
5852
  manifestFiles: z4.array(z4.string()).describe(
5550
- "Normalized page.manifest.files from the component sidecar manifest."
5853
+ "Normalized component sidecar manifest files considered by the copy service."
5551
5854
  ),
5552
5855
  copyableFiles: z4.array(z4.string()).describe(
5553
- "Manifest files considered for copying after filtering virtual route files and package.json."
5856
+ "Relative target paths considered for copying after component remapping and safety filtering."
5554
5857
  ),
5555
5858
  newFiles: z4.array(z4.string()).describe("Relative target paths for new files copied."),
5556
5859
  identicalFiles: z4.array(z4.string()).describe("Relative target paths for existing byte-identical files."),