@shardworks/nexus-core 0.1.4 → 0.1.6
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/dist/bundle.d.ts +111 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +438 -0
- package/dist/bundle.js.map +1 -0
- package/dist/dispatch.d.ts +1 -1
- package/dist/dispatch.d.ts.map +1 -1
- package/dist/guild-config.d.ts +12 -6
- package/dist/guild-config.d.ts.map +1 -1
- package/dist/guild-config.js +6 -6
- package/dist/guild-config.js.map +1 -1
- package/dist/implement.d.ts +2 -2
- package/dist/implement.d.ts.map +1 -1
- package/dist/implement.js +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/init-guild.d.ts +15 -11
- package/dist/init-guild.d.ts.map +1 -1
- package/dist/init-guild.js +33 -38
- package/dist/init-guild.js.map +1 -1
- package/dist/install-tool.d.ts +48 -11
- package/dist/install-tool.d.ts.map +1 -1
- package/dist/install-tool.js +304 -38
- package/dist/install-tool.js.map +1 -1
- package/dist/instantiate.d.ts +1 -1
- package/dist/instantiate.d.ts.map +1 -1
- package/dist/instantiate.js +6 -7
- package/dist/instantiate.js.map +1 -1
- package/dist/nexus-home.d.ts +15 -8
- package/dist/nexus-home.d.ts.map +1 -1
- package/dist/nexus-home.js +32 -17
- package/dist/nexus-home.js.map +1 -1
- package/dist/rehydrate.d.ts +15 -0
- package/dist/rehydrate.d.ts.map +1 -0
- package/dist/rehydrate.js +84 -0
- package/dist/rehydrate.js.map +1 -0
- package/dist/remove-tool.d.ts +2 -2
- package/dist/remove-tool.d.ts.map +1 -1
- package/dist/remove-tool.js +43 -11
- package/dist/remove-tool.js.map +1 -1
- package/package.json +1 -1
- package/dist/base-tools.d.ts +0 -27
- package/dist/base-tools.d.ts.map +0 -1
- package/dist/base-tools.js +0 -30
- package/dist/base-tools.js.map +0 -1
- package/dist/bootstrap.d.ts +0 -14
- package/dist/bootstrap.d.ts.map +0 -1
- package/dist/bootstrap.js +0 -46
- package/dist/bootstrap.js.map +0 -1
- package/dist/publish.d.ts +0 -20
- package/dist/publish.d.ts.map +0 -1
- package/dist/publish.js +0 -41
- package/dist/publish.js.map +0 -1
package/dist/guild-config.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { guildhallWorktreePath } from "./nexus-home.js";
|
|
4
3
|
/**
|
|
5
4
|
* Create the default guild.json content for a new guild.
|
|
6
5
|
* All registries (implements, engines, curricula, temperaments) start empty.
|
|
7
6
|
*/
|
|
8
|
-
export function createInitialGuildConfig(nexusVersion, model) {
|
|
7
|
+
export function createInitialGuildConfig(name, nexusVersion, model) {
|
|
9
8
|
return {
|
|
9
|
+
name,
|
|
10
10
|
nexus: nexusVersion,
|
|
11
11
|
model,
|
|
12
12
|
workshops: [],
|
|
@@ -16,16 +16,16 @@ export function createInitialGuildConfig(nexusVersion, model) {
|
|
|
16
16
|
temperaments: {},
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
/** Resolve the path to guild.json in the
|
|
19
|
+
/** Resolve the path to guild.json in the guild root. */
|
|
20
20
|
export function guildConfigPath(home) {
|
|
21
|
-
return path.join(
|
|
21
|
+
return path.join(home, 'guild.json');
|
|
22
22
|
}
|
|
23
|
-
/** Read and parse guild.json from the
|
|
23
|
+
/** Read and parse guild.json from the guild root. */
|
|
24
24
|
export function readGuildConfig(home) {
|
|
25
25
|
const configFile = guildConfigPath(home);
|
|
26
26
|
return JSON.parse(fs.readFileSync(configFile, 'utf-8'));
|
|
27
27
|
}
|
|
28
|
-
/** Write guild.json to the
|
|
28
|
+
/** Write guild.json to the guild root. */
|
|
29
29
|
export function writeGuildConfig(home, config) {
|
|
30
30
|
const configFile = guildConfigPath(home);
|
|
31
31
|
fs.writeFileSync(configFile, JSON.stringify(config, null, 2) + '\n');
|
package/dist/guild-config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guild-config.js","sourceRoot":"","sources":["../src/guild-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"guild-config.js","sourceRoot":"","sources":["../src/guild-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAkD7B;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAY,EAAE,YAAoB,EAAE,KAAa;IACxF,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,YAAY;QACnB,KAAK;QACL,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,EAAE;QACd,OAAO,EAAE,EAAE;QACX,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,EAAE;KACjB,CAAC;AACJ,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AACvC,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAgB,CAAC;AACzE,CAAC;AAED,0CAA0C;AAC1C,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,MAAmB;IAChE,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACzC,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AACvE,CAAC"}
|
package/dist/implement.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ type ZodShape = Record<string, z.ZodType>;
|
|
|
30
30
|
* or calling engine) provides it.
|
|
31
31
|
*/
|
|
32
32
|
export interface ImplementContext {
|
|
33
|
-
/** Absolute path to
|
|
33
|
+
/** Absolute path to the guild root. */
|
|
34
34
|
home: string;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
@@ -55,7 +55,7 @@ export interface ImplementDefinition<TShape extends ZodShape = ZodShape> {
|
|
|
55
55
|
*
|
|
56
56
|
* The handler receives two arguments:
|
|
57
57
|
* - `params` — the validated input, typed from your Zod schemas
|
|
58
|
-
* - `context` — framework-injected context (
|
|
58
|
+
* - `context` — framework-injected context (guild root path, etc.)
|
|
59
59
|
*
|
|
60
60
|
* Return any JSON-serializable value. The MCP engine wraps it as tool output;
|
|
61
61
|
* the CLI prints it; engines use it directly.
|
package/dist/implement.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implement.d.ts","sourceRoot":"","sources":["../src/implement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;AAE1C;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,
|
|
1
|
+
{"version":3,"file":"implement.d.ts","sourceRoot":"","sources":["../src/implement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;AAE1C;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB,CAAC,MAAM,SAAS,QAAQ,GAAG,QAAQ;IACrE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,CAChB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EACpC,OAAO,EAAE,gBAAgB,KACtB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,MAAM,SAAS,QAAQ,EAAE,GAAG,EAAE;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,CACP,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EACpC,OAAO,EAAE,gBAAgB,KACtB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAM9B"}
|
package/dist/implement.js
CHANGED
|
@@ -32,7 +32,7 @@ import { z } from 'zod';
|
|
|
32
32
|
*
|
|
33
33
|
* The handler receives two arguments:
|
|
34
34
|
* - `params` — the validated input, typed from your Zod schemas
|
|
35
|
-
* - `context` — framework-injected context (
|
|
35
|
+
* - `context` — framework-injected context (guild root path, etc.)
|
|
36
36
|
*
|
|
37
37
|
* Return any JSON-serializable value. The MCP engine wraps it as tool output;
|
|
38
38
|
* the CLI prints it; engines use it directly.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
export declare const VERSION
|
|
1
|
+
export declare const VERSION: string;
|
|
2
2
|
export { type ImplementContext, type ImplementDefinition, implement, } from './implement.ts';
|
|
3
|
-
export { createLedger
|
|
3
|
+
export { createLedger } from './ledger.ts';
|
|
4
4
|
export { type GuildConfig, type ToolEntry, type TrainingEntry, createInitialGuildConfig, guildConfigPath, readGuildConfig, writeGuildConfig, } from './guild-config.ts';
|
|
5
|
-
export {
|
|
6
|
-
export { type InstallToolOptions, type InstallResult, installTool, } from './install-tool.ts';
|
|
5
|
+
export { findGuildRoot, nexusDir, ledgerPath, worktreesPath, workshopsPath, workshopBarePath, } from './nexus-home.ts';
|
|
6
|
+
export { type InstallToolOptions, type InstallResult, type SourceKind, classifySource, installTool, } from './install-tool.ts';
|
|
7
7
|
export { type RemoveToolOptions, type RemoveResult, removeTool, } from './remove-tool.ts';
|
|
8
8
|
export { type DispatchOptions, type DispatchResult, dispatch, } from './dispatch.ts';
|
|
9
|
-
export { type PublishOptions, type PublishResult, publish, } from './publish.ts';
|
|
10
9
|
export { type InstantiateOptions, type InstantiateResult, instantiate, } from './instantiate.ts';
|
|
11
|
-
export { type BaseToolRef, BASE_IMPLEMENTS, BASE_ENGINES, BASE_TOOLS, } from './base-tools.ts';
|
|
12
10
|
export { initGuild } from './init-guild.ts';
|
|
13
|
-
export {
|
|
11
|
+
export { type BundleManifest, type BundlePackageEntry, type BundleContentEntry, type BundleMigrationEntry, type InstallBundleOptions, type InstallBundleResult, readBundleManifest, installBundle, isBundleDir, } from './bundle.ts';
|
|
12
|
+
export { type RehydrateResult, rehydrate, } from './rehydrate.ts';
|
|
14
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,EAAE,MAAqB,CAAC;AAE5C,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,SAAS,GACV,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,QAAQ,EACR,UAAU,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,cAAc,EACd,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,kBAAkB,EAClB,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,eAAe,EACpB,SAAS,GACV,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
// @shardworks/nexus-core — shared infrastructure for the guild system
|
|
2
|
-
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
const _require = createRequire(import.meta.url);
|
|
4
|
+
const _pkg = _require('../package.json');
|
|
5
|
+
export const VERSION = _pkg.version;
|
|
3
6
|
export { implement, } from "./implement.js";
|
|
4
|
-
export { createLedger
|
|
7
|
+
export { createLedger } from "./ledger.js";
|
|
5
8
|
export { createInitialGuildConfig, guildConfigPath, readGuildConfig, writeGuildConfig, } from "./guild-config.js";
|
|
6
|
-
export {
|
|
7
|
-
export { installTool, } from "./install-tool.js";
|
|
9
|
+
export { findGuildRoot, nexusDir, ledgerPath, worktreesPath, workshopsPath, workshopBarePath, } from "./nexus-home.js";
|
|
10
|
+
export { classifySource, installTool, } from "./install-tool.js";
|
|
8
11
|
export { removeTool, } from "./remove-tool.js";
|
|
9
12
|
export { dispatch, } from "./dispatch.js";
|
|
10
|
-
export { publish, } from "./publish.js";
|
|
11
13
|
export { instantiate, } from "./instantiate.js";
|
|
12
|
-
export { BASE_IMPLEMENTS, BASE_ENGINES, BASE_TOOLS, } from "./base-tools.js";
|
|
13
14
|
export { initGuild } from "./init-guild.js";
|
|
14
|
-
export {
|
|
15
|
+
export { readBundleManifest, installBundle, isBundleDir, } from "./bundle.js";
|
|
16
|
+
export { rehydrate, } from "./rehydrate.js";
|
|
15
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,OAAO,GAAW,IAAI,CAAC,OAAO,CAAC;AAE5C,OAAO,EAGL,SAAS,GACV,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAIL,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,QAAQ,EACR,UAAU,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAIL,cAAc,EACd,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAGL,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGL,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAOL,kBAAkB,EAClB,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,SAAS,GACV,MAAM,gBAAgB,CAAC"}
|
package/dist/init-guild.d.ts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Create a new guild
|
|
2
|
+
* Create a new guild at the given path.
|
|
3
3
|
*
|
|
4
|
-
* Sets up the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Sets up a regular git repo at `home` with the guild directory structure:
|
|
5
|
+
* guild.json, package.json, .gitignore, scaffolded directories, and an
|
|
6
|
+
* initial git commit.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* The .nexus/ directory (gitignored) holds framework-managed state: the Ledger,
|
|
9
|
+
* workshop bare clones, and commission worktrees.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* applyMigrations(home) // create ledger via migration engine
|
|
11
|
+
* This creates only the skeleton. After this, the caller should install a
|
|
12
|
+
* bundle (which delivers tools, training, and migrations) and apply migrations:
|
|
14
13
|
*
|
|
15
|
-
*
|
|
14
|
+
* initGuild(home, name, model) // skeleton
|
|
15
|
+
* installBundle({ home, bundleDir }) // tools, training, migrations
|
|
16
|
+
* applyMigrations(home) // create ledger
|
|
17
|
+
*
|
|
18
|
+
* @param home - Absolute path for the new guild directory.
|
|
19
|
+
* @param name - Guild name (used in guild.json and as the npm package name).
|
|
16
20
|
* @param model - Default model identifier for anima sessions.
|
|
17
21
|
* @throws If `home` exists and is not empty.
|
|
18
22
|
*/
|
|
19
|
-
export declare function initGuild(home: string, model: string): void;
|
|
23
|
+
export declare function initGuild(home: string, name: string, model: string): void;
|
|
20
24
|
//# sourceMappingURL=init-guild.d.ts.map
|
package/dist/init-guild.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-guild.d.ts","sourceRoot":"","sources":["../src/init-guild.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init-guild.d.ts","sourceRoot":"","sources":["../src/init-guild.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAsDzE"}
|
package/dist/init-guild.js
CHANGED
|
@@ -2,31 +2,33 @@ import path from 'node:path';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import { execFileSync } from 'node:child_process';
|
|
4
4
|
import { VERSION } from "./index.js";
|
|
5
|
-
import { guildhallBarePath, guildhallWorktreePath } from "./nexus-home.js";
|
|
6
5
|
import { createInitialGuildConfig } from "./guild-config.js";
|
|
7
|
-
import { INITIAL_SCHEMA } from "./ledger.js";
|
|
8
6
|
function git(args, cwd) {
|
|
9
7
|
execFileSync('git', args, { cwd, stdio: 'pipe' });
|
|
10
8
|
}
|
|
11
9
|
/**
|
|
12
|
-
* Create a new guild
|
|
10
|
+
* Create a new guild at the given path.
|
|
13
11
|
*
|
|
14
|
-
* Sets up the
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* Sets up a regular git repo at `home` with the guild directory structure:
|
|
13
|
+
* guild.json, package.json, .gitignore, scaffolded directories, and an
|
|
14
|
+
* initial git commit.
|
|
17
15
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* The .nexus/ directory (gitignored) holds framework-managed state: the Ledger,
|
|
17
|
+
* workshop bare clones, and commission worktrees.
|
|
20
18
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* applyMigrations(home) // create ledger via migration engine
|
|
19
|
+
* This creates only the skeleton. After this, the caller should install a
|
|
20
|
+
* bundle (which delivers tools, training, and migrations) and apply migrations:
|
|
24
21
|
*
|
|
25
|
-
*
|
|
22
|
+
* initGuild(home, name, model) // skeleton
|
|
23
|
+
* installBundle({ home, bundleDir }) // tools, training, migrations
|
|
24
|
+
* applyMigrations(home) // create ledger
|
|
25
|
+
*
|
|
26
|
+
* @param home - Absolute path for the new guild directory.
|
|
27
|
+
* @param name - Guild name (used in guild.json and as the npm package name).
|
|
26
28
|
* @param model - Default model identifier for anima sessions.
|
|
27
29
|
* @throws If `home` exists and is not empty.
|
|
28
30
|
*/
|
|
29
|
-
export function initGuild(home, model) {
|
|
31
|
+
export function initGuild(home, name, model) {
|
|
30
32
|
// Validate target
|
|
31
33
|
if (fs.existsSync(home)) {
|
|
32
34
|
const entries = fs.readdirSync(home);
|
|
@@ -34,18 +36,14 @@ export function initGuild(home, model) {
|
|
|
34
36
|
throw new Error(`${home} exists and is not empty.`);
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
|
-
// Create
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// Create
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
//
|
|
44
|
-
git(['-C', ghBare, 'worktree', 'add', '-b', 'main', ghWorktree]);
|
|
45
|
-
// Scaffold guildhall directory structure
|
|
39
|
+
// Create guild root and initialize git repo
|
|
40
|
+
fs.mkdirSync(home, { recursive: true });
|
|
41
|
+
git(['init'], home);
|
|
42
|
+
// Create .nexus infrastructure directory
|
|
43
|
+
fs.mkdirSync(path.join(home, '.nexus', 'workshops'), { recursive: true });
|
|
44
|
+
fs.mkdirSync(path.join(home, '.nexus', 'worktrees'), { recursive: true });
|
|
45
|
+
// Scaffold guild directory structure
|
|
46
46
|
const dirs = [
|
|
47
|
-
'nexus/implements',
|
|
48
|
-
'nexus/engines',
|
|
49
47
|
'nexus/migrations',
|
|
50
48
|
'implements',
|
|
51
49
|
'engines',
|
|
@@ -54,24 +52,21 @@ export function initGuild(home, model) {
|
|
|
54
52
|
'training/temperaments',
|
|
55
53
|
];
|
|
56
54
|
for (const dir of dirs) {
|
|
57
|
-
const full = path.join(
|
|
55
|
+
const full = path.join(home, dir);
|
|
58
56
|
fs.mkdirSync(full, { recursive: true });
|
|
59
57
|
fs.writeFileSync(path.join(full, '.gitkeep'), '');
|
|
60
58
|
}
|
|
61
|
-
// Write initial migration
|
|
62
|
-
fs.writeFileSync(path.join(ghWorktree, 'nexus/migrations/001-initial-schema.sql'), INITIAL_SCHEMA.trimStart());
|
|
63
|
-
// Remove .gitkeep from migrations since it now has a real file
|
|
64
|
-
const migrationsGitkeep = path.join(ghWorktree, 'nexus/migrations/.gitkeep');
|
|
65
|
-
if (fs.existsSync(migrationsGitkeep)) {
|
|
66
|
-
fs.unlinkSync(migrationsGitkeep);
|
|
67
|
-
}
|
|
68
59
|
// Write codex placeholder
|
|
69
|
-
fs.writeFileSync(path.join(
|
|
70
|
-
// Write guild.json — empty registries, tools
|
|
71
|
-
const config = createInitialGuildConfig(VERSION, model);
|
|
72
|
-
fs.writeFileSync(path.join(
|
|
60
|
+
fs.writeFileSync(path.join(home, 'codex/all.md'), '');
|
|
61
|
+
// Write guild.json — empty registries, tools installed via bundle
|
|
62
|
+
const config = createInitialGuildConfig(name, VERSION, model);
|
|
63
|
+
fs.writeFileSync(path.join(home, 'guild.json'), JSON.stringify(config, null, 2) + '\n');
|
|
64
|
+
// Make the guildhall an npm package so guild tools can be installed as
|
|
65
|
+
// npm dependencies with proper dependency resolution.
|
|
66
|
+
fs.writeFileSync(path.join(home, 'package.json'), JSON.stringify({ name: `guild-${name}`, private: true, version: '0.0.0' }, null, 2) + '\n');
|
|
67
|
+
fs.writeFileSync(path.join(home, '.gitignore'), 'node_modules/\n.nexus/\n');
|
|
73
68
|
// Initial commit
|
|
74
|
-
git(['add', '-A'],
|
|
75
|
-
git(['commit', '-m', 'Initialize guild'],
|
|
69
|
+
git(['add', '-A'], home);
|
|
70
|
+
git(['commit', '-m', 'Initialize guild'], home);
|
|
76
71
|
}
|
|
77
72
|
//# sourceMappingURL=init-guild.js.map
|
package/dist/init-guild.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-guild.js","sourceRoot":"","sources":["../src/init-guild.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"init-guild.js","sourceRoot":"","sources":["../src/init-guild.ts"],"names":[],"mappings":"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"}
|
package/dist/install-tool.d.ts
CHANGED
|
@@ -1,34 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the source was classified for installation.
|
|
3
|
+
*
|
|
4
|
+
* - `registry` — npm package specifier (e.g. `foo@1.0`, `@scope/tool`)
|
|
5
|
+
* - `git-url` — git URL (e.g. `git+https://github.com/org/repo.git#v1.0`)
|
|
6
|
+
* - `workshop` — workshop ref (e.g. `workshop:forge#tool/fetch-jira@1.0`)
|
|
7
|
+
* - `tarball` — local .tgz/.tar.gz file
|
|
8
|
+
* - `link` — symlinked local directory (dev mode)
|
|
9
|
+
*/
|
|
10
|
+
export type SourceKind = 'registry' | 'git-url' | 'workshop' | 'tarball' | 'link';
|
|
1
11
|
export interface InstallToolOptions {
|
|
2
|
-
/** Absolute path to the
|
|
12
|
+
/** Absolute path to the guild root directory. */
|
|
3
13
|
home: string;
|
|
4
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Source specifier:
|
|
16
|
+
*
|
|
17
|
+
* - npm package specifier: `some-tool@1.0`, `@scope/tool`
|
|
18
|
+
* - Git URL: `git+https://github.com/org/repo.git#v1.0`
|
|
19
|
+
* - Workshop ref: `workshop:forge#tool/fetch-jira@1.0`
|
|
20
|
+
* - Tarball: `./my-tool-1.0.0.tgz`
|
|
21
|
+
* - Local directory (with `--link`): `~/projects/my-tool`
|
|
22
|
+
*/
|
|
5
23
|
source: string;
|
|
6
|
-
/** Override the tool name (defaults to
|
|
24
|
+
/** Override the tool name (defaults to package name or directory basename). */
|
|
7
25
|
name?: string;
|
|
8
26
|
/** Override the version slot. */
|
|
9
27
|
slot?: string;
|
|
10
28
|
/** Roles for implements (comma-separated or array). */
|
|
11
29
|
roles?: string[];
|
|
12
|
-
/**
|
|
13
|
-
* Install as a framework tool (`source: 'nexus'`).
|
|
14
|
-
* Installs to `nexus/implements/` or `nexus/engines/` instead of
|
|
15
|
-
* guild-managed directories. Framework tools cannot be removed via remove-tool.
|
|
16
|
-
*/
|
|
17
|
-
framework?: boolean;
|
|
18
30
|
/** Whether to create a git commit after installing. Defaults to true. */
|
|
19
31
|
commit?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Symlink a local directory instead of copying (dev mode).
|
|
34
|
+
* Only valid for local directories with `package.json`.
|
|
35
|
+
* Changes to the source are reflected immediately at runtime.
|
|
36
|
+
* **Not durable** — will not survive a fresh clone.
|
|
37
|
+
*/
|
|
38
|
+
link?: boolean;
|
|
39
|
+
/** Bundle provenance — which bundle delivered this artifact. */
|
|
40
|
+
bundle?: string;
|
|
20
41
|
}
|
|
21
42
|
export interface InstallResult {
|
|
22
43
|
category: 'implements' | 'engines' | 'curricula' | 'temperaments';
|
|
23
44
|
name: string;
|
|
24
45
|
slot: string;
|
|
25
46
|
installedTo: string;
|
|
47
|
+
sourceKind: SourceKind;
|
|
26
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Classify a source string to determine the installation method.
|
|
51
|
+
*
|
|
52
|
+
* @param source - The source specifier.
|
|
53
|
+
* @param link - Whether the --link flag was set.
|
|
54
|
+
*/
|
|
55
|
+
export declare function classifySource(source: string, link?: boolean): SourceKind;
|
|
27
56
|
/**
|
|
28
57
|
* Install a tool (implement, engine, curriculum, or temperament) into the guild.
|
|
29
58
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
59
|
+
* Supports five source types:
|
|
60
|
+
* - **Registry** — npm package specifier, fully durable via package.json
|
|
61
|
+
* - **Git URL** — `git+https://...`, fully durable via package.json
|
|
62
|
+
* - **Workshop** — `workshop:name#ref`, durable within the guild via full source in slot
|
|
63
|
+
* - **Tarball** — `.tgz` file, durable via full source in slot
|
|
64
|
+
* - **Link** — symlinked local dir (dev mode), NOT durable
|
|
65
|
+
*
|
|
66
|
+
* For npm-installed tools, runtime code lives in node_modules. Metadata
|
|
67
|
+
* (descriptor + instructions) is copied to the guild slot for git tracking.
|
|
68
|
+
* The `package` field in guild.json tells the manifest engine to resolve by package name.
|
|
32
69
|
*/
|
|
33
70
|
export declare function installTool(opts: InstallToolOptions): InstallResult;
|
|
34
71
|
//# sourceMappingURL=install-tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-tool.d.ts","sourceRoot":"","sources":["../src/install-tool.ts"],"names":[],"mappings":"AAiCA,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb
|
|
1
|
+
{"version":3,"file":"install-tool.d.ts","sourceRoot":"","sources":["../src/install-tool.ts"],"names":[],"mappings":"AAiCA;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAElF,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;;OAQG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,yEAAyE;IACzE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc,CAAC;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;CACxB;AAgFD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,OAAe,GAAG,UAAU,CAMhF;AA2KD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,aAAa,CAiJnE"}
|