@shardworks/guild-starter-kit 0.1.17 → 0.1.19

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.
@@ -40,14 +40,105 @@ Other roles may emerge as the guild evolves.
40
40
 
41
41
  ## Workshops
42
42
 
43
- A workshop is a repository where animas do their work. The patron assigns workshops (usually existing repos), and artificers work inside them on commissions. The patron judges results by the works produced, not by inspecting the workshop.
43
+ A workshop is a repository where animas do their work. Workshops are guild space the patron assigns them, but during normal operation the patron judges results by the works produced, not by inspecting the workshop directly.
44
44
 
45
- ### Workshop Lifecycle
45
+ Each workshop is registered in `guild.json` under the `workshops` key with its name, remote URL, and the timestamp it was added. On disk, the guild maintains a bare clone of each workshop at `.nexus/workshops/{name}.git`. Commission worktrees are created from these bare clones, giving each commission an isolated working directory.
46
46
 
47
- 1. A workshop is registered with the guild (`nsg workshop add <url>`)
48
- 2. The guild clones it and manages worktrees for concurrent commissions
49
- 3. Artificers work in isolated worktrees — one per commission
50
- 4. Completed work is delivered as branches or pull requests
47
+ ### Managing Workshops
48
+
49
+ Four commands manage the workshop lifecycle:
50
+
51
+ | Command | What it does |
52
+ |---------|-------------|
53
+ | `nsg workshop add <url>` | Clone a remote repo and register it as a workshop |
54
+ | `nsg workshop remove <name>` | Remove a workshop — deletes bare clone, worktrees, and guild.json entry |
55
+ | `nsg workshop list` | List all workshops with clone status and active worktree count |
56
+ | `nsg workshop create <org/name>` | Create a new GitHub repo and register it as a workshop |
57
+
58
+ ### Adding an Existing Repository
59
+
60
+ When the patron has an existing repository they want the guild to work on:
61
+
62
+ ```
63
+ nsg workshop add https://github.com/org/my-app.git
64
+ ```
65
+
66
+ This clones the repo as a bare clone into `.nexus/workshops/my-app.git` and adds it to `guild.json`. The workshop name is derived from the URL (the last path segment, minus `.git`). To use a custom name:
67
+
68
+ ```
69
+ nsg workshop add https://github.com/org/my-app.git --name frontend
70
+ ```
71
+
72
+ The repository must already exist and be accessible. SSH URLs work too:
73
+
74
+ ```
75
+ nsg workshop add git@github.com:org/my-app.git
76
+ ```
77
+
78
+ ### Creating a New Repository
79
+
80
+ For greenfield work where no repository exists yet:
81
+
82
+ ```
83
+ nsg workshop create myorg/new-project
84
+ ```
85
+
86
+ This requires the GitHub CLI (`gh`) to be installed and authenticated. The command:
87
+
88
+ 1. Creates the repository on GitHub (private by default)
89
+ 2. Clones it as a bare clone into `.nexus/workshops/`
90
+ 3. Registers it in `guild.json`
91
+
92
+ For a public repository:
93
+
94
+ ```
95
+ nsg workshop create myorg/new-project --public
96
+ ```
97
+
98
+ If `gh` is not installed or not authenticated, the command fails with a clear message explaining what's needed.
99
+
100
+ ### Workshop Status
101
+
102
+ `nsg workshop list` shows each workshop with:
103
+
104
+ - **✓ / ✗** — whether the bare clone exists on disk (it may be missing after a fresh guild clone before running `nsg guild restore`)
105
+ - **Active worktrees** — how many commissions currently have worktrees checked out
106
+ - **Remote URL** — where the repo lives
107
+
108
+ If a bare clone is missing, the output includes a hint to run `nsg guild restore`.
109
+
110
+ ### Removing a Workshop
111
+
112
+ ```
113
+ nsg workshop remove my-app
114
+ ```
115
+
116
+ This deletes the bare clone, any commission worktrees for that workshop, and removes the entry from `guild.json`. This is a destructive operation — the workshop's local state is gone. The remote repository is not affected.
117
+
118
+ ### How Workshops Are Used in Commissions
119
+
120
+ When a commission is dispatched to a workshop, the worktree-setup engine:
121
+
122
+ 1. Creates a commission-specific branch from `main` in the workshop's bare clone
123
+ 2. Checks out a git worktree at `.nexus/worktrees/{workshop}/commission-{id}/`
124
+ 3. The anima works in this isolated directory
125
+
126
+ This means multiple commissions can run concurrently in the same workshop without interfering with each other — each gets its own branch and working directory.
127
+
128
+ ### guild.json Shape
129
+
130
+ ```json
131
+ {
132
+ "workshops": {
133
+ "my-app": {
134
+ "remoteUrl": "https://github.com/org/my-app.git",
135
+ "addedAt": "2026-03-24T12:00:00.000Z"
136
+ }
137
+ }
138
+ }
139
+ ```
140
+
141
+ The `remoteUrl` is the source of truth. The bare clone on disk is ephemeral and can be reconstructed from this URL by `nsg guild restore`.
51
142
 
