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

Function _run_init

src/specify_cli/commands/bundle/__init__.py:92–125  ·  view source on GitHub ↗

Idempotently scaffold a Spec Kit project here via the existing ``init`` machinery. Reuses the real ``specify init`` command callback in-process (Principle I) with ``--here --force`` so it is non-interactive and merges into the current directory.

(integration: str, *, script_type: str, offline: bool = False)

Source from the content-addressed store, hash-verified

90
91
92def _run_init(integration: str, *, script_type: str, offline: bool = False) -> None:
93 """Idempotently scaffold a Spec Kit project here via the existing ``init`` machinery.
94
95 Reuses the real ``specify init`` command callback in-process (Principle I)
96 with ``--here --force`` so it is non-interactive and merges into the current
97 directory.
98 """
99 from ... import app
100
101 init_cb = next(
102 c.callback
103 for c in app.registered_commands
104 if c.callback and c.callback.__name__ == "init"
105 )
106 try:
107 init_cb(
108 project_name=None,
109 script_type=script_type,
110 ignore_agent_tools=True,
111 here=True,
112 force=True,
113 skip_tls=False,
114 debug=False,
115 github_token=None,
116 offline=offline,
117 preset=None,
118 integration=integration,
119 integration_options=None,
120 )
121 except typer.Exit as exc:
122 if exc.exit_code:
123 raise BundlerError(
124 f"Failed to initialize a Spec Kit project (integration '{integration}')."
125 ) from exc
126
127
128def _resolve_init_integration(override: str | None, manifest) -> str:

Callers 2

bundle_installFunction · 0.70
bundle_initFunction · 0.70

Calls 1

BundlerErrorClass · 0.85

Tested by

no test coverage detected