Skip to content

Commit 0d80f3b

Browse files
Add hello world on-boarding to install script
1 parent fd52449 commit 0d80f3b

1 file changed

Lines changed: 278 additions & 3 deletions

File tree

install.sh

Lines changed: 278 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ GRAY_LIGHT='\033[38;2;211;211;211m' # #D3D3D3
1616
BOLD='\033[1m'
1717
NC='\033[0m' # No Color / Reset
1818

19+
clear
1920
echo -e "started ${YELLOW}${BOLD}*codeplain CLI${NC} installation..."
2021

2122
# Install uv if not present
@@ -105,12 +106,11 @@ else
105106
else
106107
sed -i "s|export CODEPLAIN_API_KEY=.*|export CODEPLAIN_API_KEY=\"$API_KEY\"|" "$SHELL_RC"
107108
fi
108-
echo -e "${GREEN}${NC} API key added to ${SHELL_RC}"
109109
fi
110-
111110
fi
112111

113112
# ASCII Art Welcome
113+
clear
114114
echo ""
115115
echo -e "${NC}"
116116
echo -e "${GRAY}────────────────────────────────────────────${NC}"
@@ -124,13 +124,288 @@ cat << 'EOF'
124124
|_|
125125
EOF
126126
echo ""
127+
echo -e "${GREEN}${NC} Sign in successful."
128+
echo ""
127129
echo -e " ${YELLOW}welcome to *codeplain!${NC}"
128130
echo ""
129131
echo -e " spec-driven, production-ready code generation"
130132
echo ""
131133
echo ""
132134
echo -e "${GRAY}────────────────────────────────────────────${NC}"
133135
echo ""
136+
echo -e " would you like to get a quick intro to ***plain specification language?"
137+
echo ""
138+
read -p " [Y/n]: " WALKTHROUGH_CHOICE </dev/tty
139+
echo ""
140+
141+
# Default to yes if empty, check for explicit no
142+
if [[ ! "$WALKTHROUGH_CHOICE" =~ ^[Nn]$ ]]; then
143+
144+
# Onboarding Step 1: Introduction to Plain
145+
clear
146+
echo ""
147+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
148+
echo -e " ${YELLOW}${BOLD}quick intro to ***plain specification language{NC} - Step 1 of 5"
149+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
150+
echo ""
151+
echo -e " ***plain is a language of spec-driven development that allows developers to express intent on any level of detail."
152+
echo ""
153+
echo -e " write specs in ${YELLOW}plain English${NC}, in markdown with additional syntax"
154+
echo ""
155+
echo -e " render production-ready code with *codeplain."
156+
echo ""
157+
echo -e " A ***plain file has these key sections:"
158+
echo ""
159+
echo -e "${GRAY} ┌────────────────────────────────────────────────────────┐${NC}"
160+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
161+
echo -e "${GRAY}${NC} ${YELLOW}***definitions***${NC} - key concepts in your app ${GRAY}${NC}"
162+
echo -e "${GRAY}${NC} ${YELLOW}***technical specs***${NC} - implementation details ${GRAY}${NC}"
163+
echo -e "${GRAY}${NC} ${YELLOW}***test specs***${NC} - testing requirements ${GRAY}${NC}"
164+
echo -e "${GRAY}${NC} ${YELLOW}***functional specs***${NC} - what the app should do ${GRAY}${NC}"
165+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
166+
echo -e "${GRAY} └────────────────────────────────────────────────────────┘${NC}"
167+
echo ""
168+
echo -e " Let's see each section in a \"hello, world\" example."
169+
echo ""
170+
read -p " press [Enter] to continue..." </dev/tty
171+
172+
# Onboarding Step 2: Functional Specification
173+
clear
174+
echo ""
175+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
176+
echo -e " ${YELLOW}${BOLD}Plain Language 101${NC} - Step 2 of 5"
177+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
178+
echo ""
179+
echo -e " ${WHITE}${BOLD}FUNCTIONAL SPECS${NC} - what should the app do?"
180+
echo ""
181+
echo -e " This is where you describe ${GREEN}what your app should do${NC},"
182+
echo -e " written in plain English. No code, just requirements."
183+
echo ""
184+
echo -e "${GRAY} ┌────────────────────────────────────────────────────────┐${NC}"
185+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
186+
echo -e "${GRAY}${NC} ${GRAY}***definitions***${NC} ${GRAY}${NC}"
187+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
188+
echo -e "${GRAY}${NC} ${GRAY}- :App: is a console application.${NC} ${GRAY}${NC}"
189+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
190+
echo -e "${GRAY}${NC} ${GRAY}***technical specs***${NC} ${GRAY}${NC}"
191+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
192+
echo -e "${GRAY}${NC} ${GRAY}- :Implementation: should be in Python.${NC} ${GRAY}${NC}"
193+
echo -e "${GRAY}${NC} ${GRAY}- :UnitTests: should use Unittest framework.${NC} ${GRAY}${NC}"
194+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
195+
echo -e "${GRAY}${NC} ${GRAY}***test specs***${NC} ${GRAY}${NC}"
196+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
197+
echo -e "${GRAY}${NC} ${GRAY}- :ConformanceTests: should use Unittest.${NC} ${GRAY}${NC}"
198+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
199+
echo -e "${GRAY}${NC} ${YELLOW}${BOLD}***functional specs***${NC} ${GRAY}${NC}"
200+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
201+
echo -e "${GRAY}${NC} ${GREEN}${BOLD}- :App: should display \"hello, world\".${NC} ${GRAY}${NC}"
202+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
203+
echo -e "${GRAY} └────────────────────────────────────────────────────────┘${NC}"
204+
echo ""
205+
echo -e " ${GREEN}${NC} The ${YELLOW}functional spec${NC} describes ${GREEN}what${NC} the app does."
206+
echo -e " Here, it simply displays \"hello, world\"."
207+
echo ""
208+
read -p " press [Enter] to continue..." </dev/tty
209+
210+
# Onboarding Step 3: Definitions
211+
clear
212+
echo ""
213+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
214+
echo -e " ${YELLOW}${BOLD}Plain Language 101${NC} - Step 3 of 5"
215+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
216+
echo ""
217+
echo -e " ${WHITE}${BOLD}DEFINITIONS${NC} - identify key concepts"
218+
echo ""
219+
echo -e " Define ${GREEN}reusable concepts${NC} with the ${YELLOW}:ConceptName:${NC} syntax."
220+
echo -e " These become building blocks you can reference anywhere."
221+
echo ""
222+
echo -e "${GRAY} ┌────────────────────────────────────────────────────────┐${NC}"
223+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
224+
echo -e "${GRAY}${NC} ${YELLOW}${BOLD}***definitions***${NC} ${GRAY}${NC}"
225+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
226+
echo -e "${GRAY}${NC} ${GREEN}${BOLD}- :App: is a console application.${NC} ${GRAY}${NC}"
227+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
228+
echo -e "${GRAY}${NC} ${GRAY}***technical specs***${NC} ${GRAY}${NC}"
229+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
230+
echo -e "${GRAY}${NC} ${GRAY}- :Implementation: should be in Python.${NC} ${GRAY}${NC}"
231+
echo -e "${GRAY}${NC} ${GRAY}- :UnitTests: should use Unittest framework.${NC} ${GRAY}${NC}"
232+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
233+
echo -e "${GRAY}${NC} ${GRAY}***test specs***${NC} ${GRAY}${NC}"
234+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
235+
echo -e "${GRAY}${NC} ${GRAY}- :ConformanceTests: should use Unittest.${NC} ${GRAY}${NC}"
236+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
237+
echo -e "${GRAY}${NC} ${GRAY}***functional specs***${NC} ${GRAY}${NC}"
238+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
239+
echo -e "${GRAY}${NC} ${GRAY}- :App: should display \"hello, world\".${NC} ${GRAY}${NC}"
240+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
241+
echo -e "${GRAY} └────────────────────────────────────────────────────────┘${NC}"
242+
echo ""
243+
echo -e " ${GREEN}${NC} The ${YELLOW}:App:${NC} concept is defined once and used throughout."
244+
echo -e " Concepts help keep your specs consistent and clear."
245+
echo ""
246+
read -p " press [Enter] to continue..." </dev/tty
247+
248+
# Onboarding Step 4: Technical & Test Specs
249+
clear
250+
echo ""
251+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
252+
echo -e " ${YELLOW}${BOLD}Plain Language 101${NC} - Step 4 of 5"
253+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
254+
echo ""
255+
echo -e " ${WHITE}${BOLD}TECHNICAL & TEST SPECS${NC} - how to implement and test"
256+
echo ""
257+
echo -e " Specify ${GREEN}implementation details${NC} and ${GREEN}testing requirements${NC}."
258+
echo -e " This guides how the code should be generated and verified."
259+
echo ""
260+
echo -e "${GRAY} ┌────────────────────────────────────────────────────────┐${NC}"
261+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
262+
echo -e "${GRAY}${NC} ${GRAY}***definitions***${NC} ${GRAY}${NC}"
263+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
264+
echo -e "${GRAY}${NC} ${GRAY}- :App: is a console application.${NC} ${GRAY}${NC}"
265+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
266+
echo -e "${GRAY}${NC} ${YELLOW}${BOLD}***technical specs***${NC} ${GRAY}${NC}"
267+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
268+
echo -e "${GRAY}${NC} ${GREEN}${BOLD}- :Implementation: should be in Python.${NC} ${GRAY}${NC}"
269+
echo -e "${GRAY}${NC} ${GREEN}${BOLD}- :UnitTests: should use Unittest framework.${NC} ${GRAY}${NC}"
270+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
271+
echo -e "${GRAY}${NC} ${YELLOW}${BOLD}***test specs***${NC} ${GRAY}${NC}"
272+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
273+
echo -e "${GRAY}${NC} ${GREEN}${BOLD}- :ConformanceTests: should use Unittest.${NC} ${GRAY}${NC}"
274+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
275+
echo -e "${GRAY}${NC} ${GRAY}***functional specs***${NC} ${GRAY}${NC}"
276+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
277+
echo -e "${GRAY}${NC} ${GRAY}- :App: should display \"hello, world\".${NC} ${GRAY}${NC}"
278+
echo -e "${GRAY}${NC} ${GRAY}${NC}"
279+
echo -e "${GRAY} └────────────────────────────────────────────────────────┘${NC}"
280+
echo ""
281+
echo -e " ${GREEN}${NC} ${YELLOW}Technical specs${NC} define the language and frameworks."
282+
echo -e " ${YELLOW}Test specs${NC} ensure the generated code is verified."
283+
echo ""
284+
read -p " press [Enter] to continue..." </dev/tty
285+
286+
# Onboarding Step 5: Rendering Code
287+
clear
288+
echo ""
289+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
290+
echo -e " ${YELLOW}${BOLD}Plain Language 101${NC} - Step 5 of 5"
291+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
292+
echo ""
293+
echo -e " ${WHITE}${BOLD}RENDERING CODE${NC} - generate your app"
294+
echo ""
295+
echo -e " Once you have a Plain file, generate code with:"
296+
echo ""
297+
echo -e " ${YELLOW}${BOLD}codeplain hello_world.plain${NC}"
298+
echo ""
299+
echo -e " *codeplain will:"
300+
echo ""
301+
echo -e " ${GREEN}1.${NC} Read your specification"
302+
echo -e " ${GREEN}2.${NC} Generate implementation code"
303+
echo -e " ${GREEN}3.${NC} Create and run tests to verify correctness"
304+
echo -e " ${GREEN}4.${NC} Output production-ready code"
305+
echo ""
306+
echo -e " The generated code is guaranteed to match your specs"
307+
echo -e " and pass all defined tests."
308+
echo ""
309+
read -p " press [Enter] to finish..." </dev/tty
310+
311+
fi # End of walkthrough conditional
312+
313+
# Download examples step
314+
clear
315+
echo ""
316+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
317+
echo -e " ${YELLOW}${BOLD}Example Projects${NC}"
318+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
319+
echo ""
320+
echo -e " we've prepared some example Plain projects for you"
321+
echo -e " to explore and experiment with."
322+
echo ""
323+
echo -e " would you like to download them?"
324+
echo ""
325+
read -p " [Y/n]: " DOWNLOAD_EXAMPLES </dev/tty
326+
echo ""
327+
328+
if [[ ! "$DOWNLOAD_EXAMPLES" =~ ^[Nn]$ ]]; then
329+
# Show current directory and ask for extraction path
330+
CURRENT_DIR=$(pwd)
331+
echo -e " current folder: ${YELLOW}${CURRENT_DIR}${NC}"
332+
echo ""
333+
echo -e " extract examples here, or enter a different path:"
334+
echo ""
335+
read -p " [Enter for current, or type path]: " EXTRACT_PATH </dev/tty
336+
echo ""
337+
338+
# Use current directory if empty
339+
if [ -z "$EXTRACT_PATH" ]; then
340+
EXTRACT_PATH="$CURRENT_DIR"
341+
fi
342+
343+
# Expand ~ to home directory
344+
EXTRACT_PATH="${EXTRACT_PATH/#\~/$HOME}"
345+
346+
# Check if directory exists, create if not
347+
if [ ! -d "$EXTRACT_PATH" ]; then
348+
echo -e " ${GRAY}creating directory...${NC}"
349+
mkdir -p "$EXTRACT_PATH" 2>/dev/null
350+
if [ $? -ne 0 ]; then
351+
echo -e " ${RED}${NC} failed to create directory: ${EXTRACT_PATH}"
352+
echo -e " ${GRAY}skipping example download.${NC}"
353+
DOWNLOAD_EXAMPLES="n"
354+
fi
355+
fi
356+
357+
if [[ ! "$DOWNLOAD_EXAMPLES" =~ ^[Nn]$ ]]; then
358+
echo -e " ${GRAY}downloading examples...${NC}"
359+
360+
# Download the zip file
361+
TEMP_ZIP=$(mktemp)
362+
curl -L -s -o "$TEMP_ZIP" "https://github.com/Codeplain-ai/plainlang-examples/archive/refs/tags/0.1.zip"
363+
364+
if [ $? -eq 0 ] && [ -s "$TEMP_ZIP" ]; then
365+
echo -e " ${GRAY}extracting to ${EXTRACT_PATH}...${NC}"
366+
367+
# Extract the zip file
368+
unzip -q -o "$TEMP_ZIP" -d "$EXTRACT_PATH" 2>/dev/null
369+
370+
if [ $? -eq 0 ]; then
371+
# Remove the .gitignore file from the root of the extracted directory
372+
EXTRACTED_DIR="${EXTRACT_PATH}/plainlang-examples-on-boarding"
373+
if [ -f "${EXTRACTED_DIR}/.gitignore" ]; then
374+
rm -f "${EXTRACTED_DIR}/.gitignore"
375+
fi
376+
377+
echo ""
378+
echo -e " ${GREEN}${NC} examples downloaded successfully!"
379+
echo ""
380+
echo -e " examples are in: ${YELLOW}${EXTRACTED_DIR}${NC}"
381+
echo ""
382+
else
383+
echo -e " ${RED}${NC} failed to extract examples."
384+
fi
385+
386+
# Clean up temp file
387+
rm -f "$TEMP_ZIP"
388+
else
389+
echo -e " ${RED}${NC} failed to download examples."
390+
rm -f "$TEMP_ZIP"
391+
fi
392+
393+
echo ""
394+
read -p " press [Enter] to continue..." </dev/tty
395+
fi
396+
fi
397+
398+
# Final message
399+
clear
400+
echo ""
401+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
402+
echo -e " ${YELLOW}${BOLD}You're all set!${NC}"
403+
echo -e "${GRAY}────────────────────────────────────────────${NC}"
404+
echo ""
134405
echo -e " thank you for using *codeplain!"
135406
echo ""
136-
echo -e " run '${YELLOW}${BOLD}codeplain <path_to_plain_file>${NC}' to get started."
407+
echo ""
408+
echo -e " learn more at ${YELLOW}https://plainlang.org/{NC}"
409+
echo ""
410+
echo -e " ${GREEN}happy development!${NC} 🚀"
411+
echo ""

0 commit comments

Comments
 (0)