@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.
@@ -42578,6 +42578,27 @@ var yaml_dist = __webpack_require__(1198);
42578
42578
  return new FileSystemAgentFileGateway();
42579
42579
  }
42580
42580
 
42581
+ ;// CONCATENATED MODULE: ./src/entities/copilot-setup.ts
42582
+ /**
42583
+ * Core domain entities for the Copilot Setup Steps feature.
42584
+ * These are the fundamental types that represent the business domain.
42585
+ */ /**
42586
+ * Types of version files supported for detection
42587
+ */ /**
42588
+ * Node.js package manager types (in priority order: npm > yarn > pnpm)
42589
+ */ const NODE_PACKAGE_MANAGERS = [
42590
+ "npm",
42591
+ "yarn",
42592
+ "pnpm"
42593
+ ];
42594
+ /**
42595
+ * Python package manager types (in priority order)
42596
+ */ const PYTHON_PACKAGE_MANAGERS = [
42597
+ "poetry",
42598
+ "pipenv",
42599
+ "pip"
42600
+ ];
42601
+
42581
42602
  // EXTERNAL MODULE: external "node:fs"
42582
42603
  var external_node_fs_ = __webpack_require__(3024);
42583
42604
  // EXTERNAL MODULE: ./node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
@@ -44867,12 +44888,102 @@ async function watchConfig(options) {
44867
44888
  "actions/setup-ruby",
44868
44889
  "jdx/mise-action"
44869
44890
  ];
44891
+ /**
44892
+ * Default package manager mappings
44893
+ * Based on Dependabot supported ecosystems
44894
+ */ const DEFAULT_PACKAGE_MANAGERS = [
44895
+ // Node.js package managers
44896
+ {
44897
+ type: "npm",
44898
+ manifestFile: "package.json",
44899
+ lockfile: "package-lock.json",
44900
+ installCommand: "npm ci"
44901
+ },
44902
+ {
44903
+ type: "yarn",
44904
+ manifestFile: "package.json",
44905
+ lockfile: "yarn.lock",
44906
+ installCommand: "yarn install --frozen-lockfile"
44907
+ },
44908
+ {
44909
+ type: "pnpm",
44910
+ manifestFile: "package.json",
44911
+ lockfile: "pnpm-lock.yaml",
44912
+ installCommand: "pnpm install --frozen-lockfile"
44913
+ },
44914
+ // Python package managers
44915
+ {
44916
+ type: "pip",
44917
+ manifestFile: "requirements.txt",
44918
+ installCommand: "pip install -r requirements.txt"
44919
+ },
44920
+ {
44921
+ type: "pipenv",
44922
+ manifestFile: "Pipfile",
44923
+ lockfile: "Pipfile.lock",
44924
+ installCommand: "pipenv install --deploy"
44925
+ },
44926
+ {
44927
+ type: "poetry",
44928
+ manifestFile: "pyproject.toml",
44929
+ lockfile: "poetry.lock",
44930
+ requiresLockfile: true,
44931
+ installCommand: "poetry install --no-root"
44932
+ },
44933
+ // Ruby
44934
+ {
44935
+ type: "bundler",
44936
+ manifestFile: "Gemfile",
44937
+ lockfile: "Gemfile.lock",
44938
+ installCommand: "bundle install"
44939
+ },
44940
+ // Rust
44941
+ {
44942
+ type: "cargo",
44943
+ manifestFile: "Cargo.toml",
44944
+ lockfile: "Cargo.lock",
44945
+ installCommand: "cargo build"
44946
+ },
44947
+ // PHP
44948
+ {
44949
+ type: "composer",
44950
+ manifestFile: "composer.json",
44951
+ lockfile: "composer.lock",
44952
+ installCommand: "composer install"
44953
+ },
44954
+ // Java
44955
+ {
44956
+ type: "maven",
44957
+ manifestFile: "pom.xml",
44958
+ installCommand: "mvn install -DskipTests"
44959
+ },
44960
+ {
44961
+ type: "gradle",
44962
+ manifestFile: "build.gradle",
44963
+ installCommand: "gradle build -x test"
44964
+ },
44965
+ // Go
44966
+ {
44967
+ type: "gomod",
44968
+ manifestFile: "go.mod",
44969
+ lockfile: "go.sum",
44970
+ installCommand: "go mod download"
44971
+ },
44972
+ // Dart/Flutter
44973
+ {
44974
+ type: "pub",
44975
+ manifestFile: "pubspec.yaml",
44976
+ lockfile: "pubspec.lock",
44977
+ installCommand: "dart pub get"
44978
+ }
44979
+ ];
44870
44980
  /**
44871
44981
  * Default copilot-setup configuration
44872
44982
  */ const DEFAULT_CONFIG = {
44873
44983
  versionFiles: DEFAULT_VERSION_FILES,
44874
44984
  setupActions: DEFAULT_SETUP_ACTIONS,
44875
- setupActionPatterns: DEFAULT_SETUP_ACTION_PATTERNS
44985
+ setupActionPatterns: DEFAULT_SETUP_ACTION_PATTERNS,
44986
+ packageManagers: DEFAULT_PACKAGE_MANAGERS
44876
44987
  };
