Skip to content

fix(cli): write the workflow for init --workflow without --ci - #155

Open
KrasimirKralev wants to merge 1 commit into
openclaw:mainfrom
KrasimirKralev:fix/init-workflow-implies-ci
Open

KrasimirKralev wants to merge 1 commit into
openclaw:mainfrom
KrasimirKralev:fix/init-workflow-implies-ci

Conversation

@KrasimirKralev

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: plugin-inspector init --workflow <path> exits 0 and writes no workflow unless --ci is also passed.

  • Problem: runInit reads --workflow, but writePluginInspectorInit only honours it when ci is true. The flag is also missing from --help and the README, so nothing tells the user it depends on --ci.
  • What did NOT change (scope boundary): --ci without --workflow still writes .github/workflows/plugin-inspector.yml, plain init still writes only the config, and writePluginInspectorInit's ci and workflowPath options are unchanged. No workflow content, overwrite protection or report output changed.
  • Requested by a maintainer/owner? No, found by reading the CLI against its help text.

User Impact

A plugin author who runs init --workflow ci/inspect.yml gets the workflow at that path, or a would write ci/inspect.yml line with --dry-run. Before, they saw a clean exit and only learned the file was missing when CI never ran. --workflow now appears in the init usage line and the README.

Behavior note: a command that passed --workflow without --ci used to write only the config and now also writes the workflow. An existing file at that path is protected by the same --force check as --ci.

Why This Change Was Made

  • What changed: runInit treats --workflow as also asking for the workflow (ci: commandArgs.includes("--ci") || commandArgs.includes("--workflow")). The usage line, README and CHANGELOG name the flag.
  • Root cause: src/init.js resolves workflowPath only when options.ci === true, so a path with no ci is dropped without a message.
  • Missing detection / guardrail: the existing init tests always pass --ci. A new test/cli.test.js case runs --workflow without --ci, in dry-run and for real, and asserts the file lands at that path and not at the default path. It fails with the src/cli.js change reverted (1 fail, 5 pass in the init command group) and the full suite is green on the branch (938 of 938).

Evidence

  • Behavior or issue addressed: init --workflow <path> without --ci silently wrote no workflow.
  • Real environment tested: Ubuntu 26.04, Node 24, this checkout, in a scratch plugin directory holding package.json and openclaw.plugin.json.
  • Exact steps or command run after this patch: node src/cli.js init --workflow ci/inspect.yml, then with --dry-run, then node src/cli.js init --help, on base and on this branch.
  • Evidence after fix:
BEFORE (upstream/main 09b4129)
$ node src/cli.js init --workflow ci/inspect.yml
wrote plugin-inspector.config.json
package manager: npm
exit=0
$ find . -type f
./openclaw.plugin.json
./package.json
./plugin-inspector.config.json
$ node src/cli.js init --workflow ci/inspect.yml --dry-run
would write plugin-inspector.config.json
package manager: npm
$ node src/cli.js init --help | grep 'plugin-inspector init'
  plugin-inspector init [--plugin-root <path>] [--config <path>] [--ci] [--scripts] [--package-manager npm|pnpm|yarn|bun] [--dry-run] [--json] [--force]

AFTER (this branch)
$ node src/cli.js init --workflow ci/inspect.yml
wrote plugin-inspector.config.json
wrote ci/inspect.yml
package manager: npm
exit=0
$ find . -type f
./ci/inspect.yml
./openclaw.plugin.json
./package.json
./plugin-inspector.config.json
$ node src/cli.js init --workflow ci/inspect.yml --dry-run
would write plugin-inspector.config.json
would write ci/inspect.yml
package manager: npm
$ node src/cli.js init --help | grep 'plugin-inspector init'
  plugin-inspector init [--plugin-root <path>] [--config <path>] [--ci] [--workflow <path>] [--scripts] [--package-manager npm|pnpm|yarn|bun] [--dry-run] [--json] [--force]
  • Observed result after fix: running node src/cli.js init --workflow ci/inspect.yml now writes the workflow at that path and says so, in both modes; --help lists the flag.
  • Crabpot source-mode run: CRABPOT_PLUGIN_INSPECTOR_CLI=source CRABPOT_PLUGIN_INSPECTOR_DIR=<checkout> npm run plugin-inspector:smoke at crabpot 497e477 with every plugin submodule checked out reports status fail with 35 breakages on both upstream/main and this branch, so this change does not move it. Crabpot's scripts and tests do not call plugin-inspector init.
  • What was not tested: the smoke's other modes (--resources, --retirements, packed package), and running a generated workflow on GitHub Actions; the workflow text is unchanged.
  • Proof limitations or environment constraints: none beyond the above.

@KrasimirKralev
KrasimirKralev requested a review from a team as a code owner November 6, 2026 11:46
@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 6, 2026
@clawsweeper

clawsweeper Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codex review: ready, awaiting a maintainer decision.

What this changes

Makes init --workflow <path> generate a workflow without --ci and documents the flag.

