@rolexjs/core 1.5.0-dev-20260317075835 → 1.5.0
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/index.d.ts +26 -86
- package/dist/index.js +146 -339
- package/dist/index.js.map +1 -1
- package/package.json +3 -7
package/dist/index.js
CHANGED
|
@@ -66,6 +66,13 @@ var strategy = structure("strategy", "Product strategy \u2014 how to win", produ
|
|
|
66
66
|
var spec = structure("spec", "Product behavior contract \u2014 BDD specification", product);
|
|
67
67
|
var release = structure("release", "Product version release", product);
|
|
68
68
|
var channel = structure("channel", "Product distribution channel", product);
|
|
69
|
+
var issue = structure("issue", "A collaboration topic requiring attention", society, [
|
|
70
|
+
relation("authored-by", "Who created this issue", individual),
|
|
71
|
+
relation("assigned-to", "Who is responsible for this issue", individual)
|
|
72
|
+
]);
|
|
73
|
+
var comment = structure("comment", "A discussion entry on an issue", issue, [
|
|
74
|
+
relation("authored-by", "Who wrote this comment", individual)
|
|
75
|
+
]);
|
|
69
76
|
|
|
70
77
|
// src/execution.ts
|
|
71
78
|
import { create, process, transform } from "@rolexjs/system";
|
|
@@ -552,27 +559,6 @@ var Role = class {
|
|
|
552
559
|
return this.fmt("role.forget", result);
|
|
553
560
|
}
|
|
554
561
|
// ================================================================
|
|
555
|
-
// Skills
|
|
556
|
-
// ================================================================
|
|
557
|
-
/** Skill: load full skill content by locator. */
|
|
558
|
-
async skill(locator) {
|
|
559
|
-
return await this.deps.commands["role.skill"](locator);
|
|
560
|
-
}
|
|
561
|
-
// ================================================================
|
|
562
|
-
// Use — subjective execution
|
|
563
|
-
// ================================================================
|
|
564
|
-
/** Use: subjective execution — `!ns.method` or ResourceX locator. */
|
|
565
|
-
async use(locator, args) {
|
|
566
|
-
if (!this.deps.direct) {
|
|
567
|
-
throw new Error("Direct execution is not available on this Role instance.");
|
|
568
|
-
}
|
|
569
|
-
const result = await this.deps.direct(locator, args);
|
|
570
|
-
if (this.deps.transformUseResult) {
|
|
571
|
-
return this.deps.transformUseResult(locator, result);
|
|
572
|
-
}
|
|
573
|
-
return result;
|
|
574
|
-
}
|
|
575
|
-
// ================================================================
|
|
576
562
|
// Cognitive hints
|
|
577
563
|
// ================================================================
|
|
578
564
|
cognitiveHint(process8) {
|
|
@@ -621,10 +607,6 @@ var Role = class {
|
|
|
621
607
|
}
|
|
622
608
|
};
|
|
623
609
|
|
|
624
|
-
// src/rolex-service.ts
|
|
625
|
-
import { createIssueX } from "issuexjs";
|
|
626
|
-
import { createResourceX, setProvider } from "resourcexjs";
|
|
627
|
-
|
|
628
610
|
// src/apply.ts
|
|
629
611
|
async function applyPrototype(data, repo, direct) {
|
|
630
612
|
const sorted = [...data.migrations].sort((a, b) => a.version - b.version);
|
|
@@ -667,7 +649,7 @@ function findInState(state, target) {
|
|
|
667
649
|
return null;
|
|
668
650
|
}
|
|
669
651
|
function createHelpers(ctx) {
|
|
670
|
-
const { rt, project: project2
|
|
652
|
+
const { rt, project: project2 } = ctx;
|
|
671
653
|
async function ok2(node, process8) {
|
|
672
654
|
return { state: await project2(node), process: process8 };
|
|
673
655
|
}
|
|
@@ -689,95 +671,142 @@ function createHelpers(ctx) {
|
|
|
689
671
|
const existing = findInState(state, id);
|
|
690
672
|
if (existing) await rt.remove(existing);
|
|
691
673
|
}
|
|
692
|
-
|
|
693
|
-
if (!resourcex) throw new Error("ResourceX is not available.");
|
|
694
|
-
return resourcex;
|
|
695
|
-
}
|
|
696
|
-
function requireIssueX() {
|
|
697
|
-
if (!issuex) throw new Error("IssueX is not available.");
|
|
698
|
-
return issuex;
|
|
699
|
-
}
|
|
700
|
-
return { ok: ok2, archive: archive2, validateGherkin, removeExisting, requireResourceX, requireIssueX };
|
|
674
|
+
return { ok: ok2, archive: archive2, validateGherkin, removeExisting };
|
|
701
675
|
}
|
|
702
676
|
|
|
703
677
|
// src/commands/issue.ts
|
|
704
|
-
|
|
705
|
-
|
|
678
|
+
var nextIssueNumber = 0;
|
|
679
|
+
function initCounter(children) {
|
|
680
|
+
let max = 0;
|
|
681
|
+
for (const child of children) {
|
|
682
|
+
if (child.name === "issue" && child.id) {
|
|
683
|
+
const match = child.id.match(/^issue-(\d+)$/);
|
|
684
|
+
if (match) {
|
|
685
|
+
const n = parseInt(match[1], 10);
|
|
686
|
+
if (n > max) max = n;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
nextIssueNumber = max;
|
|
691
|
+
}
|
|
692
|
+
function allocateNumber() {
|
|
693
|
+
return ++nextIssueNumber;
|
|
694
|
+
}
|
|
695
|
+
function issueCommands(ctx, helpers) {
|
|
696
|
+
const { rt, society: society2, resolve, project: project2 } = ctx;
|
|
697
|
+
const { ok: ok2 } = helpers;
|
|
698
|
+
let counterInitialized = false;
|
|
699
|
+
async function ensureCounter() {
|
|
700
|
+
if (counterInitialized) return;
|
|
701
|
+
const state = await rt.project(society2);
|
|
702
|
+
initCounter(state.children ?? []);
|
|
703
|
+
counterInitialized = true;
|
|
704
|
+
}
|
|
705
|
+
async function findIssue(number) {
|
|
706
|
+
const id = `issue-${number}`;
|
|
707
|
+
const node = await resolve(id);
|
|
708
|
+
return node;
|
|
709
|
+
}
|
|
706
710
|
return {
|
|
707
711
|
async "issue.publish"(title, body, author, assignee) {
|
|
708
|
-
|
|
709
|
-
|
|
712
|
+
await ensureCounter();
|
|
713
|
+
const number = allocateNumber();
|
|
714
|
+
const id = `issue-${number}`;
|
|
715
|
+
const node = await rt.create(society2, issue, body, id, [title]);
|
|
716
|
+
await rt.addTag(node, "open");
|
|
717
|
+
const authorNode = await resolve(author);
|
|
718
|
+
await rt.link(node, authorNode, "authored-by", "author-of");
|
|
719
|
+
if (assignee) {
|
|
720
|
+
const assigneeNode = await resolve(assignee);
|
|
721
|
+
await rt.link(node, assigneeNode, "assigned-to", "assigned");
|
|
722
|
+
}
|
|
723
|
+
return ok2(node, "publish");
|
|
710
724
|
},
|
|
711
725
|
async "issue.get"(number) {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
726
|
+
const node = await findIssue(number);
|
|
727
|
+
return ok2(node, "get");
|
|
728
|
+
},
|
|
729
|
+
async "issue.list"(status, _author, _assignee, _label) {
|
|
730
|
+
const state = await project2(society2);
|
|
731
|
+
const issues = (state.children ?? []).filter((c) => {
|
|
732
|
+
if (c.name !== "issue") return false;
|
|
733
|
+
if (status && !c.tags?.includes(status)) return false;
|
|
734
|
+
return true;
|
|
735
|
+
});
|
|
736
|
+
return {
|
|
737
|
+
state: { ...state, children: issues },
|
|
738
|
+
process: "list"
|
|
739
|
+
};
|
|
723
740
|
},
|
|
724
741
|
async "issue.update"(number, title, body, assignee) {
|
|
725
|
-
const
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
742
|
+
const node = await findIssue(number);
|
|
743
|
+
if (body !== void 0 || title !== void 0) {
|
|
744
|
+
const target = issue;
|
|
745
|
+
if (body !== void 0) {
|
|
746
|
+
await rt.transform(node, target, body);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
if (assignee !== void 0) {
|
|
750
|
+
const state = await rt.project(node);
|
|
751
|
+
const existingAssignee = state.links?.find((l) => l.relation === "assigned-to");
|
|
752
|
+
if (existingAssignee) {
|
|
753
|
+
await rt.unlink(node, existingAssignee.target, "assigned-to", "assigned");
|
|
754
|
+
}
|
|
755
|
+
if (assignee) {
|
|
756
|
+
const assigneeNode = await resolve(assignee);
|
|
757
|
+
await rt.link(node, assigneeNode, "assigned-to", "assigned");
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return ok2(node, "update");
|
|
733
761
|
},
|
|
734
762
|
async "issue.close"(number) {
|
|
735
|
-
const
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
return
|
|
763
|
+
const node = await findIssue(number);
|
|
764
|
+
await rt.removeTag(node, "open");
|
|
765
|
+
await rt.addTag(node, "closed");
|
|
766
|
+
return ok2(node, "close");
|
|
739
767
|
},
|
|
740
768
|
async "issue.reopen"(number) {
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
return
|
|
769
|
+
const node = await findIssue(number);
|
|
770
|
+
await rt.removeTag(node, "closed");
|
|
771
|
+
await rt.addTag(node, "open");
|
|
772
|
+
return ok2(node, "reopen");
|
|
745
773
|
},
|
|
746
774
|
async "issue.assign"(number, assignee) {
|
|
747
|
-
const
|
|
748
|
-
const
|
|
749
|
-
|
|
750
|
-
|
|
775
|
+
const node = await findIssue(number);
|
|
776
|
+
const state = await rt.project(node);
|
|
777
|
+
const existingAssignee = state.links?.find((l) => l.relation === "assigned-to");
|
|
778
|
+
if (existingAssignee) {
|
|
779
|
+
await rt.unlink(node, existingAssignee.target, "assigned-to", "assigned");
|
|
780
|
+
}
|
|
781
|
+
const assigneeNode = await resolve(assignee);
|
|
782
|
+
await rt.link(node, assigneeNode, "assigned-to", "assigned");
|
|
783
|
+
return ok2(node, "assign");
|
|
751
784
|
},
|
|
752
785
|
async "issue.comment"(number, body, author) {
|
|
753
|
-
const
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
|
|
786
|
+
const issueNode = await findIssue(number);
|
|
787
|
+
const commentNode = await rt.create(issueNode, comment, body);
|
|
788
|
+
const authorNode = await resolve(author);
|
|
789
|
+
await rt.link(commentNode, authorNode, "authored-by", "author-of");
|
|
790
|
+
return ok2(commentNode, "comment");
|
|
757
791
|
},
|
|
758
792
|
async "issue.comments"(number) {
|
|
759
|
-
const
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
return
|
|
793
|
+
const issueNode = await findIssue(number);
|
|
794
|
+
const state = await project2(issueNode);
|
|
795
|
+
const comments = (state.children ?? []).filter((c) => c.name === "comment");
|
|
796
|
+
return {
|
|
797
|
+
state: { ...state, children: comments },
|
|
798
|
+
process: "comments"
|
|
799
|
+
};
|
|
763
800
|
},
|
|
764
801
|
async "issue.label"(number, label) {
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
let labelObj = await ix.getLabelByName(label);
|
|
769
|
-
if (!labelObj) labelObj = await ix.createLabel({ name: label });
|
|
770
|
-
await ix.addLabel(issue.id, labelObj.id);
|
|
771
|
-
return ix.getIssueByNumber(number);
|
|
802
|
+
const node = await findIssue(number);
|
|
803
|
+
await rt.addTag(node, label);
|
|
804
|
+
return ok2(node, "label");
|
|
772
805
|
},
|
|
773
806
|
async "issue.unlabel"(number, label) {
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
const labelObj = await ix.getLabelByName(label);
|
|
778
|
-
if (!labelObj) throw new Error(`Label "${label}" not found.`);
|
|
779
|
-
await ix.removeLabel(issue.id, labelObj.id);
|
|
780
|
-
return ix.getIssueByNumber(number);
|
|
807
|
+
const node = await findIssue(number);
|
|
808
|
+
await rt.removeTag(node, label);
|
|
809
|
+
return ok2(node, "unlabel");
|
|
781
810
|
}
|
|
782
811
|
};
|
|
783
812
|
}
|
|
@@ -871,7 +900,7 @@ function projectCommands(ctx, helpers) {
|
|
|
871
900
|
},
|
|
872
901
|
async "project.achieve"(milestone2) {
|
|
873
902
|
const node = await resolve(milestone2);
|
|
874
|
-
await rt.
|
|
903
|
+
await rt.addTag(node, "done");
|
|
875
904
|
return ok2(node, "achieve");
|
|
876
905
|
},
|
|
877
906
|
async "project.enroll"(project2, individual2) {
|
|
@@ -916,69 +945,10 @@ function projectCommands(ctx, helpers) {
|
|
|
916
945
|
};
|
|
917
946
|
}
|
|
918
947
|
|
|
919
|
-
// src/commands/resource.ts
|
|
920
|
-
function resourceCommands(_ctx, helpers) {
|
|
921
|
-
const { requireResourceX } = helpers;
|
|
922
|
-
return {
|
|
923
|
-
"resource.add"(path) {
|
|
924
|
-
return requireResourceX().add(path);
|
|
925
|
-
},
|
|
926
|
-
"resource.search"(query) {
|
|
927
|
-
return requireResourceX().search(query);
|
|
928
|
-
},
|
|
929
|
-
"resource.has"(locator) {
|
|
930
|
-
return requireResourceX().has(locator);
|
|
931
|
-
},
|
|
932
|
-
"resource.info"(locator) {
|
|
933
|
-
return requireResourceX().info(locator);
|
|
934
|
-
},
|
|
935
|
-
"resource.remove"(locator) {
|
|
936
|
-
return requireResourceX().remove(locator);
|
|
937
|
-
},
|
|
938
|
-
"resource.push"(locator, options) {
|
|
939
|
-
return requireResourceX().push(locator, options);
|
|
940
|
-
},
|
|
941
|
-
"resource.pull"(locator, options) {
|
|
942
|
-
return requireResourceX().pull(locator, options);
|
|
943
|
-
},
|
|
944
|
-
"resource.clearCache"(registry) {
|
|
945
|
-
return requireResourceX().clearCache(registry);
|
|
946
|
-
}
|
|
947
|
-
};
|
|
948
|
-
}
|
|
949
|
-
|
|
950
948
|
// src/commands/role.ts
|
|
951
|
-
function formatRXM(rxm) {
|
|
952
|
-
const lines = [`--- RXM: ${rxm.locator} ---`];
|
|
953
|
-
const def2 = rxm.definition;
|
|
954
|
-
if (def2) {
|
|
955
|
-
if (def2.author) lines.push(`Author: ${def2.author}`);
|
|
956
|
-
if (def2.description) lines.push(`Description: ${def2.description}`);
|
|
957
|
-
}
|
|
958
|
-
const source = rxm.source;
|
|
959
|
-
if (source?.files) {
|
|
960
|
-
lines.push("Files:");
|
|
961
|
-
lines.push(renderFileTree(source.files, " "));
|
|
962
|
-
}
|
|
963
|
-
lines.push("---");
|
|
964
|
-
return lines.join("\n");
|
|
965
|
-
}
|
|
966
|
-
function renderFileTree(files, indent = "") {
|
|
967
|
-
const lines = [];
|
|
968
|
-
for (const [name, value] of Object.entries(files)) {
|
|
969
|
-
if (value && typeof value === "object" && !("size" in value)) {
|
|
970
|
-
lines.push(`${indent}${name}`);
|
|
971
|
-
lines.push(renderFileTree(value, `${indent} `));
|
|
972
|
-
} else {
|
|
973
|
-
const size = value?.size ? ` (${value.size} bytes)` : "";
|
|
974
|
-
lines.push(`${indent}${name}${size}`);
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
return lines.filter(Boolean).join("\n");
|
|
978
|
-
}
|
|
979
949
|
function roleCommands(ctx, helpers) {
|
|
980
950
|
const { rt, resolve } = ctx;
|
|
981
|
-
const { ok: ok2, validateGherkin, removeExisting
|
|
951
|
+
const { ok: ok2, validateGherkin, removeExisting } = helpers;
|
|
982
952
|
return {
|
|
983
953
|
// ---- Role: focus ----
|
|
984
954
|
async "role.focus"(goal2) {
|
|
@@ -1005,7 +975,7 @@ function roleCommands(ctx, helpers) {
|
|
|
1005
975
|
async "role.finish"(task2, individual2, encounter2) {
|
|
1006
976
|
validateGherkin(encounter2);
|
|
1007
977
|
const taskNode = await resolve(task2);
|
|
1008
|
-
await rt.
|
|
978
|
+
await rt.addTag(taskNode, "done");
|
|
1009
979
|
if (encounter2) {
|
|
1010
980
|
const encId = taskNode.id ? `${taskNode.id}-finished` : void 0;
|
|
1011
981
|
const enc = await rt.create(await resolve(individual2), encounter, encounter2, encId);
|
|
@@ -1016,7 +986,7 @@ function roleCommands(ctx, helpers) {
|
|
|
1016
986
|
async "role.complete"(plan2, individual2, encounter2) {
|
|
1017
987
|
validateGherkin(encounter2);
|
|
1018
988
|
const planNode = await resolve(plan2);
|
|
1019
|
-
await rt.
|
|
989
|
+
await rt.addTag(planNode, "done");
|
|
1020
990
|
const encId = planNode.id ? `${planNode.id}-completed` : void 0;
|
|
1021
991
|
const enc = await rt.create(await resolve(individual2), encounter, encounter2, encId);
|
|
1022
992
|
return ok2(enc, "complete");
|
|
@@ -1024,7 +994,7 @@ function roleCommands(ctx, helpers) {
|
|
|
1024
994
|
async "role.abandon"(plan2, individual2, encounter2) {
|
|
1025
995
|
validateGherkin(encounter2);
|
|
1026
996
|
const planNode = await resolve(plan2);
|
|
1027
|
-
await rt.
|
|
997
|
+
await rt.addTag(planNode, "abandoned");
|
|
1028
998
|
const encId = planNode.id ? `${planNode.id}-abandoned` : void 0;
|
|
1029
999
|
const enc = await rt.create(await resolve(individual2), encounter, encounter2, encId);
|
|
1030
1000
|
return ok2(enc, "abandon");
|
|
@@ -1075,20 +1045,6 @@ function roleCommands(ctx, helpers) {
|
|
|
1075
1045
|
const node = await resolve(nodeId);
|
|
1076
1046
|
await rt.remove(node);
|
|
1077
1047
|
return { state: { ...node, children: [] }, process: "forget" };
|
|
1078
|
-
},
|
|
1079
|
-
// ---- Role: skill ----
|
|
1080
|
-
async "role.skill"(locator) {
|
|
1081
|
-
const rx = requireResourceX();
|
|
1082
|
-
const content = await rx.ingest(locator);
|
|
1083
|
-
const text = typeof content === "string" ? content : JSON.stringify(content, null, 2);
|
|
1084
|
-
try {
|
|
1085
|
-
const rxm = await rx.info(locator);
|
|
1086
|
-
return `${formatRXM(rxm)}
|
|
1087
|
-
|
|
1088
|
-
${text}`;
|
|
1089
|
-
} catch {
|
|
1090
|
-
return text;
|
|
1091
|
-
}
|
|
1092
1048
|
}
|
|
1093
1049
|
};
|
|
1094
1050
|
}
|
|
@@ -1226,7 +1182,6 @@ function createCommands(ctx) {
|
|
|
1226
1182
|
...projectCommands(ctx, helpers),
|
|
1227
1183
|
...productCommands(ctx, helpers),
|
|
1228
1184
|
...surveyCommands(ctx, helpers),
|
|
1229
|
-
...resourceCommands(ctx, helpers),
|
|
1230
1185
|
...issueCommands(ctx, helpers)
|
|
1231
1186
|
};
|
|
1232
1187
|
}
|
|
@@ -1736,74 +1691,6 @@ var projectUnmaintain = def(
|
|
|
1736
1691
|
["project", "individual"]
|
|
1737
1692
|
);
|
|
1738
1693
|
|
|
1739
|
-
// src/instructions/resource.ts
|
|
1740
|
-
var resourceAdd = def(
|
|
1741
|
-
"resource",
|
|
1742
|
-
"add",
|
|
1743
|
-
{
|
|
1744
|
-
path: { type: "string", required: true, description: "Path to resource directory" }
|
|
1745
|
-
},
|
|
1746
|
-
["path"]
|
|
1747
|
-
);
|
|
1748
|
-
var resourceSearch = def(
|
|
1749
|
-
"resource",
|
|
1750
|
-
"search",
|
|
1751
|
-
{
|
|
1752
|
-
query: { type: "string", required: false, description: "Search query" }
|
|
1753
|
-
},
|
|
1754
|
-
["query"]
|
|
1755
|
-
);
|
|
1756
|
-
var resourceHas = def(
|
|
1757
|
-
"resource",
|
|
1758
|
-
"has",
|
|
1759
|
-
{
|
|
1760
|
-
locator: { type: "string", required: true, description: "Resource locator" }
|
|
1761
|
-
},
|
|
1762
|
-
["locator"]
|
|
1763
|
-
);
|
|
1764
|
-
var resourceInfo = def(
|
|
1765
|
-
"resource",
|
|
1766
|
-
"info",
|
|
1767
|
-
{
|
|
1768
|
-
locator: { type: "string", required: true, description: "Resource locator" }
|
|
1769
|
-
},
|
|
1770
|
-
["locator"]
|
|
1771
|
-
);
|
|
1772
|
-
var resourceRemove = def(
|
|
1773
|
-
"resource",
|
|
1774
|
-
"remove",
|
|
1775
|
-
{
|
|
1776
|
-
locator: { type: "string", required: true, description: "Resource locator" }
|
|
1777
|
-
},
|
|
1778
|
-
["locator"]
|
|
1779
|
-
);
|
|
1780
|
-
var resourcePush = def(
|
|
1781
|
-
"resource",
|
|
1782
|
-
"push",
|
|
1783
|
-
{
|
|
1784
|
-
locator: { type: "string", required: true, description: "Resource locator" },
|
|
1785
|
-
registry: { type: "string", required: false, description: "Registry URL (overrides default)" }
|
|
1786
|
-
},
|
|
1787
|
-
["locator", { pack: ["registry"] }]
|
|
1788
|
-
);
|
|
1789
|
-
var resourcePull = def(
|
|
1790
|
-
"resource",
|
|
1791
|
-
"pull",
|
|
1792
|
-
{
|
|
1793
|
-
locator: { type: "string", required: true, description: "Resource locator" },
|
|
1794
|
-
registry: { type: "string", required: false, description: "Registry URL (overrides default)" }
|
|
1795
|
-
},
|
|
1796
|
-
["locator", { pack: ["registry"] }]
|
|
1797
|
-
);
|
|
1798
|
-
var resourceClearCache = def(
|
|
1799
|
-
"resource",
|
|
1800
|
-
"clearCache",
|
|
1801
|
-
{
|
|
1802
|
-
registry: { type: "string", required: false, description: "Registry to clear cache for" }
|
|
1803
|
-
},
|
|
1804
|
-
["registry"]
|
|
1805
|
-
);
|
|
1806
|
-
|
|
1807
1694
|
// src/instructions/role.ts
|
|
1808
1695
|
var roleActivate = def(
|
|
1809
1696
|
"role",
|
|
@@ -1991,14 +1878,6 @@ var roleForget = def(
|
|
|
1991
1878
|
},
|
|
1992
1879
|
["id", "individual"]
|
|
1993
1880
|
);
|
|
1994
|
-
var roleSkill = def(
|
|
1995
|
-
"role",
|
|
1996
|
-
"skill",
|
|
1997
|
-
{
|
|
1998
|
-
locator: { type: "string", required: true, description: "ResourceX locator for the skill" }
|
|
1999
|
-
},
|
|
2000
|
-
["locator"]
|
|
2001
|
-
);
|
|
2002
1881
|
|
|
2003
1882
|
// src/instructions/society.ts
|
|
2004
1883
|
var societyBorn = def(
|
|
@@ -2163,7 +2042,6 @@ var instructions = {
|
|
|
2163
2042
|
"role.realize": roleRealize,
|
|
2164
2043
|
"role.master": roleMaster,
|
|
2165
2044
|
"role.forget": roleForget,
|
|
2166
|
-
"role.skill": roleSkill,
|
|
2167
2045
|
// org
|
|
2168
2046
|
"org.charter": orgCharter,
|
|
2169
2047
|
"org.hire": orgHire,
|
|
@@ -2205,15 +2083,6 @@ var instructions = {
|
|
|
2205
2083
|
"survey.list": surveyList,
|
|
2206
2084
|
// prototype
|
|
2207
2085
|
"prototype.evict": prototypeEvict,
|
|
2208
|
-
// resource
|
|
2209
|
-
"resource.add": resourceAdd,
|
|
2210
|
-
"resource.search": resourceSearch,
|
|
2211
|
-
"resource.has": resourceHas,
|
|
2212
|
-
"resource.info": resourceInfo,
|
|
2213
|
-
"resource.remove": resourceRemove,
|
|
2214
|
-
"resource.push": resourcePush,
|
|
2215
|
-
"resource.pull": resourcePull,
|
|
2216
|
-
"resource.clearCache": resourceClearCache,
|
|
2217
2086
|
// issue
|
|
2218
2087
|
"issue.publish": issuePublish,
|
|
2219
2088
|
"issue.get": issueGet,
|
|
@@ -2678,7 +2547,7 @@ var processes = {
|
|
|
2678
2547
|
deliver: "Feature: deliver \u2014 define a project deliverable\n Define a deliverable for a project.\n Deliverables describe the concrete outputs produced by the project.\n\n Scenario: Define a deliverable\n Given a project exists in society\n And a Gherkin source describing the deliverable\n When deliver is called on the project with a deliverable id\n Then the deliverable is stored as the project's information\n\n Scenario: Parameters\n Given the command is project.deliver\n Then project is required \u2014 the project's id\n And content is required \u2014 Gherkin Feature source for the deliverable\n And id is required \u2014 deliverable id (keywords joined by hyphens)\n\n Scenario: Writing the deliverable Gherkin\n Given the deliverable defines a concrete output of the project\n Then the Feature title names the deliverable\n And Scenarios describe acceptance criteria and specifications\n And the tone is concrete \u2014 what is being produced and how it will be evaluated\n",
|
|
2679
2548
|
deprecate: "Feature: deprecate \u2014 deprecate a product\n Mark a product as deprecated.\n The product is no longer actively maintained or recommended.\n\n Scenario: Deprecate a product\n Given a product exists in society\n When deprecate is called on the product\n Then the product is marked as deprecated\n\n Scenario: Parameters\n Given the command is product.deprecate\n Then product is required \u2014 the product's id\n",
|
|
2680
2549
|
die: "Feature: die \u2014 permanently archive an individual\n Move an individual to the past archive with intent of permanence.\n Technically identical to retire (data is preserved in past), but signals finality.\n Use die when the individual is no longer needed (deprecated role, replaced).\n\n Scenario: Archive an individual permanently\n Given an individual exists in society\n When die is called on the individual\n Then the individual is moved to the past archive\n And data is preserved but restoration is not intended\n\n Scenario: Parameters\n Given the command is society.die\n Then individual is required \u2014 the individual's id\n\n Scenario: retire vs die\n Given both move the individual to past archive\n Then retire signals temporary \u2014 may return later\n And die signals permanent \u2014 not intended to return\n",
|
|
2681
|
-
direct:
|
|
2550
|
+
direct: "Feature: direct \u2014 world-level command executor\n Execute RoleX world commands without an active role.\n Direct operates as an anonymous observer \u2014 no role identity, no role context.\n Use for administrative operations like society.born, org.hire, etc.\n\n Scenario: Execute a world command\n Given the command follows the namespace.method pattern\n When direct is called with the command and named args\n Then the command is dispatched to the corresponding RoleX API\n And the result is returned\n",
|
|
2682
2551
|
dismiss: "Feature: dismiss \u2014 remove from a position\n Dismiss an individual from a position.\n The individual remains a member of the organization.\n\n Scenario: Dismiss an individual\n Given an individual holds a position\n When dismiss is called with the position and individual\n Then the individual no longer holds the position\n And the individual remains a member of the organization\n And the position is now vacant\n\n Scenario: Parameters\n Given the command is position.dismiss\n Then position is required \u2014 the position's id\n And individual is required \u2014 the individual's id\n",
|
|
2683
2552
|
disown: "Feature: disown \u2014 remove product owner\n Remove an individual as an owner of a product.\n The individual is no longer responsible for the product.\n\n Scenario: Remove an owner\n Given an individual is an owner of a product\n When disown is called with the product and individual\n Then the individual is no longer an owner of the product\n\n Scenario: Parameters\n Given the command is product.disown\n Then product is required \u2014 the product's id\n And individual is required \u2014 the individual's id (owner to remove)\n",
|
|
2684
2553
|
dissolve: "Feature: dissolve \u2014 dissolve an organization\n Move an organization to the past archive.\n The organization and its subtree are archived, not deleted.\n\n Scenario: Dissolve an organization\n Given an organization exists in society\n When dissolve is called on the organization\n Then the organization is moved to the past archive\n And the organization's subtree (charter, positions) is preserved in past\n\n Scenario: Parameters\n Given the command is society.dissolve\n Then org is required \u2014 the organization's id\n",
|
|
@@ -2775,7 +2644,6 @@ var processes = {
|
|
|
2775
2644
|
retire: "Feature: retire \u2014 archive an individual\n Move an individual to the past archive.\n All data is preserved \u2014 the individual can be rehired later with full history intact.\n Use retire when the individual may return (sabbatical, role rotation).\n\n Scenario: Retire an individual\n Given an individual exists in society\n When retire is called on the individual\n Then the individual is moved to the past archive\n And all knowledge, experience, and history are preserved\n And the individual can be restored via rehire\n\n Scenario: Parameters\n Given the command is society.retire\n Then individual is required \u2014 the individual's id\n",
|
|
2776
2645
|
scope: "Feature: scope \u2014 define project scope\n Define the scope for a project.\n The scope describes the boundaries, inclusions, and exclusions of the project.\n\n Scenario: Define project scope\n Given a project exists in society\n And a Gherkin source describing the scope\n When scope is called on the project with a scope id\n Then the scope is stored as the project's information\n\n Scenario: Parameters\n Given the command is project.scope\n Then project is required \u2014 the project's id\n And content is required \u2014 Gherkin Feature source for the scope\n And id is required \u2014 scope id\n\n Scenario: Writing the scope Gherkin\n Given the scope defines the boundaries of a project\n Then the Feature title names the scope area\n And Scenarios describe what is included and excluded\n And the tone is declarative \u2014 stating what the project covers\n",
|
|
2777
2646
|
settle: "Feature: settle \u2014 register a prototype into the world\n Pull a prototype from a ResourceX source and register it locally.\n Once settled, the prototype can be used to create individuals or organizations.\n\n Scenario: Settle a prototype\n Given a valid ResourceX source exists (URL, path, or locator)\n When settle is called with the source\n Then the resource is ingested and its state is extracted\n And the prototype is registered locally by its id\n And the prototype is available for born, activate, and organizational use\n",
|
|
2778
|
-
skill: "Feature: skill \u2014 load full skill content\n Load the complete skill instructions by ResourceX locator.\n This is progressive disclosure layer 2 \u2014 on-demand knowledge injection.\n\n Scenario: Load a skill\n Given a procedure exists in the role with a locator\n When skill is called with the locator\n Then the full SKILL.md content is loaded via ResourceX\n And the content is injected into the AI's context\n And the AI can now follow the skill's detailed instructions\n",
|
|
2779
2647
|
spec: "Feature: spec \u2014 define product specification\n Define a behavior contract (BDD specification) for a product.\n Specs describe the expected behavior of the product in Gherkin format.\n\n Scenario: Define a product spec\n Given a product exists in society\n And a Gherkin source describing the behavior contract\n When spec is called on the product with a spec id\n Then the spec is stored as the product's information\n\n Scenario: Parameters\n Given the command is product.spec\n Then product is required \u2014 the product's id\n And content is required \u2014 Gherkin Feature source for the behavior contract (BDD specification)\n And id is required \u2014 spec id (keywords joined by hyphens)\n\n Scenario: Writing the spec Gherkin\n Given the spec defines expected product behavior\n Then the Feature title names the behavior or capability\n And Scenarios describe Given-When-Then acceptance criteria\n And the tone is precise \u2014 specifying exactly what the product should do\n",
|
|
2780
2648
|
strategy: "Feature: strategy \u2014 define product strategy\n Define the strategy for a product.\n The strategy describes the product's direction, positioning, and competitive approach.\n\n Scenario: Define product strategy\n Given a product exists in society\n And a Gherkin source describing the strategy\n When strategy is called on the product with a strategy id\n Then the strategy is stored as the product's information\n\n Scenario: Parameters\n Given the command is product.strategy\n Then product is required \u2014 the product's id\n And content is required \u2014 Gherkin Feature source for the strategy\n And id is required \u2014 strategy id\n\n Scenario: Writing the strategy Gherkin\n Given the strategy defines the product's direction\n Then the Feature title names the strategy\n And Scenarios describe positioning, target audience, and competitive approach\n And the tone is strategic \u2014 articulating where the product is headed and why\n",
|
|
2781
2649
|
survey: "Feature: survey \u2014 world-level overview\n List all entities in the world: individuals, organizations, positions.\n Works without an active role \u2014 a stateless world query.\n\n Scenario: Survey the world\n When survey is called without arguments\n Then all individuals, organizations, and positions are returned\n\n Scenario: Filter by type\n When survey is called with a type parameter\n Then only entities of that type are returned\n And valid types are individual, organization, position, past\n",
|
|
@@ -2845,7 +2713,6 @@ var processes = {
|
|
|
2845
2713
|
`,
|
|
2846
2714
|
unadmin: "Feature: unadmin \u2014 revoke organization administrator\n Revoke admin privileges from an individual within an organization.\n The individual remains a member but loses management capabilities.\n\n Scenario: Revoke admin\n Given an individual is an admin of an organization\n When unadmin is called with the organization and individual\n Then the individual loses admin privileges\n And the individual remains a member of the organization\n\n Scenario: Parameters\n Given the command is org.unadmin\n Then org is required \u2014 the organization's id\n And individual is required \u2014 the individual's id\n",
|
|
2847
2715
|
unmaintain: "Feature: unmaintain \u2014 remove project maintainer\n Remove maintainer role from an individual on a project.\n\n Scenario: Remove a maintainer\n Given an individual is a maintainer of a project\n When unmaintain is called with the project and individual\n Then the individual is no longer a maintainer of the project\n\n Scenario: Parameters\n Given the command is project.unmaintain\n Then project is required \u2014 the project's id\n And individual is required \u2014 the individual's id\n",
|
|
2848
|
-
use: 'Feature: use \u2014 act as the current role\n Execute commands and load resources as the active role.\n Use requires an active role \u2014 the role is the subject performing the action.\n For operations before activating a role, use the direct tool instead.\n\n Scenario: When to use "use" vs "direct"\n Given a role is activated \u2014 I am someone\n When I perform operations through use\n Then the operation happens in the context of my role\n And use is for role-level actions \u2014 acting in the world as myself\n\n Scenario: Execute a RoleX command\n Given the locator starts with `!`\n When use is called with the locator and named args\n Then the command is parsed as `namespace.method`\n And dispatched to the corresponding RoleX API\n\n Scenario: Load a ResourceX resource\n Given the locator does not start with `!`\n When use is called with the locator\n Then the locator is passed to ResourceX for resolution\n And the resource is loaded and returned\n',
|
|
2849
2716
|
want: 'Feature: want \u2014 declare a goal\n Declare a new goal for a role.\n A goal describes a desired outcome with Gherkin scenarios as success criteria.\n\n Scenario: Declare a goal\n Given an active role exists\n And a Gherkin source describing the desired outcome\n When want is called with the source\n Then a new goal node is created under the role\n And the goal becomes the current focus\n And subsequent plan and todo operations target this goal\n\n Scenario: Writing the goal Gherkin\n Given the goal describes a desired outcome \u2014 what success looks like\n Then the Feature title names the outcome in concrete terms\n And Scenarios define success criteria \u2014 each scenario is a testable condition\n And the tone is aspirational but specific \u2014 "users can log in" not "improve auth"\n',
|
|
2850
2717
|
wiki: "Feature: wiki \u2014 add a wiki entry to a project\n Add a wiki entry to a project.\n Wiki entries capture knowledge, documentation, and reference material for the project.\n\n Scenario: Add a wiki entry\n Given a project exists in society\n And a Gherkin source describing the wiki entry\n When wiki is called on the project with a wiki entry id\n Then the wiki entry is stored as the project's information\n\n Scenario: Parameters\n Given the command is project.wiki\n Then project is required \u2014 the project's id\n And content is required \u2014 Gherkin Feature source for the wiki entry\n And id is required \u2014 wiki entry id (keywords joined by hyphens)\n\n Scenario: Writing the wiki Gherkin\n Given the wiki entry captures project knowledge\n Then the Feature title names the topic\n And Scenarios describe key facts, decisions, or reference material\n And the tone is informational \u2014 documenting what is known\n"
|
|
2851
2718
|
};
|
|
@@ -2986,8 +2853,6 @@ var RoleXService = class _RoleXService {
|
|
|
2986
2853
|
rt;
|
|
2987
2854
|
commands;
|
|
2988
2855
|
project;
|
|
2989
|
-
resourcex;
|
|
2990
|
-
issuex;
|
|
2991
2856
|
repo;
|
|
2992
2857
|
initializer;
|
|
2993
2858
|
renderer;
|
|
@@ -3008,15 +2873,6 @@ var RoleXService = class _RoleXService {
|
|
|
3008
2873
|
this.initializer = platform.initializer;
|
|
3009
2874
|
this.prototypes = prototypes ?? [];
|
|
3010
2875
|
this.renderer = renderer;
|
|
3011
|
-
if (platform.resourcexProvider) {
|
|
3012
|
-
setProvider(platform.resourcexProvider);
|
|
3013
|
-
this.resourcex = createResourceX(
|
|
3014
|
-
platform.resourcexExecutor ? { isolator: "custom", executor: platform.resourcexExecutor } : void 0
|
|
3015
|
-
);
|
|
3016
|
-
}
|
|
3017
|
-
if (platform.issuexProvider) {
|
|
3018
|
-
this.issuex = createIssueX({ provider: platform.issuexProvider });
|
|
3019
|
-
}
|
|
3020
2876
|
}
|
|
3021
2877
|
static async create(platform, renderer, prototypes) {
|
|
3022
2878
|
const service = new _RoleXService(platform, renderer, prototypes);
|
|
@@ -3041,10 +2897,7 @@ var RoleXService = class _RoleXService {
|
|
|
3041
2897
|
},
|
|
3042
2898
|
find: (id) => this.find(id),
|
|
3043
2899
|
project: this.project,
|
|
3044
|
-
|
|
3045
|
-
issuex: this.issuex,
|
|
3046
|
-
prototype: this.repo.prototype,
|
|
3047
|
-
direct: (locator, args) => this.direct(locator, args, { raw: true })
|
|
2900
|
+
prototype: this.repo.prototype
|
|
3048
2901
|
});
|
|
3049
2902
|
await this.initializer?.bootstrap();
|
|
3050
2903
|
for (const proto of this.prototypes) {
|
|
@@ -3072,8 +2925,7 @@ var RoleXService = class _RoleXService {
|
|
|
3072
2925
|
const role = new Role(individual2, {
|
|
3073
2926
|
commands: this.commands,
|
|
3074
2927
|
renderer: this.renderer,
|
|
3075
|
-
onSave: (snapshot) => this.saveSnapshot(snapshot)
|
|
3076
|
-
direct: (locator, args) => this.direct(locator, args)
|
|
2928
|
+
onSave: (snapshot) => this.saveSnapshot(snapshot)
|
|
3077
2929
|
});
|
|
3078
2930
|
role.hydrate(state);
|
|
3079
2931
|
await this.restoreSnapshot(role);
|
|
@@ -3142,27 +2994,23 @@ var RoleXService = class _RoleXService {
|
|
|
3142
2994
|
// ================================================================
|
|
3143
2995
|
async direct(locator, args, options) {
|
|
3144
2996
|
const shouldRender = !options?.raw;
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
`Unknown command "${locator}".
|
|
2997
|
+
const command = locator.startsWith("!") ? locator.slice(1) : locator;
|
|
2998
|
+
const fn = this.commands[command];
|
|
2999
|
+
if (!fn) {
|
|
3000
|
+
const hint = directives["identity-ethics"]?.["on-unknown-command"] ?? "";
|
|
3001
|
+
throw new Error(
|
|
3002
|
+
`Unknown command "${locator}".
|
|
3152
3003
|
|
|
3153
3004
|
You may be guessing the command name. Load the relevant skill first with skill(locator) to learn the correct syntax.
|
|
3154
3005
|
|
|
3155
3006
|
` + hint
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
}
|
|
3162
|
-
return result;
|
|
3007
|
+
);
|
|
3008
|
+
}
|
|
3009
|
+
const result = await fn(...toArgs(command, args ?? {}));
|
|
3010
|
+
if (shouldRender && isCommandResult(result)) {
|
|
3011
|
+
return this.renderer.render(command, result);
|
|
3163
3012
|
}
|
|
3164
|
-
|
|
3165
|
-
return this.resourcex.ingest(locator, args);
|
|
3013
|
+
return result;
|
|
3166
3014
|
}
|
|
3167
3015
|
// ================================================================
|
|
3168
3016
|
// Internal helpers
|
|
@@ -3296,18 +3144,6 @@ function createIssueNamespace(call) {
|
|
|
3296
3144
|
unlabel: (p5) => call("issue.unlabel", p5)
|
|
3297
3145
|
};
|
|
3298
3146
|
}
|
|
3299
|
-
function createResourceNamespace(call) {
|
|
3300
|
-
return {
|
|
3301
|
-
add: (p5) => call("resource.add", p5),
|
|
3302
|
-
search: (p5) => call("resource.search", p5),
|
|
3303
|
-
has: (p5) => call("resource.has", p5),
|
|
3304
|
-
info: (p5) => call("resource.info", p5),
|
|
3305
|
-
remove: (p5) => call("resource.remove", p5),
|
|
3306
|
-
push: (p5) => call("resource.push", p5),
|
|
3307
|
-
pull: (p5) => call("resource.pull", p5),
|
|
3308
|
-
clearCache: (p5) => call("resource.clearCache", p5)
|
|
3309
|
-
};
|
|
3310
|
-
}
|
|
3311
3147
|
|
|
3312
3148
|
// src/tools.ts
|
|
3313
3149
|
var worldInstructions = Object.values(world).join("\n\n");
|
|
@@ -3521,34 +3357,7 @@ var tools = [
|
|
|
3521
3357
|
}
|
|
3522
3358
|
}
|
|
3523
3359
|
},
|
|
3524
|
-
|
|
3525
|
-
name: "skill",
|
|
3526
|
-
description: d("skill"),
|
|
3527
|
-
params: {
|
|
3528
|
-
locator: {
|
|
3529
|
-
type: "string",
|
|
3530
|
-
required: true,
|
|
3531
|
-
description: "ResourceX locator for the skill (e.g. deepractice/role-management)"
|
|
3532
|
-
}
|
|
3533
|
-
}
|
|
3534
|
-
},
|
|
3535
|
-
// --- Use / Direct ---
|
|
3536
|
-
{
|
|
3537
|
-
name: "use",
|
|
3538
|
-
description: d("use"),
|
|
3539
|
-
params: {
|
|
3540
|
-
command: {
|
|
3541
|
-
type: "string",
|
|
3542
|
-
required: true,
|
|
3543
|
-
description: "!namespace.method for RoleX commands, or a ResourceX locator for resources"
|
|
3544
|
-
},
|
|
3545
|
-
args: {
|
|
3546
|
-
type: "record",
|
|
3547
|
-
required: false,
|
|
3548
|
-
description: "Named arguments object for the command. Pass all parameters as key-value pairs in this object (e.g. id, content, org, individual). Must be a JSON object, not a string. Load the relevant skill first to learn what args to pass."
|
|
3549
|
-
}
|
|
3550
|
-
}
|
|
3551
|
-
},
|
|
3360
|
+
// --- Direct ---
|
|
3552
3361
|
{
|
|
3553
3362
|
name: "direct",
|
|
3554
3363
|
description: d("direct"),
|
|
@@ -3556,12 +3365,12 @@ var tools = [
|
|
|
3556
3365
|
command: {
|
|
3557
3366
|
type: "string",
|
|
3558
3367
|
required: true,
|
|
3559
|
-
description: "
|
|
3368
|
+
description: "namespace.method for RoleX commands (e.g. society.born, org.hire)"
|
|
3560
3369
|
},
|
|
3561
3370
|
args: {
|
|
3562
3371
|
type: "record",
|
|
3563
3372
|
required: false,
|
|
3564
|
-
description: "Named arguments object for the command. Pass all parameters as key-value pairs in this object (e.g. id, content,
|
|
3373
|
+
description: "Named arguments object for the command. Pass all parameters as key-value pairs in this object (e.g. id, content, org, individual). Must be a JSON object, not a string."
|
|
3565
3374
|
}
|
|
3566
3375
|
}
|
|
3567
3376
|
}
|
|
@@ -3622,7 +3431,6 @@ function createBuilder(config) {
|
|
|
3622
3431
|
const _project = createProjectNamespace(call);
|
|
3623
3432
|
const _product = createProductNamespace(call);
|
|
3624
3433
|
const _issue = createIssueNamespace(call);
|
|
3625
|
-
const _resource = createResourceNamespace(call);
|
|
3626
3434
|
return {
|
|
3627
3435
|
get society() {
|
|
3628
3436
|
return _society;
|
|
@@ -3645,9 +3453,6 @@ function createBuilder(config) {
|
|
|
3645
3453
|
get issue() {
|
|
3646
3454
|
return _issue;
|
|
3647
3455
|
},
|
|
3648
|
-
get resource() {
|
|
3649
|
-
return _resource;
|
|
3650
|
-
},
|
|
3651
3456
|
async inspect({ id, raw }) {
|
|
3652
3457
|
return call("inspect", { id, raw });
|
|
3653
3458
|
},
|
|
@@ -3704,6 +3509,7 @@ export {
|
|
|
3704
3509
|
charge,
|
|
3705
3510
|
charter,
|
|
3706
3511
|
charterOrg,
|
|
3512
|
+
comment,
|
|
3707
3513
|
complete,
|
|
3708
3514
|
create6 as create,
|
|
3709
3515
|
createBuilder,
|
|
@@ -3731,6 +3537,7 @@ export {
|
|
|
3731
3537
|
identity,
|
|
3732
3538
|
individual,
|
|
3733
3539
|
instructions,
|
|
3540
|
+
issue,
|
|
3734
3541
|
launch,
|
|
3735
3542
|
link4 as link,
|
|
3736
3543
|
master,
|