@tscircuit/cli 0.1.274 → 0.1.275

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/dist/main.js +46 -29
  2. package/package.json +4 -2
package/dist/main.js CHANGED
@@ -53413,7 +53413,7 @@ var require_braces = __commonJS((exports2, module2) => {
53413
53413
  module2.exports = braces;
53414
53414
  });
53415
53415
 
53416
- // node_modules/micromatch/node_modules/picomatch/lib/constants.js
53416
+ // node_modules/picomatch/lib/constants.js
53417
53417
  var require_constants3 = __commonJS((exports2, module2) => {
53418
53418
  var path14 = __require("path");
53419
53419
  var WIN_SLASH = "\\\\/";
@@ -53553,7 +53553,7 @@ var require_constants3 = __commonJS((exports2, module2) => {
53553
53553
  };
53554
53554
  });
53555
53555
 
53556
- // node_modules/micromatch/node_modules/picomatch/lib/utils.js
53556
+ // node_modules/picomatch/lib/utils.js
53557
53557
  var require_utils3 = __commonJS((exports2) => {
53558
53558
  var path14 = __require("path");
53559
53559
  var win32 = process.platform === "win32";
@@ -53613,7 +53613,7 @@ var require_utils3 = __commonJS((exports2) => {
53613
53613
  };
53614
53614
  });
53615
53615
 
53616
- // node_modules/micromatch/node_modules/picomatch/lib/scan.js
53616
+ // node_modules/picomatch/lib/scan.js
53617
53617
  var require_scan = __commonJS((exports2, module2) => {
53618
53618
  var utils = require_utils3();
53619
53619
  var {
@@ -53928,7 +53928,7 @@ var require_scan = __commonJS((exports2, module2) => {
53928
53928
  module2.exports = scan;
53929
53929
  });
53930
53930
 
53931
- // node_modules/micromatch/node_modules/picomatch/lib/parse.js
53931
+ // node_modules/picomatch/lib/parse.js
53932
53932
  var require_parse3 = __commonJS((exports2, module2) => {
53933
53933
  var constants = require_constants3();
53934
53934
  var utils = require_utils3();
@@ -54706,7 +54706,7 @@ var require_parse3 = __commonJS((exports2, module2) => {
54706
54706
  module2.exports = parse3;
54707
54707
  });
54708
54708
 
54709
- // node_modules/micromatch/node_modules/picomatch/lib/picomatch.js
54709
+ // node_modules/picomatch/lib/picomatch.js
54710
54710
  var require_picomatch = __commonJS((exports2, module2) => {
54711
54711
  var path14 = __require("path");
54712
54712
  var scan = require_scan();
@@ -87533,7 +87533,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
87533
87533
  import { execSync as execSync2 } from "node:child_process";
87534
87534
  var import_semver2 = __toESM2(require_semver2(), 1);
87535
87535
  // package.json
87536
- var version = "0.1.273";
87536
+ var version = "0.1.274";
87537
87537
  var package_default = {
87538
87538
  name: "@tscircuit/cli",
87539
87539
  version,
@@ -87542,7 +87542,7 @@ var package_default = {
87542
87542
  "@babel/standalone": "^7.26.9",
87543
87543
  "@biomejs/biome": "^1.9.4",
87544
87544
  "@tscircuit/circuit-json-util": "0.0.67",
87545
- "@tscircuit/fake-snippets": "^0.0.87",
87545
+ "@tscircuit/fake-snippets": "^0.0.110",
87546
87546
  "@tscircuit/file-server": "^0.0.30",
87547
87547
  "@tscircuit/math-utils": "0.0.21",
87548
87548
  "@tscircuit/props": "^0.0.341",
@@ -87574,6 +87574,7 @@ var package_default = {
87574
87574
  "fuse.js": "^7.1.0",
87575
87575
  "get-port": "^7.1.0",
87576
87576
  globby: "^14.1.0",
87577
+ jose: "^6.1.0",
87577
87578
  jsonwebtoken: "^9.0.2",
87578
87579
  jszip: "^3.10.1",
87579
87580
  "jwt-decode": "^4.0.0",
@@ -87583,6 +87584,7 @@ var package_default = {
87583
87584
  ky: "^1.7.4",
87584
87585
  "looks-same": "^9.0.1",
87585
87586
  "make-vfs": "^1.0.15",
87587
+ md5: "^2.3.0",
87586
87588
  "perfect-cli": "^1.0.21",
87587
87589
  poppygl: "^0.0.12",
87588
87590
  prompts: "^2.4.2",
@@ -91346,7 +91348,10 @@ var getPackageAuthor = (packageName) => {
91346
91348
  if (packageName.startsWith("@tsci/")) {
91347
91349
  return packageName.split("/")[1].split(".")[0];
91348
91350
  }
91349
- return packageName.split("/")[0].replace("@", "");
91351
+ if (packageName.includes("/")) {
91352
+ return packageName.split("/")[0].replace("@", "");
91353
+ }
91354
+ return "";
91350
91355
  };
91351
91356
 
91352
91357
  // cli/dev/get-package-file-paths.ts
@@ -91892,6 +91897,18 @@ var getPackageFilePaths = (projectDir, ignored = []) => {
91892
91897
  return fileNames.map((fileName) => path15.join(projectDir, fileName));
91893
91898
  };
91894
91899
 
91900
+ // lib/utils/check-org-access.ts
91901
+ var checkOrgAccess = async (ky2, accountName) => {
91902
+ try {
91903
+ const { org } = await ky2.post("orgs/get", {
91904
+ json: { org_name: accountName }
91905
+ }).json();
91906
+ return org.user_permissions?.can_manage_org ?? false;
91907
+ } catch {
91908
+ return false;
91909
+ }
91910
+ };
91911
+
91895
91912
  // lib/shared/push-snippet.ts
91896
91913
  var debug = Debug("tsci:push-snippet");
91897
91914
  var pushSnippet = async ({
@@ -91960,11 +91977,21 @@ var pushSnippet = async ({
91960
91977
  packageJson.name = `@tsci/${currentUsername}.${unscopedPackageName}`;
91961
91978
  fs16.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
91962
91979
  }
91963
- if (currentUsername !== packageJsonAuthor) {
91964
- console.warn(`Package author "${packageJsonAuthor}" does not match the logged in GitHub username "${currentUsername}"`);
91980
+ let accountName = currentUsername;
91981
+ if (packageJsonAuthor && currentUsername !== packageJsonAuthor) {
91982
+ const hasOrgAccess = await checkOrgAccess(ky2, packageJsonAuthor);
91983
+ if (hasOrgAccess) {
91984
+ accountName = packageJsonAuthor;
91985
+ console.log(kleur_default.gray(`Publishing to org "${packageJsonAuthor}" (user: ${currentUsername})`));
91986
+ } else {
91987
+ onError(`You don't have access to the org "${packageJsonAuthor}". Either:
91988
+ ` + ` 1. Get added as a member of the "${packageJsonAuthor}" org, or
91989
+ ` + ` 2. Change the package name in package.json to use your username: "${currentUsername}/${unscopedPackageName}"`);
91990
+ return onExit(1);
91991
+ }
91965
91992
  }
91966
- const scopedPackageName = `${currentUsername}/${unscopedPackageName}`;
91967
- const tsciPackageName = `@tsci/${currentUsername}.${unscopedPackageName}`;
91993
+ const scopedPackageName = `${accountName}/${unscopedPackageName}`;
91994
+ const tsciPackageName = `@tsci/${accountName}.${unscopedPackageName}`;
91968
91995
  const previousPackageReleases = await ky2.post("package_releases/list", {
91969
91996
  json: { package_name: scopedPackageName }
91970
91997
  }).json().then((response) => response.package_releases);
@@ -91994,7 +92021,7 @@ var pushSnippet = async ({
91994
92021
  }
91995
92022
  });
91996
92023
  if (!doesPackageExist) {
91997
- const { createPackage, visibility, snippetType } = await prompts_default([
92024
+ const { createPackage, visibility } = await prompts_default([
91998
92025
  {
91999
92026
  type: "confirm",
92000
92027
  name: "createPackage",
@@ -92009,15 +92036,6 @@ var pushSnippet = async ({
92009
92036
  { title: "Public", value: "public", selected: !isPrivate },
92010
92037
  { title: "Private", value: "private", selected: isPrivate }
92011
92038
  ]
92012
- },
92013
- {
92014
- name: "snippetType",
92015
- type: "select",
92016
- message: "Package Type:",
92017
- choices: [
92018
- { title: "Reusable Package", value: "package", selected: true },
92019
- { title: "Board", value: "board" }
92020
- ]
92021
92039
  }
92022
92040
  ]);
92023
92041
  if (!createPackage || !visibility) {
@@ -92027,9 +92045,7 @@ var pushSnippet = async ({
92027
92045
  await ky2.post("packages/create", {
92028
92046
  json: {
92029
92047
  name: scopedPackageName,
92030
- is_private: visibility === "private",
92031
- is_snippet: true,
92032
- snippet_type: snippetType
92048
+ is_private: visibility === "private"
92033
92049
  },
92034
92050
  headers: { Authorization: `Bearer ${sessionToken}` }
92035
92051
  }).json().then((response) => {
@@ -92660,8 +92676,8 @@ var registerClone = (program3) => {
92660
92676
  package_files: []
92661
92677
  };
92662
92678
  try {
92663
- packageFileList = await ky2.post("package_files/list", {
92664
- json: {
92679
+ packageFileList = await ky2.get("package_files/list", {
92680
+ searchParams: {
92665
92681
  package_name: `${author}/${packageName}`,
92666
92682
  use_latest_version: true
92667
92683
  }
@@ -92682,9 +92698,10 @@ var registerClone = (program3) => {
92682
92698
  const fullPath = path20.join(dirPath, filePath);
92683
92699
  fs20.mkdirSync(path20.dirname(fullPath), { recursive: true });
92684
92700
  try {
92685
- const fileContent = await ky2.post("package_files/get", {
92686
- json: {
92701
+ const fileContent = await ky2.get("package_files/get", {
92702
+ searchParams: {
92687
92703
  package_name: `${author}/${packageName}`,
92704
+ use_latest_version: true,
92688
92705
  file_path: fileInfo.file_path
92689
92706
  }
92690
92707
  }).json();
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.274",
3
+ "version": "0.1.275",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",
7
7
  "@biomejs/biome": "^1.9.4",
8
8
  "@tscircuit/circuit-json-util": "0.0.67",
9
- "@tscircuit/fake-snippets": "^0.0.87",
9
+ "@tscircuit/fake-snippets": "^0.0.110",
10
10
  "@tscircuit/file-server": "^0.0.30",
11
11
  "@tscircuit/math-utils": "0.0.21",
12
12
  "@tscircuit/props": "^0.0.341",
@@ -38,6 +38,7 @@
38
38
  "fuse.js": "^7.1.0",
39
39
  "get-port": "^7.1.0",
40
40
  "globby": "^14.1.0",
41
+ "jose": "^6.1.0",
41
42
  "jsonwebtoken": "^9.0.2",
42
43
  "jszip": "^3.10.1",
43
44
  "jwt-decode": "^4.0.0",
@@ -47,6 +48,7 @@
47
48
  "ky": "^1.7.4",
48
49
  "looks-same": "^9.0.1",
49
50
  "make-vfs": "^1.0.15",
51
+ "md5": "^2.3.0",
50
52
  "perfect-cli": "^1.0.21",
51
53
  "poppygl": "^0.0.12",
52
54
  "prompts": "^2.4.2",