@aipm-registry/cli 0.1.6 → 0.1.7
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/bin.cjs +29 -17
- package/dist/bin.cjs.map +4 -4
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -7814,7 +7814,7 @@ var program = new Command();
|
|
|
7814
7814
|
// src/bin.ts
|
|
7815
7815
|
var import_node_child_process4 = require("node:child_process");
|
|
7816
7816
|
var import_promises9 = require("node:fs/promises");
|
|
7817
|
-
var
|
|
7817
|
+
var import_node_path10 = require("node:path");
|
|
7818
7818
|
var import_node_process3 = require("node:process");
|
|
7819
7819
|
init_dist();
|
|
7820
7820
|
init_dist4();
|
|
@@ -8040,14 +8040,14 @@ async function packStagedFiles(root) {
|
|
|
8040
8040
|
}
|
|
8041
8041
|
async function unpackTarballToBuffer(tarball, entry) {
|
|
8042
8042
|
const { mkdtemp: mkdtemp2, rm: rm3, writeFile: writeFile6 } = await import("node:fs/promises");
|
|
8043
|
-
const { join:
|
|
8043
|
+
const { join: join9 } = await import("node:path");
|
|
8044
8044
|
const { tmpdir: tmpdir2 } = await import("node:os");
|
|
8045
|
-
const tempDir = await mkdtemp2(
|
|
8046
|
-
const tgzPath =
|
|
8045
|
+
const tempDir = await mkdtemp2(join9(tmpdir2(), "aipm-install-"));
|
|
8046
|
+
const tgzPath = join9(tempDir, "pkg.tgz");
|
|
8047
8047
|
try {
|
|
8048
8048
|
await writeFile6(tgzPath, tarball);
|
|
8049
8049
|
await execFileAsync("tar", ["-xzf", tgzPath, "-C", tempDir]);
|
|
8050
|
-
return (0, import_promises5.readFile)(
|
|
8050
|
+
return (0, import_promises5.readFile)(join9(tempDir, entry), "utf8");
|
|
8051
8051
|
} finally {
|
|
8052
8052
|
await rm3(tempDir, { recursive: true, force: true });
|
|
8053
8053
|
}
|
|
@@ -8355,12 +8355,24 @@ async function runDoctor(options) {
|
|
|
8355
8355
|
|
|
8356
8356
|
// src/bin.ts
|
|
8357
8357
|
init_project_files();
|
|
8358
|
+
|
|
8359
|
+
// src/version.ts
|
|
8360
|
+
var import_node_fs2 = require("node:fs");
|
|
8361
|
+
var import_node_path9 = require("node:path");
|
|
8362
|
+
function getCliVersion() {
|
|
8363
|
+
const pkgPath = (0, import_node_path9.join)(__dirname, "..", "package.json");
|
|
8364
|
+
const pkg = JSON.parse((0, import_node_fs2.readFileSync)(pkgPath, "utf8"));
|
|
8365
|
+
return pkg.version;
|
|
8366
|
+
}
|
|
8367
|
+
|
|
8368
|
+
// src/bin.ts
|
|
8369
|
+
var CLI_VERSION = getCliVersion();
|
|
8358
8370
|
var program2 = new Command();
|
|
8359
8371
|
var DEFAULT_REGISTRY = "https://api.aipm-registry.com";
|
|
8360
8372
|
var SITE_URL = "https://aipm-registry.com";
|
|
8361
8373
|
var PUBLISH_DOC_URL = "https://aipm-registry.com/publish";
|
|
8362
8374
|
var DASHBOARD_URL = "https://aipm-registry.com/dashboard";
|
|
8363
|
-
program2.name("aipm").description("AI package manager").enablePositionalOptions().version(
|
|
8375
|
+
program2.name("aipm").description("AI package manager").enablePositionalOptions().version(CLI_VERSION, "-v, --version", "output the current version").option("--verbose", "Print extra diagnostic output").option("--quiet", "Reduce non-essential output").addHelpText(
|
|
8364
8376
|
"after",
|
|
8365
8377
|
`
|
|
8366
8378
|
|
|
@@ -8397,7 +8409,7 @@ async function writeStarterFile(path2, content) {
|
|
|
8397
8409
|
}
|
|
8398
8410
|
async function inferEntryFromSource(source, fallback) {
|
|
8399
8411
|
const sourceInfo = await (0, import_promises9.stat)(source);
|
|
8400
|
-
if (sourceInfo.isFile()) return (0,
|
|
8412
|
+
if (sourceInfo.isFile()) return (0, import_node_path10.basename)(source);
|
|
8401
8413
|
if (!sourceInfo.isDirectory()) return fallback;
|
|
8402
8414
|
const entries = await (0, import_promises9.readdir)(source);
|
|
8403
8415
|
if (entries.includes(fallback)) return fallback;
|
|
@@ -8562,10 +8574,10 @@ function parseSkillTemplate(value) {
|
|
|
8562
8574
|
}
|
|
8563
8575
|
async function initSkill(opts) {
|
|
8564
8576
|
if (!isValidScopeName(opts.name)) throw new Error("Invalid @scope/name");
|
|
8565
|
-
const root = opts.here ? (0, import_node_process3.cwd)() : (0,
|
|
8577
|
+
const root = opts.here ? (0, import_node_process3.cwd)() : (0, import_node_path10.resolve)((0, import_node_process3.cwd)(), opts.dir ?? skillFolderName(opts.name));
|
|
8566
8578
|
const cdTarget = opts.here ? null : opts.dir ?? skillFolderName(opts.name);
|
|
8567
8579
|
await (0, import_promises9.mkdir)(root, { recursive: true });
|
|
8568
|
-
const source = opts.from ? (0,
|
|
8580
|
+
const source = opts.from ? (0, import_node_path10.resolve)(opts.from) : null;
|
|
8569
8581
|
const entry = source ? await inferEntryFromSource(source, opts.entry) : opts.entry;
|
|
8570
8582
|
const manifest = {
|
|
8571
8583
|
schemaVersion: "0.1",
|
|
@@ -8583,21 +8595,21 @@ async function initSkill(opts) {
|
|
|
8583
8595
|
if (sourceInfo.isDirectory()) {
|
|
8584
8596
|
await (0, import_promises9.cp)(source, root, { recursive: true, force: false, errorOnExist: true });
|
|
8585
8597
|
} else if (sourceInfo.isFile()) {
|
|
8586
|
-
await (0, import_promises9.cp)(source, (0,
|
|
8598
|
+
await (0, import_promises9.cp)(source, (0, import_node_path10.join)(root, (0, import_node_path10.basename)(source)), { force: false, errorOnExist: true });
|
|
8587
8599
|
} else {
|
|
8588
8600
|
throw new Error(`Unsupported source path: ${opts.from}`);
|
|
8589
8601
|
}
|
|
8590
8602
|
}
|
|
8591
|
-
await writeStarterFile((0,
|
|
8603
|
+
await writeStarterFile((0, import_node_path10.join)(root, "aipm.manifest.json"), JSON.stringify(manifest, null, 2) + "\n");
|
|
8592
8604
|
if (!opts.from) {
|
|
8593
8605
|
const template = parseSkillTemplate(opts.template ?? "blank");
|
|
8594
8606
|
await writeStarterFile(
|
|
8595
|
-
(0,
|
|
8607
|
+
(0, import_node_path10.join)(root, entry),
|
|
8596
8608
|
SKILL_TEMPLATES[template](opts.name)
|
|
8597
8609
|
);
|
|
8598
8610
|
}
|
|
8599
8611
|
await writeStarterFile(
|
|
8600
|
-
(0,
|
|
8612
|
+
(0, import_node_path10.join)(root, ".aipmignore"),
|
|
8601
8613
|
[
|
|
8602
8614
|
"# Files that should never be published with this skill",
|
|
8603
8615
|
".env*",
|
|
@@ -8615,7 +8627,7 @@ async function initSkill(opts) {
|
|
|
8615
8627
|
""
|
|
8616
8628
|
].join("\n")
|
|
8617
8629
|
);
|
|
8618
|
-
await (0, import_promises9.mkdir)((0,
|
|
8630
|
+
await (0, import_promises9.mkdir)((0, import_node_path10.join)(root, ".aipm"), { recursive: true });
|
|
8619
8631
|
console.log(`Created ${opts.name} skill folder: ${root}`);
|
|
8620
8632
|
printPublishGuide(
|
|
8621
8633
|
opts.from ? `Copied ${opts.from} into ${root} and created aipm.manifest.json, .aipmignore, and the local publish state folder.` : `Created ${root} with aipm.manifest.json, ${entry}, .aipmignore, and the local publish state folder.`,
|
|
@@ -8657,7 +8669,7 @@ program2.command("config").description("Show resolved AIPM CLI and project confi
|
|
|
8657
8669
|
const lock = await readLockfile(root);
|
|
8658
8670
|
const registry = resolveRegistryUrl(project, opts.registry, DEFAULT_REGISTRY);
|
|
8659
8671
|
const data = {
|
|
8660
|
-
cliVersion:
|
|
8672
|
+
cliVersion: CLI_VERSION,
|
|
8661
8673
|
nodeVersion: process.versions.node,
|
|
8662
8674
|
cwd: root,
|
|
8663
8675
|
registry,
|
|
@@ -8751,8 +8763,8 @@ var publish = program2.command("publish [dir]").description("Stage, validate, an
|
|
|
8751
8763
|
publish.help();
|
|
8752
8764
|
return;
|
|
8753
8765
|
}
|
|
8754
|
-
const abs = (0,
|
|
8755
|
-
const manifestRaw = await (0, import_promises9.readFile)((0,
|
|
8766
|
+
const abs = (0, import_node_path10.resolve)(dir);
|
|
8767
|
+
const manifestRaw = await (0, import_promises9.readFile)((0, import_node_path10.join)(abs, "aipm.manifest.json"), "utf8");
|
|
8756
8768
|
const manifest = PackageManifestSchema.parse(JSON.parse(manifestRaw));
|
|
8757
8769
|
const tarball = await packDirectory(abs);
|
|
8758
8770
|
const registry = registryFromEnvOrDefault(opts.registry);
|