Skip to content

Allow specify workflow run to execute YAML files without a project#2825

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/allow-post-init-workflow-execution
Draft

Allow specify workflow run to execute YAML files without a project#2825
Copilot wants to merge 4 commits into
mainfrom
copilot/allow-post-init-workflow-execution

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 2, 2026

Makes specify workflow run ./myworkflow.yml work without requiring a .specify/ project directory. When the source argument is a YAML file path that exists on disk, the current working directory is used as the project root. When running by workflow ID, the existing project requirement is preserved.

specify workflow run ./myinit.yml
specify workflow run /path/to/setup.yml

Changes

  • src/specify_cli/__init__.py: Modified the workflow_run command to detect when the source is an existing YAML file and skip the .specify/ project requirement, using cwd as the project root instead.
  • tests/test_workflow_run_without_project.py: Tests for running a YAML workflow without a project, verifying workflow ID still requires a project, handling missing YAML files, and reporting failure status.

Copilot AI requested review from Copilot and removed request for Copilot June 2, 2026 22:59
Copilot AI linked an issue Jun 2, 2026 that may be closed by this pull request
Copilot AI requested review from Copilot and removed request for Copilot June 2, 2026 23:03
Copilot AI requested review from Copilot and removed request for Copilot June 2, 2026 23:05
Copilot AI changed the title [WIP] Add support for --workflow input-file.yml in initialization Add --workflow option to init for post-bootstrap workflow execution Jun 2, 2026
Copilot finished work on behalf of mnriem June 2, 2026 23:05
Copilot AI requested a review from mnriem June 2, 2026 23:05
Copy link
Copy Markdown
Collaborator

@mnriem mnriem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Instead of adding --workflow to the init command can we make it so that specify workflow run ./myworkflow.yml can run without a project?

Instead of adding --workflow to init, make `specify workflow run ./file.yml`
work without requiring a .specify/ project directory. When the source is a
YAML file that exists on disk, cwd is used as the project root. When it's a
workflow ID, the .specify/ project requirement is preserved.
Copilot AI requested review from Copilot and removed request for Copilot June 3, 2026 13:44
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 3, 2026

@copilot Instead of adding --workflow to the init command can we make it so that specify workflow run ./myworkflow.yml can run without a project?

Done in 08d21cf. Removed the --workflow flag from init and instead modified specify workflow run to work without a .specify/ project directory when given a YAML file path directly. Running by workflow ID still requires a project.

Usage: specify workflow run ./myworkflow.yml

Copilot AI changed the title Add --workflow option to init for post-bootstrap workflow execution Allow specify workflow run to execute YAML files without a project Jun 3, 2026
Copilot finished work on behalf of mnriem June 3, 2026 13:46
Copilot AI requested a review from mnriem June 3, 2026 13:46
@mnriem mnriem requested a review from Copilot June 3, 2026 18:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the specify workflow run CLI to support running a local workflow YAML file even when the current directory is not an initialized Spec Kit project (i.e., no .specify/ directory). This aligns the CLI with the documented ability to run workflows from local YAML paths, while preserving the existing “project required” behavior when running by workflow ID.

Changes:

  • Detect when source is an existing .yml/.yaml file and use cwd as the workflow engine project root without calling _require_specify_project().
  • Add pytest coverage verifying local YAML execution works without a project, while workflow IDs still require a project.
  • Add test coverage for missing YAML paths and a failing YAML workflow run.
Show a summary per file
File Description
src/specify_cli/init.py Makes workflow run skip the .specify/ project requirement when source is an existing YAML file path.
tests/test_workflow_run_without_project.py Adds regression tests for running a YAML workflow outside a project and for related edge cases.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 3

Comment on lines +2730 to +2732
source_path = Path(source)
is_file_source = source_path.suffix in (".yml", ".yaml") and source_path.exists()

Comment on lines +2733 to +2738
if is_file_source:
# When running a YAML file directly, use cwd as project root
# without requiring a .specify/ project directory.
project_root = Path.cwd()
else:
project_root = _require_specify_project()
], catch_exceptions=False)
finally:
os.chdir(old_cwd)
assert "failed" in result.output.lower()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow a post init workflow execution

3 participants