Conversation
Add cron-based scheduled execution of claude -p commands per worktree, configured via CMATE.md Schedules section. Includes environment sanitization, CMATE.md parser, DB migration v17, schedule manager with croner, API endpoints, execution log UI, and i18n support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract duplicated constants and validators into centralized config,
improve type safety, and add edge case tests.
Improvements:
- Extract UUID_V4_PATTERN, isValidUuidV4, MAX_SCHEDULE_*_LENGTH into src/config/schedule-config.ts (DRY)
- Remove 7 duplicated require('./db-instance') calls in schedule-manager.ts via getLazyDbInstance() helper
- Add typed DB row interfaces (WorktreeRow, ScheduleIdRow) in schedule-manager.ts
- Add ExecutionLogStatus union type (replaces plain string) in schedule-manager.ts and ExecutionLogPane.tsx
- Add JSDoc comments throughout schedule-manager.ts DB operations
- Exhaustive switch in getStatusColor() (no default branch needed)
- Add 27 new unit tests (3885 -> 3912 passed)
Quality Metrics:
- ESLint errors: 0 -> 0
- TypeScript errors: 0 -> 0
- Unit tests: 3885 -> 3912 (+27)
Relates to #294
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add buildCliArgs() to generate correct arguments per CLI tool (claude: --output-format text --permission-mode acceptEdits, codex: exec --sandbox workspace-write) - Close child stdin immediately to prevent yes/no prompt hang - Add unit tests for buildCliArgs() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…294 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a one-click CMATE button that creates CMATE.md from a template if it doesn't exist, or validates the Schedules section if it does. This improves discoverability and reduces silent configuration errors. - New src/lib/cmate-validator.ts: client-side parser and validator - FileTreeView: onCmateSetup prop with FileText icon button - WorktreeDetailRefactored: handleCmateSetup handler (desktop + mobile) - i18n keys for en/ja schedule.json - 18 unit tests for validator Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…reation The format check was not visible because handleCmateSetup returned immediately after creating the template without running validation. Now validation always runs: after creation it uses the template content directly, otherwise it reads from the API response. Also added defensive typeof check on API response content field. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously only data rows were validated, allowing incorrect header names (e.g. "Message2") to pass silently. Now validates that Schedules section headers match expected columns (Name, Cron, Message). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename "Notes & Logs" tab to "CMATE" and "Logs" sub-tab to "Schedules" to better reflect the schedule execution feature. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The /api/worktrees/:id/tree endpoint returns an object { path, name, items, parentPath },
not an array. Extract items from the response to fix TypeError in handleCmateSetup().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the single-line empty state message in the Schedules tab with an i18n-supported step-by-step guide to help first-time users configure schedules via CMATE.md. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lback The CMATE.md Schedules table validator now treats the Permission column as optional. When omitted, the parser applies DEFAULT_PERMISSIONS per CLI tool (claude: acceptEdits, codex: workspace-write). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add per-schedule permission configuration parsed from CMATE.md Permission column. The permission value flows through the full pipeline: parser -> schedule manager -> CLI executor (--permission-mode for claude, --sandbox for codex). Includes stale schedule cleanup in DB sync. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Security: - Add ALLOWED_CLI_TOOLS whitelist to claude-executor.ts to prevent arbitrary command execution via execFile [SEC-001] - Add permission value validation against CLAUDE_PERMISSIONS/CODEX_SANDBOXES in cmate-validator.ts (not just empty check) DRY / Code Quality: - Extract shared constants (CONTROL_CHAR_PATTERN, NAME_PATTERN, isValidCronExpression, sanitizeContent) into src/config/cmate-constants.ts - Fix global regex /g flag state issue by using CONTROL_CHAR_PATTERN without /g and creating fresh RegExp in sanitizeContent() - Remove duplicated constants from cmate-parser.ts and cmate-validator.ts i18n: - Replace all hardcoded English strings in ExecutionLogPane with t() calls - Replace hardcoded tab labels in NotesAndLogsPane with t() calls - Fix LeftPaneTabSwitcher test to match renamed CMATE tab label Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…issues API Routes: - Add ALLOWED_CLI_TOOLS whitelist validation to POST/PUT schedules - Add isValidCronExpression() syntax check to POST/PUT schedules - Trim name/message fields to reject whitespace-only input Consistency: - Align permission validation between parser and validator (empty permission is allowed in both — parser applies default per CLI tool) - Merge default case into claude case in buildCliArgs() to eliminate unreachable dead code Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat(schedule): CMATE.md schedule execution feature (Issue #294)
Align mobile tab label with desktop LeftPaneTabSwitcher naming. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix: rename mobile tab label from 'Notes' to 'CMATE'
Reflect current 5-tab layout: Terminal, History, Files, CMATE, Info. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
docs: update mobile tab bar table in webapp-guide
…ssion-mode values Replace incorrect ['default', 'acceptEdits', 'full'] with the actual 5 valid values: 'default', 'acceptEdits', 'plan', 'dontAsk', 'bypassPermissions'. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix(schedule): correct CLAUDE_PERMISSIONS values
…ponse detail Execution log list now displays the schedule name instead of the message content for consistency with the Schedules section. Expanded log detail shows both Message and Response as labeled sections. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat(schedule): show schedule name in execution logs with Message/Response detail
…gs via LEFT JOIN Schedules API now returns only enabled schedules (enabled=1) so renamed/ removed entries no longer appear. Execution logs API uses LEFT JOIN to include schedule_name for all logs, preserving history from old schedules. ExecutionLogPane uses the API-provided schedule_name directly instead of a client-side Map lookup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix(schedule): filter disabled schedules and resolve name display on logs
…n CLI docs Add bilingual user guides for the CMATE schedule feature covering table format, cron reference, permissions, examples, and troubleshooting. Register 'cmate-schedules' section in docs-reader SECTION_MAP for CLI access. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
docs(schedule): add CMATE schedules user guide (ja/en)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claude -pを使用した定期タスク自動実行エンジンの実装Changes
cmate-parser.ts,cmate-validator.ts,claude-executor.ts,schedule-manager.ts,env-sanitizer.tsExecutionLogPane,NotesAndLogsPane, FileTreeView CMATE統合cmate-constants.ts,schedule-config.ts, i18n (schedule namespace)Test plan
🤖 Generated with Claude Code