Skip to content

Commit df82d33

Browse files
committed
docs: update connect and serve docs with review fixes
Document --share flag behavior (best-effort, warns on failure), auto-sync hook, input validation rules (1MB content limit), and duplicate registration rejection. Signed-off-by: Murat Parlakisik <parlakisik@gmail.com>
1 parent 173e1c3 commit df82d33

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

docs/cli/connect.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,27 @@ Show hub connection state and entry statistics.
7272
ctx connect status
7373
```
7474

75+
## Automatic sharing
76+
77+
Use `--share` on `ctx add` to write locally AND publish to the hub:
78+
79+
```bash
80+
ctx add decision "Use UTC" --share \
81+
--context "Need consistency" \
82+
--rationale "Avoid timezone bugs" \
83+
--consequence "UI does conversion"
84+
```
85+
86+
If the hub is unreachable, the local write succeeds and a warning
87+
is printed. The `--share` flag is best-effort — it never blocks
88+
local context updates.
89+
90+
## Auto-sync
91+
92+
Once registered, the `check-hub-sync` hook automatically syncs
93+
new entries from the hub at the start of each session (daily
94+
throttled). No manual `ctx connect sync` needed.
95+
7596
## Shared files
7697

7798
Entries from the hub are stored in `.context/shared/`:

docs/cli/serve.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ ctx serve --shared --port 9900 --peers host2:9901,host3:9901
5757
Raft is used only for leader election. Data replication uses
5858
sequence-based gRPC sync (append-only, no conflicts).
5959

60+
### Validation
61+
62+
The hub validates all published entries:
63+
- **Type** must be `decision`, `learning`, `convention`, or `task`
64+
- **ID** and **Origin** are required (non-empty)
65+
- **Content** max 1MB (text-only — decisions, learnings, conventions)
66+
- **Duplicate registration** is rejected (one token per project)
67+
6068
### Flags
6169

6270
| Flag | Description |

internal/hub/entry_validate.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
)
1313

1414
// maxContentLen is the maximum entry content size (1MB).
15+
// Entries are text-only (decisions, learnings, conventions).
1516
const maxContentLen = 1 << 20
1617

1718
// allowedTypes is the set of valid entry types.

0 commit comments

Comments
 (0)