@jhizzard/termdeck-stack 0.4.3 → 0.4.5
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/assets/hooks/README.md +41 -11
- package/package.json +1 -1
package/assets/hooks/README.md
CHANGED
|
@@ -68,23 +68,53 @@ your own:
|
|
|
68
68
|
has dropped it.
|
|
69
69
|
2. Find the `PROJECT_MAP` array near the top of the file.
|
|
70
70
|
3. Add one entry per project; each entry is `{ pattern, project }`
|
|
71
|
-
where `pattern` is a regex matched against `cwd
|
|
71
|
+
where `pattern` is a regex matched against `cwd`.
|
|
72
|
+
|
|
73
|
+
### Order matters: most-specific-first
|
|
74
|
+
|
|
75
|
+
`detectProject(cwd)` returns the **first** matching entry. If a deep
|
|
76
|
+
project lives under a broader parent dir, the deep pattern must come
|
|
77
|
+
first or the parent will swallow it. This bug bit the TermDeck team in
|
|
78
|
+
Sprint 41 — every cwd under a `ChopinNashville/` parent was getting
|
|
79
|
+
tagged `chopin-nashville` because the parent-dir pattern came before
|
|
80
|
+
each sub-project's specific pattern.
|
|
81
|
+
|
|
82
|
+
Example showing the right ordering:
|
|
72
83
|
|
|
73
84
|
```js
|
|
74
85
|
const PROJECT_MAP = [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{ pattern:
|
|
86
|
+
// Specific code projects under a common parent — these MUST appear
|
|
87
|
+
// before the parent-dir catch-all below.
|
|
88
|
+
{ pattern: /\/MyOrg\/SideProjects\/widget-app/i, project: 'widget-app' },
|
|
89
|
+
{ pattern: /\/MyOrg\/SideProjects\/scheduler/i, project: 'scheduler' },
|
|
90
|
+
{ pattern: /\/MyOrg\/2026\/festival\/podium/i, project: 'podium' },
|
|
91
|
+
{ pattern: /\/MyOrg\/2026\/festival/i, project: 'festival' },
|
|
92
|
+
|
|
93
|
+
// Other top-level projects.
|
|
94
|
+
{ pattern: /\/PVB\//i, project: 'pvb' },
|
|
95
|
+
|
|
96
|
+
// Catch-all for the parent dir — only matches when no specific
|
|
97
|
+
// project above matched first.
|
|
98
|
+
{ pattern: /\/MyOrg(\/|$)/i, project: 'myorg-ops' },
|
|
78
99
|
];
|
|
79
100
|
```
|
|
80
101
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
`
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
102
|
+
For a worked example of a real production taxonomy (with explicit
|
|
103
|
+
priority ordering, alias documentation, and a structural-invariant
|
|
104
|
+
test), see [`docs/PROJECT-TAXONOMY.md`](https://github.com/jhizzard/termdeck/blob/main/docs/PROJECT-TAXONOMY.md)
|
|
105
|
+
in the TermDeck repo.
|
|
106
|
+
|
|
107
|
+
### Other rules
|
|
108
|
+
|
|
109
|
+
- The map is local-only — it's never sent to any service. Editing it
|
|
110
|
+
takes effect on the next Claude Code session close (no restart
|
|
111
|
+
needed).
|
|
112
|
+
- Anything that doesn't match falls through to `'global'`.
|
|
113
|
+
- Adopt the module-export contract (`module.exports = { detectProject, PROJECT_MAP }`)
|
|
114
|
+
if you want to write a unit test that exercises your taxonomy. The
|
|
115
|
+
bundled hook already does this; if you copy-paste a custom hook,
|
|
116
|
+
preserve the `if (require.main === module)` guard around the stdin
|
|
117
|
+
reader so `require()` doesn't hang.
|
|
88
118
|
|
|
89
119
|
## Coexistence with Joshua's `rag-system` hook
|
|
90
120
|
|
package/package.json
CHANGED