@yuaone/cli 0.1.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 (58) hide show
  1. package/LICENSE +663 -0
  2. package/dist/auth.d.ts +71 -0
  3. package/dist/auth.d.ts.map +1 -0
  4. package/dist/auth.js +240 -0
  5. package/dist/auth.js.map +1 -0
  6. package/dist/cli.d.ts +16 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +212 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/cloud-client.d.ts +179 -0
  11. package/dist/cloud-client.d.ts.map +1 -0
  12. package/dist/cloud-client.js +369 -0
  13. package/dist/cloud-client.js.map +1 -0
  14. package/dist/config.d.ts +59 -0
  15. package/dist/config.d.ts.map +1 -0
  16. package/dist/config.js +214 -0
  17. package/dist/config.js.map +1 -0
  18. package/dist/design-renderer.d.ts +16 -0
  19. package/dist/design-renderer.d.ts.map +1 -0
  20. package/dist/design-renderer.js +78 -0
  21. package/dist/design-renderer.js.map +1 -0
  22. package/dist/design.d.ts +18 -0
  23. package/dist/design.d.ts.map +1 -0
  24. package/dist/design.js +190 -0
  25. package/dist/design.js.map +1 -0
  26. package/dist/diff-renderer.d.ts +56 -0
  27. package/dist/diff-renderer.d.ts.map +1 -0
  28. package/dist/diff-renderer.js +133 -0
  29. package/dist/diff-renderer.js.map +1 -0
  30. package/dist/index.d.ts +16 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +16 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/interactive.d.ts +73 -0
  35. package/dist/interactive.d.ts.map +1 -0
  36. package/dist/interactive.js +638 -0
  37. package/dist/interactive.js.map +1 -0
  38. package/dist/oneshot.d.ts +17 -0
  39. package/dist/oneshot.d.ts.map +1 -0
  40. package/dist/oneshot.js +281 -0
  41. package/dist/oneshot.js.map +1 -0
  42. package/dist/progress-renderer.d.ts +116 -0
  43. package/dist/progress-renderer.d.ts.map +1 -0
  44. package/dist/progress-renderer.js +249 -0
  45. package/dist/progress-renderer.js.map +1 -0
  46. package/dist/renderer.d.ts +67 -0
  47. package/dist/renderer.d.ts.map +1 -0
  48. package/dist/renderer.js +182 -0
  49. package/dist/renderer.js.map +1 -0
  50. package/dist/session.d.ts +71 -0
  51. package/dist/session.d.ts.map +1 -0
  52. package/dist/session.js +246 -0
  53. package/dist/session.js.map +1 -0
  54. package/dist/y-spinner.d.ts +34 -0
  55. package/dist/y-spinner.d.ts.map +1 -0
  56. package/dist/y-spinner.js +93 -0
  57. package/dist/y-spinner.js.map +1 -0
  58. package/package.json +45 -0