Example: Run plugin-inspector init --workflow ci/inspect.yml.

  • Before: Exits successfully after writing only plugin-inspector.config.json.
  • After: Also writes ci/inspect.yml and reports its path.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused implementation and direct CLI proof are strong; the unresolved owner decision on flag semantics caps the overall rating.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Contributor terminal output exercises src/cli.js init on Ubuntu 26.04 with Node 24, showing ci/inspect.yml created without --ci, the matching dry-run result, and updated help.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: A plugin author supplies a workflow destination, receives a successful exit, and discovers no workflow was written.
Reason: Honoring the explicit path has clear value, but making it a generation switch changes the owner-built --ci contract without recorded approval.

Merge readiness

⏳ Ready, awaiting maintainer decision

This PR addresses a current CLI failure with a focused, correct patch; the area owner should decide whether --workflow should imply workflow generation.

Priority: P2
Reviewed head: fdb9f0fa8b0ca02b526b46df18509f10adf8d73a
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should an explicit --workflow path request workflow generation without --ci?
  • Recommendation: Allow --workflow to imply generation: Approve this focused behavior change so an explicit workflow destination is honored, with existing overwrite protection.
  • Why: The original initializer uses --ci as the generation switch, existing documentation demonstrates that switch, and no owner approval establishes the proposed standalone semantics.

Before merge

None.

Findings

None.

Agent review details

How this fits together

The CLI translates init arguments into the existing initializer, which reads plugin metadata and writes starter config and optional workflow files.

flowchart LR
  A[Plugin author] --> B[Init CLI arguments]
  B --> C[Existing initializer]
  D[Plugin metadata] --> C
  C --> E[Config and workflow files]
  C --> F[Written file summary]
Loading

Technical review

Best possible solution:

Let the init owner choose the standalone --workflow contract, retaining this minimal CLI change if implicit generation is approved.

Do we have a high-confidence way to reproduce the issue?

Current-main source deterministically drops the workflow destination without --ci, and the contributor supplies matching before/after CLI output; no target code was run during this read-only review.

Is this the best way to solve the issue?

The patch is the smallest complete implementation of implicit generation: it changes argument translation while reusing the existing writer, but the owner should approve that semantic choice.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 09b4129b8924.

Provenance checked

  • CLI workflow generation switch changes intended behavior with a stated reason (feat(cli): streamline plugin root checks #10: The plugin-root initializer introduced optional CI generation controlled by --ci, with --workflow passed separately as its destination.)
  • Init help and JSON output keeps the original intent (5c40771: The commit added a machine-readable init summary and documented --json; the PR preserves that output and adds the previously omitted workflow flag.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current-main failure: Current main parses --workflow but enables workflow generation only for --ci; src/init.js resolves the workflow path only when ci is true. (src/cli.js:168, 09b4129b8924)
  • Focused introduced change: The patch changes the CLI boolean and help text, adds documentation, and adds a subprocess regression test covering dry-run, the custom destination, and absence of the default workflow. (test/cli.test.js:408, fdb9f0fa8b0c)
  • Original contract and ownership: The GitHub-verified introduction in feat(cli): streamline plugin root checks #10 added --workflow parsing alongside explicit --ci gating. Subsequent init work added package-manager detection, scripts, dry-run, and JSON output; no retrieved rationale establishes standalone --workflow semantics. A missing historical blob prevented the local introduction diff, but the GitHub commit patch supplied it. (src/cli.js:168, 0fc9697a14cd)
  • Behavior proof and discussion: The full PR body supplies before/after terminal output from Ubuntu 26.04 and Node 24 showing actual workflow creation, dry-run output, and help. It reports a failing regression test with the production change reverted and 938 passing tests afterward. Comments contain bot status only, and no review approves the semantic change. (fdb9f0fa8b0c)
  • Repository policy and existing-state protection: The complete root AGENTS.md applies, with no nested policies or maintainer notes found. The initializer's config format, workflow template, dry-run behavior, and pre-write overwrite checks remain unchanged; the body records the required crabpot smoke comparison. (src/init.js:22, fdb9f0fa8b0c)
  • Consumer smoke boundary: The PR explicitly tests against this consumer, establishing the policy signal. Its root AGENTS.md was read; the smoke invokes report rather than init. The contributor reports identical 35-breakage reports on base and head, so that comparison does not demonstrate a regression from this patch or require changed report expectations. (scripts/run-plugin-inspector-smoke.mjs:23, 497e477988b6)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: A plugin-author CLI command silently ignores an explicit destination, with the existing --ci invocation providing a workaround.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.

Label justifications:

  • P2: A plugin-author CLI command silently ignores an explicit destination, with the existing --ci invocation providing a workaround.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Have the init owner choose whether --workflow should imply workflow generation.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 6, 2026, 7:00 AM ET / 12:00 UTC.

@KrasimirKralev
KrasimirKralev force-pushed the fix/init-workflow-implies-ci branch from fdb9f0f to ae5a2b3 Compare November 14, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant