@lousy-agents/cli 2.3.3 → 2.4.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/index.js +309 -39
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.js +302 -10
- package/dist/mcp-server.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -9798,7 +9798,6 @@ __webpack_require__.d(classic_schemas_namespaceObject, {
|
|
|
9798
9798
|
|
|
9799
9799
|
|
|
9800
9800
|
;// CONCATENATED MODULE: ./node_modules/citty/dist/_chunks/libs/scule.mjs
|
|
9801
|
-
//#region node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs
|
|
9802
9801
|
const NUMBER_CHAR_RE = /\d/;
|
|
9803
9802
|
const STR_SPLITTERS = [
|
|
9804
9803
|
"-",
|
|
@@ -9864,15 +9863,12 @@ function kebabCase(str, joiner) {
|
|
|
9864
9863
|
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
|
|
9865
9864
|
}
|
|
9866
9865
|
|
|
9867
|
-
//#endregion
|
|
9868
9866
|
|
|
9869
9867
|
// EXTERNAL MODULE: external "node:util"
|
|
9870
9868
|
var external_node_util_ = __webpack_require__(7975);
|
|
9871
9869
|
;// CONCATENATED MODULE: ./node_modules/citty/dist/index.mjs
|
|
9872
9870
|
|
|
9873
9871
|
|
|
9874
|
-
|
|
9875
|
-
//#region src/_utils.ts
|
|
9876
9872
|
function toArray(val) {
|
|
9877
9873
|
if (Array.isArray(val)) return val;
|
|
9878
9874
|
return val === void 0 ? [] : [val];
|
|
@@ -9893,9 +9889,6 @@ var CLIError = class extends Error {
|
|
|
9893
9889
|
this.code = code;
|
|
9894
9890
|
}
|
|
9895
9891
|
};
|
|
9896
|
-
|
|
9897
|
-
//#endregion
|
|
9898
|
-
//#region src/_parser.ts
|
|
9899
9892
|
function parseRawArgs(args = [], opts = {}) {
|
|
9900
9893
|
const booleans = new Set(opts.boolean || []);
|
|
9901
9894
|
const strings = new Set(opts.string || []);
|
|
@@ -9965,16 +9958,19 @@ function parseRawArgs(args = [], opts = {}) {
|
|
|
9965
9958
|
const out = { _: [] };
|
|
9966
9959
|
out._ = parsed.positionals;
|
|
9967
9960
|
for (const [key, value] of Object.entries(parsed.values)) out[key] = value;
|
|
9968
|
-
for (const [name] of Object.entries(negatedFlags))
|
|
9961
|
+
for (const [name] of Object.entries(negatedFlags)) {
|
|
9962
|
+
out[name] = false;
|
|
9963
|
+
const mainName = aliasToMain.get(name);
|
|
9964
|
+
if (mainName) out[mainName] = false;
|
|
9965
|
+
const aliases = mainToAliases.get(name);
|
|
9966
|
+
if (aliases) for (const alias of aliases) out[alias] = false;
|
|
9967
|
+
}
|
|
9969
9968
|
for (const [alias, main] of aliasToMain.entries()) {
|
|
9970
9969
|
if (out[alias] !== void 0 && out[main] === void 0) out[main] = out[alias];
|
|
9971
9970
|
if (out[main] !== void 0 && out[alias] === void 0) out[alias] = out[main];
|
|
9972
9971
|
}
|
|
9973
9972
|
return out;
|
|
9974
9973
|
}
|
|
9975
|
-
|
|
9976
|
-
//#endregion
|
|
9977
|
-
//#region src/_color.ts
|
|
9978
9974
|
const noColor = /* @__PURE__ */ (() => {
|
|
9979
9975
|
const env = globalThis.process?.env ?? {};
|
|
9980
9976
|
return env.NO_COLOR === "1" || env.TERM === "dumb" || env.TEST || env.CI;
|
|
@@ -9984,9 +9980,6 @@ const bold = /* @__PURE__ */ _c(1, 22);
|
|
|
9984
9980
|
const cyan = /* @__PURE__ */ _c(36);
|
|
9985
9981
|
const gray = /* @__PURE__ */ _c(90);
|
|
9986
9982
|
const underline = /* @__PURE__ */ _c(4, 24);
|
|
9987
|
-
|
|
9988
|
-
//#endregion
|
|
9989
|
-
//#region src/args.ts
|
|
9990
9983
|
function parseArgs(rawArgs, argsDef) {
|
|
9991
9984
|
const parseOptions = {
|
|
9992
9985
|
boolean: [],
|
|
@@ -10036,9 +10029,6 @@ function resolveArgs(argsDef) {
|
|
|
10036
10029
|
});
|
|
10037
10030
|
return args;
|
|
10038
10031
|
}
|
|
10039
|
-
|
|
10040
|
-
//#endregion
|
|
10041
|
-
//#region src/command.ts
|
|
10042
10032
|
function defineCommand(def) {
|
|
10043
10033
|
return def;
|
|
10044
10034
|
}
|
|
@@ -10080,9 +10070,6 @@ async function resolveSubCommand(cmd, rawArgs, parent) {
|
|
|
10080
10070
|
}
|
|
10081
10071
|
return [cmd, parent];
|
|
10082
10072
|
}
|
|
10083
|
-
|
|
10084
|
-
//#endregion
|
|
10085
|
-
//#region src/usage.ts
|
|
10086
10073
|
async function showUsage(cmd, parent) {
|
|
10087
10074
|
try {
|
|
10088
10075
|
console.log(await renderUsage(cmd, parent) + "\n");
|
|
@@ -10114,11 +10101,6 @@ async function renderUsage(cmd, parent) {
|
|
|
10114
10101
|
const isRequired = arg.required === true && arg.default === void 0;
|
|
10115
10102
|
const argStr = [...(arg.alias || []).map((a) => `-${a}`), `--${arg.name}`].join(", ") + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "") + (arg.type === "enum" && arg.options ? `=<${arg.options.join("|")}>` : "");
|
|
10116
10103
|
argLines.push([cyan(argStr + (isRequired ? " (required)" : "")), arg.description || ""]);
|
|
10117
|
-
/**
|
|
10118
|
-
* print negative boolean arg variant usage when
|
|
10119
|
-
* - enabled by default or has `negativeDescription`
|
|
10120
|
-
* - not prefixed with `no-` or `no[A-Z]`
|
|
10121
|
-
*/
|
|
10122
10104
|
if (arg.type === "boolean" && (arg.default === true || arg.negativeDescription) && !negativePrefixRe.test(arg.name)) {
|
|
10123
10105
|
const negativeArgStr = [...(arg.alias || []).map((a) => `--no-${a}`), `--no-${arg.name}`].join(", ");
|
|
10124
10106
|
argLines.push([cyan(negativeArgStr + (isRequired ? " (required)" : "")), arg.negativeDescription || ""]);
|
|
@@ -10158,9 +10140,6 @@ async function renderUsage(cmd, parent) {
|
|
|
10158
10140
|
}
|
|
10159
10141
|
return usageLines.filter((l) => typeof l === "string").join("\n");
|
|
10160
10142
|
}
|
|
10161
|
-
|
|
10162
|
-
//#endregion
|
|
10163
|
-
//#region src/main.ts
|
|
10164
10143
|
async function runMain(cmd, opts = {}) {
|
|
10165
10144
|
const rawArgs = opts.rawArgs || process.argv.slice(2);
|
|
10166
10145
|
const showUsage$1 = opts.showUsage || showUsage;
|
|
@@ -10185,7 +10164,6 @@ function createMain(cmd) {
|
|
|
10185
10164
|
return (opts = {}) => runMain(cmd, opts);
|
|
10186
10165
|
}
|
|
10187
10166
|
|
|
10188
|
-
//#endregion
|
|
10189
10167
|
|
|
10190
10168
|
// EXTERNAL MODULE: external "node:fs/promises"
|
|
10191
10169
|
var promises_ = __webpack_require__(1455);
|
|
@@ -11821,6 +11799,27 @@ const consola = dist_createConsola();
|
|
|
11821
11799
|
return new FileSystemAgentFileGateway();
|
|
11822
11800
|
}
|
|
11823
11801
|
|
|
11802
|
+
;// CONCATENATED MODULE: ./src/entities/copilot-setup.ts
|
|
11803
|
+
/**
|
|
11804
|
+
* Core domain entities for the Copilot Setup Steps feature.
|
|
11805
|
+
* These are the fundamental types that represent the business domain.
|
|
11806
|
+
*/ /**
|
|
11807
|
+
* Types of version files supported for detection
|
|
11808
|
+
*/ /**
|
|
11809
|
+
* Node.js package manager types (in priority order: npm > yarn > pnpm)
|
|
11810
|
+
*/ const NODE_PACKAGE_MANAGERS = [
|
|
11811
|
+
"npm",
|
|
11812
|
+
"yarn",
|
|
11813
|
+
"pnpm"
|
|
11814
|
+
];
|
|
11815
|
+
/**
|
|
11816
|
+
* Python package manager types (in priority order)
|
|
11817
|
+
*/ const PYTHON_PACKAGE_MANAGERS = [
|
|
11818
|
+
"poetry",
|
|
11819
|
+
"pipenv",
|
|
11820
|
+
"pip"
|
|
11821
|
+
];
|
|
11822
|
+
|
|
11824
11823
|
// EXTERNAL MODULE: external "node:fs"
|
|
11825
11824
|
var external_node_fs_ = __webpack_require__(3024);
|
|
11826
11825
|
// EXTERNAL MODULE: ./node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
@@ -14108,12 +14107,102 @@ async function watchConfig(options) {
|
|
|
14108
14107
|
"actions/setup-ruby",
|
|
14109
14108
|
"jdx/mise-action"
|
|
14110
14109
|
];
|
|
14110
|
+
/**
|
|
14111
|
+
* Default package manager mappings
|
|
14112
|
+
* Based on Dependabot supported ecosystems
|
|
14113
|
+
*/ const DEFAULT_PACKAGE_MANAGERS = [
|
|
14114
|
+
// Node.js package managers
|
|
14115
|
+
{
|
|
14116
|
+
type: "npm",
|
|
14117
|
+
manifestFile: "package.json",
|
|
14118
|
+
lockfile: "package-lock.json",
|
|
14119
|
+
installCommand: "npm ci"
|
|
14120
|
+
},
|
|
14121
|
+
{
|
|
14122
|
+
type: "yarn",
|
|
14123
|
+
manifestFile: "package.json",
|
|
14124
|
+
lockfile: "yarn.lock",
|
|
14125
|
+
installCommand: "yarn install --frozen-lockfile"
|
|
14126
|
+
},
|
|
14127
|
+
{
|
|
14128
|
+
type: "pnpm",
|
|
14129
|
+
manifestFile: "package.json",
|
|
14130
|
+
lockfile: "pnpm-lock.yaml",
|
|
14131
|
+
installCommand: "pnpm install --frozen-lockfile"
|
|
14132
|
+
},
|
|
14133
|
+
// Python package managers
|
|
14134
|
+
{
|
|
14135
|
+
type: "pip",
|
|
14136
|
+
manifestFile: "requirements.txt",
|
|
14137
|
+
installCommand: "pip install -r requirements.txt"
|
|
14138
|
+
},
|
|
14139
|
+
{
|
|
14140
|
+
type: "pipenv",
|
|
14141
|
+
manifestFile: "Pipfile",
|
|
14142
|
+
lockfile: "Pipfile.lock",
|
|
14143
|
+
installCommand: "pipenv install --deploy"
|
|
14144
|
+
},
|
|
14145
|
+
{
|
|
14146
|
+
type: "poetry",
|
|
14147
|
+
manifestFile: "pyproject.toml",
|
|
14148
|
+
lockfile: "poetry.lock",
|
|
14149
|
+
requiresLockfile: true,
|
|
14150
|
+
installCommand: "poetry install --no-root"
|
|
14151
|
+
},
|
|
14152
|
+
// Ruby
|
|
14153
|
+
{
|
|
14154
|
+
type: "bundler",
|
|
14155
|
+
manifestFile: "Gemfile",
|
|
14156
|
+
lockfile: "Gemfile.lock",
|
|
14157
|
+
installCommand: "bundle install"
|
|
14158
|
+
},
|
|
14159
|
+
// Rust
|
|
14160
|
+
{
|
|
14161
|
+
type: "cargo",
|
|
14162
|
+
manifestFile: "Cargo.toml",
|
|
14163
|
+
lockfile: "Cargo.lock",
|
|
14164
|
+
installCommand: "cargo build"
|
|
14165
|
+
},
|
|
14166
|
+
// PHP
|
|
14167
|
+
{
|
|
14168
|
+
type: "composer",
|
|
14169
|
+
manifestFile: "composer.json",
|
|
14170
|
+
lockfile: "composer.lock",
|
|
14171
|
+
installCommand: "composer install"
|
|
14172
|
+
},
|
|
14173
|
+
// Java
|
|
14174
|
+
{
|
|
14175
|
+
type: "maven",
|
|
14176
|
+
manifestFile: "pom.xml",
|
|
14177
|
+
installCommand: "mvn install -DskipTests"
|
|
14178
|
+
},
|
|
14179
|
+
{
|
|
14180
|
+
type: "gradle",
|
|
14181
|
+
manifestFile: "build.gradle",
|
|
14182
|
+
installCommand: "gradle build -x test"
|
|
14183
|
+
},
|
|
14184
|
+
// Go
|
|
14185
|
+
{
|
|
14186
|
+
type: "gomod",
|
|
14187
|
+
manifestFile: "go.mod",
|
|
14188
|
+
lockfile: "go.sum",
|
|
14189
|
+
installCommand: "go mod download"
|
|
14190
|
+
},
|
|
14191
|
+
// Dart/Flutter
|
|
14192
|
+
{
|
|
14193
|
+
type: "pub",
|
|
14194
|
+
manifestFile: "pubspec.yaml",
|
|
14195
|
+
lockfile: "pubspec.lock",
|
|
14196
|
+
installCommand: "dart pub get"
|
|
14197
|
+
}
|
|
14198
|
+
];
|
|
14111
14199
|
/**
|
|
14112
14200
|
* Default copilot-setup configuration
|
|
14113
14201
|
*/ const DEFAULT_CONFIG = {
|
|
14114
14202
|
versionFiles: DEFAULT_VERSION_FILES,
|
|
14115
14203
|
setupActions: DEFAULT_SETUP_ACTIONS,
|
|
14116
|
-
setupActionPatterns: DEFAULT_SETUP_ACTION_PATTERNS
|
|
14204
|
+
setupActionPatterns: DEFAULT_SETUP_ACTION_PATTERNS,
|
|
14205
|
+
packageManagers: DEFAULT_PACKAGE_MANAGERS
|
|
14117
14206
|
};
|
|
14118
14207
|
/**
|
|
14119
14208
|
* Loads the copilot-setup configuration using c12
|
|
@@ -14172,6 +14261,7 @@ async function watchConfig(options) {
|
|
|
14172
14261
|
|
|
14173
14262
|
|
|
14174
14263
|
|
|
14264
|
+
|
|
14175
14265
|
/**
|
|
14176
14266
|
* Reads the content of a version file and trims whitespace
|
|
14177
14267
|
*/ async function readVersionFileContent(filePath) {
|
|
@@ -14189,9 +14279,21 @@ async function watchConfig(options) {
|
|
|
14189
14279
|
return this.config;
|
|
14190
14280
|
}
|
|
14191
14281
|
async detectEnvironment(targetDir) {
|
|
14192
|
-
const miseTomlPath = (0,external_node_path_.join)(targetDir, "mise.toml");
|
|
14193
|
-
const hasMise = await fileExists(miseTomlPath);
|
|
14194
14282
|
const config = await this.getConfig();
|
|
14283
|
+
const hasMise = await this.detectMise(targetDir);
|
|
14284
|
+
const versionFiles = await this.detectVersionFiles(targetDir, config);
|
|
14285
|
+
const packageManagers = await this.detectPackageManagers(targetDir, config);
|
|
14286
|
+
return {
|
|
14287
|
+
hasMise,
|
|
14288
|
+
versionFiles,
|
|
14289
|
+
packageManagers
|
|
14290
|
+
};
|
|
14291
|
+
}
|
|
14292
|
+
async detectMise(targetDir) {
|
|
14293
|
+
const miseTomlPath = (0,external_node_path_.join)(targetDir, "mise.toml");
|
|
14294
|
+
return fileExists(miseTomlPath);
|
|
14295
|
+
}
|
|
14296
|
+
async detectVersionFiles(targetDir, config) {
|
|
14195
14297
|
const filenameToType = getVersionFilenameToTypeMap(config);
|
|
14196
14298
|
const versionFiles = [];
|
|
14197
14299
|
for (const fileConfig of config.versionFiles){
|
|
@@ -14205,10 +14307,109 @@ async function watchConfig(options) {
|
|
|
14205
14307
|
});
|
|
14206
14308
|
}
|
|
14207
14309
|
}
|
|
14208
|
-
return
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
|
|
14310
|
+
return versionFiles;
|
|
14311
|
+
}
|
|
14312
|
+
async detectPackageManagers(targetDir, config) {
|
|
14313
|
+
const packageManagers = [];
|
|
14314
|
+
// Helper to check if a package manager type is in a list
|
|
14315
|
+
const isPackageManagerType = (pm, types)=>types.includes(pm.type);
|
|
14316
|
+
const nodePackageManagers = config.packageManagers.filter((pm)=>isPackageManagerType(pm, NODE_PACKAGE_MANAGERS));
|
|
14317
|
+
const pythonPackageManagers = config.packageManagers.filter((pm)=>isPackageManagerType(pm, PYTHON_PACKAGE_MANAGERS));
|
|
14318
|
+
const otherPackageManagers = config.packageManagers.filter((pm)=>!isPackageManagerType(pm, NODE_PACKAGE_MANAGERS) && !isPackageManagerType(pm, PYTHON_PACKAGE_MANAGERS));
|
|
14319
|
+
// Detect Node.js package manager (with prioritization)
|
|
14320
|
+
const nodePackageManager = await this.detectNodePackageManager(targetDir, nodePackageManagers);
|
|
14321
|
+
if (nodePackageManager) {
|
|
14322
|
+
packageManagers.push(nodePackageManager);
|
|
14323
|
+
}
|
|
14324
|
+
// Detect Python package manager (with prioritization)
|
|
14325
|
+
const pythonPackageManager = await this.detectPythonPackageManager(targetDir, pythonPackageManagers);
|
|
14326
|
+
if (pythonPackageManager) {
|
|
14327
|
+
packageManagers.push(pythonPackageManager);
|
|
14328
|
+
}
|
|
14329
|
+
// Detect other package managers
|
|
14330
|
+
const otherDetectedManagers = await this.detectOtherPackageManagers(targetDir, otherPackageManagers);
|
|
14331
|
+
packageManagers.push(...otherDetectedManagers);
|
|
14332
|
+
return packageManagers;
|
|
14333
|
+
}
|
|
14334
|
+
async detectNodePackageManager(targetDir, nodePackageManagers) {
|
|
14335
|
+
const packageJsonPath = (0,external_node_path_.join)(targetDir, "package.json");
|
|
14336
|
+
if (!await fileExists(packageJsonPath)) {
|
|
14337
|
+
return null;
|
|
14338
|
+
}
|
|
14339
|
+
// Priority order for Node.js package managers: npm > yarn > pnpm
|
|
14340
|
+
const lockfileOrder = [
|
|
14341
|
+
"npm",
|
|
14342
|
+
"yarn",
|
|
14343
|
+
"pnpm"
|
|
14344
|
+
];
|
|
14345
|
+
for (const pmType of lockfileOrder){
|
|
14346
|
+
const pmConfig = nodePackageManagers.find((pm)=>pm.type === pmType);
|
|
14347
|
+
if (!pmConfig?.lockfile) {
|
|
14348
|
+
continue;
|
|
14349
|
+
}
|
|
14350
|
+
const lockfilePath = (0,external_node_path_.join)(targetDir, pmConfig.lockfile);
|
|
14351
|
+
if (await fileExists(lockfilePath)) {
|
|
14352
|
+
return {
|
|
14353
|
+
type: pmConfig.type,
|
|
14354
|
+
filename: pmConfig.manifestFile,
|
|
14355
|
+
lockfile: pmConfig.lockfile
|
|
14356
|
+
};
|
|
14357
|
+
}
|
|
14358
|
+
}
|
|
14359
|
+
// Default to npm if no lockfile found
|
|
14360
|
+
const npmConfig = nodePackageManagers.find((pm)=>pm.type === "npm");
|
|
14361
|
+
if (npmConfig) {
|
|
14362
|
+
return {
|
|
14363
|
+
type: npmConfig.type,
|
|
14364
|
+
filename: npmConfig.manifestFile,
|
|
14365
|
+
lockfile: undefined
|
|
14366
|
+
};
|
|
14367
|
+
}
|
|
14368
|
+
return null;
|
|
14369
|
+
}
|
|
14370
|
+
async detectPythonPackageManager(targetDir, pythonPackageManagers) {
|
|
14371
|
+
// Priority order for Python package managers: poetry > pipenv > pip
|
|
14372
|
+
for (const pmType of PYTHON_PACKAGE_MANAGERS){
|
|
14373
|
+
const pmConfig = pythonPackageManagers.find((pm)=>pm.type === pmType);
|
|
14374
|
+
if (!pmConfig) {
|
|
14375
|
+
continue;
|
|
14376
|
+
}
|
|
14377
|
+
const manifestPath = (0,external_node_path_.join)(targetDir, pmConfig.manifestFile);
|
|
14378
|
+
if (await fileExists(manifestPath)) {
|
|
14379
|
+
const lockfilePath = pmConfig.lockfile ? (0,external_node_path_.join)(targetDir, pmConfig.lockfile) : undefined;
|
|
14380
|
+
const hasLockfile = lockfilePath ? await fileExists(lockfilePath) : false;
|
|
14381
|
+
// Skip if lockfile is required but not present
|
|
14382
|
+
if (pmConfig.requiresLockfile && !hasLockfile) {
|
|
14383
|
+
continue;
|
|
14384
|
+
}
|
|
14385
|
+
return {
|
|
14386
|
+
type: pmConfig.type,
|
|
14387
|
+
filename: pmConfig.manifestFile,
|
|
14388
|
+
lockfile: hasLockfile ? pmConfig.lockfile : undefined
|
|
14389
|
+
};
|
|
14390
|
+
}
|
|
14391
|
+
}
|
|
14392
|
+
return null;
|
|
14393
|
+
}
|
|
14394
|
+
async detectOtherPackageManagers(targetDir, otherPackageManagers) {
|
|
14395
|
+
const packageManagers = [];
|
|
14396
|
+
for (const pmConfig of otherPackageManagers){
|
|
14397
|
+
const manifestPath = (0,external_node_path_.join)(targetDir, pmConfig.manifestFile);
|
|
14398
|
+
if (await fileExists(manifestPath)) {
|
|
14399
|
+
const lockfilePath = pmConfig.lockfile ? (0,external_node_path_.join)(targetDir, pmConfig.lockfile) : undefined;
|
|
14400
|
+
const hasLockfile = lockfilePath ? await fileExists(lockfilePath) : false;
|
|
14401
|
+
// Skip if lockfile is required but not present
|
|
14402
|
+
if (pmConfig.requiresLockfile && !hasLockfile) {
|
|
14403
|
+
continue;
|
|
14404
|
+
}
|
|
14405
|
+
packageManagers.push({
|
|
14406
|
+
type: pmConfig.type,
|
|
14407
|
+
filename: pmConfig.manifestFile,
|
|
14408
|
+
lockfile: hasLockfile ? pmConfig.lockfile : undefined
|
|
14409
|
+
});
|
|
14410
|
+
}
|
|
14411
|
+
}
|
|
14412
|
+
return packageManagers;
|
|
14212
14413
|
}
|
|
14213
14414
|
}
|
|
14214
14415
|
/**
|
|
@@ -14560,7 +14761,7 @@ var dist = __webpack_require__(1198);
|
|
|
14560
14761
|
/**
|
|
14561
14762
|
* Use case for building setup step candidates from environment detection.
|
|
14562
14763
|
* This module handles the logic of determining which GitHub Actions
|
|
14563
|
-
* setup steps should be added based on detected version files.
|
|
14764
|
+
* setup steps should be added based on detected version files and package managers.
|
|
14564
14765
|
*/
|
|
14565
14766
|
|
|
14566
14767
|
/**
|
|
@@ -14585,7 +14786,12 @@ var dist = __webpack_require__(1198);
|
|
|
14585
14786
|
return candidates;
|
|
14586
14787
|
}
|
|
14587
14788
|
// Otherwise, add individual setup actions for each version file
|
|
14588
|
-
|
|
14789
|
+
const setupCandidates = await buildCandidatesFromVersionFiles(environment.versionFiles, versionTypeToAction, versionFileConfigKeys, versionGateway);
|
|
14790
|
+
candidates.push(...setupCandidates);
|
|
14791
|
+
// Add install steps for detected package managers
|
|
14792
|
+
const installCandidates = buildInstallCandidatesFromPackageManagers(environment.packageManagers, loadedConfig);
|
|
14793
|
+
candidates.push(...installCandidates);
|
|
14794
|
+
return candidates;
|
|
14589
14795
|
}
|
|
14590
14796
|
/**
|
|
14591
14797
|
* Builds setup step candidates from individual version files
|
|
@@ -14620,6 +14826,59 @@ var dist = __webpack_require__(1198);
|
|
|
14620
14826
|
}
|
|
14621
14827
|
return candidates;
|
|
14622
14828
|
}
|
|
14829
|
+
/**
|
|
14830
|
+
* Builds install step candidates from detected package managers
|
|
14831
|
+
* @param packageManagers Array of detected package managers
|
|
14832
|
+
* @param config Configuration for package manager mappings
|
|
14833
|
+
* @returns Array of install step candidates
|
|
14834
|
+
*/ function buildInstallCandidatesFromPackageManagers(packageManagers, config) {
|
|
14835
|
+
const candidates = [];
|
|
14836
|
+
const addedTypes = new Set();
|
|
14837
|
+
for (const pm of packageManagers){
|
|
14838
|
+
// Skip if we've already added this package manager type
|
|
14839
|
+
if (addedTypes.has(pm.type)) {
|
|
14840
|
+
continue;
|
|
14841
|
+
}
|
|
14842
|
+
addedTypes.add(pm.type);
|
|
14843
|
+
// Find the config for this package manager
|
|
14844
|
+
const pmConfig = config.packageManagers.find((c)=>c.type === pm.type);
|
|
14845
|
+
if (!pmConfig) {
|
|
14846
|
+
continue;
|
|
14847
|
+
}
|
|
14848
|
+
// Determine a descriptive name for the install step
|
|
14849
|
+
const stepName = getInstallStepName(pm.type);
|
|
14850
|
+
// Create install step candidate
|
|
14851
|
+
// Note: Empty action string indicates this is a run step (uses 'run' field instead of 'uses')
|
|
14852
|
+
// This is checked in workflow-generator.ts buildStepFromCandidate()
|
|
14853
|
+
candidates.push({
|
|
14854
|
+
action: "",
|
|
14855
|
+
source: "version-file",
|
|
14856
|
+
name: stepName,
|
|
14857
|
+
run: pmConfig.installCommand
|
|
14858
|
+
});
|
|
14859
|
+
}
|
|
14860
|
+
return candidates;
|
|
14861
|
+
}
|
|
14862
|
+
/**
|
|
14863
|
+
* Gets a descriptive name for an install step based on package manager type
|
|
14864
|
+
*/ function getInstallStepName(packageManagerType) {
|
|
14865
|
+
const names = {
|
|
14866
|
+
npm: "Install Node.js dependencies",
|
|
14867
|
+
yarn: "Install Node.js dependencies",
|
|
14868
|
+
pnpm: "Install Node.js dependencies",
|
|
14869
|
+
pip: "Install Python dependencies",
|
|
14870
|
+
pipenv: "Install Python dependencies",
|
|
14871
|
+
poetry: "Install Python dependencies",
|
|
14872
|
+
bundler: "Install Ruby dependencies",
|
|
14873
|
+
cargo: "Build Rust project",
|
|
14874
|
+
composer: "Install PHP dependencies",
|
|
14875
|
+
maven: "Install Java dependencies",
|
|
14876
|
+
gradle: "Build Gradle project",
|
|
14877
|
+
gomod: "Download Go dependencies",
|
|
14878
|
+
pub: "Install Dart dependencies"
|
|
14879
|
+
};
|
|
14880
|
+
return names[packageManagerType] || "Install dependencies";
|
|
14881
|
+
}
|
|
14623
14882
|
|
|
14624
14883
|
;// CONCATENATED MODULE: ./node_modules/@github-actions-workflow-ts/lib/dist/esm/workflow/index.js
|
|
14625
14884
|
/**
|
|
@@ -15168,11 +15427,22 @@ Example resolved format: actions/setup-node@1a2b3c4d5e6f # v4.0.0`;
|
|
|
15168
15427
|
* @param options Optional conversion options for placeholders and resolved versions
|
|
15169
15428
|
* @returns A typed Step object
|
|
15170
15429
|
*/ function buildStepFromCandidate(candidate, options) {
|
|
15430
|
+
// Handle run steps (install commands)
|
|
15431
|
+
// Run steps have a 'run' field and no action (or empty action string)
|
|
15432
|
+
if (candidate.run && !candidate.action) {
|
|
15433
|
+
const stepProps = {
|
|
15434
|
+
name: candidate.name || "Run command",
|
|
15435
|
+
run: candidate.run
|
|
15436
|
+
};
|
|
15437
|
+
// Type assertion is safe here - Step constructor accepts both 'uses' and 'run' at runtime
|
|
15438
|
+
return new Step(stepProps);
|
|
15439
|
+
}
|
|
15440
|
+
// Handle action steps (uses)
|
|
15171
15441
|
const version = getVersionForAction(candidate.action, candidate.version, options);
|
|
15172
15442
|
const usesValue = buildUsesValue(candidate.action, version, options);
|
|
15173
15443
|
const withConfig = candidate.config && Object.keys(candidate.config).length > 0 ? candidate.config : undefined;
|
|
15174
15444
|
const stepProps = {
|
|
15175
|
-
name: generateStepName(candidate.action),
|
|
15445
|
+
name: candidate.name || generateStepName(candidate.action),
|
|
15176
15446
|
uses: usesValue,
|
|
15177
15447
|
with: withConfig
|
|
15178
15448
|
};
|