@tscircuit/cli 0.1.83 → 0.1.84
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/main.js +13 -5
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -433425,7 +433425,7 @@ import readline from "node:readline";
|
|
|
433425
433425
|
import { execSync as execSync2 } from "node:child_process";
|
|
433426
433426
|
var import_semver = __toESM2(require_semver2(), 1);
|
|
433427
433427
|
// package.json
|
|
433428
|
-
var version = "0.1.
|
|
433428
|
+
var version = "0.1.83";
|
|
433429
433429
|
var package_default = {
|
|
433430
433430
|
name: "@tscircuit/cli",
|
|
433431
433431
|
version,
|
|
@@ -439192,12 +439192,20 @@ var registerConfigPrint = (program3) => {
|
|
|
439192
439192
|
import * as fs19 from "node:fs";
|
|
439193
439193
|
import * as path19 from "node:path";
|
|
439194
439194
|
var registerClone = (program3) => {
|
|
439195
|
-
program3.command("clone").description("Clone a snippet from the registry").argument("<snippet>", "Snippet to clone (e.g. author/snippetName)").action(async (snippetPath) => {
|
|
439196
|
-
const
|
|
439197
|
-
|
|
439198
|
-
|
|
439195
|
+
program3.command("clone").description("Clone a snippet from the registry").argument("<snippet>", "Snippet to clone (e.g. author/snippetName or https://tscircuit.com/author/snippetName)").action(async (snippetPath) => {
|
|
439196
|
+
const urlMatch = snippetPath.match(/^https:\/\/tscircuit\.com\/([^\/]+)\/([^\/]+)\/?$/i);
|
|
439197
|
+
const originalMatch = !urlMatch && snippetPath.match(/^(?:@tsci\/)?([^/.]+)[/.]([^/.]+)$/);
|
|
439198
|
+
if (!urlMatch && !originalMatch) {
|
|
439199
|
+
console.error(`Invalid snippet path "${snippetPath}". Accepted formats:
|
|
439200
|
+
- author/snippetName
|
|
439201
|
+
- author.snippetName
|
|
439202
|
+
- @tsci/author.snippetName
|
|
439203
|
+
- https://tscircuit.com/author/snippetName`);
|
|
439199
439204
|
process.exit(1);
|
|
439200
439205
|
}
|
|
439206
|
+
const match = urlMatch || originalMatch;
|
|
439207
|
+
if (!match)
|
|
439208
|
+
throw new Error("No valid match found");
|
|
439201
439209
|
const [, author, snippetName] = match;
|
|
439202
439210
|
console.log(`Cloning ${author}/${snippetName}...`);
|
|
439203
439211
|
const ky2 = getRegistryApiKy();
|