Repository navigation
feat(v3.2.31): Watch-ClaudeLog 起動時セッション検出 + cron-launcher tmux -e 修正 (Issue #185 + #186) #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
| Linux 側の cron-launcher.sh が出力するログファイルを自動検出し | ||
| Windows Terminal の新規タブで tail -f を開始する。 | ||
| cron 実行前に起動しておくと、発火を検知して自動でログ表示を開始する。 | ||
| ClaudeOS v3.2.16 | ||
| ClaudeOS v3.2.31 | ||
| .PARAMETER NewTab | ||
| Windows Terminal の新規タブで開く(既定: 現在のウィンドウで実行)。 | ||
| .PARAMETER PollIntervalSeconds | ||
|
|
@@ -182,6 +182,15 @@ function Open-SessionInfoTab { | |
| Write-WaitHeader | ||
|
|
||
| $knownLog = Get-LatestLog | ||
| # 起動時に15分以内のログがある場合は実行中と見なして即監視 | ||
| if ($knownLog -match 'cron-(\d{8}-\d{6})\.log$') { | ||
| $logTime = [datetime]::MinValue | ||
| $parsed = [datetime]::TryParseExact($Matches[1], 'yyyyMMdd-HHmmss', $null, | ||
|
|
||
| [System.Globalization.DateTimeStyles]::None, [ref]$logTime) | ||
| if ($parsed -and ((Get-Date) - $logTime -lt [timespan]::FromMinutes(15))) { | ||
| $knownLog = '' # 新規扱いにして直後のループで検出させる | ||
| } | ||
| } | ||
|
Comment on lines
+185
to
+193
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's examine the PowerShell script to see the actual code at lines 185-193
cat -n scripts/tools/Watch-ClaudeLog.ps1 | sed -n '180,200p'Repository: Kensan196948G/ClaudeCode-StartUpTools-New Length of output: 873 🏁 Script executed: # Let's also check the Linux side to see how timestamps are generated
cat -n Claude/templates/linux/cron-launcher.sh | head -60Repository: Kensan196948G/ClaudeCode-StartUpTools-New Length of output: 2299 🏁 Script executed: # Look for SSH-related variables and usage patterns in the PowerShell script
rg -n 'SshTarget|SshUser|ssh ' scripts/tools/Watch-ClaudeLog.ps1 | head -40Repository: Kensan196948G/ClaudeCode-StartUpTools-New Length of output: 454 🏁 Script executed: # Check the beginning of the file to understand SSH setup
head -100 scripts/tools/Watch-ClaudeLog.ps1 | tail -80Repository: Kensan196948G/ClaudeCode-StartUpTools-New Length of output: 3218 タイムゾーン差で起動時の「15分以内」判定が誤る可能性があります。 Line 188-190 は監視端末側時刻 ( 🔧 例: タイムゾーン非依存の比較に寄せる差分案-$knownLog = Get-LatestLog
-# 起動時に15分以内のログがある場合は実行中と見なして即監視
-if ($knownLog -match 'cron-(\d{8}-\d{6})\.log$') {
- $logTime = [datetime]::MinValue
- $parsed = [datetime]::TryParseExact($Matches[1], 'yyyyMMdd-HHmmss', $null,
- [System.Globalization.DateTimeStyles]::None, [ref]$logTime)
- if ($parsed -and ((Get-Date) - $logTime -lt [timespan]::FromMinutes(15))) {
- $knownLog = '' # 新規扱いにして直後のループで検出させる
- }
-}
+$knownLog = Get-LatestLog
+# 起動時に15分以内のログがある場合は実行中と見なして即監視(タイムゾーン非依存)
+if ($knownLog) {
+ $latestEpochRaw = ssh $SshTarget "stat -c %Y '$knownLog' 2>/dev/null" 2>$null
+ if ($latestEpochRaw -match '^\d+$') {
+ $ageSec = [DateTimeOffset]::UtcNow.ToUnixTimeSeconds() - [int64]$latestEpochRaw
+ if ($ageSec -ge 0 -and $ageSec -lt 900) {
+ $knownLog = '' # 新規扱いにして直後のループで検出させる
+ }
+ }
+}🤖 Prompt for AI Agents |
||
| $dotCount = 0 | ||
|
|
||
| while ($true) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Claude Code CLI の最新公式ドキュメントで、claude --dangerously-skip-permissionsに対してプロンプトを argv ではなく「標準入力」または「ファイル」から渡す方法(例: --prompt-file,@file, stdin)がサポートされているか確認してください。💡 Result:
Claude Code CLIの最新公式ドキュメント(https://code.claude.com/docs/en/cli-referenceなど)では、claude --dangerously-skip-permissionsに対して、プロンプトをargv(コマンドライン引数)ではなく標準入力(stdin)やファイル(--prompt-file,
@fileなど)から渡す専用のオプション(例: --prompt-fileや@file)は明示的にリストされていません。 ただし、-p(printモード、非インタラクティブ)を使用する場合、stdinからの入力がサポートされており、例としてcat file | claude -p "query"が公式ドキュメントで示されています。この場合、--dangerously-skip-permissionsを組み合わせることが可能で、cat prompt.txt | claude -p --dangerously-skip-permissions "追加のクエリ"のようにstdinでプロンプト部分を渡せます。argvの"query"がstdinの内容に置き換わるかは文脈からstdinがコンテキストとして追加される形です。@fileのようなファイル指定オプションや--prompt-fileはflagsリストに存在せず、サポートされていないと判断されます。システムプロンプト用には--system-prompt-fileがありますが、ユーザープロンプト用ではありません。Citations:
大容量プロンプト対策が未完了です(argv へ直接渡すことによる引数長上限の制約が残ります)。
Line 155-157 で
.promptファイルの内容全体を_prompt_contentに読み込み、その後claude --dangerously-skip-permissions "$_prompt_content"として単一の引数に渡しているため、システムの引数長上限に依存する制約が残ります。公式ドキュメント確認により、
--prompt-fileや@fileのような専用オプションは現在サポートされていませんが、標準入力(stdin)を経由する方法が利用可能です。以下の形式でプロンプトをファイルから読み込むことで、引数長の制限を回避できます:現在の実装を stdin ベースに変更することで、Issue
#186の「大容量引数対策」に対応してください。🤖 Prompt for AI Agents