@knowledgine/cli 0.1.0 → 0.2.1

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 (123) hide show
  1. package/dist/commands/capture.d.ts +23 -0
  2. package/dist/commands/capture.d.ts.map +1 -0
  3. package/dist/commands/capture.js +237 -0
  4. package/dist/commands/capture.js.map +1 -0
  5. package/dist/commands/demo.d.ts +6 -0
  6. package/dist/commands/demo.d.ts.map +1 -0
  7. package/dist/commands/demo.js +48 -0
  8. package/dist/commands/demo.js.map +1 -0
  9. package/dist/commands/feedback.d.ts +27 -0
  10. package/dist/commands/feedback.d.ts.map +1 -0
  11. package/dist/commands/feedback.js +120 -0
  12. package/dist/commands/feedback.js.map +1 -0
  13. package/dist/commands/ingest.d.ts +9 -0
  14. package/dist/commands/ingest.d.ts.map +1 -0
  15. package/dist/commands/ingest.js +162 -0
  16. package/dist/commands/ingest.js.map +1 -0
  17. package/dist/commands/init.d.ts +2 -0
  18. package/dist/commands/init.d.ts.map +1 -1
  19. package/dist/commands/init.js +327 -42
  20. package/dist/commands/init.js.map +1 -1
  21. package/dist/commands/plugins.d.ts +6 -0
  22. package/dist/commands/plugins.d.ts.map +1 -0
  23. package/dist/commands/plugins.js +41 -0
  24. package/dist/commands/plugins.js.map +1 -0
  25. package/dist/commands/search.d.ts +16 -0
  26. package/dist/commands/search.d.ts.map +1 -0
  27. package/dist/commands/search.js +140 -0
  28. package/dist/commands/search.js.map +1 -0
  29. package/dist/commands/setup.d.ts +57 -0
  30. package/dist/commands/setup.d.ts.map +1 -0
  31. package/dist/commands/setup.js +331 -0
  32. package/dist/commands/setup.js.map +1 -0
  33. package/dist/commands/start.d.ts +1 -0
  34. package/dist/commands/start.d.ts.map +1 -1
  35. package/dist/commands/start.js +98 -24
  36. package/dist/commands/start.js.map +1 -1
  37. package/dist/commands/status.d.ts +5 -0
  38. package/dist/commands/status.d.ts.map +1 -0
  39. package/dist/commands/status.js +149 -0
  40. package/dist/commands/status.js.map +1 -0
  41. package/dist/commands/tool.d.ts +29 -0
  42. package/dist/commands/tool.d.ts.map +1 -0
  43. package/dist/commands/tool.js +247 -0
  44. package/dist/commands/tool.js.map +1 -0
  45. package/dist/commands/upgrade.d.ts +6 -0
  46. package/dist/commands/upgrade.d.ts.map +1 -0
  47. package/dist/commands/upgrade.js +137 -0
  48. package/dist/commands/upgrade.js.map +1 -0
  49. package/dist/index.js +178 -2
  50. package/dist/index.js.map +1 -1
  51. package/dist/lib/demo-manager.d.ts +16 -0
  52. package/dist/lib/demo-manager.d.ts.map +1 -0
  53. package/dist/lib/demo-manager.js +37 -0
  54. package/dist/lib/demo-manager.js.map +1 -0
  55. package/dist/lib/entity-extractor.d.ts +15 -0
  56. package/dist/lib/entity-extractor.d.ts.map +1 -0
  57. package/dist/lib/entity-extractor.js +86 -0
  58. package/dist/lib/entity-extractor.js.map +1 -0
  59. package/dist/lib/formatter.d.ts +7 -0
  60. package/dist/lib/formatter.d.ts.map +1 -0
  61. package/dist/lib/formatter.js +94 -0
  62. package/dist/lib/formatter.js.map +1 -0
  63. package/dist/lib/indexer.d.ts +6 -1
  64. package/dist/lib/indexer.d.ts.map +1 -1
  65. package/dist/lib/indexer.js +4 -1
  66. package/dist/lib/indexer.js.map +1 -1
  67. package/dist/lib/ingest-watcher.d.ts +20 -0
  68. package/dist/lib/ingest-watcher.d.ts.map +1 -0
  69. package/dist/lib/ingest-watcher.js +45 -0
  70. package/dist/lib/ingest-watcher.js.map +1 -0
  71. package/dist/lib/plugin-loader.d.ts +5 -0
  72. package/dist/lib/plugin-loader.d.ts.map +1 -0
  73. package/dist/lib/plugin-loader.js +27 -0
  74. package/dist/lib/plugin-loader.js.map +1 -0
  75. package/dist/lib/progress.d.ts +63 -0
  76. package/dist/lib/progress.d.ts.map +1 -0
  77. package/dist/lib/progress.js +228 -0
  78. package/dist/lib/progress.js.map +1 -0
  79. package/dist/lib/ui/box.d.ts +7 -0
  80. package/dist/lib/ui/box.d.ts.map +1 -0
  81. package/dist/lib/ui/box.js +19 -0
  82. package/dist/lib/ui/box.js.map +1 -0
  83. package/dist/lib/ui/error-formatter.d.ts +8 -0
  84. package/dist/lib/ui/error-formatter.d.ts.map +1 -0
  85. package/dist/lib/ui/error-formatter.js +21 -0
  86. package/dist/lib/ui/error-formatter.js.map +1 -0
  87. package/dist/lib/ui/index.d.ts +7 -0
  88. package/dist/lib/ui/index.d.ts.map +1 -0
  89. package/dist/lib/ui/index.js +7 -0
  90. package/dist/lib/ui/index.js.map +1 -0
  91. package/dist/lib/ui/output.d.ts +2 -0
  92. package/dist/lib/ui/output.d.ts.map +1 -0
  93. package/dist/lib/ui/output.js +4 -0
  94. package/dist/lib/ui/output.js.map +1 -0
  95. package/dist/lib/ui/spinner.d.ts +4 -0
  96. package/dist/lib/ui/spinner.d.ts.map +1 -0
  97. package/dist/lib/ui/spinner.js +5 -0
  98. package/dist/lib/ui/spinner.js.map +1 -0
  99. package/dist/lib/ui/table.d.ts +9 -0
  100. package/dist/lib/ui/table.d.ts.map +1 -0
  101. package/dist/lib/ui/table.js +28 -0
  102. package/dist/lib/ui/table.js.map +1 -0
  103. package/dist/lib/ui/theme.d.ts +21 -0
  104. package/dist/lib/ui/theme.d.ts.map +1 -0
  105. package/dist/lib/ui/theme.js +29 -0
  106. package/dist/lib/ui/theme.js.map +1 -0
  107. package/dist/lib/unknown-command-handler.d.ts +14 -0
  108. package/dist/lib/unknown-command-handler.d.ts.map +1 -0
  109. package/dist/lib/unknown-command-handler.js +25 -0
  110. package/dist/lib/unknown-command-handler.js.map +1 -0
  111. package/dist/lib/url-validator.d.ts +2 -0
  112. package/dist/lib/url-validator.d.ts.map +1 -0
  113. package/dist/lib/url-validator.js +21 -0
  114. package/dist/lib/url-validator.js.map +1 -0
  115. package/fixtures/demo/notes/api-design-decisions.md +84 -0
  116. package/fixtures/demo/notes/auth-debugging.md +60 -0
  117. package/fixtures/demo/notes/ci-cd-pipeline.md +97 -0
  118. package/fixtures/demo/notes/code-review-notes.md +78 -0
  119. package/fixtures/demo/notes/database-optimization.md +81 -0
  120. package/fixtures/demo/notes/docker-troubleshooting.md +80 -0
  121. package/fixtures/demo/notes/react-performance.md +67 -0
  122. package/fixtures/demo/notes/typescript-migration.md +89 -0
  123. package/package.json +13 -4
