Skip to content

Commit cf27925

Browse files
committed
refactor: rename end-of-day to post-flight across repo
Rename the session cleanup script and all references from "end-of-day" to "post-flight" for clearer naming that isn't tied to time of day. Files renamed: - experimental/end-of-day.sh → post-flight.sh - tools/mcp-server/src/handlers/end-of-day.ts → post-flight.ts - PROJECT/1-INBOX/P1-END-OF-DAY.md → P1-POST-FLIGHT.md MCP tool renamed: end_of_day_session_cleanup → post_flight_session_cleanup TypeScript types renamed: EndOfDay* → PostFlight* https://claude.ai/code/session_018aweaCm87Pw1pYDdwVsrqr
1 parent 995347b commit cf27925

7 files changed

Lines changed: 51 additions & 51 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1818
### Added
1919
- **Native `.wpcignore` support in WPCC**`check-performance.sh` now loads gitignore-style patterns from a `.wpcignore` file and filters the PHP file list before scanning. Auto-detects `.wpcignore` in the scan target directory or current working directory. Supports directory patterns (`tools/`), extension globs (`*.min.js`), and literal substring matches. New flags: `--wpcignore-file <path>` for explicit file, `--no-wpcignore` to disable. Unblocks repo-wide scanning without false positives from embedded tools, temp files, and vendor directories.
2020
- **VS Code extension dynamic MCP discovery (v0.2.0)** — the extension's MCP server definition provider now merges configs from 5 layers (static AI-DDTK fallback, workspace `.mcp.json`, `.vscode/mcp.json`, `.mcp.local.json`, `temp/mcp/local-snippets/*.json`) with file watchers for live re-discovery. Site-specific WP MCP Adapter servers are automatically provided to all VS Code MCP clients without manual wiring or restart.
21-
- **`experimental/end-of-day.sh` — solo developer session cleanup script** — automated script for end-of-work synchronization. Checks 4X4.md, CHANGELOG.md, and MEMORY.md freshness; archives session-scoped MEMORY.md to `PROJECT/1-INBOX/MEMORY-<timestamp>.md` for clean sessions. Supports `--commit` (with confirmation), `--push` (implies commit, with confirmation), `--force` (skip prompts for automation), `--dry-run`, and agent hook integration for orchestration. Default mode reports findings only; opt-in flags enable commit/push. Includes build validation (PHP syntax check) and structured event emission for agent coordination.
22-
- **MCP tool: `end_of_day_session_cleanup`** — expose end-of-day.sh as a typed MCP tool (v0.9.0). Agents can call `end_of_day_session_cleanup` with `mode` (report/commit/push), `dryRun`, `force`, `skipValidation` flags. Returns structured check results (4X4.md, CHANGELOG.md, MEMORY.md, build validation), git state (branch, modified files, untracked), and command exit code. Enables VS Code agents to orchestrate session cleanup without shell escaping.
21+
- **`experimental/post-flight.sh` — solo developer post-flight session cleanup script** — automated script for post-session synchronization. Checks 4X4.md, CHANGELOG.md, and MEMORY.md freshness; archives session-scoped MEMORY.md to `PROJECT/1-INBOX/MEMORY-<timestamp>.md` for clean sessions. Supports `--commit` (with confirmation), `--push` (implies commit, with confirmation), `--force` (skip prompts for automation), `--dry-run`, and agent hook integration for orchestration. Default mode reports findings only; opt-in flags enable commit/push. Includes build validation (PHP syntax check) and structured event emission for agent coordination.
22+
- **MCP tool: `post_flight_session_cleanup`** — expose post-flight.sh as a typed MCP tool (v0.9.0). Agents can call `post_flight_session_cleanup` with `mode` (report/commit/push), `dryRun`, `force`, `skipValidation` flags. Returns structured check results (4X4.md, CHANGELOG.md, MEMORY.md, build validation), git state (branch, modified files, untracked), and command exit code. Enables VS Code agents to orchestrate session cleanup without shell escaping.
2323

