setup-cc-room 0.2.1 → 0.2.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.
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: show
3
+ description: Explicit whiteboard posts and sharing of skills, commands, or CLAUDE.md. Use /private for local/public toggle.
4
+ ---
5
+
6
+ Write explicitly to the room whiteboard. **Use `/private` to toggle local/public** (the old `/show` toggle is removed).
7
+
8
+ ## Resolve the port
9
+
10
+ Before every HTTP request, resolve the port:
11
+
12
+ ```bash
13
+ CC_ROOM_HOME="${CC_ROOM_HOME:-$HOME/.cc-room}"
14
+ HTTP_PORT=$(grep 'http_port:' "$CC_ROOM_HOME/config.yaml" 2>/dev/null | awk '{print $2}' | tr -d '[:space:]')
15
+ HTTP_PORT="${HTTP_PORT:-7332}"
16
+ BASE_URL="http://127.0.0.1:$HTTP_PORT"
17
+ ```
18
+
19
+ ## Subcommands
20
+
21
+ ### `/show` (no args) — deprecated
22
+
23
+ The old toggle is removed. Guide the user:
24
+
25
+ ```
26
+ Use /private to toggle local/public:
27
+ /private on — local mode (hide work)
28
+ /private off — back to public (choose share/drop for pending work)
29
+ To post a message, use /show "message".
30
+ ```
31
+
32
+ ### `/show <message>` — post a message
33
+
34
+ Post to the **Primary** room whiteboard.
35
+
36
+ 1. Check `private` via `GET $BASE_URL/status`.
37
+ 2. If Private ON, always confirm with the user:
38
+ "You are in local mode. This message will be posted to Primary (<primary_room_name>). Send it?"
39
+ → Continue only if they accept.
40
+ 3. `POST $BASE_URL/share` with:
41
+ ```json
42
+ { "message": "<message>" }
43
+ ```
44
+ (Posted to Primary only.)
45
+ 4. On success:
46
+ ```
47
+ 📡 [<room_name>] <message>
48
+ ```
49
+
50
+ ### `/show skill <name>` — share a skill
51
+
52
+ Share your skill file with everyone in the room (recipients must accept).
53
+
54
+ 1. Resolve the port (above).
55
+ 2. Load the skill file:
56
+ ```bash
57
+ SKILL_NAME="<name>"
58
+ SKILL_BASE="${SKILL_NAME%.md}"
59
+ SKILL_FILE=""
60
+ CC_CLAUDE_HOME="${CC_CLAUDE_HOME:-$HOME/.claude}"
61
+ for dir in "$CC_CLAUDE_HOME/skills" "$CC_CLAUDE_HOME/commands"; do
62
+ if [ -f "$dir/$SKILL_BASE.md" ]; then
63
+ SKILL_FILE="$dir/$SKILL_BASE.md"
64
+ break
65
+ elif [ -f "$dir/$SKILL_BASE" ]; then
66
+ SKILL_FILE="$dir/$SKILL_BASE"
67
+ break
68
+ fi
69
+ done
70
+ if [ -z "$SKILL_FILE" ]; then
71
+ echo "Error: skill '$SKILL_NAME' not found"
72
+ exit 1
73
+ fi
74
+ SKILL_CONTENT=$(cat "$SKILL_FILE")
75
+ ```
76
+ 3. `POST $BASE_URL/show/file` with:
77
+ ```json
78
+ { "share_type": "skill", "filename": "<name>.md", "content": "<file_content>" }
79
+ ```
80
+ 4. On success:
81
+ ```
82
+ 📤 Shared skill '<name>' (recipients must approve with /room accept)
83
+ ```
84
+
85
+ ### `/show command <name>` — share a command
86
+
87
+ Share your command file with everyone in the room (recipients must accept).
88
+
89
+ 1. Resolve the port (above).
90
+ 2. Load the command file:
91
+ ```bash
92
+ CMD_NAME="<name>"
93
+ CMD_BASE="${CMD_NAME%.md}"
94
+ CMD_FILE=""
95
+ for dir in "$HOME/.claude/commands"; do
96
+ if [ -f "$dir/$CMD_BASE.md" ]; then CMD_FILE="$dir/$CMD_BASE.md"; break; fi
97
+ done
98
+ if [ -z "$CMD_FILE" ]; then
99
+ echo "Error: command '$CMD_NAME' not found"
100
+ exit 1
101
+ fi
102
+ CMD_CONTENT=$(cat "$CMD_FILE")
103
+ ```
104
+ 3. `POST $BASE_URL/show/file` with:
105
+ ```json
106
+ { "share_type": "command", "filename": "<name>.md", "content": "<file_content>" }
107
+ ```
108
+ 4. On success:
109
+ ```
110
+ 📤 Shared command '<name>' (recipients must approve with /room accept)
111
+ ```
112
+
113
+ ### `/show claude-md` — share CLAUDE.md
114
+
115
+ Share this project's CLAUDE.md with the room (after accept it is saved room-scoped; promote globally with `/room adopt`).
116
+
117
+ 1. Resolve the port (above).
118
+ 2. Load CLAUDE.md from the current directory:
119
+ ```bash
120
+ CLAUDE_MD_FILE="$(pwd)/CLAUDE.md"
121
+ if [ ! -f "$CLAUDE_MD_FILE" ]; then
122
+ GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
123
+ if [ -n "$GIT_ROOT" ] && [ -f "$GIT_ROOT/CLAUDE.md" ]; then
124
+ CLAUDE_MD_FILE="$GIT_ROOT/CLAUDE.md"
125
+ else
126
+ echo "Error: CLAUDE.md not found"
127
+ exit 1
128
+ fi
129
+ fi
130
+ CLAUDE_MD_CONTENT=$(cat "$CLAUDE_MD_FILE")
131
+ ```
132
+ 3. `POST $BASE_URL/show/file` with:
133
+ ```json
134
+ { "share_type": "claude_md", "filename": "CLAUDE.md", "content": "<file_content>" }
135
+ ```
136
+ 4. On success:
137
+ ```
138
+ 📤 Shared CLAUDE.md (recipients approve with /room accept; saved room-scoped)
139
+ Use /room adopt to promote to ~/.claude/CLAUDE.md
140
+ ```
141
+
142
+ ## Errors
143
+
144
+ - If the daemon is not running:
145
+ "cc-room daemon is not running."
146
+ - If not in a room:
147
+ "You are not in a room. Use `/room open` or `/room join` first."
148
+ - If there is no Primary room:
149
+ "Pick a room to write with `/room switch <name>`."
@@ -48778,6 +48778,18 @@ var PeerConnector = class extends import_node_events3.EventEmitter {
48778
48778
  const conn = this.connections.get(key);
48779
48779
  return conn?.ws.readyState === wrapper_default.OPEN || false;
48780
48780
  }
