@slahon/lazykit 1.0.8 → 1.1.1
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/init.js +27 -5
- package/package.json +1 -1
- package/workflow.js +20 -7
package/init.js
CHANGED
|
@@ -74,6 +74,8 @@ async function init() {
|
|
|
74
74
|
|
|
75
75
|
const label = await ask('Label name to trigger Claude', 'lazykit');
|
|
76
76
|
|
|
77
|
+
const autoTrigger = await confirm('Trigger Claude on every new issue automatically? (no = only when you apply the label)', true);
|
|
78
|
+
|
|
77
79
|
const wantClaudeMd = await confirm('Generate CLAUDE.md project guide?', true);
|
|
78
80
|
|
|
79
81
|
log.blank();
|
|
@@ -85,7 +87,7 @@ async function init() {
|
|
|
85
87
|
fs.mkdirSync(workflowDir, { recursive: true });
|
|
86
88
|
|
|
87
89
|
const workflowPath = path.join(workflowDir, 'lazykit.yml');
|
|
88
|
-
const workflowContent = generateWorkflow({ label });
|
|
90
|
+
const workflowContent = generateWorkflow({ label, autoTrigger });
|
|
89
91
|
fs.writeFileSync(workflowPath, workflowContent);
|
|
90
92
|
|
|
91
93
|
spinner.succeed(chalk.green('Created .github/workflows/lazykit.yml'));
|
|
@@ -204,10 +206,30 @@ async function init() {
|
|
|
204
206
|
|
|
205
207
|
log.divider();
|
|
206
208
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
// ─── Step 9: Commit and push ──────────────────────────────────────────────
|
|
210
|
+
const autoPush = await confirm('Commit and push the generated files now?', true);
|
|
211
|
+
|
|
212
|
+
if (autoPush) {
|
|
213
|
+
const pushSpinner = ora({ text: 'Committing and pushing...', color: 'cyan' }).start();
|
|
214
|
+
try {
|
|
215
|
+
const files = ['.github/workflows/lazykit.yml', ...(wantClaudeMd ? ['CLAUDE.md'] : [])].join(' ');
|
|
216
|
+
execSync(`git add ${files}`, { stdio: 'pipe' });
|
|
217
|
+
execSync(`git commit -m "Add LazyKit automation"`, { stdio: 'pipe' });
|
|
218
|
+
execSync(`git push`, { stdio: 'pipe' });
|
|
219
|
+
pushSpinner.succeed(chalk.green('Committed and pushed — workflow is live'));
|
|
220
|
+
} catch (err) {
|
|
221
|
+
pushSpinner.fail(chalk.red('Push failed.'));
|
|
222
|
+
console.log(chalk.gray('\n Push it manually:\n'));
|
|
223
|
+
console.log(chalk.cyan(' git add .github/workflows/lazykit.yml' + (wantClaudeMd ? ' CLAUDE.md' : '')));
|
|
224
|
+
console.log(chalk.cyan(' git commit -m "Add LazyKit automation"'));
|
|
225
|
+
console.log(chalk.cyan(' git push\n'));
|
|
226
|
+
}
|
|
227
|
+
} else {
|
|
228
|
+
console.log(chalk.bold('\n Push the files yourself when ready:\n'));
|
|
229
|
+
console.log(chalk.cyan(' git add .github/workflows/lazykit.yml' + (wantClaudeMd ? ' CLAUDE.md' : '')));
|
|
230
|
+
console.log(chalk.cyan(' git commit -m "Add LazyKit automation"'));
|
|
231
|
+
console.log(chalk.cyan(' git push'));
|
|
232
|
+
}
|
|
211
233
|
|
|
212
234
|
log.divider();
|
|
213
235
|
|
package/package.json
CHANGED
package/workflow.js
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function generateWorkflow({ label }) {
|
|
3
|
+
function generateWorkflow({ label, autoTrigger }) {
|
|
4
4
|
const checkList = ` 1. Review your changes and make sure no existing functionality is broken.
|
|
5
5
|
2. If you encounter errors you cannot fix, post a comment on the issue explaining what went wrong instead of committing broken code.`;
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const trigger = autoTrigger
|
|
8
|
+
? `on:
|
|
9
|
+
issues:
|
|
10
|
+
types: [opened]
|
|
11
|
+
issue_comment:
|
|
12
|
+
types: [created]`
|
|
13
|
+
: `on:
|
|
10
14
|
issues:
|
|
11
15
|
types: [opened, labeled]
|
|
12
16
|
issue_comment:
|
|
13
|
-
types: [created]
|
|
17
|
+
types: [created]`;
|
|
18
|
+
|
|
19
|
+
const condition = autoTrigger
|
|
20
|
+
? `github.event.action == 'opened' ||
|
|
21
|
+
contains(github.event.comment.body, '@claude')`
|
|
22
|
+
: `contains(github.event.issue.labels.*.name, '${label}') ||
|
|
23
|
+
contains(github.event.comment.body, '@claude')`;
|
|
24
|
+
|
|
25
|
+
return `name: LazyKit
|
|
26
|
+
|
|
27
|
+
${trigger}
|
|
14
28
|
|
|
15
29
|
concurrency:
|
|
16
30
|
group: lazykit-\${{ github.event.issue.number }}
|
|
@@ -19,8 +33,7 @@ concurrency:
|
|
|
19
33
|
jobs:
|
|
20
34
|
lazykit:
|
|
21
35
|
if: >
|
|
22
|
-
|
|
23
|
-
contains(github.event.comment.body, '@claude')
|
|
36
|
+
${condition}
|
|
24
37
|
runs-on: ubuntu-latest
|
|
25
38
|
timeout-minutes: 30
|
|
26
39
|
permissions:
|