@maestro-js/cli 1.0.0-alpha.23 → 1.0.0-alpha.3
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.js +24 -45
- package/package.json +11 -11
package/dist/bin.js
CHANGED
|
@@ -456,6 +456,7 @@ async function resolveDbConfig(opts) {
|
|
|
456
456
|
password,
|
|
457
457
|
database
|
|
458
458
|
};
|
|
459
|
+
console.log(resolved);
|
|
459
460
|
return resolved;
|
|
460
461
|
}
|
|
461
462
|
async function createDb(config) {
|
|
@@ -608,19 +609,15 @@ function hashMakeKey() {
|
|
|
608
609
|
import { execSync as execSync3 } from "child_process";
|
|
609
610
|
async function configRun(opts) {
|
|
610
611
|
const { Config } = await import("@maestro-js/config").catch(() => requirePeer("@maestro-js/config"));
|
|
611
|
-
const
|
|
612
|
-
if (
|
|
612
|
+
const configName = opts.config;
|
|
613
|
+
if (!configName) {
|
|
613
614
|
console.error("Missing required --config <name> option");
|
|
614
615
|
process.exit(1);
|
|
615
616
|
}
|
|
616
617
|
const rootDir = opts.root ?? process.cwd();
|
|
617
618
|
const envName = opts.env ?? null;
|
|
618
619
|
const encryptionKey = opts.key ?? process.env["MAESTRO_ENV_ENCRYPTION_KEY"] ?? null;
|
|
619
|
-
const
|
|
620
|
-
for (const configName of configNames) {
|
|
621
|
-
const config = await Config.getConfig({ rootDir, configName, envName, encryptionKey });
|
|
622
|
-
Object.assign(merged, config);
|
|
623
|
-
}
|
|
620
|
+
const config = await Config.getConfig({ rootDir, configName, envName, encryptionKey });
|
|
624
621
|
const command = opts._.join(" ");
|
|
625
622
|
if (!command) {
|
|
626
623
|
console.error("No command provided. Usage: maestro config:run --config <name> [options] -- <command>");
|
|
@@ -628,7 +625,7 @@ async function configRun(opts) {
|
|
|
628
625
|
}
|
|
629
626
|
execSync3(command, {
|
|
630
627
|
stdio: "inherit",
|
|
631
|
-
env: { ...process.env, ...
|
|
628
|
+
env: { ...process.env, ...config }
|
|
632
629
|
});
|
|
633
630
|
}
|
|
634
631
|
|
|
@@ -653,11 +650,8 @@ async function componentsAdd(name, opts) {
|
|
|
653
650
|
|
|
654
651
|
// src/commands/skills.ts
|
|
655
652
|
import { execSync as execSync4 } from "child_process";
|
|
656
|
-
import fs from "fs";
|
|
657
|
-
import path from "path";
|
|
658
|
-
import { fileURLToPath } from "url";
|
|
659
653
|
function skillsInstall(opts) {
|
|
660
|
-
const args = ["npx", "--yes",
|
|
654
|
+
const args = ["npx", "--yes", "@maestro-js/agent-skills"];
|
|
661
655
|
if (opts.interactive) args.push("--interactive");
|
|
662
656
|
if (opts.copy) args.push("--copy");
|
|
663
657
|
try {
|
|
@@ -666,22 +660,16 @@ function skillsInstall(opts) {
|
|
|
666
660
|
process.exit(1);
|
|
667
661
|
}
|
|
668
662
|
}
|
|
669
|
-
function getCurrentVersion() {
|
|
670
|
-
const dir = path.dirname(fileURLToPath(import.meta.url));
|
|
671
|
-
const raw = fs.readFileSync(path.join(dir, "../package.json"), "utf-8");
|
|
672
|
-
const pkg = JSON.parse(raw);
|
|
673
|
-
return pkg.version;
|
|
674
|
-
}
|
|
675
663
|
|
|
676
664
|
// src/commands/upgrade.ts
|
|
677
665
|
import { execSync as execSync5 } from "child_process";
|
|
678
|
-
import
|
|
679
|
-
import
|
|
680
|
-
import { fileURLToPath
|
|
666
|
+
import fs from "fs";
|
|
667
|
+
import path from "path";
|
|
668
|
+
import { fileURLToPath } from "url";
|
|
681
669
|
import prompts4 from "prompts";
|
|
682
670
|
var onCancel2 = () => process.exit(0);
|
|
683
671
|
async function upgrade() {
|
|
684
|
-
const current =
|
|
672
|
+
const current = getCurrentVersion();
|
|
685
673
|
console.log(`Current @maestro-js version: ${current}`);
|
|
686
674
|
const versions = fetchAvailableVersions();
|
|
687
675
|
const newer = filterNewerVersions(versions, current);
|
|
@@ -700,9 +688,9 @@ async function upgrade() {
|
|
|
700
688
|
Updated ${updated} package.json file${updated === 1 ? "" : "s"}.`);
|
|
701
689
|
await runInstall();
|
|
702
690
|
}
|
|
703
|
-
function
|
|
704
|
-
const dir =
|
|
705
|
-
const raw =
|
|
691
|
+
function getCurrentVersion() {
|
|
692
|
+
const dir = path.dirname(fileURLToPath(import.meta.url));
|
|
693
|
+
const raw = fs.readFileSync(path.join(dir, "../package.json"), "utf-8");
|
|
706
694
|
const pkg = JSON.parse(raw);
|
|
707
695
|
return pkg.version;
|
|
708
696
|
}
|
|
@@ -767,19 +755,19 @@ function findAndUpdatePackageJsonFiles(targetVersion) {
|
|
|
767
755
|
function findPackageJsonFiles(dir) {
|
|
768
756
|
const results = [];
|
|
769
757
|
const skipDirs = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", ".next", ".nuxt"]);
|
|
770
|
-
for (const entry of
|
|
758
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
771
759
|
if (entry.isDirectory()) {
|
|
772
760
|
if (!skipDirs.has(entry.name)) {
|
|
773
|
-
results.push(...findPackageJsonFiles(
|
|
761
|
+
results.push(...findPackageJsonFiles(path.join(dir, entry.name)));
|
|
774
762
|
}
|
|
775
763
|
} else if (entry.name === "package.json") {
|
|
776
|
-
results.push(
|
|
764
|
+
results.push(path.join(dir, entry.name));
|
|
777
765
|
}
|
|
778
766
|
}
|
|
779
767
|
return results;
|
|
780
768
|
}
|
|
781
769
|
function updateMaestroDependencies(filePath, targetVersion) {
|
|
782
|
-
const raw =
|
|
770
|
+
const raw = fs.readFileSync(filePath, "utf-8");
|
|
783
771
|
const pkg = JSON.parse(raw);
|
|
784
772
|
let changed = false;
|
|
785
773
|
for (const depKey of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
|
|
@@ -802,8 +790,8 @@ function updateMaestroDependencies(filePath, targetVersion) {
|
|
|
802
790
|
const trailingNewline = raw.endsWith("\n");
|
|
803
791
|
let output = JSON.stringify(pkg, null, indent);
|
|
804
792
|
if (trailingNewline) output += "\n";
|
|
805
|
-
|
|
806
|
-
console.log(` Updated ${
|
|
793
|
+
fs.writeFileSync(filePath, output, "utf-8");
|
|
794
|
+
console.log(` Updated ${path.relative(process.cwd(), filePath)}`);
|
|
807
795
|
}
|
|
808
796
|
return changed;
|
|
809
797
|
}
|
|
@@ -822,7 +810,7 @@ ${pm} install failed. package.json files have been updated \u2014 run install ma
|
|
|
822
810
|
function detectPackageManager() {
|
|
823
811
|
const root = process.cwd();
|
|
824
812
|
try {
|
|
825
|
-
const raw =
|
|
813
|
+
const raw = fs.readFileSync(path.join(root, "package.json"), "utf-8");
|
|
826
814
|
const pkg = JSON.parse(raw);
|
|
827
815
|
if (pkg.packageManager) {
|
|
828
816
|
const name = pkg.packageManager.split("@")[0];
|
|
@@ -830,8 +818,8 @@ function detectPackageManager() {
|
|
|
830
818
|
}
|
|
831
819
|
} catch {
|
|
832
820
|
}
|
|
833
|
-
if (
|
|
834
|
-
if (
|
|
821
|
+
if (fs.existsSync(path.join(root, "pnpm-lock.yaml"))) return "pnpm";
|
|
822
|
+
if (fs.existsSync(path.join(root, "yarn.lock"))) return "yarn";
|
|
835
823
|
return "npm";
|
|
836
824
|
}
|
|
837
825
|
function detectIndent(json) {
|
|
@@ -874,22 +862,13 @@ function compareSemver(a, b) {
|
|
|
874
862
|
|
|
875
863
|
// src/commands/init.ts
|
|
876
864
|
import { execSync as execSync6 } from "child_process";
|
|
877
|
-
import fs3 from "fs";
|
|
878
|
-
import path3 from "path";
|
|
879
|
-
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
880
865
|
function init(name) {
|
|
881
866
|
try {
|
|
882
|
-
execSync6(`npx --yes @maestro-js/init
|
|
867
|
+
execSync6(`npx --yes @maestro-js/init ${name}`, { stdio: "inherit" });
|
|
883
868
|
} catch {
|
|
884
869
|
process.exit(1);
|
|
885
870
|
}
|
|
886
871
|
}
|
|
887
|
-
function getCurrentVersion3() {
|
|
888
|
-
const dir = path3.dirname(fileURLToPath3(import.meta.url));
|
|
889
|
-
const raw = fs3.readFileSync(path3.join(dir, "../package.json"), "utf-8");
|
|
890
|
-
const pkg = JSON.parse(raw);
|
|
891
|
-
return pkg.version;
|
|
892
|
-
}
|
|
893
872
|
|
|
894
873
|
// src/bin.ts
|
|
895
874
|
var require2 = createRequire(import.meta.url);
|
|
@@ -908,7 +887,7 @@ prog.command("env:encrypt <env>").describe("Encrypt a .env file").option("--key
|
|
|
908
887
|
prog.command("env:decrypt <env>").describe("Decrypt a .env.encrypted file").option("--key <value>", "Encryption key (env: MAESTRO_ENV_ENCRYPTION_KEY)").option("--force", "Overwrite existing .env file").action(envDecrypt);
|
|
909
888
|
prog.command("components:list").describe("List available components").action(componentsList);
|
|
910
889
|
prog.command("components:add [name]").describe("Add components to the current project").option("--directory", "Target directory (default: cwd)").option("--overwrite", "Overwrite existing files").option("--all", "Add all available components").action(componentsAdd);
|
|
911
|
-
prog.command("config:run").describe("Resolve config and run a command with the config values as environment variables").option("--config <name>", "Config name (required
|
|
890
|
+
prog.command("config:run").describe("Resolve config and run a command with the config values as environment variables").option("--config <name>", "Config name (required)").option("--root <path>", "Project root directory (default: cwd)").option("--env <name>", "Environment name (e.g. production)").option("--key <value>", "Encryption key (env: MAESTRO_ENV_ENCRYPTION_KEY)").action(configRun);
|
|
912
891
|
prog.command("skills:install").describe("Install agent skills from @maestro-js/agent-skills").option("--interactive", "Run in interactive mode (select skills manually)").option("--copy", "Copy skill files instead of symlinking").action(skillsInstall);
|
|
913
892
|
prog.command("upgrade").describe("Upgrade @maestro-js/* packages to a newer version").action(upgrade);
|
|
914
893
|
prog.command("init <name>").describe("Scaffold a new Maestro project").action(init);
|
package/package.json
CHANGED
|
@@ -13,22 +13,22 @@
|
|
|
13
13
|
"sade": "^1.8.1"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@maestro-js/
|
|
17
|
-
"@maestro-js/
|
|
18
|
-
"@maestro-js/
|
|
19
|
-
"@maestro-js/
|
|
20
|
-
"@maestro-js/db-migrate": "1.0.0-alpha.
|
|
16
|
+
"@maestro-js/agent-container": "1.0.0-alpha.3",
|
|
17
|
+
"@maestro-js/components": "1.0.0-alpha.3",
|
|
18
|
+
"@maestro-js/config": "1.0.0-alpha.3",
|
|
19
|
+
"@maestro-js/db": "1.0.0-alpha.3",
|
|
20
|
+
"@maestro-js/db-migrate": "1.0.0-alpha.3"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^22.19.11",
|
|
24
24
|
"@types/prompts": "^2.4.9",
|
|
25
|
-
"@maestro-js/agent-container": "1.0.0-alpha.
|
|
26
|
-
"@maestro-js/components": "1.0.0-alpha.
|
|
27
|
-
"@maestro-js/config": "1.0.0-alpha.
|
|
28
|
-
"@maestro-js/db": "1.0.0-alpha.
|
|
29
|
-
"@maestro-js/db-migrate": "1.0.0-alpha.
|
|
25
|
+
"@maestro-js/agent-container": "1.0.0-alpha.3",
|
|
26
|
+
"@maestro-js/components": "1.0.0-alpha.3",
|
|
27
|
+
"@maestro-js/config": "1.0.0-alpha.3",
|
|
28
|
+
"@maestro-js/db": "1.0.0-alpha.3",
|
|
29
|
+
"@maestro-js/db-migrate": "1.0.0-alpha.3"
|
|
30
30
|
},
|
|
31
|
-
"version": "1.0.0-alpha.
|
|
31
|
+
"version": "1.0.0-alpha.3",
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "restricted"
|
|
34
34
|
},
|