Skip to content

Commit 0140fe6

Browse files
stephendolanclaude
andcommitted
feat: add continue_flag to resume sessions in existing directories
When navigating to an existing directory, appends --continue (by default) to the agent command, allowing users to resume their previous coding session. Configurable via config file or SCRY_CONTINUE_FLAG env var. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 77fc531 commit 0140fe6

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

shard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: scry
2-
version: 0.7.0
2+
version: 0.8.0
33

44
authors:
55
- Stephen Dolan

src/scry.cr

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ struct Config
99

1010
getter path : String = "~/scries"
1111
getter agent : String = "claude"
12+
getter continue_flag : String = "--continue"
1213

1314
def self.load : Config
1415
config_path = File.expand_path("~/.config/scry/config.json", home: Path.home)
@@ -26,6 +27,7 @@ struct Config
2627
def initialize
2728
@path = "~/scries"
2829
@agent = "claude"
30+
@continue_flag = "--continue"
2931
end
3032

3133
def effective_path : String
@@ -36,6 +38,10 @@ struct Config
3638
ENV["SCRY_AGENT"]? || @agent
3739
end
3840

41+
def effective_continue_flag : String
42+
ENV["SCRY_CONTINUE_FLAG"]? || @continue_flag
43+
end
44+
3945
private def expand_home_path(path : String) : String
4046
path.starts_with?("~") ? File.expand_path(path, home: Path.home) : path
4147
end
@@ -893,17 +899,20 @@ def print_help(config : Config)
893899
The "default" template is applied automatically (if it exists).
894900
895901
Current config:
896-
Path: #{config.effective_path}
897-
Agent: #{config.effective_agent}
902+
Path: #{config.effective_path}
903+
Agent: #{config.effective_agent}
904+
Continue flag: #{config.effective_continue_flag.empty? ? "(disabled)" : config.effective_continue_flag}
898905
899906
Environment (overrides config file):
900-
SCRY_PATH Where scries are stored
901-
SCRY_AGENT Command to run after cd
907+
SCRY_PATH Where scries are stored
908+
SCRY_AGENT Command to run after cd
909+
SCRY_CONTINUE_FLAG Flag to add when resuming (set empty to disable)
902910
903911
Config file: ~/.config/scry/config.json
904912
{
905913
"path": "~/scries",
906-
"agent": "claude"
914+
"agent": "claude",
915+
"continue_flag": "--continue"
907916
}
908917
909918
HELP
@@ -1132,7 +1141,14 @@ end
11321141
end
11331142

11341143
escaped_path = path.gsub("'", "'\\''")
1135-
puts "cd '#{escaped_path}' && #{config.effective_agent}"
1144+
agent_cmd = config.effective_agent
1145+
continue_flag = config.effective_continue_flag
1146+
1147+
if result[:type] == :cd && !continue_flag.empty?
1148+
agent_cmd = "#{agent_cmd} #{continue_flag}"
1149+
end
1150+
1151+
puts "cd '#{escaped_path}' && #{agent_cmd}"
11361152
File.touch(path) rescue nil
11371153
end
11381154
{% end %}

0 commit comments

Comments
 (0)