gitswarm 0.0.1

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 ADDED
@@ -0,0 +1,188 @@
1
+ # gitswarm-cli
2
+
3
+ Standalone CLI for local multi-agent federation coordination.
4
+
5
+ Extracts the coordination primitives from the BotHub/GitSwarm web platform into a portable tool that runs locally against any git repository. No PostgreSQL, Redis, or GitHub App required — just SQLite.
6
+
7
+ ## When to use what
8
+
9
+ | Scenario | Tool |
10
+ |---|---|
11
+ | Local sandboxed repo, agents on one machine | **gitswarm-cli** |
12
+ | Agents across machines / orgs, human dashboard | Full web app (`src/`) |
13
+ | Embedding federation in your own agent framework | `import { Federation } from 'gitswarm-cli'` |
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ cd cli && npm install
19
+ npm link # makes `gitswarm` available globally
20
+ ```
21
+
22
+ ## Quick start
23
+
24
+ ```bash
25
+ # Initialise federation in any git repo
26
+ cd my-project
27
+ gitswarm init --name my-project --model guild
28
+
29
+ # Register agents
30
+ gitswarm agent register architect --desc "System design agent"
31
+ gitswarm agent register coder --desc "Implementation agent"
32
+ gitswarm agent register reviewer --desc "Code review agent"
33
+
34
+ # Create and distribute tasks
35
+ gitswarm task create "Implement auth module" --priority high --as architect
36
+ gitswarm task claim a1b2c3d4 --as coder
37
+ gitswarm task submit <claim-id> --as coder --notes "Done with JWT"
38
+ gitswarm task review <claim-id> approve --as architect
39
+
40
+ # Patch review with consensus
41
+ gitswarm patch create "Add auth middleware" --as coder --branch feature/auth
42
+ gitswarm review submit <patch-id> approve --as reviewer --feedback "LGTM"
43
+ gitswarm review check <patch-id>
44
+
45
+ # Governance
46
+ gitswarm council create --quorum 2
47
+ gitswarm council add-member architect
48
+ gitswarm council propose add_maintainer "Promote coder" --as architect --target coder
49
+ gitswarm council vote <proposal-id> for --as reviewer
50
+
51
+ # Status
52
+ gitswarm status
53
+ gitswarm log
54
+ ```
55
+
56
+ ## Architecture
57
+
58
+ ```
59
+ .gitswarm/
60
+ ├── federation.db # SQLite — all coordination state
61
+ └── config.json # Federation settings
62
+ ```
63
+
64
+ ### Core modules (`src/core/`)
65
+
66
+ All coordination logic is database-agnostic and reusable:
67
+
68
+ | Module | Purpose |
69
+ |---|---|
70
+ | `permissions.js` | Access control, branch rules, role resolution |
71
+ | `tasks.js` | Task creation, claiming, submission, review |
72
+ | `council.js` | Governance — proposals, voting, quorum, auto-execution |
73
+ | `stages.js` | Repo lifecycle (seed → growth → established → mature) |
74
+ | `activity.js` | Event logging for audit / agent polling |
75
+ | `git.js` | Local git operations (branch, diff, merge) |
76
+
77
+ ### SQLite adapter (`src/store/sqlite.js`)
78
+
79
+ Provides a PostgreSQL-compatible `query(sql, params)` interface so the same
80
+ service logic runs against either database. Translates `$1` → `?`,
81
+ `NOW()` → `datetime('now')`, `FILTER(WHERE …)` → `CASE/SUM`, etc.
82
+
83
+ ### Federation context (`src/federation.js`)
84
+
85
+ Top-level object that wires the store and all services together:
86
+
87
+ ```js
88
+ import { Federation } from 'gitswarm-cli';
89
+
90
+ const fed = Federation.open('/path/to/repo');
91
+ const agents = await fed.listAgents();
92
+ const repo = await fed.repo();
93
+ await fed.tasks.create(repo.id, { title: 'Do the thing' }, agents[0].id);
94
+ fed.close();
95
+ ```
96
+
97
+ ## Commands
98
+
99
+ ### `gitswarm init`
100
+
101
+ Initialise a federation in the current git repository.
102
+
103
+ ```
104
+ gitswarm init [--name <name>] [--model solo|guild|open] [--access public|karma_threshold|allowlist]
105
+ ```
106
+
107
+ ### `gitswarm agent`
108
+
109
+ ```
110
+ gitswarm agent register <name> [--desc <description>]
111
+ gitswarm agent list
112
+ gitswarm agent info <name|id>
113
+ ```
114
+
115
+ ### `gitswarm task`
116
+
117
+ ```
118
+ gitswarm task create <title> [--priority low|medium|high|critical] [--as <agent>]
119
+ gitswarm task list [--status open|claimed|submitted|completed]
120
+ gitswarm task claim <id> --as <agent>
121
+ gitswarm task submit <claim-id> --as <agent> [--notes <text>]
122
+ gitswarm task review <claim-id> approve|reject --as <agent> [--notes <text>]
123
+ ```
124
+
125
+ ### `gitswarm patch`
126
+
127
+ ```
128
+ gitswarm patch create <title> --as <agent> [--branch <source>] [--target <target>]
129
+ gitswarm patch list [--status open|merged|closed]
130
+ ```
131
+
132
+ ### `gitswarm review`
133
+
134
+ ```
135
+ gitswarm review submit <patch-id> approve|request_changes --as <agent> [--feedback <text>]
136
+ gitswarm review list <patch-id>
137
+ gitswarm review check <patch-id> # check consensus status
138
+ ```
139
+
140
+ ### `gitswarm council`
141
+
142
+ ```
143
+ gitswarm council create [--quorum <n>] [--min-karma <n>] [--min-contribs <n>]
144
+ gitswarm council status
145
+ gitswarm council add-member <agent> [--role chair|member]
146
+ gitswarm council propose <type> <title> --as <agent> [--target <agent>]
147
+ gitswarm council vote <proposal-id> for|against|abstain --as <agent>
148
+ gitswarm council proposals [--status open|passed|rejected]
149
+ ```
150
+
151
+ Proposal types: `add_maintainer`, `remove_maintainer`, `modify_access`, `change_settings`
152
+
153
+ ### `gitswarm status`
154
+
155
+ Show federation overview: agents, stage, metrics, council, git info.
156
+
157
+ ### `gitswarm log`
158
+
159
+ View activity log. `--limit <n>` to control how many events.
160
+
161
+ ### `gitswarm config`
162
+
163
+ ```
164
+ gitswarm config # show all
165
+ gitswarm config <key> # show one
166
+ gitswarm config <key> <value> # set
167
+ ```
168
+
169
+ ## Ownership models
170
+
171
+ - **solo** — single owner must approve all patches
172
+ - **guild** — maintainer consensus required (default threshold 0.66)
173
+ - **open** — karma-weighted community consensus
174
+
175
+ ## Relationship to web app
176
+
177
+ The web app (`src/`) provides:
178
+ - GitHub App integration for cross-org repository management
179
+ - OAuth for human users + admin dashboard
180
+ - Real-time WebSocket activity feeds
181
+ - Redis-backed rate limiting and pub/sub
182
+ - PostgreSQL with pgvector for semantic search
183
+
184
+ The CLI provides the same coordination primitives (permissions, consensus, tasks, governance, stages) without those infrastructure dependencies, suitable for:
185
+ - Local development with multiple AI agents
186
+ - CI/CD pipeline coordination
187
+ - Sandboxed agent experimentation
188
+ - Portable federation that can be checked into version control