@simetrajs/designer 0.2.0 → 0.3.0-next.2

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/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "./package-Dg3MXPve.js";
3
- import { n as TOOL_NAMES } from "./types-iWavtmdS.js";
2
+ import { t as version } from "./package-CN8Tgd0H.js";
3
+ import { n as TOOL_NAMES } from "./types-CMcZhIci.js";
4
4
  import { defineCommand, runCommand, runMain, showUsage } from "citty";
5
5
  // src/main.ts
6
6
  const main = defineCommand({
@@ -10,8 +10,8 @@ const main = defineCommand({
10
10
  description: "Simetra metadata tooling"
11
11
  },
12
12
  subCommands: {
13
- ...Object.fromEntries(TOOL_NAMES.map((name) => [name, () => import("./command-BCAw6Fsb.js").then((m) => m.commandByName(name))])),
14
- mcp: () => import("./mcp-ChltmHBb.js").then((m) => m.default),
13
+ ...Object.fromEntries(TOOL_NAMES.map((name) => [name, () => import("./command-W8Mnvc9E.js").then((m) => m.commandByName(name))])),
14
+ mcp: () => import("./mcp-DYYIww-s.js").then((m) => m.default),
15
15
  init: () => import("./init-jr0Xsrpp.js").then((m) => m.default)
16
16
  }
17
17
  });
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { a as invoke, c as summarizeData, f as checkEnvName, h as databaseResource, i as renderPlan, l as toJson, m as parseDataLaunch, n as renderApply, o as TOOLS, p as dataResource, r as renderDiff, t as formatDiagnostics } from "./report-DV4deFdu.js";
2
+ import { d as parseDataLaunch, f as databaseResource, i as structureOf, l as checkEnvName, n as TOOLS, o as formatDiagnostics, r as presentation, t as invoke, u as dataResource } from "./invoke-DLCOtVpB.js";
3
3
  import { a as dataWriteHint, l as readOnlyHint, n as trimSlash, o as databaseWriteHint, p as UsageError, r as ALLOW_RIGHTS_WRITE_FLAG } from "./default-dir-DerxTbci.js";
4
- import { t as version } from "./package-Dg3MXPve.js";
4
+ import { t as version } from "./package-CN8Tgd0H.js";
5
5
  import { t as mcpArgs } from "./mcp-args-D63akJ97.js";
6
6
  import { defineCommand } from "citty";
7
7
  import { z } from "zod";
@@ -36,7 +36,7 @@ function lineFor(c, written) {
36
36
  return `${c.deleted ? "would delete" : "would write"} ${c.path}`;
37
37
  }
38
38
  function toResponse(tool, result, o, dry) {
39
- const { ok, written, changes, diagnostics, refusal } = result;
39
+ const { ok, written, wouldWrite, changes, diagnostics, refusal, artifacts } = result;
40
40
  if (refusal !== void 0) return {
41
41
  isError: true,
42
42
  structuredContent: {
@@ -54,110 +54,52 @@ function toResponse(tool, result, o, dry) {
54
54
  text: refusal.message
55
55
  }]
56
56
  };
57
- if ((tool.name === "data-read" || tool.name === "data-command") && result.data !== void 0) {
58
- const data = result.data;
59
- return {
60
- isError: !ok,
61
- structuredContent: {
62
- ok,
63
- diagnostics,
64
- ...toJson(data)
65
- },
66
- content: [{
67
- type: "text",
68
- text: summarizeData(tool.name, data)
69
- }]
70
- };
71
- }
72
- if (tool.name === "explain" && ok && result.data !== void 0) return {
73
- structuredContent: { ...result.data },
74
- content: [{
75
- type: "text",
76
- text: JSON.stringify(result.data, null, 2)
77
- }]
78
- };
79
57
  const report = formatDiagnostics(diagnostics, {
80
58
  dir: o.dir,
81
59
  locale: "en",
82
60
  format: "text"
83
61
  });
84
- if (tool.name === "diff" && result.data !== void 0) {
85
- const data = result.data;
86
- return {
87
- isError: !ok,
88
- structuredContent: {
89
- ok,
90
- written,
91
- changes,
92
- ...data
93
- },
94
- content: [{
95
- type: "text",
96
- text: renderDiff(data, report)
97
- }]
98
- };
99
- }
100
- if (tool.name === "plan") {
101
- const data = result.data;
102
- return {
103
- isError: !ok,
104
- structuredContent: {
105
- ok,
106
- written,
107
- artifacts: result.artifacts ?? [],
108
- diagnostics,
109
- ...data
110
- },
111
- content: [{
112
- type: "text",
113
- text: renderPlan(data, report, {
114
- ok,
115
- written
116
- })
117
- }]
118
- };
119
- }
120
- if (tool.name === "apply") {
121
- const data = result.data;
122
- return {
123
- isError: !ok,
124
- structuredContent: {
125
- ok,
126
- written,
127
- artifacts: result.artifacts ?? [],
128
- diagnostics,
129
- ...data
130
- },
131
- content: [{
132
- type: "text",
133
- text: renderApply(data, diagnostics, report)
134
- }]
135
- };
136
- }
137
- const record = tool.name === "promote" ? result.data : void 0;
62
+ const view = {
63
+ channel: "mcp",
64
+ ok,
65
+ written,
66
+ diagnostics,
67
+ report
68
+ };
69
+ const present = tool.present;
70
+ const { shown, data: shownData } = presentation(tool, result);
71
+ if (present?.bare === true && shown) return {
72
+ structuredContent: { ...structureOf(tool, shownData) },
73
+ content: [{
74
+ type: "text",
75
+ text: present.text?.(shownData, view) ?? ""
76
+ }]
77
+ };
78
+ const text = shown ? present?.text?.(shownData, view) : void 0;
138
79
  const databaseFailed = diagnostics.some((d) => d.code === "database.failed");
139
80
  const databaseUnreadable = diagnostics.some((d) => d.code === "engine.owner-not-member");
140
81
  const lines = ok ? [
141
82
  ...changes.map((c) => lineFor(c, written)),
142
83
  ...dry && tool.files === "write" ? ["dry run: nothing written"] : [],
143
84
  ...tool.files === "read" ? [`${tool.name}: no errors`] : []
144
- ] : databaseFailed ? [`${tool.files === "write" ? "nothing written" : tool.name}: the database work failed`] : databaseUnreadable ? [`${tool.name}: the database has objects the engine cannot read`] : tool.files === "write" ? ["nothing written: the operation was refused or the result has errors"] : [`${tool.name}: the metadata has errors`];
85
+ ] : databaseFailed ? [`${tool.files === "write" ? "nothing written" : tool.name}: the database work failed`] : databaseUnreadable ? [`${tool.name}: the database has objects the engine cannot read`] : tool.files === "write" ? [written ? "written: the result keeps only repair-class errors the directory already had" : wouldWrite === true ? "would write: the result keeps only repair-class errors the directory already had" : "nothing written: the operation was refused or the result has errors"] : [`${tool.name}: the metadata has errors`];
145
86
  return {
146
87
  isError: !ok,
147
88
  structuredContent: {
148
89
  ok,
149
90
  written,
91
+ ...wouldWrite === true ? { wouldWrite } : {},
150
92
  changes,
93
+ ...tool.files === "artifact" ? { artifacts: artifacts ?? [] } : {},
151
94
  diagnostics,
152
- ...tool.name === "introspect" && result.data !== void 0 ? result.data : {},
153
- ...record === void 0 ? {} : { record }
95
+ ...shownData !== void 0 ? structureOf(tool, shownData) : {}
154
96
  },
155
97
  content: [{
156
98
  type: "text",
157
- text: [
99
+ text: text ?? [
158
100
  ...lines,
159
101
  report,
160
- ...record === void 0 ? [] : ["promotion record:", JSON.stringify(record, null, 2)]
102
+ ...shownData !== void 0 && present?.appendix !== void 0 ? [present.appendix(shownData, view)] : []
161
103
  ].join("\n")
162
104
  }]
163
105
  };
@@ -188,7 +130,8 @@ function registerCatalog(server, o) {
188
130
  ...o.databaseEnv === void 0 ? {} : { databaseEnv: o.databaseEnv },
189
131
  ...o.data === void 0 ? {} : { data: o.data },
190
132
  ...o.dataEnv === void 0 ? {} : { dataEnv: o.dataEnv },
191
- launchArgs: o.launchArgs
133
+ launchArgs: o.launchArgs,
134
+ ...o.env === void 0 ? {} : { env: o.env }
192
135
  });
193
136
  return toResponse(tool, result, o, dry === true);
194
137
  });
@@ -252,7 +195,8 @@ function mcpOptionsFrom(args, env, argv) {
252
195
  databaseEnv,
253
196
  ...data === void 0 ? {} : { data },
254
197
  ...launch === void 0 ? {} : { dataEnv: launch.urlEnv },
255
- launchArgs: argv
198
+ launchArgs: argv,
199
+ env
256
200
  };
257
201
  }
258
202
  var mcp_default = defineCommand({
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  // package.json
3
- var version = "0.2.0";
3
+ var version = "0.3.0-next.2";
4
4
  export { version as t };