semantic-atlas 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/.agents/skills/semantic-atlas/SKILL.md +3 -0
  2. package/.agents/skills/semantic-atlas/references/product-feedback.md +34 -0
  3. package/.agents/skills/semantic-atlas-insights/SKILL.md +55 -0
  4. package/README.md +203 -88
  5. package/README.zh-CN.md +181 -85
  6. package/dist/cli/argument-parser.js +9 -1
  7. package/dist/cli/bin.js +10 -2
  8. package/dist/cli/cli-application.d.ts +1 -0
  9. package/dist/cli/cli-application.d.ts.map +1 -1
  10. package/dist/cli/cli-application.js +64 -12
  11. package/dist/cli/insights-cli.d.ts +6 -0
  12. package/dist/cli/insights-cli.d.ts.map +1 -0
  13. package/dist/cli/insights-cli.js +236 -0
  14. package/dist/cli/main.d.ts.map +1 -1
  15. package/dist/cli/main.js +94 -2
  16. package/dist/cli/standalone-cli.d.ts.map +1 -1
  17. package/dist/cli/standalone-cli.js +36 -5
  18. package/dist/cli/types.d.ts +2 -0
  19. package/dist/cli/types.d.ts.map +1 -1
  20. package/dist/contracts/cli.d.ts +63 -0
  21. package/dist/contracts/cli.d.ts.map +1 -1
  22. package/dist/contracts/cli.js +7 -0
  23. package/dist/contracts/insights.d.ts +2 -0
  24. package/dist/contracts/insights.d.ts.map +1 -0
  25. package/dist/contracts/insights.js +1 -0
  26. package/dist/contracts/public-contracts.d.ts +1 -0
  27. package/dist/contracts/public-contracts.d.ts.map +1 -1
  28. package/dist/contracts/public-contracts.js +1 -0
  29. package/dist/insights/contracts.d.ts +266 -0
  30. package/dist/insights/contracts.d.ts.map +1 -0
  31. package/dist/insights/contracts.js +124 -0
  32. package/dist/insights/insights-store.d.ts +73 -0
  33. package/dist/insights/insights-store.d.ts.map +1 -0
  34. package/dist/insights/insights-store.js +246 -0
  35. package/dist/setup/package-upgrader.d.ts +54 -0
  36. package/dist/setup/package-upgrader.d.ts.map +1 -0
  37. package/dist/setup/package-upgrader.js +169 -0
  38. package/dist/setup/skill-installer.d.ts +3 -2
  39. package/dist/setup/skill-installer.d.ts.map +1 -1
  40. package/dist/setup/skill-installer.js +67 -36
  41. package/dist/storage/atlas-database.d.ts +1 -0
  42. package/dist/storage/atlas-database.d.ts.map +1 -1
  43. package/dist/storage/atlas-database.js +13 -6
  44. package/docs/contracts/cli-v1.md +25 -4
  45. package/docs/contracts/insights-v1.md +84 -0
  46. package/docs/index.md +2 -0
  47. package/docs/log.md +24 -0
  48. package/docs/product-contract.md +15 -8
  49. package/package.json +3 -1
  50. package/schemas/cli-envelope-v1.schema.json +85 -1
  51. package/schemas/insights-envelope-v1.schema.json +428 -0
