@lightward/mechanic-cli 0.1.0 → 0.1.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.
@@ -1 +1 @@
1
- {"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/pull.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAkBpD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,WAAW;IAChD,OAAgB,OAAO,SAAmD;IAC1E,OAAgB,WAAW,SAAmI;IAE9J,OAAgB,IAAI;;MAElB;IAEF,OAAgB,KAAK;;;MAGnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAwF3B"}
1
+ {"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/pull.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAmBpD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,WAAW;IAChD,OAAgB,OAAO,SAAmD;IAC1E,OAAgB,WAAW,SAAmI;IAE9J,OAAgB,IAAI;;MAElB;IAEF,OAAgB,KAAK;;;MAGnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA2F3B"}
@@ -4,6 +4,7 @@ import { BaseCommand } from "../../base-command.js";
4
4
  import { saveLinks, slugForRemoteId, updateLink } from "../../config.js";
5
5
  import { pathExists } from "../../fs.js";
6
6
  import { contentHash } from "../../hash.js";
7
+ import { stableStringify } from "../../json.js";
7
8
  import { CliError } from "../../errors.js";
8
9
  import { displayTaskPath, nextAvailableSlug, readRawTaskFile, resolveTaskSelector, taskForPush, taskPath, taskSlug, unbundledHelperDirForTaskFile, writeTaskFilePathAndRefreshHelper, } from "../../tasks.js";
9
10
  export default class TasksPull extends BaseCommand {
@@ -56,8 +57,11 @@ export default class TasksPull extends BaseCommand {
56
57
  ` mechanic tasks pull ${envelope.id}`,
57
58
  ].join("\n"), 2);
58
59
  }
59
- const localHash = contentHash(taskForPush(localTask));
60
- if (localHash !== link?.last_remote_content_hash) {
60
+ const localTaskForPull = taskForPush(localTask);
61
+ const remoteTaskForPull = taskForPush(envelope.task);
62
+ const localMatchesCurrentRemote = stableStringify(localTaskForPull) === stableStringify(remoteTaskForPull);
63
+ const localHash = contentHash(localTaskForPull);
64
+ if (!localMatchesCurrentRemote && localHash !== link?.last_remote_content_hash) {
61
65
  throw new CliError([
62
66
  `${displayTaskPath(project, filePath)} has local changes that would be overwritten.`,
63
67
  `Run "mechanic tasks diff ${displayTaskPath(project, filePath)}" to review them.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightward/mechanic-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Develop, preview, diff, and publish Mechanic Shopify automation tasks from local files",
5
5
  "type": "module",
6
6
  "keywords": [