@johngaynor/ocnus 0.0.0-stage → 2.0.0

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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +988 -2
  3. package/agents/linear-mcp.json +1 -0
  4. package/agents/ocnus-build.md +23 -0
  5. package/agents/ocnus-write-up.md +20 -0
  6. package/cli/host-mark +36 -0
  7. package/cli/lib/agents.sh +350 -0
  8. package/cli/lib/approval.sh +94 -0
  9. package/cli/lib/archive.sh +447 -0
  10. package/cli/lib/billing.sh +166 -0
  11. package/cli/lib/close.sh +189 -0
  12. package/cli/lib/commands.sh +220 -0
  13. package/cli/lib/common.sh +215 -0
  14. package/cli/lib/finish.sh +288 -0
  15. package/cli/lib/github.sh +162 -0
  16. package/cli/lib/guard.sh +134 -0
  17. package/cli/lib/handoff.sh +551 -0
  18. package/cli/lib/host.sh +1802 -0
  19. package/cli/lib/linear.sh +1389 -0
  20. package/cli/lib/links.sh +135 -0
  21. package/cli/lib/merges.sh +853 -0
  22. package/cli/lib/recipes.sh +54 -0
  23. package/cli/lib/settings.sh +465 -0
  24. package/cli/lib/space.sh +343 -0
  25. package/cli/lib/task.sh +847 -0
  26. package/cli/lib/tests.sh +268 -0
  27. package/cli/lib/trust.sh +70 -0
  28. package/cli/ocnus +630 -0
  29. package/herdr/README.md +2238 -0
  30. package/herdr/layouts/default.json +259 -0
  31. package/herdr/mods/agent-settings/cog.svg +4 -0
  32. package/herdr/mods/agent-settings/main.js +356 -0
  33. package/herdr/mods/agent-settings/mod.json +1 -0
  34. package/herdr/mods/cards/main.js +450 -0
  35. package/herdr/mods/cards/mod.json +1 -0
  36. package/herdr/mods/cards/refresh.svg +4 -0
  37. package/herdr/mods/cpu/main.js +90 -0
  38. package/herdr/mods/cpu/mod.json +1 -0
  39. package/herdr/mods/layout-switch/main.js +48 -0
  40. package/herdr/mods/layout-switch/mod.json +1 -0
  41. package/herdr/mods/names/main.js +69 -0
  42. package/herdr/mods/names/mod.json +1 -0
  43. package/herdr/mods/ocnus-spaces/main.js +376 -0
  44. package/herdr/mods/ocnus-spaces/mod.json +1 -0
  45. package/herdr/mods/steps/main.js +354 -0
  46. package/herdr/mods/steps/mod.json +1 -0
  47. package/herdr/spaces/template/SPACE.md +19 -0
  48. package/package.json +27 -4
  49. package/prompts/task-build.md +11 -0
  50. package/prompts/task-new.md +17 -0
  51. package/skills/brief/SKILL.md +64 -0
  52. package/skills/sdlc-breakdown/SKILL.md +312 -0
  53. package/skills/sdlc-build/SKILL.md +182 -0
  54. package/skills/sdlc-define/SKILL.md +203 -0
  55. package/skills/sdlc-plan/SKILL.md +202 -0
  56. package/skills/sdlc-pr/SKILL.md +339 -0
  57. package/skills/sdlc-review/SKILL.md +227 -0
