mimi-seed 0.13.0 → 0.13.2
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.
|
@@ -13,9 +13,56 @@ import * as readline2 from "readline";
|
|
|
13
13
|
import os5 from "os";
|
|
14
14
|
|
|
15
15
|
// src/credentials.ts
|
|
16
|
-
import
|
|
16
|
+
import fs2 from "fs";
|
|
17
17
|
import os from "os";
|
|
18
|
+
import path2 from "path";
|
|
19
|
+
|
|
20
|
+
// src/project-manifest.ts
|
|
21
|
+
import fs from "fs";
|
|
18
22
|
import path from "path";
|
|
23
|
+
var MANIFEST_FILENAME = ".mimi-seed.json";
|
|
24
|
+
function isValidSocialProfileId(value) {
|
|
25
|
+
return /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.test(value);
|
|
26
|
+
}
|
|
27
|
+
function manifestSocialProfile(m, platform) {
|
|
28
|
+
const profiles = m.socialProfiles;
|
|
29
|
+
if (profiles === void 0) return null;
|
|
30
|
+
if (!profiles || typeof profiles !== "object" || Array.isArray(profiles)) {
|
|
31
|
+
throw new Error(`${MANIFEST_FILENAME} socialProfiles must be an object`);
|
|
32
|
+
}
|
|
33
|
+
const value = profiles[platform];
|
|
34
|
+
if (value === void 0) return null;
|
|
35
|
+
if (typeof value !== "string" || !isValidSocialProfileId(value)) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`${MANIFEST_FILENAME} socialProfiles.${platform} must be a safe 1-64 character profile id`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
function findProjectManifest(startDir = process.cwd(), maxDepth = 8) {
|
|
43
|
+
let dir = path.resolve(startDir);
|
|
44
|
+
for (let i = 0; i <= maxDepth; i++) {
|
|
45
|
+
const candidate = path.join(dir, MANIFEST_FILENAME);
|
|
46
|
+
if (fs.existsSync(candidate)) {
|
|
47
|
+
try {
|
|
48
|
+
const obj = JSON.parse(fs.readFileSync(candidate, "utf-8"));
|
|
49
|
+
if (obj && typeof obj === "object") return { manifest: obj, filePath: candidate };
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const parent = path.dirname(dir);
|
|
55
|
+
if (parent === dir) break;
|
|
56
|
+
dir = parent;
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
function manifestServiceEntries(m) {
|
|
61
|
+
const svc = m.services ?? {};
|
|
62
|
+
return Object.keys(svc).filter((k) => svc[k] != null).map((k) => [k, svc[k]]);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// src/credentials.ts
|
|
19
66
|
function credLabel(spec, lang = resolveLang()) {
|
|
20
67
|
return spec.label[lang];
|
|
21
68
|
}
|
|
@@ -26,28 +73,30 @@ function credObtain(spec, lang = resolveLang()) {
|
|
|
26
73
|
return spec.obtain[lang];
|
|
27
74
|
}
|
|
28
75
|
function credDir(home) {
|
|
29
|
-
return
|
|
76
|
+
return path2.join(home, ".mimi-seed");
|
|
30
77
|
}
|
|
31
78
|
function hasFile(home, name) {
|
|
32
|
-
return
|
|
79
|
+
return fs2.existsSync(path2.join(credDir(home), name));
|
|
33
80
|
}
|
|
34
81
|
function anyFileStarting(home, prefix) {
|
|
35
82
|
try {
|
|
36
|
-
return
|
|
83
|
+
return fs2.readdirSync(credDir(home)).some((f) => f.startsWith(prefix));
|
|
37
84
|
} catch {
|
|
38
85
|
return false;
|
|
39
86
|
}
|
|
40
87
|
}
|
|
41
88
|
function readJson(home, name) {
|
|
42
89
|
try {
|
|
43
|
-
return JSON.parse(
|
|
90
|
+
return JSON.parse(fs2.readFileSync(path2.join(credDir(home), name), "utf-8"));
|
|
44
91
|
} catch {
|
|
45
92
|
return null;
|
|
46
93
|
}
|
|
47
94
|
}
|
|
48
95
|
var EXPIRING_SOON_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
49
|
-
function detectSocialToken(home, file, idKey, tokenKey) {
|
|
50
|
-
const
|
|
96
|
+
function detectSocialToken(home, file, idKey, tokenKey, nestedPlatform) {
|
|
97
|
+
const root = readJson(home, file);
|
|
98
|
+
const nested = nestedPlatform ? root?.[nestedPlatform] : root;
|
|
99
|
+
const cfg = nested && typeof nested === "object" && !Array.isArray(nested) ? nested : null;
|
|
51
100
|
const id = cfg?.[idKey];
|
|
52
101
|
const token = cfg?.[tokenKey];
|
|
53
102
|
if (typeof id !== "string" || !id || typeof token !== "string" || !token) {
|
|
@@ -66,10 +115,34 @@ function detectSocialToken(home, file, idKey, tokenKey) {
|
|
|
66
115
|
}
|
|
67
116
|
return { present: true, detail: display, freshness: "fresh", daysRemaining };
|
|
68
117
|
}
|
|
118
|
+
function detectProjectSocialToken(home, startDir, platform) {
|
|
119
|
+
const idKey = "userId";
|
|
120
|
+
const tokenKey = "accessToken";
|
|
121
|
+
const loaded = findProjectManifest(startDir ?? process.cwd());
|
|
122
|
+
if (!loaded) return detectSocialToken(home, `${platform}.json`, idKey, tokenKey);
|
|
123
|
+
let profile;
|
|
124
|
+
try {
|
|
125
|
+
profile = manifestSocialProfile(loaded.manifest, platform);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
return { present: false, detail: error instanceof Error ? error.message : String(error) };
|
|
128
|
+
}
|
|
129
|
+
if (!profile) return detectSocialToken(home, `${platform}.json`, idKey, tokenKey);
|
|
130
|
+
const detected = detectSocialToken(
|
|
131
|
+
home,
|
|
132
|
+
path2.join("social-profiles", `${profile}.json`),
|
|
133
|
+
idKey,
|
|
134
|
+
tokenKey,
|
|
135
|
+
platform
|
|
136
|
+
);
|
|
137
|
+
return {
|
|
138
|
+
...detected,
|
|
139
|
+
detail: detected.detail ? `${profile}: ${detected.detail}` : `profile ${profile}`
|
|
140
|
+
};
|
|
141
|
+
}
|
|
69
142
|
function hasPlaySa(home) {
|
|
70
143
|
if (hasFile(home, "play-service-account.json")) return true;
|
|
71
144
|
try {
|
|
72
|
-
return
|
|
145
|
+
return fs2.readdirSync(path2.join(credDir(home), "play-service-accounts")).some((f) => f.endsWith(".json"));
|
|
73
146
|
} catch {
|
|
74
147
|
return false;
|
|
75
148
|
}
|
|
@@ -414,7 +487,7 @@ var CREDENTIALS = [
|
|
|
414
487
|
]
|
|
415
488
|
},
|
|
416
489
|
docsAnchor: "instagram",
|
|
417
|
-
detect: (home) =>
|
|
490
|
+
detect: (home, startDir) => detectProjectSocialToken(home, startDir, "instagram")
|
|
418
491
|
},
|
|
419
492
|
{
|
|
420
493
|
id: "threads",
|
|
@@ -444,7 +517,7 @@ var CREDENTIALS = [
|
|
|
444
517
|
]
|
|
445
518
|
},
|
|
446
519
|
docsAnchor: "threads",
|
|
447
|
-
detect: (home) =>
|
|
520
|
+
detect: (home, startDir) => detectProjectSocialToken(home, startDir, "threads")
|
|
448
521
|
},
|
|
449
522
|
{
|
|
450
523
|
id: "anthropic",
|
|
@@ -479,8 +552,8 @@ var CREDENTIALS = [
|
|
|
479
552
|
function tryCredById(id) {
|
|
480
553
|
return CREDENTIALS.find((c) => c.id === id);
|
|
481
554
|
}
|
|
482
|
-
function detectAll(home = os.homedir()) {
|
|
483
|
-
return new Map(CREDENTIALS.map((c) => [c.id, c.detect(home)]));
|
|
555
|
+
function detectAll(home = os.homedir(), startDir = process.cwd()) {
|
|
556
|
+
return new Map(CREDENTIALS.map((c) => [c.id, c.detect(home, startDir)]));
|
|
484
557
|
}
|
|
485
558
|
function isSatisfied(spec, detected) {
|
|
486
559
|
if (detected.get(spec.id)?.present) return true;
|
|
@@ -543,28 +616,28 @@ async function runMcpBin(bin, extraArgs = []) {
|
|
|
543
616
|
}
|
|
544
617
|
|
|
545
618
|
// src/jenkins-config.ts
|
|
546
|
-
import
|
|
619
|
+
import fs3 from "fs";
|
|
547
620
|
import os2 from "os";
|
|
548
|
-
import
|
|
549
|
-
var CONFIG_DIR =
|
|
550
|
-
var JENKINS_PATH =
|
|
551
|
-
var LEGACY_PATH =
|
|
621
|
+
import path3 from "path";
|
|
622
|
+
var CONFIG_DIR = path3.join(os2.homedir(), ".mimi-seed");
|
|
623
|
+
var JENKINS_PATH = path3.join(CONFIG_DIR, "jenkins.json");
|
|
624
|
+
var LEGACY_PATH = path3.join(CONFIG_DIR, "config.json");
|
|
552
625
|
function loadJenkinsConfig(home = os2.homedir()) {
|
|
553
626
|
try {
|
|
554
|
-
const p =
|
|
555
|
-
return JSON.parse(
|
|
627
|
+
const p = path3.join(home, ".mimi-seed", "jenkins.json");
|
|
628
|
+
return JSON.parse(fs3.readFileSync(p, "utf-8"));
|
|
556
629
|
} catch {
|
|
557
630
|
return null;
|
|
558
631
|
}
|
|
559
632
|
}
|
|
560
633
|
function migrateLegacyJenkins(home = os2.homedir()) {
|
|
561
|
-
const dir =
|
|
562
|
-
const jenkinsPath =
|
|
563
|
-
const legacyPath =
|
|
564
|
-
if (
|
|
634
|
+
const dir = path3.join(home, ".mimi-seed");
|
|
635
|
+
const jenkinsPath = path3.join(dir, "jenkins.json");
|
|
636
|
+
const legacyPath = path3.join(dir, "config.json");
|
|
637
|
+
if (fs3.existsSync(jenkinsPath)) return false;
|
|
565
638
|
let legacy;
|
|
566
639
|
try {
|
|
567
|
-
legacy = JSON.parse(
|
|
640
|
+
legacy = JSON.parse(fs3.readFileSync(legacyPath, "utf-8"));
|
|
568
641
|
} catch {
|
|
569
642
|
return false;
|
|
570
643
|
}
|
|
@@ -578,28 +651,28 @@ function migrateLegacyJenkins(home = os2.homedir()) {
|
|
|
578
651
|
...j.jobAndroid ? { jobAndroid: j.jobAndroid } : {},
|
|
579
652
|
...j.jobIos ? { jobIos: j.jobIos } : {}
|
|
580
653
|
};
|
|
581
|
-
|
|
582
|
-
|
|
654
|
+
fs3.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
655
|
+
fs3.writeFileSync(jenkinsPath, JSON.stringify(migrated, null, 2), { mode: 384 });
|
|
583
656
|
delete legacy.jenkins;
|
|
584
657
|
const tmp = `${legacyPath}.tmp`;
|
|
585
|
-
|
|
586
|
-
|
|
658
|
+
fs3.writeFileSync(tmp, JSON.stringify(legacy, null, 2), { mode: 384 });
|
|
659
|
+
fs3.renameSync(tmp, legacyPath);
|
|
587
660
|
return true;
|
|
588
661
|
}
|
|
589
662
|
|
|
590
663
|
// src/detect.ts
|
|
591
|
-
import
|
|
592
|
-
import
|
|
664
|
+
import fs4 from "fs/promises";
|
|
665
|
+
import path4 from "path";
|
|
593
666
|
async function readIfExists(p) {
|
|
594
667
|
try {
|
|
595
|
-
return await
|
|
668
|
+
return await fs4.readFile(p, "utf8");
|
|
596
669
|
} catch {
|
|
597
670
|
return null;
|
|
598
671
|
}
|
|
599
672
|
}
|
|
600
673
|
async function pathExists(p) {
|
|
601
674
|
try {
|
|
602
|
-
await
|
|
675
|
+
await fs4.access(p);
|
|
603
676
|
return true;
|
|
604
677
|
} catch {
|
|
605
678
|
return false;
|
|
@@ -621,16 +694,16 @@ async function walk(root, match, maxDepth = 5) {
|
|
|
621
694
|
if (depth > maxDepth) return;
|
|
622
695
|
let entries;
|
|
623
696
|
try {
|
|
624
|
-
entries = await
|
|
697
|
+
entries = await fs4.readdir(dir, { withFileTypes: true });
|
|
625
698
|
} catch {
|
|
626
699
|
return;
|
|
627
700
|
}
|
|
628
701
|
for (const e of entries) {
|
|
629
702
|
if (e.isDirectory()) {
|
|
630
703
|
if (skipDirs.has(e.name)) continue;
|
|
631
|
-
await visit(
|
|
704
|
+
await visit(path4.join(dir, e.name), depth + 1);
|
|
632
705
|
} else if (e.isFile() && match(e.name)) {
|
|
633
|
-
found.push(
|
|
706
|
+
found.push(path4.join(dir, e.name));
|
|
634
707
|
}
|
|
635
708
|
}
|
|
636
709
|
}
|
|
@@ -640,7 +713,7 @@ async function walk(root, match, maxDepth = 5) {
|
|
|
640
713
|
async function detectHints(cwd) {
|
|
641
714
|
const hints = [];
|
|
642
715
|
for (const fname of ["app.json", "app.config.json"]) {
|
|
643
|
-
const txt = await readIfExists(
|
|
716
|
+
const txt = await readIfExists(path4.join(cwd, fname));
|
|
644
717
|
if (!txt) continue;
|
|
645
718
|
try {
|
|
646
719
|
const json = JSON.parse(txt);
|
|
@@ -671,7 +744,7 @@ async function detectHints(cwd) {
|
|
|
671
744
|
if (m?.[1]) {
|
|
672
745
|
const pkg = m[1];
|
|
673
746
|
if (!hints.some((h) => h.packageName === pkg)) {
|
|
674
|
-
hints.push({ packageName: pkg, source: [
|
|
747
|
+
hints.push({ packageName: pkg, source: [path4.relative(cwd, f)] });
|
|
675
748
|
}
|
|
676
749
|
}
|
|
677
750
|
}
|
|
@@ -686,7 +759,7 @@ async function detectHints(cwd) {
|
|
|
686
759
|
let bid = m[1];
|
|
687
760
|
if (bid.includes("$(PRODUCT_BUNDLE_IDENTIFIER)")) continue;
|
|
688
761
|
if (!hints.some((h) => h.bundleId === bid)) {
|
|
689
|
-
hints.push({ bundleId: bid, source: [
|
|
762
|
+
hints.push({ bundleId: bid, source: [path4.relative(cwd, f)] });
|
|
690
763
|
}
|
|
691
764
|
}
|
|
692
765
|
}
|
|
@@ -699,11 +772,11 @@ async function detectHints(cwd) {
|
|
|
699
772
|
const bid = m[1].trim().replace(/^["']|["']$/g, "");
|
|
700
773
|
if (!bid || bid.includes("$")) continue;
|
|
701
774
|
if (!hints.some((h) => h.bundleId === bid)) {
|
|
702
|
-
hints.push({ bundleId: bid, source: [
|
|
775
|
+
hints.push({ bundleId: bid, source: [path4.relative(cwd, f)] });
|
|
703
776
|
}
|
|
704
777
|
}
|
|
705
778
|
}
|
|
706
|
-
const pkgJson = await readIfExists(
|
|
779
|
+
const pkgJson = await readIfExists(path4.join(cwd, "package.json"));
|
|
707
780
|
if (pkgJson) {
|
|
708
781
|
try {
|
|
709
782
|
const json = JSON.parse(pkgJson);
|
|
@@ -739,7 +812,7 @@ async function detectHints(cwd) {
|
|
|
739
812
|
return merged.filter((h) => h.packageName || h.bundleId);
|
|
740
813
|
}
|
|
741
814
|
async function hasAnyProjectSignal(cwd) {
|
|
742
|
-
return await pathExists(
|
|
815
|
+
return await pathExists(path4.join(cwd, "package.json")) || await pathExists(path4.join(cwd, "app.json")) || await pathExists(path4.join(cwd, "android")) || await pathExists(path4.join(cwd, "ios"));
|
|
743
816
|
}
|
|
744
817
|
|
|
745
818
|
// src/deploy.ts
|
|
@@ -747,28 +820,28 @@ import kleur from "kleur";
|
|
|
747
820
|
import * as readline from "readline";
|
|
748
821
|
|
|
749
822
|
// src/config.ts
|
|
750
|
-
import
|
|
751
|
-
import
|
|
823
|
+
import fs5 from "fs/promises";
|
|
824
|
+
import path5 from "path";
|
|
752
825
|
import os3 from "os";
|
|
753
|
-
var CONFIG_DIR2 =
|
|
754
|
-
var CONFIG_PATH =
|
|
826
|
+
var CONFIG_DIR2 = path5.join(os3.homedir(), ".mimi-seed");
|
|
827
|
+
var CONFIG_PATH = path5.join(CONFIG_DIR2, "config.json");
|
|
755
828
|
async function readConfig() {
|
|
756
829
|
try {
|
|
757
|
-
const txt = await
|
|
830
|
+
const txt = await fs5.readFile(CONFIG_PATH, "utf8");
|
|
758
831
|
return JSON.parse(txt);
|
|
759
832
|
} catch {
|
|
760
833
|
return null;
|
|
761
834
|
}
|
|
762
835
|
}
|
|
763
836
|
async function writeConfig(cfg) {
|
|
764
|
-
await
|
|
765
|
-
await
|
|
837
|
+
await fs5.mkdir(CONFIG_DIR2, { recursive: true });
|
|
838
|
+
await fs5.writeFile(CONFIG_PATH, JSON.stringify(cfg, null, 2));
|
|
766
839
|
if (process.platform !== "win32") {
|
|
767
|
-
await
|
|
840
|
+
await fs5.chmod(CONFIG_PATH, 384);
|
|
768
841
|
}
|
|
769
842
|
}
|
|
770
843
|
async function deleteConfig() {
|
|
771
|
-
await
|
|
844
|
+
await fs5.rm(CONFIG_PATH, { force: true });
|
|
772
845
|
}
|
|
773
846
|
var CONFIG_LOCATION = CONFIG_PATH;
|
|
774
847
|
async function getEffectiveConfig() {
|
|
@@ -787,10 +860,10 @@ async function getEffectiveConfig() {
|
|
|
787
860
|
}
|
|
788
861
|
|
|
789
862
|
// src/ci-providers.ts
|
|
790
|
-
import
|
|
791
|
-
import
|
|
863
|
+
import fs6 from "fs";
|
|
864
|
+
import path6 from "path";
|
|
792
865
|
import os4 from "os";
|
|
793
|
-
var CI_CONFIG_PATH =
|
|
866
|
+
var CI_CONFIG_PATH = path6.join(os4.homedir(), ".mimi-seed", "ci.json");
|
|
794
867
|
var M = catalog(
|
|
795
868
|
{
|
|
796
869
|
badToken: (provider, status) => `${provider} ${status} \u2014 \uD1A0\uD070\uC774 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC544`,
|
|
@@ -808,7 +881,7 @@ var M = catalog(
|
|
|
808
881
|
);
|
|
809
882
|
function loadCiProviderConfig() {
|
|
810
883
|
try {
|
|
811
|
-
const cfg = JSON.parse(
|
|
884
|
+
const cfg = JSON.parse(fs6.readFileSync(CI_CONFIG_PATH, "utf-8"));
|
|
812
885
|
const host = normalizeHost(cfg.host);
|
|
813
886
|
return host ? { ...cfg, host } : { ...cfg, host: void 0 };
|
|
814
887
|
} catch {
|
|
@@ -822,15 +895,15 @@ function normalizeHost(host) {
|
|
|
822
895
|
return withScheme.replace(/\/+$/, "");
|
|
823
896
|
}
|
|
824
897
|
function saveCiProviderConfig(cfg) {
|
|
825
|
-
const dir =
|
|
826
|
-
if (!
|
|
827
|
-
|
|
898
|
+
const dir = path6.dirname(CI_CONFIG_PATH);
|
|
899
|
+
if (!fs6.existsSync(dir)) {
|
|
900
|
+
fs6.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
828
901
|
}
|
|
829
902
|
const normalized = { ...cfg, host: normalizeHost(cfg.host) };
|
|
830
903
|
if (!normalized.host) delete normalized.host;
|
|
831
|
-
|
|
904
|
+
fs6.writeFileSync(CI_CONFIG_PATH, JSON.stringify(normalized, null, 2));
|
|
832
905
|
if (process.platform !== "win32") {
|
|
833
|
-
|
|
906
|
+
fs6.chmodSync(CI_CONFIG_PATH, 384);
|
|
834
907
|
}
|
|
835
908
|
}
|
|
836
909
|
async function verifyCiToken(cfg) {
|
|
@@ -1721,6 +1794,8 @@ export {
|
|
|
1721
1794
|
deleteConfig,
|
|
1722
1795
|
CONFIG_LOCATION,
|
|
1723
1796
|
getEffectiveConfig,
|
|
1797
|
+
findProjectManifest,
|
|
1798
|
+
manifestServiceEntries,
|
|
1724
1799
|
credLabel,
|
|
1725
1800
|
credNote,
|
|
1726
1801
|
CREDENTIALS,
|
package/dist/index.js
CHANGED
|
@@ -13,14 +13,16 @@ import {
|
|
|
13
13
|
deleteConfig,
|
|
14
14
|
detectAll,
|
|
15
15
|
detectHints,
|
|
16
|
+
findProjectManifest,
|
|
16
17
|
getEffectiveConfig,
|
|
17
18
|
hasAnyProjectSignal,
|
|
18
19
|
isSatisfied,
|
|
20
|
+
manifestServiceEntries,
|
|
19
21
|
migrateLegacyJenkins,
|
|
20
22
|
runMcpBin,
|
|
21
23
|
tryCredById,
|
|
22
24
|
writeConfig
|
|
23
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-3FZH2LZB.js";
|
|
24
26
|
import {
|
|
25
27
|
catalog,
|
|
26
28
|
isLang,
|
|
@@ -31,8 +33,8 @@ import {
|
|
|
31
33
|
|
|
32
34
|
// src/index.ts
|
|
33
35
|
import os3 from "os";
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
+
import fs4 from "fs";
|
|
37
|
+
import path4 from "path";
|
|
36
38
|
import kleur9 from "kleur";
|
|
37
39
|
import open from "open";
|
|
38
40
|
|
|
@@ -142,33 +144,6 @@ function formatCommitsForPrompt(commits) {
|
|
|
142
144
|
return commits.map((c) => `- ${c.message} (${c.author}, ${c.date.slice(0, 10)})`).join("\n");
|
|
143
145
|
}
|
|
144
146
|
|
|
145
|
-
// src/project-manifest.ts
|
|
146
|
-
import fs from "fs";
|
|
147
|
-
import path from "path";
|
|
148
|
-
var MANIFEST_FILENAME = ".mimi-seed.json";
|
|
149
|
-
function findProjectManifest(startDir = process.cwd(), maxDepth = 8) {
|
|
150
|
-
let dir = path.resolve(startDir);
|
|
151
|
-
for (let i = 0; i <= maxDepth; i++) {
|
|
152
|
-
const candidate = path.join(dir, MANIFEST_FILENAME);
|
|
153
|
-
if (fs.existsSync(candidate)) {
|
|
154
|
-
try {
|
|
155
|
-
const obj = JSON.parse(fs.readFileSync(candidate, "utf-8"));
|
|
156
|
-
if (obj && typeof obj === "object") return { manifest: obj, filePath: candidate };
|
|
157
|
-
} catch {
|
|
158
|
-
}
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
161
|
-
const parent = path.dirname(dir);
|
|
162
|
-
if (parent === dir) break;
|
|
163
|
-
dir = parent;
|
|
164
|
-
}
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
function manifestServiceEntries(m) {
|
|
168
|
-
const svc = m.services ?? {};
|
|
169
|
-
return Object.keys(svc).filter((k) => svc[k] != null).map((k) => [k, svc[k]]);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
147
|
// src/doctor.ts
|
|
173
148
|
function ok(label, detail = "") {
|
|
174
149
|
process.stdout.write(` ${kleur.green("\u2713")} ${label}${detail ? kleur.dim(" " + detail) : ""}
|
|
@@ -224,7 +199,7 @@ async function cmdDoctor() {
|
|
|
224
199
|
}
|
|
225
200
|
section(m.secCreds);
|
|
226
201
|
migrateLegacyJenkins();
|
|
227
|
-
const detected = detectAll();
|
|
202
|
+
const detected = detectAll(void 0, cwd);
|
|
228
203
|
for (const spec of CREDENTIALS) {
|
|
229
204
|
const d = detected.get(spec.id);
|
|
230
205
|
const base = credLabel(spec);
|
|
@@ -990,6 +965,7 @@ ${kleur5.bold("\uBE4C\uB4DC / \uB9C8\uCF00\uD305:")}
|
|
|
990
965
|
${kleur5.cyan("mimi-seed auth facebook")} Facebook \uD398\uC774\uC9C0
|
|
991
966
|
${kleur5.cyan("mimi-seed auth instagram")} Instagram
|
|
992
967
|
${kleur5.cyan("mimi-seed auth threads")} Threads
|
|
968
|
+
${kleur5.dim(" Instagram/Threads: --profile <id>\uB85C \uD2B9\uC815 \uC18C\uC15C \uD504\uB85C\uD544 \uC800\uC7A5/\uAC31\uC2E0")}
|
|
993
969
|
|
|
994
970
|
${kleur5.bold("\uC804\uCCB4 \uC0C1\uD0DC:")}
|
|
995
971
|
${kleur5.cyan("mimi-seed auth status --all")} \uBAA8\uB4E0 \uC790\uACA9\uC99D\uBA85 \uBCF4\uC720 \uC5EC\uBD80 \uD55C\uB208\uC5D0
|
|
@@ -1028,6 +1004,7 @@ ${kleur5.bold("Build / marketing:")}
|
|
|
1028
1004
|
${kleur5.cyan("mimi-seed auth facebook")} Facebook Page
|
|
1029
1005
|
${kleur5.cyan("mimi-seed auth instagram")} Instagram
|
|
1030
1006
|
${kleur5.cyan("mimi-seed auth threads")} Threads
|
|
1007
|
+
${kleur5.dim(" Instagram/Threads: use --profile <id> to save or refresh a named social profile")}
|
|
1031
1008
|
|
|
1032
1009
|
${kleur5.bold("Everything at a glance:")}
|
|
1033
1010
|
${kleur5.cyan("mimi-seed auth status --all")} which credentials you have
|
|
@@ -1075,12 +1052,12 @@ async function cmdAuth(args) {
|
|
|
1075
1052
|
if (sub === "bigquery") return void exitWith(await runMcpBin("mimi-seed-bigquery-auth", rest));
|
|
1076
1053
|
if (sub === "jenkins") return void exitWith(await runMcpBin("mimi-seed-jenkins-auth", rest));
|
|
1077
1054
|
if (sub === "googleads") return void exitWith(await runMcpBin("mimi-seed-googleads-auth", rest));
|
|
1078
|
-
if (sub === "meta") return void exitWith(await runMcpBin("mimi-seed-social-auth", ["all"]));
|
|
1055
|
+
if (sub === "meta") return void exitWith(await runMcpBin("mimi-seed-social-auth", ["all", ...rest]));
|
|
1079
1056
|
if (sub === "facebook") return void exitWith(await runMcpBin("mimi-seed-social-auth", ["facebook"]));
|
|
1080
|
-
if (sub === "instagram") return void exitWith(await runMcpBin("mimi-seed-social-auth", ["instagram"]));
|
|
1081
|
-
if (sub === "threads") return void exitWith(await runMcpBin("mimi-seed-social-auth", ["threads"]));
|
|
1057
|
+
if (sub === "instagram") return void exitWith(await runMcpBin("mimi-seed-social-auth", ["instagram", ...rest]));
|
|
1058
|
+
if (sub === "threads") return void exitWith(await runMcpBin("mimi-seed-social-auth", ["threads", ...rest]));
|
|
1082
1059
|
if (sub === "ci") {
|
|
1083
|
-
const { cmdSetup: cmdSetup2 } = await import("./setup-
|
|
1060
|
+
const { cmdSetup: cmdSetup2 } = await import("./setup-VP5WRSXY.js");
|
|
1084
1061
|
await cmdSetup2(["--only", "github,gitlab", "--reconnect", "github,gitlab"]);
|
|
1085
1062
|
return;
|
|
1086
1063
|
}
|
|
@@ -1171,9 +1148,9 @@ async function cmdGa4(args) {
|
|
|
1171
1148
|
|
|
1172
1149
|
// src/mcp-restart.ts
|
|
1173
1150
|
import { execSync as execSync2 } from "child_process";
|
|
1174
|
-
import
|
|
1151
|
+
import fs from "fs";
|
|
1175
1152
|
import os from "os";
|
|
1176
|
-
import
|
|
1153
|
+
import path from "path";
|
|
1177
1154
|
import kleur7 from "kleur";
|
|
1178
1155
|
function log3(msg) {
|
|
1179
1156
|
process.stdout.write(msg + "\n");
|
|
@@ -1215,9 +1192,9 @@ var M6 = catalog(
|
|
|
1215
1192
|
}
|
|
1216
1193
|
);
|
|
1217
1194
|
function readClaudeJson() {
|
|
1218
|
-
const p =
|
|
1195
|
+
const p = path.join(os.homedir(), ".claude.json");
|
|
1219
1196
|
try {
|
|
1220
|
-
return JSON.parse(
|
|
1197
|
+
return JSON.parse(fs.readFileSync(p, "utf8"));
|
|
1221
1198
|
} catch {
|
|
1222
1199
|
return {};
|
|
1223
1200
|
}
|
|
@@ -1304,8 +1281,8 @@ async function cmdRestart(args) {
|
|
|
1304
1281
|
}
|
|
1305
1282
|
|
|
1306
1283
|
// src/mcp-config.ts
|
|
1307
|
-
import
|
|
1308
|
-
import
|
|
1284
|
+
import fs2 from "fs/promises";
|
|
1285
|
+
import path2 from "path";
|
|
1309
1286
|
import os2 from "os";
|
|
1310
1287
|
import kleur8 from "kleur";
|
|
1311
1288
|
var SERVER_NAME = "mimi-seed";
|
|
@@ -1377,12 +1354,12 @@ function removeTomlBlock(input, tableName) {
|
|
|
1377
1354
|
return `${input.slice(0, start)}${input.slice(end).replace(/^\n+/, "\n")}`;
|
|
1378
1355
|
}
|
|
1379
1356
|
async function writeCodexMcpConfig(cfg) {
|
|
1380
|
-
const configDir =
|
|
1381
|
-
const configPath =
|
|
1382
|
-
await
|
|
1357
|
+
const configDir = path2.join(os2.homedir(), ".codex");
|
|
1358
|
+
const configPath = path2.join(configDir, "config.toml");
|
|
1359
|
+
await fs2.mkdir(configDir, { recursive: true });
|
|
1383
1360
|
let current = "";
|
|
1384
1361
|
try {
|
|
1385
|
-
current = await
|
|
1362
|
+
current = await fs2.readFile(configPath, "utf8");
|
|
1386
1363
|
} catch {
|
|
1387
1364
|
current = "";
|
|
1388
1365
|
}
|
|
@@ -1392,14 +1369,14 @@ async function writeCodexMcpConfig(cfg) {
|
|
|
1392
1369
|
current = removeTomlBlock(current, "mcp_servers.mimi-seed.http_headers");
|
|
1393
1370
|
}
|
|
1394
1371
|
const next = replaceTomlBlock(current, `mcp_servers.${CODEX_REMOTE_NAME}`, codexBlock(cfg));
|
|
1395
|
-
await
|
|
1372
|
+
await fs2.writeFile(configPath, next);
|
|
1396
1373
|
return configPath;
|
|
1397
1374
|
}
|
|
1398
1375
|
|
|
1399
1376
|
// src/release-manifest.ts
|
|
1400
|
-
import
|
|
1401
|
-
import
|
|
1402
|
-
var RELEASE_MANIFEST_RELATIVE_PATH =
|
|
1377
|
+
import fs3 from "fs/promises";
|
|
1378
|
+
import path3 from "path";
|
|
1379
|
+
var RELEASE_MANIFEST_RELATIVE_PATH = path3.join("docs", "releases.json");
|
|
1403
1380
|
var RELEASE_MANIFEST_TEMPLATE = {
|
|
1404
1381
|
$schema: {
|
|
1405
1382
|
_comment: "Mimi Seed release notes SSOT. Store notes, App Store What's New, in-app announcements, and app-version rollout metadata can share this file.",
|
|
@@ -1425,14 +1402,14 @@ var RELEASE_MANIFEST_TEMPLATE = {
|
|
|
1425
1402
|
versions: {}
|
|
1426
1403
|
};
|
|
1427
1404
|
async function ensureReleaseManifest(cwd) {
|
|
1428
|
-
const filePath =
|
|
1405
|
+
const filePath = path3.join(cwd, RELEASE_MANIFEST_RELATIVE_PATH);
|
|
1429
1406
|
try {
|
|
1430
|
-
await
|
|
1407
|
+
await fs3.access(filePath);
|
|
1431
1408
|
return { path: filePath, created: false };
|
|
1432
1409
|
} catch {
|
|
1433
1410
|
}
|
|
1434
|
-
await
|
|
1435
|
-
await
|
|
1411
|
+
await fs3.mkdir(path3.dirname(filePath), { recursive: true });
|
|
1412
|
+
await fs3.writeFile(filePath, `${JSON.stringify(RELEASE_MANIFEST_TEMPLATE, null, 2)}
|
|
1436
1413
|
`, {
|
|
1437
1414
|
mode: 420
|
|
1438
1415
|
});
|
|
@@ -1897,16 +1874,16 @@ async function cmdInit(args) {
|
|
|
1897
1874
|
"- `/mimi-seed:health` \u2014 \uC5F0\uACB0 \uC0C1\uD0DC \uBE60\uB978 \uD655\uC778",
|
|
1898
1875
|
"- `/mimi-seed:review-inbox` \u2014 \uBBF8\uB2F5\uBCC0 \uB9AC\uBDF0 \uB2F5\uBCC0"
|
|
1899
1876
|
].join("\n");
|
|
1900
|
-
const claudeDir =
|
|
1901
|
-
const claudeAgentPath =
|
|
1902
|
-
if (!
|
|
1903
|
-
|
|
1904
|
-
|
|
1877
|
+
const claudeDir = path4.join(cwd, ".claude");
|
|
1878
|
+
const claudeAgentPath = path4.join(claudeDir, "mimi-seed.md");
|
|
1879
|
+
if (!fs4.existsSync(claudeAgentPath)) {
|
|
1880
|
+
fs4.mkdirSync(claudeDir, { recursive: true });
|
|
1881
|
+
fs4.writeFileSync(claudeAgentPath, agentMd, { mode: 420 });
|
|
1905
1882
|
log4(kleur9.dim(M8().claudeAgent));
|
|
1906
1883
|
}
|
|
1907
|
-
const codexAgentPath =
|
|
1908
|
-
if (!
|
|
1909
|
-
|
|
1884
|
+
const codexAgentPath = path4.join(cwd, "AGENTS.md");
|
|
1885
|
+
if (!fs4.existsSync(codexAgentPath)) {
|
|
1886
|
+
fs4.writeFileSync(codexAgentPath, agentMd, { mode: 420 });
|
|
1910
1887
|
log4(kleur9.dim(M8().codexAgent));
|
|
1911
1888
|
}
|
|
1912
1889
|
const manifest = await ensureReleaseManifest(cwd);
|