@myna-sh/cli 0.9.0 → 0.11.0
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/dsl.d.ts +117 -1
- package/dist/dsl.js +169 -1
- package/dist/dsl.js.map +1 -1
- package/dist/main.js +104 -18
- package/dist/main.js.map +1 -1
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -2242,7 +2242,17 @@ function registerEntries(program) {
|
|
|
2242
2242
|
const project = ctx.requireProject();
|
|
2243
2243
|
const id = await resolveEntryId(ctx.management(), project, args[0]);
|
|
2244
2244
|
const entry = await ctx.management().entries.get(project, id);
|
|
2245
|
-
emit(entry)
|
|
2245
|
+
emit(entry, () => {
|
|
2246
|
+
process.stdout.write(JSON.stringify(entry, null, 2) + "\n");
|
|
2247
|
+
for (const cs of entry.openChangeSets ?? []) {
|
|
2248
|
+
const who = cs.actor?.displayName ?? "someone";
|
|
2249
|
+
const what = cs.fields.length ? cs.fields.join(", ") : cs.operation;
|
|
2250
|
+
diag(` open change set ${cs.id} \u2014 ${cs.title} (${who}): ${what}`);
|
|
2251
|
+
}
|
|
2252
|
+
if (entry.contendedFields?.length) {
|
|
2253
|
+
diag(` contended by more than one: ${entry.contendedFields.join(", ")}`);
|
|
2254
|
+
}
|
|
2255
|
+
});
|
|
2246
2256
|
})
|
|
2247
2257
|
);
|
|
2248
2258
|
entries.command("create").description("Create an entry").argument("<collection>", "collection key").option("--data <json-or-@file>", "entry data as JSON or @file").option("--set <path=value...>", "set individual fields", collect, []).option("--slug <slug>", "explicit slug").option("--change-set <id>", "attach to a change set").option("--summary <text>", "change summary").action(
|
|
@@ -3691,22 +3701,8 @@ function registerBilling(program) {
|
|
|
3691
3701
|
import { existsSync as existsSync5, readFileSync as readFileSync4, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
|
|
3692
3702
|
import { join as join6 } from "path";
|
|
3693
3703
|
|
|
3694
|
-
// src/
|
|
3695
|
-
var VERSION = true ? "0.9.0" : "0.0.0-dev";
|
|
3696
|
-
|
|
3697
|
-
// src/commands/doctor.ts
|
|
3704
|
+
// src/registry.ts
|
|
3698
3705
|
var NPM_REGISTRY = "https://registry.npmjs.org";
|
|
3699
|
-
var SCAN_IGNORE = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", "build", ".react-router", ".turbo", "coverage"]);
|
|
3700
|
-
var GENERATED_MARKERS = [
|
|
3701
|
-
"// Generated by `myna types generate`. Do not edit by hand.",
|
|
3702
|
-
"export interface MynaCollections {"
|
|
3703
|
-
];
|
|
3704
|
-
function looksGenerated(contents) {
|
|
3705
|
-
return GENERATED_MARKERS.every((marker) => contents.includes(marker));
|
|
3706
|
-
}
|
|
3707
|
-
function check(id, title, status, detail, remedy) {
|
|
3708
|
-
return remedy ? { id, title, status, detail, remedy } : { id, title, status, detail };
|
|
3709
|
-
}
|
|
3710
3706
|
async function latestPublished(pkg) {
|
|
3711
3707
|
try {
|
|
3712
3708
|
const res = await fetch(`${NPM_REGISTRY}/${pkg}/latest`, {
|
|
@@ -3720,8 +3716,45 @@ async function latestPublished(pkg) {
|
|
|
3720
3716
|
return void 0;
|
|
3721
3717
|
}
|
|
3722
3718
|
}
|
|
3719
|
+
function detectPackageManager(binPath) {
|
|
3720
|
+
const path = binPath.replaceAll("\\", "/");
|
|
3721
|
+
if (path.includes("/.bun/")) return "bun";
|
|
3722
|
+
if (path.includes("/pnpm/") || path.includes("/.pnpm/")) return "pnpm";
|
|
3723
|
+
if (path.includes("/yarn/") || path.includes("/.yarn/")) return "yarn";
|
|
3724
|
+
return "npm";
|
|
3725
|
+
}
|
|
3726
|
+
function installCommand(manager, version) {
|
|
3727
|
+
const spec = `@myna-sh/cli@${version}`;
|
|
3728
|
+
switch (manager) {
|
|
3729
|
+
case "pnpm":
|
|
3730
|
+
return ["pnpm", "add", "-g", spec];
|
|
3731
|
+
case "yarn":
|
|
3732
|
+
return ["yarn", "global", "add", spec];
|
|
3733
|
+
case "bun":
|
|
3734
|
+
return ["bun", "add", "-g", spec];
|
|
3735
|
+
case "npm":
|
|
3736
|
+
return ["npm", "install", "-g", spec];
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
|
|
3740
|
+
// src/version.ts
|
|
3741
|
+
var VERSION = true ? "0.11.0" : "0.0.0-dev";
|
|
3742
|
+
var IS_RELEASE_BUILD = true;
|
|
3743
|
+
|
|
3744
|
+
// src/commands/doctor.ts
|
|
3745
|
+
var SCAN_IGNORE = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", "build", ".react-router", ".turbo", "coverage"]);
|
|
3746
|
+
var GENERATED_MARKERS = [
|
|
3747
|
+
"// Generated by `myna types generate`. Do not edit by hand.",
|
|
3748
|
+
"export interface MynaCollections {"
|
|
3749
|
+
];
|
|
3750
|
+
function looksGenerated(contents) {
|
|
3751
|
+
return GENERATED_MARKERS.every((marker) => contents.includes(marker));
|
|
3752
|
+
}
|
|
3753
|
+
function check(id, title, status, detail, remedy) {
|
|
3754
|
+
return remedy ? { id, title, status, detail, remedy } : { id, title, status, detail };
|
|
3755
|
+
}
|
|
3723
3756
|
async function checkCliVersion() {
|
|
3724
|
-
if (!
|
|
3757
|
+
if (!IS_RELEASE_BUILD) {
|
|
3725
3758
|
return check(
|
|
3726
3759
|
"cli.version",
|
|
3727
3760
|
"CLI version",
|
|
@@ -3758,7 +3791,7 @@ function checkApi(meta, apiUrl) {
|
|
|
3758
3791
|
const checks = [
|
|
3759
3792
|
check("api.reachable", "API reachable", "pass", `${apiUrl} speaks API ${meta.apiVersion}.`)
|
|
3760
3793
|
];
|
|
3761
|
-
if (!
|
|
3794
|
+
if (!IS_RELEASE_BUILD) {
|
|
3762
3795
|
checks.push(
|
|
3763
3796
|
check("api.compatibility", "Client compatibility", "skip", "Unreleased CLI build; nothing to compare.")
|
|
3764
3797
|
);
|
|
@@ -4030,6 +4063,58 @@ ${failed} failure(s), ${warned} warning(s).`
|
|
|
4030
4063
|
);
|
|
4031
4064
|
}
|
|
4032
4065
|
|
|
4066
|
+
// src/commands/update.ts
|
|
4067
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
4068
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
4069
|
+
function registerUpdate(program) {
|
|
4070
|
+
program.command("update").description("Update the CLI to the latest published release").option("--check", "report whether an update exists without installing it", false).action(
|
|
4071
|
+
handle(async (_ctx, _args, opts) => {
|
|
4072
|
+
const current = VERSION;
|
|
4073
|
+
const checkOnly = Boolean(opts.check);
|
|
4074
|
+
if (!IS_RELEASE_BUILD) {
|
|
4075
|
+
emit(
|
|
4076
|
+
{ current, latest: null, upToDate: false, updated: false, reason: "unreleased" },
|
|
4077
|
+
() => diag(`Running an unreleased build (${current}); nothing to update. Install a release with: npm install -g @myna-sh/cli`)
|
|
4078
|
+
);
|
|
4079
|
+
return;
|
|
4080
|
+
}
|
|
4081
|
+
const latest = await latestPublished("@myna-sh/cli");
|
|
4082
|
+
if (!latest) {
|
|
4083
|
+
throw new CliError("Could not reach the npm registry to check for updates.");
|
|
4084
|
+
}
|
|
4085
|
+
if (compareSemVer(current, latest) >= 0) {
|
|
4086
|
+
emit(
|
|
4087
|
+
{ current, latest, upToDate: true, updated: false },
|
|
4088
|
+
() => diag(`${current} is the latest release.`)
|
|
4089
|
+
);
|
|
4090
|
+
return;
|
|
4091
|
+
}
|
|
4092
|
+
const manager = detectPackageManager(fileURLToPath2(import.meta.url));
|
|
4093
|
+
const command = installCommand(manager, latest);
|
|
4094
|
+
if (checkOnly) {
|
|
4095
|
+
emit(
|
|
4096
|
+
{ current, latest, upToDate: false, updated: false, command: command.join(" ") },
|
|
4097
|
+
() => diag(`${current} is behind ${latest}. Update with: ${command.join(" ")}`)
|
|
4098
|
+
);
|
|
4099
|
+
process.exitCode = 1;
|
|
4100
|
+
return;
|
|
4101
|
+
}
|
|
4102
|
+
diag(`Updating ${current} \u2192 ${latest} with: ${command.join(" ")}`);
|
|
4103
|
+
try {
|
|
4104
|
+
execFileSync3(command[0], command.slice(1), { stdio: "inherit" });
|
|
4105
|
+
} catch (error) {
|
|
4106
|
+
throw new CliError(
|
|
4107
|
+
`Update failed: ${error instanceof Error ? error.message : String(error)}. Run it yourself with: ${command.join(" ")}`
|
|
4108
|
+
);
|
|
4109
|
+
}
|
|
4110
|
+
emit(
|
|
4111
|
+
{ current, latest, upToDate: false, updated: true, command: command.join(" ") },
|
|
4112
|
+
() => diag(`Updated to ${latest}. Run \`myna doctor\` to confirm the API agrees.`)
|
|
4113
|
+
);
|
|
4114
|
+
})
|
|
4115
|
+
);
|
|
4116
|
+
}
|
|
4117
|
+
|
|
4033
4118
|
// src/commands/sync.ts
|
|
4034
4119
|
import { readdir as readdir2, stat as stat2 } from "fs/promises";
|
|
4035
4120
|
import { join as join7 } from "path";
|
|
@@ -4211,6 +4296,7 @@ function buildProgram() {
|
|
|
4211
4296
|
program.name("myna").description("Myna \u2014 content infrastructure for developers and agents").version(VERSION, "-v, --version").option("--json", "emit a single machine-readable JSON value on stdout").option("--project <ref>", "project id or slug").option("--organization <ref>", "organization id or slug").option("--token <token>", "API token (overrides stored credentials)").option("--api-url <url>", "API base URL").option("--no-interactive", "disable prompts and browser opening").showHelpAfterError();
|
|
4212
4297
|
registerAuth(program);
|
|
4213
4298
|
registerDoctor(program);
|
|
4299
|
+
registerUpdate(program);
|
|
4214
4300
|
registerWorkspace(program);
|
|
4215
4301
|
registerSchema(program);
|
|
4216
4302
|
registerEntries(program);
|