2424
### Changed
25-
- **`end-of-day.sh` pluggable build validation**`validate_build()` now auto-detects and runs PHP syntax checks (up to 200 files), `npm run build` (if `package.json` has a `build` script), and `composer validate` (if `composer.json` exists). Skips gracefully when no validators are detected. Previously only checked a single hardcoded PHP file. MCP handler updated to capture per-validator results.
25+
- **`post-flight.sh` pluggable build validation**`validate_build()` now auto-detects and runs PHP syntax checks (up to 200 files), `npm run build` (if `package.json` has a `build` script), and `composer validate` (if `composer.json` exists). Skips gracefully when no validators are detected. Previously only checked a single hardcoded PHP file. MCP handler updated to capture per-validator results.
2626
- **`servers-audit.sh` and `servers-preflight.sh` promoted to `tools/`** — moved from `experimental/` to `tools/` alongside `servers.md` template. These scripts have received 4+ consecutive hardening releases (Launchd plist parsing, KeepAlive detection, expanded TLD coverage, Valet site discovery) and are no longer experimental. Internal path references (`$SCRIPT_DIR`) are relative and required no changes. CLI-REFERENCE.md updated with new sections for both scripts.
2727

2828
## [1.8.6] - 2026-04-05
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# End-of-Day Session Cleanup Script
1+
# Post-Flight Session Cleanup Script
22

33
## Overview
44

55
**Status**: ✅ DRAFT COMPLETE
6-
**Location**: `experimental/end-of-day.sh`
7-
**Purpose**: Solo developer session cleanup — ensures 4X4.md, CHANGELOG.md, MEMORY.md are synced, optionally commits and pushes.
6+
**Location**: `experimental/post-flight.sh`
7+
**Purpose**: Solo developer post-flight session cleanup — ensures 4X4.md, CHANGELOG.md, MEMORY.md are synced, optionally commits and pushes.
88

99
---
1010

@@ -20,7 +20,7 @@ The original analysis included pushback on auto-commit/push risks. However, for
2020

2121
---
2222

23-
## Analysis & Feedback on "end-of-day" Script
23+
## Analysis & Feedback on "post-flight" Script
2424

2525
**Good idea.** This addresses a real friction point. But let me push back on scope and add some nuances based on what `servers-preflight.sh` and `servers-audit.sh` do well.
2626

@@ -83,13 +83,13 @@ Check:
8383

