@ibalzam/codejitsu-core 0.7.0 → 0.8.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/bin/codejitsu.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { parseArgs } from 'node:util';
3
3
  import { runBlog } from '../modules/cli/src/blog.mjs';
4
- import { runDeploySetup } from '../modules/cli/src/deploy.mjs';
4
+ import { runDeploySetup, runDeployTrigger } from '../modules/cli/src/deploy.mjs';
5
5
  import { runAudit } from '../modules/audit/src/run.mjs';
6
6
 
7
7
  const subcommand = process.argv[2];
@@ -11,6 +11,7 @@ const COMMANDS = {
11
11
  'blog:list': () => runBlog('blog:list'),
12
12
  'blog:drafts': () => runBlog('blog:drafts'),
13
13
  'deploy:setup': () => runDeploySetup(),
14
+ 'deploy:run': () => runDeployTrigger(),
14
15
  audit: () => {
15
16
  const { values } = parseArgs({
16
17
  args: rest,
@@ -55,6 +56,7 @@ function printHelp() {
55
56
  console.log(` blog:drafts List future-dated (pending) posts only`);
56
57
  console.log(``);
57
58
  console.log(` deploy:setup Wire up daily Cloudflare deploy (prompts for hook URL)`);
59
+ console.log(` deploy:run Trigger the Daily Deploy workflow once now`);
58
60
  console.log(``);
59
61
  console.log(` audit Run pre-delivery audit. Flags:`);
60
62
  console.log(` --live <url> Add live-URL checks (SSL, headers, 404, broken links)`);
@@ -133,6 +133,55 @@ export async function runDeploySetup() {
133
133
  await offerTestRun(repo);
134
134
  }
135
135
 
136
+ /**
137
+ * `codejitsu deploy:run` — fire the "Daily Deploy" workflow once on demand.
138
+ * Useful when you want to publish a scheduled blog post immediately instead
139
+ * of waiting for the next 13:00 UTC cron tick.
140
+ */
141
+ export async function runDeployTrigger() {
142
+ const cwd = process.cwd();
143
+
144
+ const repo = detectGitHubRepo(cwd);
145
+ if (!repo) {
146
+ console.error(c.red('✗ Could not detect GitHub repo from git remote.'));
147
+ process.exit(1);
148
+ }
149
+
150
+ const ghAvailable = await commandExists('gh');
151
+ if (!ghAvailable) {
152
+ console.error(c.red('✗ `gh` CLI not in PATH. Install: https://cli.github.com/'));
153
+ process.exit(1);
154
+ }
155
+ const ghAuthed = await ghIsAuthed();
156
+ if (!ghAuthed) {
157
+ console.error(c.red('✗ `gh` not authenticated. Run: gh auth login'));
158
+ process.exit(1);
159
+ }
160
+
161
+ console.log(`Triggering "Daily Deploy" in ${c.bold(repo)}…`);
162
+ const trigger = await runGh(['workflow', 'run', 'Daily Deploy', '--repo', repo]);
163
+ if (trigger.code !== 0) {
164
+ console.error(c.red('✗ Failed to trigger workflow.'));
165
+ console.error(' ' + trigger.stderr.trim());
166
+ console.error(' Make sure .github/workflows/daily-deploy.yml exists and is committed.');
167
+ process.exit(1);
168
+ }
169
+ console.log(c.green('✓') + ' Workflow dispatched.');
170
+ console.log(c.gray(` Watch: https://github.com/${repo}/actions/workflows/daily-deploy.yml`));
171
+
172
+ // Brief: show the most recent runs.
173
+ console.log('\nRecent runs:');
174
+ const list = await runGh([
175
+ 'run', 'list',
176
+ '--workflow', 'daily-deploy.yml',
177
+ '--repo', repo,
178
+ '--limit', '3',
179
+ ]);
180
+ if (list.code === 0 && list.stdout.trim()) {
181
+ console.log(c.gray(list.stdout.trim().split('\n').map((l) => ' ' + l).join('\n')));
182
+ }
183
+ }
184
+
136
185
  async function offerTestRun(repo) {
137
186
  const test = await prompt('\nTrigger the workflow once now to test? [y/N]: ');
138
187
  if (!/^y(es)?$/i.test(test.trim())) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibalzam/codejitsu-core",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "Shared core for Codejitsu Astro sites — reusable code and Claude-facing instructions for blog, SEO, images, deploy, and llms.txt.",
6
6
  "keywords": [