@rolexjs/core 1.5.0-dev-20260310014736 → 1.5.0-dev-20260310024101

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.js CHANGED
@@ -650,11 +650,39 @@ async function applyPrototype(data, repo, direct) {
650
650
  };
651
651
  }
652
652
 
653
- // src/commands.ts
653
+ // src/commands/census.ts
654
+ function censusCommands(ctx, _helpers) {
655
+ const { past: past2, project: project2 } = ctx;
656
+ const societyNode = ctx.society;
657
+ return {
658
+ async "census.list"(type) {
659
+ const target = type === "past" ? past2 : societyNode;
660
+ const state = await project2(target);
661
+ const children = state.children ?? [];
662
+ const filtered = type === "past" ? children : children.filter((c) => type ? c.name === type : c.name !== "past");
663
+ return { state: { ...state, children: filtered }, process: "list" };
664
+ }
665
+ };
666
+ }
667
+
668
+ // src/commands/helpers.ts
654
669
  import { parse } from "@rolexjs/parser";
655
670
  import { structure as structure2 } from "@rolexjs/system";
656
- function createCommands(ctx) {
657
- const { rt, society: society2, past: past2, resolve, project: project2, resourcex, issuex } = ctx;
671
+ function findInState(state, target) {
672
+ if (state.id && state.id.toLowerCase() === target) return state;
673
+ if (state.alias) {
674
+ for (const a of state.alias) {
675
+ if (a.toLowerCase() === target) return state;
676
+ }
677
+ }
678
+ for (const child of state.children ?? []) {
679
+ const found2 = findInState(child, target);
680
+ if (found2) return found2;
681
+ }
682
+ return null;
683
+ }
684
+ function createHelpers(ctx) {
685
+ const { rt, project: project2, resourcex, issuex } = ctx;
658
686
  async function ok(node, process8) {
659
687
  return { state: await project2(node), process: process8 };
660
688
  }
@@ -671,22 +699,9 @@ function createCommands(ctx) {
671
699
  throw new Error(`Invalid Gherkin: ${e.message}`);
672
700
  }
673
701
  }
674
- function findInState2(state, target) {
675
- if (state.id && state.id.toLowerCase() === target) return state;
676
- if (state.alias) {
677
- for (const a of state.alias) {
678
- if (a.toLowerCase() === target) return state;
679
- }
680
- }
681
- for (const child of state.children ?? []) {
682
- const found2 = findInState2(child, target);
683
- if (found2) return found2;
684
- }
685
- return null;
686
- }
687
702
  async function removeExisting(parent, id) {
688
703
  const state = await rt.project(parent);
689
- const existing = findInState2(state, id);
704
+ const existing = findInState(state, id);
690
705
  if (existing) await rt.remove(existing);
691
706
  }
692
707
  function requireResourceX() {
@@ -697,165 +712,176 @@ function createCommands(ctx) {
697
712
  if (!issuex) throw new Error("IssueX is not available.");
698
713
  return issuex;
699
714
  }
715
+ return { ok, archive: archive2, validateGherkin, removeExisting, requireResourceX, requireIssueX };
716
+ }
717
+
718
+ // src/commands/issue.ts
719
+ function issueCommands(_ctx, helpers) {
720
+ const { requireIssueX } = helpers;
700
721
  return {
701
- // ---- Society: individual lifecycle ----
702
- async "society.born"(content, id, alias) {
703
- validateGherkin(content);
704
- const node = await rt.create(society2, individual, content, id, alias);
705
- await rt.create(node, identity, void 0, `${id}-identity`);
706
- return ok(node, "born");
707
- },
708
- async "society.retire"(individual2) {
709
- return archive2(await resolve(individual2), "retire");
710
- },
711
- async "society.die"(individual2) {
712
- return archive2(await resolve(individual2), "die");
713
- },
714
- async "society.rehire"(pastNode) {
715
- const node = await resolve(pastNode);
716
- const ind = await rt.transform(node, individual);
717
- return ok(ind, "rehire");
718
- },
719
- // ---- Society: external injection ----
720
- async "society.teach"(individual2, principle2, id) {
721
- validateGherkin(principle2);
722
- const parent = await resolve(individual2);
723
- if (id) await removeExisting(parent, id);
724
- const node = await rt.create(parent, principle, principle2, id);
725
- return ok(node, "teach");
722
+ async "issue.publish"(title, body, author, assignee) {
723
+ const ix = requireIssueX();
724
+ return ix.createIssue({ title, body, author, assignee });
726
725
  },
727
- async "society.train"(individual2, procedure2, id) {
728
- validateGherkin(procedure2);
729
- const parent = await resolve(individual2);
730
- if (id) await removeExisting(parent, id);
731
- const node = await rt.create(parent, procedure, procedure2, id);
732
- return ok(node, "train");
726
+ async "issue.get"(number) {
727
+ return requireIssueX().getIssueByNumber(number);
733
728
  },
734
- // ---- Role: focus ----
735
- async "role.focus"(goal2) {
736
- return ok(await resolve(goal2), "focus");
729
+ async "issue.list"(status, author, assignee, label) {
730
+ const filter = {};
731
+ if (status) filter.status = status;
732
+ if (author) filter.author = author;
733
+ if (assignee) filter.assignee = assignee;
734
+ if (label) filter.label = label;
735
+ return requireIssueX().listIssues(
736
+ Object.keys(filter).length > 0 ? filter : void 0
737
+ );
737
738
  },
738
- // ---- Role: execution ----
739
- async "role.want"(individual2, goal2, id, alias) {
740
- validateGherkin(goal2);
741
- const node = await rt.create(await resolve(individual2), goal, goal2, id, alias);
742
- return ok(node, "want");
739
+ async "issue.update"(number, title, body, assignee) {
740
+ const ix = requireIssueX();
741
+ const issue = await ix.getIssueByNumber(number);
742
+ if (!issue) throw new Error(`Issue #${number} not found.`);
743
+ const patch = {};
744
+ if (title !== void 0) patch.title = title;
745
+ if (body !== void 0) patch.body = body;
746
+ if (assignee !== void 0) patch.assignee = assignee;
747
+ return ix.updateIssue(issue.id, patch);
743
748
  },
744
- async "role.plan"(goal2, plan2, id, after, fallback) {
745
- validateGherkin(plan2);
746
- const node = await rt.create(await resolve(goal2), plan, plan2, id);
747
- if (after) await rt.link(node, await resolve(after), "after", "before");
748
- if (fallback) await rt.link(node, await resolve(fallback), "fallback-for", "fallback");
749
- return ok(node, "plan");
749
+ async "issue.close"(number) {
750
+ const ix = requireIssueX();
751
+ const issue = await ix.getIssueByNumber(number);
752
+ if (!issue) throw new Error(`Issue #${number} not found.`);
753
+ return ix.closeIssue(issue.id);
750
754
  },
751
- async "role.todo"(plan2, task2, id, alias) {
752
- validateGherkin(task2);
753
- const node = await rt.create(await resolve(plan2), task, task2, id, alias);
754
- return ok(node, "todo");
755
+ async "issue.reopen"(number) {
756
+ const ix = requireIssueX();
757
+ const issue = await ix.getIssueByNumber(number);
758
+ if (!issue) throw new Error(`Issue #${number} not found.`);
759
+ return ix.reopenIssue(issue.id);
755
760
  },
756
- async "role.finish"(task2, individual2, encounter2) {
757
- validateGherkin(encounter2);
758
- const taskNode = await resolve(task2);
759
- await rt.tag(taskNode, "done");
760
- if (encounter2) {
761
- const encId = taskNode.id ? `${taskNode.id}-finished` : void 0;
762
- const enc = await rt.create(await resolve(individual2), encounter, encounter2, encId);
763
- return ok(enc, "finish");
764
- }
765
- return ok(taskNode, "finish");
761
+ async "issue.assign"(number, assignee) {
762
+ const ix = requireIssueX();
763
+ const issue = await ix.getIssueByNumber(number);
764
+ if (!issue) throw new Error(`Issue #${number} not found.`);
765
+ return ix.updateIssue(issue.id, { assignee });
766
766
  },
767
- async "role.complete"(plan2, individual2, encounter2) {
768
- validateGherkin(encounter2);
769
- const planNode = await resolve(plan2);
770
- await rt.tag(planNode, "done");
771
- const encId = planNode.id ? `${planNode.id}-completed` : void 0;
772
- const enc = await rt.create(await resolve(individual2), encounter, encounter2, encId);
773
- return ok(enc, "complete");
767
+ async "issue.comment"(number, body, author) {
768
+ const ix = requireIssueX();
769
+ const issue = await ix.getIssueByNumber(number);
770
+ if (!issue) throw new Error(`Issue #${number} not found.`);
771
+ return ix.createComment(issue.id, body, author);
774
772
  },
775
- async "role.abandon"(plan2, individual2, encounter2) {
776
- validateGherkin(encounter2);
777
- const planNode = await resolve(plan2);
778
- await rt.tag(planNode, "abandoned");
779
- const encId = planNode.id ? `${planNode.id}-abandoned` : void 0;
780
- const enc = await rt.create(await resolve(individual2), encounter, encounter2, encId);
781
- return ok(enc, "abandon");
773
+ async "issue.comments"(number) {
774
+ const ix = requireIssueX();
775
+ const issue = await ix.getIssueByNumber(number);
776
+ if (!issue) throw new Error(`Issue #${number} not found.`);
777
+ return ix.listComments(issue.id);
782
778
  },
783
- // ---- Role: cognition ----
784
- async "role.reflect"(encounter2, individual2, experience2, id) {
785
- validateGherkin(experience2);
786
- if (encounter2) {
787
- const encNode = await resolve(encounter2);
788
- const exp2 = await rt.create(
789
- await resolve(individual2),
790
- experience,
791
- experience2 || encNode.information,
792
- id
793
- );
794
- await rt.remove(encNode);
795
- return ok(exp2, "reflect");
796
- }
797
- const exp = await rt.create(await resolve(individual2), experience, experience2, id);
798
- return ok(exp, "reflect");
779
+ async "issue.label"(number, label) {
780
+ const ix = requireIssueX();
781
+ const issue = await ix.getIssueByNumber(number);
782
+ if (!issue) throw new Error(`Issue #${number} not found.`);
783
+ let labelObj = await ix.getLabelByName(label);
784
+ if (!labelObj) labelObj = await ix.createLabel({ name: label });
785
+ await ix.addLabel(issue.id, labelObj.id);
786
+ return ix.getIssueByNumber(number);
799
787
  },
800
- async "role.realize"(experience2, individual2, principle2, id) {
801
- validateGherkin(principle2);
802
- if (experience2) {
803
- const expNode = await resolve(experience2);
804
- const prin2 = await rt.create(
805
- await resolve(individual2),
806
- principle,
807
- principle2 || expNode.information,
808
- id
809
- );
810
- await rt.remove(expNode);
811
- return ok(prin2, "realize");
812
- }
813
- const prin = await rt.create(await resolve(individual2), principle, principle2, id);
814
- return ok(prin, "realize");
788
+ async "issue.unlabel"(number, label) {
789
+ const ix = requireIssueX();
790
+ const issue = await ix.getIssueByNumber(number);
791
+ if (!issue) throw new Error(`Issue #${number} not found.`);
792
+ const labelObj = await ix.getLabelByName(label);
793
+ if (!labelObj) throw new Error(`Label "${label}" not found.`);
794
+ await ix.removeLabel(issue.id, labelObj.id);
795
+ return ix.getIssueByNumber(number);
796
+ }
797
+ };
798
+ }
799
+
800
+ // src/commands/position.ts
801
+ function positionCommands(ctx, helpers) {
802
+ const { rt, resolve } = ctx;
803
+ const { ok, validateGherkin, removeExisting } = helpers;
804
+ return {
805
+ async "position.charge"(position2, duty2, id) {
806
+ validateGherkin(duty2);
807
+ const node = await rt.create(await resolve(position2), duty, duty2, id);
808
+ return ok(node, "charge");
815
809
  },
816
- async "role.master"(individual2, procedure2, id, experience2) {
810
+ async "position.require"(position2, procedure2, id) {
817
811
  validateGherkin(procedure2);
818
- const parent = await resolve(individual2);
812
+ const parent = await resolve(position2);
819
813
  if (id) await removeExisting(parent, id);
820
- const proc = await rt.create(parent, procedure, procedure2, id);
821
- if (experience2) await rt.remove(await resolve(experience2));
822
- return ok(proc, "master");
814
+ const node = await rt.create(parent, requirement, procedure2, id);
815
+ return ok(node, "require");
823
816
  },
824
- // ---- Role: knowledge management ----
825
- async "role.forget"(nodeId) {
826
- const node = await resolve(nodeId);
827
- await rt.remove(node);
828
- return { state: { ...node, children: [] }, process: "forget" };
817
+ async "position.appoint"(position2, individual2) {
818
+ const posNode = await resolve(position2);
819
+ const indNode = await resolve(individual2);
820
+ await rt.link(posNode, indNode, "appointment", "serve");
821
+ return ok(posNode, "appoint");
829
822
  },
830
- // ---- Role: skill ----
831
- async "role.skill"(locator) {
832
- const rx = requireResourceX();
833
- const content = await rx.ingest(locator);
834
- const text = typeof content === "string" ? content : JSON.stringify(content, null, 2);
835
- try {
836
- const rxm = await rx.info(locator);
837
- return `${formatRXM(rxm)}
823
+ async "position.dismiss"(position2, individual2) {
824
+ const posNode = await resolve(position2);
825
+ await rt.unlink(posNode, await resolve(individual2), "appointment", "serve");
826
+ return ok(posNode, "dismiss");
827
+ }
828
+ };
829
+ }
838
830
 
839
- ${text}`;
840
- } catch {
841
- return text;
842
- }
831
+ // src/commands/product.ts
832
+ function productCommands(ctx, helpers) {
833
+ const { rt, resolve } = ctx;
834
+ const { ok, archive: archive2, validateGherkin } = helpers;
835
+ return {
836
+ async "product.strategy"(product2, strategy2, id) {
837
+ validateGherkin(strategy2);
838
+ const node = await rt.create(await resolve(product2), strategy, strategy2, id);
839
+ return ok(node, "strategy");
843
840
  },
844
- // ---- Project ----
845
- async "project.launch"(content, id, alias, org) {
846
- validateGherkin(content);
847
- const node = await rt.create(society2, project, content, id, alias);
848
- if (org) await rt.link(node, await resolve(org), "ownership", "project");
849
- return ok(node, "launch");
841
+ async "product.spec"(product2, spec2, id) {
842
+ validateGherkin(spec2);
843
+ const node = await rt.create(await resolve(product2), spec, spec2, id);
844
+ return ok(node, "spec");
850
845
  },
851
- async "project.scope"(project3, scope2, id) {
852
- validateGherkin(scope2);
853
- const node = await rt.create(await resolve(project3), scope, scope2, id);
854
- return ok(node, "scope");
846
+ async "product.release"(product2, release2, id) {
847
+ validateGherkin(release2);
848
+ const node = await rt.create(await resolve(product2), release, release2, id);
849
+ return ok(node, "release");
855
850
  },
856
- async "project.milestone"(project3, milestone2, id) {
851
+ async "product.channel"(product2, channel2, id) {
852
+ validateGherkin(channel2);
853
+ const node = await rt.create(await resolve(product2), channel, channel2, id);
854
+ return ok(node, "channel");
855
+ },
856
+ async "product.own"(product2, individual2) {
857
+ const prodNode = await resolve(product2);
858
+ await rt.link(prodNode, await resolve(individual2), "ownership", "own");
859
+ return ok(prodNode, "own");
860
+ },
861
+ async "product.disown"(product2, individual2) {
862
+ const prodNode = await resolve(product2);
863
+ await rt.unlink(prodNode, await resolve(individual2), "ownership", "own");
864
+ return ok(prodNode, "disown");
865
+ },
866
+ async "product.deprecate"(product2) {
867
+ return archive2(await resolve(product2), "deprecate");
868
+ }
869
+ };
870
+ }
871
+
872
+ // src/commands/project.ts
873
+ function projectCommands(ctx, helpers) {
874
+ const { rt, society: society2, resolve } = ctx;
875
+ const { ok, validateGherkin } = helpers;
876
+ return {
877
+ async "project.scope"(project2, scope2, id) {
878
+ validateGherkin(scope2);
879
+ const node = await rt.create(await resolve(project2), scope, scope2, id);
880
+ return ok(node, "scope");
881
+ },
882
+ async "project.milestone"(project2, milestone2, id) {
857
883
  validateGherkin(milestone2);
858
- const node = await rt.create(await resolve(project3), milestone, milestone2, id);
884
+ const node = await rt.create(await resolve(project2), milestone, milestone2, id);
859
885
  return ok(node, "milestone");
860
886
  },
861
887
  async "project.achieve"(milestone2) {
@@ -863,168 +889,52 @@ ${text}`;
863
889
  await rt.tag(node, "done");
864
890
  return ok(node, "achieve");
865
891
  },
866
- async "project.enroll"(project3, individual2) {
867
- const projNode = await resolve(project3);
892
+ async "project.enroll"(project2, individual2) {
893
+ const projNode = await resolve(project2);
868
894
  await rt.link(projNode, await resolve(individual2), "participation", "participate");
869
895
  return ok(projNode, "enroll");
870
896
  },
871
- async "project.remove"(project3, individual2) {
872
- const projNode = await resolve(project3);
897
+ async "project.remove"(project2, individual2) {
898
+ const projNode = await resolve(project2);
873
899
  await rt.unlink(projNode, await resolve(individual2), "participation", "participate");
874
900
  return ok(projNode, "remove");
875
901
  },
876
- async "project.deliver"(project3, deliverable2, id) {
902
+ async "project.deliver"(project2, deliverable2, id) {
877
903
  validateGherkin(deliverable2);
878
- const node = await rt.create(await resolve(project3), deliverable, deliverable2, id);
904
+ const node = await rt.create(await resolve(project2), deliverable, deliverable2, id);
879
905
  return ok(node, "deliver");
880
906
  },
881
- async "project.wiki"(project3, wiki2, id) {
907
+ async "project.wiki"(project2, wiki2, id) {
882
908
  validateGherkin(wiki2);
883
- const node = await rt.create(await resolve(project3), wiki, wiki2, id);
909
+ const node = await rt.create(await resolve(project2), wiki, wiki2, id);
884
910
  return ok(node, "wiki");
885
911
  },
886
- async "project.archive"(project3) {
887
- return archive2(await resolve(project3), "archive");
888
- },
889
- async "project.produce"(project3, content, id, alias) {
912
+ async "project.produce"(project2, content, id, alias, owner) {
890
913
  validateGherkin(content);
891
- const projNode = await resolve(project3);
914
+ const projNode = await resolve(project2);
892
915
  const node = await rt.create(society2, product, content, id, alias);
893
916
  await rt.link(projNode, node, "production", "produce");
894
917
  await rt.link(node, projNode, "origin", "produced-by");
918
+ if (owner) await rt.link(node, await resolve(owner), "ownership", "own");
895
919
  return ok(node, "produce");
896
920
  },
897
- async "project.maintain"(project3, individual2) {
898
- const projNode = await resolve(project3);
921
+ async "project.maintain"(project2, individual2) {
922
+ const projNode = await resolve(project2);
899
923
  await rt.link(projNode, await resolve(individual2), "maintain", "maintained-by");
900
924
  return ok(projNode, "maintain");
901
925
  },
902
- async "project.unmaintain"(project3, individual2) {
903
- const projNode = await resolve(project3);
926
+ async "project.unmaintain"(project2, individual2) {
927
+ const projNode = await resolve(project2);
904
928
  await rt.unlink(projNode, await resolve(individual2), "maintain", "maintained-by");
905
929
  return ok(projNode, "unmaintain");
906
- },
907
- // ---- Product ----
908
- async "product.strategy"(product2, strategy2, id) {
909
- validateGherkin(strategy2);
910
- const node = await rt.create(await resolve(product2), strategy, strategy2, id);
911
- return ok(node, "strategy");
912
- },
913
- async "product.spec"(product2, spec2, id) {
914
- validateGherkin(spec2);
915
- const node = await rt.create(await resolve(product2), spec, spec2, id);
916
- return ok(node, "spec");
917
- },
918
- async "product.release"(product2, release2, id) {
919
- validateGherkin(release2);
920
- const node = await rt.create(await resolve(product2), release, release2, id);
921
- return ok(node, "release");
922
- },
923
- async "product.channel"(product2, channel2, id) {
924
- validateGherkin(channel2);
925
- const node = await rt.create(await resolve(product2), channel, channel2, id);
926
- return ok(node, "channel");
927
- },
928
- async "product.own"(product2, individual2) {
929
- const prodNode = await resolve(product2);
930
- await rt.link(prodNode, await resolve(individual2), "ownership", "own");
931
- return ok(prodNode, "own");
932
- },
933
- async "product.disown"(product2, individual2) {
934
- const prodNode = await resolve(product2);
935
- await rt.unlink(prodNode, await resolve(individual2), "ownership", "own");
936
- return ok(prodNode, "disown");
937
- },
938
- async "product.deprecate"(product2) {
939
- return archive2(await resolve(product2), "deprecate");
940
- },
941
- // ---- Society: organization lifecycle ----
942
- async "society.found"(content, id, alias) {
943
- validateGherkin(content);
944
- const node = await rt.create(society2, organization, content, id, alias);
945
- return ok(node, "found");
946
- },
947
- async "society.dissolve"(org) {
948
- return archive2(await resolve(org), "dissolve");
949
- },
950
- // ---- Org ----
951
- async "org.charter"(org, charter2, id) {
952
- validateGherkin(charter2);
953
- const node = await rt.create(await resolve(org), charter, charter2, id);
954
- return ok(node, "charter");
955
- },
956
- async "org.hire"(org, individual2) {
957
- const orgNode = await resolve(org);
958
- await rt.link(orgNode, await resolve(individual2), "membership", "belong");
959
- return ok(orgNode, "hire");
960
- },
961
- async "org.fire"(org, individual2) {
962
- const orgNode = await resolve(org);
963
- await rt.unlink(orgNode, await resolve(individual2), "membership", "belong");
964
- return ok(orgNode, "fire");
965
- },
966
- async "org.admin"(org, individual2) {
967
- const orgNode = await resolve(org);
968
- await rt.link(orgNode, await resolve(individual2), "admin", "administer");
969
- return ok(orgNode, "admin");
970
- },
971
- async "org.unadmin"(org, individual2) {
972
- const orgNode = await resolve(org);
973
- await rt.unlink(orgNode, await resolve(individual2), "admin", "administer");
974
- return ok(orgNode, "unadmin");
975
- },
976
- // ---- Position ----
977
- async "position.establish"(content, id, alias) {
978
- validateGherkin(content);
979
- const node = await rt.create(society2, position, content, id, alias);
980
- return ok(node, "establish");
981
- },
982
- async "position.charge"(position2, duty2, id) {
983
- validateGherkin(duty2);
984
- const node = await rt.create(await resolve(position2), duty, duty2, id);
985
- return ok(node, "charge");
986
- },
987
- async "position.require"(position2, procedure2, id) {
988
- validateGherkin(procedure2);
989
- const parent = await resolve(position2);
990
- if (id) await removeExisting(parent, id);
991
- const node = await rt.create(parent, requirement, procedure2, id);
992
- return ok(node, "require");
993
- },
994
- async "position.abolish"(position2) {
995
- return archive2(await resolve(position2), "abolish");
996
- },
997
- async "position.appoint"(position2, individual2) {
998
- const posNode = await resolve(position2);
999
- const indNode = await resolve(individual2);
1000
- await rt.link(posNode, indNode, "appointment", "serve");
1001
- return ok(posNode, "appoint");
1002
- },
1003
- async "position.dismiss"(position2, individual2) {
1004
- const posNode = await resolve(position2);
1005
- await rt.unlink(posNode, await resolve(individual2), "appointment", "serve");
1006
- return ok(posNode, "dismiss");
1007
- },
1008
- // ---- Society ----
1009
- async "society.crown"(individual2) {
1010
- const indNode = await resolve(individual2);
1011
- await rt.link(society2, indNode, "crown", "crowned");
1012
- return ok(indNode, "crown");
1013
- },
1014
- async "society.uncrown"(individual2) {
1015
- const indNode = await resolve(individual2);
1016
- await rt.unlink(society2, indNode, "crown", "crowned");
1017
- return ok(indNode, "uncrown");
1018
- },
1019
- // ---- Census ----
1020
- async "census.list"(type) {
1021
- const target = type === "past" ? past2 : society2;
1022
- const state = await project2(target);
1023
- const children = state.children ?? [];
1024
- const filtered = type === "past" ? children : children.filter((c) => type ? c.name === type : c.name !== "past");
1025
- return { state: { ...state, children: filtered }, process: "list" };
1026
- },
1027
- // ---- Resource (proxy to ResourceX) ----
930
+ }
931
+ };
932
+ }
933
+
934
+ // src/commands/resource.ts
935
+ function resourceCommands(_ctx, helpers) {
936
+ const { requireResourceX } = helpers;
937
+ return {
1028
938
  "resource.add"(path) {
1029
939
  return requireResourceX().add(path);
1030
940
  },
@@ -1048,85 +958,11 @@ ${text}`;
1048
958
  },
1049
959
  "resource.clearCache"(registry) {
1050
960
  return requireResourceX().clearCache(registry);
1051
- },
1052
- // ---- Issue (proxy to IssueX) ----
1053
- async "issue.publish"(title, body, author, assignee) {
1054
- const ix = requireIssueX();
1055
- return ix.createIssue({ title, body, author, assignee });
1056
- },
1057
- async "issue.get"(number) {
1058
- return requireIssueX().getIssueByNumber(number);
1059
- },
1060
- async "issue.list"(status, author, assignee, label) {
1061
- const filter = {};
1062
- if (status) filter.status = status;
1063
- if (author) filter.author = author;
1064
- if (assignee) filter.assignee = assignee;
1065
- if (label) filter.label = label;
1066
- return requireIssueX().listIssues(
1067
- Object.keys(filter).length > 0 ? filter : void 0
1068
- );
1069
- },
1070
- async "issue.update"(number, title, body, assignee) {
1071
- const ix = requireIssueX();
1072
- const issue = await ix.getIssueByNumber(number);
1073
- if (!issue) throw new Error(`Issue #${number} not found.`);
1074
- const patch = {};
1075
- if (title !== void 0) patch.title = title;
1076
- if (body !== void 0) patch.body = body;
1077
- if (assignee !== void 0) patch.assignee = assignee;
1078
- return ix.updateIssue(issue.id, patch);
1079
- },
1080
- async "issue.close"(number) {
1081
- const ix = requireIssueX();
1082
- const issue = await ix.getIssueByNumber(number);
1083
- if (!issue) throw new Error(`Issue #${number} not found.`);
1084
- return ix.closeIssue(issue.id);
1085
- },
1086
- async "issue.reopen"(number) {
1087
- const ix = requireIssueX();
1088
- const issue = await ix.getIssueByNumber(number);
1089
- if (!issue) throw new Error(`Issue #${number} not found.`);
1090
- return ix.reopenIssue(issue.id);
1091
- },
1092
- async "issue.assign"(number, assignee) {
1093
- const ix = requireIssueX();
1094
- const issue = await ix.getIssueByNumber(number);
1095
- if (!issue) throw new Error(`Issue #${number} not found.`);
1096
- return ix.updateIssue(issue.id, { assignee });
1097
- },
1098
- async "issue.comment"(number, body, author) {
1099
- const ix = requireIssueX();
1100
- const issue = await ix.getIssueByNumber(number);
1101
- if (!issue) throw new Error(`Issue #${number} not found.`);
1102
- return ix.createComment(issue.id, body, author);
1103
- },
1104
- async "issue.comments"(number) {
1105
- const ix = requireIssueX();
1106
- const issue = await ix.getIssueByNumber(number);
1107
- if (!issue) throw new Error(`Issue #${number} not found.`);
1108
- return ix.listComments(issue.id);
1109
- },
1110
- async "issue.label"(number, label) {
1111
- const ix = requireIssueX();
1112
- const issue = await ix.getIssueByNumber(number);
1113
- if (!issue) throw new Error(`Issue #${number} not found.`);
1114
- let labelObj = await ix.getLabelByName(label);
1115
- if (!labelObj) labelObj = await ix.createLabel({ name: label });
1116
- await ix.addLabel(issue.id, labelObj.id);
1117
- return ix.getIssueByNumber(number);
1118
- },
1119
- async "issue.unlabel"(number, label) {
1120
- const ix = requireIssueX();
1121
- const issue = await ix.getIssueByNumber(number);
1122
- if (!issue) throw new Error(`Issue #${number} not found.`);
1123
- const labelObj = await ix.getLabelByName(label);
1124
- if (!labelObj) throw new Error(`Label "${label}" not found.`);
1125
- await ix.removeLabel(issue.id, labelObj.id);
1126
- return ix.getIssueByNumber(number);
1127
961
  }
1128
962
  };
1129
963
  }
964
+
965
+ // src/commands/role.ts
1130
966
  function formatRXM(rxm) {
1131
967
  const lines = [`--- RXM: ${rxm.locator} ---`];
1132
968
  const def2 = rxm.definition;
@@ -1155,678 +991,1116 @@ function renderFileTree(files, indent = "") {
1155
991
  }
1156
992
  return lines.filter(Boolean).join("\n");
1157
993
  }
1158
-
1159
- // src/directives/index.ts
1160
- var directives = {
1161
- "identity-ethics": {
1162
- "on-unknown-command": "STOP. Do not guess another command name. Do not search source code for commands.\nCheck your procedures \u2014 if one covers this task, call skill(locator) to load it first.\nThe skill will tell you the correct command name and arguments.\nIf no procedure covers this task, it is outside your duties. Tell the user and suggest Nuwa.",
1163
- "on-activate": "Your duties define the COMPLETE scope of what you do. Everything else is forbidden.\nWhen a request falls outside your duties, you MUST refuse. This is not optional.\nDo not attempt to discover commands outside your skills. Do not read source code to find them.\nSuggest Nuwa for anything outside your scope."
1164
- }
1165
- };
1166
-
1167
- // src/instructions.ts
1168
- function def(namespace, method, params, args) {
1169
- return { namespace, method, params, args };
1170
- }
1171
- var societyBorn = def(
1172
- "society",
1173
- "born",
994
+ function roleCommands(ctx, helpers) {
995
+ const { rt, resolve } = ctx;
996
+ const { ok, validateGherkin, removeExisting, requireResourceX } = helpers;
997
+ return {
998
+ // ---- Role: focus ----
999
+ async "role.focus"(goal2) {
1000
+ return ok(await resolve(goal2), "focus");
1001
+ },
1002
+ // ---- Role: execution ----
1003
+ async "role.want"(individual2, goal2, id, alias) {
1004
+ validateGherkin(goal2);
1005
+ const node = await rt.create(await resolve(individual2), goal, goal2, id, alias);
1006
+ return ok(node, "want");
1007
+ },
1008
+ async "role.plan"(goal2, plan2, id, after, fallback) {
1009
+ validateGherkin(plan2);
1010
+ const node = await rt.create(await resolve(goal2), plan, plan2, id);
1011
+ if (after) await rt.link(node, await resolve(after), "after", "before");
1012
+ if (fallback) await rt.link(node, await resolve(fallback), "fallback-for", "fallback");
1013
+ return ok(node, "plan");
1014
+ },
1015
+ async "role.todo"(plan2, task2, id, alias) {
1016
+ validateGherkin(task2);
1017
+ const node = await rt.create(await resolve(plan2), task, task2, id, alias);
1018
+ return ok(node, "todo");
1019
+ },
1020
+ async "role.finish"(task2, individual2, encounter2) {
1021
+ validateGherkin(encounter2);
1022
+ const taskNode = await resolve(task2);
1023
+ await rt.tag(taskNode, "done");
1024
+ if (encounter2) {
1025
+ const encId = taskNode.id ? `${taskNode.id}-finished` : void 0;
1026
+ const enc = await rt.create(await resolve(individual2), encounter, encounter2, encId);
1027
+ return ok(enc, "finish");
1028
+ }
1029
+ return ok(taskNode, "finish");
1030
+ },
1031
+ async "role.complete"(plan2, individual2, encounter2) {
1032
+ validateGherkin(encounter2);
1033
+ const planNode = await resolve(plan2);
1034
+ await rt.tag(planNode, "done");
1035
+ const encId = planNode.id ? `${planNode.id}-completed` : void 0;
1036
+ const enc = await rt.create(await resolve(individual2), encounter, encounter2, encId);
1037
+ return ok(enc, "complete");
1038
+ },
1039
+ async "role.abandon"(plan2, individual2, encounter2) {
1040
+ validateGherkin(encounter2);
1041
+ const planNode = await resolve(plan2);
1042
+ await rt.tag(planNode, "abandoned");
1043
+ const encId = planNode.id ? `${planNode.id}-abandoned` : void 0;
1044
+ const enc = await rt.create(await resolve(individual2), encounter, encounter2, encId);
1045
+ return ok(enc, "abandon");
1046
+ },
1047
+ // ---- Role: cognition ----
1048
+ async "role.reflect"(encounter2, individual2, experience2, id) {
1049
+ validateGherkin(experience2);
1050
+ if (encounter2) {
1051
+ const encNode = await resolve(encounter2);
1052
+ const exp2 = await rt.create(
1053
+ await resolve(individual2),
1054
+ experience,
1055
+ experience2 || encNode.information,
1056
+ id
1057
+ );
1058
+ await rt.remove(encNode);
1059
+ return ok(exp2, "reflect");
1060
+ }
1061
+ const exp = await rt.create(await resolve(individual2), experience, experience2, id);
1062
+ return ok(exp, "reflect");
1063
+ },
1064
+ async "role.realize"(experience2, individual2, principle2, id) {
1065
+ validateGherkin(principle2);
1066
+ if (experience2) {
1067
+ const expNode = await resolve(experience2);
1068
+ const prin2 = await rt.create(
1069
+ await resolve(individual2),
1070
+ principle,
1071
+ principle2 || expNode.information,
1072
+ id
1073
+ );
1074
+ await rt.remove(expNode);
1075
+ return ok(prin2, "realize");
1076
+ }
1077
+ const prin = await rt.create(await resolve(individual2), principle, principle2, id);
1078
+ return ok(prin, "realize");
1079
+ },
1080
+ async "role.master"(individual2, procedure2, id, experience2) {
1081
+ validateGherkin(procedure2);
1082
+ const parent = await resolve(individual2);
1083
+ if (id) await removeExisting(parent, id);
1084
+ const proc = await rt.create(parent, procedure, procedure2, id);
1085
+ if (experience2) await rt.remove(await resolve(experience2));
1086
+ return ok(proc, "master");
1087
+ },
1088
+ // ---- Role: knowledge management ----
1089
+ async "role.forget"(nodeId) {
1090
+ const node = await resolve(nodeId);
1091
+ await rt.remove(node);
1092
+ return { state: { ...node, children: [] }, process: "forget" };
1093
+ },
1094
+ // ---- Role: skill ----
1095
+ async "role.skill"(locator) {
1096
+ const rx = requireResourceX();
1097
+ const content = await rx.ingest(locator);
1098
+ const text = typeof content === "string" ? content : JSON.stringify(content, null, 2);
1099
+ try {
1100
+ const rxm = await rx.info(locator);
1101
+ return `${formatRXM(rxm)}
1102
+
1103
+ ${text}`;
1104
+ } catch {
1105
+ return text;
1106
+ }
1107
+ }
1108
+ };
1109
+ }
1110
+
1111
+ // src/commands/society.ts
1112
+ function societyCommands(ctx, helpers) {
1113
+ const { rt, society: society2, resolve } = ctx;
1114
+ const { ok, archive: archive2, validateGherkin, removeExisting } = helpers;
1115
+ return {
1116
+ // ---- Society: individual lifecycle ----
1117
+ async "society.born"(content, id, alias) {
1118
+ validateGherkin(content);
1119
+ const node = await rt.create(society2, individual, content, id, alias);
1120
+ await rt.create(node, identity, void 0, `${id}-identity`);
1121
+ return ok(node, "born");
1122
+ },
1123
+ async "society.retire"(individual2) {
1124
+ return archive2(await resolve(individual2), "retire");
1125
+ },
1126
+ async "society.die"(individual2) {
1127
+ return archive2(await resolve(individual2), "die");
1128
+ },
1129
+ async "society.rehire"(pastNode) {
1130
+ const node = await resolve(pastNode);
1131
+ const ind = await rt.transform(node, individual);
1132
+ return ok(ind, "rehire");
1133
+ },
1134
+ // ---- Society: external injection ----
1135
+ async "society.teach"(individual2, principle2, id) {
1136
+ validateGherkin(principle2);
1137
+ const parent = await resolve(individual2);
1138
+ if (id) await removeExisting(parent, id);
1139
+ const node = await rt.create(parent, principle, principle2, id);
1140
+ return ok(node, "teach");
1141
+ },
1142
+ async "society.train"(individual2, procedure2, id) {
1143
+ validateGherkin(procedure2);
1144
+ const parent = await resolve(individual2);
1145
+ if (id) await removeExisting(parent, id);
1146
+ const node = await rt.create(parent, procedure, procedure2, id);
1147
+ return ok(node, "train");
1148
+ },
1149
+ // ---- Society: organization lifecycle ----
1150
+ async "society.found"(content, id, alias, admin) {
1151
+ validateGherkin(content);
1152
+ const node = await rt.create(society2, organization, content, id, alias);
1153
+ if (admin) await rt.link(node, await resolve(admin), "admin", "administer");
1154
+ return ok(node, "found");
1155
+ },
1156
+ async "society.dissolve"(org) {
1157
+ return archive2(await resolve(org), "dissolve");
1158
+ },
1159
+ // ---- Society: crown ----
1160
+ async "society.crown"(individual2) {
1161
+ const indNode = await resolve(individual2);
1162
+ await rt.link(society2, indNode, "crown", "crowned");
1163
+ return ok(indNode, "crown");
1164
+ },
1165
+ async "society.uncrown"(individual2) {
1166
+ const indNode = await resolve(individual2);
1167
+ await rt.unlink(society2, indNode, "crown", "crowned");
1168
+ return ok(indNode, "uncrown");
1169
+ },
1170
+ // ---- Org ----
1171
+ async "org.charter"(org, charter2, id) {
1172
+ validateGherkin(charter2);
1173
+ const node = await rt.create(await resolve(org), charter, charter2, id);
1174
+ return ok(node, "charter");
1175
+ },
1176
+ async "org.hire"(org, individual2) {
1177
+ const orgNode = await resolve(org);
1178
+ await rt.link(orgNode, await resolve(individual2), "membership", "belong");
1179
+ return ok(orgNode, "hire");
1180
+ },
1181
+ async "org.fire"(org, individual2) {
1182
+ const orgNode = await resolve(org);
1183
+ await rt.unlink(orgNode, await resolve(individual2), "membership", "belong");
1184
+ return ok(orgNode, "fire");
1185
+ },
1186
+ async "org.admin"(org, individual2) {
1187
+ const orgNode = await resolve(org);
1188
+ await rt.link(orgNode, await resolve(individual2), "admin", "administer");
1189
+ return ok(orgNode, "admin");
1190
+ },
1191
+ async "org.unadmin"(org, individual2) {
1192
+ const orgNode = await resolve(org);
1193
+ await rt.unlink(orgNode, await resolve(individual2), "admin", "administer");
1194
+ return ok(orgNode, "unadmin");
1195
+ },
1196
+ // ---- Org: project lifecycle ----
1197
+ async "org.launch"(content, id, alias, org, maintainer) {
1198
+ validateGherkin(content);
1199
+ const node = await rt.create(society2, project, content, id, alias);
1200
+ if (org) await rt.link(node, await resolve(org), "ownership", "project");
1201
+ if (maintainer) await rt.link(node, await resolve(maintainer), "maintain", "maintained-by");
1202
+ return ok(node, "launch");
1203
+ },
1204
+ async "org.archive"(project2) {
1205
+ return archive2(await resolve(project2), "archive");
1206
+ },
1207
+ // ---- Org: position lifecycle ----
1208
+ async "org.establish"(content, id, alias) {
1209
+ validateGherkin(content);
1210
+ const node = await rt.create(society2, position, content, id, alias);
1211
+ return ok(node, "establish");
1212
+ },
1213
+ async "org.abolish"(position2) {
1214
+ return archive2(await resolve(position2), "abolish");
1215
+ }
1216
+ };
1217
+ }
1218
+
1219
+ // src/commands/index.ts
1220
+ function createCommands(ctx) {
1221
+ const helpers = createHelpers(ctx);
1222
+ return {
1223
+ ...societyCommands(ctx, helpers),
1224
+ ...roleCommands(ctx, helpers),
1225
+ ...positionCommands(ctx, helpers),
1226
+ ...projectCommands(ctx, helpers),
1227
+ ...productCommands(ctx, helpers),
1228
+ ...censusCommands(ctx, helpers),
1229
+ ...resourceCommands(ctx, helpers),
1230
+ ...issueCommands(ctx, helpers)
1231
+ };
1232
+ }
1233
+
1234
+ // src/directives/index.ts
1235
+ var directives = {
1236
+ "identity-ethics": {
1237
+ "on-unknown-command": "STOP. Do not guess another command name. Do not search source code for commands.\nCheck your procedures \u2014 if one covers this task, call skill(locator) to load it first.\nThe skill will tell you the correct command name and arguments.\nIf no procedure covers this task, it is outside your duties. Tell the user and suggest Nuwa.",
1238
+ "on-activate": "Your duties define the COMPLETE scope of what you do. Everything else is forbidden.\nWhen a request falls outside your duties, you MUST refuse. This is not optional.\nDo not attempt to discover commands outside your skills. Do not read source code to find them.\nSuggest Nuwa for anything outside your scope."
1239
+ }
1240
+ };
1241
+
1242
+ // src/instructions/def.ts
1243
+ function def(namespace, method, params, args) {
1244
+ return { namespace, method, params, args };
1245
+ }
1246
+
1247
+ // src/instructions/issue.ts
1248
+ var issuePublish = def(
1249
+ "issue",
1250
+ "publish",
1251
+ {
1252
+ title: { type: "string", required: true, description: "Issue title" },
1253
+ body: { type: "string", required: true, description: "Issue body/description" },
1254
+ author: { type: "string", required: true, description: "Author individual id" },
1255
+ assignee: { type: "string", required: false, description: "Assignee individual id" }
1256
+ },
1257
+ ["title", "body", "author", "assignee"]
1258
+ );
1259
+ var issueGet = def(
1260
+ "issue",
1261
+ "get",
1262
+ {
1263
+ number: { type: "number", required: true, description: "Issue number" }
1264
+ },
1265
+ ["number"]
1266
+ );
1267
+ var issueList = def(
1268
+ "issue",
1269
+ "list",
1270
+ {
1271
+ status: { type: "string", required: false, description: "Filter by status (open/closed)" },
1272
+ author: { type: "string", required: false, description: "Filter by author" },
1273
+ assignee: { type: "string", required: false, description: "Filter by assignee" },
1274
+ label: { type: "string", required: false, description: "Filter by label name" }
1275
+ },
1276
+ ["status", "author", "assignee", "label"]
1277
+ );
1278
+ var issueUpdate = def(
1279
+ "issue",
1280
+ "update",
1281
+ {
1282
+ number: { type: "number", required: true, description: "Issue number" },
1283
+ title: { type: "string", required: false, description: "New title" },
1284
+ body: { type: "string", required: false, description: "New body" },
1285
+ assignee: { type: "string", required: false, description: "New assignee" }
1286
+ },
1287
+ ["number", "title", "body", "assignee"]
1288
+ );
1289
+ var issueClose = def(
1290
+ "issue",
1291
+ "close",
1292
+ {
1293
+ number: { type: "number", required: true, description: "Issue number to close" }
1294
+ },
1295
+ ["number"]
1296
+ );
1297
+ var issueReopen = def(
1298
+ "issue",
1299
+ "reopen",
1300
+ {
1301
+ number: { type: "number", required: true, description: "Issue number to reopen" }
1302
+ },
1303
+ ["number"]
1304
+ );
1305
+ var issueAssign = def(
1306
+ "issue",
1307
+ "assign",
1308
+ {
1309
+ number: { type: "number", required: true, description: "Issue number" },
1310
+ assignee: { type: "string", required: true, description: "Individual id to assign" }
1311
+ },
1312
+ ["number", "assignee"]
1313
+ );
1314
+ var issueComment = def(
1315
+ "issue",
1316
+ "comment",
1317
+ {
1318
+ number: { type: "number", required: true, description: "Issue number" },
1319
+ body: { type: "string", required: true, description: "Comment body" },
1320
+ author: { type: "string", required: true, description: "Author individual id" }
1321
+ },
1322
+ ["number", "body", "author"]
1323
+ );
1324
+ var issueComments = def(
1325
+ "issue",
1326
+ "comments",
1327
+ {
1328
+ number: { type: "number", required: true, description: "Issue number" }
1329
+ },
1330
+ ["number"]
1331
+ );
1332
+ var issueLabel = def(
1333
+ "issue",
1334
+ "label",
1335
+ {
1336
+ number: { type: "number", required: true, description: "Issue number" },
1337
+ label: { type: "string", required: true, description: "Label name" }
1338
+ },
1339
+ ["number", "label"]
1340
+ );
1341
+ var issueUnlabel = def(
1342
+ "issue",
1343
+ "unlabel",
1344
+ {
1345
+ number: { type: "number", required: true, description: "Issue number" },
1346
+ label: { type: "string", required: true, description: "Label name to remove" }
1347
+ },
1348
+ ["number", "label"]
1349
+ );
1350
+
1351
+ // src/instructions/org.ts
1352
+ var orgCharter = def(
1353
+ "org",
1354
+ "charter",
1355
+ {
1356
+ org: { type: "string", required: true, description: "Organization id" },
1357
+ content: {
1358
+ type: "gherkin",
1359
+ required: true,
1360
+ description: "Gherkin Feature source for the charter"
1361
+ },
1362
+ id: { type: "string", required: true, description: "Charter id" }
1363
+ },
1364
+ ["org", "content", "id"]
1365
+ );
1366
+ var orgHire = def(
1367
+ "org",
1368
+ "hire",
1369
+ {
1370
+ org: { type: "string", required: true, description: "Organization id" },
1371
+ individual: { type: "string", required: true, description: "Individual id" }
1372
+ },
1373
+ ["org", "individual"]
1374
+ );
1375
+ var orgFire = def(
1376
+ "org",
1377
+ "fire",
1378
+ {
1379
+ org: { type: "string", required: true, description: "Organization id" },
1380
+ individual: { type: "string", required: true, description: "Individual id" }
1381
+ },
1382
+ ["org", "individual"]
1383
+ );
1384
+ var orgAdmin = def(
1385
+ "org",
1386
+ "admin",
1387
+ {
1388
+ org: { type: "string", required: true, description: "Organization id" },
1389
+ individual: { type: "string", required: true, description: "Individual id" }
1390
+ },
1391
+ ["org", "individual"]
1392
+ );
1393
+ var orgUnadmin = def(
1394
+ "org",
1395
+ "unadmin",
1396
+ {
1397
+ org: { type: "string", required: true, description: "Organization id" },
1398
+ individual: { type: "string", required: true, description: "Individual id" }
1399
+ },
1400
+ ["org", "individual"]
1401
+ );
1402
+ var orgLaunch = def(
1403
+ "org",
1404
+ "launch",
1174
1405
  {
1175
1406
  content: {
1176
1407
  type: "gherkin",
1177
1408
  required: false,
1178
- description: "Gherkin Feature source for the individual"
1409
+ description: "Gherkin Feature source for the project"
1179
1410
  },
1180
1411
  id: { type: "string", required: true, description: "User-facing identifier (kebab-case)" },
1181
- alias: { type: "string[]", required: false, description: "Alternative names" }
1412
+ alias: { type: "string[]", required: false, description: "Alternative names" },
1413
+ org: {
1414
+ type: "string",
1415
+ required: false,
1416
+ description: "Organization id that owns this project"
1417
+ },
1418
+ maintainer: {
1419
+ type: "string",
1420
+ required: false,
1421
+ description: "Individual id of the first maintainer"
1422
+ }
1182
1423
  },
1183
- ["content", "id", "alias"]
1424
+ ["content", "id", "alias", "org", "maintainer"]
1184
1425
  );
1185
- var societyRetire = def(
1186
- "society",
1187
- "retire",
1426
+ var orgArchive = def(
1427
+ "org",
1428
+ "archive",
1188
1429
  {
1189
- individual: { type: "string", required: true, description: "Individual id" }
1430
+ project: { type: "string", required: true, description: "Project id" }
1190
1431
  },
1191
- ["individual"]
1432
+ ["project"]
1192
1433
  );
1193
- var societyDie = def(
1194
- "society",
1195
- "die",
1434
+ var orgEstablish = def(
1435
+ "org",
1436
+ "establish",
1196
1437
  {
1197
- individual: { type: "string", required: true, description: "Individual id" }
1438
+ content: {
1439
+ type: "gherkin",
1440
+ required: false,
1441
+ description: "Gherkin Feature source for the position"
1442
+ },
1443
+ id: { type: "string", required: true, description: "User-facing identifier (kebab-case)" },
1444
+ alias: { type: "string[]", required: false, description: "Alternative names" }
1198
1445
  },
1199
- ["individual"]
1446
+ ["content", "id", "alias"]
1200
1447
  );
1201
- var societyRehire = def(
1202
- "society",
1203
- "rehire",
1448
+ var orgAbolish = def(
1449
+ "org",
1450
+ "abolish",
1204
1451
  {
1205
- individual: { type: "string", required: true, description: "Individual id (from past)" }
1452
+ position: { type: "string", required: true, description: "Position id" }
1206
1453
  },
1207
- ["individual"]
1454
+ ["position"]
1208
1455
  );
1209
- var societyTeach = def(
1210
- "society",
1211
- "teach",
1456
+
1457
+ // src/instructions/position.ts
1458
+ var positionCharge = def(
1459
+ "position",
1460
+ "charge",
1212
1461
  {
1213
- individual: { type: "string", required: true, description: "Individual id" },
1462
+ position: { type: "string", required: true, description: "Position id" },
1214
1463
  content: {
1215
1464
  type: "gherkin",
1216
1465
  required: true,
1217
- description: "Gherkin Feature source for the principle"
1466
+ description: "Gherkin Feature source for the duty"
1218
1467
  },
1219
- id: {
1220
- type: "string",
1221
- required: true,
1222
- description: "Principle id (keywords joined by hyphens)"
1223
- }
1468
+ id: { type: "string", required: true, description: "Duty id (keywords joined by hyphens)" }
1224
1469
  },
1225
- ["individual", "content", "id"]
1470
+ ["position", "content", "id"]
1226
1471
  );
1227
- var societyTrain = def(
1228
- "society",
1229
- "train",
1472
+ var positionRequire = def(
1473
+ "position",
1474
+ "require",
1230
1475
  {
1231
- individual: { type: "string", required: true, description: "Individual id" },
1476
+ position: { type: "string", required: true, description: "Position id" },
1232
1477
  content: {
1233
1478
  type: "gherkin",
1234
1479
  required: true,
1235
- description: "Gherkin Feature source for the procedure"
1480
+ description: "Gherkin Feature source for the skill requirement"
1236
1481
  },
1237
1482
  id: {
1238
1483
  type: "string",
1239
1484
  required: true,
1240
- description: "Procedure id (keywords joined by hyphens)"
1485
+ description: "Requirement id (keywords joined by hyphens)"
1241
1486
  }
1242
1487
  },
1243
- ["individual", "content", "id"]
1488
+ ["position", "content", "id"]
1244
1489
  );
1245
- var roleActivate = def(
1246
- "role",
1247
- "activate",
1490
+ var positionAppoint = def(
1491
+ "position",
1492
+ "appoint",
1248
1493
  {
1249
- individual: {
1250
- type: "string",
1251
- required: true,
1252
- description: "Individual id to activate as role"
1253
- }
1494
+ position: { type: "string", required: true, description: "Position id" },
1495
+ individual: { type: "string", required: true, description: "Individual id" }
1254
1496
  },
1255
- ["individual"]
1497
+ ["position", "individual"]
1256
1498
  );
1257
- var roleFocus = def(
1258
- "role",
1259
- "focus",
1499
+ var positionDismiss = def(
1500
+ "position",
1501
+ "dismiss",
1260
1502
  {
1261
- goal: { type: "string", required: true, description: "Goal id to switch to" }
1503
+ position: { type: "string", required: true, description: "Position id" },
1504
+ individual: { type: "string", required: true, description: "Individual id" }
1262
1505
  },
1263
- ["goal"]
1506
+ ["position", "individual"]
1264
1507
  );
1265
- var roleWant = def(
1266
- "role",
1267
- "want",
1508
+
1509
+ // src/instructions/product.ts
1510
+ var productStrategy = def(
1511
+ "product",
1512
+ "strategy",
1268
1513
  {
1269
- individual: { type: "string", required: true, description: "Individual id" },
1270
- goal: {
1514
+ product: { type: "string", required: true, description: "Product id" },
1515
+ content: {
1271
1516
  type: "gherkin",
1272
- required: false,
1273
- description: "Gherkin Feature source describing the goal"
1517
+ required: true,
1518
+ description: "Gherkin Feature source for the strategy"
1274
1519
  },
1275
- id: { type: "string", required: true, description: "Goal id (used for focus/reference)" },
1276
- alias: { type: "string[]", required: false, description: "Alternative names" }
1520
+ id: { type: "string", required: true, description: "Strategy id" }
1277
1521
  },
1278
- ["individual", "goal", "id", "alias"]
1522
+ ["product", "content", "id"]
1279
1523
  );
1280
- var rolePlan = def(
1281
- "role",
1282
- "plan",
1524
+ var productSpec = def(
1525
+ "product",
1526
+ "spec",
1283
1527
  {
1284
- goal: { type: "string", required: true, description: "Goal id" },
1285
- plan: {
1528
+ product: { type: "string", required: true, description: "Product id" },
1529
+ content: {
1286
1530
  type: "gherkin",
1287
- required: false,
1288
- description: "Gherkin Feature source describing the plan"
1289
- },
1290
- id: { type: "string", required: true, description: "Plan id (keywords joined by hyphens)" },
1291
- after: {
1292
- type: "string",
1293
- required: false,
1294
- description: "Plan id this plan follows (sequential/phase)"
1531
+ required: true,
1532
+ description: "Gherkin Feature source for the behavior contract (BDD specification)"
1295
1533
  },
1296
- fallback: {
1534
+ id: {
1297
1535
  type: "string",
1298
- required: false,
1299
- description: "Plan id this plan is a backup for (alternative/strategy)"
1536
+ required: true,
1537
+ description: "Spec id (keywords joined by hyphens)"
1300
1538
  }
1301
1539
  },
1302
- ["goal", "plan", "id", "after", "fallback"]
1540
+ ["product", "content", "id"]
1303
1541
  );
1304
- var roleTodo = def(
1305
- "role",
1306
- "todo",
1542
+ var productRelease = def(
1543
+ "product",
1544
+ "release",
1307
1545
  {
1308
- plan: { type: "string", required: true, description: "Plan id" },
1309
- task: {
1546
+ product: { type: "string", required: true, description: "Product id" },
1547
+ content: {
1310
1548
  type: "gherkin",
1311
- required: false,
1312
- description: "Gherkin Feature source describing the task"
1549
+ required: true,
1550
+ description: "Gherkin Feature source for the release"
1313
1551
  },
1314
- id: { type: "string", required: true, description: "Task id (used for finish/reference)" },
1315
- alias: { type: "string[]", required: false, description: "Alternative names" }
1552
+ id: {
1553
+ type: "string",
1554
+ required: true,
1555
+ description: "Release id (e.g. v1.0.0)"
1556
+ }
1316
1557
  },
1317
- ["plan", "task", "id", "alias"]
1558
+ ["product", "content", "id"]
1318
1559
  );
1319
- var roleFinish = def(
1320
- "role",
1321
- "finish",
1560
+ var productChannel = def(
1561
+ "product",
1562
+ "channel",
1322
1563
  {
1323
- task: { type: "string", required: true, description: "Task id to finish" },
1324
- individual: { type: "string", required: true, description: "Individual id (encounter owner)" },
1325
- encounter: {
1564
+ product: { type: "string", required: true, description: "Product id" },
1565
+ content: {
1326
1566
  type: "gherkin",
1327
- required: false,
1328
- description: "Optional Gherkin Feature describing what happened"
1567
+ required: true,
1568
+ description: "Gherkin Feature source for the distribution channel"
1569
+ },
1570
+ id: {
1571
+ type: "string",
1572
+ required: true,
1573
+ description: "Channel id (e.g. npm, cloud-platform)"
1329
1574
  }
1330
1575
  },
1331
- ["task", "individual", "encounter"]
1576
+ ["product", "content", "id"]
1332
1577
  );
1333
- var roleComplete = def(
1334
- "role",
1335
- "complete",
1578
+ var productOwn = def(
1579
+ "product",
1580
+ "own",
1336
1581
  {
1337
- plan: { type: "string", required: true, description: "Plan id to complete" },
1338
- individual: { type: "string", required: true, description: "Individual id (encounter owner)" },
1339
- encounter: {
1340
- type: "gherkin",
1341
- required: false,
1342
- description: "Optional Gherkin Feature describing what happened"
1343
- }
1582
+ product: { type: "string", required: true, description: "Product id" },
1583
+ individual: { type: "string", required: true, description: "Individual id (owner)" }
1344
1584
  },
1345
- ["plan", "individual", "encounter"]
1585
+ ["product", "individual"]
1346
1586
  );
1347
- var roleAbandon = def(
1348
- "role",
1349
- "abandon",
1587
+ var productDisown = def(
1588
+ "product",
1589
+ "disown",
1350
1590
  {
1351
- plan: { type: "string", required: true, description: "Plan id to abandon" },
1352
- individual: { type: "string", required: true, description: "Individual id (encounter owner)" },
1353
- encounter: {
1591
+ product: { type: "string", required: true, description: "Product id" },
1592
+ individual: { type: "string", required: true, description: "Individual id (owner to remove)" }
1593
+ },
1594
+ ["product", "individual"]
1595
+ );
1596
+ var productDeprecate = def(
1597
+ "product",
1598
+ "deprecate",
1599
+ {
1600
+ product: { type: "string", required: true, description: "Product id" }
1601
+ },
1602
+ ["product"]
1603
+ );
1604
+
1605
+ // src/instructions/project.ts
1606
+ var projectScope = def(
1607
+ "project",
1608
+ "scope",
1609
+ {
1610
+ project: { type: "string", required: true, description: "Project id" },
1611
+ content: {
1354
1612
  type: "gherkin",
1355
- required: false,
1356
- description: "Optional Gherkin Feature describing what happened"
1357
- }
1613
+ required: true,
1614
+ description: "Gherkin Feature source for the scope"
1615
+ },
1616
+ id: { type: "string", required: true, description: "Scope id" }
1358
1617
  },
1359
- ["plan", "individual", "encounter"]
1618
+ ["project", "content", "id"]
1360
1619
  );
1361
- var roleReflect = def(
1362
- "role",
1363
- "reflect",
1620
+ var projectMilestone = def(
1621
+ "project",
1622
+ "milestone",
1364
1623
  {
1365
- encounter: { type: "string", required: true, description: "Encounter id to reflect on" },
1366
- individual: { type: "string", required: true, description: "Individual id" },
1367
- experience: {
1624
+ project: { type: "string", required: true, description: "Project id" },
1625
+ content: {
1368
1626
  type: "gherkin",
1369
- required: false,
1370
- description: "Gherkin Feature source for the experience"
1627
+ required: true,
1628
+ description: "Gherkin Feature source for the milestone"
1371
1629
  },
1372
1630
  id: {
1373
1631
  type: "string",
1374
1632
  required: true,
1375
- description: "Experience id (keywords joined by hyphens)"
1633
+ description: "Milestone id (keywords joined by hyphens)"
1376
1634
  }
1377
1635
  },
1378
- ["encounter", "individual", "experience", "id"]
1636
+ ["project", "content", "id"]
1379
1637
  );
1380
- var roleRealize = def(
1381
- "role",
1382
- "realize",
1638
+ var projectAchieve = def(
1639
+ "project",
1640
+ "achieve",
1383
1641
  {
1384
- experience: { type: "string", required: true, description: "Experience id to distill" },
1385
- individual: { type: "string", required: true, description: "Individual id" },
1386
- principle: {
1642
+ milestone: { type: "string", required: true, description: "Milestone id to mark as done" }
1643
+ },
1644
+ ["milestone"]
1645
+ );
1646
+ var projectEnroll = def(
1647
+ "project",
1648
+ "enroll",
1649
+ {
1650
+ project: { type: "string", required: true, description: "Project id" },
1651
+ individual: { type: "string", required: true, description: "Individual id" }
1652
+ },
1653
+ ["project", "individual"]
1654
+ );
1655
+ var projectRemove = def(
1656
+ "project",
1657
+ "remove",
1658
+ {
1659
+ project: { type: "string", required: true, description: "Project id" },
1660
+ individual: { type: "string", required: true, description: "Individual id" }
1661
+ },
1662
+ ["project", "individual"]
1663
+ );
1664
+ var projectDeliver = def(
1665
+ "project",
1666
+ "deliver",
1667
+ {
1668
+ project: { type: "string", required: true, description: "Project id" },
1669
+ content: {
1387
1670
  type: "gherkin",
1388
- required: false,
1389
- description: "Gherkin Feature source for the principle"
1671
+ required: true,
1672
+ description: "Gherkin Feature source for the deliverable"
1390
1673
  },
1391
1674
  id: {
1392
1675
  type: "string",
1393
1676
  required: true,
1394
- description: "Principle id (keywords joined by hyphens)"
1677
+ description: "Deliverable id (keywords joined by hyphens)"
1395
1678
  }
1396
1679
  },
1397
- ["experience", "individual", "principle", "id"]
1680
+ ["project", "content", "id"]
1398
1681
  );
1399
- var roleMaster = def(
1400
- "role",
1401
- "master",
1682
+ var projectWiki = def(
1683
+ "project",
1684
+ "wiki",
1402
1685
  {
1403
- individual: { type: "string", required: true, description: "Individual id" },
1404
- procedure: {
1686
+ project: { type: "string", required: true, description: "Project id" },
1687
+ content: {
1405
1688
  type: "gherkin",
1406
1689
  required: true,
1407
- description: "Gherkin Feature source for the procedure"
1690
+ description: "Gherkin Feature source for the wiki entry"
1408
1691
  },
1409
1692
  id: {
1410
1693
  type: "string",
1411
1694
  required: true,
1412
- description: "Procedure id (keywords joined by hyphens)"
1413
- },
1414
- experience: {
1415
- type: "string",
1416
- required: false,
1417
- description: "Experience id to consume (optional)"
1695
+ description: "Wiki entry id (keywords joined by hyphens)"
1418
1696
  }
1419
1697
  },
1420
- ["individual", "procedure", "id", "experience"]
1421
- );
1422
- var roleForget = def(
1423
- "role",
1424
- "forget",
1425
- {
1426
- id: { type: "string", required: true, description: "Id of the node to remove" },
1427
- individual: { type: "string", required: true, description: "Individual id (owner)" }
1428
- },
1429
- ["id", "individual"]
1430
- );
1431
- var roleSkill = def(
1432
- "role",
1433
- "skill",
1434
- {
1435
- locator: { type: "string", required: true, description: "ResourceX locator for the skill" }
1436
- },
1437
- ["locator"]
1698
+ ["project", "content", "id"]
1438
1699
  );
1439
- var societyFound = def(
1440
- "society",
1441
- "found",
1700
+ var projectProduce = def(
1701
+ "project",
1702
+ "produce",
1442
1703
  {
1704
+ project: { type: "string", required: true, description: "Project id" },
1443
1705
  content: {
1444
1706
  type: "gherkin",
1445
1707
  required: false,
1446
- description: "Gherkin Feature source for the organization"
1708
+ description: "Gherkin Feature source for the product (vision)"
1447
1709
  },
1448
- id: { type: "string", required: true, description: "User-facing identifier (kebab-case)" },
1449
- alias: { type: "string[]", required: false, description: "Alternative names" }
1710
+ id: { type: "string", required: true, description: "Product id (kebab-case)" },
1711
+ alias: { type: "string[]", required: false, description: "Alternative names" },
1712
+ owner: {
1713
+ type: "string",
1714
+ required: false,
1715
+ description: "Individual id of the first product owner"
1716
+ }
1450
1717
  },
1451
- ["content", "id", "alias"]
1718
+ ["project", "content", "id", "alias", "owner"]
1452
1719
  );
1453
- var orgCharter = def(
1454
- "org",
1455
- "charter",
1720
+ var projectMaintain = def(
1721
+ "project",
1722
+ "maintain",
1456
1723
  {
1457
- org: { type: "string", required: true, description: "Organization id" },
1458
- content: {
1459
- type: "gherkin",
1460
- required: true,
1461
- description: "Gherkin Feature source for the charter"
1462
- },
1463
- id: { type: "string", required: true, description: "Charter id" }
1724
+ project: { type: "string", required: true, description: "Project id" },
1725
+ individual: { type: "string", required: true, description: "Individual id" }
1464
1726
  },
1465
- ["org", "content", "id"]
1727
+ ["project", "individual"]
1466
1728
  );
1467
- var societyDissolve = def(
1468
- "society",
1469
- "dissolve",
1729
+ var projectUnmaintain = def(
1730
+ "project",
1731
+ "unmaintain",
1470
1732
  {
1471
- org: { type: "string", required: true, description: "Organization id" }
1733
+ project: { type: "string", required: true, description: "Project id" },
1734
+ individual: { type: "string", required: true, description: "Individual id" }
1472
1735
  },
1473
- ["org"]
1736
+ ["project", "individual"]
1474
1737
  );
1475
- var orgHire = def(
1476
- "org",
1477
- "hire",
1738
+
1739
+ // src/instructions/resource.ts
1740
+ var resourceAdd = def(
1741
+ "resource",
1742
+ "add",
1478
1743
  {
1479
- org: { type: "string", required: true, description: "Organization id" },
1480
- individual: { type: "string", required: true, description: "Individual id" }
1744
+ path: { type: "string", required: true, description: "Path to resource directory" }
1481
1745
  },
1482
- ["org", "individual"]
1746
+ ["path"]
1483
1747
  );
1484
- var orgFire = def(
1485
- "org",
1486
- "fire",
1748
+ var resourceSearch = def(
1749
+ "resource",
1750
+ "search",
1487
1751
  {
1488
- org: { type: "string", required: true, description: "Organization id" },
1489
- individual: { type: "string", required: true, description: "Individual id" }
1752
+ query: { type: "string", required: false, description: "Search query" }
1490
1753
  },
1491
- ["org", "individual"]
1754
+ ["query"]
1492
1755
  );
1493
- var orgAdmin = def(
1494
- "org",
1495
- "admin",
1756
+ var resourceHas = def(
1757
+ "resource",
1758
+ "has",
1496
1759
  {
1497
- org: { type: "string", required: true, description: "Organization id" },
1498
- individual: { type: "string", required: true, description: "Individual id" }
1760
+ locator: { type: "string", required: true, description: "Resource locator" }
1499
1761
  },
1500
- ["org", "individual"]
1762
+ ["locator"]
1501
1763
  );
1502
- var orgUnadmin = def(
1503
- "org",
1504
- "unadmin",
1764
+ var resourceInfo = def(
1765
+ "resource",
1766
+ "info",
1505
1767
  {
1506
- org: { type: "string", required: true, description: "Organization id" },
1507
- individual: { type: "string", required: true, description: "Individual id" }
1768
+ locator: { type: "string", required: true, description: "Resource locator" }
1508
1769
  },
1509
- ["org", "individual"]
1770
+ ["locator"]
1510
1771
  );
1511
- var positionEstablish = def(
1512
- "position",
1513
- "establish",
1772
+ var resourceRemove = def(
1773
+ "resource",
1774
+ "remove",
1514
1775
  {
1515
- content: {
1516
- type: "gherkin",
1517
- required: false,
1518
- description: "Gherkin Feature source for the position"
1519
- },
1520
- id: { type: "string", required: true, description: "User-facing identifier (kebab-case)" },
1521
- alias: { type: "string[]", required: false, description: "Alternative names" }
1776
+ locator: { type: "string", required: true, description: "Resource locator" }
1522
1777
  },
1523
- ["content", "id", "alias"]
1778
+ ["locator"]
1524
1779
  );
1525
- var positionCharge = def(
1526
- "position",
1527
- "charge",
1780
+ var resourcePush = def(
1781
+ "resource",
1782
+ "push",
1528
1783
  {
1529
- position: { type: "string", required: true, description: "Position id" },
1530
- content: {
1531
- type: "gherkin",
1532
- required: true,
1533
- description: "Gherkin Feature source for the duty"
1534
- },
1535
- id: { type: "string", required: true, description: "Duty id (keywords joined by hyphens)" }
1784
+ locator: { type: "string", required: true, description: "Resource locator" },
1785
+ registry: { type: "string", required: false, description: "Registry URL (overrides default)" }
1536
1786
  },
1537
- ["position", "content", "id"]
1787
+ ["locator", { pack: ["registry"] }]
1538
1788
  );
1539
- var positionRequire = def(
1540
- "position",
1541
- "require",
1789
+ var resourcePull = def(
1790
+ "resource",
1791
+ "pull",
1542
1792
  {
1543
- position: { type: "string", required: true, description: "Position id" },
1544
- content: {
1545
- type: "gherkin",
1546
- required: true,
1547
- description: "Gherkin Feature source for the skill requirement"
1548
- },
1549
- id: {
1550
- type: "string",
1551
- required: true,
1552
- description: "Requirement id (keywords joined by hyphens)"
1553
- }
1793
+ locator: { type: "string", required: true, description: "Resource locator" },
1794
+ registry: { type: "string", required: false, description: "Registry URL (overrides default)" }
1554
1795
  },
1555
- ["position", "content", "id"]
1796
+ ["locator", { pack: ["registry"] }]
1556
1797
  );
1557
- var positionAbolish = def(
1558
- "position",
1559
- "abolish",
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
+ // src/instructions/role.ts
1808
+ var roleActivate = def(
1809
+ "role",
1810
+ "activate",
1560
1811
  {
1561
- position: { type: "string", required: true, description: "Position id" }
1812
+ individual: {
1813
+ type: "string",
1814
+ required: true,
1815
+ description: "Individual id to activate as role"
1816
+ }
1562
1817
  },
1563
- ["position"]
1818
+ ["individual"]
1564
1819
  );
1565
- var positionAppoint = def(
1566
- "position",
1567
- "appoint",
1820
+ var roleFocus = def(
1821
+ "role",
1822
+ "focus",
1568
1823
  {
1569
- position: { type: "string", required: true, description: "Position id" },
1570
- individual: { type: "string", required: true, description: "Individual id" }
1824
+ goal: { type: "string", required: true, description: "Goal id to switch to" }
1571
1825
  },
1572
- ["position", "individual"]
1826
+ ["goal"]
1573
1827
  );
1574
- var positionDismiss = def(
1575
- "position",
1576
- "dismiss",
1828
+ var roleWant = def(
1829
+ "role",
1830
+ "want",
1577
1831
  {
1578
- position: { type: "string", required: true, description: "Position id" },
1579
- individual: { type: "string", required: true, description: "Individual id" }
1832
+ individual: { type: "string", required: true, description: "Individual id" },
1833
+ goal: {
1834
+ type: "gherkin",
1835
+ required: false,
1836
+ description: "Gherkin Feature source describing the goal"
1837
+ },
1838
+ id: { type: "string", required: true, description: "Goal id (used for focus/reference)" },
1839
+ alias: { type: "string[]", required: false, description: "Alternative names" }
1580
1840
  },
1581
- ["position", "individual"]
1841
+ ["individual", "goal", "id", "alias"]
1582
1842
  );
1583
- var projectLaunch = def(
1584
- "project",
1585
- "launch",
1843
+ var rolePlan = def(
1844
+ "role",
1845
+ "plan",
1586
1846
  {
1587
- content: {
1847
+ goal: { type: "string", required: true, description: "Goal id" },
1848
+ plan: {
1588
1849
  type: "gherkin",
1589
1850
  required: false,
1590
- description: "Gherkin Feature source for the project"
1851
+ description: "Gherkin Feature source describing the plan"
1591
1852
  },
1592
- id: { type: "string", required: true, description: "User-facing identifier (kebab-case)" },
1593
- alias: { type: "string[]", required: false, description: "Alternative names" },
1594
- org: {
1853
+ id: { type: "string", required: true, description: "Plan id (keywords joined by hyphens)" },
1854
+ after: {
1595
1855
  type: "string",
1596
1856
  required: false,
1597
- description: "Organization id that owns this project"
1857
+ description: "Plan id this plan follows (sequential/phase)"
1858
+ },
1859
+ fallback: {
1860
+ type: "string",
1861
+ required: false,
1862
+ description: "Plan id this plan is a backup for (alternative/strategy)"
1598
1863
  }
1599
1864
  },
1600
- ["content", "id", "alias", "org"]
1865
+ ["goal", "plan", "id", "after", "fallback"]
1601
1866
  );
1602
- var projectScope = def(
1603
- "project",
1604
- "scope",
1867
+ var roleTodo = def(
1868
+ "role",
1869
+ "todo",
1605
1870
  {
1606
- project: { type: "string", required: true, description: "Project id" },
1607
- content: {
1871
+ plan: { type: "string", required: true, description: "Plan id" },
1872
+ task: {
1608
1873
  type: "gherkin",
1609
- required: true,
1610
- description: "Gherkin Feature source for the scope"
1874
+ required: false,
1875
+ description: "Gherkin Feature source describing the task"
1611
1876
  },
1612
- id: { type: "string", required: true, description: "Scope id" }
1877
+ id: { type: "string", required: true, description: "Task id (used for finish/reference)" },
1878
+ alias: { type: "string[]", required: false, description: "Alternative names" }
1613
1879
  },
1614
- ["project", "content", "id"]
1880
+ ["plan", "task", "id", "alias"]
1615
1881
  );
1616
- var projectMilestone = def(
1617
- "project",
1618
- "milestone",
1882
+ var roleFinish = def(
1883
+ "role",
1884
+ "finish",
1619
1885
  {
1620
- project: { type: "string", required: true, description: "Project id" },
1621
- content: {
1886
+ task: { type: "string", required: true, description: "Task id to finish" },
1887
+ individual: { type: "string", required: true, description: "Individual id (encounter owner)" },
1888
+ encounter: {
1622
1889
  type: "gherkin",
1623
- required: true,
1624
- description: "Gherkin Feature source for the milestone"
1625
- },
1626
- id: {
1627
- type: "string",
1628
- required: true,
1629
- description: "Milestone id (keywords joined by hyphens)"
1890
+ required: false,
1891
+ description: "Optional Gherkin Feature describing what happened"
1630
1892
  }
1631
1893
  },
1632
- ["project", "content", "id"]
1894
+ ["task", "individual", "encounter"]
1633
1895
  );
1634
- var projectAchieve = def(
1635
- "project",
1636
- "achieve",
1896
+ var roleComplete = def(
1897
+ "role",
1898
+ "complete",
1637
1899
  {
1638
- milestone: { type: "string", required: true, description: "Milestone id to mark as done" }
1900
+ plan: { type: "string", required: true, description: "Plan id to complete" },
1901
+ individual: { type: "string", required: true, description: "Individual id (encounter owner)" },
1902
+ encounter: {
1903
+ type: "gherkin",
1904
+ required: false,
1905
+ description: "Optional Gherkin Feature describing what happened"
1906
+ }
1639
1907
  },
1640
- ["milestone"]
1908
+ ["plan", "individual", "encounter"]
1641
1909
  );
1642
- var projectEnroll = def(
1643
- "project",
1644
- "enroll",
1910
+ var roleAbandon = def(
1911
+ "role",
1912
+ "abandon",
1645
1913
  {
1646
- project: { type: "string", required: true, description: "Project id" },
1647
- individual: { type: "string", required: true, description: "Individual id" }
1914
+ plan: { type: "string", required: true, description: "Plan id to abandon" },
1915
+ individual: { type: "string", required: true, description: "Individual id (encounter owner)" },
1916
+ encounter: {
1917
+ type: "gherkin",
1918
+ required: false,
1919
+ description: "Optional Gherkin Feature describing what happened"
1920
+ }
1648
1921
  },
1649
- ["project", "individual"]
1922
+ ["plan", "individual", "encounter"]
1650
1923
  );
1651
- var projectRemove = def(
1652
- "project",
1653
- "remove",
1924
+ var roleReflect = def(
1925
+ "role",
1926
+ "reflect",
1654
1927
  {
1655
- project: { type: "string", required: true, description: "Project id" },
1656
- individual: { type: "string", required: true, description: "Individual id" }
1928
+ encounter: { type: "string", required: true, description: "Encounter id to reflect on" },
1929
+ individual: { type: "string", required: true, description: "Individual id" },
1930
+ experience: {
1931
+ type: "gherkin",
1932
+ required: false,
1933
+ description: "Gherkin Feature source for the experience"
1934
+ },
1935
+ id: {
1936
+ type: "string",
1937
+ required: true,
1938
+ description: "Experience id (keywords joined by hyphens)"
1939
+ }
1657
1940
  },
1658
- ["project", "individual"]
1941
+ ["encounter", "individual", "experience", "id"]
1659
1942
  );
1660
- var projectDeliver = def(
1661
- "project",
1662
- "deliver",
1943
+ var roleRealize = def(
1944
+ "role",
1945
+ "realize",
1663
1946
  {
1664
- project: { type: "string", required: true, description: "Project id" },
1665
- content: {
1947
+ experience: { type: "string", required: true, description: "Experience id to distill" },
1948
+ individual: { type: "string", required: true, description: "Individual id" },
1949
+ principle: {
1666
1950
  type: "gherkin",
1667
- required: true,
1668
- description: "Gherkin Feature source for the deliverable"
1951
+ required: false,
1952
+ description: "Gherkin Feature source for the principle"
1669
1953
  },
1670
1954
  id: {
1671
1955
  type: "string",
1672
1956
  required: true,
1673
- description: "Deliverable id (keywords joined by hyphens)"
1957
+ description: "Principle id (keywords joined by hyphens)"
1674
1958
  }
1675
1959
  },
1676
- ["project", "content", "id"]
1960
+ ["experience", "individual", "principle", "id"]
1677
1961
  );
1678
- var projectWiki = def(
1679
- "project",
1680
- "wiki",
1962
+ var roleMaster = def(
1963
+ "role",
1964
+ "master",
1681
1965
  {
1682
- project: { type: "string", required: true, description: "Project id" },
1683
- content: {
1966
+ individual: { type: "string", required: true, description: "Individual id" },
1967
+ procedure: {
1684
1968
  type: "gherkin",
1685
1969
  required: true,
1686
- description: "Gherkin Feature source for the wiki entry"
1970
+ description: "Gherkin Feature source for the procedure"
1687
1971
  },
1688
1972
  id: {
1689
1973
  type: "string",
1690
1974
  required: true,
1691
- description: "Wiki entry id (keywords joined by hyphens)"
1975
+ description: "Procedure id (keywords joined by hyphens)"
1976
+ },
1977
+ experience: {
1978
+ type: "string",
1979
+ required: false,
1980
+ description: "Experience id to consume (optional)"
1692
1981
  }
1693
1982
  },
1694
- ["project", "content", "id"]
1983
+ ["individual", "procedure", "id", "experience"]
1695
1984
  );
1696
- var projectArchive = def(
1697
- "project",
1698
- "archive",
1985
+ var roleForget = def(
1986
+ "role",
1987
+ "forget",
1699
1988
  {
1700
- project: { type: "string", required: true, description: "Project id" }
1989
+ id: { type: "string", required: true, description: "Id of the node to remove" },
1990
+ individual: { type: "string", required: true, description: "Individual id (owner)" }
1701
1991
  },
1702
- ["project"]
1992
+ ["id", "individual"]
1703
1993
  );
1704
- var projectProduce = def(
1705
- "project",
1706
- "produce",
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
+
2003
+ // src/instructions/society.ts
2004
+ var societyBorn = def(
2005
+ "society",
2006
+ "born",
1707
2007
  {
1708
- project: { type: "string", required: true, description: "Project id" },
1709
2008
  content: {
1710
2009
  type: "gherkin",
1711
2010
  required: false,
1712
- description: "Gherkin Feature source for the product (vision)"
2011
+ description: "Gherkin Feature source for the individual"
1713
2012
  },
1714
- id: { type: "string", required: true, description: "Product id (kebab-case)" },
2013
+ id: { type: "string", required: true, description: "User-facing identifier (kebab-case)" },
1715
2014
  alias: { type: "string[]", required: false, description: "Alternative names" }
1716
2015
  },
1717
- ["project", "content", "id", "alias"]
2016
+ ["content", "id", "alias"]
1718
2017
  );
1719
- var projectMaintain = def(
1720
- "project",
1721
- "maintain",
2018
+ var societyRetire = def(
2019
+ "society",
2020
+ "retire",
1722
2021
  {
1723
- project: { type: "string", required: true, description: "Project id" },
1724
2022
  individual: { type: "string", required: true, description: "Individual id" }
1725
2023
  },
1726
- ["project", "individual"]
2024
+ ["individual"]
1727
2025
  );
1728
- var projectUnmaintain = def(
1729
- "project",
1730
- "unmaintain",
2026
+ var societyDie = def(
2027
+ "society",
2028
+ "die",
1731
2029
  {
1732
- project: { type: "string", required: true, description: "Project id" },
1733
2030
  individual: { type: "string", required: true, description: "Individual id" }
1734
2031
  },
1735
- ["project", "individual"]
2032
+ ["individual"]
1736
2033
  );
1737
- var productStrategy = def(
1738
- "product",
1739
- "strategy",
1740
- {
1741
- product: { type: "string", required: true, description: "Product id" },
1742
- content: {
1743
- type: "gherkin",
1744
- required: true,
1745
- description: "Gherkin Feature source for the strategy"
1746
- },
1747
- id: { type: "string", required: true, description: "Strategy id" }
2034
+ var societyRehire = def(
2035
+ "society",
2036
+ "rehire",
2037
+ {
2038
+ individual: { type: "string", required: true, description: "Individual id (from past)" }
1748
2039
  },
1749
- ["product", "content", "id"]
2040
+ ["individual"]
1750
2041
  );
1751
- var productSpec = def(
1752
- "product",
1753
- "spec",
2042
+ var societyTeach = def(
2043
+ "society",
2044
+ "teach",
1754
2045
  {
1755
- product: { type: "string", required: true, description: "Product id" },
2046
+ individual: { type: "string", required: true, description: "Individual id" },
1756
2047
  content: {
1757
2048
  type: "gherkin",
1758
2049
  required: true,
1759
- description: "Gherkin Feature source for the behavior contract (BDD specification)"
2050
+ description: "Gherkin Feature source for the principle"
1760
2051
  },
1761
2052
  id: {
1762
2053
  type: "string",
1763
2054
  required: true,
1764
- description: "Spec id (keywords joined by hyphens)"
2055
+ description: "Principle id (keywords joined by hyphens)"
1765
2056
  }
1766
2057
  },
1767
- ["product", "content", "id"]
2058
+ ["individual", "content", "id"]
1768
2059
  );
1769
- var productRelease = def(
1770
- "product",
1771
- "release",
2060
+ var societyTrain = def(
2061
+ "society",
2062
+ "train",
1772
2063
  {
1773
- product: { type: "string", required: true, description: "Product id" },
2064
+ individual: { type: "string", required: true, description: "Individual id" },
1774
2065
  content: {
1775
2066
  type: "gherkin",
1776
2067
  required: true,
1777
- description: "Gherkin Feature source for the release"
2068
+ description: "Gherkin Feature source for the procedure"
1778
2069
  },
1779
2070
  id: {
1780
2071
  type: "string",
1781
2072
  required: true,
1782
- description: "Release id (e.g. v1.0.0)"
2073
+ description: "Procedure id (keywords joined by hyphens)"
1783
2074
  }
1784
2075
  },
1785
- ["product", "content", "id"]
2076
+ ["individual", "content", "id"]
1786
2077
  );
1787
- var productChannel = def(
1788
- "product",
1789
- "channel",
2078
+ var societyFound = def(
2079
+ "society",
2080
+ "found",
1790
2081
  {
1791
- product: { type: "string", required: true, description: "Product id" },
1792
2082
  content: {
1793
2083
  type: "gherkin",
1794
- required: true,
1795
- description: "Gherkin Feature source for the distribution channel"
2084
+ required: false,
2085
+ description: "Gherkin Feature source for the organization"
1796
2086
  },
1797
- id: {
2087
+ id: { type: "string", required: true, description: "User-facing identifier (kebab-case)" },
2088
+ alias: { type: "string[]", required: false, description: "Alternative names" },
2089
+ admin: {
1798
2090
  type: "string",
1799
- required: true,
1800
- description: "Channel id (e.g. npm, cloud-platform)"
2091
+ required: false,
2092
+ description: "Individual id of the first admin"
1801
2093
  }
1802
2094
  },
1803
- ["product", "content", "id"]
1804
- );
1805
- var productOwn = def(
1806
- "product",
1807
- "own",
1808
- {
1809
- product: { type: "string", required: true, description: "Product id" },
1810
- individual: { type: "string", required: true, description: "Individual id (owner)" }
1811
- },
1812
- ["product", "individual"]
1813
- );
1814
- var productDisown = def(
1815
- "product",
1816
- "disown",
1817
- {
1818
- product: { type: "string", required: true, description: "Product id" },
1819
- individual: { type: "string", required: true, description: "Individual id (owner to remove)" }
1820
- },
1821
- ["product", "individual"]
2095
+ ["content", "id", "alias", "admin"]
1822
2096
  );
1823
- var productDeprecate = def(
1824
- "product",
1825
- "deprecate",
2097
+ var societyDissolve = def(
2098
+ "society",
2099
+ "dissolve",
1826
2100
  {
1827
- product: { type: "string", required: true, description: "Product id" }
2101
+ org: { type: "string", required: true, description: "Organization id" }
1828
2102
  },
1829
- ["product"]
2103
+ ["org"]
1830
2104
  );
1831
2105
  var societyCrown = def(
1832
2106
  "society",
@@ -1844,6 +2118,8 @@ var societyUncrown = def(
1844
2118
  },
1845
2119
  ["individual"]
1846
2120
  );
2121
+
2122
+ // src/instructions/index.ts
1847
2123
  var censusList = def(
1848
2124
  "census",
1849
2125
  "list",
@@ -1864,174 +2140,6 @@ var prototypeEvict = def(
1864
2140
  },
1865
2141
  ["id"]
1866
2142
  );
1867
- var resourceAdd = def(
1868
- "resource",
1869
- "add",
1870
- {
1871
- path: { type: "string", required: true, description: "Path to resource directory" }
1872
- },
1873
- ["path"]
1874
- );
1875
- var resourceSearch = def(
1876
- "resource",
1877
- "search",
1878
- {
1879
- query: { type: "string", required: false, description: "Search query" }
1880
- },
1881
- ["query"]
1882
- );
1883
- var resourceHas = def(
1884
- "resource",
1885
- "has",
1886
- {
1887
- locator: { type: "string", required: true, description: "Resource locator" }
1888
- },
1889
- ["locator"]
1890
- );
1891
- var resourceInfo = def(
1892
- "resource",
1893
- "info",
1894
- {
1895
- locator: { type: "string", required: true, description: "Resource locator" }
1896
- },
1897
- ["locator"]
1898
- );
1899
- var resourceRemove = def(
1900
- "resource",
1901
- "remove",
1902
- {
1903
- locator: { type: "string", required: true, description: "Resource locator" }
1904
- },
1905
- ["locator"]
1906
- );
1907
- var resourcePush = def(
1908
- "resource",
1909
- "push",
1910
- {
1911
- locator: { type: "string", required: true, description: "Resource locator" },
1912
- registry: { type: "string", required: false, description: "Registry URL (overrides default)" }
1913
- },
1914
- ["locator", { pack: ["registry"] }]
1915
- );
1916
- var resourcePull = def(
1917
- "resource",
1918
- "pull",
1919
- {
1920
- locator: { type: "string", required: true, description: "Resource locator" },
1921
- registry: { type: "string", required: false, description: "Registry URL (overrides default)" }
1922
- },
1923
- ["locator", { pack: ["registry"] }]
1924
- );
1925
- var resourceClearCache = def(
1926
- "resource",
1927
- "clearCache",
1928
- {
1929
- registry: { type: "string", required: false, description: "Registry to clear cache for" }
1930
- },
1931
- ["registry"]
1932
- );
1933
- var issuePublish = def(
1934
- "issue",
1935
- "publish",
1936
- {
1937
- title: { type: "string", required: true, description: "Issue title" },
1938
- body: { type: "string", required: true, description: "Issue body/description" },
1939
- author: { type: "string", required: true, description: "Author individual id" },
1940
- assignee: { type: "string", required: false, description: "Assignee individual id" }
1941
- },
1942
- ["title", "body", "author", "assignee"]
1943
- );
1944
- var issueGet = def(
1945
- "issue",
1946
- "get",
1947
- {
1948
- number: { type: "number", required: true, description: "Issue number" }
1949
- },
1950
- ["number"]
1951
- );
1952
- var issueList = def(
1953
- "issue",
1954
- "list",
1955
- {
1956
- status: { type: "string", required: false, description: "Filter by status (open/closed)" },
1957
- author: { type: "string", required: false, description: "Filter by author" },
1958
- assignee: { type: "string", required: false, description: "Filter by assignee" },
1959
- label: { type: "string", required: false, description: "Filter by label name" }
1960
- },
1961
- ["status", "author", "assignee", "label"]
1962
- );
1963
- var issueUpdate = def(
1964
- "issue",
1965
- "update",
1966
- {
1967
- number: { type: "number", required: true, description: "Issue number" },
1968
- title: { type: "string", required: false, description: "New title" },
1969
- body: { type: "string", required: false, description: "New body" },
1970
- assignee: { type: "string", required: false, description: "New assignee" }
1971
- },
1972
- ["number", "title", "body", "assignee"]
1973
- );
1974
- var issueClose = def(
1975
- "issue",
1976
- "close",
1977
- {
1978
- number: { type: "number", required: true, description: "Issue number to close" }
1979
- },
1980
- ["number"]
1981
- );
1982
- var issueReopen = def(
1983
- "issue",
1984
- "reopen",
1985
- {
1986
- number: { type: "number", required: true, description: "Issue number to reopen" }
1987
- },
1988
- ["number"]
1989
- );
1990
- var issueAssign = def(
1991
- "issue",
1992
- "assign",
1993
- {
1994
- number: { type: "number", required: true, description: "Issue number" },
1995
- assignee: { type: "string", required: true, description: "Individual id to assign" }
1996
- },
1997
- ["number", "assignee"]
1998
- );
1999
- var issueComment = def(
2000
- "issue",
2001
- "comment",
2002
- {
2003
- number: { type: "number", required: true, description: "Issue number" },
2004
- body: { type: "string", required: true, description: "Comment body" },
2005
- author: { type: "string", required: true, description: "Author individual id" }
2006
- },
2007
- ["number", "body", "author"]
2008
- );
2009
- var issueComments = def(
2010
- "issue",
2011
- "comments",
2012
- {
2013
- number: { type: "number", required: true, description: "Issue number" }
2014
- },
2015
- ["number"]
2016
- );
2017
- var issueLabel = def(
2018
- "issue",
2019
- "label",
2020
- {
2021
- number: { type: "number", required: true, description: "Issue number" },
2022
- label: { type: "string", required: true, description: "Label name" }
2023
- },
2024
- ["number", "label"]
2025
- );
2026
- var issueUnlabel = def(
2027
- "issue",
2028
- "unlabel",
2029
- {
2030
- number: { type: "number", required: true, description: "Issue number" },
2031
- label: { type: "string", required: true, description: "Label name to remove" }
2032
- },
2033
- ["number", "label"]
2034
- );
2035
2143
  var instructions = {
2036
2144
  // society — individual lifecycle + org lifecycle
2037
2145
  "society.born": societyBorn,
@@ -2062,15 +2170,16 @@ var instructions = {
2062
2170
  "org.fire": orgFire,
2063
2171
  "org.admin": orgAdmin,
2064
2172
  "org.unadmin": orgUnadmin,
2173
+ "org.launch": orgLaunch,
2174
+ "org.archive": orgArchive,
2175
+ "org.establish": orgEstablish,
2176
+ "org.abolish": orgAbolish,
2065
2177
  // position
2066
- "position.establish": positionEstablish,
2067
2178
  "position.charge": positionCharge,
2068
2179
  "position.require": positionRequire,
2069
- "position.abolish": positionAbolish,
2070
2180
  "position.appoint": positionAppoint,
2071
2181
  "position.dismiss": positionDismiss,
2072
2182
  // project
2073
- "project.launch": projectLaunch,
2074
2183
  "project.scope": projectScope,
2075
2184
  "project.milestone": projectMilestone,
2076
2185
  "project.achieve": projectAchieve,
@@ -2078,7 +2187,6 @@ var instructions = {
2078
2187
  "project.remove": projectRemove,
2079
2188
  "project.deliver": projectDeliver,
2080
2189
  "project.wiki": projectWiki,
2081
- "project.archive": projectArchive,
2082
2190
  "project.produce": projectProduce,
2083
2191
  "project.maintain": projectMaintain,
2084
2192
  "project.unmaintain": projectUnmaintain,
@@ -2180,7 +2288,7 @@ function matches(node, target) {
2180
2288
  }
2181
2289
  return false;
2182
2290
  }
2183
- function findInState(state, target) {
2291
+ function findInState2(state, target) {
2184
2292
  const lowered = target.toLowerCase();
2185
2293
  let best = null;
2186
2294
  let bestPriority = Infinity;
@@ -2251,10 +2359,10 @@ var world = {
2251
2359
  Given org commands manage organization membership and governance
2252
2360
  And !org.hire adds a member, !org.fire removes a member, !org.charter defines governance
2253
2361
  Given position commands manage positions
2254
- Then !position.establish creates, !position.abolish archives
2362
+ Then !org.establish creates, !org.abolish archives
2255
2363
  And !position.appoint assigns, !position.dismiss removes, !position.charge adds duty
2256
2364
  Given project commands manage projects
2257
- Then !project.launch creates, !project.archive archives
2365
+ Then !org.launch creates, !org.archive archives
2258
2366
  `,
2259
2367
  communication: `Feature: Communication \u2014 speak the user's language
2260
2368
  The AI communicates in the user's natural language.
@@ -2521,12 +2629,12 @@ Feature: Role identity \u2014 activate before acting
2521
2629
  };
2522
2630
  var processes = {
2523
2631
  abandon: "Feature: abandon \u2014 abandon a plan\n Mark a plan as dropped and create an encounter.\n Call this when a plan's strategy is no longer viable. Even failed plans produce learning.\n\n Scenario: Abandon a plan\n Given a focused plan exists\n And the plan's strategy is no longer viable\n When abandon is called\n Then the plan is tagged #abandoned and stays in the tree\n And an encounter is created under the role\n And the encounter can be reflected on \u2014 failure is also learning\n\n Scenario: Writing the encounter Gherkin\n Given the encounter records what happened \u2014 even failure is a raw experience\n Then the Feature title describes what was attempted and why it was abandoned\n And Scenarios capture what was tried, what went wrong, and what was learned\n And the tone is concrete and honest \u2014 failure produces the richest encounters\n",
2524
- abolish: "Feature: abolish \u2014 abolish a position\n Move a position to the past archive.\n The position and its subtree (duties, requirements) are archived, not deleted.\n\n Scenario: Abolish a position\n Given a position exists in society\n When abolish is called on the position\n Then the position is moved to the past archive\n And the position's subtree (duties, requirements) is preserved in past\n\n Scenario: Parameters\n Given the command is position.abolish\n Then position is required \u2014 the position's id\n",
2632
+ abolish: "Feature: abolish \u2014 abolish a position\n Move a position to the past archive.\n The position and its subtree (duties, requirements) are archived, not deleted.\n\n Scenario: Abolish a position\n Given a position exists in society\n When abolish is called on the position\n Then the position is moved to the past archive\n And the position's subtree (duties, requirements) is preserved in past\n\n Scenario: Parameters\n Given the command is org.abolish\n Then position is required \u2014 the position's id\n",
2525
2633
  achieve: "Feature: achieve \u2014 mark a milestone as done\n Mark a project milestone as achieved.\n The milestone is completed and its status is updated.\n\n Scenario: Achieve a milestone\n Given a milestone exists within a project\n When achieve is called on the milestone\n Then the milestone is marked as done\n\n Scenario: Parameters\n Given the command is project.achieve\n Then milestone is required \u2014 the milestone's id\n",
2526
2634
  activate: "Feature: activate \u2014 enter a role\n Project the individual's full state including identity, goals,\n and organizational context. This is the entry point for working as a role.\n\n Scenario: Activate an individual\n Given an individual exists in society\n When activate is called with the individual reference\n Then the full state tree is projected\n And identity, goals, and organizational context are loaded\n And the individual becomes the active role\n",
2527
2635
  admin: "Feature: admin \u2014 set organization administrator\n Grant admin privileges to an individual within an organization.\n Admins can manage charter, membership, positions, and projects.\n\n Scenario: Set an admin\n Given an individual is a member of an organization\n When admin is called with the organization and individual\n Then the individual gains admin privileges for the organization\n And the individual can manage positions, projects, and membership\n\n Scenario: Parameters\n Given the command is org.admin\n Then org is required \u2014 the organization's id\n And individual is required \u2014 the individual's id\n",
2528
2636
  appoint: "Feature: appoint \u2014 assign to a position\n Appoint an individual to a position.\n The individual must be a member of the organization.\n\n Scenario: Appoint an individual\n Given an individual is a member of an organization\n And a position exists within the organization\n When appoint is called with the position and individual\n Then the individual holds the position\n And the individual inherits the position's duties\n\n Scenario: Parameters\n Given the command is position.appoint\n Then position is required \u2014 the position's id\n And individual is required \u2014 the individual's id\n",
2529
- archive: "Feature: archive \u2014 archive a project\n Move a project to the past archive.\n The project and its subtree (scope, milestones, deliverables, wiki) are preserved.\n\n Scenario: Archive a project\n Given a project exists in society\n When archive is called on the project\n Then the project is moved to the past archive\n And the project's subtree is preserved in past\n\n Scenario: Parameters\n Given the command is project.archive\n Then project is required \u2014 the project's id\n",
2637
+ archive: "Feature: archive \u2014 archive a project\n Move a project to the past archive.\n The project and its subtree (scope, milestones, deliverables, wiki) are preserved.\n\n Scenario: Archive a project\n Given a project exists in society\n When archive is called on the project\n Then the project is moved to the past archive\n And the project's subtree is preserved in past\n\n Scenario: Parameters\n Given the command is org.archive\n Then project is required \u2014 the project's id\n",
2530
2638
  born: 'Feature: born \u2014 create a new individual\n Create a new individual with persona identity.\n The persona defines who the role is \u2014 personality, values, background.\n An identity node is automatically created under the individual.\n\n Scenario: Birth an individual\n Given a Gherkin source describing the persona\n When born is called with the source\n Then a new individual node is created in society\n And an identity child node is created automatically\n And the individual can be hired into organizations\n And the individual can be activated to start working\n\n Scenario: Parameters\n Given the command is society.born\n Then content is optional \u2014 Gherkin Feature describing the persona\n And id is optional \u2014 kebab-case identifier (e.g. "sean")\n And alias is optional \u2014 alternative names (e.g. ["\u5C0F\u660E", "xm"])\n\n Scenario: Writing the individual Gherkin\n Given the individual Feature defines a persona \u2014 who this role is\n Then the Feature title names the individual\n And the description captures personality, values, expertise, and background\n And Scenarios are optional \u2014 use them for distinct aspects of the persona\n',
2531
2639
  channel: "Feature: channel \u2014 define a distribution channel\n Define a distribution channel for a product.\n Channels describe how the product reaches its users.\n\n Scenario: Define a channel\n Given a product exists in society\n And a Gherkin source describing the distribution channel\n When channel is called on the product with a channel id\n Then the channel is stored as the product's information\n\n Scenario: Parameters\n Given the command is product.channel\n Then product is required \u2014 the product's id\n And content is required \u2014 Gherkin Feature source for the distribution channel\n And id is required \u2014 channel id (e.g. npm, cloud-platform)\n\n Scenario: Writing the channel Gherkin\n Given the channel defines how the product is distributed\n Then the Feature title names the channel\n And Scenarios describe distribution mechanics, access, and availability\n And the tone is operational \u2014 how users get the product\n",
2532
2640
  charge: `Feature: charge \u2014 assign duty to a position
@@ -2567,7 +2675,7 @@ var processes = {
2567
2675
  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",
2568
2676
  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",
2569
2677
  enroll: "Feature: enroll \u2014 add participant to a project\n Enroll an individual as a participant in a project.\n Participants can contribute to the project's work.\n\n Scenario: Enroll an individual\n Given a project and an individual exist\n When enroll is called with the project and individual\n Then the individual becomes a participant in the project\n\n Scenario: Parameters\n Given the command is project.enroll\n Then project is required \u2014 the project's id\n And individual is required \u2014 the individual's id\n",
2570
- establish: 'Feature: establish \u2014 create a position\n Create a position in society.\n Positions define roles with duties and skill requirements.\n Individuals can be appointed to positions.\n\n Scenario: Establish a position\n Given a Gherkin source describing the position\n When establish is called with the source\n Then a new position node is created in society\n And the position can be charged with duties\n And skill requirements can be added\n And individuals can be appointed to it\n\n Scenario: Parameters\n Given the command is position.establish\n Then content is optional \u2014 Gherkin Feature describing the position\n And id is optional \u2014 kebab-case identifier (e.g. "cto")\n And alias is optional \u2014 alternative names\n\n Scenario: Writing the position Gherkin\n Given the position Feature describes a role\n Then the Feature title names the position\n And the description captures responsibilities, scope, and expectations\n And Scenarios are optional \u2014 use them for distinct aspects of the role\n',
2678
+ establish: 'Feature: establish \u2014 create a position\n Create a position in society.\n Positions define roles with duties and skill requirements.\n Individuals can be appointed to positions.\n\n Scenario: Establish a position\n Given a Gherkin source describing the position\n When establish is called with the source\n Then a new position node is created in society\n And the position can be charged with duties\n And skill requirements can be added\n And individuals can be appointed to it\n\n Scenario: Parameters\n Given the command is org.establish\n Then content is optional \u2014 Gherkin Feature describing the position\n And id is optional \u2014 kebab-case identifier (e.g. "cto")\n And alias is optional \u2014 alternative names\n\n Scenario: Writing the position Gherkin\n Given the position Feature describes a role\n Then the Feature title names the position\n And the description captures responsibilities, scope, and expectations\n And Scenarios are optional \u2014 use them for distinct aspects of the role\n',
2571
2679
  finish: "Feature: finish \u2014 complete a task\n Mark a task as done and create an encounter.\n The encounter records what happened and can be reflected on for learning.\n\n Scenario: Finish a task\n Given a task exists\n When finish is called on the task\n Then the task is tagged #done and stays in the tree\n And an encounter is created under the role\n\n Scenario: Finish with experience\n Given a task is completed with a notable learning\n When finish is called with an optional experience parameter\n Then the experience text is attached to the encounter\n\n Scenario: Finish without encounter\n Given a task is completed with no notable learning\n When finish is called without the encounter parameter\n Then the task is tagged #done but no encounter is created\n And the task stays in the tree \u2014 visible via focus on the parent goal\n\n Scenario: Writing the encounter Gherkin\n Given the encounter records what happened \u2014 a raw account of the experience\n Then the Feature title describes what was done\n And Scenarios capture what was done, what was encountered, and what resulted\n And the tone is concrete and specific \u2014 tied to this particular task\n",
2572
2680
  fire: "Feature: fire \u2014 remove from an organization\n Fire an individual from an organization.\n The individual is dismissed from all positions and removed from the organization.\n\n Scenario: Fire an individual\n Given an individual is a member of an organization\n When fire is called with the organization and individual\n Then the individual is dismissed from all positions\n And the individual is removed from the organization\n\n Scenario: Parameters\n Given the command is org.fire\n Then org is required \u2014 the organization's id\n And individual is required \u2014 the individual's id\n",
2573
2681
  focus: "Feature: focus \u2014 view or switch focused goal\n View the current goal's state, or switch focus to a different goal.\n Subsequent plan and todo operations target the focused goal.\n Only goal ids are accepted \u2014 plan, task, or other node types are rejected.\n\n Scenario: View current goal\n Given an active goal exists\n When focus is called without a name\n Then the current goal's state tree is projected\n And plans and tasks under the goal are visible\n\n Scenario: Switch focus\n Given multiple goals exist\n When focus is called with a goal id\n Then the focused goal switches to the named goal\n And subsequent plan and todo operations target this goal\n\n Scenario: Reject non-goal ids\n Given a plan or task id is passed to focus\n Then focus returns an error indicating the node type\n And suggests using the correct goal id instead\n",
@@ -2598,7 +2706,7 @@ var processes = {
2598
2706
  `,
2599
2707
  hire: "Feature: hire \u2014 hire into an organization\n Hire an individual into an organization as a member.\n Members can then be appointed to positions.\n\n Scenario: Hire an individual\n Given an organization and an individual exist\n When hire is called with the organization and individual\n Then the individual becomes a member of the organization\n And the individual can be appointed to positions within the organization\n\n Scenario: Parameters\n Given the command is org.hire\n Then org is required \u2014 the organization's id\n And individual is required \u2014 the individual's id\n",
2600
2708
  inspect: "Feature: inspect \u2014 examine any node's full state tree\n Project a node's complete subtree including children and links.\n Works without an active role \u2014 a stateless observation tool.\n\n Scenario: Inspect a node\n Given a node id is provided\n When inspect is called with the id\n Then the full state tree is projected from that node downward\n And output uses heading + Gherkin format (same as activate)\n",
2601
- launch: 'Feature: launch \u2014 create a new project\n Launch a new project in society.\n Projects organize work with scope, milestones, deliverables, and wiki.\n A project can optionally be linked to an owning organization.\n\n Scenario: Launch a project\n Given a Gherkin source describing the project\n When launch is called with the source\n Then a new project node is created in society\n And scope, milestones, deliverables, and wiki can be added\n And individuals can be enrolled as participants\n And products can be produced from the project\n\n Scenario: Parameters\n Given the command is project.launch\n Then content is optional \u2014 Gherkin Feature describing the project\n And id is optional \u2014 kebab-case identifier (e.g. "rolex")\n And alias is optional \u2014 alternative names\n And org is optional \u2014 owning organization id, creates an ownership link\n\n Scenario: Writing the project Gherkin\n Given the project Feature describes the work to be done\n Then the Feature title names the project\n And the description captures goals, scope, and context\n And Scenarios are optional \u2014 use them for distinct project concerns\n',
2709
+ launch: 'Feature: launch \u2014 create a new project\n Launch a new project in society.\n Projects organize work with scope, milestones, deliverables, and wiki.\n A project can optionally be linked to an owning organization.\n\n Scenario: Launch a project\n Given a Gherkin source describing the project\n When launch is called with the source\n Then a new project node is created in society\n And scope, milestones, deliverables, and wiki can be added\n And individuals can be enrolled as participants\n And products can be produced from the project\n\n Scenario: Parameters\n Given the command is org.launch\n Then content is optional \u2014 Gherkin Feature describing the project\n And id is optional \u2014 kebab-case identifier (e.g. "rolex")\n And alias is optional \u2014 alternative names\n And org is optional \u2014 owning organization id, creates an ownership link\n\n Scenario: Writing the project Gherkin\n Given the project Feature describes the work to be done\n Then the Feature title names the project\n And the description captures goals, scope, and context\n And Scenarios are optional \u2014 use them for distinct project concerns\n',
2602
2710
  maintain: "Feature: maintain \u2014 set project maintainer\n Assign a maintainer to a project.\n Maintainers can manage scope, milestones, participants, deliverables, and wiki.\n\n Scenario: Set a maintainer\n Given an individual and a project exist\n When maintain is called with the project and individual\n Then the individual becomes a maintainer of the project\n And the individual can manage the project's internal operations\n\n Scenario: Parameters\n Given the command is project.maintain\n Then project is required \u2014 the project's id\n And individual is required \u2014 the individual's id\n",
2603
2711
  master: 'Feature: master \u2014 self-mastery of a procedure\n The role masters a procedure through its own agency.\n This is an act of self-growth \u2014 the role decides to acquire or codify a skill.\n Experience can be consumed as the source, or the role can master directly from external information.\n\n Scenario: Master from experience\n Given an experience exists from reflection\n When master is called with experience ids\n Then the experience is consumed\n And a procedure is created under the individual\n\n Scenario: Master directly\n Given the role encounters external information worth mastering\n When master is called without experience ids\n Then a procedure is created under the individual\n And no experience is consumed\n\n Scenario: Procedure ID convention\n Given the id is keywords from the procedure content joined by hyphens\n Then "JWT mastery" becomes id "jwt-mastery"\n And "Cross-package refactoring" becomes id "cross-package-refactoring"\n\n Scenario: Writing the procedure Gherkin\n Given a procedure is skill metadata \u2014 a reference to full skill content\n Then the Feature title names the capability\n And the description includes the locator for full skill loading\n And Scenarios describe when and why to apply this skill\n And the tone is referential \u2014 pointing to the full skill, not containing it\n',
2604
2712
  milestone: "Feature: milestone \u2014 define a project milestone\n Define a milestone for a project.\n Milestones mark significant checkpoints or deliverable targets within the project.\n\n Scenario: Define a milestone\n Given a project exists in society\n And a Gherkin source describing the milestone\n When milestone is called on the project with a milestone id\n Then the milestone is stored as the project's information\n And the milestone can later be achieved\n\n Scenario: Parameters\n Given the command is project.milestone\n Then project is required \u2014 the project's id\n And content is required \u2014 Gherkin Feature source for the milestone\n And id is required \u2014 milestone id (keywords joined by hyphens)\n\n Scenario: Writing the milestone Gherkin\n Given the milestone defines a checkpoint in the project\n Then the Feature title names the milestone\n And Scenarios describe success criteria and acceptance conditions\n And the tone is goal-oriented \u2014 what must be true when the milestone is reached\n",
@@ -2744,16 +2852,20 @@ var orgAdminPermissions = [
2744
2852
  p("org.charter", "charter"),
2745
2853
  p("org.hire", "hire"),
2746
2854
  p("org.fire", "fire"),
2855
+ p("org.admin", "admin"),
2856
+ p("org.unadmin", "unadmin"),
2747
2857
  // Position lifecycle (org creates positions)
2748
- p("position.establish", "establish"),
2749
- p("position.abolish", "abolish"),
2858
+ p("org.establish", "establish"),
2859
+ p("org.abolish", "abolish"),
2750
2860
  p("position.charge", "charge"),
2751
2861
  p("position.require", "require"),
2752
2862
  p("position.appoint", "appoint"),
2753
2863
  p("position.dismiss", "dismiss"),
2754
2864
  // Project lifecycle (org creates projects)
2755
- p("project.launch", "launch"),
2756
- p("project.archive", "archive")
2865
+ p("org.launch", "launch"),
2866
+ p("org.archive", "archive"),
2867
+ p("project.maintain", "maintain"),
2868
+ p("project.unmaintain", "unmaintain")
2757
2869
  ];
2758
2870
 
2759
2871
  // src/permissions/product-owner.ts
@@ -2766,7 +2878,9 @@ var productOwnerPermissions = [
2766
2878
  p2("product.spec", "spec"),
2767
2879
  p2("product.release", "release"),
2768
2880
  p2("product.channel", "channel"),
2769
- p2("product.deprecate", "deprecate")
2881
+ p2("product.deprecate", "deprecate"),
2882
+ p2("product.own", "own"),
2883
+ p2("product.disown", "disown")
2770
2884
  ];
2771
2885
 
2772
2886
  // src/permissions/project-maintainer.ts
@@ -2782,7 +2896,9 @@ var projectMaintainerPermissions = [
2782
2896
  p3("project.remove", "remove"),
2783
2897
  p3("project.deliver", "deliver"),
2784
2898
  p3("project.wiki", "wiki"),
2785
- p3("project.produce", "produce")
2899
+ p3("project.produce", "produce"),
2900
+ p3("product.own", "own"),
2901
+ p3("product.disown", "disown")
2786
2902
  ];
2787
2903
 
2788
2904
  // src/permissions/registry.ts
@@ -2840,36 +2956,22 @@ function createProjection(rt, permissions) {
2840
2956
  return permissions.enrich(compacted);
2841
2957
  };
2842
2958
  }
2843
- var compactRelations = /* @__PURE__ */ new Set([
2844
- "crowned",
2845
- "belong",
2846
- "appointment",
2847
- "administer",
2848
- "maintained-by",
2849
- "own"
2850
- ]);
2851
2959
  function compact(state) {
2852
2960
  const { children, links, ...node } = state;
2853
2961
  return node;
2854
2962
  }
2855
2963
  function compactState(state, depth) {
2856
2964
  const children = depth > 0 ? state.children?.map((c) => compactState(c, depth - 1)) : state.children?.map((c) => compact(c));
2857
- const compactedLinks = state.links?.map(
2858
- (l) => compactRelations.has(l.relation) ? { ...l, target: compact(l.target) } : { ...l, target: compactLinkedTarget(l.target) }
2859
- );
2965
+ const compactedLinks = state.links?.map((l) => ({
2966
+ ...l,
2967
+ target: compact(l.target)
2968
+ }));
2860
2969
  return {
2861
2970
  ...state,
2862
2971
  ...children ? { children } : {},
2863
2972
  ...compactedLinks ? { links: compactedLinks } : {}
2864
2973
  };
2865
2974
  }
2866
- function compactLinkedTarget(state) {
2867
- const children = state.children?.map((c) => compactLinkedTarget(c));
2868
- return {
2869
- ...state,
2870
- ...children ? { children } : {}
2871
- };
2872
- }
2873
2975
 
2874
2976
  // src/rolex-service.ts
2875
2977
  var RoleXService = class _RoleXService {
@@ -3054,7 +3156,7 @@ You may be guessing the command name. Load the relevant skill first with skill(l
3054
3156
  /** Find a node by id across the entire society tree (raw, no pipeline). */
3055
3157
  async find(id) {
3056
3158
  const raw = await this.rt.project(this.society);
3057
- return findInState(raw, id);
3159
+ return findInState2(raw, id);
3058
3160
  }
3059
3161
  };
3060
3162
  function isCommandResult(value) {
@@ -3356,7 +3458,7 @@ export {
3356
3458
  enroll,
3357
3459
  establish,
3358
3460
  experience,
3359
- findInState,
3461
+ findInState2 as findInState,
3360
3462
  finish,
3361
3463
  fire,
3362
3464
  found,