8484
```bash
8585
#!/usr/bin/env bash
86-
# end-of-day.sh — Session cleanup & doc synchronization
86+
# post-flight.sh — Session cleanup & doc synchronization
8787
#
88-
# Ensures 4X4.md, CHANGELOG.md, MEMORY.md are synced before close-of-day.
88+
# Ensures 4X4.md, CHANGELOG.md, MEMORY.md are synced after session.
8989
# Reports findings, suggests fixes, but does NOT auto-commit/push unless --auto-commit.
9090
#
9191
# Usage:
92-
# end-of-day.sh [--auto-commit] [--push] [--no-validate] [--hook <script>]
92+
# post-flight.sh [--auto-commit] [--push] [--no-validate] [--hook <script>]
9393
#
9494
# Exit codes:
9595
# 0 = OK, all docs fresh, working tree clean
@@ -130,7 +130,7 @@ check_changelog() {
130130
}
131131

132132
check_memory() {
133-
# MEMORY.md exists, should be archived at EOD if present
133+
# MEMORY.md exists, should be archived at post-flight if present
134134
# Return: "fresh" | "missing" | "should_archive"
135135
}
136136

@@ -167,7 +167,7 @@ main() {
167167

168168
The agent could call it like:
169169
```bash
170-
end-of-day.sh --hook ./agent-hook.sh --json-events \
170+
post-flight.sh --hook ./agent-hook.sh --json-events \
171171
&& git log -1 --oneline \
172172
|| echo "Session cleanup needed"
173173
```
@@ -189,7 +189,7 @@ Not dumb—it's **solving a real problem**. But I'd recommend:
189189
1. **Don't auto-commit by default**—make it opt-in with `--auto-commit`
190190
2. **Use the event/hook pattern** from `servers-audit.sh`—lets agents orchestrate without you baking in every decision
191191
3. **Validate before committing**—quick syntax check + git state sanity
192-
4. **Archive MEMORY.md at EOD**—keeps it from growing and cluttering the repo
192+
4. **Archive MEMORY.md at post-flight**—keeps it from growing and cluttering the repo
193193
5. **Generate commit messages from diffs**—human-friendly, not "Lazy commit"
194194

195195
**Thoughts? Should I sketch out a full draft?**
@@ -198,13 +198,13 @@ Not dumb—it's **solving a real problem**. But I'd recommend:
198198

199199
## ✅ Implementation Complete
200200

201-
The script has been drafted and placed at `experimental/end-of-day.sh`.
201+
The script has been drafted and placed at `experimental/post-flight.sh`.
202202

203203
### Key Features
204204

205205
#### **Default Behavior (No Flags)**
206206
```bash
207-
end-of-day.sh
207+
post-flight.sh
208208
```
209209
- ✓ Checks 4X4.md, CHANGELOG.md, MEMORY.md freshness
210210
- ✓ Archives MEMORY.md if present → `PROJECT/1-INBOX/MEMORY-<timestamp>.md`
@@ -215,7 +215,7 @@ end-of-day.sh
215215

216216
#### **Commit Mode**
217217
```bash
218-
end-of-day.sh --commit
218+
post-flight.sh --commit
219219
```
220220
- Runs all checks (as above)
221221
- Prompts: "Continue with commit?" `[y/N]`
@@ -224,7 +224,7 @@ end-of-day.sh --commit
224224

225225
#### **Push Mode**
226226
```bash
227-
end-of-day.sh --push
227+
post-flight.sh --push
228228
```
229229
- Implies `--commit`
230230
- After commit, prompts: "Push to remote?" `[y/N]`
@@ -233,7 +233,7 @@ end-of-day.sh --push
233233

234234
#### **Force Mode (Automation)**
235235
```bash
236-
end-of-day.sh --push --force
236+
post-flight.sh --push --force
237237
```
238238
- Skips ALL confirmation prompts
239239
- Archives MEMORY.md, commits, pushes automatically
@@ -242,7 +242,7 @@ end-of-day.sh --push --force
242242

243243
#### **Dry-Run Mode**
244244
```bash
245-
end-of-day.sh --push --dry-run
245+
post-flight.sh --push --dry-run
246246
```
247247
- Shows what WOULD happen, but doesn't execute
248248
- Useful for testing, previewing before automation
@@ -275,7 +275,7 @@ Keeps MEMORY.md fresh for each session without losing context.
275275
The script emits **structured events** that agents can hook into:
276276

277277
```bash
278-
end-of-day.sh --push --hook ./agent-hook.sh
278+
post-flight.sh --push --hook ./agent-hook.sh
279279
```
280280

281281
**Agent Hook Protocol**: Hook receives `<script> <event-name> '<json-payload>'`
@@ -303,4 +303,4 @@ end-of-day.sh --push --hook ./agent-hook.sh
303303
- [ ] Pre-commit validation (run tests, linters if configured)
304304
- [ ] Selective archiving (different locations by file type)
305305
- [ ] Rollback support (easy undo if push fails)
306-
- [ ] Config file support (`.end-of-day.toml` per-repo settings)
306+
- [ ] Config file support (`.post-flight.toml` per-repo settings)
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
set -euo pipefail
44

5-
# ─── end-of-day.sh ─────────────────────────────────────────────────────────
5+
# ─── post-flight.sh ─────────────────────────────────────────────────────────
66
#
77
# Session cleanup & documentation synchronization for solo developers.
88
#
99
# Ensures 4X4.md, CHANGELOG.md, MEMORY.md are synced, optionally commits and
1010
# pushes with a single confirmation prompt.
1111
#
1212
# Usage:
13-
# end-of-day.sh [OPTIONS]
13+
# post-flight.sh [OPTIONS]
1414
#
1515
# Options:
1616
# --commit Stage & commit if docs changed (requires confirmation)
@@ -28,19 +28,19 @@ set -euo pipefail
2828
#
2929
# Examples:
3030
# # Report only (default)
31-
# end-of-day.sh
31+
# post-flight.sh
3232
#
3333
# # Commit with confirmation
34-
# end-of-day.sh --commit
34+
# post-flight.sh --commit
3535
#
3636
# # Commit + push with confirmation
37-
# end-of-day.sh --push
37+
# post-flight.sh --push
3838
#
3939
# # Full automation (no prompts)
40-
# end-of-day.sh --push --force
40+
# post-flight.sh --push --force
4141
#
4242
# # With agent hook for orchestration
43-
# end-of-day.sh --push --hook ./my-agent-hook.sh
43+
# post-flight.sh --push --hook ./my-agent-hook.sh
4444
#
4545
# Agent Hook Events:
4646
# check:4x4 '{"status":"ok|missing|stale|mismatch"}'
@@ -333,7 +333,7 @@ done
333333
# ─── Main ────────────────────────────────────────────────────────────────────
334334

335335
main() {
336-
echo "${BOLD}[end-of-day] 📋 Session Summary${NC}"
336+
echo "${BOLD}[post-flight] 📋 Session Summary${NC}"
337337
echo ""
338338

339339
check_4x4 || true
@@ -342,7 +342,7 @@ main() {
342342
check_git_state || true
343343

344344
echo ""
345-
echo "${BOLD}[end-of-day] 🔍 Validation${NC}"
345+
echo "${BOLD}[post-flight] 🔍 Validation${NC}"
346346
validate_build || true
347347

348348
if [ "$MODE_COMMIT" -eq 0 ]; then

tools/mcp-server/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> Version: 0.9.0
44
5-
Unified MCP server for AI-DDTK. Exposes LocalWP, WPCC, `pw-auth`, `wp-ajax-test`, tmux, Query Monitor, and end-of-day session cleanup workflows as typed **Tools**, **Resources**, and **Prompts** — compatible with Claude Code, GitHub Copilot, Cline, Augment Code, Cursor, Claude Desktop, and any MCP-capable client.
5+
Unified MCP server for AI-DDTK. Exposes LocalWP, WPCC, `pw-auth`, `wp-ajax-test`, tmux, Query Monitor, and post-flight session cleanup workflows as typed **Tools**, **Resources**, and **Prompts** — compatible with Claude Code, GitHub Copilot, Cline, Augment Code, Cursor, Claude Desktop, and any MCP-capable client.
66

77
## Quick Start
88

@@ -55,7 +55,7 @@ npm run mcp:http
5555
| AJAX | `wp_ajax_test` | Test `admin-ajax.php` endpoints with structured inputs |
5656
| tmux | `tmux_start`, `tmux_send`, `tmux_capture`, `tmux_stop`, `tmux_list`, `tmux_status` | Run resilient long-lived commands and inspect output |
5757
| Query Monitor | `qm_profile_page`, `qm_slow_queries`, `qm_duplicate_queries` | Profile pages, find slow queries, detect N+1 patterns |
58-
| Session cleanup | `end_of_day_session_cleanup` | Automated solo dev session cleanup: sync 4X4.md/CHANGELOG.md/MEMORY.md, optionally commit and push with confirmation |
58+
| Session cleanup | `post_flight_session_cleanup` | Automated solo dev post-flight session cleanup: sync 4X4.md/CHANGELOG.md/MEMORY.md, optionally commit and push with confirmation |
5959

6060
## Resources
6161

tools/mcp-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ai-ddtk-mcp",
33
"version": "0.9.0",
4-
"description": "AI-DDTK MCP server for LocalWP, pw-auth, wp-ajax-test, tmux, WPCC, Query Monitor, and end-of-day session cleanup workflows",
4+
"description": "AI-DDTK MCP server for LocalWP, pw-auth, wp-ajax-test, tmux, WPCC, Query Monitor, and post-flight session cleanup workflows",
55
"type": "module",
66
"main": "dist/src/index.js",
77
"bin": {

tools/mcp-server/src/handlers/end-of-day.ts renamed to tools/mcp-server/src/handlers/post-flight.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ import { ExecFileTextError, execFileText, type ExecFileText, type ExecResult } f
33

44
const DEFAULT_TIMEOUT_MS = 30_000;
55

6-
export type EndOfDayMode = "report" | "commit" | "push";
6+
export type PostFlightMode = "report" | "commit" | "push";
77

8-
export type EndOfDayCheckResult = Record<string, unknown> & {
8+
export type PostFlightCheckResult = Record<string, unknown> & {
99
check: string;
1010
status: "ok" | "missing" | "stale" | "dirty" | "error";
1111
message: string;
1212
};
1313

14-
export type EndOfDayResult = Record<string, unknown> & {
15-
mode: EndOfDayMode;
14+
export type PostFlightResult = Record<string, unknown> & {
15+
mode: PostFlightMode;
1616
dryRun: boolean;
1717
force: boolean;
18-
checks: EndOfDayCheckResult[];
18+
checks: PostFlightCheckResult[];
1919
gitBranch: string;
2020
gitState: "clean" | "dirty";
2121
modifiedFiles: number;
@@ -25,22 +25,22 @@ export type EndOfDayResult = Record<string, unknown> & {
2525
exitCode: number;
2626
};
2727

28-
export interface EndOfDayHandlerDeps {
28+
export interface PostFlightHandlerDeps {
2929
repoRoot: string;
3030
timeoutMs?: number;
3131
execRunner?: ExecFileText;
3232
}
3333

34-
export function createEndOfDayHandlers(deps: EndOfDayHandlerDeps) {
34+
export function createPostFlightHandlers(deps: PostFlightHandlerDeps) {
3535
const { repoRoot, timeoutMs = DEFAULT_TIMEOUT_MS, execRunner = execFileText } = deps;
36-
const scriptPath = path.join(repoRoot, "experimental/end-of-day.sh");
36+
const scriptPath = path.join(repoRoot, "experimental/post-flight.sh");
3737

38-
async function runEndOfDay(options: {
39-
mode?: EndOfDayMode;
38+
async function runPostFlight(options: {
39+
mode?: PostFlightMode;
4040
dryRun?: boolean;
4141
force?: boolean;
4242
skipValidation?: boolean;
43-
}): Promise<EndOfDayResult> {
43+
}): Promise<PostFlightResult> {
4444
const { mode = "report", dryRun = false, force = false, skipValidation = false } = options;
4545

4646
const args: string[] = [];
@@ -71,7 +71,7 @@ export function createEndOfDayHandlers(deps: EndOfDayHandlerDeps) {
7171

7272
// Parse stdout for check results and git state
7373
const lines = result.stdout.split("\n");
74-
const checks: EndOfDayCheckResult[] = [];
74+
const checks: PostFlightCheckResult[] = [];
7575
let gitBranch = "unknown";
7676
let gitState: "clean" | "dirty" = "clean";
7777
let modifiedFiles = 0;
@@ -157,6 +157,6 @@ export function createEndOfDayHandlers(deps: EndOfDayHandlerDeps) {
157157
}
158158
}
159159

160-
return { runEndOfDay };
160+
return { runPostFlight };
161161
}
162162

tools/mcp-server/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { createTmuxHandlers } from "./handlers/tmux.js";
1313
import { createWpAjaxTestHandlers } from "./handlers/wp-ajax-test.js";
1414
import { createQmHandlers } from "./handlers/qm.js";
1515
import { WPCC_LATEST_REPORT_URI, WPCC_LATEST_SCAN_URI, WPCC_SCAN_URI_TEMPLATE, createWpccHandlers } from "./handlers/wpcc.js";
16-
import { createEndOfDayHandlers } from "./handlers/end-of-day.js";
16+
import { createPostFlightHandlers } from "./handlers/post-flight.js";
1717
import { SessionStore, SiteState } from "./state.js";
1818
import { loadOrGenerateToken, getTokenFilePath } from "./utils/token.js";
1919

@@ -165,7 +165,7 @@ export function createServer() {
165165
const wpAjaxTestHandlers = createWpAjaxTestHandlers({ repoRoot });
166166
const wpccHandlers = createWpccHandlers({ repoRoot });
167167
const qmHandlers = createQmHandlers({ getCookiesForSite: (user, domain) => pwAuthHandlers.getCookiesForSite(user, domain), repoRoot });
168-
const endOfDayHandlers = createEndOfDayHandlers({ repoRoot });
168+
const postFlightHandlers = createPostFlightHandlers({ repoRoot });
169169

170170
const server = new McpServer({
171171
name: "ai-ddtk-mcp",
@@ -860,10 +860,10 @@ export function createServer() {
860860
);
861861

862862
server.registerTool(
863-
"end_of_day_session_cleanup",
863+
"post_flight_session_cleanup",
864864
{
865865
description:
866-
"Solo developer session cleanup — ensures 4X4.md, CHANGELOG.md, and MEMORY.md are synced. Optionally commits and pushes with confirmation. Archives MEMORY.md to PROJECT/1-INBOX/ for clean sessions. Runs build validation.",
866+
"Solo developer post-flight session cleanup — ensures 4X4.md, CHANGELOG.md, and MEMORY.md are synced. Optionally commits and pushes with confirmation. Archives MEMORY.md to PROJECT/1-INBOX/ for clean sessions. Runs build validation.",
867867
inputSchema: {
868868
mode: z.enum(["report", "commit", "push"]).default("report").describe("report (default, no git actions), commit (with confirmation), or push (commit + push with confirmations)"),
869869
dryRun: z.boolean().default(false).describe("Show what would happen without executing"),
@@ -891,7 +891,7 @@ export function createServer() {
891891
async ({ mode = "report", dryRun = false, force = false, skipValidation = false }) => {
892892
try {
893893
return successResult(
894-
await endOfDayHandlers.runEndOfDay({
894+
await postFlightHandlers.runPostFlight({
895895
mode: mode as "report" | "commit" | "push",
896896
dryRun,
897897
force,

0 commit comments

Comments
 (0)