@packmind/cli 0.21.0 → 0.21.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.
Files changed (2) hide show
  1. package/main.cjs +41 -12
  2. package/package.json +1 -1
package/main.cjs CHANGED
@@ -3852,7 +3852,7 @@ var require_package = __commonJS({
3852
3852
  "apps/cli/package.json"(exports2, module2) {
3853
3853
  module2.exports = {
3854
3854
  name: "@packmind/cli",
3855
- version: "0.21.0",
3855
+ version: "0.21.1",
3856
3856
  description: "A command-line interface for Packmind linting and code quality checks",
3857
3857
  private: false,
3858
3858
  bin: {
@@ -5035,9 +5035,9 @@ var CHANGE_PROPOSAL_TYPE_LABELS = {
5035
5035
  ["createStandard" /* createStandard */]: "New standard",
5036
5036
  ["createCommand" /* createCommand */]: "New command",
5037
5037
  ["createSkill" /* createSkill */]: "New skill",
5038
- ["removeStandard" /* removeStandard */]: "Remove standard",
5039
- ["removeCommand" /* removeCommand */]: "Remove command",
5040
- ["removeSkill" /* removeSkill */]: "Remove skill"
5038
+ ["removeStandard" /* removeStandard */]: "Removed",
5039
+ ["removeCommand" /* removeCommand */]: "Removed",
5040
+ ["removeSkill" /* removeSkill */]: "Removed"
5041
5041
  };
5042
5042
 
5043
5043
  // packages/types/src/playbookChangeManagement/events/ChangeProposalAcceptedEvent.ts
@@ -11795,7 +11795,7 @@ var DiffArtefactsUseCase = class {
11795
11795
  diffs.push(...newFileDiffs);
11796
11796
  }
11797
11797
  }
11798
- return diffs;
11798
+ return diffs.map((diff) => ({ ...diff, targetId: response.targetId }));
11799
11799
  }
11800
11800
  prefixSkillFolders(skillFolders, relativePath) {
11801
11801
  if (!relativePath) return skillFolders;
@@ -11869,7 +11869,8 @@ var SubmitDiffsUseCase = class {
11869
11869
  artefactId: CREATION_TYPES.has(diff.type) ? null : diff.artifactId,
11870
11870
  payload: diff.payload,
11871
11871
  captureMode: "commit" /* commit */,
11872
- message
11872
+ message,
11873
+ targetId: diff.targetId
11873
11874
  }))
11874
11875
  });
11875
11876
  submitted += response.created;
@@ -11922,7 +11923,8 @@ var CheckDiffsUseCase = class {
11922
11923
  artefactId: diff.artifactId,
11923
11924
  payload: diff.payload,
11924
11925
  captureMode: "commit" /* commit */,
11925
- message: ""
11926
+ message: "",
11927
+ targetId: diff.targetId
11926
11928
  }))
11927
11929
  });
11928
11930
  for (const result of response.results) {
@@ -15457,10 +15459,34 @@ async function diffAddHandler(deps) {
15457
15459
  return;
15458
15460
  }
15459
15461
  const space = await packmindCliHexa.getPackmindGateway().spaces.getGlobal();
15462
+ let targetId;
15463
+ try {
15464
+ const cwd = getCwd();
15465
+ const fullConfig = await packmindCliHexa.readFullConfig(cwd);
15466
+ const configPackages = fullConfig ? Object.keys(fullConfig.packages) : [];
15467
+ const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(cwd);
15468
+ if (gitRoot && configPackages.length > 0) {
15469
+ const gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
15470
+ const gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
15471
+ let relativePath = cwd.startsWith(gitRoot) ? cwd.slice(gitRoot.length) : "/";
15472
+ if (!relativePath.startsWith("/")) relativePath = "/" + relativePath;
15473
+ if (!relativePath.endsWith("/")) relativePath = relativePath + "/";
15474
+ const deployedContent = await packmindCliHexa.getPackmindGateway().deployment.getDeployed({
15475
+ packagesSlugs: configPackages,
15476
+ gitRemoteUrl,
15477
+ gitBranch,
15478
+ relativePath,
15479
+ agents: fullConfig?.agents
15480
+ });
15481
+ targetId = deployedContent.targetId;
15482
+ }
15483
+ } catch {
15484
+ }
15460
15485
  const diff = {
15461
15486
  ...diffResult.diff,
15462
15487
  filePath: absolutePath,
15463
- spaceId: space.id
15488
+ spaceId: space.id,
15489
+ targetId
15464
15490
  };
15465
15491
  const result = await packmindCliHexa.submitDiffs([[diff]], message);
15466
15492
  for (const err of result.errors) {
@@ -15674,8 +15700,10 @@ async function diffRemoveHandler(deps) {
15674
15700
  if (normalizedFilePath.startsWith("/")) {
15675
15701
  normalizedFilePath = normalizedFilePath.slice(1);
15676
15702
  }
15703
+ const relativePathPrefix = relativePath.startsWith("/") ? relativePath.slice(1) : relativePath;
15704
+ const filePathForComparison = relativePathPrefix.length > 0 && normalizedFilePath.startsWith(relativePathPrefix) ? normalizedFilePath.slice(relativePathPrefix.length) : normalizedFilePath;
15677
15705
  const deployedFile = deployedContent.fileUpdates.createOrUpdate.find(
15678
- (file) => normalizePath(file.path) === normalizedFilePath
15706
+ (file) => normalizePath(file.path) === filePathForComparison
15679
15707
  );
15680
15708
  if (!deployedFile) {
15681
15709
  const artifactTypeLabel = ARTIFACT_TYPE_LABELS2[artefactResult.artifactType];
@@ -15690,7 +15718,7 @@ async function diffRemoveHandler(deps) {
15690
15718
  exit(1);
15691
15719
  return;
15692
15720
  }
15693
- if (!deployedContent.targetId || !deployedContent.packageIds) {
15721
+ if (!deployedContent.targetId || !deployedFile.packageIds) {
15694
15722
  logErrorConsole(
15695
15723
  "Missing target or package information. Cannot create change proposal for removal."
15696
15724
  );
@@ -15730,12 +15758,13 @@ async function diffRemoveHandler(deps) {
15730
15758
  type: changeProposalType,
15731
15759
  payload: {
15732
15760
  targetId: deployedContent.targetId,
15733
- packageIds: deployedContent.packageIds
15761
+ packageIds: deployedFile.packageIds.map(createPackageId)
15734
15762
  },
15735
15763
  artifactName: deployedFile.artifactName || artefactResult.artifactType,
15736
15764
  artifactType: artefactResult.artifactType,
15737
15765
  artifactId: deployedFile.artifactId,
15738
- spaceId: deployedFile.spaceId
15766
+ spaceId: deployedFile.spaceId,
15767
+ targetId: deployedContent.targetId
15739
15768
  };
15740
15769
  const result = await packmindCliHexa.submitDiffs([[diff]], message);
15741
15770
  for (const err of result.errors) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@packmind/cli",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "description": "A command-line interface for Packmind linting and code quality checks",
5
5
  "private": false,
6
6
  "bin": {