@ulysses-ai/create-workspace 0.14.0-beta.1 → 0.14.0-beta.3
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/README.md +1 -1
- package/package.json +1 -1
- package/template/.claude/hooks/version-freshness-check.mjs +30 -0
- package/template/.claude/lib/freshness.mjs +75 -0
- package/template/.claude/lib/freshness.test.mjs +175 -0
- package/template/.claude/lib/registry-check.mjs +106 -0
- package/template/.claude/lib/registry-check.test.mjs +130 -0
- package/template/.claude/rules/memory-guidance.md +47 -0
- package/template/.claude/rules/workspace-structure.md +2 -0
- package/template/.claude/scripts/build-shared-context-index.mjs +212 -0
- package/template/.claude/scripts/build-shared-context-index.test.mjs +318 -0
- package/template/.claude/scripts/migrate-claude-md-freshness-include.mjs +30 -0
- package/template/.claude/scripts/migrate-claude-md-freshness-include.test.mjs +54 -0
- package/template/.claude/settings.json +6 -0
- package/template/.claude/skills/maintenance/SKILL.md +49 -7
- package/template/.claude/skills/workspace-update/SKILL.md +16 -0
- package/template/CLAUDE.md.tmpl +1 -0
- package/template/_gitignore +2 -3
- package/template/workspace.json.tmpl +1 -0
|
@@ -30,6 +30,7 @@ For each shared-context `.md` file and each `work-sessions/*/workspace/session.m
|
|
|
30
30
|
- `lifecycle: active` on a file not updated in 7+ days? (stale candidate)
|
|
31
31
|
- `lifecycle: resolved` files that should have been processed by /complete-work?
|
|
32
32
|
- Session tracker `status: active` but the workspace worktree at `work-sessions/{name}/workspace/` is missing? (orphaned)
|
|
33
|
+
- `confidence` field present? Must be one of `high`, `medium`, `low` if set.
|
|
33
34
|
|
|
34
35
|
### 3. Workspace structure
|
|
35
36
|
- Actual directory layout matches what workspace-structure rule describes?
|
|
@@ -44,24 +45,63 @@ For each shared-context `.md` file and each `work-sessions/*/workspace/session.m
|
|
|
44
45
|
- Workspace repo on expected branch?
|
|
45
46
|
- Orphan worktree records in project repos — run `git -C repos/{repo} worktree list` for each repo and flag any `prunable` markers. These usually come from a workspace-first teardown (the unsafe order) leaving stale admin records behind. Suggest `git worktree prune` on the affected repo.
|
|
46
47
|
|
|
48
|
+
### 5. Shared-context index integrity
|
|
49
|
+
|
|
50
|
+
`shared-context/index.md` is auto-generated from frontmatter. Run the check:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
node .claude/scripts/build-shared-context-index.mjs --check --root .
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Three failure modes (script exits 1 with a JSON status):
|
|
57
|
+
|
|
58
|
+
- `missing` — `shared-context/` exists but `index.md` does not. Run `--write` to create.
|
|
59
|
+
- `stale` — `index.md` exists but its entries no longer match the filesystem. Causes: a file was added or deleted, a `description:` was changed, a `.indexignore` rule was added. Run `--write` to regenerate.
|
|
60
|
+
- (no failure) — `current` with the entry count.
|
|
61
|
+
|
|
62
|
+
Audit mode reports the status. Cleanup mode runs `--write` if stale or missing, then re-checks.
|
|
63
|
+
|
|
64
|
+
While the index is being read, also flag entries with weak fallbacks: filename-slug-only descriptions (e.g., "project status" with no period) usually indicate the underlying file is missing a `description:` or has no usable opening sentence. Suggest adding `description:` to those source files — the index will pick it up on the next regeneration.
|
|
65
|
+
|
|
66
|
+
### 6. Template freshness
|
|
67
|
+
|
|
68
|
+
Compare the workspace's pinned template version against the latest published on npm.
|
|
69
|
+
|
|
70
|
+
Always invoke `refreshIfStale` from the audit (regardless of `workspace.versionCheck.ambient` — the user explicitly ran `/maintenance`):
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
import { refreshIfStale } from './.claude/lib/freshness.mjs';
|
|
74
|
+
const result = await refreshIfStale({
|
|
75
|
+
workspaceRoot: process.cwd(),
|
|
76
|
+
ttlMs: 24 * 60 * 60 * 1000,
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Report one of:
|
|
81
|
+
- `outdated` → `✗ Template v{current} → v{latest} available. Run npx @ulysses-ai/create-workspace --upgrade.`
|
|
82
|
+
- `current` → `✓ Template is up to date (v{latest}).`
|
|
83
|
+
- `unknown` (with cache) → `⚠ Could not reach npm registry; last cached latest was v{latest} as of {checkedAt}.`
|
|
84
|
+
- `unknown` (no cache) → `⚠ Could not reach npm registry; no cached version on file. Try again when online.`
|
|
85
|
+
- `skipped: 'uninitialized'` → `⚠ Workspace not initialized; freshness check unavailable.`
|
|
86
|
+
|
|
47
87
|
## Cleanup
|
|
48
88
|
|
|
49
89
|
Active recommendations. Flags problems and suggests fixes, but asks before acting.
|
|
50
90
|
|
|
51
|
-
###
|
|
91
|
+
### 7. Stale context
|
|
52
92
|
- Ephemeral files not updated in 7+ days — suggest resolve, update, or archive
|
|
53
93
|
- `work-sessions/{name}/` folders whose worktrees are gone — suggest cleanup
|
|
54
94
|
- Session trackers whose branches have been merged — suggest `/complete-work` post-flight cleanup
|
|
55
95
|
- Braindumps that overlap significantly — suggest merging (e.g., "workspace-branching.md and persistent-work-sessions.md cover the same topic")
|
|
56
96
|
- Handoffs referencing deleted branches — suggest resolve or remove
|
|
57
97
|
|
|
58
|
-
###
|
|
98
|
+
### 8. Context reconciliation
|
|
59
99
|
- Read recent shared-context writes (last session or last N files by updated date)
|
|
60
100
|
- For each, scan other shared-context files for references that are now stale
|
|
61
101
|
- Surface: "{file} says X but {newer-file} now says Y. Update {file}?"
|
|
62
102
|
- This is the capture-time cross-check, run retroactively instead of inline
|
|
63
103
|
|
|
64
|
-
###
|
|
104
|
+
### 9. Health metrics
|
|
65
105
|
- Size of `shared-context/locked/` relative to the active model's context window — flag if over 5% (yellow) or 15% (red). Absolute byte count is a weak proxy; contradictions, stale references, and duplicated coverage across files matter more than total size.
|
|
66
106
|
- Number of ephemeral files — flag if accumulating without resolution
|
|
67
107
|
- Session log stats (if `workspace-scratchpad/session-log.jsonl` exists):
|
|
@@ -90,11 +130,12 @@ Cleanup suggestions (2):
|
|
|
90
130
|
⊕ migration-recipes.md still says "/sync handles dogfood" but
|
|
91
131
|
/sync was replaced by /sync-work — update?
|
|
92
132
|
|
|
93
|
-
OK (
|
|
133
|
+
OK (5):
|
|
94
134
|
✓ All CLAUDE.md skill references valid
|
|
95
135
|
✓ Workspace structure matches rule
|
|
96
136
|
✓ workspace.json repos all present
|
|
97
137
|
✓ No frontmatter errors
|
|
138
|
+
✓ Template is up to date (v0.14.0)
|
|
98
139
|
```
|
|
99
140
|
|
|
100
141
|
## Flow
|
|
@@ -104,9 +145,10 @@ OK (4):
|
|
|
104
145
|
3. Read workspace.json — extract repo manifest
|
|
105
146
|
4. Check `.claude/rules/`, `.claude/skills/`, `.claude/agents/` against references
|
|
106
147
|
5. Check git state (worktrees, branches, remotes)
|
|
107
|
-
6.
|
|
108
|
-
7.
|
|
109
|
-
8.
|
|
148
|
+
6. Run `node .claude/scripts/build-shared-context-index.mjs --check --root .` — capture status
|
|
149
|
+
7. Read session-log.jsonl if it exists
|
|
150
|
+
8. If cleanup mode: regenerate the shared-context index if stale; compare files pairwise for overlap; scan for stale cross-references
|
|
151
|
+
9. Compile and present findings grouped by severity
|
|
110
152
|
|
|
111
153
|
## Notes
|
|
112
154
|
- Audit mode is always read-only — never modifies files
|
|
@@ -75,6 +75,22 @@ Also handle these non-component files from the payload:
|
|
|
75
75
|
|
|
76
76
|
Read `toVersion` from `.workspace-update/.manifest.json` and update `templateVersion` in `workspace.json` to match.
|
|
77
77
|
|
|
78
|
+
### Step 4a: Run idempotent migrators
|
|
79
|
+
|
|
80
|
+
The payload may include migrator scripts at `.workspace-update/.claude/scripts/migrate-*.mjs` that bring older workspaces forward in shape. They are idempotent — safe to re-run on already-migrated workspaces. Run each one and surface its action in the upgrade summary.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
node .workspace-update/.claude/scripts/migrate-claude-md-freshness-include.mjs
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Output is JSON: `{"action":"appended"|"unchanged"|"skipped"}`.
|
|
87
|
+
|
|
88
|
+
- `appended` — the workspace's `CLAUDE.md` got the `@local-only-template-freshness.md` include line added at the end.
|
|
89
|
+
- `unchanged` — the line was already present.
|
|
90
|
+
- `skipped` — no `CLAUDE.md` exists at the workspace root (rare; surface to the user).
|
|
91
|
+
|
|
92
|
+
Add other migrators here as the template ships them.
|
|
93
|
+
|
|
78
94
|
### Step 5: Post-update verification
|
|
79
95
|
|
|
80
96
|
Run `/maintenance audit` again to verify the update didn't introduce:
|
package/template/CLAUDE.md.tmpl
CHANGED
package/template/_gitignore
CHANGED
|
@@ -16,9 +16,8 @@ workspace-scratchpad/
|
|
|
16
16
|
.claude/settings.local.json
|
|
17
17
|
.claude/.active-session.json
|
|
18
18
|
|
|
19
|
-
# Local-only convention
|
|
20
|
-
|
|
21
|
-
shared-context/**/local-only-*
|
|
19
|
+
# Local-only convention — machine-local state, any depth
|
|
20
|
+
local-only-*
|
|
22
21
|
|
|
23
22
|
# IDE
|
|
24
23
|
.idea/
|