sim 2.2.33-preview.320.1 → 2.2.33-preview.321.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/dist/index.js CHANGED
@@ -42397,7 +42397,7 @@ class CliUsageError extends LocalRefusal {
42397
42397
  }
42398
42398
 
42399
42399
  // src/commands/protocol/source-dir/command-lock.ts
42400
- import { readFileSync as readFileSync4 } from "node:fs";
42400
+ import { rmSync as rmSync3 } from "node:fs";
42401
42401
  import { lstat as lstat3, mkdir as mkdir2, readFile as readFile2, realpath as realpath2, rm as rm3, rmdir, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
42402
42402
  import { hostname } from "node:os";
42403
42403
  import { dirname as dirname7, join as join6, resolve as resolve4 } from "node:path";
@@ -52948,32 +52948,18 @@ async function withSourceDirLock(dir, run, options = {}) {
52948
52948
  throw new SourceDirError(`Another sim command is using ${dir}; nothing was read or written. Run this one again once it finished. If none is running, remove ${join6(dir, SOURCE_DIR_LOCK)}.`, { code: "SOURCE_DIR_BUSY", exitCode: SOURCE_BUSY_EXIT_CODE });
52949
52949
  }
52950
52950
  const owner = { pid: process.pid, host: hostname() };
52951
- let ownerRecorded = false;
52952
- const ownedLock = () => {
52953
- if (!ownerRecorded)
52954
- return lock;
52955
- try {
52956
- const recorded = toRecord(JSON.parse(readFileSync4(join6(lock, LOCK_OWNER_FILE), "utf8")));
52957
- return recorded.pid === owner.pid && recorded.host === owner.host ? lock : null;
52958
- } catch {
52959
- return null;
52960
- }
52961
- };
52962
- const disposeSignalRelease = removeStagingOnSignal(ownedLock);
52951
+ const disposeSignalRelease = removeStagingOnSignal(() => lock);
52963
52952
  try {
52964
52953
  await writeFile2(join6(lock, LOCK_OWNER_FILE), JSON.stringify(owner));
52965
- ownerRecorded = true;
52966
52954
  return await run();
52967
52955
  } finally {
52968
52956
  try {
52969
- await rm3(await checkedPath(root, SOURCE_DIR_LOCK, new Set), {
52970
- recursive: true,
52971
- force: true
52972
- });
52973
- await removeCreatedFolders();
52957
+ const held = await checkedPath(root, SOURCE_DIR_LOCK, new Set);
52958
+ rmSync3(held, { recursive: true, force: true });
52974
52959
  } finally {
52975
52960
  disposeSignalRelease();
52976
52961
  }
52962
+ await removeCreatedFolders();
52977
52963
  }
52978
52964
  }
