MCPcopy Index your code
hub / github.com/github/spec-kit / InitStep

Class InitStep

src/specify_cli/workflows/steps/init/__init__.py:28–309  ·  view source on GitHub ↗

Bootstrap a project, equivalent to running ``specify init``. The step runs the bundled ``specify init`` command non-interactively, scaffolding templates, scripts, shared infrastructure, and the selected coding agent integration into the target directory. Because workflows run unatt

Source from the content-addressed store, hash-verified

26
27
28class InitStep(StepBase):
29 """Bootstrap a project, equivalent to running ``specify init``.
30
31 The step runs the bundled ``specify init`` command non-interactively,
32 scaffolding templates, scripts, shared infrastructure, and the
33 selected coding agent integration into the target directory.
34
35 Because workflows run unattended, the step defaults to
36 ``--ignore-agent-tools`` (skip checks for an installed agent CLI) and
37 resolves the integration from the step config, falling back to the
38 workflow-level default integration.
39
40 Example YAML::
41
42 - id: bootstrap
43 type: init
44 here: true
45 integration: copilot
46 script: sh
47
48 Supported config fields (all optional):
49
50 ``project``
51 Project name or path to create. Use ``"."`` for the current
52 directory. Ignored when ``here`` is truthy.
53 ``here``
54 Initialize in the target directory instead of creating a new one.
55 ``integration``
56 Integration key (e.g. ``copilot``). Defaults to the workflow's
57 default integration, then to ``DEFAULT_INIT_INTEGRATION``.
58 ``integration_options``
59 Extra options for the integration (e.g. ``"--skills"`` or
60 ``"--commands-dir .myagent/cmds"``).
61 ``script``
62 Script type, ``sh`` or ``ps``.
63 ``force``
64 Merge/overwrite without confirmation when the directory is not
65 empty.
66 ``ignore_agent_tools``
67 Skip checks for the coding agent CLI (defaults to ``true``).
68 ``preset``
69 Preset ID to install during initialization.
70 """
71
72 type_key = "init"
73
74 def execute(self, config: dict[str, Any], context: StepContext) -> StepResult:
75 project = self._resolve(config.get("project"), context)
76 here = self._resolve_bool(config.get("here"), context)
77
78 integration = self._resolve(config.get("integration"), context)
79 if not integration:
80 integration = self._resolve(context.default_integration, context)
81 # Apply the same default that specify init uses in non-interactive mode
82 # so that output.integration reflects the actual integration used.
83 if not integration:
84 integration = DEFAULT_INIT_INTEGRATION
85

Calls

no outgoing calls