@flowdot.ai/cli 1.0.0 → 1.0.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/ui/run.js CHANGED
@@ -1,132 +1 @@
1
- // packages/ui/src/run.tsx
2
- import { useState, useEffect, useRef, useCallback } from "react";
3
- import { render, Box, Text, useApp, useStdout } from "ink";
4
- import TextInput from "ink-text-input";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
- var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
7
- var SPINNER_INTERVAL = 300;
8
- var SlowSpinner = () => {
9
- const [frame, setFrame] = useState(0);
10
- useEffect(() => {
11
- const timer = setInterval(() => {
12
- setFrame((prev) => (prev + 1) % SPINNER_FRAMES.length);
13
- }, SPINNER_INTERVAL);
14
- return () => clearInterval(timer);
15
- }, []);
16
- return /* @__PURE__ */ jsx(Text, { children: SPINNER_FRAMES[frame] });
17
- };
18
- function sendToParent(message) {
19
- if (process.send) {
20
- process.send(message);
21
- }
22
- }
23
- function App() {
24
- const [messages, setMessages] = useState([]);
25
- const [input, setInput] = useState("");
26
- const [spinnerState, setSpinnerState] = useState({
27
- active: false,
28
- text: ""
29
- });
30
- const [isReady, setIsReady] = useState(false);
31
- const messageIdRef = useRef(0);
32
- const { exit } = useApp();
33
- const { stdout } = useStdout();
34
- const width = stdout?.columns || 80;
35
- useEffect(() => {
36
- const handleMessage = (message) => {
37
- switch (message.type) {
38
- case "display":
39
- setSpinnerState({ active: false, text: "" });
40
- setMessages((prev) => [
41
- ...prev,
42
- {
43
- id: messageIdRef.current++,
44
- content: message.content,
45
- color: message.color,
46
- bold: message.bold
47
- }
48
- ]);
49
- break;
50
- case "spinner:start":
51
- setSpinnerState({ active: true, text: message.text });
52
- break;
53
- case "spinner:succeed":
54
- case "spinner:fail":
55
- case "spinner:warn":
56
- setSpinnerState({ active: false, text: "" });
57
- if (message.text) {
58
- setMessages((prev) => [
59
- ...prev,
60
- {
61
- id: messageIdRef.current++,
62
- content: message.text,
63
- color: message.type === "spinner:succeed" ? "green" : message.type === "spinner:fail" ? "red" : "yellow"
64
- }
65
- ]);
66
- }
67
- break;
68
- case "clear":
69
- setMessages([]);
70
- break;
71
- case "prompt":
72
- break;
73
- case "exit":
74
- exit();
75
- process.exit(0);
76
- break;
77
- default:
78
- break;
79
- }
80
- };
81
- process.on("message", handleMessage);
82
- sendToParent({ type: "ready" });
83
- setIsReady(true);
84
- return () => {
85
- process.removeListener("message", handleMessage);
86
- };
87
- }, [exit]);
88
- const handleSubmit = useCallback((value) => {
89
- if (!value.trim()) {
90
- return;
91
- }
92
- sendToParent({ type: "input", value });
93
- setInput("");
94
- }, []);
95
- const handleExit = useCallback(() => {
96
- sendToParent({ type: "exit" });
97
- exit();
98
- }, [exit]);
99
- if (!isReady) {
100
- return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { color: "cyan", children: "Initializing..." }) });
101
- }
102
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", width, children: [
103
- /* @__PURE__ */ jsx(Box, { borderStyle: "round", borderColor: "cyan", paddingX: 1, children: /* @__PURE__ */ jsx(Text, { color: "cyan", bold: true, children: "FlowDot CLI" }) }),
104
- /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginY: 1, children: messages.map((msg) => /* @__PURE__ */ jsx(Text, { color: msg.color || "white", bold: msg.bold, children: msg.content }, msg.id)) }),
105
- spinnerState.active && /* @__PURE__ */ jsxs(Box, { children: [
106
- /* @__PURE__ */ jsx(Text, { color: "cyan", children: /* @__PURE__ */ jsx(SlowSpinner, {}) }),
107
- /* @__PURE__ */ jsxs(Text, { children: [
108
- " ",
109
- spinnerState.text
110
- ] })
111
- ] }),
112
- /* @__PURE__ */ jsxs(Box, { children: [
113
- /* @__PURE__ */ jsx(Text, { color: "green", bold: true, children: "> " }),
114
- /* @__PURE__ */ jsx(
115
- TextInput,
116
- {
117
- value: input,
118
- onChange: setInput,
119
- onSubmit: handleSubmit
120
- }
121
- )
122
- ] }),
123
- /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "Press Ctrl+C to exit" }) })
124
- ] });
125
- }
126
- process.stdin.resume();
127
- render(/* @__PURE__ */ jsx(App, {}));
128
- /**
129
- * @license
130
- * Copyright 2026 FlowDot
131
- * SPDX-License-Identifier: Apache-2.0
132
- */
1
+ import{useState as c,useEffect as I,useRef as v,useCallback as g}from"react";import{render as R,Box as o,Text as r,useApp as B,useStdout as M}from"ink";import C from"ink-text-input";import{jsx as e,jsxs as l}from"react/jsx-runtime";var m=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],E=300,D=()=>{let[s,i]=c(0);return I(()=>{let d=setInterval(()=>{i(a=>(a+1)%m.length)},E);return()=>clearInterval(d)},[]),e(r,{children:m[s]})};function y(s){process.send&&process.send(s)}function N(){let[s,i]=c([]),[d,a]=c(""),[f,x]=c({active:!1,text:""}),[S,T]=c(!1),b=v(0),{exit:p}=B(),{stdout:k}=M(),h=k?.columns||80;I(()=>{let t=n=>{switch(n.type){case"display":x({active:!1,text:""}),i(u=>[...u,{id:b.current++,content:n.content,color:n.color,bold:n.bold}]);break;case"spinner:start":x({active:!0,text:n.text});break;case"spinner:succeed":case"spinner:fail":case"spinner:warn":x({active:!1,text:""}),n.text&&i(u=>[...u,{id:b.current++,content:n.text,color:n.type==="spinner:succeed"?"green":n.type==="spinner:fail"?"red":"yellow"}]);break;case"clear":i([]);break;case"prompt":break;case"exit":p(),process.exit(0);break;default:break}};return process.on("message",t),y({type:"ready"}),T(!0),()=>{process.removeListener("message",t)}},[p]);let w=g(t=>{t.trim()&&(y({type:"input",value:t}),a(""))},[]),A=g(()=>{y({type:"exit"}),p()},[p]);return S?l(o,{flexDirection:"column",width:h,children:[e(o,{borderStyle:"round",borderColor:"cyan",paddingX:1,children:e(r,{color:"cyan",bold:!0,children:"FlowDot CLI"})}),e(o,{flexDirection:"column",marginY:1,children:s.map(t=>e(r,{color:t.color||"white",bold:t.bold,children:t.content},t.id))}),f.active&&l(o,{children:[e(r,{color:"cyan",children:e(D,{})}),l(r,{children:[" ",f.text]})]}),l(o,{children:[e(r,{color:"green",bold:!0,children:"> "}),e(C,{value:d,onChange:a,onSubmit:w})]}),e(o,{marginTop:1,children:e(r,{color:"gray",children:"Press Ctrl+C to exit"})})]}):e(o,{children:e(r,{color:"cyan",children:"Initializing..."})})}process.stdin.resume();R(e(N,{}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowdot.ai/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Official CLI for FlowDot - Execute workflows, send messages to the agent, and manage your account from the command line",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,17 +10,25 @@
10
10
  "packages/*"
11
11
  ],
12
12
  "scripts": {
13
+ "clean": "rimraf dist coverage",
13
14
  "build": "node esbuild.config.js",
14
15
  "build:extension": "npm run build --workspace=flowdot-vscode && npm run package:all --workspace=flowdot-vscode",
15
16
  "build:all": "npm run build && npm run build:extension",
16
17
  "dev": "node esbuild.config.js --watch",
17
- "test": "vitest",
18
- "lint": "eslint .",
19
- "prepublishOnly": "npm run build:all"
18
+ "lint": "cross-env NODE_OPTIONS=--max-old-space-size=8192 eslint .",
19
+ "lint:fix": "cross-env NODE_OPTIONS=--max-old-space-size=8192 eslint . --fix",
20
+ "type-check": "tsc --noEmit",
21
+ "test": "vitest run",
22
+ "test:watch": "vitest",
23
+ "verify-pack": "node scripts/verify-pack.mjs",
24
+ "publish:safe": "node scripts/publish.mjs",
25
+ "prepublishOnly": "npm run clean && npm run lint && npm test && npm run build && npm run verify-pack",
26
+ "prepare": "husky || true"
20
27
  },
21
28
  "files": [
22
29
  "dist",
23
30
  "packages/core/assets",
31
+ "LICENSE",
24
32
  "README.md"
25
33
  ],
26
34
  "publishConfig": {
@@ -28,15 +36,16 @@
28
36
  },
29
37
  "repository": {
30
38
  "type": "git",
31
- "url": "https://github.com/flowdot-llc/flowdot-cli"
39
+ "url": "https://github.com/ElliotTheGreek/flowdot-cli.git"
32
40
  },
33
41
  "homepage": "https://flowdot.ai/docs/cli",
34
42
  "author": "FlowDot",
35
- "license": "MIT",
43
+ "license": "SEE LICENSE IN LICENSE",
36
44
  "engines": {
37
45
  "node": ">=20.0.0"
38
46
  },
39
47
  "devDependencies": {
48
+ "@eslint/js": "^9.24.0",
40
49
  "@types/js-yaml": "^4.0.9",
41
50
  "@types/node": "^20.11.20",
42
51
  "@types/react": "^19.2.0",
@@ -53,11 +62,14 @@
53
62
  "eslint-plugin-react": "^7.37.5",
54
63
  "eslint-plugin-react-hooks": "^5.2.0",
55
64
  "globals": "^16.0.0",
65
+ "husky": "^9.1.7",
56
66
  "ink-spinner": "^5.0.0",
57
67
  "ink-testing-library": "^4.0.0",
58
68
  "ink-text-input": "^6.0.0",
59
69
  "jest-environment-jsdom": "^30.2.0",
70
+ "lint-staged": "^15.2.10",
60
71
  "prettier": "^3.2.5",
72
+ "rimraf": "^6.0.1",
61
73
  "typescript": "^5.3.3",
62
74
  "typescript-eslint": "^8.30.1",
63
75
  "uuid": "^10.0.0",
@@ -65,8 +77,13 @@
65
77
  "vitest": "^3.2.4"
66
78
  },
67
79
  "dependencies": {
68
- "@flowdot.ai/api": "^1.0.2",
80
+ "@flowdot.ai/api": "^1.0.5",
69
81
  "ink": "npm:@jrichman/ink@6.4.6",
70
82
  "react": "^19.2.0"
83
+ },
84
+ "lint-staged": {
85
+ "*.{ts,tsx}": [
86
+ "cross-env NODE_OPTIONS=--max-old-space-size=8192 eslint --fix"
87
+ ]
71
88
  }
72
89
  }