52979
52965
  async function removeEmptyFolders(dir, outermost) {
@@ -53233,7 +53219,7 @@ function sourceExitCodeRows(prefix) {
53233
53219
  },
53234
53220
  {
53235
53221
  code: 1,
53236
- meaning: prefix === "sim workspaces source" ? "The source has errors (each printed as `file:line:column` with a hint), a locked block (`E_APPLY_LOCKED_BLOCK`), a name another resource holds (`E_NAME_TAKEN`), a cancelled prompt, or the command failed" : "The source has errors (each printed as `file:line:column` with a hint), a locked block (`E_APPLY_LOCKED_BLOCK`), a name another workflow holds (`SOURCE_NAME_TAKEN`), a cancelled prompt, or the command failed",
53222
+ meaning: `The source has errors (each printed as \`file:line:column\` with a hint), a locked block (\`E_APPLY_LOCKED_BLOCK\`), ${prefix === "sim workspaces source" ? "a name another resource holds (`E_NAME_TAKEN`)" : "a name another workflow holds (`SOURCE_NAME_TAKEN`)"}, a cancelled prompt, or the command failed`,
53237
53223
  next: "Fix what it printed and run it again",
53238
53224
  help: {
53239
53225
  "workflows source apply": "the source has errors (each printed as file:line:column with its frame and hint) or the command failed",
@@ -53385,7 +53371,7 @@ have been written and how to check.`;
53385
53371
 
53386
53372
  // src/commands/protocol/source-tree.ts
53387
53373
  import { createHash as createHash5 } from "node:crypto";
53388
- import { rmSync as rmSync3 } from "node:fs";
53374
+ import { rmSync as rmSync4 } from "node:fs";
53389
53375
  import { mkdir as mkdir3, mkdtemp as mkdtemp3, readFile as readFile3, rename as rename3, rm as rm4, writeFile as writeFile3 } from "node:fs/promises";
53390
53376
  import { dirname as dirname8, join as join7 } from "node:path";
53391
53377
 
@@ -56078,7 +56064,7 @@ function writeWorkspaceCatalogPointer(workspaceId, hash) {
56078
56064
  if (legacy === `${hash}.json`)
56079
56065
  continue;
56080
56066
  try {
56081
- rmSync3(join7(catalogCacheDir(), legacy), { recursive: true, force: true });
56067
+ rmSync4(join7(catalogCacheDir(), legacy), { recursive: true, force: true });
56082
56068
  } catch {}
56083
56069
  }
56084
56070
  }
@@ -64177,12 +64163,9 @@ async function checkWorkflowDir(dir, catalog, options) {
64177
64163
  if (finding.code !== "W_UNKNOWN_OPTION" || blockKey === undefined || param === undefined) {
64178
64164
  return false;
64179
64165
  }
64180
- return optionsVaryOn(blockKey, (id) => id === param);
64181
- };
64182
- const optionsVaryOn = (blockKey, matches) => {
64183
64166
  const type = compiled.workflow ? getOwn(compiled.workflow.blocks, blockKey)?.type : undefined;
64184
64167
  const block = type === undefined ? undefined : catalogBlock(compiledDir.catalog, type);
64185
- return block?.subBlocks.some((sub) => matches(sub.id) && sub.optionsVary === true) === true;
64168
+ return block?.subBlocks.some((sub) => sub.id === param && sub.optionsVary === true) === true;
64186
64169
  };
64187
64170
  const exempt = (finding) => mayBeRenamed(finding) || variesByDeployment(finding);
64188
64171
  const refusable = (finding) => !exempt(finding);
package/dist/runtime.js CHANGED
@@ -42446,7 +42446,7 @@ class CliUsageError extends LocalRefusal {
42446
42446
  }
42447
42447
 
42448
42448
  // src/commands/protocol/source-dir/command-lock.ts
42449
- import { readFileSync as readFileSync4 } from "node:fs";
42449
+ import { rmSync as rmSync3 } from "node:fs";
42450
42450
  import { lstat as lstat3, mkdir as mkdir2, readFile as readFile2, realpath as realpath2, rm as rm3, rmdir, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
42451
42451
  import { hostname } from "node:os";
42452
42452
  import { dirname as dirname7, join as join6, resolve as resolve4 } from "node:path";
@@ -52997,32 +52997,18 @@ async function withSourceDirLock(dir, run, options = {}) {
52997
52997
  throw new SourceDirError(`Another sim command is using ${dir}; nothing was read or written. Run this one again once it finished. If none is running, remove ${join6(dir, SOURCE_DIR_LOCK)}.`, { code: "SOURCE_DIR_BUSY", exitCode: SOURCE_BUSY_EXIT_CODE });
52998
52998
  }
52999
52999
  const owner = { pid: process.pid, host: hostname() };
53000
- let ownerRecorded = false;
53001
- const ownedLock = () => {
53002
- if (!ownerRecorded)
53003
- return lock;
53004
- try {
53005
- const recorded = toRecord(JSON.parse(readFileSync4(join6(lock, LOCK_OWNER_FILE), "utf8")));
53006
- return recorded.pid === owner.pid && recorded.host === owner.host ? lock : null;
53007
- } catch {
53008
- return null;
53009
- }
53010
- };
53011
- const disposeSignalRelease = removeStagingOnSignal(ownedLock);
53000
+ const disposeSignalRelease = removeStagingOnSignal(() => lock);
53012
53001
  try {
53013
53002
  await writeFile2(join6(lock, LOCK_OWNER_FILE), JSON.stringify(owner));
53014
- ownerRecorded = true;
53015
53003
  return await run();
53016
53004
  } finally {
53017
53005
  try {
53018
- await rm3(await checkedPath(root, SOURCE_DIR_LOCK, new Set), {
53019
- recursive: true,
53020
- force: true
53021
- });
53022
- await removeCreatedFolders();
53006
+ const held = await checkedPath(root, SOURCE_DIR_LOCK, new Set);
53007
+ rmSync3(held, { recursive: true, force: true });
53023
53008
  } finally {
53024
53009
  disposeSignalRelease();
53025
53010
  }
53011
+ await removeCreatedFolders();
53026
53012
  }
53027
53013
  }
53028
53014
  async function removeEmptyFolders(dir, outermost) {
@@ -53282,7 +53268,7 @@ function sourceExitCodeRows(prefix) {
53282
53268
  },
53283
53269
  {
53284
53270
  code: 1,
53285
- meaning: prefix === "sim workspaces source" ? "The source has errors (each printed as `file:line:column` with a hint), a locked block (`E_APPLY_LOCKED_BLOCK`), a name another resource holds (`E_NAME_TAKEN`), a cancelled prompt, or the command failed" : "The source has errors (each printed as `file:line:column` with a hint), a locked block (`E_APPLY_LOCKED_BLOCK`), a name another workflow holds (`SOURCE_NAME_TAKEN`), a cancelled prompt, or the command failed",
53271
+ meaning: `The source has errors (each printed as \`file:line:column\` with a hint), a locked block (\`E_APPLY_LOCKED_BLOCK\`), ${prefix === "sim workspaces source" ? "a name another resource holds (`E_NAME_TAKEN`)" : "a name another workflow holds (`SOURCE_NAME_TAKEN`)"}, a cancelled prompt, or the command failed`,
53286
53272
  next: "Fix what it printed and run it again",
53287
53273
  help: {
53288
53274
  "workflows source apply": "the source has errors (each printed as file:line:column with its frame and hint) or the command failed",
@@ -53434,7 +53420,7 @@ have been written and how to check.`;
53434
53420
 
53435
53421
  // src/commands/protocol/source-tree.ts
53436
53422
  import { createHash as createHash5 } from "node:crypto";
53437
- import { rmSync as rmSync3 } from "node:fs";
53423
+ import { rmSync as rmSync4 } from "node:fs";
53438
53424
  import { mkdir as mkdir3, mkdtemp as mkdtemp3, readFile as readFile3, rename as rename3, rm as rm4, writeFile as writeFile3 } from "node:fs/promises";
53439
53425
  import { dirname as dirname8, join as join7 } from "node:path";
53440
53426
 
@@ -56127,7 +56113,7 @@ function writeWorkspaceCatalogPointer(workspaceId, hash) {
56127
56113
  if (legacy === `${hash}.json`)
56128
56114
  continue;
56129
56115
  try {
56130
- rmSync3(join7(catalogCacheDir(), legacy), { recursive: true, force: true });
56116
+ rmSync4(join7(catalogCacheDir(), legacy), { recursive: true, force: true });
56131
56117
  } catch {}
56132
56118
  }
56133
56119
  }
@@ -64226,12 +64212,9 @@ async function checkWorkflowDir(dir, catalog, options) {
64226
64212
  if (finding.code !== "W_UNKNOWN_OPTION" || blockKey === undefined || param === undefined) {
64227
64213
  return false;
64228
64214
  }
64229
- return optionsVaryOn(blockKey, (id) => id === param);
64230
- };
64231
- const optionsVaryOn = (blockKey, matches) => {
64232
64215
  const type = compiled.workflow ? getOwn(compiled.workflow.blocks, blockKey)?.type : undefined;
64233
64216
  const block = type === undefined ? undefined : catalogBlock(compiledDir.catalog, type);
64234
- return block?.subBlocks.some((sub) => matches(sub.id) && sub.optionsVary === true) === true;
64217
+ return block?.subBlocks.some((sub) => sub.id === param && sub.optionsVary === true) === true;
64235
64218
  };
64236
64219
  const exempt = (finding) => mayBeRenamed(finding) || variesByDeployment(finding);
64237
64220
  const refusable = (finding) => !exempt(finding);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.2.33-preview.320.1",
3
+ "version": "2.2.33-preview.321.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "bin": {