worclaude 2.8.0 → 2.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/README.md +72 -56
- package/SECURITY.md +54 -35
- package/package.json +5 -2
- package/src/commands/doc-lint.js +37 -0
- package/src/commands/doctor.js +77 -0
- package/src/commands/init.js +144 -44
- package/src/commands/observability.js +24 -0
- package/src/commands/regenerate-routing.js +70 -0
- package/src/commands/status.js +14 -0
- package/src/commands/upgrade.js +87 -1
- package/src/commands/worktrees.js +90 -0
- package/src/core/config.js +10 -1
- package/src/core/file-categorizer.js +16 -0
- package/src/core/merger.js +42 -20
- package/src/core/scaffolder.js +26 -0
- package/src/data/agents.js +14 -28
- package/src/data/optional-features.js +46 -0
- package/src/generators/agent-routing.js +189 -34
- package/src/index.js +37 -0
- package/src/prompts/agent-selection.js +11 -3
- package/src/utils/agent-frontmatter.js +109 -0
- package/src/utils/doc-lint.js +196 -0
- package/src/utils/observability.js +300 -0
- package/templates/agents/optional/backend/api-designer.md +7 -1
- package/templates/agents/optional/backend/auth-auditor.md +7 -1
- package/templates/agents/optional/backend/database-analyst.md +7 -1
- package/templates/agents/optional/data/data-pipeline-reviewer.md +7 -1
- package/templates/agents/optional/data/ml-experiment-tracker.md +7 -1
- package/templates/agents/optional/data/prompt-engineer.md +7 -1
- package/templates/agents/optional/devops/ci-fixer.md +7 -1
- package/templates/agents/optional/devops/dependency-manager.md +7 -1
- package/templates/agents/optional/devops/deploy-validator.md +7 -1
- package/templates/agents/optional/devops/docker-helper.md +7 -1
- package/templates/agents/optional/docs/changelog-generator.md +9 -1
- package/templates/agents/optional/docs/doc-writer.md +7 -1
- package/templates/agents/optional/frontend/style-enforcer.md +7 -1
- package/templates/agents/optional/frontend/ui-reviewer.md +7 -1
- package/templates/agents/optional/quality/bug-fixer.md +7 -1
- package/templates/agents/optional/quality/build-fixer.md +7 -1
- package/templates/agents/optional/quality/performance-auditor.md +8 -1
- package/templates/agents/optional/quality/refactorer.md +7 -1
- package/templates/agents/optional/quality/security-reviewer.md +7 -1
- package/templates/agents/universal/build-validator.md +7 -1
- package/templates/agents/universal/code-simplifier.md +8 -1
- package/templates/agents/universal/plan-reviewer.md +8 -1
- package/templates/agents/universal/test-writer.md +7 -1
- package/templates/agents/universal/upstream-watcher.md +8 -1
- package/templates/agents/universal/verify-app.md +33 -3
- package/templates/commands/build-fix.md +30 -11
- package/templates/commands/commit-push-pr.md +47 -24
- package/templates/commands/compact-safe.md +79 -7
- package/templates/commands/conflict-resolver.md +7 -3
- package/templates/commands/end.md +63 -17
- package/templates/commands/learn.md +72 -8
- package/templates/commands/observability.md +59 -0
- package/templates/commands/refactor-clean.md +44 -2
- package/templates/commands/review-changes.md +40 -11
- package/templates/commands/review-plan.md +83 -10
- package/templates/commands/start.md +61 -30
- package/templates/commands/sync.md +86 -6
- package/templates/commands/test-coverage.md +78 -12
- package/templates/commands/update-claude-md.md +96 -7
- package/templates/commands/verify.md +32 -8
- package/templates/core/claude-md.md +9 -0
- package/templates/hooks/correction-detect.cjs +1 -1
- package/templates/hooks/learn-capture.cjs +0 -2
- package/templates/hooks/obs-agent-events.cjs +55 -0
- package/templates/hooks/obs-command-invocations.cjs +53 -0
- package/templates/hooks/obs-skill-loads.cjs +54 -0
- package/templates/hooks/skill-hint.cjs +22 -2
- package/templates/scripts/start-drift.sh +29 -0
- package/templates/scripts/sync-release-scope.sh +17 -0
- package/templates/scripts/test-coverage-changed-files.sh +14 -0
- package/templates/settings/base.json +73 -0
- package/templates/skills/universal/claude-md-maintenance.md +50 -14
- package/templates/skills/universal/git-conventions.md +11 -1
- package/templates/skills/universal/memory-architecture.md +115 -0
- package/templates/skills/universal/subagent-usage.md +1 -1
- package/src/data/agent-registry.js +0 -365
- package/templates/agents/optional/quality/e2e-runner.md +0 -98
- package/templates/commands/status.md +0 -15
- package/templates/commands/techdebt.md +0 -18
- package/templates/commands/upstream-check.md +0 -85
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,71 @@ All notable changes to worclaude are documented in this file. Format loosely fol
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [2.9.1] — 2026-04-28
|
|
8
|
+
|
|
9
|
+
Security patch clearing three transitive dev-dep advisories surfaced by Socket.dev and `npm audit` (esbuild dev-server CORS, vite path-traversal in optimized-deps, postcss XSS in CSS stringify). All three were dev-only, gated behind running `npm run docs:dev` and visiting a hostile origin in the same session — neither CI nor end-user installs trigger the conditions — but they kept appearing in scanner output and drowning out signal. Resolved via `npm overrides` in `package.json` (esbuild ^0.25.0, vite ^6.4.2, postcss ^8.5.10) which forces vitepress 1.6.4 onto patched transitives despite its declared `vite ^5.4.14` peer range; `npm run docs:build` verified clean. SECURITY.md rewritten: stale "pending upstream fixes" section replaced with "fixed via overrides", new false-positive subsections for Socket's AI-typosquat alert ("Did you mean: claude") and URL-strings alert (template content, not endpoints), supported-version table bumped to 2.9.x.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Three transitive dev-dep CVEs cleared via `npm overrides`** (PR #153) — esbuild 0.21.5 → 0.25.12 ([GHSA-67mh-4wv8-2f99](https://github.com/advisories/GHSA-67mh-4wv8-2f99) / CVE-2026-41305), vite 5.4.21 → 6.4.2 ([GHSA-4w7w-66w2-5vf9](https://github.com/advisories/GHSA-4w7w-66w2-5vf9) / CVE-2026-39365), postcss 8.5.8 → 8.5.12 ([GHSA-qx2v-qp2m-jg93](https://github.com/advisories/GHSA-qx2v-qp2m-jg93)). `npm audit` now reports 0 vulnerabilities; all 947 tests still pass; `npm run docs:build` succeeds against vitepress 1.6.4.
|
|
14
|
+
|
|
15
|
+
### Docs
|
|
16
|
+
|
|
17
|
+
- **`SECURITY.md` refresh** (PR #153) — replaces the obsolete "pending upstream fixes" section with a "fixed via overrides" section listing each advisory and resolved version. Adds two new false-positive subsections documenting Socket's AI-typosquat alert ("Did you mean: claude" — permanent, package was published under this name from day one) and URL-strings alert (flagged hostnames/filenames are template prose under `templates/`, not runtime endpoints; only `src/utils/npm.js` makes a network call). Bumps the supported-version table from `2.6.x` to `2.9.x`.
|
|
18
|
+
|
|
19
|
+
## [2.9.0] — 2026-04-28
|
|
20
|
+
|
|
21
|
+
Audit-driven workflow rebuild executing the canonical 7-phase plan derived from the 2026-04 master architecture audit, plus the @claude GitHub Action surface and post-phase polish. Phase 1 cleaned drift and gap-filled hooks. Phase 2 rebuilt the slash-command surface, retired three superseded commands, and split `/start`/`/end` into distinct forward-looking-handoff and backward-looking-session-summary artifacts with `sha:` frontmatter for SHA-based drift detection. Phase 3 made agent files the routing source of truth via a new frontmatter contract (`category`, `triggerType`, `whenToUse`, `whatItDoes`, `expectBack`, `situationLabel`) regenerated on every `/sync` and `worclaude upgrade`. Phase 4 introduced the memory-architecture skill and the `/update-claude-md` promotion algorithm. Phase 5 added the `worclaude doc-lint` subcommand. Phase 6a shipped end-to-end observability — capture, the `worclaude observability` aggregator, and the `/observability` slash command. Phase 7 added an `init` opt-in for the @claude GitHub Action workflow. Post-phase polish required explicit human invocation of `/commit-push-pr` or `/sync` for any git write (no more conversational "yes" authorizations) and extracted multi-line bash from three slash commands into POSIX helper scripts under `templates/scripts/` so each invocation matches a single allow rule. Test surface grew from 804/58 files to 947/69 files.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- **`worclaude observability` subcommand + `/observability` slash command** (PR #144) — aggregates per-session captured signals into a Markdown report; `/observability` surfaces it in-session.
|
|
26
|
+
- **Observability capture infrastructure** (PR #143) — per-session signal capture wired into hooks; foundation that PR #144 reads from.
|
|
27
|
+
- **Observability upgrade-path integration + VitePress docs** (PR #145) — existing installs pick up observability infra; new VitePress page documents the flow.
|
|
28
|
+
- **`worclaude doc-lint` subcommand** (PR #142) — validates `<!-- references … -->` markers and surfaces tech-stack drift between code and prose; T5.9 of the canonical plan.
|
|
29
|
+
- **`worclaude regenerate-routing` subcommand** (PR #137, T3.1 Path B) — rebuilds `.claude/skills/agent-routing/SKILL.md` from agent-file routing-fields frontmatter (`category`, `triggerType`, `whenToUse`, `whatItDoes`, `expectBack`, `situationLabel`). Preserves user prose outside `<!-- AUTO-GENERATED-START/END -->` markers. Auto-runs during `/sync` and `worclaude upgrade`. New `src/utils/agent-frontmatter.js` parser/validator and `src/generators/agent-routing.js` builder.
|
|
30
|
+
- **`worclaude worktrees clean` subcommand** (PR #128) — removes stale agent worktrees left behind by Claude Code's worktree harness.
|
|
31
|
+
- **`/sync` refreshes test/file metrics in CLAUDE.md and AGENTS.md** (PR #128) — fixes silent drift of `\d+ tests, \d+ files` claims.
|
|
32
|
+
- **Default `sandbox.network.deniedDomains` in `templates/settings/base.json`** (PR #128) — opinionated baseline deny-list shipped to every fresh init.
|
|
33
|
+
- **`e2e-runner` agent** (PR #130) — end-to-end test orchestration; new bundled agent.
|
|
34
|
+
- **`Version bump:` enforcement in `/commit-push-pr`** (PR #131) — uses `AskUserQuestion` to demand a declaration on every PR; refuses to open without one.
|
|
35
|
+
- **Session-lifecycle redesign** (PR #132) — `/start` and `/end` write distinct artifacts: handoff (forward-looking, `docs/handoffs/HANDOFF-{branch}-{date}.md`) vs session summary (backward-looking, `.claude/sessions/{YYYY-MM-DD-HHMM}-{branch}.md`). Both carry `sha:` frontmatter for drift detection. New `/learn` and `/update-claude-md` meta/memory commands.
|
|
36
|
+
- **`.claude/scratch/` and `.claude/plans/` infrastructure** (PR #133) — five dependent commands (`/review-changes`, `/refactor-clean`, `/review-plan`, `/test-coverage`, `/observability`) write SHA-tagged artifacts that `/start` surfaces, distinguishing fresh from stale findings.
|
|
37
|
+
- **T3.6 installation rationale + T3.8 drift detect surfaces** (PR #138) — exposes detection signals to slash commands.
|
|
38
|
+
- **T3.9 optional features registry** (PR #139) — opt-in toggles for non-default flows surfaced through `init` and `upgrade`.
|
|
39
|
+
- **Memory-architecture skill + `/update-claude-md` promotion algorithm** (PR #140) — five-layer memory model (CLAUDE.md, learnings, scratch, sessions, auto-memory). `/update-claude-md` reviews learnings and proposes targeted CLAUDE.md edits with diff preview.
|
|
40
|
+
- **`@claude` GitHub Action surface via `init` opt-in** (PR #146) — scaffolds `.github/workflows/claude-code.yml` exposing the @claude bot; docs document the OIDC + token-exchange contract.
|
|
41
|
+
- **POSIX helper scripts under `templates/scripts/`** (PR #151) — `start-drift.sh`, `sync-release-scope.sh`, `test-coverage-changed-files.sh` extract multi-line bash from `/start`, `/sync`, `/test-coverage` so each invocation matches a single allow rule. New `scaffoldScripts` function wired into Scenarios A/B/C (init, merger, upgrade flows). New `'script'` file class.
|
|
42
|
+
- **Expanded `templates/settings/base.json` allow list** (PR #151) — `Bash(test:*)`, `Bash([:*)`, `Bash(bash:*)`, `WebFetch(domain:docs.anthropic.com|docs.claude.com|github.com|api.github.com)`, `WebSearch`, `Skill(update-config)`, `Skill(fewer-permission-prompts)` — closes the most common in-session permission-prompt fragmentation paths.
|
|
43
|
+
- **CLAUDE.md Critical Rule #16** (PR #150) — commit/push/PR only when the human invokes `/commit-push-pr` or `/sync` explicitly. Conversational "yes" no longer authorizes git writes; agents refuse without a slash-command trigger.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- ⚠ **PR #125 — 2026-04 master architecture audit + canonical 7-phase plan** — no `Version bump:` declaration (under-documented; treated as `none`). Pure docs landing into `docs/phases/`, `docs/archive/audits/2026-04/master-architecture-audit.md`, and `docs/archive/decisions/2026-04/`. Establishes the deliberation history that subsequent PRs execute against.
|
|
48
|
+
- **Retired 3 slash commands** (PR #130) — superseded by other workflows; net slash-command count drops from 18 to 16.
|
|
49
|
+
- **`/verify`, `/conflict-resolver`, `/build-fix` polished** (PR #131) — alongside the versioning enforcement work.
|
|
50
|
+
- **BACKLOG.md is rolling** (PR #127) — single file, items removed when scheduled; no per-release archive, no version-suffixed BACKLOG files.
|
|
51
|
+
- **Skill rewrite + hooks gap-fill** (PR #127) — every hook event documented in SPEC has a scaffolded handler; skills updated to current voice.
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
- **Misleading static test count in drift display** (PR #147) — `worclaude doc-lint` no longer reports a hard-coded test count when the actual count differs.
|
|
56
|
+
- **Phase 1 PR A drift cleanup — text + agent metadata** (PR #126) — aligns scaffold-template prose and agent frontmatter with the routing-fields contract.
|
|
57
|
+
|
|
58
|
+
### Tests
|
|
59
|
+
|
|
60
|
+
- **947 tests across 69 files** (was 804/58 at v2.8.0 release). Net +143 tests across the seven phases.
|
|
61
|
+
|
|
62
|
+
### Docs
|
|
63
|
+
|
|
64
|
+
- **Comprehensive post-Phase-1-7 docs refresh** (PR #148) — counts, new commands, observability flow surfaced consistently across CLAUDE.md, README, VitePress site.
|
|
65
|
+
- **Phase plans archived under `docs/archive/phases/`** (PR #149) — Phase 1, 2, 3, 4, 5, 6a, 7 deliberation history preserved post-execution.
|
|
66
|
+
- **Phase 1 + Phase 2 retrospectives** (PRs #129, #134) — what landed vs what slipped, lessons forward.
|
|
67
|
+
- **Phase 3 PR A — docs contracts T3.4/T3.5/T3.7** (PR #135) — PR template, drift-allowed sentinel, consequence lines.
|
|
68
|
+
- **Phase 3 PR B — small wins T3.10/T3.11** (PR #136) — handoff TTL + `sha:` frontmatter dogfood across templates.
|
|
69
|
+
- **Phase 5 PR A — SoT markers, SPEC ToC, PR template** (PR #141) — source-of-truth markers across templates.
|
|
70
|
+
- **`docs/reference/permissions.md` — "Why prompts still fire" section** (PR #151) — env-var-prefix gotcha, multi-line fragmentation, pipes/redirects, the `additionalDirectories` directory-access layer, and pointer to Claude Code's built-in `/fewer-permission-prompts` skill.
|
|
71
|
+
|
|
7
72
|
## [2.8.0] — 2026-04-24
|
|
8
73
|
|
|
9
74
|
Fixes a long-standing agent worktree correctness bug. Both `claude --worktree` and the `Agent` tool's `isolation: "worktree"` option create their isolated checkout from `origin/HEAD` — which on most worclaude-convention repos resolves to `origin/main`. When the working branch (typically `develop`) is ahead of main (the normal state mid-release-cycle), agent worktrees get a stale checkout that misses recent commits, producing "missing develop files" symptoms easy to misattribute to tooling flakiness. This release ships two complementary fixes: a new `worclaude doctor` check that detects and warns on the at-risk configuration with a local, reversible remedy (`git remote set-head origin <branch>`), and a freshness preamble on the three bundled worktree agents (`bug-fixer`, `verify-app`, `test-writer`) that resets the worktree to match the parent's current branch regardless of `origin/HEAD`. Documentation in `subagent-usage` now correctly describes the harness behavior instead of the previous "creates a worktree from your current branch" claim.
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="assets/
|
|
2
|
+
<img src="assets/banner.png" alt="Worclaude: The Workflow Layer for Claude Code" width="100%" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
<a href="https://github.com/sefaertunc/Worclaude/issues">Issues</a>
|
|
24
24
|
</p>
|
|
25
25
|
|
|
26
|
-
# Worclaude
|
|
26
|
+
# Worclaude: The Workflow Layer for Claude Code
|
|
27
27
|
|
|
28
|
-
Worclaude scaffolds a complete Claude Code workflow into any project in seconds. One `init` command installs
|
|
28
|
+
Worclaude scaffolds a complete Claude Code workflow into any project in seconds. One `init` command installs 25 agents, 16 slash commands, 17 skills, an 11-event hook layer, local observability capture, a five-layer memory system, and a CLAUDE.md template tuned for your tech stack. It implements the patterns in [howborisusesclaudecode.com](https://www.howborisusesclaudecode.com/) as a reusable, upgradable scaffold, so you stop rebuilding the same configuration for every new project.
|
|
29
29
|
|
|
30
30
|
<div align="center">
|
|
31
31
|
|
|
32
|
-
| CLI Commands | Agents | Slash Commands | Skills |
|
|
33
|
-
| :----------: | :-----------------------: | :------------: | :-------------------: |
|
|
34
|
-
|
|
|
35
|
-
| subcommands | across 6 categories | session tools | universal + templates |
|
|
32
|
+
| CLI Commands | Agents | Slash Commands | Skills | Hooks | Tech Stacks |
|
|
33
|
+
| :----------: | :-----------------------: | :------------: | :-------------------: | :------------: | :-----------: |
|
|
34
|
+
| 14 | 6 universal + 19 optional | 16 | 17 | 11 events | 16 |
|
|
35
|
+
| subcommands | across 6 categories | session tools | universal + templates | 7 hook scripts | auto-detected |
|
|
36
36
|
|
|
37
37
|
</div>
|
|
38
38
|
|
|
@@ -42,42 +42,52 @@ Worclaude scaffolds a complete Claude Code workflow into any project in seconds.
|
|
|
42
42
|
|
|
43
43
|
`worclaude init` installs a production-ready Claude Code workflow:
|
|
44
44
|
|
|
45
|
-
### Agents (
|
|
45
|
+
### Agents (25 total)
|
|
46
46
|
|
|
47
47
|
- **6 universal:** plan-reviewer (Opus), code-simplifier (Sonnet, worktree), test-writer (Sonnet, worktree), build-validator (Haiku), verify-app (Sonnet, worktree), upstream-watcher (Sonnet)
|
|
48
|
-
- **
|
|
48
|
+
- **19 optional** across 6 categories: Backend, Frontend, DevOps, Quality, Documentation, Data/AI. Worclaude recommends agents based on your project type.
|
|
49
49
|
|
|
50
|
-
### Slash Commands (
|
|
50
|
+
### Slash Commands (16)
|
|
51
51
|
|
|
52
|
-
Session lifecycle, review, verification, memory,
|
|
52
|
+
Session lifecycle, review, verification, memory, observability, and git automation:
|
|
53
53
|
|
|
54
|
-
`/start` `/end` `/commit-push-pr` `/review-plan` `/
|
|
54
|
+
`/start` `/end` `/commit-push-pr` `/review-plan` `/verify` `/compact-safe` `/update-claude-md` `/learn` `/setup` `/sync` `/conflict-resolver` `/review-changes` `/build-fix` `/refactor-clean` `/test-coverage` `/observability`
|
|
55
55
|
|
|
56
|
-
### Skills (
|
|
56
|
+
### Skills (17 total)
|
|
57
57
|
|
|
58
|
-
- **
|
|
59
|
-
- **3 project templates** filled in automatically by `/setup
|
|
60
|
-
- **1 generated
|
|
58
|
+
- **13 universal**: context-management, git-conventions, planning-with-files, review-and-handoff, prompt-engineering, verification, testing, claude-md-maintenance, coding-principles, subagent-usage, security-checklist, coordinator-mode, memory-architecture
|
|
59
|
+
- **3 project templates** filled in automatically by `/setup`: backend-conventions, frontend-design-system, project-patterns
|
|
60
|
+
- **1 generated**: agent-routing, dynamically built from your agent selections
|
|
61
61
|
|
|
62
62
|
Skills use Claude Code's directory format (`skill-name/SKILL.md`) and support **conditional activation** via path globs, so Claude only carries knowledge relevant to the current file.
|
|
63
63
|
|
|
64
|
-
### Hooks (
|
|
64
|
+
### Hooks (11 events, 7 hook scripts)
|
|
65
65
|
|
|
66
|
-
Worclaude scaffolds
|
|
66
|
+
Worclaude scaffolds 14 hook entries across 11 Claude Code events:
|
|
67
67
|
|
|
68
|
-
- **SessionStart
|
|
69
|
-
- **PostToolUse
|
|
70
|
-
- **PostCompact
|
|
71
|
-
- **PreCompact
|
|
72
|
-
- **UserPromptSubmit
|
|
73
|
-
- **Stop
|
|
74
|
-
- **
|
|
68
|
+
- **SessionStart**: auto-loads CLAUDE.md, PROGRESS.md, last session summary, and recent learnings
|
|
69
|
+
- **PostToolUse**: auto-formats code after every edit (formatter chosen by stack); strict profile adds a TypeScript check
|
|
70
|
+
- **PostCompact**: re-reads key files after context compaction so Claude stays oriented
|
|
71
|
+
- **PreCompact**: emergency git snapshot before auto-compaction (`pre-compact-save.cjs`)
|
|
72
|
+
- **UserPromptSubmit**: three handlers run in sequence (correction-detection, skill-hint matching, and command-invocation observability capture)
|
|
73
|
+
- **Stop**: extracts `[LEARN]` blocks from the transcript and persists them (`learn-capture.cjs`)
|
|
74
|
+
- **InstructionsLoaded**: captures skill loads to `.claude/observability/skill-loads.jsonl` (`obs-skill-loads.cjs`)
|
|
75
|
+
- **SubagentStart / SubagentStop**: captures agent invocations to `.claude/observability/agent-events.jsonl` (`obs-agent-events.cjs`)
|
|
76
|
+
- **SessionEnd / Notification**: quiet-by-default session-end and desktop alerts
|
|
75
77
|
|
|
76
|
-
Three profiles via `WORCLAUDE_HOOK_PROFILE`: `minimal` (context hooks only), `standard` (all hooks, default), `strict` (standard + TypeScript checking on every edit).
|
|
78
|
+
Three profiles via `WORCLAUDE_HOOK_PROFILE`: `minimal` (context hooks only; disables observability and notifications), `standard` (all hooks, default), `strict` (standard + TypeScript checking on every edit).
|
|
79
|
+
|
|
80
|
+
### Observability
|
|
81
|
+
|
|
82
|
+
A privacy-first per-project signal layer captures skill loads, command invocations, and agent timings to `.claude/observability/*.jsonl` (gitignored). The `worclaude observability` CLI and `/observability` slash command aggregate the signals into a Markdown report: top skills, top commands, agent failure rates, and anomalies. Zero data leaves the machine; opt out via `WORCLAUDE_HOOK_PROFILE=minimal` or by deleting the folder.
|
|
83
|
+
|
|
84
|
+
### GitHub Action Integration
|
|
85
|
+
|
|
86
|
+
When `worclaude init` finishes it offers to surface Claude Code's `/install-github-action` flow. If installed, `@claude` mentions in PR comments will automatically propose CLAUDE.md updates, slotting cleanly into the `/sync`-driven release flow. Worclaude itself never shells out to the install command; it just points you at it.
|
|
77
87
|
|
|
78
88
|
### Learnings System
|
|
79
89
|
|
|
80
|
-
A personal, gitignored store at `.claude/learnings/` captures corrections and rules Claude picks up mid-session and replays them at the start of future sessions. The `correction-detect.cjs` and `learn-capture.cjs` hooks do this automatically; the `/learn` slash command is the explicit capture path. Unlike CLAUDE.md (shared rules, in git), learnings are yours
|
|
90
|
+
A personal, gitignored store at `.claude/learnings/` captures corrections and rules Claude picks up mid-session and replays them at the start of future sessions. The `correction-detect.cjs` and `learn-capture.cjs` hooks do this automatically; the `/learn` slash command is the explicit capture path. Unlike CLAUDE.md (shared rules, in git), learnings are yours; useful for personal conventions that should not leak into the repo. Promote a learning to CLAUDE.md when it matures into something every contributor should follow.
|
|
81
91
|
|
|
82
92
|
### Cross-Tool Compatibility
|
|
83
93
|
|
|
@@ -119,18 +129,24 @@ claude --worktree --tmux
|
|
|
119
129
|
|
|
120
130
|
## Commands
|
|
121
131
|
|
|
122
|
-
| Command
|
|
123
|
-
|
|
|
124
|
-
| `worclaude init`
|
|
125
|
-
| `worclaude upgrade`
|
|
126
|
-
| `worclaude status`
|
|
127
|
-
| `worclaude backup`
|
|
128
|
-
| `worclaude restore`
|
|
129
|
-
| `worclaude diff`
|
|
130
|
-
| `worclaude delete`
|
|
131
|
-
| `worclaude doctor`
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
| Command | Description |
|
|
133
|
+
| ------------------------------ | ------------------------------------------------------------------------ |
|
|
134
|
+
| `worclaude init` | Scaffold workflow into new or existing project |
|
|
135
|
+
| `worclaude upgrade` | Update universal components and repair on-disk drift |
|
|
136
|
+
| `worclaude status` | Show current workflow state, version, and npm update status |
|
|
137
|
+
| `worclaude backup` | Create a timestamped backup of workflow files |
|
|
138
|
+
| `worclaude restore` | Restore from a previous backup |
|
|
139
|
+
| `worclaude diff` | Compare current setup vs latest template |
|
|
140
|
+
| `worclaude delete` | Remove worclaude workflow from project |
|
|
141
|
+
| `worclaude doctor` | Validate workflow installation health |
|
|
142
|
+
| `worclaude doc-lint` | Validate `<!-- references … -->` markers; surface tech-stack drift |
|
|
143
|
+
| `worclaude observability` | Aggregate per-project signals into a Markdown report (`--json`, `--out`) |
|
|
144
|
+
| `worclaude regenerate-routing` | Rebuild `agent-routing/SKILL.md` from `templates/agents/` |
|
|
145
|
+
| `worclaude scan` | Detect project type/stack via the project-scanner detectors |
|
|
146
|
+
| `worclaude setup-state` | Inspect / save / reset / resume `/setup` interview persistence |
|
|
147
|
+
| `worclaude worktrees clean` | Remove stale agent worktrees (locked or orphaned) |
|
|
148
|
+
|
|
149
|
+
The `init` command detects existing setups and merges intelligently; no data is overwritten without your confirmation. Use `upgrade` to pull in new features, restore missing files, and preserve your customizations. `upgrade` accepts `--dry-run`, `--yes`, and `--repair-only` for scripted flows. `doctor` accepts `--json` for CI dashboards. `doc-lint` accepts `--strict` to exit non-zero on drift (CI-friendly).
|
|
134
150
|
|
|
135
151
|
See the [full command reference](https://sefaertunc.github.io/Worclaude/reference/commands) for detailed usage and options.
|
|
136
152
|
|
|
@@ -139,11 +155,11 @@ See the [full command reference](https://sefaertunc.github.io/Worclaude/referenc
|
|
|
139
155
|
## Why Worclaude
|
|
140
156
|
|
|
141
157
|
- **Split architecture.** CLAUDE.md stays under 200 lines for speed; detail lives in skills loaded on demand. Personal rules live in `.claude/learnings/` (gitignored); shared rules live in CLAUDE.md.
|
|
142
|
-
- **Learning loop.** Correct Claude once, it captures the rule, the next session picks it up at start
|
|
158
|
+
- **Learning loop.** Correct Claude once, it captures the rule, the next session picks it up at start; no re-stating.
|
|
143
159
|
- **Cross-tool ready.** `AGENTS.md` generated from the same source as CLAUDE.md, so your rules work in Cursor / Codex / Copilot too.
|
|
144
160
|
- **Hook profiles.** Dial strictness up or down via one environment variable. `minimal` for CI, `standard` for daily work, `strict` for type-heavy projects.
|
|
145
|
-
- **Smart merge.** Detects existing Claude Code setups and merges additively
|
|
146
|
-
- **Self-healing doctor.** Catches drift, stale hashes, deprecated models, broken learnings
|
|
161
|
+
- **Smart merge.** Detects existing Claude Code setups and merges additively; existing files never overwritten without confirmation. Three-tier strategy: additive for missing content, safe-alongside for conflicts, interactive for CLAUDE.md.
|
|
162
|
+
- **Self-healing doctor.** Catches drift, stale hashes, deprecated models, broken learnings; before they bite.
|
|
147
163
|
- **Batched releases.** Every PR declares `Version bump: {major|minor|patch|none}` in its body; `/sync` aggregates declarations across merged PRs and only cuts a release when at least one rises above `none`. Internal-only work (docs, CI, tests) accumulates on `develop` without triggering noisy publishes.
|
|
148
164
|
|
|
149
165
|
---
|
|
@@ -152,25 +168,25 @@ See the [full command reference](https://sefaertunc.github.io/Worclaude/referenc
|
|
|
152
168
|
|
|
153
169
|
Worclaude draws from patterns and insights across the Claude Code ecosystem:
|
|
154
170
|
|
|
155
|
-
- [Boris Cherny's Claude Code tips](https://howborisusesclaudecode.com/)
|
|
156
|
-
- [everything-claude-code](https://github.com/affaan-m/everything-claude-code) by Affaan Mir (Anthropic hackathon winner)
|
|
157
|
-
- [Andrej Karpathy's coding principles](https://github.com/multica-ai/andrej-karpathy-skills)
|
|
158
|
-
- [pro-workflow](https://github.com/peterHoburg/pro-workflow)
|
|
159
|
-
- [Anthropic Engineering Blog](https://www.anthropic.com/engineering)
|
|
160
|
-
- [awesome-claude-code](https://github.com/hesreallyhim/awesome-claude-code) by hesreallyhim
|
|
161
|
-
- [awesome-claude-code-toolkit](https://github.com/rohitg00/awesome-claude-code-toolkit) by rohitg00
|
|
162
|
-
- [claude-skills-cli](https://github.com/anthropics/skills)
|
|
163
|
-
- [SuperClaude](https://github.com/andyholst/SuperClaude)
|
|
164
|
-
- [ccusage](https://github.com/yashikota/ccusage) / [claude-devtools](https://github.com/nicobailey/claude-devtools)
|
|
165
|
-
- [claude-flow](https://github.com/Ruflo/claude-flow) by Ruflo
|
|
166
|
-
- [Vercel SkillKit](https://github.com/vercel/skillkit)
|
|
167
|
-
- [claude-code-templates](https://github.com/danielsalas/claude-code-templates) by Daniel Avila
|
|
171
|
+
- [Boris Cherny's Claude Code tips](https://howborisusesclaudecode.com/): The foundational workflow patterns: multi-terminal pipelines, plan-then-execute, CLAUDE.md as shared knowledge, verification-first development
|
|
172
|
+
- [everything-claude-code](https://github.com/affaan-m/everything-claude-code) by Affaan Mir (Anthropic hackathon winner): Session persistence, hook profiles, confidence filtering, security scanning patterns
|
|
173
|
+
- [Andrej Karpathy's coding principles](https://github.com/multica-ai/andrej-karpathy-skills): Think before coding, simplicity first, surgical changes ([original post](https://x.com/karpathy/status/2015883857489522876))
|
|
174
|
+
- [pro-workflow](https://github.com/peterHoburg/pro-workflow): Correction detection, learning capture hooks, loop prevention patterns
|
|
175
|
+
- [Anthropic Engineering Blog](https://www.anthropic.com/engineering): Agent design, context engineering, harness patterns
|
|
176
|
+
- [awesome-claude-code](https://github.com/hesreallyhim/awesome-claude-code) by hesreallyhim: Community resource discovery and ecosystem awareness
|
|
177
|
+
- [awesome-claude-code-toolkit](https://github.com/rohitg00/awesome-claude-code-toolkit) by rohitg00: Toolkit patterns and companion app references
|
|
178
|
+
- [claude-skills-cli](https://github.com/anthropics/skills): Skill activation patterns and conditional loading insights
|
|
179
|
+
- [SuperClaude](https://github.com/andyholst/SuperClaude): Persona and mode system analysis (informed what NOT to build)
|
|
180
|
+
- [ccusage](https://github.com/yashikota/ccusage) / [claude-devtools](https://github.com/nicobailey/claude-devtools): Observability patterns (informed what NOT to build)
|
|
181
|
+
- [claude-flow](https://github.com/Ruflo/claude-flow) by Ruflo: Runtime orchestration patterns (informed the scaffolding-only philosophy)
|
|
182
|
+
- [Vercel SkillKit](https://github.com/vercel/skillkit): Skill packaging and marketplace patterns
|
|
183
|
+
- [claude-code-templates](https://github.com/danielsalas/claude-code-templates) by Daniel Avila: Template gallery and component catalog reference
|
|
168
184
|
|
|
169
185
|
---
|
|
170
186
|
|
|
171
187
|
## Links
|
|
172
188
|
|
|
173
|
-
- [Full Documentation](https://sefaertunc.github.io/Worclaude/)
|
|
189
|
+
- [Full Documentation](https://sefaertunc.github.io/Worclaude/): VitePress site with guides and reference
|
|
174
190
|
- [npm Package](https://www.npmjs.com/package/worclaude)
|
|
175
191
|
- [GitHub Issues](https://github.com/sefaertunc/Worclaude/issues)
|
|
176
192
|
- [Contributing](CONTRIBUTING.md)
|
package/SECURITY.md
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
| Version | Supported |
|
|
6
6
|
| ------- | ------------------ |
|
|
7
|
-
| 2.
|
|
8
|
-
| < 2.
|
|
7
|
+
| 2.9.x | :white_check_mark: |
|
|
8
|
+
| < 2.9 | :x: |
|
|
9
9
|
|
|
10
10
|
## Reporting a Vulnerability
|
|
11
11
|
|
|
@@ -69,39 +69,33 @@ an opt-in `workflow-meta.json`. The `fs-extra`-based filesystem capability
|
|
|
69
69
|
flag is a disclosure, not a vulnerability — removing it would delete the
|
|
70
70
|
tool's core function.
|
|
71
71
|
|
|
72
|
-
### Dev-only transitive advisories
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
`
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
`
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
`
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
- Worclaude's CI does not run `docs:dev`; it runs `test`, `lint`, and
|
|
100
|
-
`docs:build` only.
|
|
101
|
-
|
|
102
|
-
Tracking: a GitHub issue is opened to bump `vitepress` once a release
|
|
103
|
-
using `vite@>=6.4.2` lands upstream. Until then the scanner will continue
|
|
104
|
-
to flag these, and we accept the dev-only risk.
|
|
72
|
+
### Dev-only transitive advisories (fixed via overrides)
|
|
73
|
+
|
|
74
|
+
Three advisories sat deep in the dev-dependency tree, all pulled through
|
|
75
|
+
`vitepress@1.6.4 → vite@5.x → esbuild@0.21.x`. They are now pinned to
|
|
76
|
+
patched versions via `"overrides"` in `package.json`:
|
|
77
|
+
|
|
78
|
+
- **[GHSA-67mh-4wv8-2f99](https://github.com/advisories/GHSA-67mh-4wv8-2f99)
|
|
79
|
+
/ CVE-2026-41305** — `esbuild` dev-server CORS misconfiguration.
|
|
80
|
+
Override: `"esbuild": "^0.25.0"` (resolved 0.25.12).
|
|
81
|
+
- **[GHSA-4w7w-66w2-5vf9](https://github.com/advisories/GHSA-4w7w-66w2-5vf9)
|
|
82
|
+
/ CVE-2026-39365** — `vite` path traversal in optimized-deps handling
|
|
83
|
+
(affects vite 6.0.0–6.4.1; Socket's range matcher also flags 5.x).
|
|
84
|
+
Override: `"vite": "^6.4.2"` (resolved 6.4.2).
|
|
85
|
+
- **[GHSA-qx2v-qp2m-jg93](https://github.com/advisories/GHSA-qx2v-qp2m-jg93)** —
|
|
86
|
+
`postcss` XSS via unescaped `</style>` in CSS stringify output.
|
|
87
|
+
Override: `"postcss": "^8.5.10"` (resolved 8.5.12).
|
|
88
|
+
|
|
89
|
+
Verified clean: `npm audit` reports 0 vulnerabilities, `npm run docs:build`
|
|
90
|
+
succeeds against `vitepress@1.6.4` despite its declared `vite@^5.4.14`
|
|
91
|
+
peer range, and all 947 tests pass.
|
|
92
|
+
|
|
93
|
+
These were not exploitable in worclaude's actual usage — every advisory
|
|
94
|
+
required an active local dev server (`npm run docs:dev`) and the operator
|
|
95
|
+
visiting a hostile origin in the same session. `npm test`, `npm run lint`,
|
|
96
|
+
`npm run docs:build`, and CI never start a server. They are flagged
|
|
97
|
+
nonetheless because Socket and `npm audit` scan the lockfile by version,
|
|
98
|
+
not by exploit reachability.
|
|
105
99
|
|
|
106
100
|
### brace-expansion DoS (fixed via override)
|
|
107
101
|
|
|
@@ -109,3 +103,28 @@ to flag these, and we accept the dev-only risk.
|
|
|
109
103
|
`brace-expansion@<1.1.13` zero-step sequence. Fixed in 1.1.13; enforced
|
|
110
104
|
via `"overrides": { "brace-expansion": "^1.1.13" }` in `package.json`
|
|
111
105
|
since v2.6.2. Pulled by `eslint@9.x → minimatch@3.x`.
|
|
106
|
+
|
|
107
|
+
### AI-detected typosquat alert (false positive)
|
|
108
|
+
|
|
109
|
+
Socket's "AI-detected possible typosquat — Did you mean: claude" flag
|
|
110
|
+
triggers because the package name `worclaude` contains the substring
|
|
111
|
+
`claude`. The package was published under this name from day one
|
|
112
|
+
(2026-02), the npm namespace is owned by the original author
|
|
113
|
+
(`sefaertunc`), and the package is the canonical home for the workflow
|
|
114
|
+
described in this README. There is no upstream `claude` workflow
|
|
115
|
+
scaffolder being typosquatted — `claude` on npm is an unrelated
|
|
116
|
+
abandoned package. Renaming a published, indexed package would break
|
|
117
|
+
every existing user's CLI alias and slash-command muscle memory; the
|
|
118
|
+
alert is accepted as a permanent false positive.
|
|
119
|
+
|
|
120
|
+
### URL-strings supply-chain alert (template content)
|
|
121
|
+
|
|
122
|
+
Socket's "URL strings" alert lists hostnames and filenames extracted
|
|
123
|
+
from the package's text content (e.g. `gitforwindows.org`, `Fly.io`,
|
|
124
|
+
`Platform.sh`, `CLAUDE.md`, `SKILL.md`). Every match is documentation
|
|
125
|
+
or template prose under `templates/` — instruction text the scaffolder
|
|
126
|
+
writes into the user's project. Worclaude does not make network calls
|
|
127
|
+
at runtime; the only HTTP code path is `src/utils/npm.js`, which
|
|
128
|
+
queries the npm registry for the latest published version during
|
|
129
|
+
`worclaude upgrade` and `worclaude status`. The flagged strings are
|
|
130
|
+
content, not endpoints.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "worclaude",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"description": "The Workflow Layer for Claude Code — scaffold agents, commands, skills, hooks, and memory into any project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -79,6 +79,9 @@
|
|
|
79
79
|
"vitest": "^3.0.9"
|
|
80
80
|
},
|
|
81
81
|
"overrides": {
|
|
82
|
-
"brace-expansion": "^1.1.13"
|
|
82
|
+
"brace-expansion": "^1.1.13",
|
|
83
|
+
"esbuild": "^0.25.0",
|
|
84
|
+
"vite": "^6.4.2",
|
|
85
|
+
"postcss": "^8.5.10"
|
|
83
86
|
}
|
|
84
87
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { lintRepo } from '../utils/doc-lint.js';
|
|
2
|
+
import * as display from '../utils/display.js';
|
|
3
|
+
|
|
4
|
+
export async function docLintCommand(options = {}) {
|
|
5
|
+
const projectRoot = process.cwd();
|
|
6
|
+
const result = await lintRepo(projectRoot);
|
|
7
|
+
|
|
8
|
+
if (!result.hasDrift) {
|
|
9
|
+
display.success(`doc-lint clean — ${result.markerCount} marker(s) checked, no drift.`);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
display.newline();
|
|
14
|
+
display.barLine(`Drift in ${result.findings.length} location(s):`);
|
|
15
|
+
for (const f of result.findings) {
|
|
16
|
+
if (f.kind === 'test-count-drift') {
|
|
17
|
+
display.barLine(
|
|
18
|
+
` ${f.file}:${f.claimLine} — claims ${f.claimed.files} test files (actual ${f.actual.files})`
|
|
19
|
+
);
|
|
20
|
+
} else if (f.kind === 'missing-npm-script') {
|
|
21
|
+
display.barLine(
|
|
22
|
+
` ${f.file}:${f.markerLine} — references \`npm run ${f.scriptName}\` but no such script in package.json`
|
|
23
|
+
);
|
|
24
|
+
} else {
|
|
25
|
+
display.barLine(` ${f.file}:${f.markerLine} — ${f.kind}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
display.newline();
|
|
30
|
+
display.dim(
|
|
31
|
+
'Fix by running /sync (refreshes both test count and file count in step 10c via the test runner) or by editing the cited section.'
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
if (options.strict) {
|
|
35
|
+
process.exitCode = 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/commands/doctor.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
TEMPLATE_SKILLS,
|
|
12
12
|
} from '../data/agents.js';
|
|
13
13
|
import { hasClaudeMdMemoryGuidance, readClaudeMd } from '../core/drift-checks.js';
|
|
14
|
+
import { lintRepo } from '../utils/doc-lint.js';
|
|
14
15
|
import { resolveKeyPath, isWorkflowRefFile } from '../core/file-categorizer.js';
|
|
15
16
|
import * as display from '../utils/display.js';
|
|
16
17
|
|
|
@@ -98,6 +99,42 @@ function printResult(r) {
|
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
|
|
102
|
+
function checkInstallationRationale(meta) {
|
|
103
|
+
// Old installs scaffolded before T3.6 lack the field — do not flag.
|
|
104
|
+
if (!meta || !meta.installation) return null;
|
|
105
|
+
const { rationale } = meta.installation;
|
|
106
|
+
if (typeof rationale !== 'string' || rationale.trim() === '') {
|
|
107
|
+
return result(WARN, 'Installation rationale', 'Field present but rationale is empty');
|
|
108
|
+
}
|
|
109
|
+
return result(PASS, `Installation rationale: ${rationale}`, null);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async function checkDocLint(projectRoot) {
|
|
113
|
+
const lint = await lintRepo(projectRoot);
|
|
114
|
+
if (lint.markerCount === 0) return null;
|
|
115
|
+
if (!lint.hasDrift) {
|
|
116
|
+
return result(PASS, `doc-lint: ${lint.markerCount} marker(s) match their source`, null);
|
|
117
|
+
}
|
|
118
|
+
const summary = lint.findings
|
|
119
|
+
.slice(0, 3)
|
|
120
|
+
.map((f) => {
|
|
121
|
+
if (f.kind === 'test-count-drift') {
|
|
122
|
+
return `${f.file}:${f.claimLine} claims ${f.claimed.files} files (actual ${f.actual.files})`;
|
|
123
|
+
}
|
|
124
|
+
if (f.kind === 'missing-npm-script') {
|
|
125
|
+
return `${f.file}:${f.markerLine} references missing script \`npm run ${f.scriptName}\``;
|
|
126
|
+
}
|
|
127
|
+
return `${f.file}:${f.markerLine} ${f.kind}`;
|
|
128
|
+
})
|
|
129
|
+
.join('; ');
|
|
130
|
+
const more = lint.findings.length > 3 ? ` (+${lint.findings.length - 3} more)` : '';
|
|
131
|
+
return result(
|
|
132
|
+
WARN,
|
|
133
|
+
`doc-lint: ${lint.findings.length} drift finding(s)`,
|
|
134
|
+
`${summary}${more}. Run /sync to refresh tech-stack metrics, or fix the cited section.`
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
101
138
|
async function checkWorkflowMeta(projectRoot) {
|
|
102
139
|
if (!(await workflowMetaExists(projectRoot))) {
|
|
103
140
|
return result(FAIL, 'workflow-meta.json', 'Missing — run `worclaude init` to create');
|
|
@@ -905,6 +942,41 @@ async function checkOriginHead(projectRoot) {
|
|
|
905
942
|
);
|
|
906
943
|
}
|
|
907
944
|
|
|
945
|
+
const STALE_WORKTREE_THRESHOLD = 3;
|
|
946
|
+
|
|
947
|
+
async function checkStaleWorktrees(projectRoot) {
|
|
948
|
+
const worktreesDir = path.join(projectRoot, '.claude', 'worktrees');
|
|
949
|
+
if (!(await fs.pathExists(worktreesDir))) {
|
|
950
|
+
return result(PASS, '.claude/worktrees/ (none)', null);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
let entries;
|
|
954
|
+
try {
|
|
955
|
+
entries = await fs.readdir(worktreesDir);
|
|
956
|
+
} catch {
|
|
957
|
+
return result(PASS, '.claude/worktrees/ (unreadable, skipped)', null);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
const dirs = [];
|
|
961
|
+
for (const name of entries) {
|
|
962
|
+
if (name.startsWith('.')) continue;
|
|
963
|
+
const stat = await fs.stat(path.join(worktreesDir, name)).catch(() => null);
|
|
964
|
+
if (stat && stat.isDirectory()) dirs.push(name);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
if (dirs.length === 0) {
|
|
968
|
+
return result(PASS, '.claude/worktrees/ (empty)', null);
|
|
969
|
+
}
|
|
970
|
+
if (dirs.length <= STALE_WORKTREE_THRESHOLD) {
|
|
971
|
+
return result(PASS, `.claude/worktrees/ (${dirs.length} present)`, null);
|
|
972
|
+
}
|
|
973
|
+
return result(
|
|
974
|
+
WARN,
|
|
975
|
+
`.claude/worktrees/ has ${dirs.length} entries (threshold ${STALE_WORKTREE_THRESHOLD})`,
|
|
976
|
+
'Locked agent worktrees survive `git worktree prune`. Run `worclaude worktrees clean` to force-remove them.'
|
|
977
|
+
);
|
|
978
|
+
}
|
|
979
|
+
|
|
908
980
|
async function checkPendingReviewFiles(projectRoot) {
|
|
909
981
|
const pending = [];
|
|
910
982
|
try {
|
|
@@ -1000,6 +1072,10 @@ export async function doctorCommand(options = {}) {
|
|
|
1000
1072
|
// Documentation
|
|
1001
1073
|
section('Documentation');
|
|
1002
1074
|
record('docs', await checkDocSpecs(projectRoot));
|
|
1075
|
+
const rationaleCheck = checkInstallationRationale(meta);
|
|
1076
|
+
if (rationaleCheck) record('docs', rationaleCheck);
|
|
1077
|
+
const lintCheck = await checkDocLint(projectRoot);
|
|
1078
|
+
if (lintCheck) record('docs', lintCheck);
|
|
1003
1079
|
spacer();
|
|
1004
1080
|
|
|
1005
1081
|
// Learnings
|
|
@@ -1017,6 +1093,7 @@ export async function doctorCommand(options = {}) {
|
|
|
1017
1093
|
section('Integrity');
|
|
1018
1094
|
record('integrity', await checkHashIntegrity(projectRoot, meta));
|
|
1019
1095
|
record('integrity', await checkPendingReviewFiles(projectRoot));
|
|
1096
|
+
record('integrity', await checkStaleWorktrees(projectRoot));
|
|
1020
1097
|
spacer();
|
|
1021
1098
|
|
|
1022
1099
|
// Exit code
|