52
143
  ## Commissions
53
144
 
@@ -58,7 +149,7 @@ A commission is a unit of work posted by the patron and undertaken by the guild.
58
149
  3. **In progress** — the artificer works in a workshop worktree
59
150
  4. **Completed** or **Failed** — work is delivered or the commission is marked as failed
60
151
 
61
- Use `nsg dispatch` to post and dispatch commissions.
152
+ Use `nsg commission` to post commissions. The Clockworks handles the rest via standing orders.
62
153
 
63
154
  ## Tools
64
155
 
@@ -68,7 +159,7 @@ Tools that animas wield during work. Each tool ships with instructions delivered
68
159
 
69
160
  - **install-tool** — install new tools, engines, or bundles into the guild
70
161
  - **remove-tool** — remove installed tools
71
- - **dispatch** — post and dispatch commissions
162
+ - **commission** — post commissions to the guild
72
163
  - **instantiate** — create new animas with assigned training and roles
73
164
  - **nexus-version** — report the installed Nexus framework version
74
165
  - **signal** — signal a custom guild event for the Clockworks
@@ -86,6 +177,9 @@ Automated mechanical processes with no AI involvement. Two kinds:
86
177
 
87
178
  **Clockwork engines** — purpose-built to respond to events via standing orders. Use the `engine()` SDK factory from `@shardworks/nexus-core`. The Clockworks runner calls them automatically when matching events fire.
88
179
 
180
+ - **workshop-prepare** — creates a worktree when a commission is posted (`commission.posted` → `commission.ready`)
181
+ - **workshop-merge** — merges a commission branch after the session ends (`commission.session.ended` → `commission.completed` or `commission.failed`)
182
+
89
183
  ## The Codex
90
184
 
91
185
  The guild's institutional body of policy and procedure — the employee handbook. Lives in `codex/` in the guildhall. Every anima receives the codex when manifested. The codex defines how the guild operates: standards, procedures, policies, and environmental facts.
@@ -240,6 +334,36 @@ Named, versioned, immutable personality templates. A temperament defines who an
240
334
 
241
335
  Training content lives in `training/curricula/` and `training/temperaments/` in the guildhall, organized as `{name}/{version}/`.
242
336
 
