mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: add exploration quest with file navigation instructions and example files
This commit is contained in:
1 parent
26e79690f8
commit
c61f844e42
8 files changed
+172
-3
No files matched your search
@@ -2,7 +2,6 @@ import { defineStore } from 'pinia'
|
|||||||
import {
|
import {
|
||||||
FileGraph,
|
FileGraph,
|
||||||
type FileGraphUpdateEvent,
|
type FileGraphUpdateEvent,
|
||||||
type FileObject,
|
|
||||||
} from '../../../packages/file-graph'
|
} from '../../../packages/file-graph'
|
||||||
import type { IResponse, ITask } from '../../../packages/game'
|
import type { IResponse, ITask } from '../../../packages/game'
|
||||||
import type { SessionDetail } from '../../../server/src/routers/sessionRouter'
|
import type { SessionDetail } from '../../../server/src/routers/sessionRouter'
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
echo start
|
||||||
|
ls
|
||||||
|
cd folder1
|
||||||
|
ls
|
||||||
|
cd ..
|
||||||
|
cd folder2
|
||||||
|
ls
|
||||||
|
cd ..
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
id: explore
|
||||||
|
image: base
|
||||||
|
title: 探索檔案
|
||||||
|
instruction: |
|
||||||
|
在這個關卡中,你將會學到:
|
||||||
|
1. 如何使用 `ls` 查看資料夾的內容
|
||||||
|
2. 如何使用 `cd` 在資料夾之間移動
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
- get-started
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- id: start
|
||||||
|
name: 按下 `開始` 按鈕開始教程
|
||||||
|
condition:
|
||||||
|
command: ^echo start$
|
||||||
|
response:
|
||||||
|
content: |
|
||||||
|
在終端機中,並沒有圖形介面可以讓你查看資料夾的內容。
|
||||||
|
但是你可以透過 `ls` 指令來查看資料夾的內容。
|
||||||
|
`ls` 指令(第一個字是小寫L)是 list 的簡寫,也就是列出檔案的意思。
|
||||||
|
在輸入 `ls` 指令後,終端機會輸出資料夾中包含的檔案和資料夾。
|
||||||
|
現在,請你輸入 `ls` 指令,查看資料夾中有什麼東西。
|
||||||
|
hint: 輸入 `ls` 並查看資料夾的內容
|
||||||
|
|
||||||
|
- id: ls
|
||||||
|
name: 查看資料夾中的檔案
|
||||||
|
requirements:
|
||||||
|
- start
|
||||||
|
condition:
|
||||||
|
command: ^ls$
|
||||||
|
exceptions:
|
||||||
|
- id: wrong_directory
|
||||||
|
condition:
|
||||||
|
not:
|
||||||
|
pwd: /home/commander
|
||||||
|
response:
|
||||||
|
type: narrative
|
||||||
|
content: |
|
||||||
|
請先回到 `/home/commander/` 資料夾
|
||||||
|
輸入 `cd ~` 來返回 `/home/commander/` 資料夾
|
||||||
|
response:
|
||||||
|
content: |
|
||||||
|
你應該能看到資料夾中的內容了。
|
||||||
|
在畫面右邊的檔案樹也有了改變。
|
||||||
|
可以看出,在這個資料夾中包含了兩個資料夾,分別是 `folder1` 和 `folder2` 。
|
||||||
|
|
||||||
|
接下來,我要教你如何進入資料夾。
|
||||||
|
`cd` 指令是 change directory 的縮寫,也就是改變路徑的意思。
|
||||||
|
你可以通過輸入 `cd [資料夾名稱]` 來進入資料夾。
|
||||||
|
例如你要進入 `folder1` 資料夾,你可以輸入 `cd folder1` 。
|
||||||
|
現在,請你進入 `folder1` 資料夾。
|
||||||
|
hint: 輸入 `cd folder1` 來進入 `folder1` 資料夾
|
||||||
|
|
||||||
|
- id: cd-folder1
|
||||||
|
name: 進入 `folder1` 資料夾
|
||||||
|
requirements:
|
||||||
|
- ls
|
||||||
|
condition:
|
||||||
|
pwd: /home/commander/folder1
|
||||||
|
exceptions:
|
||||||
|
- id: wrong_spelling
|
||||||
|
condition:
|
||||||
|
command: ^folderl$
|
||||||
|
response:
|
||||||
|
type: narrative
|
||||||
|
content: |
|
||||||
|
`folder1` 的最後是數字 `1` 不是字母 `l`。
|
||||||
|
- id: wrong_directory
|
||||||
|
condition:
|
||||||
|
pwd: /home/commander
|
||||||
|
response:
|
||||||
|
type: narrative
|
||||||
|
content: 輸入 `cd folder1` 來進入 `folder1` 資料夾
|
||||||
|
- id: not_in_home
|
||||||
|
condition:
|
||||||
|
not:
|
||||||
|
pwd: /home/commander
|
||||||
|
response:
|
||||||
|
type: narrative
|
||||||
|
content: |
|
||||||
|
請先回到 `/home/commander/` 資料夾
|
||||||
|
輸入 `cd ~` 來返回 `/home/commander/` 資料夾
|
||||||
|
再輸入 `cd folder1` 來進入 `folder1` 資料夾
|
||||||
|
response:
|
||||||
|
content: |
|
||||||
|
你成功的進入 `folder1` 資料夾了。
|
||||||
|
你可以發現指令提示符從原本的
|
||||||
|
`commander:~ $` 變成了
|
||||||
|
`commander:~/folder1 $` 。
|
||||||
|
這表示你現在正位在 `folder1` 資料夾中。
|
||||||
|
現在,請查看 `folder1` 資料夾的內容。
|
||||||
|
hint: 輸入 `ls` 查看資料夾的內容
|
||||||
|
|
||||||
|
- id: ls-folder1
|
||||||
|
name: 查看 `folder1` 資料夾的內容
|
||||||
|
requirements:
|
||||||
|
- cd-folder1
|
||||||
|
condition:
|
||||||
|
pwd: /home/commander/folder1
|
||||||
|
command: ^ls$
|
||||||
|
response:
|
||||||
|
content: |
|
||||||
|
你現在可以看到 `folder1` 資料夾中有兩個檔案,分別是 `file1.txt` 跟 `file2.txt`。
|
||||||
|
現在我們可以離開 `folder1` 回到原本的資料夾了。
|
||||||
|
你可以使用 `cd ..` 回到上一層資料夾。
|
||||||
|
這裡的 `..` 代表的是上一層的資料夾。
|
||||||
|
hint: 輸入 `cd ..` 回到上一層資料夾
|
||||||
|
|
||||||
|
- id: cd_up
|
||||||
|
name: 回到上一層資料夾
|
||||||
|
requirements:
|
||||||
|
- ls-folder1
|
||||||
|
condition:
|
||||||
|
pwd: /home/commander
|
||||||
|
response:
|
||||||
|
content: |
|
||||||
|
你成功的回到上一層資料夾了。
|
||||||
|
現在,請你剛才所學的指令,進入 `folder2` 資料夾,檢查 `folder2` 資料夾的內容,最後回到這個資料夾。
|
||||||
|
hint: |
|
||||||
|
使用 `cd` 指令進出資料夾
|
||||||
|
使用 `ls` 指令查看資料夾的內容
|
||||||
|
|
||||||
|
- id: cd-folder2
|
||||||
|
name: 進入 `folder2` 資料夾
|
||||||
|
requirements:
|
||||||
|
- cd_up
|
||||||
|
condition:
|
||||||
|
pwd: /home/commander/folder2
|
||||||
|
response:
|
||||||
|
content: |
|
||||||
|
你成功的進入 `folder2` 資料夾了。
|
||||||
|
現在,請你查看 `folder2` 資料夾的內容。
|
||||||
|
hint: 使用 `ls` 查看資料夾的內容
|
||||||
|
|
||||||
|
- id: ls-folder2
|
||||||
|
name: 查看 `folder2` 資料夾的內容
|
||||||
|
requirements:
|
||||||
|
- cd-folder2
|
||||||
|
condition:
|
||||||
|
pwd: /home/commander/folder2
|
||||||
|
command: ^ls$
|
||||||
|
response:
|
||||||
|
content: |
|
||||||
|
你看到了 `folder2` 資料夾中的檔案,分別是 `file3.txt` 跟 `file4.txt`。
|
||||||
|
現在你可以離開 `folder2` 回到原本的資料夾了。
|
||||||
|
hint: 使用 `cd ..` 回到上一層資料夾
|
||||||
|
|
||||||
|
- id: end
|
||||||
|
name: 回到原本的資料夾
|
||||||
|
requirements:
|
||||||
|
- ls-folder2
|
||||||
|
condition:
|
||||||
|
pwd: /home/commander
|
||||||
|
response:
|
||||||
|
content: |
|
||||||
|
你成功的回到原本的資料夾了。
|
||||||
|
恭喜你學會了 `ls` 和 `cd` 指令的用法。
|
||||||
|
hint: |
|
||||||
|
使用 `cd` 指令進出資料夾
|
||||||
|
使用 `ls` 指令查看資料夾的內容
|
||||||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
+3
-2
@@ -3,11 +3,12 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "Linux Odyssey Server",
|
"description": "Linux Odyssey Server",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "tsx src/index.ts",
|
"start": "node dist/server/src/index.js",
|
||||||
"setup": "tsx src/cli/setup.js",
|
"setup": "tsx src/cli/setup.js",
|
||||||
"clean": "tsx src/cli/clean.js",
|
"clean": "tsx src/cli/clean.js",
|
||||||
|
"build": "tsc",
|
||||||
"type-check": "tsc --noEmit",
|
"type-check": "tsc --noEmit",
|
||||||
"dev": "tsx --watch src/index.ts",
|
"dev": "tsx watch --include \"../quests/**/*.yml\" src/index.ts",
|
||||||
"build:quests": "tsx src/cli/build.js"
|
"build:quests": "tsx src/cli/build.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
Reference in new issue
Block a user