@amistio/cli 0.1.14 → 0.1.15

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
@@ -4385,6 +4385,8 @@ var appEvaluationStart = "AMISTIO_APP_EVALUATION_START";
4385
4385
  var appEvaluationEnd = "AMISTIO_APP_EVALUATION_END";
4386
4386
  var projectContextRefreshStart = "AMISTIO_PROJECT_CONTEXT_REFRESH_START";
4387
4387
  var projectContextRefreshEnd = "AMISTIO_PROJECT_CONTEXT_REFRESH_END";
4388
+ var validProjectContextEntityTypes = /* @__PURE__ */ new Set(["project", "system", "component", "domain", "tool", "decision", "feature", "risk", "team", "workflow", "unknown"]);
4389
+ var validProjectContextRelationTypes = /* @__PURE__ */ new Set(["uses", "depends_on", "decides", "supersedes", "touches", "blocks", "implements", "mentions"]);
4388
4390
  function createWorkExecutionPrompt(workItem, context) {
4389
4391
  if (workItem.workKind === "brainGeneration") {
4390
4392
  return createBrainGenerationPrompt(workItem);
@@ -4955,7 +4957,7 @@ function parseProjectContextRefreshResult(output) {
4955
4957
  }
4956
4958
  const payload = output.slice(start + projectContextRefreshStart.length, end).trim();
4957
4959
  const parsed = JSON.parse(stripJsonFence(payload));
4958
- return projectContextRefreshResultSchema.parse(parsed);
4960
+ return projectContextRefreshResultSchema.parse(normalizeProjectContextRefreshEnums(parsed));
4959
4961
  }
4960
4962
  function projectContextRefreshSubmissionFailureSummary(result) {
4961
4963
  if (result.refresh.status !== "failed" && result.workItem.status !== "failed") {
@@ -5019,6 +5021,50 @@ function createBrainGenerationPrompt(workItem) {
5019
5021
  "Do not put Markdown fences around the markers. Do not claim implementation is complete."
5020
5022
  ].join("\n");
5021
5023
  }
5024
+ function normalizeProjectContextRefreshEnums(value) {
5025
+ if (!isObjectRecord(value)) {
5026
+ return value;
5027
+ }
5028
+ const normalized = { ...value };
5029
+ if (Array.isArray(normalized.entities)) {
5030
+ normalized.entities = normalized.entities.map((entity) => {
5031
+ if (!isObjectRecord(entity)) {
5032
+ return entity;
5033
+ }
5034
+ const normalizedEntity = { ...entity };
5035
+ normalizedEntity.entityType = normalizeProjectContextEntityType(entity.entityType);
5036
+ return normalizedEntity;
5037
+ });
5038
+ }
5039
+ if (Array.isArray(normalized.relations)) {
5040
+ normalized.relations = normalized.relations.map((relation) => {
5041
+ if (!isObjectRecord(relation)) {
5042
+ return relation;
5043
+ }
5044
+ const normalizedRelation = { ...relation };
5045
+ normalizedRelation.relationType = normalizeProjectContextRelationType(relation.relationType);
5046
+ return normalizedRelation;
5047
+ });
5048
+ }
5049
+ return normalized;
5050
+ }
5051
+ function normalizeProjectContextEntityType(value) {
5052
+ if (typeof value !== "string") {
5053
+ return "unknown";
5054
+ }
5055
+ const normalized = value.trim().toLowerCase();
5056
+ return validProjectContextEntityTypes.has(normalized) ? normalized : "unknown";
5057
+ }
5058
+ function normalizeProjectContextRelationType(value) {
5059
+ if (typeof value !== "string") {
5060
+ return "mentions";
5061
+ }
5062
+ const normalized = value.trim().toLowerCase();
5063
+ return validProjectContextRelationTypes.has(normalized) ? normalized : "mentions";
5064
+ }
5065
+ function isObjectRecord(value) {
5066
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5067
+ }
5022
5068
  function artifactFormatPreferenceInstructions(preference) {
5023
5069
  if (preference === "html") {
5024
5070
  return "The user chose HTML. Generate .html artifacts under docs/html/<folder>/ and set contentFormat to html.";