@shardworks/engine-workshop-prepare 0.1.17
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/LICENSE +15 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/nexus-engine.json +5 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sean Boots
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAgBA,wBA6CG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workshop Prepare Engine (clockwork)
|
|
3
|
+
*
|
|
4
|
+
* Standing order handler for commission.posted events. Creates an isolated
|
|
5
|
+
* git worktree for the commission and signals commission.ready so the next
|
|
6
|
+
* standing order (summon artificer) can launch the session.
|
|
7
|
+
*
|
|
8
|
+
* Event flow:
|
|
9
|
+
* commission.posted { commissionId, workshop }
|
|
10
|
+
* → creates worktree from workshop bare repo
|
|
11
|
+
* → updates commission status → in_progress
|
|
12
|
+
* → signals commission.ready { commissionId, workshop, worktreePath }
|
|
13
|
+
*/
|
|
14
|
+
import { engine, signalEvent, updateCommissionStatus, readCommission } from '@shardworks/nexus-core';
|
|
15
|
+
import { setupWorktree } from '@shardworks/engine-worktree-setup';
|
|
16
|
+
export default engine({
|
|
17
|
+
handler: async (event, { home }) => {
|
|
18
|
+
if (!event) {
|
|
19
|
+
throw new Error('workshop-prepare requires an event (cannot be invoked directly).');
|
|
20
|
+
}
|
|
21
|
+
const payload = event.payload;
|
|
22
|
+
if (!payload || typeof payload.commissionId !== 'number' || typeof payload.workshop !== 'string') {
|
|
23
|
+
throw new Error(`workshop-prepare expected payload with { commissionId, workshop }, got: ${JSON.stringify(payload)}`);
|
|
24
|
+
}
|
|
25
|
+
const commissionId = payload.commissionId;
|
|
26
|
+
const workshop = payload.workshop;
|
|
27
|
+
// Verify commission exists
|
|
28
|
+
const commission = readCommission(home, commissionId);
|
|
29
|
+
if (!commission) {
|
|
30
|
+
throw new Error(`Commission #${commissionId} not found in the Ledger.`);
|
|
31
|
+
}
|
|
32
|
+
// Create the worktree
|
|
33
|
+
const worktree = setupWorktree({
|
|
34
|
+
home,
|
|
35
|
+
workshop,
|
|
36
|
+
commissionId,
|
|
37
|
+
});
|
|
38
|
+
// Update commission status
|
|
39
|
+
updateCommissionStatus(home, commissionId, 'in_progress', `worktree ready on branch ${worktree.branch}`);
|
|
40
|
+
// Signal ready for the next standing order (summon artificer)
|
|
41
|
+
signalEvent(home, 'commission.ready', { commissionId, workshop, worktreePath: worktree.path }, 'framework');
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
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AAC,MAAM,EAAE,CAC9C,CAAC;QAEF,8DAA8D;QAC9D,WAAW,CACT,IAAI,EACJ,kBAAkB,EAClB,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC,IAAI,EAAE,EACvD,WAAW,CACZ,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shardworks/engine-workshop-prepare",
|
|
3
|
+
"version": "0.1.17",
|
|
4
|
+
"license": "ISC",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/shardworks/nexus-mk2",
|
|
8
|
+
"directory": "packages/engine-workshop-prepare"
|
|
9
|
+
},
|
|
10
|
+
"description": "Clockwork engine — prepares a workshop worktree for a commission",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@shardworks/engine-worktree-setup": "0.1.17",
|
|
20
|
+
"@shardworks/nexus-core": "0.1.17"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "25.5.0"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"nexus-engine.json"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc",
|
|
31
|
+
"typecheck": "tsc --noEmit"
|
|
32
|
+
}
|
|
33
|
+
}
|