@@ -0,0 +1,133 @@
1
+ /**
2
+ * YUAN CLI — Terminal Diff Viewer
3
+ *
4
+ * Renders unified diffs with color in the terminal.
5
+ * Design ref: Section 10.3 of YUAN_CODING_AGENT_DESIGN.md
6
+ */
7
+ import * as readline from "node:readline";
8
+ import { colors } from "./renderer.js";
9
+ const ESC = "\x1b[";
10
+ function c(color, text) {
11
+ return `${color}${text}${ESC}0m`;
12
+ }
13
+ /**
14
+ * DiffRenderer — renders diffs in the terminal with colors
15
+ */
16
+ export class DiffRenderer {
17
+ /**
18
+ * Render a unified diff to the terminal.
19
+ * Additions are green (+), deletions are red (-), context is dim.
20
+ */
21
+ render(diff) {
22
+ const { filePath, hunks, stats } = diff;
23
+ // File header
24
+ const statsStr = c(colors.green, `+${stats.additions}`) +
25
+ " " +
26
+ c(colors.red, `-${stats.deletions}`);
27
+ console.log();
28
+ console.log(c(colors.bold, ` ${filePath}`) + ` ${statsStr}`);
29
+ console.log(c(colors.dim, " " + "─".repeat(60)));
30
+ // Render each hunk
31
+ for (const hunk of hunks) {
32
+ // Hunk header
33
+ const hunkHeader = `@@ -${hunk.startLineOld} +${hunk.startLineNew} @@`;
34
+ console.log(c(colors.cyan, ` ${hunkHeader}`));
35
+ for (const line of hunk.lines) {
36
+ const oldNum = line.lineNumberOld?.toString().padStart(4, " ") ?? " ";
37
+ const newNum = line.lineNumberNew?.toString().padStart(4, " ") ?? " ";
38
+ switch (line.type) {
39
+ case "add":
40
+ console.log(` ${c(colors.dim, oldNum)} ${c(colors.green, newNum)} ` +
41
+ c(colors.green, `+ ${line.content}`));
42
+ break;
43
+ case "delete":
44
+ console.log(` ${c(colors.red, oldNum)} ${c(colors.dim, newNum)} ` +
45
+ c(colors.red, `- ${line.content}`));
46
+ break;
47
+ case "context":
48
+ console.log(` ${c(colors.dim, oldNum)} ${c(colors.dim, newNum)} ` +
49
+ c(colors.dim, ` ${line.content}`));
50
+ break;
51
+ }
52
+ }
53
+ }
54
+ console.log(c(colors.dim, " " + "─".repeat(60)));
55
+ }
56
+ /**
57
+ * Render a raw unified diff string (e.g. from `git diff`).
58
+ * Parses lines and colorizes +/- lines.
59
+ */
60
+ renderRawDiff(diffText) {
61
+ const lines = diffText.split("\n");
62
+ for (const line of lines) {
63
+ if (line.startsWith("+++") || line.startsWith("---")) {
64
+ console.log(c(colors.bold, ` ${line}`));
65
+ }
66
+ else if (line.startsWith("@@")) {
67
+ console.log(c(colors.cyan, ` ${line}`));
68
+ }
69
+ else if (line.startsWith("+")) {
70
+ console.log(c(colors.green, ` ${line}`));
71
+ }
72
+ else if (line.startsWith("-")) {
73
+ console.log(c(colors.red, ` ${line}`));
74
+ }
75
+ else {
76
+ console.log(c(colors.dim, ` ${line}`));
77
+ }
78
+ }
79
+ }
80
+ /**
81
+ * Prompt the user to accept, reject, or rollback a diff.
82
+ * Returns the user's decision.
83
+ */
84
+ async promptDecision(filePath) {
85
+ const rl = readline.createInterface({
86
+ input: process.stdin,
87
+ output: process.stdout,
88
+ });
89
+ return new Promise((resolve) => {
90
+ const question = c(colors.yellow, "\n Apply this change? ") +
91
+ c(colors.dim, "[Y/n/rollback] ");
92
+ rl.question(question, (answer) => {
93
+ rl.close();
94
+ const a = answer.trim().toLowerCase();
95
+ if (a === "n" || a === "no") {
96
+ resolve("reject");
97
+ }
98
+ else if (a === "rollback" || a === "r") {
99
+ resolve("rollback");
100
+ }
101
+ else {
102
+ resolve("accept");
103
+ }
104
+ });
105
+ });
106
+ }
107
+ /**
108
+ * Render a summary of all changed files.
109
+ */
110
+ renderSummary(diffs) {
111
+ console.log();
112
+ console.log(c(colors.bold, ` Changed Files (${diffs.length})`));
113
+ console.log(c(colors.dim, " " + "─".repeat(50)));
114
+ let totalAdd = 0;
115
+ let totalDel = 0;
116
+ for (const diff of diffs) {
117
+ totalAdd += diff.stats.additions;
118
+ totalDel += diff.stats.deletions;
119
+ const statsStr = c(colors.green, `+${diff.stats.additions}`.padStart(5)) +
120
+ " " +
121
+ c(colors.red, `-${diff.stats.deletions}`.padStart(5));
122
+ console.log(` ${statsStr} ${diff.filePath}`);
123
+ }
124
+ console.log(c(colors.dim, " " + "─".repeat(50)));
125
+ console.log(c(colors.dim, " Total: ") +
126
+ c(colors.green, `+${totalAdd}`) +
127
+ " " +
128
+ c(colors.red, `-${totalDel}`) +
129
+ c(colors.dim, ` across ${diffs.length} files`));
130
+ console.log();
131
+ }
132
+ }
133
+ //# sourceMappingURL=diff-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-renderer.js","sourceRoot":"","sources":["../src/diff-renderer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB,SAAS,CAAC,CAAC,KAAa,EAAE,IAAY;IACpC,OAAO,GAAG,KAAK,GAAG,IAAI,GAAG,GAAG,IAAI,CAAC;AACnC,CAAC;AA4BD;;GAEG;AACH,MAAM,OAAO,YAAY;IACvB;;;OAGG;IACH,MAAM,CAAC,IAAiB;QACtB,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QAExC,cAAc;QACd,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IA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AC;QAED,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CACT,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC;YACxB,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,QAAQ,EAAE,CAAC;YAC/B,GAAG;YACH,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,QAAQ,EAAE,CAAC;YAC7B,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,WAAW,KAAK,CAAC,MAAM,QAAQ,CAAC,CACjD,CAAC;QACF,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * YUAN CLI — Public API Exports
3
+ *
4
+ * Re-exports all modules for programmatic use.
5
+ */
6
+ export { ConfigManager, type YuanConfig, type Provider } from "./config.js";
7
+ export { TerminalRenderer, Spinner, colors } from "./renderer.js";
8
+ export { DiffRenderer, type UnifiedDiff, type DiffHunk, type DiffLine, type DiffDecision, } from "./diff-renderer.js";
9
+ export { SessionManager, type SessionData, type SessionMessage, } from "./session.js";
10
+ export { InteractiveSession } from "./interactive.js";
11
+ export { runOneshot } from "./oneshot.js";
12
+ export { login, logout, getAuth, verifyAuth, type AuthData, type AuthUser, type AuthPlan, } from "./auth.js";
13
+ export { YSpinner } from "./y-spinner.js";
14
+ export { DesignRenderer } from "./design-renderer.js";
15
+ export { ProgressRenderer, renderBar, type ProgressRendererConfig, type AgentPhase, type StatusEvent, type ToolCallEvent, type ToolResultEvent, type ApprovalEvent, type DoneResult, } from "./progress-renderer.js";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EACL,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,UAAU,EACV,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,QAAQ,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,UAAU,GAChB,MAAM,wBAAwB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * YUAN CLI — Public API Exports
3
+ *
4
+ * Re-exports all modules for programmatic use.
5
+ */
6
+ export { ConfigManager } from "./config.js";
7
+ export { TerminalRenderer, Spinner, colors } from "./renderer.js";
8
+ export { DiffRenderer, } from "./diff-renderer.js";
9
+ export { SessionManager, } from "./session.js";
10
+ export { InteractiveSession } from "./interactive.js";
11
+ export { runOneshot } from "./oneshot.js";
12
+ export { login, logout, getAuth, verifyAuth, } from "./auth.js";
13
+ export { YSpinner } from "./y-spinner.js";
14
+ export { DesignRenderer } from "./design-renderer.js";
15
+ export { ProgressRenderer, renderBar, } from "./progress-renderer.js";
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAkC,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EACL,YAAY,GAKb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,cAAc,GAGf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,UAAU,GAIX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,SAAS,GAQV,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * YUAN CLI — Interactive Mode
3
+ *
4
+ * REPL loop for interactive agent sessions.
5
+ * Supports slash commands, multiline input, and streaming responses.
6
+ * Wired to @yuaone/core AgentLoop + @yuaone/tools for real LLM-powered execution.
7
+ */
8
+ import { TerminalRenderer } from "./renderer.js";
9
+ import { SessionManager, type SessionData } from "./session.js";
10
+ import { ConfigManager } from "./config.js";
11
+ /**
12
+ * InteractiveSession — the main REPL for `yuan` interactive mode
13
+ */
14
+ export declare class InteractiveSession {
15
+ private renderer;
16
+ private diffRenderer;
17
+ private sessionManager;
18
+ private configManager;
19
+ private session;
20
+ private rl;
21
+ private isRunning;
22
+ private isStreaming;
23
+ /** Track files changed during the session for /diff and /undo */
24
+ private changedFiles;
25
+ constructor(renderer: TerminalRenderer, sessionManager: SessionManager, configManager: ConfigManager, existingSession?: SessionData);
26
+ /** Start the interactive REPL */
27
+ start(): Promise<void>;
28
+ /** Handle a slash command. Returns false if session should end. */
29
+ private handleSlashCommand;
30
+ /** Show available slash commands */
31
+ private showHelp;
32
+ /** Show current session info */
33
+ private showSessionInfo;
34
+ /**
35
+ * Handle /undo command.
36
+ * Reverts the last file change using git checkout or .yuan-backup files.
37
+ */
38
+ private handleUndo;
39
+ /**
40
+ * Handle /diff command.
41
+ * Shows git diff for files changed during this session.
42
+ */
43
+ private handleDiff;
44
+ /**
45
+ * Process a user message — dispatches to local or cloud mode.
46
+ */
47
+ private processMessage;
48
+ /**
49
+ * Process a user message via CloudClient (cloud mode).
50
+ * Starts a remote session, streams SSE events, handles approvals.
51
+ */
52
+ private processMessageCloud;
53
+ /**
54
+ * Prompt the user for cloud-mode approval and send response to server.
55
+ */
56
+ private promptCloudApproval;
57
+ /**
58
+ * Process a user message through the local AgentLoop.
59
+ * Creates BYOKClient + ToolExecutor, runs AgentLoop.run(), and renders events.
60
+ */
61
+ private processMessageLocal;
62
+ /**
63
+ * Prompt the user for approval of a dangerous action.
64
+ * Shows the action details and waits for Y/N/A input.
65
+ *
66
+ * @param request The approval request from ApprovalManager
67
+ * @returns 'approve', 'reject', or 'always_approve'
68
+ */
69
+ private promptApproval;
70
+ /** Stop the interactive session */
71
+ private stop;
72
+ }
73
+ //# sourceMappingURL=interactive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../src/interactive.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,gBAAgB,EAAU,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA+B5C;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAmB;IACnC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,EAAE,CAAmC;IAC7C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,iEAAiE;IACjE,OAAO,CAAC,YAAY,CAAgB;gBAGlC,QAAQ,EAAE,gBAAgB,EAC1B,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,eAAe,CAAC,EAAE,WAAW;IAiB/B,iCAAiC;IAC3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAqE5B,mEAAmE;IACnE,OAAO,CAAC,kBAAkB;IA2C1B,oCAAoC;IACpC,OAAO,CAAC,QAAQ;IAYhB,gCAAgC;IAChC,OAAO,CAAC,eAAe;IAYvB;;;OAGG;IACH,OAAO,CAAC,UAAU;IA8BlB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAsClB;;OAEG;YACW,cAAc;IAO5B;;;OAGG;YACW,mBAAmB;IA2IjC;;OAEG;YACW,mBAAmB;IAiCjC;;;OAGG;YACW,mBAAmB;IAiMjC;;;;;;OAMG;YACW,cAAc;IAqE5B,mCAAmC;IACnC,OAAO,CAAC,IAAI;CAQb"}