@@ -0,0 +1,236 @@
1
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
2
+ if (value !== null && value !== void 0) {
3
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
+ var dispose, inner;
5
+ if (async) {
6
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
+ dispose = value[Symbol.asyncDispose];
8
+ }
9
+ if (dispose === void 0) {
10
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
+ dispose = value[Symbol.dispose];
12
+ if (async) inner = dispose;
13
+ }
14
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
16
+ env.stack.push({ value: value, dispose: dispose, async: async });
17
+ }
18
+ else if (async) {
19
+ env.stack.push({ async: true });
20
+ }
21
+ return value;
22
+ };
23
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
24
+ return function (env) {
25
+ function fail(e) {
26
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
27
+ env.hasError = true;
28
+ }
29
+ var r, s = 0;
30
+ function next() {
31
+ while (r = env.stack.pop()) {
32
+ try {
33
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
34
+ if (r.dispose) {
35
+ var result = r.dispose.call(r.value);
36
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
37
+ }
38
+ else s |= 1;
39
+ }
40
+ catch (e) {
41
+ fail(e);
42
+ }
43
+ }
44
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
45
+ if (env.hasError) throw env.error;
46
+ }
47
+ return next();
48
+ };
49
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
50
+ var e = new Error(message);
51
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
+ });
53
+ import { feedbackReportUpdateInputSchema, feedbackStatusSchema, insightsEnvelopeSchema, insightsPeriodSchema, } from "../contracts/insights.js";
54
+ import { InsightsStore } from "../insights/insights-store.js";
55
+ class InsightsInputError extends Error {
56
+ }
57
+ export async function runInsightsCli(arguments_, io) {
58
+ if (arguments_[0] !== "insights")
59
+ return undefined;
60
+ let command = identifyInsightsCommand(arguments_);
61
+ try {
62
+ const env_1 = { stack: [], error: void 0, hasError: false };
63
+ try {
64
+ const parsed = parseInsightsArguments(arguments_);
65
+ command = parsed.name;
66
+ const store = __addDisposableResource(env_1, new InsightsStore(), false);
67
+ const data = await executeInsightsCommand(parsed, store, io.stdin);
68
+ writeInsightsEnvelope(io, { schemaVersion: 1, status: "ok", data }, parsed.pretty);
69
+ return 0;
70
+ }
71
+ catch (e_1) {
72
+ env_1.error = e_1;
73
+ env_1.hasError = true;
74
+ }
75
+ finally {
76
+ __disposeResources(env_1);
77
+ }
78
+ }
79
+ catch (error) {
80
+ const inputError = error instanceof InsightsInputError;
81
+ writeInsightsEnvelope(io, {
82
+ schemaVersion: 1,
83
+ status: "error",
84
+ data: {
85
+ command,
86
+ error: {
87
+ code: inputError ? "INVALID_INPUT" : "INTERNAL_ERROR",
88
+ message: inputError ? error.message : "Semantic Atlas insights failed unexpectedly.",
89
+ },
90
+ },
91
+ }, false);
92
+ if (!inputError && error instanceof Error && error.stack !== undefined) {
93
+ io.stderr.write(`${error.stack}\n`);
94
+ }
95
+ return inputError ? 2 : 1;
96
+ }
97
+ }
98
+ export function resolveInsightsRange(period, now = new Date()) {
99
+ if (period === "all") {
100
+ return { from: "1970-01-01T00:00:00.000Z", to: "9999-12-31T23:59:59.999Z" };
101
+ }
102
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
103
+ const start = new Date(today);
104
+ if (period === "yesterday")
105
+ start.setDate(start.getDate() - 1);
106
+ if (period === "7d")
107
+ start.setDate(start.getDate() - 6);
108
+ if (period === "30d")
109
+ start.setDate(start.getDate() - 29);
110
+ const end = period === "yesterday" ? today : new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
111
+ return { from: start.toISOString(), to: end.toISOString() };
112
+ }
113
+ async function executeInsightsCommand(command, store, stdin) {
114
+ if (command.name === "insights.summary") {
115
+ const range = resolveInsightsRange(command.period);
116
+ return { command: command.name, range, summary: store.summary(range) };
117
+ }
118
+ if (command.name === "insights.feedback") {
119
+ const range = resolveInsightsRange(command.period);
120
+ return { command: command.name, range, reports: store.listFeedback(range, command.status) };
121
+ }
122
+ const input = await readJsonStandardInput(stdin, command.name);
123
+ const parsed = feedbackReportUpdateInputSchema.safeParse(input);
124
+ if (!parsed.success) {
125
+ throw new InsightsInputError("The feedback update input is invalid.");
126
+ }
127
+ return {
128
+ command: command.name,
129
+ report: store.updateFeedback({
130
+ id: parsed.data.id,
131
+ status: parsed.data.status,
132
+ note: parsed.data.note,
133
+ }),
134
+ };
135
+ }
136
+ function parseInsightsArguments(arguments_) {
137
+ const argumentsWithoutPretty = removePrettyOption(arguments_.slice(1));
138
+ const [subcommand, action, ...rest] = argumentsWithoutPretty.remaining;
139
+ if (subcommand === "summary") {
140
+ return {
141
+ name: "insights.summary",
142
+ period: parsePeriodOption([action, ...rest], "insights summary"),
143
+ pretty: argumentsWithoutPretty.pretty,
144
+ };
145
+ }
146
+ if (subcommand === "feedback" && action === "update") {
147
+ if (rest.length !== 1 || rest[0] !== "--stdin") {
148
+ throw new InsightsInputError("insights feedback update requires exactly --stdin.");
149
+ }
150
+ return { name: "insights.feedback.update", pretty: argumentsWithoutPretty.pretty };
151
+ }
152
+ if (subcommand === "feedback") {
153
+ const options = parseOptions([action, ...rest].filter(isDefined), ["--period", "--status"], "insights feedback");
154
+ const statusValue = options.get("--status");
155
+ const parsedStatus = statusValue === undefined ? undefined : feedbackStatusSchema.safeParse(statusValue);
156
+ if (parsedStatus !== undefined && !parsedStatus.success) {
157
+ throw new InsightsInputError("--status must be a feedback status.");
158
+ }
159
+ return {
160
+ name: "insights.feedback",
161
+ period: parsePeriod(options.get("--period")),
162
+ ...(parsedStatus === undefined ? {} : { status: parsedStatus.data }),
163
+ pretty: argumentsWithoutPretty.pretty,
164
+ };
165
+ }
166
+ throw new InsightsInputError("The insights command is invalid.");
167
+ }
168
+ function removePrettyOption(arguments_) {
169
+ const remaining = [];
170
+ let pretty = false;
171
+ for (const argument of arguments_) {
172
+ if (argument === "--pretty") {
173
+ if (pretty)
174
+ throw new InsightsInputError("--pretty may only be provided once.");
175
+ pretty = true;
176
+ }
177
+ else {
178
+ remaining.push(argument);
179
+ }
180
+ }
181
+ return { remaining, pretty };
182
+ }
183
+ function parsePeriodOption(arguments_, command) {
184
+ return parsePeriod(parseOptions(arguments_.filter(isDefined), ["--period"], command).get("--period"));
185
+ }
186
+ function parseOptions(arguments_, allowed, command) {
187
+ if (arguments_.length % 2 !== 0) {
188
+ throw new InsightsInputError(`${command} options require values.`);
189
+ }
190
+ const options = new Map();
191
+ for (let index = 0; index < arguments_.length; index += 2) {
192
+ const option = arguments_[index];
193
+ const value = arguments_[index + 1];
194
+ if (!allowed.includes(option) || value.startsWith("-") || options.has(option)) {
195
+ throw new InsightsInputError(`${command} accepts only ${allowed.join(" and ")}.`);
196
+ }
197
+ options.set(option, value);
198
+ }
199
+ return options;
200
+ }
201
+ function parsePeriod(value) {
202
+ if (value === undefined)
203
+ return "today";
204
+ const parsed = insightsPeriodSchema.safeParse(value);
205
+ if (!parsed.success) {
206
+ throw new InsightsInputError("--period must be one of today, yesterday, 7d, 30d, or all.");
207
+ }
208
+ return parsed.data;
209
+ }
210
+ async function readJsonStandardInput(stream, command) {
211
+ let contents = "";
212
+ for await (const chunk of stream)
213
+ contents += String(chunk);
214
+ try {
215
+ return JSON.parse(contents);
216
+ }
217
+ catch {
218
+ throw new InsightsInputError(`${command} requires one complete JSON value on standard input.`);
219
+ }
220
+ }
221
+ function identifyInsightsCommand(arguments_) {
222
+ if (arguments_[0] !== "insights")
223
+ return null;
224
+ if (arguments_[1] === "summary")
225
+ return "insights.summary";
226
+ if (arguments_[1] !== "feedback")
227
+ return null;
228
+ return arguments_[2] === "update" ? "insights.feedback.update" : "insights.feedback";
229
+ }
230
+ function writeInsightsEnvelope(io, envelope, pretty) {
231
+ const validated = insightsEnvelopeSchema.parse(envelope);
232
+ io.stdout.write(`${JSON.stringify(validated, null, pretty ? 2 : undefined)}\n`);
233
+ }
234
+ function isDefined(value) {
235
+ return value !== undefined;
236
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAkB,KAAK,EAAE,MAAM,YAAY,CAAC;AAExD,wBAAsB,MAAM,CAC1B,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,EAAE,EAAE,KAAK,EACT,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAuCjB"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAkB,KAAK,EAAE,MAAM,YAAY,CAAC;AAExD,wBAAsB,MAAM,CAC1B,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,EAAE,EAAE,KAAK,EACT,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAkEjB"}
package/dist/cli/main.js CHANGED
@@ -1,3 +1,56 @@
1
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
2
+ if (value !== null && value !== void 0) {
3
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
+ var dispose, inner;
5
+ if (async) {
6
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
+ dispose = value[Symbol.asyncDispose];
8
+ }
9
+ if (dispose === void 0) {
10
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
+ dispose = value[Symbol.dispose];
12
+ if (async) inner = dispose;
13
+ }
14
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
16
+ env.stack.push({ value: value, dispose: dispose, async: async });
17
+ }
18
+ else if (async) {
19
+ env.stack.push({ async: true });
20
+ }
21
+ return value;
22
+ };
23
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
24
+ return function (env) {
25
+ function fail(e) {
26
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
27
+ env.hasError = true;
28
+ }
29
+ var r, s = 0;
30
+ function next() {
31
+ while (r = env.stack.pop()) {
32
+ try {
33
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
34
+ if (r.dispose) {
35
+ var result = r.dispose.call(r.value);
36
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
37
+ }
38
+ else s |= 1;
39
+ }
40
+ catch (e) {
41
+ fail(e);
42
+ }
43
+ }
44
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
45
+ if (env.hasError) throw env.error;
46
+ }
47
+ return next();
48
+ };
49
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
50
+ var e = new Error(message);
51
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
+ });
53
+ import { InsightsStore } from "../insights/insights-store.js";
1
54
  import { parseCliArguments } from "./argument-parser.js";
