mano-coding 0.1.19 → 0.1.20
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 +81 -50
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -31879,6 +31879,8 @@ var init_execute = __esm({
|
|
|
31879
31879
|
|
|
31880
31880
|
// packages/core/src/execute/task-runner.ts
|
|
31881
31881
|
import { spawn } from "node:child_process";
|
|
31882
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
31883
|
+
import { delimiter, join as join11 } from "node:path";
|
|
31882
31884
|
function filterTasksByHook(items, hook) {
|
|
31883
31885
|
return items.filter((item) => {
|
|
31884
31886
|
const task = "task" in item ? item.task : item;
|
|
@@ -31980,6 +31982,33 @@ function generateTaskSummary(tasks, ctx) {
|
|
|
31980
31982
|
return `[${idx + 1}/${tasks.length}] ${task.id}: ${fullCmd}`;
|
|
31981
31983
|
});
|
|
31982
31984
|
}
|
|
31985
|
+
function resolveTaskExecutable(command, platform = process.platform, envPath) {
|
|
31986
|
+
if (platform !== "win32") {
|
|
31987
|
+
return command;
|
|
31988
|
+
}
|
|
31989
|
+
if (/\.(exe|cmd|bat|com)$/i.test(command)) {
|
|
31990
|
+
return command;
|
|
31991
|
+
}
|
|
31992
|
+
const knownCmds = /* @__PURE__ */ new Set(["npx", "npm", "pnpm", "yarn", "corepack", "bun", "deno"]);
|
|
31993
|
+
if (knownCmds.has(command.toLowerCase())) {
|
|
31994
|
+
return `${command}.cmd`;
|
|
31995
|
+
}
|
|
31996
|
+
const pathValue = envPath ?? process.env.PATH ?? "";
|
|
31997
|
+
const pathext = (process.env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").map((ext) => ext.toLowerCase());
|
|
31998
|
+
const dirs = pathValue.split(delimiter).filter(Boolean);
|
|
31999
|
+
for (const dir of dirs) {
|
|
32000
|
+
for (const ext of pathext) {
|
|
32001
|
+
const target = join11(dir, `${command}${ext}`);
|
|
32002
|
+
try {
|
|
32003
|
+
if (existsSync4(target)) {
|
|
32004
|
+
return `${command}${ext}`;
|
|
32005
|
+
}
|
|
32006
|
+
} catch {
|
|
32007
|
+
}
|
|
32008
|
+
}
|
|
32009
|
+
}
|
|
32010
|
+
return command;
|
|
32011
|
+
}
|
|
31983
32012
|
async function executeTasks(tasks, ctx, options = {}) {
|
|
31984
32013
|
if (tasks.length === 0) return;
|
|
31985
32014
|
const stdio = options.stdio ?? "inherit";
|
|
@@ -31997,8 +32026,9 @@ async function executeTasks(tasks, ctx, options = {}) {
|
|
|
31997
32026
|
if (options.onProgress) {
|
|
31998
32027
|
options.onProgress(`\u6B63\u5728\u6267\u884C\u4EFB\u52A1 [${i + 1}/${tasks.length}] (${task.id}): ${command} ${args.join(" ")}`);
|
|
31999
32028
|
}
|
|
32029
|
+
const executable = resolveTaskExecutable(command, process.platform, env.PATH);
|
|
32000
32030
|
await new Promise((resolve22, reject) => {
|
|
32001
|
-
const child = spawn(
|
|
32031
|
+
const child = spawn(executable, args, {
|
|
32002
32032
|
cwd,
|
|
32003
32033
|
env,
|
|
32004
32034
|
stdio,
|
|
@@ -32050,7 +32080,7 @@ var init_task_runner = __esm({
|
|
|
32050
32080
|
|
|
32051
32081
|
// packages/core/src/execute/template-contract.ts
|
|
32052
32082
|
import { readFile as readFile17, readdir as readdir4 } from "node:fs/promises";
|
|
32053
|
-
import { join as
|
|
32083
|
+
import { join as join12, relative as relative4 } from "node:path";
|
|
32054
32084
|
function validateMcpConfig(rawConfig) {
|
|
32055
32085
|
if (typeof rawConfig !== "object" || rawConfig === null) {
|
|
32056
32086
|
throw new TemplateContractError("mcp/mcp.json \u5FC5\u987B\u662F JSON \u5BF9\u8C61", "MCP_CONFIG_INVALID");
|
|
@@ -32086,7 +32116,7 @@ function validateMcpConfig(rawConfig) {
|
|
|
32086
32116
|
async function scanTemplateDirectoryContract(options) {
|
|
32087
32117
|
const { templateDir, targets } = options;
|
|
32088
32118
|
const intents = [];
|
|
32089
|
-
const agentsPath =
|
|
32119
|
+
const agentsPath = join12(templateDir, "AGENTS.md");
|
|
32090
32120
|
try {
|
|
32091
32121
|
const agentsContent = await readFile17(agentsPath);
|
|
32092
32122
|
intents.push({
|
|
@@ -32097,16 +32127,16 @@ async function scanTemplateDirectoryContract(options) {
|
|
|
32097
32127
|
});
|
|
32098
32128
|
} catch {
|
|
32099
32129
|
}
|
|
32100
|
-
const skillsDir =
|
|
32130
|
+
const skillsDir = join12(templateDir, "skills");
|
|
32101
32131
|
try {
|
|
32102
32132
|
const skillEntries = await readdir4(skillsDir, { withFileTypes: true });
|
|
32103
32133
|
for (const skillEntry of skillEntries) {
|
|
32104
32134
|
if (!skillEntry.isDirectory()) continue;
|
|
32105
32135
|
const skillId = skillEntry.name;
|
|
32106
|
-
const singleSkillDir =
|
|
32136
|
+
const singleSkillDir = join12(skillsDir, skillId);
|
|
32107
32137
|
const allSkillFiles = await listAllFilesRecursive(singleSkillDir);
|
|
32108
32138
|
for (const relFile of allSkillFiles) {
|
|
32109
|
-
const fileContent = await readFile17(
|
|
32139
|
+
const fileContent = await readFile17(join12(singleSkillDir, relFile));
|
|
32110
32140
|
intents.push({
|
|
32111
32141
|
action: "upsert",
|
|
32112
32142
|
type: "file",
|
|
@@ -32127,17 +32157,17 @@ async function scanTemplateDirectoryContract(options) {
|
|
|
32127
32157
|
}
|
|
32128
32158
|
} catch {
|
|
32129
32159
|
}
|
|
32130
|
-
const rulesDir =
|
|
32160
|
+
const rulesDir = join12(templateDir, "rules");
|
|
32131
32161
|
try {
|
|
32132
32162
|
const ruleIdeEntries = await readdir4(rulesDir, { withFileTypes: true });
|
|
32133
32163
|
for (const ideEntry of ruleIdeEntries) {
|
|
32134
32164
|
if (!ideEntry.isDirectory()) continue;
|
|
32135
32165
|
const ide = ideEntry.name;
|
|
32136
32166
|
if (!targets.includes(ide)) continue;
|
|
32137
|
-
const singleRuleDir =
|
|
32167
|
+
const singleRuleDir = join12(rulesDir, ide);
|
|
32138
32168
|
const allRuleFiles = await listAllFilesRecursive(singleRuleDir);
|
|
32139
32169
|
for (const relFile of allRuleFiles) {
|
|
32140
|
-
const fileContent = await readFile17(
|
|
32170
|
+
const fileContent = await readFile17(join12(singleRuleDir, relFile));
|
|
32141
32171
|
const normalizedRel = relFile.replaceAll("\\", "/");
|
|
32142
32172
|
let targetDestPath;
|
|
32143
32173
|
switch (ide) {
|
|
@@ -32168,7 +32198,7 @@ async function scanTemplateDirectoryContract(options) {
|
|
|
32168
32198
|
}
|
|
32169
32199
|
} catch {
|
|
32170
32200
|
}
|
|
32171
|
-
const mcpPath =
|
|
32201
|
+
const mcpPath = join12(templateDir, "mcp", "mcp.json");
|
|
32172
32202
|
try {
|
|
32173
32203
|
const mcpRaw = await readFile17(mcpPath, "utf-8");
|
|
32174
32204
|
const mcpServers = validateMcpConfig(JSON.parse(mcpRaw));
|
|
@@ -32212,7 +32242,7 @@ async function listAllFilesRecursive(dir, baseDir = dir) {
|
|
|
32212
32242
|
try {
|
|
32213
32243
|
const entries = await readdir4(dir, { withFileTypes: true });
|
|
32214
32244
|
for (const entry of entries) {
|
|
32215
|
-
const full =
|
|
32245
|
+
const full = join12(dir, entry.name);
|
|
32216
32246
|
if (entry.isDirectory()) {
|
|
32217
32247
|
const subFiles = await listAllFilesRecursive(full, baseDir);
|
|
32218
32248
|
files.push(...subFiles);
|
|
@@ -32240,7 +32270,7 @@ var init_template_contract = __esm({
|
|
|
32240
32270
|
|
|
32241
32271
|
// packages/core/src/plugin/plugin-delivery.ts
|
|
32242
32272
|
import { readFile as readFile18, stat as stat4, readdir as readdir5 } from "node:fs/promises";
|
|
32243
|
-
import { join as
|
|
32273
|
+
import { join as join13, resolve as resolve8 } from "node:path";
|
|
32244
32274
|
import { createHash as createHash8 } from "node:crypto";
|
|
32245
32275
|
function isPluginTargetSupported(target) {
|
|
32246
32276
|
return target in PLUGIN_SUPPORT_MATRIX;
|
|
@@ -32294,7 +32324,7 @@ async function validatePlugin(request) {
|
|
|
32294
32324
|
return diagnostics;
|
|
32295
32325
|
}
|
|
32296
32326
|
const entryFile = getPluginEntryFile(plugin.target);
|
|
32297
|
-
const entryPath =
|
|
32327
|
+
const entryPath = join13(pluginPath, entryFile);
|
|
32298
32328
|
try {
|
|
32299
32329
|
await stat4(entryPath);
|
|
32300
32330
|
} catch {
|
|
@@ -32555,7 +32585,7 @@ function getHostVersionCommand(target) {
|
|
|
32555
32585
|
}
|
|
32556
32586
|
async function readNativePluginMeta(pluginDir, target) {
|
|
32557
32587
|
const entryFile = getPluginEntryFile(target);
|
|
32558
|
-
const entryPath =
|
|
32588
|
+
const entryPath = join13(pluginDir, entryFile);
|
|
32559
32589
|
try {
|
|
32560
32590
|
const raw = await readFile18(entryPath, "utf-8");
|
|
32561
32591
|
const parsed = JSON.parse(raw);
|
|
@@ -32599,7 +32629,7 @@ async function collectDirectoryCopyIntents(sourceDir, sourceRelPath, destDir, pa
|
|
|
32599
32629
|
const intents = [];
|
|
32600
32630
|
const entries = await readdir5(sourceDir, { withFileTypes: true });
|
|
32601
32631
|
for (const entry of entries) {
|
|
32602
|
-
const entrySourcePath =
|
|
32632
|
+
const entrySourcePath = join13(sourceDir, entry.name);
|
|
32603
32633
|
const entryDestPath = `${destDir}/${entry.name}`;
|
|
32604
32634
|
if (!isPathInside(packageRoot, entrySourcePath)) {
|
|
32605
32635
|
continue;
|
|
@@ -32607,7 +32637,7 @@ async function collectDirectoryCopyIntents(sourceDir, sourceRelPath, destDir, pa
|
|
|
32607
32637
|
if (entry.isDirectory()) {
|
|
32608
32638
|
const subIntents = await collectDirectoryCopyIntents(
|
|
32609
32639
|
entrySourcePath,
|
|
32610
|
-
|
|
32640
|
+
join13(sourceRelPath, entry.name),
|
|
32611
32641
|
entryDestPath,
|
|
32612
32642
|
packageRoot,
|
|
32613
32643
|
metadata
|
|
@@ -32717,7 +32747,7 @@ var init_plugin = __esm({
|
|
|
32717
32747
|
// packages/core/src/journal.ts
|
|
32718
32748
|
import { createHash as createHash9, randomUUID as randomUUID3 } from "node:crypto";
|
|
32719
32749
|
import { chmod as chmod2, cp, mkdir as mkdir11, open as open3, readdir as readdir6, readFile as readFile19, rename as rename5, rm as rm4, stat as stat5, writeFile as writeFile7 } from "node:fs/promises";
|
|
32720
|
-
import { dirname as dirname11, join as
|
|
32750
|
+
import { dirname as dirname11, join as join14, resolve as resolve9 } from "node:path";
|
|
32721
32751
|
function projectHash(projectRoot) {
|
|
32722
32752
|
return createHash9("sha256").update(resolve9(projectRoot)).digest("hex").slice(0, 32);
|
|
32723
32753
|
}
|
|
@@ -32728,15 +32758,15 @@ function isUuid(value) {
|
|
|
32728
32758
|
return typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
|
|
32729
32759
|
}
|
|
32730
32760
|
function transactionPathOf(userDataDir, projectRoot, operationId) {
|
|
32731
|
-
return
|
|
32761
|
+
return join14(resolve9(userDataDir), "transactions", projectHash(projectRoot), operationId);
|
|
32732
32762
|
}
|
|
32733
32763
|
function pathsFor(userDataDir, projectRoot, operationId) {
|
|
32734
32764
|
const directory = transactionPathOf(userDataDir, projectRoot, operationId);
|
|
32735
32765
|
return {
|
|
32736
|
-
journalPath:
|
|
32766
|
+
journalPath: join14(directory, "journal.json"),
|
|
32737
32767
|
transactionPath: directory,
|
|
32738
|
-
backupPath:
|
|
32739
|
-
recoveryPath:
|
|
32768
|
+
backupPath: join14(directory, "backup"),
|
|
32769
|
+
recoveryPath: join14(directory, "recovery.json")
|
|
32740
32770
|
};
|
|
32741
32771
|
}
|
|
32742
32772
|
function documentOf(journal) {
|
|
@@ -32861,7 +32891,7 @@ async function updateJournal(journal, state) {
|
|
|
32861
32891
|
return updated;
|
|
32862
32892
|
}
|
|
32863
32893
|
async function scanJournals(userDataDir, projectRoot) {
|
|
32864
|
-
const directory =
|
|
32894
|
+
const directory = join14(resolve9(userDataDir), "transactions", projectHash(projectRoot));
|
|
32865
32895
|
let entries;
|
|
32866
32896
|
try {
|
|
32867
32897
|
entries = await readdir6(directory, { withFileTypes: true });
|
|
@@ -32872,7 +32902,7 @@ async function scanJournals(userDataDir, projectRoot) {
|
|
|
32872
32902
|
const journals = [];
|
|
32873
32903
|
for (const entry of entries) {
|
|
32874
32904
|
if (!entry.isDirectory() || !isUuid(entry.name)) continue;
|
|
32875
|
-
const path2 =
|
|
32905
|
+
const path2 = join14(directory, entry.name, "journal.json");
|
|
32876
32906
|
try {
|
|
32877
32907
|
journals.push(await readJournal(path2, userDataDir, projectRoot));
|
|
32878
32908
|
} catch (error) {
|
|
@@ -32910,12 +32940,12 @@ async function prepareRecoverySnapshots(journal, scope, root, paths) {
|
|
|
32910
32940
|
try {
|
|
32911
32941
|
const info = await stat5(absolutePath);
|
|
32912
32942
|
if (info.isDirectory()) {
|
|
32913
|
-
await cp(absolutePath,
|
|
32943
|
+
await cp(absolutePath, join14(journal.backupPath, backupName), { recursive: true, force: false });
|
|
32914
32944
|
snapshots.push({ scope, path: path2, existed: true, backup: backupName, kind: "directory", mode: info.mode & 4095 });
|
|
32915
32945
|
continue;
|
|
32916
32946
|
}
|
|
32917
32947
|
if (!info.isFile()) throw new JournalError(`Recovery \u76EE\u6807\u4E0D\u662F\u6587\u4EF6\u6216\u76EE\u5F55: ${path2}`, "JOURNAL_INVALID");
|
|
32918
|
-
await writeFile7(
|
|
32948
|
+
await writeFile7(join14(journal.backupPath, backupName), await readFile19(absolutePath));
|
|
32919
32949
|
snapshots.push({ scope, path: path2, existed: true, backup: backupName, mode: info.mode & 4095, kind: "file" });
|
|
32920
32950
|
} catch (error) {
|
|
32921
32951
|
if (error.code === "ENOENT") {
|
|
@@ -32941,12 +32971,12 @@ async function restoreRecovery(journal, projectRoot, recovery) {
|
|
|
32941
32971
|
}
|
|
32942
32972
|
if (snapshot2.kind === "directory") {
|
|
32943
32973
|
await rm4(absolutePath, { recursive: true, force: true });
|
|
32944
|
-
await cp(
|
|
32974
|
+
await cp(join14(journal.backupPath, snapshot2.backup), absolutePath, { recursive: true, force: false });
|
|
32945
32975
|
if (snapshot2.mode !== void 0 && process.platform !== "win32") await chmod2(absolutePath, snapshot2.mode);
|
|
32946
32976
|
continue;
|
|
32947
32977
|
}
|
|
32948
32978
|
await mkdir11(dirname11(absolutePath), { recursive: true });
|
|
32949
|
-
await writeFile7(absolutePath, await readFile19(
|
|
32979
|
+
await writeFile7(absolutePath, await readFile19(join14(journal.backupPath, snapshot2.backup)));
|
|
32950
32980
|
if (snapshot2.mode !== void 0 && process.platform !== "win32") await chmod2(absolutePath, snapshot2.mode);
|
|
32951
32981
|
}
|
|
32952
32982
|
}
|
|
@@ -33551,6 +33581,7 @@ __export(src_exports, {
|
|
|
33551
33581
|
resolveAdapter: () => resolveAdapter,
|
|
33552
33582
|
resolveCanonicalSchemaPath: () => resolveCanonicalSchemaPath3,
|
|
33553
33583
|
resolveLauncher: () => resolveLauncher,
|
|
33584
|
+
resolveTaskExecutable: () => resolveTaskExecutable,
|
|
33554
33585
|
sanitizeCommand: () => sanitizeCommand,
|
|
33555
33586
|
sanitizeEnvValue: () => sanitizeEnvValue,
|
|
33556
33587
|
sanitizeUrl: () => sanitizeUrl,
|
|
@@ -36697,7 +36728,7 @@ var init_shared_options = __esm({
|
|
|
36697
36728
|
// packages/cli/src/commands/extension-dev.ts
|
|
36698
36729
|
import { mkdtemp as mkdtemp4, readFile as readFile21 } from "node:fs/promises";
|
|
36699
36730
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
36700
|
-
import { join as
|
|
36731
|
+
import { join as join15, resolve as resolvePath9, relative as relative5, isAbsolute as isAbsolute5, sep as sep3 } from "node:path";
|
|
36701
36732
|
function createExtensionDevCommand() {
|
|
36702
36733
|
const cmd = new Command("dev");
|
|
36703
36734
|
cmd.description(t("extension.dev.description")).argument("[package-directory]", t("extension.dev.argPackageDirectory"), ".").requiredOption("--project <fixture-directory>", t("extension.dev.optionProject")).option("--operation <create|apply|sync|remove>", t("extension.dev.optionOperation"), "apply").option("--target <id>", t("mutation.target"), collectString2, []).option("--set <name=value>", t("mutation.set"), collectString2, []).option("--dry-run", t("mutation.dryRun")).option("--yes", t("mutation.yes")).option("--allow <permission>", t("mutation.allow"), collectString2, []).option("--watch", t("extension.dev.optionWatch")).action(async (packageDirectory, opts) => {
|
|
@@ -36751,7 +36782,7 @@ async function executeExtensionDev(packageDirectory, options) {
|
|
|
36751
36782
|
return ExitCode.SchemaInvalid;
|
|
36752
36783
|
}
|
|
36753
36784
|
const effectiveDryRun = options.dryRun || options.watch;
|
|
36754
|
-
const isolatedUserData = await mkdtemp4(
|
|
36785
|
+
const isolatedUserData = await mkdtemp4(join15(tmpdir4(), "aicoding-dev-userdata-"));
|
|
36755
36786
|
const prevUserData = process.env["AICODING_USER_DATA"];
|
|
36756
36787
|
process.env["AICODING_USER_DATA"] = isolatedUserData;
|
|
36757
36788
|
try {
|
|
@@ -36992,7 +37023,7 @@ var init_extension_test = __esm({
|
|
|
36992
37023
|
|
|
36993
37024
|
// packages/cli/src/commands/extension-pack.ts
|
|
36994
37025
|
import { readFile as readFile23, mkdir as mkdir14 } from "node:fs/promises";
|
|
36995
|
-
import { resolve as resolve13, join as
|
|
37026
|
+
import { resolve as resolve13, join as join16, dirname as dirname13 } from "node:path";
|
|
36996
37027
|
import { execFile as execFile5 } from "node:child_process";
|
|
36997
37028
|
import { promisify as promisify5 } from "node:util";
|
|
36998
37029
|
import { createHash as createHash10 } from "node:crypto";
|
|
@@ -37145,7 +37176,7 @@ async function executeExtensionPack(packageDirectory, options, cliVersion) {
|
|
|
37145
37176
|
let tarballName;
|
|
37146
37177
|
let tarballPath;
|
|
37147
37178
|
tarballName = `${pkgName.replace(/^@/, "").replace(/\//g, "-")}-${pkgVersion}.tgz`;
|
|
37148
|
-
tarballPath =
|
|
37179
|
+
tarballPath = join16(outputDir, tarballName);
|
|
37149
37180
|
try {
|
|
37150
37181
|
await packWithNpm(pkgDir, outputDir);
|
|
37151
37182
|
} catch (err) {
|
|
@@ -37912,7 +37943,7 @@ var init_journal_helper = __esm({
|
|
|
37912
37943
|
|
|
37913
37944
|
// packages/cli/src/commands/service-locator.ts
|
|
37914
37945
|
import { homedir as homedir2 } from "node:os";
|
|
37915
|
-
import { join as
|
|
37946
|
+
import { join as join17, resolve as resolve16 } from "node:path";
|
|
37916
37947
|
var ServiceLocator;
|
|
37917
37948
|
var init_service_locator = __esm({
|
|
37918
37949
|
"packages/cli/src/commands/service-locator.ts"() {
|
|
@@ -37946,13 +37977,13 @@ var init_service_locator = __esm({
|
|
|
37946
37977
|
return `mano-coding@${this.config.cliVersion}`;
|
|
37947
37978
|
}
|
|
37948
37979
|
getUserDataDir() {
|
|
37949
|
-
return this.config.userDataDir ?? process.env["MANO_USER_DATA"] ?? process.env["AICODING_USER_DATA"] ??
|
|
37980
|
+
return this.config.userDataDir ?? process.env["MANO_USER_DATA"] ?? process.env["AICODING_USER_DATA"] ?? join17(homedir2(), ".mano-coding");
|
|
37950
37981
|
}
|
|
37951
37982
|
getRegistryUrl() {
|
|
37952
37983
|
return this.config.registryUrl || process.env["MANO_REGISTRY"] || process.env["AICODING_REGISTRY"] || DEFAULT_PUBLIC_REGISTRY_URL;
|
|
37953
37984
|
}
|
|
37954
37985
|
getCacheRoot() {
|
|
37955
|
-
return this.config.cacheRoot ??
|
|
37986
|
+
return this.config.cacheRoot ?? join17(this.getUserDataDir(), "cache");
|
|
37956
37987
|
}
|
|
37957
37988
|
getRegistryClient() {
|
|
37958
37989
|
if (!this._registryClient) {
|
|
@@ -38132,7 +38163,7 @@ var init_service_locator = __esm({
|
|
|
38132
38163
|
|
|
38133
38164
|
// packages/cli/src/commands/plan-execution.ts
|
|
38134
38165
|
import { mkdir as mkdir16, readFile as readFile26, readdir as readdir8, stat as stat6 } from "node:fs/promises";
|
|
38135
|
-
import { join as
|
|
38166
|
+
import { join as join18, relative as relative6, resolve as resolve17 } from "node:path";
|
|
38136
38167
|
import { createHash as createHash12 } from "node:crypto";
|
|
38137
38168
|
async function buildIntentsFromPlan(_plan, resolutions, service, projectTargets, userInstallationKeys) {
|
|
38138
38169
|
const adapterRegistry = service.getAdapterRegistry();
|
|
@@ -38434,7 +38465,7 @@ async function collectAssetIntents(packageRoot, source, destination, metadata) {
|
|
|
38434
38465
|
if (!sourceStat.isDirectory()) throw new Error(`Asset '${source}' \u65E2\u4E0D\u662F\u6587\u4EF6\u4E5F\u4E0D\u662F\u76EE\u5F55`);
|
|
38435
38466
|
const intents = [];
|
|
38436
38467
|
for (const entry of await readdir8(sourcePath, { withFileTypes: true })) {
|
|
38437
|
-
intents.push(...await collectAssetIntents(packageRoot,
|
|
38468
|
+
intents.push(...await collectAssetIntents(packageRoot, join18(source, entry.name), join18(destination, entry.name).replaceAll("\\", "/"), metadata));
|
|
38438
38469
|
}
|
|
38439
38470
|
return intents;
|
|
38440
38471
|
}
|
|
@@ -41237,7 +41268,7 @@ var init_upgrade = __esm({
|
|
|
41237
41268
|
|
|
41238
41269
|
// packages/cli/src/commands/cache.ts
|
|
41239
41270
|
import { homedir as homedir3 } from "node:os";
|
|
41240
|
-
import { join as
|
|
41271
|
+
import { join as join19, resolve as resolve20 } from "node:path";
|
|
41241
41272
|
import { rm as rm5, stat as stat7 } from "node:fs/promises";
|
|
41242
41273
|
function createCacheCommand(cliVersion) {
|
|
41243
41274
|
const cmd = new Command("cache");
|
|
@@ -41279,7 +41310,7 @@ function createCacheCommand(cliVersion) {
|
|
|
41279
41310
|
return cmd;
|
|
41280
41311
|
}
|
|
41281
41312
|
function getUserDataDir() {
|
|
41282
|
-
return process.env["AICODING_USER_DATA"] ??
|
|
41313
|
+
return process.env["AICODING_USER_DATA"] ?? join19(homedir3(), ".aicoding");
|
|
41283
41314
|
}
|
|
41284
41315
|
function parsePositiveInt(value, name) {
|
|
41285
41316
|
if (value === void 0) return void 0;
|
|
@@ -41481,7 +41512,7 @@ async function executeClean(opts, cliVersion) {
|
|
|
41481
41512
|
throw new CliError(t("cache.cleanRequiresYes"), ExitCode.NeedsInputOrDenied, "NEEDS_CONFIRMATION");
|
|
41482
41513
|
}
|
|
41483
41514
|
if (cleanRegistry && !dryRun) await updateCache.clear();
|
|
41484
|
-
if (cleanAudit && !dryRun) await rm5(
|
|
41515
|
+
if (cleanAudit && !dryRun) await rm5(join19(userDataDir, "audit"), { recursive: true, force: true });
|
|
41485
41516
|
if (json) {
|
|
41486
41517
|
emitSuccessJson("cache clean", { dryRun, cleanedLeases: 0, clearedUpdateCache: cleanRegistry, clearedAudit: cleanAudit, message: t("cache.noInstallationsClean") });
|
|
41487
41518
|
} else {
|
|
@@ -41496,7 +41527,7 @@ async function executeClean(opts, cliVersion) {
|
|
|
41496
41527
|
throw new CliError(t("cache.cleanRequiresYes"), ExitCode.NeedsInputOrDenied, "NEEDS_CONFIRMATION");
|
|
41497
41528
|
}
|
|
41498
41529
|
if (cleanRegistry && !dryRun) await updateCache.clear();
|
|
41499
|
-
if (cleanAudit && !dryRun) await rm5(
|
|
41530
|
+
if (cleanAudit && !dryRun) await rm5(join19(userDataDir, "audit"), { recursive: true, force: true });
|
|
41500
41531
|
if (json) {
|
|
41501
41532
|
emitSuccessJson("cache clean", { dryRun, cleanedLeases: 0, clearedUpdateCache: cleanRegistry, clearedAudit: cleanAudit, message: t("cache.noInstallationsClean") });
|
|
41502
41533
|
} else {
|
|
@@ -41541,7 +41572,7 @@ async function executeClean(opts, cliVersion) {
|
|
|
41541
41572
|
totalCleaned += cleaned;
|
|
41542
41573
|
}
|
|
41543
41574
|
if (cleanRegistry) await updateCache.clear();
|
|
41544
|
-
if (cleanAudit) await rm5(
|
|
41575
|
+
if (cleanAudit) await rm5(join19(userDataDir, "audit"), { recursive: true, force: true });
|
|
41545
41576
|
if (json) {
|
|
41546
41577
|
emitSuccessJson("cache clean", { dryRun: false, cleanedLeases: totalCleaned, clearedUpdateCache: cleanRegistry, clearedAudit: cleanAudit });
|
|
41547
41578
|
} else {
|
|
@@ -41563,7 +41594,7 @@ var init_cache = __esm({
|
|
|
41563
41594
|
// packages/cli/src/commands/launch.ts
|
|
41564
41595
|
import { spawn as spawn2 } from "node:child_process";
|
|
41565
41596
|
import { homedir as homedir4 } from "node:os";
|
|
41566
|
-
import { join as
|
|
41597
|
+
import { join as join20 } from "node:path";
|
|
41567
41598
|
function createLaunchCommand() {
|
|
41568
41599
|
const cmd = new Command("_launch");
|
|
41569
41600
|
cmd.description(t("launch.description")).option("--kind <kind>", t("launch.optionKind")).option("--package <package-id>", t("launch.optionPackage")).option("--id <id>", t("launch.optionId")).option("--version <version>", t("launch.optionVersion")).option("--command <name>", t("launch.optionCommand")).allowUnknownOption(true).allowExcessArguments(true).action(async (_opts, command) => {
|
|
@@ -41596,7 +41627,7 @@ function createLaunchCommand() {
|
|
|
41596
41627
|
return cmd;
|
|
41597
41628
|
}
|
|
41598
41629
|
function getUserDataDir2() {
|
|
41599
|
-
return process.env["AICODING_USER_DATA"] ??
|
|
41630
|
+
return process.env["AICODING_USER_DATA"] ?? join20(homedir4(), ".aicoding");
|
|
41600
41631
|
}
|
|
41601
41632
|
async function executeLaunch(launcherArgs) {
|
|
41602
41633
|
const userDataDir = getUserDataDir2();
|
|
@@ -41644,7 +41675,7 @@ var init_launch = __esm({
|
|
|
41644
41675
|
import { spawn as spawn3 } from "node:child_process";
|
|
41645
41676
|
import { readFile as readFile28, realpath as realpath2 } from "node:fs/promises";
|
|
41646
41677
|
import { homedir as homedir5 } from "node:os";
|
|
41647
|
-
import { extname, join as
|
|
41678
|
+
import { extname, join as join21, resolve as resolve21 } from "node:path";
|
|
41648
41679
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
41649
41680
|
import { stdin, stderr } from "node:process";
|
|
41650
41681
|
function createSelfUpgradeCommand(cliVersion) {
|
|
@@ -41706,7 +41737,7 @@ async function executeSelfUpgrade(options, cliVersion) {
|
|
|
41706
41737
|
});
|
|
41707
41738
|
await auditLog.prune().catch(() => void 0);
|
|
41708
41739
|
try {
|
|
41709
|
-
const result = await withStateLock(
|
|
41740
|
+
const result = await withStateLock(join21(userDataDir, "cli-update"), async () => {
|
|
41710
41741
|
const target = await resolveTarget(options, cacheRepository, registry);
|
|
41711
41742
|
ensureTargetAllowed(target.version, installation.currentVersion, options.allowDowngrade);
|
|
41712
41743
|
if (!isCliVersionCompatible(process.version, target.enginesNode)) {
|
|
@@ -41758,7 +41789,7 @@ function validateOptions(options) {
|
|
|
41758
41789
|
}
|
|
41759
41790
|
}
|
|
41760
41791
|
function getUserDataDir3() {
|
|
41761
|
-
return process.env["AICODING_USER_DATA"] ??
|
|
41792
|
+
return process.env["AICODING_USER_DATA"] ?? join21(homedir5(), ".aicoding");
|
|
41762
41793
|
}
|
|
41763
41794
|
function getRegistryUrl() {
|
|
41764
41795
|
const raw = process.env["AICODING_NPM_REGISTRY"] || DEFAULT_NPM_REGISTRY;
|
|
@@ -41877,7 +41908,7 @@ async function isWindowsCmdShimFor(shimPath, expectedBin) {
|
|
|
41877
41908
|
}
|
|
41878
41909
|
async function readPackageJson(root) {
|
|
41879
41910
|
try {
|
|
41880
|
-
const value = JSON.parse(await readFile28(
|
|
41911
|
+
const value = JSON.parse(await readFile28(join21(root, "package.json"), "utf8"));
|
|
41881
41912
|
if (!value || typeof value !== "object") return void 0;
|
|
41882
41913
|
const item = value;
|
|
41883
41914
|
return typeof item["name"] === "string" && typeof item["version"] === "string" ? { name: item["name"], version: item["version"], bin: item["bin"] } : void 0;
|
|
@@ -41942,11 +41973,11 @@ var init_self_upgrade = __esm({
|
|
|
41942
41973
|
|
|
41943
41974
|
// packages/cli/src/commands/update-notice.ts
|
|
41944
41975
|
import { homedir as homedir6 } from "node:os";
|
|
41945
|
-
import { join as
|
|
41976
|
+
import { join as join22 } from "node:path";
|
|
41946
41977
|
async function getCachedUpdateNotice(argv, currentVersion) {
|
|
41947
41978
|
const json = argv.includes("--json");
|
|
41948
41979
|
const disabled = argv.includes("--offline") || argv[2] === "self-upgrade" || Boolean(process.env["AICODING_NO_UPDATE_CHECK"]) || Boolean(process.env["CI"]);
|
|
41949
|
-
const repository = new CliUpdateCacheRepository(process.env["AICODING_USER_DATA"] ??
|
|
41980
|
+
const repository = new CliUpdateCacheRepository(process.env["AICODING_USER_DATA"] ?? join22(homedir6(), ".aicoding"));
|
|
41950
41981
|
if (disabled || !json && !process.stdout.isTTY) return { json, markNotified: async () => void 0 };
|
|
41951
41982
|
const cache = await repository.read();
|
|
41952
41983
|
const notifiedAt = cache?.lastNotifiedAt ? Date.parse(cache.lastNotifiedAt) : Number.NaN;
|
|
@@ -41978,7 +42009,7 @@ import { createRequire as createRequire2 } from "node:module";
|
|
|
41978
42009
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
41979
42010
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
41980
42011
|
function resolveVersion() {
|
|
41981
|
-
if (true) return "0.1.
|
|
42012
|
+
if (true) return "0.1.20";
|
|
41982
42013
|
const candidates = [
|
|
41983
42014
|
new URL("../package.json", import.meta.url),
|
|
41984
42015
|
new URL("../../package.json", import.meta.url),
|