44877
44988
  /**
44878
44989
  * Loads the copilot-setup configuration using c12
@@ -44931,6 +45042,7 @@ async function watchConfig(options) {
44931
45042
 
44932
45043
 
44933
45044
 
45045
+
44934
45046
  /**
44935
45047
  * Reads the content of a version file and trims whitespace
44936
45048
  */ async function readVersionFileContent(filePath) {
@@ -44948,9 +45060,21 @@ async function watchConfig(options) {
44948
45060
  return this.config;
44949
45061
  }
44950
45062
  async detectEnvironment(targetDir) {
44951
- const miseTomlPath = (0,external_node_path_.join)(targetDir, "mise.toml");
44952
- const hasMise = await file_system_utils_fileExists(miseTomlPath);
44953
45063
  const config = await this.getConfig();
45064
+ const hasMise = await this.detectMise(targetDir);
45065
+ const versionFiles = await this.detectVersionFiles(targetDir, config);
45066
+ const packageManagers = await this.detectPackageManagers(targetDir, config);
45067
+ return {
45068
+ hasMise,
45069
+ versionFiles,
45070
+ packageManagers
45071
+ };
45072
+ }
45073
+ async detectMise(targetDir) {
45074
+ const miseTomlPath = (0,external_node_path_.join)(targetDir, "mise.toml");
45075
+ return file_system_utils_fileExists(miseTomlPath);
45076
+ }
45077
+ async detectVersionFiles(targetDir, config) {
44954
45078
  const filenameToType = getVersionFilenameToTypeMap(config);
44955
45079
  const versionFiles = [];
44956
45080
  for (const fileConfig of config.versionFiles){
@@ -44964,10 +45088,109 @@ async function watchConfig(options) {
44964
45088
  });
44965
45089
  }
44966
45090
  }