2
55
  import { CliApplication } from "./cli-application.js";
3
56
  import { classifyCliError, CliError } from "./cli-error.js";
@@ -9,12 +62,18 @@ export async function runCli(arguments_, io, currentDirectory) {
9
62
  let repository = null;
10
63
  let snapshot = null;
11
64
  let application;
65
+ let observedRepository = null;
66
+ let outcome = "error";
67
+ let warningCodes = [];
68
+ let exitCode = 1;
69
+ const startedAt = performance.now();
12
70
  try {
13
71
  const invocation = parseCliArguments(arguments_, currentDirectory);
14
72
  pretty = invocation.pretty;
15
73
  command = invocation.command.name;
16
74
  application = new CliApplication(io);
17
75
  const context = await application.openRepository(invocation.repo, command);
76
+ observedRepository = context.repository;
18
77
  ({ repository, snapshot } = application.responseContext(context));
19
78
  const result = await application.execute(invocation.command, context);
20
79
  const responseContext = invocation.command.name === "index"
@@ -22,8 +81,11 @@ export async function runCli(arguments_, io, currentDirectory) {
22
81
  : context;
23
82
  const envelope = application.envelope(result, responseContext);
24
83
  snapshot = envelope.snapshot;
84
+ outcome = envelope.status;
85
+ warningCodes = envelope.warnings.map((warning) => warning.code);
25
86
  presenter.write(envelope, pretty);
26
- return 0;
87
+ exitCode = 0;
88
+ return exitCode;
27
89
  }
28
90
  catch (error) {
29
91
  const classified = classifyCliError(error, command);
@@ -40,6 +102,36 @@ export async function runCli(arguments_, io, currentDirectory) {
40
102
  if (classified.exitCode === 1 && !(error instanceof CliError)) {
41
103
  presenter.writeUnexpectedDiagnostic(error);
42
104
  }
43
- return classified.exitCode;
105
+ exitCode = classified.exitCode;
106
+ return exitCode;
107
+ }
108
+ finally {
109
+ if (command !== null && observedRepository !== null) {
110
+ try {
111
+ const env_1 = { stack: [], error: void 0, hasError: false };
112
+ try {
113
+ const insights = __addDisposableResource(env_1, new InsightsStore(), false);
114
+ insights.recordCommand({
115
+ repositoryId: observedRepository.repositoryId,
116
+ command: command,
117
+ outcome,
118
+ exitCode,
119
+ warningCodes,
120
+ durationMs: performance.now() - startedAt,
121
+ snapshotId: snapshot?.id ?? null,
122
+ });
123
+ }
124
+ catch (e_1) {
125
+ env_1.error = e_1;
126
+ env_1.hasError = true;
127
+ }
128
+ finally {
129
+ __disposeResources(env_1);
130
+ }
131
+ }
132
+ catch {
133
+ // Observability must not change the outcome or output of a development command.
134
+ }
135
+ }
44
136
  }
45
137
  }
@@ -1 +1 @@
1
- {"version":3,"file":"standalone-cli.d.ts","sourceRoot":"","sources":["../../src/cli/standalone-cli.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAwBxC,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,EAAE,EAAE,KAAK,GACR,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkC7B"}
1
+ {"version":3,"file":"standalone-cli.d.ts","sourceRoot":"","sources":["../../src/cli/standalone-cli.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AA6BxC,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,EAAE,EAAE,KAAK,GACR,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA6D7B"}
@@ -1,4 +1,5 @@
1
1
  import { readPackageVersion } from "../package-metadata.js";
2
+ import { SemanticAtlasPackageUpgrader } from "../setup/package-upgrader.js";
2
3
  import { SkillInstaller } from "../setup/skill-installer.js";
3
4
  const helpText = `Usage: semantic-atlas <command> [options]
4
5
 
@@ -11,15 +12,20 @@ Project understanding:
11
12
  code search <structural-term> Find bounded structural source evidence
12
13
  learn --stdin Apply one GraphPatch JSON value
13
14
  changes [--from id] [--to id] Report semantic changes
15
+ feedback report --stdin Record confirmed product friction
14
16
 
15
17
  Installation and information:
16
- setup Install or update the bundled user Skill
18
+ insights summary [--period period] Summarize local Atlas product signals
19
+ insights feedback [options] List local Agent feedback reports
20
+ insights feedback update --stdin Record a feedback triage decision
21
+ setup Install or update the bundled user Skills
22
+ upgrade Install the latest release and sync its Skills
17
23
  -h, --help Show this help
18
24
  --version Print the installed package version
19
25
 
20
26
  Global project options:
21
27
  --repo <path> Select a Git worktree (default: cwd)
22
- --pretty Indent JSON project-command output
28
+ --pretty Indent JSON project or insights output
23
29
  `;
24
30
  export async function runStandaloneCli(arguments_, io) {
25
31
  const [command, ...rest] = arguments_;
@@ -38,11 +44,12 @@ export async function runStandaloneCli(arguments_, io) {
38
44
  const version = await readPackageVersion();
39
45
  const result = await new SkillInstaller({ version }).install();
40
46
  const action = result.outcome === "current"
41
- ? "Semantic Atlas Skill is already current at"
47
+ ? "Semantic Atlas Skills are already current at"
42
48
  : result.outcome === "installed"
43
- ? "Installed Semantic Atlas Skill at"
44
- : "Updated Semantic Atlas Skill at";
49
+ ? "Installed Semantic Atlas Skills at"
50
+ : "Updated Semantic Atlas Skills at";
45
51
  io.stdout.write(`${action} ${result.targetDirectory}\n`);
52
+ io.stdout.write(`Semantic Atlas Insights Skill is synchronized at ${result.insightsTargetDirectory}\n`);
46
53
  for (const directory of result.removedLegacyDirectories) {
47
54
  io.stdout.write(`Removed legacy Semantic Atlas Skill at ${directory}\n`);
48
55
  }
@@ -53,6 +60,30 @@ export async function runStandaloneCli(arguments_, io) {
53
60
  return 1;
54
61
  }
55
62
  }
63
+ if (command === "upgrade") {
64
+ if (rest.length > 0) {
65
+ io.stderr.write("semantic-atlas upgrade does not accept arguments.\n");
66
+ return 2;
67
+ }
68
+ try {
69
+ const currentVersion = await readPackageVersion();
70
+ io.stdout.write("Checking the latest stable Semantic Atlas release...\n");
71
+ const result = await new SemanticAtlasPackageUpgrader({ currentVersion }).upgrade();
72
+ if (result.outcome === "current") {
73
+ io.stdout.write(`Semantic Atlas ${result.targetVersion} is already current.\n`);
74
+ io.stdout.write(`Semantic Atlas Skills are synchronized at ${result.skillDirectory}\n`);
75
+ }
76
+ else {
77
+ io.stdout.write(`Upgraded Semantic Atlas from ${result.previousVersion} to ${result.targetVersion}.\n`);
78
+ io.stdout.write(`Semantic Atlas Skills are synchronized at ${result.skillDirectory}\n`);
79
+ }
80
+ return 0;
81
+ }
82
+ catch (error) {
83
+ io.stderr.write(`Semantic Atlas upgrade failed: ${error instanceof Error ? error.message : String(error)}\n`);
84
+ return 1;
85
+ }
86
+ }
56
87
  return undefined;
57
88
  }
58
89
  async function writeArgumentFreeResult(rest, io, contents) {
@@ -20,6 +20,8 @@ export type ParsedCommand = {
20
20
  readonly limit: number;
21
21
  } | {
22
22
  readonly name: "learn";
23
+ } | {
24
+ readonly name: "feedback.report";
23
25
  } | {
24
26
  readonly name: "changes";
25
27
  readonly fromSnapshotId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,CAAC;AAE3E,MAAM,MAAM,aAAa,GACrB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACzD;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/E;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,QAAQ,CAAC,IAAI,EAA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W,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;CACxC"}
@@ -598,6 +598,37 @@ export declare const cliCommandDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
598
598
  removed: z.ZodArray<z.ZodString>;
599
599
  }, z.core.$loose>;
600
600
  staleAssertions: z.ZodArray<z.ZodString>;
601
+ }, z.core.$loose>, z.ZodObject<{
602
+ command: z.ZodLiteral<"feedback.report">;
603
+ report: z.ZodObject<{
604
+ id: z.ZodString;
605
+ kind: z.ZodEnum<{
606
+ problem: "problem";
607
+ suggestion: "suggestion";
608
+ }>;
609
+ category: z.ZodEnum<{
610
+ "misleading-result": "misleading-result";
611
+ "missing-knowledge": "missing-knowledge";
612
+ "workflow-friction": "workflow-friction";
613
+ performance: "performance";
614
+ "cli-error": "cli-error";
615
+ "skill-instruction": "skill-instruction";
616
+ }>;
617
+ impact: z.ZodEnum<{
618
+ minor: "minor";
619
+ blocked: "blocked";
620
+ slowed: "slowed";
621
+ }>;
622
+ sourceConfirmed: z.ZodBoolean;
623
+ status: z.ZodEnum<{
624
+ new: "new";
625
+ triaged: "triaged";
626
+ resolved: "resolved";
627
+ dismissed: "dismissed";
628
+ }>;
629
+ contextEventCount: z.ZodNumber;
630
+ createdAt: z.ZodISODateTime;
631
+ }, z.core.$strict>;
601
632
  }, z.core.$loose>], "command">;
602
633
  export declare const cliEnvelopeSchema: z.ZodUnion<readonly [z.ZodObject<{
603
634
  schemaVersion: z.ZodLiteral<1>;
@@ -1098,6 +1129,37 @@ export declare const cliEnvelopeSchema: z.ZodUnion<readonly [z.ZodObject<{
1098
1129
  removed: z.ZodArray<z.ZodString>;
1099
1130
  }, z.core.$loose>;
1100
1131
  staleAssertions: z.ZodArray<z.ZodString>;
1132
+ }, z.core.$loose>, z.ZodObject<{
1133
+ command: z.ZodLiteral<"feedback.report">;
1134
+ report: z.ZodObject<{
1135
+ id: z.ZodString;
1136
+ kind: z.ZodEnum<{
1137
+ problem: "problem";
1138
+ suggestion: "suggestion";
1139
+ }>;
1140
+ category: z.ZodEnum<{
1141
+ "misleading-result": "misleading-result";
1142
+ "missing-knowledge": "missing-knowledge";
1143
+ "workflow-friction": "workflow-friction";
1144
+ performance: "performance";
1145
+ "cli-error": "cli-error";
1146
+ "skill-instruction": "skill-instruction";
1147
+ }>;
1148
+ impact: z.ZodEnum<{
1149
+ minor: "minor";
1150
+ blocked: "blocked";
1151
+ slowed: "slowed";
1152
+ }>;
1153
+ sourceConfirmed: z.ZodBoolean;
1154
+ status: z.ZodEnum<{
1155
+ new: "new";
1156
+ triaged: "triaged";
1157
+ resolved: "resolved";
1158
+ dismissed: "dismissed";
1159
+ }>;
1160
+ contextEventCount: z.ZodNumber;
1161
+ createdAt: z.ZodISODateTime;
1162
+ }, z.core.$strict>;
1101
1163
  }, z.core.$loose>], "command">;
1102
1164
  warnings: z.ZodArray<z.ZodObject<{
1103
1165
  code: z.ZodString;
@@ -1131,6 +1193,7 @@ export declare const cliEnvelopeSchema: z.ZodUnion<readonly [z.ZodObject<{
1131
1193
  "map.search": "map.search";
1132
1194
  "map.show": "map.show";
1133
1195
  "code.search": "code.search";
1196
+ "feedback.report": "feedback.report";
1134
1197
  }>>;
1135
1198
  error: z.ZodObject<{
1136
1199
  code: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/contracts/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuDxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAU/B,CAAC;AA6BH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAG5B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { assertionCertaintySchema, businessKeySchema, businessNodeReferenceSchema, businessNodeKindSchema, businessRelationTypeSchema, evidenceSchema, knowledgeValiditySchema, relativeSourcePathSchema, sourceRangeSchema, structuralNodeKindSchema, structuralNodeIdSchema, structuralSupportSchema, } from "./graph.js";
3
3
  import { contentIdentifierSchema, gitObjectIdSchema, } from "./identifiers.js";
4
+ import { feedbackReportResultSchema } from "./insights.js";
4
5
  const repositoryDescriptorSchema = z.strictObject({
5
6
  id: contentIdentifierSchema,
6
7
  root: z.string().min(1),
@@ -54,6 +55,7 @@ const commandNameSchema = z.enum([
54
55
  "code.search",
55
56
  "learn",
56
57
  "changes",
58
+ "feedback.report",
57
59
  ]);
58
60
  const countSchema = z.number().int().nonnegative();
59
61
  const sourceChangeCountsSchema = z.looseObject({
@@ -185,6 +187,10 @@ const changesDataSchema = z.looseObject({
185
187
  relations: changeSetSchema,
186
188
  staleAssertions: z.array(z.string().min(1)),
187
189
  });
190
+ const feedbackReportDataSchema = z.looseObject({
191
+ command: z.literal("feedback.report"),
192
+ report: feedbackReportResultSchema,
193
+ });
188
194
  export const cliCommandDataSchema = z.discriminatedUnion("command", [
189
195
  statusDataSchema,
190
196
  indexDataSchema,
@@ -194,6 +200,7 @@ export const cliCommandDataSchema = z.discriminatedUnion("command", [
194
200
  codeSearchDataSchema,
195
201
  learnDataSchema,
196
202
  changesDataSchema,
203
+ feedbackReportDataSchema,
197
204
  ]);
198
205
  const errorDataSchema = z.looseObject({
199
206
  command: commandNameSchema.nullable(),
@@ -0,0 +1,2 @@
1
+ export * from "../insights/contracts.js";
2
+ //# sourceMappingURL=insights.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../../src/contracts/insights.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "../insights/contracts.js";
@@ -1,4 +1,5 @@
1
1
  export * from "./cli.js";
2
2
  export * from "./graph.js";
3
3
  export * from "./identifiers.js";
4
+ export * from "./insights.js";
4
5
  //# sourceMappingURL=public-contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-contracts.d.ts","sourceRoot":"","sources":["../../src/contracts/public-contracts.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"public-contracts.d.ts","sourceRoot":"","sources":["../../src/contracts/public-contracts.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from "./cli.js";
2
2
  export * from "./graph.js";
3
3
  export * from "./identifiers.js";
4
+ export * from "./insights.js";