@lousy-agents/cli 5.2.4 → 5.2.5
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/api/copilot-with-fastify/.devcontainer/devcontainer.json +1 -1
- package/api/copilot-with-fastify/.github/workflows/assign-copilot.yml +1 -1
- package/cli/copilot-with-citty/.devcontainer/devcontainer.json +1 -1
- package/cli/copilot-with-citty/.github/workflows/assign-copilot.yml +1 -1
- package/dist/index.js +126 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/ui/copilot-with-react/.devcontainer/devcontainer.json +1 -1
- package/ui/copilot-with-react/.github/workflows/assign-copilot.yml +1 -1
- package/ui/copilot-with-react/package.json +2 -2
- package/ui/copilot-with-react/.github/workflows/copilot-setup-steps.yml +0 -37
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"image": "mcr.microsoft.com/devcontainers/javascript-node:24-bookworm",
|
|
4
4
|
"features": {
|
|
5
5
|
"ghcr.io/devcontainers/features/github-cli:1": {
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.88.1"
|
|
7
7
|
},
|
|
8
8
|
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
|
|
9
9
|
"packages": "yamllint, shellcheck",
|
|
@@ -13,7 +13,7 @@ jobs:
|
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
14
|
steps:
|
|
15
15
|
- name: Assign and Instruct Copilot
|
|
16
|
-
uses: actions/github-script@
|
|
16
|
+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
|
|
17
17
|
with:
|
|
18
18
|
script: |
|
|
19
19
|
const issue = context.payload.issue;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"image": "mcr.microsoft.com/devcontainers/javascript-node:24-bookworm",
|
|
4
4
|
"features": {
|
|
5
5
|
"ghcr.io/devcontainers/features/github-cli:1": {
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.88.1"
|
|
7
7
|
},
|
|
8
8
|
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
|
|
9
9
|
"packages": "yamllint, shellcheck",
|
|
@@ -13,7 +13,7 @@ jobs:
|
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
14
|
steps:
|
|
15
15
|
- name: Assign and Instruct Copilot
|
|
16
|
-
uses: actions/github-script@
|
|
16
|
+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
|
|
17
17
|
with:
|
|
18
18
|
script: |
|
|
19
19
|
const issue = context.payload.issue;
|
package/dist/index.js
CHANGED
|
@@ -26930,9 +26930,11 @@ const CopilotSetupConfigSchema = schemas_object({
|
|
|
26930
26930
|
/**
|
|
26931
26931
|
* Loads the copilot-setup configuration using c12.
|
|
26932
26932
|
* Falls back to defaults if no configuration is found.
|
|
26933
|
-
|
|
26933
|
+
* @param cwd Optional working directory to load config from (defaults to process.cwd())
|
|
26934
|
+
*/ async function loadCopilotSetupConfig(cwd) {
|
|
26934
26935
|
const { config } = await loadConfig({
|
|
26935
26936
|
name: "lousy-agents",
|
|
26937
|
+
cwd,
|
|
26936
26938
|
defaults: DEFAULT_COPILOT_SETUP_CONFIG,
|
|
26937
26939
|
packageJson: "copilotSetup"
|
|
26938
26940
|
});
|
|
@@ -26984,6 +26986,7 @@ const CopilotSetupConfigSchema = schemas_object({
|
|
|
26984
26986
|
|
|
26985
26987
|
|
|
26986
26988
|
|
|
26989
|
+
|
|
26987
26990
|
const MAX_VERSION_FILE_BYTES = 16 * 1024;
|
|
26988
26991
|
async function readVersionFileContent(filePath) {
|
|
26989
26992
|
await assertFileSizeWithinLimit(filePath, MAX_VERSION_FILE_BYTES, `Version file '${filePath}'`);
|
|
@@ -26993,10 +26996,14 @@ async function readVersionFileContent(filePath) {
|
|
|
26993
26996
|
/**
|
|
26994
26997
|
* File system implementation of the environment gateway.
|
|
26995
26998
|
*/ class FileSystemEnvironmentGateway {
|
|
26999
|
+
cwd;
|
|
26996
27000
|
config = null;
|
|
27001
|
+
constructor(cwd){
|
|
27002
|
+
this.cwd = cwd;
|
|
27003
|
+
}
|
|
26997
27004
|
async getConfig() {
|
|
26998
27005
|
if (!this.config) {
|
|
26999
|
-
this.config = await loadCopilotSetupConfig();
|
|
27006
|
+
this.config = await loadCopilotSetupConfig(this.cwd !== undefined ? (0,external_node_path_.resolve)(this.cwd) : undefined);
|
|
27000
27007
|
}
|
|
27001
27008
|
return this.config;
|
|
27002
27009
|
}
|
|
@@ -27127,8 +27134,9 @@ async function readVersionFileContent(filePath) {
|
|
|
27127
27134
|
}
|
|
27128
27135
|
/**
|
|
27129
27136
|
* Creates and returns the default environment gateway.
|
|
27130
|
-
|
|
27131
|
-
|
|
27137
|
+
* @param cwd Optional working directory for config loading (defaults to process.cwd())
|
|
27138
|
+
*/ function createEnvironmentGateway(cwd) {
|
|
27139
|
+
return new FileSystemEnvironmentGateway(cwd);
|
|
27132
27140
|
}
|
|
27133
27141
|
|
|
27134
27142
|
// EXTERNAL MODULE: external "node:child_process"
|
|
@@ -32212,16 +32220,21 @@ var dist = __webpack_require__(3519);
|
|
|
32212
32220
|
|
|
32213
32221
|
|
|
32214
32222
|
|
|
32223
|
+
|
|
32215
32224
|
const COPILOT_SETUP_WORKFLOW_FILENAMES = [
|
|
32216
32225
|
"copilot-setup-steps.yml",
|
|
32217
32226
|
"copilot-setup-steps.yaml"
|
|
32218
32227
|
];
|
|
32219
32228
|
const MAX_WORKFLOW_FILE_BYTES = 1024 * 1024;
|
|
32220
32229
|
class FileSystemWorkflowGateway {
|
|
32230
|
+
cwd;
|
|
32221
32231
|
config = null;
|
|
32232
|
+
constructor(cwd){
|
|
32233
|
+
this.cwd = cwd;
|
|
32234
|
+
}
|
|
32222
32235
|
async getConfig() {
|
|
32223
32236
|
if (!this.config) {
|
|
32224
|
-
this.config = await loadCopilotSetupConfig();
|
|
32237
|
+
this.config = await loadCopilotSetupConfig(this.cwd !== undefined ? (0,external_node_path_.resolve)(this.cwd) : undefined);
|
|
32225
32238
|
}
|
|
32226
32239
|
return this.config;
|
|
32227
32240
|
}
|
|
@@ -32283,8 +32296,8 @@ class FileSystemWorkflowGateway {
|
|
|
32283
32296
|
await (0,promises_.writeFile)(workflowPath, content, "utf-8");
|
|
32284
32297
|
}
|
|
32285
32298
|
}
|
|
32286
|
-
function createWorkflowGateway() {
|
|
32287
|
-
return new FileSystemWorkflowGateway();
|
|
32299
|
+
function createWorkflowGateway(cwd) {
|
|
32300
|
+
return new FileSystemWorkflowGateway(cwd);
|
|
32288
32301
|
}
|
|
32289
32302
|
|
|
32290
32303
|
;// CONCATENATED MODULE: ../core/src/gateways/workflow-gateway.ts
|
|
@@ -32556,7 +32569,7 @@ function buildInstallCandidatesFromPackageManagers(packageManagers, config) {
|
|
|
32556
32569
|
}
|
|
32557
32570
|
const stepName = getInstallStepName(pm.type);
|
|
32558
32571
|
candidates.push({
|
|
32559
|
-
action:
|
|
32572
|
+
action: `run:${pm.type}`,
|
|
32560
32573
|
source: "version-file",
|
|
32561
32574
|
name: stepName,
|
|
32562
32575
|
run: pmConfig.installCommand
|
|
@@ -33135,8 +33148,8 @@ const workflow_generator_defaultActionVersionPort = createActionVersionPort(work
|
|
|
33135
33148
|
* @returns A typed Step object
|
|
33136
33149
|
*/ function buildStepFromCandidate(candidate, options) {
|
|
33137
33150
|
// Handle run steps (install commands)
|
|
33138
|
-
// Run steps have a 'run' field and
|
|
33139
|
-
if (candidate.run &&
|
|
33151
|
+
// Run steps have a 'run' field and use the 'run:' action prefix (e.g., 'run:npm')
|
|
33152
|
+
if (candidate.run && candidate.action.startsWith("run:")) {
|
|
33140
33153
|
const stepProps = {
|
|
33141
33154
|
name: candidate.name || "Run command",
|
|
33142
33155
|
run: candidate.run
|
|
@@ -33213,9 +33226,11 @@ const workflow_generator_defaultActionVersionPort = createActionVersionPort(work
|
|
|
33213
33226
|
const job = new NormalJob("copilot-setup-steps", {
|
|
33214
33227
|
"runs-on": "ubuntu-latest",
|
|
33215
33228
|
"timeout-minutes": 30,
|
|
33216
|
-
permissions: {
|
|
33229
|
+
permissions: options?.includeIdTokenPermission ? {
|
|
33217
33230
|
"id-token": "write",
|
|
33218
33231
|
contents: "read"
|
|
33232
|
+
} : {
|
|
33233
|
+
contents: "read"
|
|
33219
33234
|
}
|
|
33220
33235
|
}).addSteps(steps);
|
|
33221
33236
|
const workflow = new Workflow("copilot-setup-steps.yml", {
|
|
@@ -34844,9 +34859,9 @@ const copilotSetupCommand = defineCommand({
|
|
|
34844
34859
|
args: copilotSetupArgs,
|
|
34845
34860
|
run: async (context)=>{
|
|
34846
34861
|
const targetDir = typeof context.data?.targetDir === "string" ? context.data.targetDir : process.cwd();
|
|
34847
|
-
const environmentGateway = createEnvironmentGateway();
|
|
34848
|
-
const workflowGateway = createWorkflowGateway();
|
|
34849
|
-
const copilotSetupConfig = await loadCopilotSetupConfig();
|
|
34862
|
+
const environmentGateway = createEnvironmentGateway(targetDir);
|
|
34863
|
+
const workflowGateway = createWorkflowGateway(targetDir);
|
|
34864
|
+
const copilotSetupConfig = await loadCopilotSetupConfig(targetDir);
|
|
34850
34865
|
const rulesetGateway = context.data?.rulesetGateway ?? await createGitHubRulesetGateway();
|
|
34851
34866
|
const npmrcGateway = context.data?.npmrcGateway ?? createNpmrcGateway();
|
|
34852
34867
|
const prompt = context.data?.prompt ?? ((message, options)=>consola.prompt(message, options));
|
|
@@ -34983,6 +34998,43 @@ async function checkAndPromptAgentShell(npmrcGateway, targetDir, prompt, environ
|
|
|
34983
34998
|
consola.success("Added agent-shell to .npmrc. Run `npm install -g @lousy-agents/agent-shell` to complete setup.");
|
|
34984
34999
|
}
|
|
34985
35000
|
|
|
35001
|
+
;// CONCATENATED MODULE: ../core/src/use-cases/init-copilot-setup-workflow.ts
|
|
35002
|
+
/**
|
|
35003
|
+
* Use case for initializing a Copilot Setup Steps workflow in a new project.
|
|
35004
|
+
* Orchestrates environment detection, candidate building, and workflow generation.
|
|
35005
|
+
* Preserves any pre-existing workflow file.
|
|
35006
|
+
*/
|
|
35007
|
+
|
|
35008
|
+
|
|
35009
|
+
/**
|
|
35010
|
+
* Generates a Copilot Setup Steps workflow in the target directory if one does not
|
|
35011
|
+
* already exist. Uses detected environment (version files, package managers) to build
|
|
35012
|
+
* environment-aware setup candidates and writes a SHA-pinned workflow.
|
|
35013
|
+
*
|
|
35014
|
+
* @returns `{ created: false }` when the workflow already exists (preserving it),
|
|
35015
|
+
* `{ created: true, stepCount }` after writing the generated workflow.
|
|
35016
|
+
*/ async function initCopilotSetupWorkflow(input, workflowGateway, environmentGateway, copilotSetupConfig) {
|
|
35017
|
+
const workflowExists = await workflowGateway.copilotSetupWorkflowExists(input.targetDir);
|
|
35018
|
+
if (workflowExists) {
|
|
35019
|
+
return {
|
|
35020
|
+
created: false,
|
|
35021
|
+
stepCount: 0
|
|
35022
|
+
};
|
|
35023
|
+
}
|
|
35024
|
+
const environment = await environmentGateway.detectEnvironment(input.targetDir);
|
|
35025
|
+
const workflowCandidates = await workflowGateway.parseWorkflowsForSetupActions(input.targetDir);
|
|
35026
|
+
const envCandidates = await buildCandidatesFromEnvironment(environment, undefined, copilotSetupConfig);
|
|
35027
|
+
const allCandidates = mergeCandidates(workflowCandidates, envCandidates);
|
|
35028
|
+
const content = await generateWorkflowContent(allCandidates, undefined, {
|
|
35029
|
+
resolvedVersions: input.resolvedVersions
|
|
35030
|
+
});
|
|
35031
|
+
await workflowGateway.writeCopilotSetupWorkflow(input.targetDir, content);
|
|
35032
|
+
return {
|
|
35033
|
+
created: true,
|
|
35034
|
+
stepCount: allCandidates.length + 1
|
|
35035
|
+
}; // +1 for checkout
|
|
35036
|
+
}
|
|
35037
|
+
|
|
34986
35038
|
;// CONCATENATED MODULE: ./src/lib/config.ts
|
|
34987
35039
|
|
|
34988
35040
|
|
|
@@ -36069,6 +36121,10 @@ const validateUnscopedName = (name)=>{
|
|
|
36069
36121
|
|
|
36070
36122
|
|
|
36071
36123
|
|
|
36124
|
+
|
|
36125
|
+
|
|
36126
|
+
|
|
36127
|
+
|
|
36072
36128
|
const ProjectTypeSchema = schemas_enum([
|
|
36073
36129
|
"cli",
|
|
36074
36130
|
"webapp",
|
|
@@ -36143,6 +36199,61 @@ async function scaffoldProject(projectType, targetDir, templateContext) {
|
|
|
36143
36199
|
function isSupportedProjectType(projectType) {
|
|
36144
36200
|
return SUPPORTED_PROJECT_TYPES.includes(projectType);
|
|
36145
36201
|
}
|
|
36202
|
+
/**
|
|
36203
|
+
* SHA-pinned action versions for new projects.
|
|
36204
|
+
* Actions shared with the repository's copilot-setup-steps.yml (checkout, setup-python,
|
|
36205
|
+
* mise-action) use the same SHAs for consistency. Additional entries (setup-node,
|
|
36206
|
+
* setup-java, setup-go) are defaults for newly scaffolded projects that may need them
|
|
36207
|
+
* and are aligned with the scaffold template workflows.
|
|
36208
|
+
*/ const INIT_RESOLVED_VERSIONS = [
|
|
36209
|
+
{
|
|
36210
|
+
action: "actions/checkout",
|
|
36211
|
+
sha: "0c366fd6a839edf440554fa01a7085ccba70ac98",
|
|
36212
|
+
versionTag: "v6.0.2"
|
|
36213
|
+
},
|
|
36214
|
+
{
|
|
36215
|
+
action: "actions/setup-node",
|
|
36216
|
+
sha: "53b83947a5a98c8d113130e565377fae1a50d02f",
|
|
36217
|
+
versionTag: "v6.3.0"
|
|
36218
|
+
},
|
|
36219
|
+
{
|
|
36220
|
+
action: "actions/setup-python",
|
|
36221
|
+
sha: "28f2168f4d98ee0445e3c6321f6e6616c83dd5ec",
|
|
36222
|
+
versionTag: "v6.2.0"
|
|
36223
|
+
},
|
|
36224
|
+
{
|
|
36225
|
+
action: "actions/setup-java",
|
|
36226
|
+
sha: "7a6d8a8234af8eb26422e24e3006232cccaa061b",
|
|
36227
|
+
versionTag: "v4.6.0"
|
|
36228
|
+
},
|
|
36229
|
+
{
|
|
36230
|
+
action: "actions/setup-go",
|
|
36231
|
+
sha: "5fbf81aa9aa1f4a83e0b6f3c86e690bc4c2aebfe",
|
|
36232
|
+
versionTag: "v5.3.0"
|
|
36233
|
+
},
|
|
36234
|
+
{
|
|
36235
|
+
action: "jdx/mise-action",
|
|
36236
|
+
sha: "c1ecc8f748cd28cdeabf76dab3cccde4ce692fe4",
|
|
36237
|
+
versionTag: "v3.6.1"
|
|
36238
|
+
}
|
|
36239
|
+
];
|
|
36240
|
+
async function generateCopilotSetupWorkflow(targetDir) {
|
|
36241
|
+
// Normalize path (e.g., resolve ../../relative segments) before
|
|
36242
|
+
// passing to config loading or gateway construction.
|
|
36243
|
+
const resolvedTargetDir = (0,external_node_path_.resolve)(targetDir);
|
|
36244
|
+
const workflowGateway = createWorkflowGateway(resolvedTargetDir);
|
|
36245
|
+
const environmentGateway = createEnvironmentGateway(resolvedTargetDir);
|
|
36246
|
+
const copilotSetupConfig = await loadCopilotSetupConfig(resolvedTargetDir);
|
|
36247
|
+
const result = await initCopilotSetupWorkflow({
|
|
36248
|
+
targetDir: resolvedTargetDir,
|
|
36249
|
+
resolvedVersions: INIT_RESOLVED_VERSIONS
|
|
36250
|
+
}, workflowGateway, environmentGateway, copilotSetupConfig);
|
|
36251
|
+
if (!result.created) {
|
|
36252
|
+
consola.info("Copilot setup workflow already exists - preserving existing file");
|
|
36253
|
+
return;
|
|
36254
|
+
}
|
|
36255
|
+
consola.success(`Created copilot-setup-steps.yml with ${result.stepCount} step(s)`);
|
|
36256
|
+
}
|
|
36146
36257
|
const initCommand = defineCommand({
|
|
36147
36258
|
meta: {
|
|
36148
36259
|
name: "init",
|
|
@@ -36174,6 +36285,7 @@ const initCommand = defineCommand({
|
|
|
36174
36285
|
projectName
|
|
36175
36286
|
};
|
|
36176
36287
|
await scaffoldProject(projectType, targetDir, templateContext);
|
|
36288
|
+
await generateCopilotSetupWorkflow(targetDir);
|
|
36177
36289
|
consola.info(`${config.label} project scaffolding complete. Run 'npm install' to install dependencies.`);
|
|
36178
36290
|
}
|
|
36179
36291
|
});
|