ai-project-manage-cli 6.0.71 → 6.0.73
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/index.js +40 -16
- package/package.json +1 -1
- package/template/deploy/README.md +0 -14
package/dist/index.js
CHANGED
|
@@ -520,7 +520,7 @@ async function tryReadGitOriginUrl(cwd) {
|
|
|
520
520
|
}
|
|
521
521
|
|
|
522
522
|
// src/deployment-config-sync.ts
|
|
523
|
-
var TEMPLATE_HINT = "\u4FDD\u7559\u6A21\u677F .apm/apm.config.json
|
|
523
|
+
var TEMPLATE_HINT = "\u4FDD\u7559\u6A21\u677F .apm/apm.config.json";
|
|
524
524
|
var SYNC_HINT = "\u767B\u8BB0\u5DE5\u4F5C\u7A7A\u95F4\u8DEF\u5F84\u3001\u7ED1\u5B9A\u4ED3\u5E93\u540E\uFF0C\u53EF\u6267\u884C: apm sync-deploy-config";
|
|
525
525
|
async function resolveRepositoryIdForSync(api, workdirPath) {
|
|
526
526
|
const baseline = await api.cli.workspaceBaseline({ workdirPath });
|
|
@@ -583,15 +583,8 @@ ${diagnostic ?? ""}
|
|
|
583
583
|
const apmConfigPath = toFsPath(join3(targetApmDir, "apm.config.json"));
|
|
584
584
|
writeFileSync3(apmConfigPath, `${JSON.stringify(parsed, null, 2)}
|
|
585
585
|
`, "utf8");
|
|
586
|
-
const deployDir = join3(targetApmDir, "deploy");
|
|
587
|
-
await ensureDirExists(deployDir);
|
|
588
|
-
writeFileSync3(
|
|
589
|
-
toFsPath(join3(deployDir, "README.md")),
|
|
590
|
-
config.deploymentDoc ?? "",
|
|
591
|
-
"utf8"
|
|
592
|
-
);
|
|
593
586
|
console.log(`[apm] \u5DF2\u540C\u6B65\u5E73\u53F0\u90E8\u7F72\u914D\u7F6E: ${config.name}`);
|
|
594
|
-
console.log("[apm] \u5DF2\u5199\u5165 .apm/apm.config.json
|
|
587
|
+
console.log("[apm] \u5DF2\u5199\u5165 .apm/apm.config.json");
|
|
595
588
|
return { synced: true, repositoryId, configName: config.name };
|
|
596
589
|
}
|
|
597
590
|
|
|
@@ -915,7 +908,7 @@ async function runInit(name) {
|
|
|
915
908
|
console.log(`[apm] \u5DE5\u4F5C\u76EE\u5F55\u8DEF\u5F84\uFF1A${workdir}`);
|
|
916
909
|
if (syncResult && !syncResult.synced) {
|
|
917
910
|
console.log(
|
|
918
|
-
"[apm] \u5F53\u524D .apm/apm.config.json \
|
|
911
|
+
"[apm] \u5F53\u524D .apm/apm.config.json \u4E3A\u6A21\u677F\u9ED8\u8BA4\u503C\uFF1B\u5B8C\u6210\u5E73\u53F0\u767B\u8BB0\u540E\u6267\u884C apm sync-deploy-config"
|
|
919
912
|
);
|
|
920
913
|
}
|
|
921
914
|
console.log("[apm] \u8BF7\u5728\u5E73\u53F0\u300C\u63A5\u5165\u7BA1\u7406 \u2192 \u5DE5\u4F5C\u7A7A\u95F4\u300D\u767B\u8BB0\u4E0A\u8FF0\u76EE\u5F55\u8DEF\u5F84");
|
|
@@ -1764,8 +1757,33 @@ async function fetchPublishedVersion(spec) {
|
|
|
1764
1757
|
async function fetchLatestPublishedVersion() {
|
|
1765
1758
|
return fetchPublishedVersion("latest");
|
|
1766
1759
|
}
|
|
1760
|
+
function compareSemverDescending(a, b) {
|
|
1761
|
+
const pa = a.split(".").map((p) => Number.parseInt(p, 10) || 0);
|
|
1762
|
+
const pb = b.split(".").map((p) => Number.parseInt(p, 10) || 0);
|
|
1763
|
+
const len = Math.max(pa.length, pb.length);
|
|
1764
|
+
for (let i = 0; i < len; i++) {
|
|
1765
|
+
const diff = (pb[i] ?? 0) - (pa[i] ?? 0);
|
|
1766
|
+
if (diff !== 0) return diff;
|
|
1767
|
+
}
|
|
1768
|
+
return 0;
|
|
1769
|
+
}
|
|
1767
1770
|
async function fetchLatestPublishedVersionInMajor(major) {
|
|
1768
|
-
|
|
1771
|
+
const tagVersion = await fetchPublishedVersion(String(major));
|
|
1772
|
+
if (tagVersion) return tagVersion;
|
|
1773
|
+
const url = `${registryBaseUrl()}/${CLI_PACKAGE_NAME}`;
|
|
1774
|
+
try {
|
|
1775
|
+
const res = await fetch(url);
|
|
1776
|
+
if (!res.ok) return null;
|
|
1777
|
+
const data = await res.json();
|
|
1778
|
+
const versions = Object.keys(data.versions ?? {}).filter(
|
|
1779
|
+
(v) => parseMajorVersion(v) === major
|
|
1780
|
+
);
|
|
1781
|
+
if (versions.length === 0) return null;
|
|
1782
|
+
versions.sort(compareSemverDescending);
|
|
1783
|
+
return versions[0] ?? null;
|
|
1784
|
+
} catch {
|
|
1785
|
+
return null;
|
|
1786
|
+
}
|
|
1769
1787
|
}
|
|
1770
1788
|
function resolveUpdateTarget(input) {
|
|
1771
1789
|
const { current, allowMajorUpgrade, latestInMajor, globalLatest } = input;
|
|
@@ -1785,10 +1803,13 @@ function resolveUpdateTarget(input) {
|
|
|
1785
1803
|
if (latestInMajor && latestInMajor === current) {
|
|
1786
1804
|
return { action: "skip" };
|
|
1787
1805
|
}
|
|
1806
|
+
if (!latestInMajor && globalLatest && parseMajorVersion(globalLatest) === currentMajor && globalLatest === current) {
|
|
1807
|
+
return { action: "skip" };
|
|
1808
|
+
}
|
|
1788
1809
|
const majorUpgradeAvailable = globalLatest && parseMajorVersion(globalLatest) > currentMajor ? globalLatest : null;
|
|
1789
1810
|
return {
|
|
1790
1811
|
action: "install",
|
|
1791
|
-
installSpec: `${CLI_PACKAGE_NAME}@${currentMajor}`,
|
|
1812
|
+
installSpec: latestInMajor ? `${CLI_PACKAGE_NAME}@${latestInMajor}` : `${CLI_PACKAGE_NAME}@${currentMajor}`,
|
|
1792
1813
|
targetLabel: latestInMajor ?? String(currentMajor),
|
|
1793
1814
|
expectedVersion: latestInMajor,
|
|
1794
1815
|
majorUpgradeAvailable
|
|
@@ -1838,14 +1859,17 @@ async function runUpdate(options = {}) {
|
|
|
1838
1859
|
process.exit(install.status ?? 1);
|
|
1839
1860
|
}
|
|
1840
1861
|
const after = readCliVersion();
|
|
1862
|
+
const expectedBump = resolved.expectedVersion !== null && resolved.expectedVersion !== current;
|
|
1841
1863
|
if (resolved.expectedVersion && after === resolved.expectedVersion) {
|
|
1842
1864
|
console.log(`[apm] \u5DF2\u66F4\u65B0\u5230 ${after}`);
|
|
1843
|
-
} else {
|
|
1865
|
+
} else if (expectedBump) {
|
|
1844
1866
|
console.log(
|
|
1845
1867
|
`[apm] \u66F4\u65B0\u5B8C\u6210\u3002\u82E5\u7248\u672C\u53F7\u672A\u53D8\u5316\uFF0C\u8BF7\u5728\u65B0\u7EC8\u7AEF\u6267\u884C apm -V \u786E\u8BA4\uFF08\u5168\u5C40\u5B89\u88C5\u8DEF\u5F84\u53EF\u80FD\u672A\u5237\u65B0\uFF09`
|
|
1846
1868
|
);
|
|
1869
|
+
} else {
|
|
1870
|
+
console.log(`[apm] \u5DF2\u662F\u6700\u65B0\u7248\u672C ${current}`);
|
|
1847
1871
|
}
|
|
1848
|
-
return { didUpdate:
|
|
1872
|
+
return { didUpdate: expectedBump };
|
|
1849
1873
|
}
|
|
1850
1874
|
|
|
1851
1875
|
// src/commands/update-skills.ts
|
|
@@ -5663,7 +5687,7 @@ function buildProgram() {
|
|
|
5663
5687
|
await runLogin(opts);
|
|
5664
5688
|
});
|
|
5665
5689
|
program.command("init").description(
|
|
5666
|
-
"\u5728\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\u521D\u59CB\u5316 .apm \u6A21\u677F\uFF08\u82E5 .apm \u5DF2\u5B58\u5728\u4E14\u975E\u7A7A\u5219\u62A5\u9519\uFF09\uFF1B\u5DF2\u767B\u5F55\u4E14\u5E73\u53F0\u6709\u5339\u914D\u90E8\u7F72\u914D\u7F6E\u65F6\u4F1A\u540C\u6B65 apm.config.json
|
|
5690
|
+
"\u5728\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\u521D\u59CB\u5316 .apm \u6A21\u677F\uFF08\u82E5 .apm \u5DF2\u5B58\u5728\u4E14\u975E\u7A7A\u5219\u62A5\u9519\uFF09\uFF1B\u5DF2\u767B\u5F55\u4E14\u5E73\u53F0\u6709\u5339\u914D\u90E8\u7F72\u914D\u7F6E\u65F6\u4F1A\u540C\u6B65 apm.config.json"
|
|
5667
5691
|
).option("--name <name>", "\u5DE5\u4F5C\u76EE\u5F55\u540D\u79F0").action(async (opts) => {
|
|
5668
5692
|
await runInit(opts.name);
|
|
5669
5693
|
});
|
|
@@ -5683,7 +5707,7 @@ function buildProgram() {
|
|
|
5683
5707
|
await runUpdateSkills();
|
|
5684
5708
|
});
|
|
5685
5709
|
program.command("sync-deploy-config").description(
|
|
5686
|
-
"\u4ECE\u5E73\u53F0\u62C9\u53D6\u90E8\u7F72\u914D\u7F6E\uFF0C\u8986\u76D6 .apm/apm.config.json
|
|
5710
|
+
"\u4ECE\u5E73\u53F0\u62C9\u53D6\u90E8\u7F72\u914D\u7F6E\uFF0C\u8986\u76D6 .apm/apm.config.json\uFF08\u9700\u5DF2 login \u4E14\u5DE5\u4F5C\u7A7A\u95F4\u5DF2\u767B\u8BB0\u5E76\u7ED1\u5B9A\u4ED3\u5E93\uFF09"
|
|
5687
5711
|
).action(async () => {
|
|
5688
5712
|
await runSyncDeployConfig();
|
|
5689
5713
|
});
|
package/package.json
CHANGED