337
+ ## Guild Restore
338
+
339
+ When the guildhall repository is cloned fresh onto a new machine (or by a new developer), the `.nexus/` directory does not exist — it is gitignored. The guild's configuration and code are all tracked in git, but runtime state needs to be reconstructed.
340
+
341
+ ```
342
+ nsg guild restore
343
+ ```
344
+
345
+ This command reconstructs all ephemeral runtime state from the tracked guild configuration:
346
+
347
+ 1. **Workshops** — re-clones all workshop bare repos from their `remoteUrl` in `guild.json`. Skips any that are already present.
348
+ 2. **npm dependencies** — runs `npm install` to restore packages from `package.json`.
349
+ 3. **On-disk tools** — reinstalls tools that have full source tracked in the guildhall.
350
+ 4. **Reports linked tools** — lists any tools that were npm-linked and need manual re-linking (since symlinks don't survive a clone).
351
+
352
+ The command is idempotent — safe to run at any time. If everything is already in place, it reports "Nothing to restore."
353
+
354
+ ### When to Run Restore
355
+
356
+ - After cloning the guildhall repo for the first time
357
+ - After pulling changes that added new workshops
358
+ - If a bare clone is corrupted or accidentally deleted
359
+ - When `nsg workshop list` shows ✗ (missing bare clone) for any workshop
360
+
361
+ ### What Restore Does NOT Do
362
+
363
+ - It does not create the Ledger (that's done by `nsg init` and the ledger-migrate engine)
364
+ - It does not re-create animas or commissions — those live in the Ledger
365
+ - It does not push or pull workshop repos — it only clones them fresh if missing
366
+
243
367
  ## CLI Reference
244
368
 
245
369
  The primary interface is the `nsg` command:
@@ -247,9 +371,14 @@ The primary interface is the `nsg` command:
247
371
  | Command | Purpose |
248
372
  |---------|---------|
249
373
  | `nsg init` | Create a new guild |
250
- | `nsg dispatch <content>` | Post and dispatch a commission |
374
+ | `nsg commission <spec> --workshop <name>` | Post a commission |
251
375
  | `nsg tool install <source>` | Install a tool or bundle |
252
376
  | `nsg tool remove <name>` | Remove an installed tool |
377
+ | `nsg workshop add <url>` | Clone a remote repo and register it as a workshop |
378
+ | `nsg workshop remove <name>` | Remove a workshop |
379
+ | `nsg workshop list` | List workshops with status |
380
+ | `nsg workshop create <org/name>` | Create a new GitHub repo and register as a workshop |
381
+ | `nsg guild restore` | Restore runtime state after a fresh clone |
253
382
  | `nsg anima create` | Instantiate a new anima |
254
383
  | `nsg anima manifest <name>` | Generate an anima's full instructions |
255
384
  | `nsg status` | Show guild status |
@@ -0,0 +1,5 @@
1
+ -- Add status_reason to commissions for tracking why each state transition happened.
2
+ -- Every status change should include a reason: "posted by patron", "merged to main",
3
+ -- "merge conflict in src/foo.ts", etc.
4
+
5
+ ALTER TABLE commissions ADD COLUMN status_reason TEXT;
package/nexus-bundle.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "tools": [
4
4
  { "package": "@shardworks/tool-install@0.x", "name": "install-tool" },
5
5
  { "package": "@shardworks/tool-remove@0.x", "name": "remove-tool" },
6
- { "package": "@shardworks/tool-dispatch@0.x", "name": "dispatch" },
6
+ { "package": "@shardworks/tool-commission@0.x", "name": "commission" },
7
7
  { "package": "@shardworks/tool-instantiate@0.x", "name": "instantiate" },
8
8
  { "package": "@shardworks/tool-nexus-version@0.x", "name": "nexus-version" }
9
9
  ],
@@ -11,15 +11,20 @@
11
11
  { "package": "@shardworks/engine-manifest@0.x", "name": "manifest" },
12
12
  { "package": "@shardworks/engine-mcp-server@0.x", "name": "mcp-server" },
13
13
  { "package": "@shardworks/engine-worktree-setup@0.x", "name": "worktree-setup" },
14
+ { "package": "@shardworks/engine-workshop-prepare@0.x", "name": "workshop-prepare" },
15
+ { "package": "@shardworks/engine-workshop-merge@0.x", "name": "workshop-merge" },
14
16
  { "package": "@shardworks/engine-ledger-migrate@0.x", "name": "ledger-migrate" }
15
17
  ],
16
18
  "temperaments": [
17
- { "path": "temperaments/guide" }
19
+ { "path": "temperaments/guide" },
20
+ { "path": "temperaments/artisan" }
18
21
  ],
19
22
  "curricula": [
20
23
  { "path": "curricula/guild-operations" }
21
24
  ],
22
25
  "migrations": [
23
- { "path": "migrations/001-initial-schema.sql" }
26
+ { "path": "migrations/001-initial-schema.sql" },
27
+ { "path": "migrations/002-clockworks.sql" },
28
+ { "path": "migrations/003-commission-status-reason.sql" }
24
29
  ]
25
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shardworks/guild-starter-kit",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "Default bundle for new Nexus guilds — tools, training, and migrations",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,23 @@
1
+ # Artisan Temperament
2
+
3
+ You are an artisan — methodical, resourceful, and focused on delivering solid work. You take pride in craft, not in flash.
4
+
5
+ ## Disposition
6
+
7
+ - **Pragmatic.** Favor working solutions over elegant abstractions. Get something real running, then refine. Don't gold-plate.
8
+ - **Self-directed.** Once you have a clear brief, work independently. Make decisions within scope without asking permission for every detail. Use your judgment — that's why you were commissioned.
9
+ - **Thorough.** Test your work. Check edge cases. Read the error messages. Don't declare something done until you've verified it works, not just that it compiles.
10
+ - **Honest about problems.** If something isn't working, say so early. If the brief is unclear or contradictory, surface it rather than guessing. A well-timed question saves more time than a wrong assumption.
11
+
12
+ ## Communication Style
13
+
14
+ - Be concise. Commit messages and code comments are your primary output — make them clear and useful for the next anima who reads them.
15
+ - When reporting status, lead with what's done and what's blocked. Skip the preamble.
16
+ - If you encounter a design decision outside your brief, flag it and move on. Don't block on decisions that aren't yours to make.
17
+
18
+ ## Work Ethic
19
+
20
+ - Commit early and often. Small, atomic commits that tell a clear story.
21
+ - Leave the workshop cleaner than you found it. No dead code, no dangling TODOs, no mystery files.
22
+ - Respect the scope of your commission. Do the work you were asked to do. If you see adjacent improvements, note them — don't chase them.
23
+ - When sage advice is provided, follow it. The sage planned the work; you execute the plan. If you believe the plan has a flaw, record your concern, but do not contradict it unilaterally.
@@ -0,0 +1,4 @@
1
+ {
2
+ "version": "0.1.0",
3
+ "content": "content.md"
4
+ }