linkedin-repo-storyteller-cli 0.1.0 → 0.1.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 (3) hide show
  1. package/README.md +2 -0
  2. package/cli.js +54 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  A small terminal client for the LinkedIn Repo Storyteller Eve agent. It runs on your computer, collects a public GitHub repository URL, and sends it to the agent hosted on Vercel.
4
4
 
5
+ When the analysis completes, the CLI saves the generated Markdown draft in the user's Desktop folder. On Windows, it checks the standard Desktop folder and common OneDrive Desktop locations.
6
+
5
7
  ## Requirements
6
8
 
7
9
  - Node.js 24 or later
package/cli.js CHANGED
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { createInterface } from "node:readline/promises";
4
+ import { mkdir, stat, writeFile } from "node:fs/promises";
5
+ import { homedir } from "node:os";
6
+ import path from "node:path";
4
7
  import { stdin, stdout } from "node:process";
5
8
  import { Client } from "eve/client";
6
9
 
@@ -56,6 +59,40 @@ function describeError(error) {
56
59
  return error instanceof Error ? error.message : String(error);
57
60
  }
58
61
 
62
+ async function getDesktopPath() {
63
+ const desktopPaths = [];
64
+ if (process.platform === "win32") {
65
+ for (const oneDrivePath of [process.env.OneDrive, process.env.OneDriveConsumer, process.env.OneDriveCommercial]) {
66
+ if (oneDrivePath) desktopPaths.push(path.join(oneDrivePath, "Desktop"));
67
+ }
68
+ }
69
+ desktopPaths.push(path.join(homedir(), "Desktop"));
70
+
71
+ for (const desktopPath of desktopPaths) {
72
+ try {
73
+ if ((await stat(desktopPath)).isDirectory()) return desktopPath;
74
+ } catch {
75
+ // Try the next conventional Desktop location.
76
+ }
77
+ }
78
+
79
+ const defaultDesktop = path.join(homedir(), "Desktop");
80
+ try {
81
+ await mkdir(defaultDesktop, { recursive: true });
82
+ return defaultDesktop;
83
+ } catch {
84
+ throw new Error("Could not access a Desktop folder to save the LinkedIn draft.");
85
+ }
86
+ }
87
+
88
+ async function saveDraftToDesktop(text) {
89
+ const desktopPath = await getDesktopPath();
90
+ const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
91
+ const filePath = path.join(desktopPath, `linkedin-post-${timestamp}.md`);
92
+ await writeFile(filePath, `${text.trim()}\n`, { encoding: "utf8", flag: "wx" });
93
+ return filePath;
94
+ }
95
+
59
96
  async function main() {
60
97
  printWelcome();
61
98
  const repoUrl = await askForRepository();
@@ -69,13 +106,22 @@ async function main() {
69
106
  });
70
107
 
71
108
  let wroteAssistantText = false;
109
+ let assistantText = "";
110
+ let draftToSave = "";
72
111
  for await (const event of response) {
73
112
  if (event.type === "message.appended") {
113
+ assistantText += event.data.messageDelta;
74
114
  if (!wroteAssistantText) {
75
115
  stdout.write("\n");
76
116
  wroteAssistantText = true;
77
117
  }
78
118
  stdout.write(event.data.messageDelta);
119
+ } else if (event.type === "action.result") {
120
+ const result = event.data.result;
121
+ if (result.kind === "tool-result" && result.output && typeof result.output === "object") {
122
+ const contentToSave = result.output.contentToSave;
123
+ if (typeof contentToSave === "string") draftToSave = contentToSave;
124
+ }
79
125
  } else if (event.type === "actions.requested") {
80
126
  const actions = event.data.actions ?? [];
81
127
  const labels = actions.map((action) => action.label ?? action.name).filter(Boolean);
@@ -86,7 +132,14 @@ async function main() {
86
132
  }
87
133
 
88
134
  if (wroteAssistantText) stdout.write("\n");
89
- console.log("\n\x1b[32m✓ Analysis finished.\x1b[0m");
135
+ const draft = draftToSave || assistantText.trim();
136
+ if (draft) {
137
+ const savedPath = await saveDraftToDesktop(draft);
138
+ console.log(`\n\x1b[32m✓ Analysis finished. Draft saved to ${savedPath}\x1b[0m`);
139
+ } else {
140
+ console.log("\n\x1b[32m✓ Analysis finished.\x1b[0m");
141
+ console.log("No draft text was returned to save.");
142
+ }
90
143
  }
91
144
 
92
145
  main().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkedin-repo-storyteller-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A terminal client for turning GitHub repositories into LinkedIn post drafts with a remote Eve agent.",
5
5
  "type": "module",
6
6
  "bin": {