@@ -0,0 +1,135 @@
1
+ # Linking mods and layouts into Herdr, and skills and agent profiles into
2
+ # Claude Code. Sourced by cli/ocnus.
3
+
4
+ # Whether a path in the repo is still something ocnus links: a mod
5
+ # folder while it holds a mod.json, a skill folder while it holds a SKILL.md,
6
+ # and anything else, such as a layout or a profile, while it is there. On a
7
+ # clone, git leaves a removed mod's folder behind when it still holds the
8
+ # files herdr-app check writes, which herdr/.gitignore ignores. A path deeper
9
+ # in a mod or skill folder is neither, so it only has to be there.
10
+ is_linkable() {
11
+ case $1 in
12
+ "$REPO"/herdr/mods/*/* | "$REPO"/skills/*/*) [ -e "$1" ] ;;
13
+ "$REPO"/herdr/mods/*) [ -f "$1/mod.json" ] ;;
14
+ "$REPO"/skills/*) [ -f "$1/SKILL.md" ] ;;
15
+ *) [ -e "$1" ] ;;
16
+ esac
17
+ }
18
+
19
+ # The mods and layouts, each (source, destination) pair one per line,
20
+ # tab-separated. They go in Herdr's folder.
21
+ herdr_wanted() {
22
+ local m l
23
+ for m in "$REPO"/herdr/mods/*/; do
24
+ m=${m%/}
25
+ is_linkable "$m" || continue
26
+ printf '%s\t%s\n' "$m" "$APP_HOME/mods/${m##*/}"
27
+ done
28
+ for l in "$REPO"/herdr/layouts/*.json; do
29
+ [ -f "$l" ] || continue
30
+ printf '%s\t%s\n' "$l" "$APP_HOME/layouts/${l##*/}"
31
+ done
32
+ }
33
+
34
+ # Every (source, destination) pair this repo wants linked, one per line,
35
+ # tab-separated. The mods and layouts only once Herdr has been opened.
36
+ wanted() {
37
+ local s a
38
+ ! herdr_opened || herdr_wanted
39
+ for s in "$REPO"/skills/*/; do
40
+ s=${s%/}
41
+ is_linkable "$s" || continue
42
+ printf '%s\t%s\n' "$s" "$SKILLS_HOME/${s##*/}"
43
+ done
44
+ # Only the profiles: agents/ also holds the MCP config they start with,
45
+ # which `task new` and `task build` name by its path in the repo.
46
+ for a in "$REPO"/agents/*.md; do
47
+ [ -f "$a" ] || continue
48
+ printf '%s\t%s\n' "$a" "$AGENTS_HOME/${a##*/}"
49
+ done
50
+ }
51
+
52
+ # linked | missing | elsewhere (a link to somewhere else) | blocked (a real file)
53
+ state_of() {
54
+ local src=$1 dst=$2
55
+ if [ -L "$dst" ]; then
56
+ [ "$(readlink "$dst")" = "$src" ] && echo linked || echo elsewhere
57
+ elif [ -e "$dst" ]; then echo blocked
58
+ else echo missing
59
+ fi
60
+ }
61
+
62
+ # A short name for a destination: mods/cpu, layouts/default.json,
63
+ # skills/sdlc-plan, agents/ocnus-build.md.
64
+ label() {
65
+ local dst=$1
66
+ case $dst in
67
+ "$SKILLS_HOME"/*) say "skills/${dst#"$SKILLS_HOME"/}" ;;
68
+ "$AGENTS_HOME"/*) say "agents/${dst#"$AGENTS_HOME"/}" ;;
69
+ *) say "${dst#"$APP_HOME"/}" ;;
70
+ esac
71
+ }
72
+
73
+ # Link what is missing. Never touches a real file or someone else's link.
74
+ # Makes nothing in Herdr's folder before Herdr has made it.
75
+ link_all() {
76
+ local src dst added=0 skipped=0
77
+ ! herdr_opened || mkdir -p "$APP_HOME/mods" "$APP_HOME/layouts"
78
+ [ ! -d "$REPO/skills" ] || mkdir -p "$SKILLS_HOME"
79
+ [ ! -d "$REPO/agents" ] || mkdir -p "$AGENTS_HOME"
80
+ while IFS=$'\t' read -r src dst; do
81
+ case $(state_of "$src" "$dst") in
82
+ linked) ;;
83
+ missing) ln -s "$src" "$dst"; say " linked $(label "$dst")"; added=$((added + 1)) ;;
84
+ elsewhere) say " skipped $(label "$dst") (already a link to $(readlink "$dst"))"; skipped=$((skipped + 1)) ;;
85
+ blocked) say " skipped $(label "$dst") (a real file is in the way; move it aside to use ours)"; skipped=$((skipped + 1)) ;;
86
+ esac
87
+ done < <(wanted)
88
+ [ "$added" -gt 0 ] || say " nothing new to link"
89
+ CHANGED=$((CHANGED + added))
90
+ SKIPPED=$skipped
91
+ }
92
+
93
+ # Remove links that point into this repo at something it no longer links (a
94
+ # mod, layout, skill or profile that was deleted or renamed upstream). A
95
+ # folder left behind stays in the repo; only its link goes. Before Herdr's
96
+ # first run its folder is not there: its patterns match nothing, which is no
97
+ # link, so only the skills and profiles are looked at.
98
+ prune() {
99
+ local dst target why
100
+ for dst in "$APP_HOME"/mods/* "$APP_HOME"/layouts/* "$SKILLS_HOME"/* "$AGENTS_HOME"/*; do
101
+ [ -L "$dst" ] || continue
102
+ target=$(readlink "$dst")
103
+ case $target in "$REPO"/herdr/* | "$REPO"/skills/* | "$REPO"/agents/*) ;; *) continue ;; esac
104
+ is_linkable "$target" && continue
105
+ if [ ! -e "$target" ]; then
106
+ why="no longer in the repo"
107
+ else
108
+ # Only a mod or a skill folder can be there and not be linked.
109
+ case $target in "$REPO"/skills/*) why=SKILL.md ;; *) why=mod.json ;; esac
110
+ why="${target#"$REPO"/} has no $why; the folder is left in the repo"
111
+ fi
112
+ rm "$dst"; say " removed $(label "$dst") ($why)"
113
+ CHANGED=$((CHANGED + 1))
114
+ done
115
+ }
116
+
117
+ # Herdr does not notice edits made through a link. Switching to a shipped
118
+ # layout and back makes it re-read our layouts and mods. With the app closed
119
+ # there is nothing to switch: it reads the links when it starts.
120
+ refresh_herdr() {
121
+ local current
122
+ current=$(herdr_app status 2>/dev/null | sed -n 's/.*"layout": *"\([^"]*\)".*/\1/p' | head -n 1) || true
123
+ if [ -z "$current" ]; then
124
+ say " the Herdr app is not open; it picks everything up when it starts"
125
+ return 0
126
+ fi
127
+ local other=main
128
+ [ "$current" = main ] && other=terminals
129
+ herdr_app do layout.switch "{\"name\":\"$other\"}" >/dev/null 2>&1 || true
130
+ if herdr_app do layout.switch "{\"name\":\"$current\"}" >/dev/null 2>&1; then
131
+ say " refreshed Herdr (layout: $current)"
132
+ else
133
+ say " could not switch Herdr back to '$current'; pick it from the Layout dropdown or press ctrl-shift-l"
134
+ fi
135
+ }