Skip to content

Commit 2f1ff5a

Browse files
authored
Merge pull request #202 from alex-feel/alex-feel-dev
Add support for always thinking enabled and correct some messages
2 parents 166b6d9 + bfe36cf commit 2f1ff5a

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

scripts/setup_environment.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2549,6 +2549,11 @@ def process_skill(
25492549

25502550
# Destination preserves relative path structure (e.g., scripts/fill_form.py)
25512551
destination = skill_dir / file_path
2552+
2553+
# Check if destination already exists (consistent with handle_resource)
2554+
if destination.exists():
2555+
info(f' File already exists: {file_path} (overwriting)')
2556+
25522557
destination.parent.mkdir(parents=True, exist_ok=True)
25532558

25542559
# Build source path
@@ -3083,6 +3088,7 @@ def create_additional_settings(
30833088
permissions: dict[str, Any] | None = None,
30843089
env: dict[str, str] | None = None,
30853090
include_co_authored_by: bool | None = None,
3091+
always_thinking_enabled: bool | None = None,
30863092
) -> bool:
30873093
"""Create {command_name}-additional-settings.json with environment-specific settings.
30883094
@@ -3097,6 +3103,7 @@ def create_additional_settings(
30973103
permissions: Optional permissions configuration dict
30983104
env: Optional environment variables dict
30993105
include_co_authored_by: Optional flag to include co-authored-by in commits
3106+
always_thinking_enabled: Optional flag to enable always-on thinking mode
31003107
31013108
Returns:
31023109
bool: True if successful, False otherwise.
@@ -3135,6 +3142,11 @@ def create_additional_settings(
31353142
settings['includeCoAuthoredBy'] = include_co_authored_by
31363143
info(f'Setting includeCoAuthoredBy: {include_co_authored_by}')
31373144

3145+
# Add alwaysThinkingEnabled if explicitly set (None means not configured, leave as default)
3146+
if always_thinking_enabled is not None:
3147+
settings['alwaysThinkingEnabled'] = always_thinking_enabled
3148+
info(f'Setting alwaysThinkingEnabled: {always_thinking_enabled}')
3149+
31383150
# Handle hooks if present
31393151
hook_events: list[dict[str, Any]] = []
31403152

@@ -3231,7 +3243,7 @@ def create_additional_settings(
32313243
try:
32323244
with open(additional_settings_path, 'w') as f:
32333245
json.dump(settings, f, indent=2)
3234-
success(f'Created {command_name}-additional-settings.json with environment hooks')
3246+
success(f'Created {command_name}-additional-settings.json')
32353247
return True
32363248
except Exception as e:
32373249
error(f'Failed to save {command_name}-additional-settings.json: {e}')
@@ -3942,6 +3954,9 @@ def main() -> None:
39423954
# Extract include_co_authored_by configuration
39433955
include_co_authored_by = config.get('include-co-authored-by')
39443956

3957+
# Extract always_thinking_enabled configuration
3958+
always_thinking_enabled = config.get('always-thinking-enabled')
3959+
39453960
# Extract claude-code-version configuration
39463961
claude_code_version = config.get('claude-code-version')
39473962
claude_code_version_normalized = None # Default to latest
@@ -4113,6 +4128,7 @@ def main() -> None:
41134128
permissions,
41144129
env_variables,
41154130
include_co_authored_by,
4131+
always_thinking_enabled,
41164132
)
41174133

41184134
# Step 13: Create launcher script

tests/test_setup_environment.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,62 @@ def test_create_additional_settings_with_hooks(self, mock_download):
885885
assert 'hooks' in settings
886886
assert 'PostToolUse' in settings['hooks']
887887

888+
def test_create_additional_settings_always_thinking_enabled_true(self):
889+
"""Test alwaysThinkingEnabled set to true."""
890+
with tempfile.TemporaryDirectory() as tmpdir:
891+
claude_dir = Path(tmpdir)
892+
893+
result = setup_environment.create_additional_settings(
894+
{},
895+
claude_dir,
896+
'test-env',
897+
always_thinking_enabled=True,
898+
)
899+
900+
assert result is True
901+
settings_file = claude_dir / 'test-env-additional-settings.json'
902+
settings = json.loads(settings_file.read_text())
903+
904+
assert 'alwaysThinkingEnabled' in settings
905+
assert settings['alwaysThinkingEnabled'] is True
906+
907+
def test_create_additional_settings_always_thinking_enabled_false(self):
908+
"""Test alwaysThinkingEnabled set to false."""
909+
with tempfile.TemporaryDirectory() as tmpdir:
910+
claude_dir = Path(tmpdir)
911+
912+
result = setup_environment.create_additional_settings(
913+
{},
914+
claude_dir,
915+
'test-env',
916+
always_thinking_enabled=False,
917+
)
918+
919+
assert result is True
920+
settings_file = claude_dir / 'test-env-additional-settings.json'
921+
settings = json.loads(settings_file.read_text())
922+
923+
assert 'alwaysThinkingEnabled' in settings
924+
assert settings['alwaysThinkingEnabled'] is False
925+
926+
def test_create_additional_settings_always_thinking_enabled_none_not_included(self):
927+
"""Test alwaysThinkingEnabled not included when None."""
928+
with tempfile.TemporaryDirectory() as tmpdir:
929+
claude_dir = Path(tmpdir)
930+
931+
result = setup_environment.create_additional_settings(
932+
{},
933+
claude_dir,
934+
'test-env',
935+
always_thinking_enabled=None,
936+
)
937+
938+
assert result is True
939+
settings_file = claude_dir / 'test-env-additional-settings.json'
940+
settings = json.loads(settings_file.read_text())
941+
942+
assert 'alwaysThinkingEnabled' not in settings
943+
888944

889945
class TestCreateLauncherScript:
890946
"""Test launcher script creation."""

0 commit comments

Comments
 (0)