48781
+ /** 退室時: 再接続せずに当該ルームの outbound を切る */
48782
+ disconnectRoom(roomId) {
48783
+ for (const [key, conn] of [...this.connections.entries()]) {
48784
+ if (conn.roomId !== roomId) continue;
48785
+ conn.skipReconnect = true;
48786
+ this.cleanupConnection(conn);
48787
+ if (conn.ws.readyState === wrapper_default.OPEN || conn.ws.readyState === wrapper_default.CONNECTING) {
48788
+ conn.ws.close(1e3, "Left room");
48789
+ }
48790
+ this.connections.delete(key);
48791
+ }
48792
+ }
48781
48793
  cleanupConnection(conn) {
48782
48794
  if (conn.pingInterval) {
48783
48795
  clearInterval(conn.pingInterval);
@@ -51252,6 +51264,12 @@ ${conversationText}`
51252
51264
  const error2 = err && typeof err === "object" ? err : {};
51253
51265
  const status = typeof error2.status === "number" ? error2.status : void 0;
51254
51266
  const headers = error2.headers && typeof error2.headers === "object" ? error2.headers : void 0;
51267
+ if (status === 401 || status === 403) {
51268
+ log9.warn({ err, status }, "Auth failed, entering fallback mode");
51269
+ this.fallbackMode = true;
51270
+ this.fallbackUntil = Date.now() + SUMMARIZER_FALLBACK_DURATION_MS;
51271
+ return this.localFallbackSummary(turns);
51272
+ }
51255
51273
  if (attempt === SUMMARIZER_MAX_RETRIES) {
51256
51274
  log9.warn({ err }, "All retries exhausted, entering fallback mode");
51257
51275
  this.fallbackMode = true;
@@ -53167,7 +53185,9 @@ async function main() {
53167
53185
  if (!meta) {
53168
53186
  return { ok: false, message: "Room not found" };
53169
53187
  }
53188
+ peerConnector.disconnectRoom(body.room_id);
53170
53189
  server.unregisterRoom(body.room_id);
53190
+ discovery.removeRoomAdvertisement(body.room_id);
53171
53191
  notifier.notify({ type: "room_closed", room: meta.name });
53172
53192
  const remaining = storage.listRooms().filter((r2) => r2.id !== body.room_id).map((r2) => r2.id);
53173
53193
  showState.onRoomLeave(body.room_id, remaining);
File without changes
File without changes