44967
- return {
44968
- hasMise,
44969
- versionFiles
44970
- };
45091
+ return versionFiles;
45092
+ }
45093
+ async detectPackageManagers(targetDir, config) {
45094
+ const packageManagers = [];
45095
+ // Helper to check if a package manager type is in a list
45096
+ const isPackageManagerType = (pm, types)=>types.includes(pm.type);
45097
+ const nodePackageManagers = config.packageManagers.filter((pm)=>isPackageManagerType(pm, NODE_PACKAGE_MANAGERS));
45098
+ const pythonPackageManagers = config.packageManagers.filter((pm)=>isPackageManagerType(pm, PYTHON_PACKAGE_MANAGERS));
45099
+ const otherPackageManagers = config.packageManagers.filter((pm)=>!isPackageManagerType(pm, NODE_PACKAGE_MANAGERS) && !isPackageManagerType(pm, PYTHON_PACKAGE_MANAGERS));
45100
+ // Detect Node.js package manager (with prioritization)
45101
+ const nodePackageManager = await this.detectNodePackageManager(targetDir, nodePackageManagers);
45102
+ if (nodePackageManager) {
45103
+ packageManagers.push(nodePackageManager);
45104
+ }
45105
+ // Detect Python package manager (with prioritization)
45106
+ const pythonPackageManager = await this.detectPythonPackageManager(targetDir, pythonPackageManagers);
45107
+ if (pythonPackageManager) {
45108
+ packageManagers.push(pythonPackageManager);
45109
+ }
45110
+ // Detect other package managers
45111
+ const otherDetectedManagers = await this.detectOtherPackageManagers(targetDir, otherPackageManagers);
45112
+ packageManagers.push(...otherDetectedManagers);
45113
+ return packageManagers;
45114
+ }
45115
+ async detectNodePackageManager(targetDir, nodePackageManagers) {
45116
+ const packageJsonPath = (0,external_node_path_.join)(targetDir, "package.json");
45117
+ if (!await file_system_utils_fileExists(packageJsonPath)) {
45118
+ return null;
45119
+ }
45120
+ // Priority order for Node.js package managers: npm > yarn > pnpm
45121
+ const lockfileOrder = [
45122
+ "npm",
45123
+ "yarn",
45124
+ "pnpm"
45125
+ ];
45126
+ for (const pmType of lockfileOrder){
45127
+ const pmConfig = nodePackageManagers.find((pm)=>pm.type === pmType);
45128
+ if (!pmConfig?.lockfile) {
45129
+ continue;
45130
+ }
45131
+ const lockfilePath = (0,external_node_path_.join)(targetDir, pmConfig.lockfile);
45132
+ if (await file_system_utils_fileExists(lockfilePath)) {
45133
+ return {
45134
+ type: pmConfig.type,
45135
+ filename: pmConfig.manifestFile,
45136
+ lockfile: pmConfig.lockfile
45137
+ };
45138
+ }
45139
+ }
45140
+ // Default to npm if no lockfile found
45141
+ const npmConfig = nodePackageManagers.find((pm)=>pm.type === "npm");
45142
+ if (npmConfig) {
45143
+ return {
45144
+ type: npmConfig.type,
45145
+ filename: npmConfig.manifestFile,
45146
+ lockfile: undefined
45147
+ };
45148
+ }
45149
+ return null;
45150
+ }
45151
+ async detectPythonPackageManager(targetDir, pythonPackageManagers) {
45152
+ // Priority order for Python package managers: poetry > pipenv > pip
45153
+ for (const pmType of PYTHON_PACKAGE_MANAGERS){
45154
+ const pmConfig = pythonPackageManagers.find((pm)=>pm.type === pmType);
45155
+ if (!pmConfig) {
45156
+ continue;
45157
+ }
45158
+ const manifestPath = (0,external_node_path_.join)(targetDir, pmConfig.manifestFile);
45159
+ if (await file_system_utils_fileExists(manifestPath)) {
45160
+ const lockfilePath = pmConfig.lockfile ? (0,external_node_path_.join)(targetDir, pmConfig.lockfile) : undefined;
45161
+ const hasLockfile = lockfilePath ? await file_system_utils_fileExists(lockfilePath) : false;
45162
+ // Skip if lockfile is required but not present
45163
+ if (pmConfig.requiresLockfile && !hasLockfile) {
45164
+ continue;
45165
+ }
45166
+ return {
45167
+ type: pmConfig.type,
45168
+ filename: pmConfig.manifestFile,
45169
+ lockfile: hasLockfile ? pmConfig.lockfile : undefined
45170
+ };
45171
+ }
45172
+ }
45173
+ return null;
45174
+ }
45175
+ async detectOtherPackageManagers(targetDir, otherPackageManagers) {
45176
+ const packageManagers = [];
45177
+ for (const pmConfig of otherPackageManagers){
45178
+ const manifestPath = (0,external_node_path_.join)(targetDir, pmConfig.manifestFile);
45179
+ if (await file_system_utils_fileExists(manifestPath)) {
45180
+ const lockfilePath = pmConfig.lockfile ? (0,external_node_path_.join)(targetDir, pmConfig.lockfile) : undefined;
45181
+ const hasLockfile = lockfilePath ? await file_system_utils_fileExists(lockfilePath) : false;
45182
+ // Skip if lockfile is required but not present
45183
+ if (pmConfig.requiresLockfile && !hasLockfile) {
45184
+ continue;
45185
+ }
45186
+ packageManagers.push({
45187
+ type: pmConfig.type,
45188
+ filename: pmConfig.manifestFile,
45189
+ lockfile: hasLockfile ? pmConfig.lockfile : undefined
45190
+ });
45191
+ }
45192
+ }
45193
+ return packageManagers;
44971
45194
  }
44972
45195
  }
44973
45196
  /**
@@ -45532,7 +45755,7 @@ Example resolved format: actions/setup-node@1a2b3c4d5e6f # v4.0.0`;
45532
45755
  /**
45533
45756
  * Use case for building setup step candidates from environment detection.
45534
45757
  * This module handles the logic of determining which GitHub Actions
45535
- * setup steps should be added based on detected version files.
45758
+ * setup steps should be added based on detected version files and package managers.
45536
45759
  */
45537
45760
 
