specify-cli 1.3.2__py3-none-any.whl → 1.3.3__py3-none-any.whl
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.
- specify_cli/core_pack/bundles/catalog.community.json +24 -1
- specify_cli/core_pack/scripts/bash/create-new-feature.sh +1 -1
- specify_cli/integrations/_file_changes.py +112 -1
- specify_cli/integrations/base.py +297 -0
- specify_cli/presets/_manager_skills.py +14 -13
- specify_cli/presets/catalog/command_remove.py +2 -1
- specify_cli/presets/command_info.py +1 -1
- specify_cli/workflows/_execution.py +2 -0
- specify_cli/workflows/base.py +6 -0
- specify_cli/workflows/engine.py +18 -0
- specify_cli/workflows/expressions/engine.py +3 -3
- specify_cli/workflows/expressions/operators.py +25 -6
- specify_cli/workflows/step/_dispatch_settings.py +129 -0
- specify_cli/workflows/step/command/__init__.py +41 -1
- specify_cli/workflows/step/prompt/__init__.py +55 -11
- specify_cli/workflows/step/shell/__init__.py +6 -2
- {specify_cli-1.3.2.dist-info → specify_cli-1.3.3.dist-info}/METADATA +1 -1
- {specify_cli-1.3.2.dist-info → specify_cli-1.3.3.dist-info}/RECORD +21 -20
- {specify_cli-1.3.2.dist-info → specify_cli-1.3.3.dist-info}/WHEEL +0 -0
- {specify_cli-1.3.2.dist-info → specify_cli-1.3.3.dist-info}/entry_points.txt +0 -0
- {specify_cli-1.3.2.dist-info → specify_cli-1.3.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": "1.0",
|
|
3
|
-
"updated_at": "2026-
|
|
3
|
+
"updated_at": "2026-11-09T00:00:00Z",
|
|
4
4
|
"catalog_url": "https://raw.githubusercontent.com/github/spec-kit/main/bundles/catalog.community.json",
|
|
5
5
|
"bundles": {
|
|
6
|
+
"ado": {
|
|
7
|
+
"name": "Spec Kit for Azure DevOps",
|
|
8
|
+
"id": "ado",
|
|
9
|
+
"version": "0.3.1",
|
|
10
|
+
"role": "developer",
|
|
11
|
+
"description": "The ado extension plus the ado-lifecycle workflow: an ADO story to Done with a human gate on every board or PR change.",
|
|
12
|
+
"author": "praveenlavu",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"download_url": "https://github.com/praveenlavu/spec-kit-ado/releases/download/v0.3.1/ado-0.3.1.zip",
|
|
15
|
+
"sha256": "f910adc38010329ecf333126d0843f6a519c003501925b14adb0b23f5f0ae504",
|
|
16
|
+
"repository": "https://github.com/praveenlavu/spec-kit-ado",
|
|
17
|
+
"requires": {
|
|
18
|
+
"speckit_version": ">=1.2.1"
|
|
19
|
+
},
|
|
20
|
+
"provides": {
|
|
21
|
+
"extensions": 1,
|
|
22
|
+
"presets": 0,
|
|
23
|
+
"steps": 0,
|
|
24
|
+
"workflows": 1
|
|
25
|
+
},
|
|
26
|
+
"tags": ["azure-devops", "issue-tracking", "hitl", "workflow", "governance"],
|
|
27
|
+
"verified": false
|
|
28
|
+
},
|
|
6
29
|
"agentstandards": {
|
|
7
30
|
"name": "Agentstandards Multi-Vendor Architecture",
|
|
8
31
|
"id": "agentstandards",
|
|
@@ -88,7 +88,7 @@ if [ -z "$FEATURE_DESCRIPTION" ]; then
|
|
|
88
88
|
fi
|
|
89
89
|
|
|
90
90
|
# Trim whitespace and validate description is not empty (e.g., user passed only whitespace)
|
|
91
|
-
FEATURE_DESCRIPTION=$(
|
|
91
|
+
FEATURE_DESCRIPTION=$(printf '%s\n' "$FEATURE_DESCRIPTION" | sed -E 's/^[[:space:]]+|[[:space:]]+$//g')
|
|
92
92
|
if [ -z "$FEATURE_DESCRIPTION" ]; then
|
|
93
93
|
echo "Error: Feature description cannot be empty or contain only whitespace" >&2
|
|
94
94
|
exit 1
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import errno
|
|
6
|
+
import os
|
|
7
|
+
import stat
|
|
5
8
|
from collections.abc import Callable
|
|
6
|
-
from contextlib import contextmanager
|
|
9
|
+
from contextlib import ExitStack, contextmanager
|
|
7
10
|
from contextvars import ContextVar
|
|
8
11
|
from pathlib import Path
|
|
9
12
|
|
|
@@ -45,3 +48,111 @@ def write_bytes(path: Path, content: bytes) -> int:
|
|
|
45
48
|
def unlink(path: Path, *, missing_ok: bool = False) -> None:
|
|
46
49
|
with changing_file(path, removal=True):
|
|
47
50
|
path.unlink(missing_ok=missing_ok)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def unlink_in_directory(path: Path, *, root: Path) -> None:
|
|
54
|
+
"""Remove a generated file and its empty parent beneath a trusted root."""
|
|
55
|
+
directory = path.absolute().parent
|
|
56
|
+
root = root.absolute()
|
|
57
|
+
try:
|
|
58
|
+
relative = directory.relative_to(root)
|
|
59
|
+
except ValueError:
|
|
60
|
+
return
|
|
61
|
+
if not relative.parts or ".." in relative.parts:
|
|
62
|
+
return
|
|
63
|
+
if (
|
|
64
|
+
getattr(os, "O_DIRECTORY", 0)
|
|
65
|
+
and getattr(os, "O_NOFOLLOW", 0)
|
|
66
|
+
and {os.open, os.unlink, os.rmdir, os.stat} <= os.supports_dir_fd
|
|
67
|
+
and os.listdir in os.supports_fd
|
|
68
|
+
):
|
|
69
|
+
flags = os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW | getattr(os, "O_CLOEXEC", 0)
|
|
70
|
+
with ExitStack() as stack:
|
|
71
|
+
try:
|
|
72
|
+
parent_fd = os.open(root, flags & ~os.O_NOFOLLOW)
|
|
73
|
+
stack.callback(os.close, parent_fd)
|
|
74
|
+
for part in relative.parts[:-1]:
|
|
75
|
+
parent_fd = os.open(part, flags, dir_fd=parent_fd)
|
|
76
|
+
stack.callback(os.close, parent_fd)
|
|
77
|
+
directory_fd = os.open(directory.name, flags, dir_fd=parent_fd)
|
|
78
|
+
stack.callback(os.close, directory_fd)
|
|
79
|
+
except OSError as exc:
|
|
80
|
+
if exc.errno not in (errno.ENOENT, errno.ELOOP, errno.ENOTDIR):
|
|
81
|
+
raise
|
|
82
|
+
return
|
|
83
|
+
with changing_file(path, removal=True):
|
|
84
|
+
try:
|
|
85
|
+
os.unlink(path.name, dir_fd=directory_fd)
|
|
86
|
+
except FileNotFoundError:
|
|
87
|
+
pass
|
|
88
|
+
|
|
89
|
+
def same_directory() -> bool:
|
|
90
|
+
return os.path.samestat(
|
|
91
|
+
os.fstat(directory_fd),
|
|
92
|
+
os.stat(directory.name, dir_fd=parent_fd, follow_symlinks=False),
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
try:
|
|
96
|
+
empty = not os.listdir(directory_fd) and same_directory()
|
|
97
|
+
except (FileNotFoundError, NotADirectoryError):
|
|
98
|
+
return
|
|
99
|
+
if empty:
|
|
100
|
+
before_file_change(path.parent, removal=True)
|
|
101
|
+
try:
|
|
102
|
+
if not same_directory():
|
|
103
|
+
return
|
|
104
|
+
os.rmdir(directory.name, dir_fd=parent_fd)
|
|
105
|
+
except OSError as exc:
|
|
106
|
+
if exc.errno not in (errno.ENOTEMPTY, errno.EEXIST, errno.ENOENT, errno.ENOTDIR):
|
|
107
|
+
raise
|
|
108
|
+
return
|
|
109
|
+
after_file_change(path.parent)
|
|
110
|
+
return
|
|
111
|
+
|
|
112
|
+
# Without dir_fd (notably Windows), re-check before each path-based
|
|
113
|
+
# deletion. This narrows, but cannot eliminate, concurrent swap races.
|
|
114
|
+
def safe_directory() -> os.stat_result | None:
|
|
115
|
+
parent = root
|
|
116
|
+
for part in relative.parts:
|
|
117
|
+
parent = parent / part
|
|
118
|
+
try:
|
|
119
|
+
info = parent.lstat()
|
|
120
|
+
except OSError as exc:
|
|
121
|
+
if exc.errno not in (errno.ENOENT, errno.ELOOP, errno.ENOTDIR):
|
|
122
|
+
raise
|
|
123
|
+
return None
|
|
124
|
+
if not stat.S_ISDIR(info.st_mode) or (
|
|
125
|
+
getattr(info, "st_file_attributes", 0)
|
|
126
|
+
& stat.FILE_ATTRIBUTE_REPARSE_POINT
|
|
127
|
+
):
|
|
128
|
+
return None
|
|
129
|
+
return info
|
|
130
|
+
|
|
131
|
+
original = safe_directory()
|
|
132
|
+
if original is None:
|
|
133
|
+
return
|
|
134
|
+
with changing_file(path, removal=True):
|
|
135
|
+
if safe_directory() is None:
|
|
136
|
+
return
|
|
137
|
+
try:
|
|
138
|
+
path.unlink()
|
|
139
|
+
except FileNotFoundError:
|
|
140
|
+
pass
|
|
141
|
+
try:
|
|
142
|
+
empty = not any(directory.iterdir())
|
|
143
|
+
except OSError as exc:
|
|
144
|
+
if exc.errno not in (errno.ENOENT, errno.ELOOP, errno.ENOTDIR):
|
|
145
|
+
raise
|
|
146
|
+
return
|
|
147
|
+
if empty:
|
|
148
|
+
before_file_change(path.parent, removal=True)
|
|
149
|
+
current = safe_directory()
|
|
150
|
+
if current is None or not os.path.samestat(original, current):
|
|
151
|
+
return
|
|
152
|
+
try:
|
|
153
|
+
directory.rmdir()
|
|
154
|
+
except OSError as exc:
|
|
155
|
+
if exc.errno not in (errno.ENOTEMPTY, errno.EEXIST, errno.ENOENT, errno.ENOTDIR):
|
|
156
|
+
raise
|
|
157
|
+
return
|
|
158
|
+
after_file_change(path.parent)
|
specify_cli/integrations/base.py
CHANGED
|
@@ -80,6 +80,217 @@ def resolve_registrar_config(integration: IntegrationBase) -> dict[str, Any]:
|
|
|
80
80
|
return config
|
|
81
81
|
|
|
82
82
|
|
|
83
|
+
# ---------------------------------------------------------------------------
|
|
84
|
+
# Per-step dispatch settings
|
|
85
|
+
# ---------------------------------------------------------------------------
|
|
86
|
+
|
|
87
|
+
#: Settings a workflow ``command``/``prompt`` step can request for one CLI
|
|
88
|
+
#: invocation, in the order they are checked. Values are opaque strings that an
|
|
89
|
+
#: integration translates into its CLI's own arguments; see
|
|
90
|
+
#: :func:`check_dispatch_settings`.
|
|
91
|
+
DISPATCH_SETTINGS: tuple[str, ...] = ("reasoning_effort", "context_size")
|
|
92
|
+
|
|
93
|
+
_DISPATCH_PATHS = ("dispatch_command", "build_exec_args")
|
|
94
|
+
|
|
95
|
+
# One argv-safe token: no leading "-", whitespace, control characters or shell
|
|
96
|
+
# metacharacters (relevant to Windows ``.cmd`` shims), without restricting any
|
|
97
|
+
# integration's vocabulary.
|
|
98
|
+
_DISPATCH_SETTING_VALUE = re.compile(r"[A-Za-z0-9][A-Za-z0-9._-]{0,63}")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class DispatchSettingsError(ValueError):
|
|
102
|
+
"""A per-step dispatch setting is malformed or unsupported.
|
|
103
|
+
|
|
104
|
+
``setting`` names the offending setting when known, so a workflow step can
|
|
105
|
+
report where its value came from.
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
def __init__(self, message: str, *, setting: str | None = None) -> None:
|
|
109
|
+
super().__init__(message)
|
|
110
|
+
self.setting = setting
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def requested_dispatch_settings(
|
|
114
|
+
*, reasoning_effort: str | None = None, context_size: str | None = None
|
|
115
|
+
) -> dict[str, Any]:
|
|
116
|
+
"""Return the settings that were passed (``is not None``) in check order."""
|
|
117
|
+
values = {"reasoning_effort": reasoning_effort, "context_size": context_size}
|
|
118
|
+
return {
|
|
119
|
+
name: values[name] for name in DISPATCH_SETTINGS if values[name] is not None
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def dispatch_setting_value_error(
|
|
124
|
+
name: str, value: object, *, from_expression: bool = False
|
|
125
|
+
) -> str | None:
|
|
126
|
+
"""Return why *value* is not a valid *name* setting, or ``None`` if it is.
|
|
127
|
+
|
|
128
|
+
*from_expression* marks a value that a workflow expression produced, so a
|
|
129
|
+
non-string gets advice about the expression instead of YAML quoting. A
|
|
130
|
+
malformed value can come from untrusted expression results (for example
|
|
131
|
+
captured agent output, which Spec Kit does not print or log), so the
|
|
132
|
+
message reports only the value's type and length, never its text.
|
|
133
|
+
"""
|
|
134
|
+
if not isinstance(value, str):
|
|
135
|
+
type_name = type(value).__name__
|
|
136
|
+
if from_expression:
|
|
137
|
+
return (
|
|
138
|
+
f"'{name}' must be a string, but its expression resolved to "
|
|
139
|
+
f"{type_name}; make it resolve to a string, for example by "
|
|
140
|
+
"reading an input declared with type: string."
|
|
141
|
+
)
|
|
142
|
+
return (
|
|
143
|
+
f"'{name}' must be a string, got {type_name}; quote YAML values "
|
|
144
|
+
"such as 200000, on, or off."
|
|
145
|
+
)
|
|
146
|
+
if _DISPATCH_SETTING_VALUE.fullmatch(value) is None:
|
|
147
|
+
return (
|
|
148
|
+
f"'{name}' must be 1-64 letters, digits, '.', '_', or '-' starting "
|
|
149
|
+
f"with a letter or digit, got a string of length {len(value)}."
|
|
150
|
+
)
|
|
151
|
+
return None
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _defining_class(cls: type, attribute: str) -> type | None:
|
|
155
|
+
for klass in cls.__mro__:
|
|
156
|
+
if attribute in vars(klass):
|
|
157
|
+
return klass
|
|
158
|
+
return None
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _receiving_method(integration: IntegrationBase, via: str) -> str:
|
|
162
|
+
if via not in _DISPATCH_PATHS:
|
|
163
|
+
raise ValueError(f"Unknown dispatch path {via!r}.")
|
|
164
|
+
if (
|
|
165
|
+
via == "dispatch_command"
|
|
166
|
+
and _defining_class(type(integration), "dispatch_command")
|
|
167
|
+
is not IntegrationBase
|
|
168
|
+
):
|
|
169
|
+
return "dispatch_command"
|
|
170
|
+
return "build_exec_args"
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def effective_dispatch_settings(
|
|
174
|
+
integration: IntegrationBase, *, via: str = "build_exec_args"
|
|
175
|
+
) -> frozenset[str]:
|
|
176
|
+
"""Return the dispatch settings *integration* translates on path *via*.
|
|
177
|
+
|
|
178
|
+
Support counts only when declared on the class that implements the method
|
|
179
|
+
receiving the settings: ``dispatch_command`` when *via* is
|
|
180
|
+
``"dispatch_command"`` and the integration overrides it, otherwise
|
|
181
|
+
``build_exec_args``. A subclass that replaces that method must declare
|
|
182
|
+
``supported_dispatch_settings`` itself, so an inherited declaration never
|
|
183
|
+
vouches for code that does not translate the settings. A declaration that
|
|
184
|
+
is not a set or frozenset declares nothing.
|
|
185
|
+
"""
|
|
186
|
+
owner = _defining_class(type(integration), _receiving_method(integration, via))
|
|
187
|
+
if owner is None:
|
|
188
|
+
return frozenset()
|
|
189
|
+
declared = vars(owner).get("supported_dispatch_settings")
|
|
190
|
+
if not isinstance(declared, (set, frozenset)):
|
|
191
|
+
return frozenset()
|
|
192
|
+
return frozenset(name for name in DISPATCH_SETTINGS if name in declared)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def _accepts_keyword(function: Any, name: str) -> bool:
|
|
196
|
+
import inspect
|
|
197
|
+
|
|
198
|
+
try:
|
|
199
|
+
parameters = inspect.signature(function).parameters
|
|
200
|
+
except (TypeError, ValueError):
|
|
201
|
+
return False
|
|
202
|
+
if any(
|
|
203
|
+
parameter.kind is inspect.Parameter.VAR_KEYWORD
|
|
204
|
+
for parameter in parameters.values()
|
|
205
|
+
):
|
|
206
|
+
return True
|
|
207
|
+
parameter = parameters.get(name)
|
|
208
|
+
return parameter is not None and parameter.kind in (
|
|
209
|
+
inspect.Parameter.POSITIONAL_OR_KEYWORD,
|
|
210
|
+
inspect.Parameter.KEYWORD_ONLY,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def _dispatch_setting_supporters(name: str, via: str) -> list[str]:
|
|
215
|
+
from . import INTEGRATION_REGISTRY
|
|
216
|
+
from .installer import dispatch_registry
|
|
217
|
+
|
|
218
|
+
registry = dispatch_registry.get()
|
|
219
|
+
if registry is None:
|
|
220
|
+
registry = INTEGRATION_REGISTRY
|
|
221
|
+
return sorted(
|
|
222
|
+
key
|
|
223
|
+
for key, candidate in registry.items()
|
|
224
|
+
if name in effective_dispatch_settings(candidate, via=via)
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def _unsupported_dispatch_setting_message(
|
|
229
|
+
integration: IntegrationBase, name: str, via: str
|
|
230
|
+
) -> str:
|
|
231
|
+
message = f"Integration {integration.key!r} does not support per-step '{name}'."
|
|
232
|
+
hint = integration.dispatch_setting_hint(name)
|
|
233
|
+
if isinstance(hint, str) and hint.strip():
|
|
234
|
+
message = f"{message} {hint.strip()}"
|
|
235
|
+
supporters = _dispatch_setting_supporters(name, via)
|
|
236
|
+
if supporters:
|
|
237
|
+
message = (
|
|
238
|
+
f"{message} Integrations that support it: {', '.join(supporters)}."
|
|
239
|
+
)
|
|
240
|
+
else:
|
|
241
|
+
message = f"{message} No available integration supports it."
|
|
242
|
+
return (
|
|
243
|
+
f"{message} Remove the setting from this step (and from the workflow "
|
|
244
|
+
"defaults it inherits), or dispatch the step to a supporting integration."
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def check_dispatch_settings(
|
|
249
|
+
integration: IntegrationBase, settings: Mapping[str, Any], *, via: str
|
|
250
|
+
) -> None:
|
|
251
|
+
"""Gate requested per-step dispatch settings before anything is executed.
|
|
252
|
+
|
|
253
|
+
Every dispatch path calls this host-owned check when at least one setting
|
|
254
|
+
is requested; integrations add value rules through
|
|
255
|
+
:meth:`IntegrationBase.validate_dispatch_setting` but cannot bypass it.
|
|
256
|
+
*via* names the integration method the settings are dispatched through
|
|
257
|
+
(``"dispatch_command"`` or ``"build_exec_args"``). Settings are checked in
|
|
258
|
+
``DISPATCH_SETTINGS`` order, and every failure raises
|
|
259
|
+
:class:`DispatchSettingsError` naming the setting.
|
|
260
|
+
"""
|
|
261
|
+
receiver = _receiving_method(integration, via)
|
|
262
|
+
unknown = sorted(set(settings) - set(DISPATCH_SETTINGS))
|
|
263
|
+
if unknown:
|
|
264
|
+
raise ValueError(f"Unknown dispatch settings: {', '.join(unknown)}.")
|
|
265
|
+
supported = effective_dispatch_settings(integration, via=via)
|
|
266
|
+
for name in DISPATCH_SETTINGS:
|
|
267
|
+
value = settings.get(name)
|
|
268
|
+
if value is None:
|
|
269
|
+
continue
|
|
270
|
+
problem = dispatch_setting_value_error(name, value)
|
|
271
|
+
if problem is not None:
|
|
272
|
+
raise DispatchSettingsError(problem, setting=name)
|
|
273
|
+
if name not in supported:
|
|
274
|
+
raise DispatchSettingsError(
|
|
275
|
+
_unsupported_dispatch_setting_message(integration, name, via),
|
|
276
|
+
setting=name,
|
|
277
|
+
)
|
|
278
|
+
if not _accepts_keyword(getattr(integration, receiver), name):
|
|
279
|
+
raise DispatchSettingsError(
|
|
280
|
+
f"Integration {integration.key!r} declares per-step '{name}' "
|
|
281
|
+
f"support, but its {receiver}() does not accept '{name}'.",
|
|
282
|
+
setting=name,
|
|
283
|
+
)
|
|
284
|
+
try:
|
|
285
|
+
integration.validate_dispatch_setting(name, value)
|
|
286
|
+
except DispatchSettingsError as exc:
|
|
287
|
+
if exc.setting is None:
|
|
288
|
+
exc.setting = name
|
|
289
|
+
raise
|
|
290
|
+
except ValueError as exc:
|
|
291
|
+
raise DispatchSettingsError(str(exc), setting=name) from exc
|
|
292
|
+
|
|
293
|
+
|
|
83
294
|
# ---------------------------------------------------------------------------
|
|
84
295
|
# IntegrationOption
|
|
85
296
|
# ---------------------------------------------------------------------------
|
|
@@ -151,6 +362,15 @@ class IntegrationBase(ABC):
|
|
|
151
362
|
and command directory. Registry tests enforce these invariants.
|
|
152
363
|
"""
|
|
153
364
|
|
|
365
|
+
supported_dispatch_settings: frozenset[str] = frozenset()
|
|
366
|
+
"""Per-step dispatch settings (``DISPATCH_SETTINGS``) this integration translates.
|
|
367
|
+
|
|
368
|
+
Declare support on the class that implements the method receiving the
|
|
369
|
+
settings (``build_exec_args``, or ``dispatch_command`` when overridden), and
|
|
370
|
+
translate every declared setting there; inherited declarations only cover
|
|
371
|
+
inherited implementations (see :func:`effective_dispatch_settings`).
|
|
372
|
+
"""
|
|
373
|
+
|
|
154
374
|
legacy_flat_command_dir: str | None = None
|
|
155
375
|
"""Previous flat command directory retired after skill replacements exist."""
|
|
156
376
|
|
|
@@ -277,6 +497,8 @@ class IntegrationBase(ABC):
|
|
|
277
497
|
integration_args: Sequence[str] | None = None,
|
|
278
498
|
integration_options: Mapping[str, Any] | None = None,
|
|
279
499
|
project_root: Path | None = None,
|
|
500
|
+
reasoning_effort: str | None = None,
|
|
501
|
+
context_size: str | None = None,
|
|
280
502
|
) -> list[str] | None:
|
|
281
503
|
"""Build CLI arguments for non-interactive execution.
|
|
282
504
|
|
|
@@ -285,10 +507,57 @@ class IntegrationBase(ABC):
|
|
|
285
507
|
if the integration does not support CLI dispatch.
|
|
286
508
|
|
|
287
509
|
Subclasses for CLI-based integrations should override this.
|
|
510
|
+
*reasoning_effort* and *context_size* are passed only when a workflow
|
|
511
|
+
step requests them and only to integrations that declare them in
|
|
512
|
+
``supported_dispatch_settings``; this implementation translates
|
|
513
|
+
neither and rejects both.
|
|
288
514
|
"""
|
|
289
515
|
self.validate_runtime_config(integration_args, integration_options)
|
|
516
|
+
self._reject_untranslated_dispatch_settings(
|
|
517
|
+
reasoning_effort=reasoning_effort, context_size=context_size
|
|
518
|
+
)
|
|
290
519
|
return None
|
|
291
520
|
|
|
521
|
+
def validate_dispatch_setting(self, name: str, value: str) -> None:
|
|
522
|
+
"""Validate one requested dispatch setting value for this integration.
|
|
523
|
+
|
|
524
|
+
Called by :func:`check_dispatch_settings` for each supported setting
|
|
525
|
+
after the host's own checks. Values are opaque by default; override to
|
|
526
|
+
reject values the CLI would ignore or misread, raising ``ValueError``.
|
|
527
|
+
Keep *value* out of the message: it can come from captured agent
|
|
528
|
+
output, which Spec Kit does not print or log.
|
|
529
|
+
"""
|
|
530
|
+
|
|
531
|
+
def dispatch_setting_hint(self, setting: str) -> str | None:
|
|
532
|
+
"""Return remediation text for an unsupported *setting*, or ``None``."""
|
|
533
|
+
return None
|
|
534
|
+
|
|
535
|
+
def _reject_untranslated_dispatch_settings(
|
|
536
|
+
self,
|
|
537
|
+
*,
|
|
538
|
+
reasoning_effort: str | None = None,
|
|
539
|
+
context_size: str | None = None,
|
|
540
|
+
) -> None:
|
|
541
|
+
"""Fail when dispatch settings reach a builder that does not translate them.
|
|
542
|
+
|
|
543
|
+
Builders that do translate settings consume them before delegating to
|
|
544
|
+
``super().build_exec_args()``; reaching a generic builder therefore
|
|
545
|
+
means the settings would be silently dropped.
|
|
546
|
+
"""
|
|
547
|
+
requested = requested_dispatch_settings(
|
|
548
|
+
reasoning_effort=reasoning_effort, context_size=context_size
|
|
549
|
+
)
|
|
550
|
+
if not requested:
|
|
551
|
+
return
|
|
552
|
+
names = ", ".join(f"'{name}'" for name in requested)
|
|
553
|
+
raise DispatchSettingsError(
|
|
554
|
+
f"Integration {self.key!r} does not translate per-step {names}. "
|
|
555
|
+
"Declare supported_dispatch_settings on the class that implements "
|
|
556
|
+
"build_exec_args() and consume the settings there instead of "
|
|
557
|
+
"passing them to a base implementation.",
|
|
558
|
+
setting=next(iter(requested)),
|
|
559
|
+
)
|
|
560
|
+
|
|
292
561
|
def validate_runtime_config(
|
|
293
562
|
self,
|
|
294
563
|
integration_args: Sequence[str] | None = None,
|
|
@@ -434,6 +703,8 @@ class IntegrationBase(ABC):
|
|
|
434
703
|
integration_options: Mapping[str, Any] | None = None,
|
|
435
704
|
output_json: bool | None = None,
|
|
436
705
|
capture_max_bytes: int | None = None,
|
|
706
|
+
reasoning_effort: str | None = None,
|
|
707
|
+
context_size: str | None = None,
|
|
437
708
|
) -> dict[str, Any]:
|
|
438
709
|
"""Dispatch a Spec Kit command through this integration's CLI.
|
|
439
710
|
|
|
@@ -465,6 +736,11 @@ class IntegrationBase(ABC):
|
|
|
465
736
|
``None`` (the default) keeps the unbounded capture, which raises
|
|
466
737
|
``subprocess.TimeoutExpired``.
|
|
467
738
|
|
|
739
|
+
*reasoning_effort* and *context_size* are per-step dispatch
|
|
740
|
+
settings. When either is passed, :func:`check_dispatch_settings`
|
|
741
|
+
validates it first and only the passed settings are forwarded to
|
|
742
|
+
``build_exec_args()``, so builders that predate them keep working.
|
|
743
|
+
|
|
468
744
|
Returns a dict with ``exit_code``, ``stdout``, and ``stderr``.
|
|
469
745
|
Raises ``NotImplementedError`` if the integration does not
|
|
470
746
|
support CLI dispatch.
|
|
@@ -475,6 +751,11 @@ class IntegrationBase(ABC):
|
|
|
475
751
|
raise ValueError("capture_max_bytes requires stream=False.")
|
|
476
752
|
|
|
477
753
|
self.validate_runtime_config(integration_args, integration_options)
|
|
754
|
+
dispatch_settings = requested_dispatch_settings(
|
|
755
|
+
reasoning_effort=reasoning_effort, context_size=context_size
|
|
756
|
+
)
|
|
757
|
+
if dispatch_settings:
|
|
758
|
+
check_dispatch_settings(self, dispatch_settings, via="build_exec_args")
|
|
478
759
|
prompt = self._build_dispatch_prompt(command_name, args, project_root)
|
|
479
760
|
# When streaming to the terminal, request text output so the
|
|
480
761
|
# user sees readable output instead of raw JSONL events.
|
|
@@ -487,6 +768,7 @@ class IntegrationBase(ABC):
|
|
|
487
768
|
integration_args=integration_args,
|
|
488
769
|
integration_options=integration_options,
|
|
489
770
|
project_root=project_root,
|
|
771
|
+
**dispatch_settings,
|
|
490
772
|
)
|
|
491
773
|
|
|
492
774
|
if exec_args is None:
|
|
@@ -1190,8 +1472,13 @@ class MarkdownIntegration(IntegrationBase):
|
|
|
1190
1472
|
integration_args: Sequence[str] | None = None,
|
|
1191
1473
|
integration_options: Mapping[str, Any] | None = None,
|
|
1192
1474
|
project_root: Path | None = None,
|
|
1475
|
+
reasoning_effort: str | None = None,
|
|
1476
|
+
context_size: str | None = None,
|
|
1193
1477
|
) -> list[str] | None:
|
|
1194
1478
|
self.validate_runtime_config(integration_args, integration_options)
|
|
1479
|
+
self._reject_untranslated_dispatch_settings(
|
|
1480
|
+
reasoning_effort=reasoning_effort, context_size=context_size
|
|
1481
|
+
)
|
|
1195
1482
|
if not self.config or not self.config.get("requires_cli"):
|
|
1196
1483
|
return None
|
|
1197
1484
|
args = [self._resolve_executable(), "-p", prompt]
|
|
@@ -1286,8 +1573,13 @@ class TomlIntegration(IntegrationBase):
|
|
|
1286
1573
|
integration_args: Sequence[str] | None = None,
|
|
1287
1574
|
integration_options: Mapping[str, Any] | None = None,
|
|
1288
1575
|
project_root: Path | None = None,
|
|
1576
|
+
reasoning_effort: str | None = None,
|
|
1577
|
+
context_size: str | None = None,
|
|
1289
1578
|
) -> list[str] | None:
|
|
1290
1579
|
self.validate_runtime_config(integration_args, integration_options)
|
|
1580
|
+
self._reject_untranslated_dispatch_settings(
|
|
1581
|
+
reasoning_effort=reasoning_effort, context_size=context_size
|
|
1582
|
+
)
|
|
1291
1583
|
if not self.config or not self.config.get("requires_cli"):
|
|
1292
1584
|
return None
|
|
1293
1585
|
args = [self._resolve_executable(), "-p", prompt]
|
|
@@ -1761,8 +2053,13 @@ class SkillsIntegration(IntegrationBase):
|
|
|
1761
2053
|
integration_args: Sequence[str] | None = None,
|
|
1762
2054
|
integration_options: Mapping[str, Any] | None = None,
|
|
1763
2055
|
project_root: Path | None = None,
|
|
2056
|
+
reasoning_effort: str | None = None,
|
|
2057
|
+
context_size: str | None = None,
|
|
1764
2058
|
) -> list[str] | None:
|
|
1765
2059
|
self.validate_runtime_config(integration_args, integration_options)
|
|
2060
|
+
self._reject_untranslated_dispatch_settings(
|
|
2061
|
+
reasoning_effort=reasoning_effort, context_size=context_size
|
|
2062
|
+
)
|
|
1766
2063
|
if not self.config or not self.config.get("requires_cli"):
|
|
1767
2064
|
return None
|
|
1768
2065
|
args = [self._resolve_executable(), "-p", prompt]
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import copy
|
|
4
4
|
import os
|
|
5
|
-
import shutil
|
|
6
5
|
from pathlib import Path
|
|
7
6
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Union
|
|
8
7
|
|
|
@@ -216,7 +215,7 @@ class _PresetSkillMethods:
|
|
|
216
215
|
managed_skill_names if managed_names is None else managed_names
|
|
217
216
|
)
|
|
218
217
|
# Restore skills for commands whose winner is non-preset.
|
|
219
|
-
# _unregister_skills_in_dir can
|
|
218
|
+
# _unregister_skills_in_dir can remove the skill file, so
|
|
220
219
|
# overrides must be handled directly (create dir + write)
|
|
221
220
|
# without that call.
|
|
222
221
|
dir_core_ext_names = [
|
|
@@ -1275,11 +1274,12 @@ class _PresetSkillMethods:
|
|
|
1275
1274
|
if override_source:
|
|
1276
1275
|
owned_sources.add(override_source)
|
|
1277
1276
|
if source in owned_sources:
|
|
1278
|
-
from ..integrations._file_changes import
|
|
1277
|
+
from ..integrations._file_changes import unlink_in_directory
|
|
1279
1278
|
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1279
|
+
unlink_in_directory(
|
|
1280
|
+
skill_file,
|
|
1281
|
+
root=self.project_root if skill_file.is_relative_to(self.project_root) else skills_dir,
|
|
1282
|
+
)
|
|
1283
1283
|
|
|
1284
1284
|
@staticmethod
|
|
1285
1285
|
def _warn_unrestored_skill(
|
|
@@ -1370,7 +1370,7 @@ class _PresetSkillMethods:
|
|
|
1370
1370
|
# is_dir() follows symlinks, so a symlinked skill subdirectory
|
|
1371
1371
|
# (with a safe, non-symlinked parent) would otherwise slip past
|
|
1372
1372
|
# _safe_skills_dir_for_agent's parent-only check and have
|
|
1373
|
-
#
|
|
1373
|
+
# writes/removals operate through it (#2948).
|
|
1374
1374
|
if not self._validate_skill_subdir(
|
|
1375
1375
|
skill_subdir, create=False, skills_root=skills_dir
|
|
1376
1376
|
):
|
|
@@ -1435,7 +1435,7 @@ class _PresetSkillMethods:
|
|
|
1435
1435
|
# source cannot produce restored content, so leave the
|
|
1436
1436
|
# existing skill untouched rather than leaking a raw
|
|
1437
1437
|
# OSError/UnicodeDecodeError out of `preset remove` — and
|
|
1438
|
-
# rather than falling through to the
|
|
1438
|
+
# rather than falling through to the removal below, which
|
|
1439
1439
|
# would delete a skill precisely when its replacement
|
|
1440
1440
|
# cannot be generated. Matches the `continue` guards above
|
|
1441
1441
|
# (unsafe name, missing subdir, foreign owner), which also
|
|
@@ -1541,12 +1541,13 @@ class _PresetSkillMethods:
|
|
|
1541
1541
|
_write_shared_text(skills_dir, skill_file, skill_content)
|
|
1542
1542
|
mutated_names.append(skill_name)
|
|
1543
1543
|
else:
|
|
1544
|
-
# No core or extension template — remove the
|
|
1545
|
-
from ..integrations._file_changes import
|
|
1544
|
+
# No core or extension template — remove only the generated file
|
|
1545
|
+
from ..integrations._file_changes import unlink_in_directory
|
|
1546
1546
|
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1547
|
+
unlink_in_directory(
|
|
1548
|
+
skill_file,
|
|
1549
|
+
root=self.project_root if skill_file.is_relative_to(self.project_root) else skills_dir,
|
|
1550
|
+
)
|
|
1550
1551
|
mutated_names.append(skill_name)
|
|
1551
1552
|
|
|
1552
1553
|
return mutated_names
|
|
@@ -72,5 +72,6 @@ def preset_catalog_remove(
|
|
|
72
72
|
console.print(f"[green]✓[/green] Removed catalog '{safe_name}'")
|
|
73
73
|
if not catalogs:
|
|
74
74
|
console.print(
|
|
75
|
-
"\n[dim]No catalogs remain
|
|
75
|
+
"\n[dim]No project catalogs remain. The CLI will check the environment "
|
|
76
|
+
"override, user configuration, then built-in defaults.[/dim]"
|
|
76
77
|
)
|
|
@@ -113,7 +113,7 @@ def preset_info(
|
|
|
113
113
|
|
|
114
114
|
if not pack_info:
|
|
115
115
|
console.print(
|
|
116
|
-
f"[red]Error:[/red] Preset '{
|
|
116
|
+
f"[red]Error:[/red] Preset '{safe_preset_id}' not found (not installed and not in catalog)"
|
|
117
117
|
)
|
|
118
118
|
raise typer.Exit(1)
|
|
119
119
|
|
|
@@ -382,6 +382,8 @@ def child_context_for_call(parent, binding, definition):
|
|
|
382
382
|
default_integration=definition.default_integration,
|
|
383
383
|
default_model=definition.default_model,
|
|
384
384
|
default_options=definition.default_options,
|
|
385
|
+
default_reasoning_effort=definition.default_reasoning_effort,
|
|
386
|
+
default_context_size=definition.default_context_size,
|
|
385
387
|
)
|
|
386
388
|
|
|
387
389
|
|
specify_cli/workflows/base.py
CHANGED
|
@@ -83,6 +83,12 @@ class StepContext:
|
|
|
83
83
|
#: Source directory of the workflow definition file.
|
|
84
84
|
workflow_dir: str | None = None
|
|
85
85
|
|
|
86
|
+
#: Workflow-level default reasoning effort.
|
|
87
|
+
default_reasoning_effort: str | None = None
|
|
88
|
+
|
|
89
|
+
#: Workflow-level default context size.
|
|
90
|
+
default_context_size: str | None = None
|
|
91
|
+
|
|
86
92
|
|
|
87
93
|
@dataclass
|
|
88
94
|
class StepResult:
|