@@ -0,0 +1,228 @@
1
+ /**
2
+ * Progress display utility for CLI operations.
3
+ * TTY: in-place updates with \r
4
+ * Non-TTY: milestone-only output
5
+ * All output goes to stderr to avoid MCP stdout conflicts.
6
+ */
7
+ import { colors, createBox } from "./ui/index.js";
8
+ import { createSpinner } from "./ui/spinner.js";
9
+ export function createSummaryReport(title, entries) {
10
+ const maxLabelLen = entries.length > 0 ? Math.max(...entries.map((e) => e.label.length)) : 0;
11
+ const lines = entries.map((e) => `${colors.label(e.label.padEnd(maxLabelLen))} ${e.value}`);
12
+ const content = lines.join("\n");
13
+ return createBox(content, { type: "success", title });
14
+ }
15
+ export function formatDuration(ms) {
16
+ if (ms < 1000)
17
+ return `${ms}ms`;
18
+ if (ms < 60_000)
19
+ return `${(ms / 1000).toFixed(1)}s`;
20
+ const minutes = Math.floor(ms / 60_000);
21
+ const seconds = Math.round((ms % 60_000) / 1000);
22
+ return `${minutes}m ${seconds}s`;
23
+ }
24
+ function useColor() {
25
+ return !process.env["NO_COLOR"];
26
+ }
27
+ function stepIcon(status) {
28
+ if (!useColor()) {
29
+ switch (status) {
30
+ case "done":
31
+ return "[ok]";
32
+ case "failed":
33
+ return "[fail]";
34
+ case "skipped":
35
+ return "[skip]";
36
+ case "running":
37
+ return "[..]";
38
+ default:
39
+ return "[ ]";
40
+ }
41
+ }
42
+ switch (status) {
43
+ case "done":
44
+ return "\u2714"; // ✔
45
+ case "failed":
46
+ return "\u2718"; // ✘
47
+ case "skipped":
48
+ return "\u2212"; // −
49
+ case "running":
50
+ return "\u25ba"; // ►
51
+ default:
52
+ return " ";
53
+ }
54
+ }
55
+ function renderProgressBar(current, total, width = 16) {
56
+ const ratio = total > 0 ? Math.min(current / total, 1) : 0;
57
+ const filled = Math.round(ratio * width);
58
+ const empty = width - filled;
59
+ return `[${"█".repeat(filled)}${"░".repeat(empty)}]`;
60
+ }
61
+ export function createProgress(total, label) {
62
+ const isTTY = process.stderr.isTTY ?? false;
63
+ const startTime = Date.now();
64
+ let lastMilestone = -1;
65
+ function write(text) {
66
+ process.stderr.write(text);
67
+ }
68
+ function update(current, detail) {
69
+ if (isTTY) {
70
+ const detailStr = detail ? ` ${detail}` : "";
71
+ const bar = renderProgressBar(current, total);
72
+ const line = `\r[${current}/${total}] ${label}...${detailStr} ${bar}`;
73
+ write(line);
74
+ }
75
+ else {
76
+ // Non-TTY: output at 0%, 25%, 50%, 75%, 100% milestones
77
+ const pct = total > 0 ? Math.floor((current / total) * 4) : 0;
78
+ if (pct > lastMilestone) {
79
+ lastMilestone = pct;
80
+ write(`[${current}/${total}] ${label}...\n`);
81
+ }
82
+ }
83
+ }
84
+ function finish() {
85
+ const elapsed = formatDuration(Date.now() - startTime);
86
+ if (isTTY) {
87
+ write(`\r[${total}/${total}] ${label} (${elapsed})\n`);
88
+ }
89
+ else {
90
+ write(`${label}: ${total} done (${elapsed})\n`);
91
+ }
92
+ }
93
+ return { update, finish };
94
+ }
95
+ /**
96
+ * Create a step-based progress tracker for structured multi-step CLI operations.
97
+ *
98
+ * Each step is printed as it starts/completes to give real-time feedback.
99
+ * Designed to be used with init, upgrade, and other multi-phase commands.
100
+ *
101
+ * @param totalSteps - Expected number of steps (used for summary only)
102
+ * @param title - Optional title printed before the first step
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * const steps = createStepProgress(4, "Initializing knowledgine");
107
+ * steps.startStep("Creating directory");
108
+ * steps.completeStep("Creating directory");
109
+ * steps.startStep("Reading configuration");
110
+ * steps.failStep("Reading configuration", "Permission denied");
111
+ * steps.finish();
112
+ * ```
113
+ */
114
+ export function createStepProgress(totalSteps, title) {
115
+ const steps = [];
116
+ const startTime = Date.now();
117
+ let warnCount = 0;
118
+ function write(text) {
119
+ process.stderr.write(text);
120
+ }
121
+ function findStep(name) {
122
+ return steps.find((s) => s.name === name);
123
+ }
124
+ function printStepLine(step) {
125
+ const icon = stepIcon(step.status);
126
+ const reasonStr = step.reason ? ` (${step.reason})` : "";
127
+ if (useColor()) {
128
+ switch (step.status) {
129
+ case "done":
130
+ write(` ${colors.success(icon)} ${step.name}${reasonStr}\n`);
131
+ break;
132
+ case "failed":
133
+ write(` ${colors.error(icon)} ${colors.error(step.name)}${reasonStr}\n`);
134
+ break;
135
+ case "skipped":
136
+ write(` ${colors.warning(icon)} ${colors.dim(step.name)}${reasonStr}\n`);
137
+ break;
138
+ default:
139
+ write(` ${icon} ${step.name}${reasonStr}\n`);
140
+ }
141
+ }
142
+ else {
143
+ write(` ${icon} ${step.name}${reasonStr}\n`);
144
+ }
145
+ }
146
+ if (title) {
147
+ write(`\n${title}\n`);
148
+ }
149
+ function startStep(name) {
150
+ let step = findStep(name);
151
+ if (!step) {
152
+ step = { name, status: "running" };
153
+ steps.push(step);
154
+ }
155
+ else {
156
+ step.status = "running";
157
+ step.reason = undefined;
158
+ }
159
+ // Print running indicator so the user sees activity
160
+ const icon = stepIcon("running");
161
+ if (useColor()) {
162
+ write(` ${colors.info(icon)} ${name}...\n`);
163
+ }
164
+ else {
165
+ write(` ${icon} ${name}...\n`);
166
+ }
167
+ }
168
+ function completeStep(name) {
169
+ let step = findStep(name);
170
+ if (!step) {
171
+ step = { name, status: "done" };
172
+ steps.push(step);
173
+ }
174
+ else {
175
+ step.status = "done";
176
+ step.reason = undefined;
177
+ }
178
+ printStepLine(step);
179
+ }
180
+ function failStep(name, reason) {
181
+ let step = findStep(name);
182
+ if (!step) {
183
+ step = { name, status: "failed", reason };
184
+ steps.push(step);
185
+ }
186
+ else {
187
+ step.status = "failed";
188
+ step.reason = reason;
189
+ }
190
+ printStepLine(step);
191
+ }
192
+ function skipStep(name, reason) {
193
+ let step = findStep(name);
194
+ if (!step) {
195
+ step = { name, status: "skipped", reason };
196
+ steps.push(step);
197
+ }
198
+ else {
199
+ step.status = "skipped";
200
+ step.reason = reason;
201
+ }
202
+ printStepLine(step);
203
+ }
204
+ function warn(message) {
205
+ warnCount++;
206
+ write(` ! ${message}\n`);
207
+ }
208
+ function finish() {
209
+ const elapsed = formatDuration(Date.now() - startTime);
210
+ const doneCount = steps.filter((s) => s.status === "done").length;
211
+ const failCount = steps.filter((s) => s.status === "failed").length;
212
+ const skipCount = steps.filter((s) => s.status === "skipped").length;
213
+ write(`\n`);
214
+ if (failCount > 0) {
215
+ write(`Completed with errors (${elapsed}): ${doneCount}/${totalSteps} steps, ${failCount} failed, ${skipCount} skipped\n`);
216
+ }
217
+ else if (warnCount > 0 || skipCount > 0) {
218
+ write(`Completed with warnings (${elapsed}): ${doneCount}/${totalSteps} steps, ${skipCount} skipped\n`);
219
+ }
220
+ else {
221
+ write(`All steps completed (${elapsed})\n`);
222
+ }
223
+ }
224
+ return { startStep, completeStep, failStep, skipStep, warn, finish };
225
+ }
226
+ // Re-export spinner for convenience in commands
227
+ export { createSpinner } from "./ui/spinner.js";
228
+ //# sourceMappingURL=progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/lib/progress.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAuChD,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,OAAuB;IACxE,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,MAAM,KAAK,GAAG,OAAO,CAAC,GAA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,KAAK,QAAQ,CAAC,CAAC,MAAM,CAAC;QACpE,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC;QAErE,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YAClB,KAAK,CACH,0BAA0B,OAAO,MAAM,SAAS,IAAI,UAAU,WAAW,SAAS,YAAY,SAAS,YAAY,CACpH,CAAC;QACJ,CAAC;aAAM,IAAI,SAAS,GAAG,CAAC,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YAC1C,KAAK,CACH,4BAA4B,OAAO,MAAM,SAAS,IAAI,UAAU,WAAW,SAAS,YAAY,CACjG,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,wBAAwB,OAAO,KAAK,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACvE,CAAC;AAED,gDAAgD;AAChD,OAAO,EAAE,aAAa,EAAY,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type BoxType = "success" | "error" | "warning" | "info" | "default";
2
+ export declare function createBox(content: string, options?: {
3
+ title?: string;
4
+ type?: BoxType;
5
+ padding?: number;
6
+ }): string;
7
+ //# sourceMappingURL=box.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../../src/lib/ui/box.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAU3E,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CASjH"}
@@ -0,0 +1,19 @@
1
+ import boxen, {} from "boxen";
2
+ const borderColors = {
3
+ success: "green",
4
+ error: "red",
5
+ warning: "yellow",
6
+ info: "cyan",
7
+ default: "gray",
8
+ };
9
+ export function createBox(content, options) {
10
+ const type = options?.type ?? "default";
11
+ return boxen(content, {
12
+ title: options?.title,
13
+ titleAlignment: "left",
14
+ padding: options?.padding ?? 1,
15
+ borderColor: borderColors[type],
16
+ borderStyle: "round",
17
+ });
18
+ }
19
+ //# sourceMappingURL=box.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"box.js","sourceRoot":"","sources":["../../../src/lib/ui/box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAgC,MAAM,OAAO,CAAC;AAI5D,MAAM,YAAY,GAA4B;IAC5C,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,MAAM;CAChB,CAAC;AAEF,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,OAA8D;IACvG,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,SAAS,CAAC;IACxC,OAAO,KAAK,CAAC,OAAO,EAAE;QACpB,KAAK,EAAE,OAAO,EAAE,KAAK;QACrB,cAAc,EAAE,MAAM;QACtB,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,CAAC;QAC9B,WAAW,EAAE,YAAY,CAAC,IAAI,CAAgC;QAC9D,WAAW,EAAE,OAAO;KACrB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface StructuredError {
2
+ message: string;
3
+ cause?: string;
4
+ solutions?: string[];
5
+ hint?: string;
6
+ }
7
+ export declare function formatStructuredError(err: StructuredError): string;
8
+ //# sourceMappingURL=error-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-formatter.d.ts","sourceRoot":"","sources":["../../../src/lib/ui/error-formatter.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAiBlE"}
@@ -0,0 +1,21 @@
1
+ import { colors, symbols } from "./theme.js";
2
+ import { createBox } from "./box.js";
3
+ export function formatStructuredError(err) {
4
+ const lines = [
5
+ `${symbols.error} ${colors.error(colors.bold(err.message))}`,
6
+ ];
7
+ if (err.cause) {
8
+ lines.push("", `${colors.dim("Cause:")} ${err.cause}`);
9
+ }
10
+ if (err.solutions && err.solutions.length > 0) {
11
+ lines.push("", colors.dim("Solutions:"));
12
+ for (const s of err.solutions) {
13
+ lines.push(` ${symbols.arrow} ${s}`);
14
+ }
15
+ }
16
+ if (err.hint) {
17
+ lines.push("", colors.hint(err.hint));
18
+ }
19
+ return createBox(lines.join("\n"), { type: "error", title: "Error" });
20
+ }
21
+ //# sourceMappingURL=error-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-formatter.js","sourceRoot":"","sources":["../../../src/lib/ui/error-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AASrC,MAAM,UAAU,qBAAqB,CAAC,GAAoB;IACxD,MAAM,KAAK,GAAa;QACtB,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE;KAC7D,CAAC;IACF,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9C,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;QACzC,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;YAC9B,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;AACxE,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { colors, symbols, scoreColor } from "./theme.js";
2
+ export { createTable, type TableConfig } from "./table.js";
3
+ export { createBox, type BoxType } from "./box.js";
4
+ export { createSpinner, type Ora } from "./spinner.js";
5
+ export { formatStructuredError, type StructuredError } from "./error-formatter.js";
6
+ export { stderr } from "./output.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,KAAK,GAAG,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { colors, symbols, scoreColor } from "./theme.js";
2
+ export { createTable } from "./table.js";
3
+ export { createBox } from "./box.js";
4
+ export { createSpinner } from "./spinner.js";
5
+ export { formatStructuredError } from "./error-formatter.js";
6
+ export { stderr } from "./output.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,WAAW,EAAoB,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAgB,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,aAAa,EAAY,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAwB,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function stderr(text: string): void;
2
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/lib/ui/output.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEzC"}
@@ -0,0 +1,4 @@
1
+ export function stderr(text) {
2
+ process.stderr.write(text + "\n");
3
+ }
4
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/lib/ui/output.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type Ora } from "ora";
2
+ export declare function createSpinner(text: string): Ora;
3
+ export type { Ora };
4
+ //# sourceMappingURL=spinner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/lib/ui/spinner.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAEpC,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAE/C;AAED,YAAY,EAAE,GAAG,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import ora, {} from "ora";
2
+ export function createSpinner(text) {
3
+ return ora({ text, stream: process.stderr });
4
+ }
5
+ //# sourceMappingURL=spinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../src/lib/ui/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAY,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface TableConfig {
2
+ head: string[];
3
+ rows: (string | number)[][];
4
+ colWidths?: number[];
5
+ compact?: boolean;
6
+ }
7
+ export declare function createTable(config: TableConfig): string;
8
+ export declare function createTable(head: string[], rows: (string | number)[][]): string;
9
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/lib/ui/table.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC;AACzD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,GAAG,MAAM,CAAC"}
@@ -0,0 +1,28 @@
1
+ import Table from "cli-table3";
2
+ import { colors } from "./theme.js";
3
+ export function createTable(configOrHead, rows) {
4
+ let config;
5
+ if (Array.isArray(configOrHead)) {
6
+ config = { head: configOrHead, rows: rows ?? [] };
7
+ }
8
+ else {
9
+ config = configOrHead;
10
+ }
11
+ const tableOptions = {
12
+ head: config.head.map(h => colors.bold(h)),
13
+ style: {
14
+ head: [],
15
+ border: ["gray"],
16
+ compact: config.compact ?? false,
17
+ },
18
+ };
19
+ if (config.colWidths !== undefined) {
20
+ tableOptions.colWidths = config.colWidths;
21
+ }
22
+ const table = new Table(tableOptions);
23
+ for (const row of config.rows) {
24
+ table.push(row.map(String));
25
+ }
26
+ return table.toString();
27
+ }
28
+ //# sourceMappingURL=table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/lib/ui/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAWpC,MAAM,UAAU,WAAW,CACzB,YAAoC,EACpC,IAA4B;IAE5B,IAAI,MAAmB,CAAC;IACxB,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QAChC,MAAM,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC;IACpD,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,YAAY,CAAC;IACxB,CAAC;IAED,MAAM,YAAY,GAA2C;QAC3D,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1C,KAAK,EAAE;YACL,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK;SACjC;KACF,CAAC;IACF,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QACnC,YAAY,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IAC5C,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,21 @@
1
+ export declare const colors: {
2
+ readonly success: import("chalk").ChalkInstance;
3
+ readonly error: import("chalk").ChalkInstance;
4
+ readonly warning: import("chalk").ChalkInstance;
5
+ readonly info: import("chalk").ChalkInstance;
6
+ readonly hint: import("chalk").ChalkInstance;
7
+ readonly accent: import("chalk").ChalkInstance;
8
+ readonly bold: import("chalk").ChalkInstance;
9
+ readonly dim: import("chalk").ChalkInstance;
10
+ readonly label: import("chalk").ChalkInstance;
11
+ };
12
+ export declare const symbols: {
13
+ readonly success: string;
14
+ readonly error: string;
15
+ readonly warning: string;
16
+ readonly info: string;
17
+ readonly arrow: "→";
18
+ readonly bullet: "●";
19
+ };
20
+ export declare function scoreColor(score: number): (text: string) => string;
21
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/lib/ui/theme.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;;;;;;;;;;CAUT,CAAC;AAEX,eAAO,MAAM,OAAO;;;;;;;CAOV,CAAC;AAEX,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAIlE"}
@@ -0,0 +1,29 @@
1
+ import chalk from "chalk";
2
+ import logSymbols from "log-symbols";
3
+ export const colors = {
4
+ success: chalk.green,
5
+ error: chalk.red,
6
+ warning: chalk.yellow,
7
+ info: chalk.cyan,
8
+ hint: chalk.gray,
9
+ accent: chalk.magenta,
10
+ bold: chalk.bold,
11
+ dim: chalk.dim,
12
+ label: chalk.bold.white,
13
+ };
14
+ export const symbols = {
15
+ success: logSymbols.success,
16
+ error: logSymbols.error,
17
+ warning: logSymbols.warning,
18
+ info: logSymbols.info,
19
+ arrow: "→",
20
+ bullet: "●",
21
+ };
22
+ export function scoreColor(score) {
23
+ if (score >= 0.7)
24
+ return chalk.green;
25
+ if (score >= 0.4)
26
+ return chalk.yellow;
27
+ return chalk.red;
28
+ }
29
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/lib/ui/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,KAAK,CAAC,KAAK;IACpB,KAAK,EAAE,KAAK,CAAC,GAAG;IAChB,OAAO,EAAE,KAAK,CAAC,MAAM;IACrB,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,MAAM,EAAE,KAAK,CAAC,OAAO;IACrB,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,GAAG,EAAE,KAAK,CAAC,GAAG;IACd,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK;CACf,CAAC;AAEX,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,OAAO,EAAE,UAAU,CAAC,OAAO;IAC3B,KAAK,EAAE,UAAU,CAAC,KAAK;IACvB,OAAO,EAAE,UAAU,CAAC,OAAO;IAC3B,IAAI,EAAE,UAAU,CAAC,IAAI;IACrB,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;CACH,CAAC;AAEX,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC;IACrC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC;IACtC,OAAO,KAAK,CAAC,GAAG,CAAC;AACnB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Generates the "available commands" help text when an unknown command is entered.
3
+ *
4
+ * This is extracted as a pure function to enable unit testing independent of
5
+ * Commander.js program state.
6
+ */
7
+ export declare function buildUnknownCommandHelp(commandNames: string[]): string;
8
+ /**
9
+ * Creates a Commander.js outputError handler that:
10
+ * 1. Writes the original error message
11
+ * 2. Appends available commands list when the error is "unknown command"
12
+ */
13
+ export declare function createOutputErrorHandler(getCommandNames: () => string[]): (str: string, write: (s: string) => void) => void;
14
+ //# sourceMappingURL=unknown-command-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unknown-command-handler.d.ts","sourceRoot":"","sources":["../../src/lib/unknown-command-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAMtE;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,MAAM,MAAM,EAAE,GAC9B,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAOnD"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Generates the "available commands" help text when an unknown command is entered.
3
+ *
4
+ * This is extracted as a pure function to enable unit testing independent of
5
+ * Commander.js program state.
6
+ */
7
+ export function buildUnknownCommandHelp(commandNames) {
8
+ const sorted = [...commandNames].sort();
9
+ return (`\nAvailable commands: ${sorted.join(", ")}\n` +
10
+ `Run 'knowledgine --help' for usage information.\n`);
11
+ }
12
+ /**
13
+ * Creates a Commander.js outputError handler that:
14
+ * 1. Writes the original error message
15
+ * 2. Appends available commands list when the error is "unknown command"
16
+ */
17
+ export function createOutputErrorHandler(getCommandNames) {
18
+ return (str, write) => {
19
+ write(str);
20
+ if (str.includes("unknown command")) {
21
+ write(buildUnknownCommandHelp(getCommandNames()));
22
+ }
23
+ };
24
+ }
25
+ //# sourceMappingURL=unknown-command-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unknown-command-handler.js","sourceRoot":"","sources":["../../src/lib/unknown-command-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,YAAsB;IAC5D,MAAM,MAAM,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,IAAI,EAAE,CAAC;IACxC,OAAO,CACL,yBAAyB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;QAC9C,mDAAmD,CACpD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,eAA+B;IAE/B,OAAO,CAAC,GAAW,EAAE,KAA0B,EAAE,EAAE;QACjD,KAAK,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACpC,KAAK,CAAC,uBAAuB,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function validateCaptureUrl(url: string): URL;
2
+ //# sourceMappingURL=url-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-validator.d.ts","sourceRoot":"","sources":["../../src/lib/url-validator.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAqBnD"}
@@ -0,0 +1,21 @@
1
+ export function validateCaptureUrl(url) {
2
+ const parsed = new URL(url);
3
+ if (!["http:", "https:"].includes(parsed.protocol)) {
4
+ throw new Error("Only HTTP/HTTPS URLs are supported");
5
+ }
6
+ const hostname = parsed.hostname.toLowerCase();
7
+ // localhost拒否
8
+ if (hostname === "localhost" ||
9
+ hostname === "127.0.0.1" ||
10
+ hostname === "::1" ||
11
+ hostname === "[::1]" ||
12
+ hostname === "0.0.0.0") {
13
+ throw new Error("Local addresses are not allowed");
14
+ }
15
+ // プライベートIP拒否
16
+ if (/^(10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.|169\.254\.)/.test(hostname)) {
17
+ throw new Error("Private network addresses are not allowed");
18
+ }
19
+ return parsed;
20
+ }
21
+ //# sourceMappingURL=url-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-validator.js","sourceRoot":"","sources":["../../src/lib/url-validator.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IAC/C,cAAc;IACd,IACE,QAAQ,KAAK,WAAW;QACxB,QAAQ,KAAK,WAAW;QACxB,QAAQ,KAAK,KAAK;QAClB,QAAQ,KAAK,OAAO;QACpB,QAAQ,KAAK,SAAS,EACtB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IACD,aAAa;IACb,IAAI,4DAA4D,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChF,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}