45538
45761
  /**
@@ -45557,7 +45780,12 @@ Example resolved format: actions/setup-node@1a2b3c4d5e6f # v4.0.0`;
45557
45780
  return candidates;
45558
45781
  }
45559
45782
  // Otherwise, add individual setup actions for each version file
45560
- return buildCandidatesFromVersionFiles(environment.versionFiles, versionTypeToAction, versionFileConfigKeys, versionGateway);
45783
+ const setupCandidates = await buildCandidatesFromVersionFiles(environment.versionFiles, versionTypeToAction, versionFileConfigKeys, versionGateway);
45784
+ candidates.push(...setupCandidates);
45785
+ // Add install steps for detected package managers
45786
+ const installCandidates = buildInstallCandidatesFromPackageManagers(environment.packageManagers, loadedConfig);
45787
+ candidates.push(...installCandidates);
45788
+ return candidates;
45561
45789
  }
45562
45790
  /**
45563
45791
  * Builds setup step candidates from individual version files
@@ -45592,6 +45820,59 @@ Example resolved format: actions/setup-node@1a2b3c4d5e6f # v4.0.0`;
45592
45820
  }
45593
45821
  return candidates;
45594
45822
  }
45823
+ /**
45824
+ * Builds install step candidates from detected package managers
45825
+ * @param packageManagers Array of detected package managers
45826
+ * @param config Configuration for package manager mappings
45827
+ * @returns Array of install step candidates
45828
+ */ function buildInstallCandidatesFromPackageManagers(packageManagers, config) {
45829
+ const candidates = [];
45830
+ const addedTypes = new Set();
45831
+ for (const pm of packageManagers){
45832
+ // Skip if we've already added this package manager type
45833
+ if (addedTypes.has(pm.type)) {
45834
+ continue;
45835
+ }
45836
+ addedTypes.add(pm.type);
45837
+ // Find the config for this package manager
45838
+ const pmConfig = config.packageManagers.find((c)=>c.type === pm.type);
45839
+ if (!pmConfig) {
45840
+ continue;
45841
+ }
45842
+ // Determine a descriptive name for the install step
45843
+ const stepName = getInstallStepName(pm.type);
45844
+ // Create install step candidate
45845
+ // Note: Empty action string indicates this is a run step (uses 'run' field instead of 'uses')
45846
+ // This is checked in workflow-generator.ts buildStepFromCandidate()
45847
+ candidates.push({
45848
+ action: "",
45849
+ source: "version-file",
45850
+ name: stepName,
45851
+ run: pmConfig.installCommand
45852
+ });
45853
+ }
45854
+ return candidates;
45855
+ }
45856
+ /**
45857
+ * Gets a descriptive name for an install step based on package manager type
45858
+ */ function getInstallStepName(packageManagerType) {
45859
+ const names = {
45860
+ npm: "Install Node.js dependencies",
45861
+ yarn: "Install Node.js dependencies",
45862
+ pnpm: "Install Node.js dependencies",
45863
+ pip: "Install Python dependencies",
45864
+ pipenv: "Install Python dependencies",
45865
+ poetry: "Install Python dependencies",
45866
+ bundler: "Install Ruby dependencies",
45867
+ cargo: "Build Rust project",
45868
+ composer: "Install PHP dependencies",
45869
+ maven: "Install Java dependencies",
45870
+ gradle: "Build Gradle project",
45871
+ gomod: "Download Go dependencies",
45872
+ pub: "Install Dart dependencies"
45873
+ };
45874
+ return names[packageManagerType] || "Install dependencies";
45875
+ }
45595
45876
 
45596
45877
  ;// CONCATENATED MODULE: ./node_modules/@github-actions-workflow-ts/lib/dist/esm/workflow/index.js
45597
45878
  /**
@@ -46037,11 +46318,22 @@ function getGlobalWacContext() {
46037
46318
  * @param options Optional conversion options for placeholders and resolved versions
46038
46319
  * @returns A typed Step object
46039
46320
  */ function buildStepFromCandidate(candidate, options) {
46321
+ // Handle run steps (install commands)
46322
+ // Run steps have a 'run' field and no action (or empty action string)
46323
+ if (candidate.run && !candidate.action) {
46324
+ const stepProps = {
46325
+ name: candidate.name || "Run command",
46326
+ run: candidate.run
46327
+ };
46328
+ // Type assertion is safe here - Step constructor accepts both 'uses' and 'run' at runtime
46329
+ return new Step(stepProps);
46330
+ }
46331
+ // Handle action steps (uses)
46040
46332
  const version = getVersionForAction(candidate.action, candidate.version, options);
46041
46333
  const usesValue = buildUsesValue(candidate.action, version, options);
46042
46334
  const withConfig = candidate.config && Object.keys(candidate.config).length > 0 ? candidate.config : undefined;
46043
46335
  const stepProps = {
46044
- name: generateStepName(candidate.action),
46336
+ name: candidate.name || generateStepName(candidate.action),
46045
46337
  uses: usesValue,
46046
46338
  with: withConfig
46047
46339
  };