terminal-quest 1.0.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.
- package/LICENSE +21 -0
- package/bin/terminal-quest.js +2 -0
- package/dist/App.d.ts +2 -0
- package/dist/App.js +33 -0
- package/dist/components/HintBar.d.ts +9 -0
- package/dist/components/HintBar.js +11 -0
- package/dist/components/MenuItem.d.ts +9 -0
- package/dist/components/MenuItem.js +9 -0
- package/dist/components/ObjectivePanel.d.ts +8 -0
- package/dist/components/ObjectivePanel.js +10 -0
- package/dist/components/ProgressBar.d.ts +8 -0
- package/dist/components/ProgressBar.js +10 -0
- package/dist/components/TerminalOutput.d.ts +11 -0
- package/dist/components/TerminalOutput.js +25 -0
- package/dist/components/TerminalPrompt.d.ts +10 -0
- package/dist/components/TerminalPrompt.js +46 -0
- package/dist/data/commands-meta.d.ts +17 -0
- package/dist/data/commands-meta.js +256 -0
- package/dist/data/stories/00-beginner-pc.d.ts +3 -0
- package/dist/data/stories/00-beginner-pc.js +841 -0
- package/dist/data/stories/01-first-server.d.ts +3 -0
- package/dist/data/stories/01-first-server.js +364 -0
- package/dist/data/stories/02-messy-project.d.ts +3 -0
- package/dist/data/stories/02-messy-project.js +433 -0
- package/dist/data/stories/03-log-detective.d.ts +3 -0
- package/dist/data/stories/03-log-detective.js +291 -0
- package/dist/data/stories/04-deploy-day.d.ts +3 -0
- package/dist/data/stories/04-deploy-day.js +337 -0
- package/dist/data/stories/05-git-incident.d.ts +3 -0
- package/dist/data/stories/05-git-incident.js +534 -0
- package/dist/data/stories/06-pipe-master.d.ts +3 -0
- package/dist/data/stories/06-pipe-master.js +377 -0
- package/dist/data/stories/07-dangerous-commands.d.ts +3 -0
- package/dist/data/stories/07-dangerous-commands.js +411 -0
- package/dist/data/stories/index.d.ts +4 -0
- package/dist/data/stories/index.js +14 -0
- package/dist/data/stories/k1-treasure-hunt.d.ts +3 -0
- package/dist/data/stories/k1-treasure-hunt.js +815 -0
- package/dist/data/types.d.ts +97 -0
- package/dist/data/types.js +2 -0
- package/dist/engine/Achievements.d.ts +5 -0
- package/dist/engine/Achievements.js +93 -0
- package/dist/engine/CommandHandler.d.ts +17 -0
- package/dist/engine/CommandHandler.js +177 -0
- package/dist/engine/HintEngine.d.ts +10 -0
- package/dist/engine/HintEngine.js +26 -0
- package/dist/engine/MissionEngine.d.ts +17 -0
- package/dist/engine/MissionEngine.js +84 -0
- package/dist/engine/TabCompletion.d.ts +14 -0
- package/dist/engine/TabCompletion.js +93 -0
- package/dist/engine/VirtualFS.d.ts +33 -0
- package/dist/engine/VirtualFS.js +276 -0
- package/dist/engine/commands/cat.d.ts +4 -0
- package/dist/engine/commands/cat.js +18 -0
- package/dist/engine/commands/cd.d.ts +4 -0
- package/dist/engine/commands/cd.js +12 -0
- package/dist/engine/commands/chmod.d.ts +4 -0
- package/dist/engine/commands/chmod.js +98 -0
- package/dist/engine/commands/clear.d.ts +4 -0
- package/dist/engine/commands/clear.js +4 -0
- package/dist/engine/commands/cp.d.ts +4 -0
- package/dist/engine/commands/cp.js +26 -0
- package/dist/engine/commands/cut.d.ts +4 -0
- package/dist/engine/commands/cut.js +76 -0
- package/dist/engine/commands/echo.d.ts +4 -0
- package/dist/engine/commands/echo.js +4 -0
- package/dist/engine/commands/find.d.ts +4 -0
- package/dist/engine/commands/find.js +60 -0
- package/dist/engine/commands/git.d.ts +4 -0
- package/dist/engine/commands/git.js +510 -0
- package/dist/engine/commands/grep.d.ts +4 -0
- package/dist/engine/commands/grep.js +127 -0
- package/dist/engine/commands/head.d.ts +4 -0
- package/dist/engine/commands/head.js +59 -0
- package/dist/engine/commands/help.d.ts +4 -0
- package/dist/engine/commands/help.js +32 -0
- package/dist/engine/commands/hint.d.ts +4 -0
- package/dist/engine/commands/hint.js +4 -0
- package/dist/engine/commands/index.d.ts +8 -0
- package/dist/engine/commands/index.js +51 -0
- package/dist/engine/commands/ls.d.ts +4 -0
- package/dist/engine/commands/ls.js +50 -0
- package/dist/engine/commands/man.d.ts +4 -0
- package/dist/engine/commands/man.js +51 -0
- package/dist/engine/commands/mkdir.d.ts +4 -0
- package/dist/engine/commands/mkdir.js +31 -0
- package/dist/engine/commands/mv.d.ts +4 -0
- package/dist/engine/commands/mv.js +15 -0
- package/dist/engine/commands/pwd.d.ts +4 -0
- package/dist/engine/commands/pwd.js +4 -0
- package/dist/engine/commands/rm.d.ts +4 -0
- package/dist/engine/commands/rm.js +49 -0
- package/dist/engine/commands/sort.d.ts +4 -0
- package/dist/engine/commands/sort.js +100 -0
- package/dist/engine/commands/tail.d.ts +4 -0
- package/dist/engine/commands/tail.js +59 -0
- package/dist/engine/commands/touch.d.ts +4 -0
- package/dist/engine/commands/touch.js +18 -0
- package/dist/engine/commands/uniq.d.ts +4 -0
- package/dist/engine/commands/uniq.js +61 -0
- package/dist/engine/commands/wc.d.ts +4 -0
- package/dist/engine/commands/wc.js +67 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/dist/screens/MissionBriefScreen.d.ts +9 -0
- package/dist/screens/MissionBriefScreen.js +27 -0
- package/dist/screens/MissionCompleteScreen.d.ts +9 -0
- package/dist/screens/MissionCompleteScreen.js +30 -0
- package/dist/screens/ProgressScreen.d.ts +8 -0
- package/dist/screens/ProgressScreen.js +24 -0
- package/dist/screens/SettingsScreen.d.ts +8 -0
- package/dist/screens/SettingsScreen.js +45 -0
- package/dist/screens/StorySelectScreen.d.ts +8 -0
- package/dist/screens/StorySelectScreen.js +81 -0
- package/dist/screens/TerminalScreen.d.ts +12 -0
- package/dist/screens/TerminalScreen.js +150 -0
- package/dist/screens/TitleScreen.d.ts +7 -0
- package/dist/screens/TitleScreen.js +27 -0
- package/dist/state/GameState.d.ts +8 -0
- package/dist/state/GameState.js +12 -0
- package/dist/state/ProgressStore.d.ts +9 -0
- package/dist/state/ProgressStore.js +45 -0
- package/dist/state/useGameState.d.ts +11 -0
- package/dist/state/useGameState.js +92 -0
- package/dist/utils/ascii-art.d.ts +4 -0
- package/dist/utils/ascii-art.js +22 -0
- package/dist/utils/colors.d.ts +17 -0
- package/dist/utils/colors.js +17 -0
- package/dist/utils/text.d.ts +4 -0
- package/dist/utils/text.js +28 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 nasuda
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/App.d.ts
ADDED
package/dist/App.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from 'ink';
|
|
3
|
+
import { useGameState } from './state/useGameState.js';
|
|
4
|
+
import { TitleScreen } from './screens/TitleScreen.js';
|
|
5
|
+
import { StorySelectScreen } from './screens/StorySelectScreen.js';
|
|
6
|
+
import { MissionBriefScreen } from './screens/MissionBriefScreen.js';
|
|
7
|
+
import { TerminalScreen } from './screens/TerminalScreen.js';
|
|
8
|
+
import { MissionCompleteScreen } from './screens/MissionCompleteScreen.js';
|
|
9
|
+
import { ProgressScreen } from './screens/ProgressScreen.js';
|
|
10
|
+
import { SettingsScreen } from './screens/SettingsScreen.js';
|
|
11
|
+
export function App() {
|
|
12
|
+
const { screen, progress, navigateTo, completeMission, completeStory, incrementCommands, resetAll, } = useGameState();
|
|
13
|
+
const renderScreen = () => {
|
|
14
|
+
switch (screen.type) {
|
|
15
|
+
case 'title':
|
|
16
|
+
return _jsx(TitleScreen, { onNavigate: navigateTo });
|
|
17
|
+
case 'storySelect':
|
|
18
|
+
return _jsx(StorySelectScreen, { progress: progress, onNavigate: navigateTo });
|
|
19
|
+
case 'missionBrief':
|
|
20
|
+
return (_jsx(MissionBriefScreen, { storyId: screen.storyId, missionIndex: screen.missionIndex, onNavigate: navigateTo }));
|
|
21
|
+
case 'terminal':
|
|
22
|
+
return (_jsx(TerminalScreen, { storyId: screen.storyId, missionIndex: screen.missionIndex, onNavigate: navigateTo, onMissionComplete: completeMission, onStoryComplete: completeStory, onCommandExecuted: incrementCommands }));
|
|
23
|
+
case 'missionComplete':
|
|
24
|
+
return (_jsx(MissionCompleteScreen, { storyId: screen.storyId, missionIndex: screen.missionIndex, onNavigate: navigateTo }));
|
|
25
|
+
case 'progress':
|
|
26
|
+
return _jsx(ProgressScreen, { progress: progress, onNavigate: navigateTo });
|
|
27
|
+
case 'settings':
|
|
28
|
+
return _jsx(SettingsScreen, { onNavigate: navigateTo, onReset: resetAll });
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return _jsx(Box, { flexDirection: "column", children: renderScreen() });
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=App.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Hint } from '../data/types.js';
|
|
2
|
+
interface HintBarProps {
|
|
3
|
+
hint: Hint | null;
|
|
4
|
+
currentLevel: number;
|
|
5
|
+
maxLevel: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function HintBar({ hint, currentLevel, maxLevel }: HintBarProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=HintBar.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { colors } from '../utils/colors.js';
|
|
4
|
+
export function HintBar({ hint, currentLevel, maxLevel }) {
|
|
5
|
+
if (!hint)
|
|
6
|
+
return null;
|
|
7
|
+
const levelColor = hint.level === 1 ? colors.hint1 : hint.level === 2 ? colors.hint2 : colors.hint3;
|
|
8
|
+
const levelLabel = `ヒント ${hint.level}/${maxLevel}`;
|
|
9
|
+
return (_jsx(Box, { borderStyle: "round", borderColor: levelColor, paddingX: 1, marginTop: 1, children: _jsxs(Text, { children: [_jsxs(Text, { color: levelColor, bold: true, children: ["\uD83D\uDCA1 ", levelLabel, ":"] }), _jsxs(Text, { color: colors.file, children: [" ", hint.text] })] }) }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=HintBar.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface MenuItemProps {
|
|
2
|
+
label: string;
|
|
3
|
+
isSelected: boolean;
|
|
4
|
+
isLocked?: boolean;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function MenuItem({ label, isSelected, isLocked, description }: MenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=MenuItem.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'ink';
|
|
3
|
+
import { colors } from '../utils/colors.js';
|
|
4
|
+
export function MenuItem({ label, isSelected, isLocked, description }) {
|
|
5
|
+
const prefix = isSelected ? '▸ ' : ' ';
|
|
6
|
+
const color = isLocked ? colors.muted : isSelected ? colors.primary : colors.file;
|
|
7
|
+
return (_jsxs(Text, { children: [_jsxs(Text, { color: color, bold: isSelected, children: [prefix, label] }), isLocked && _jsx(Text, { color: colors.muted, children: " \uD83D\uDD12" }), description && !isLocked && (_jsxs(Text, { color: colors.muted, children: [" - ", description] }))] }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=MenuItem.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Objective } from '../data/types.js';
|
|
2
|
+
interface ObjectivePanelProps {
|
|
3
|
+
objectives: Objective[];
|
|
4
|
+
completedIds: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare function ObjectivePanel({ objectives, completedIds }: ObjectivePanelProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ObjectivePanel.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { colors } from '../utils/colors.js';
|
|
4
|
+
export function ObjectivePanel({ objectives, completedIds }) {
|
|
5
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: colors.secondary, paddingX: 1, children: [_jsx(Text, { bold: true, color: colors.secondary, children: "\u76EE\u6A19:" }), objectives.map((obj) => {
|
|
6
|
+
const isComplete = completedIds.includes(obj.id);
|
|
7
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: isComplete ? colors.success : colors.muted, children: isComplete ? ' ✓ ' : ' ○ ' }), _jsx(Text, { color: isComplete ? colors.success : colors.file, children: obj.description })] }, obj.id));
|
|
8
|
+
})] }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ObjectivePanel.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface ProgressBarProps {
|
|
2
|
+
current: number;
|
|
3
|
+
total: number;
|
|
4
|
+
width?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function ProgressBar({ current, total, width }: ProgressBarProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ProgressBar.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'ink';
|
|
3
|
+
import { colors } from '../utils/colors.js';
|
|
4
|
+
export function ProgressBar({ current, total, width = 20 }) {
|
|
5
|
+
const filled = total > 0 ? Math.round((current / total) * width) : 0;
|
|
6
|
+
const empty = width - filled;
|
|
7
|
+
const percentage = total > 0 ? Math.round((current / total) * 100) : 0;
|
|
8
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: colors.primary, children: '█'.repeat(filled) }), _jsx(Text, { color: colors.muted, children: '░'.repeat(empty) }), _jsxs(Text, { color: colors.muted, children: [" ", current, "/", total, " (", percentage, "%)"] })] }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ProgressBar.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface OutputLine {
|
|
2
|
+
text: string;
|
|
3
|
+
type: 'output' | 'error' | 'system' | 'success' | 'separator';
|
|
4
|
+
}
|
|
5
|
+
interface TerminalOutputProps {
|
|
6
|
+
lines: OutputLine[];
|
|
7
|
+
maxLines?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function TerminalOutput({ lines, maxLines }: TerminalOutputProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=TerminalOutput.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { colors } from '../utils/colors.js';
|
|
4
|
+
export function TerminalOutput({ lines, maxLines = 20 }) {
|
|
5
|
+
const filtered = lines.filter(line => line.type !== 'separator');
|
|
6
|
+
const visibleLines = maxLines > 0 ? filtered.slice(-maxLines) : filtered;
|
|
7
|
+
return (_jsx(Box, { flexDirection: "column", children: visibleLines.map((line, i) => {
|
|
8
|
+
let color;
|
|
9
|
+
switch (line.type) {
|
|
10
|
+
case 'error':
|
|
11
|
+
color = colors.error;
|
|
12
|
+
break;
|
|
13
|
+
case 'system':
|
|
14
|
+
color = colors.info;
|
|
15
|
+
break;
|
|
16
|
+
case 'success':
|
|
17
|
+
color = colors.success;
|
|
18
|
+
break;
|
|
19
|
+
default:
|
|
20
|
+
color = colors.file;
|
|
21
|
+
}
|
|
22
|
+
return (_jsx(Text, { color: color, children: line.text }, i));
|
|
23
|
+
}) }));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=TerminalOutput.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TabCompletion } from '../engine/TabCompletion.js';
|
|
2
|
+
interface TerminalPromptProps {
|
|
3
|
+
cwd: string;
|
|
4
|
+
onSubmit: (input: string) => void;
|
|
5
|
+
history: string[];
|
|
6
|
+
tabCompletion?: TabCompletion;
|
|
7
|
+
}
|
|
8
|
+
export declare function TerminalPrompt({ cwd, onSubmit, history, tabCompletion }: TerminalPromptProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=TerminalPrompt.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
import { Box, Text, useInput } from 'ink';
|
|
4
|
+
import TextInput from 'ink-text-input';
|
|
5
|
+
import { colors } from '../utils/colors.js';
|
|
6
|
+
export function TerminalPrompt({ cwd, onSubmit, history, tabCompletion }) {
|
|
7
|
+
const [value, setValue] = useState('');
|
|
8
|
+
const [historyIndex, setHistoryIndex] = useState(-1);
|
|
9
|
+
const [completionCandidates, setCompletionCandidates] = useState([]);
|
|
10
|
+
useInput((_input, key) => {
|
|
11
|
+
if (key.upArrow && history.length > 0) {
|
|
12
|
+
const newIndex = Math.min(historyIndex + 1, history.length - 1);
|
|
13
|
+
setHistoryIndex(newIndex);
|
|
14
|
+
setValue(history[history.length - 1 - newIndex]);
|
|
15
|
+
setCompletionCandidates([]);
|
|
16
|
+
}
|
|
17
|
+
if (key.downArrow) {
|
|
18
|
+
if (historyIndex <= 0) {
|
|
19
|
+
setHistoryIndex(-1);
|
|
20
|
+
setValue('');
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const newIndex = historyIndex - 1;
|
|
24
|
+
setHistoryIndex(newIndex);
|
|
25
|
+
setValue(history[history.length - 1 - newIndex]);
|
|
26
|
+
}
|
|
27
|
+
setCompletionCandidates([]);
|
|
28
|
+
}
|
|
29
|
+
if (key.tab && tabCompletion) {
|
|
30
|
+
const result = tabCompletion.complete(value);
|
|
31
|
+
setValue(result.completed);
|
|
32
|
+
setCompletionCandidates(result.candidates.length > 1 ? result.candidates : []);
|
|
33
|
+
}
|
|
34
|
+
if (!key.tab) {
|
|
35
|
+
setCompletionCandidates([]);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const handleSubmit = useCallback((input) => {
|
|
39
|
+
onSubmit(input);
|
|
40
|
+
setValue('');
|
|
41
|
+
setHistoryIndex(-1);
|
|
42
|
+
setCompletionCandidates([]);
|
|
43
|
+
}, [onSubmit]);
|
|
44
|
+
return (_jsxs(Box, { flexDirection: "column", children: [completionCandidates.length > 0 && (_jsx(Text, { color: colors.muted, children: completionCandidates.join(' ') })), _jsxs(Box, { children: [_jsx(Text, { color: colors.prompt, bold: true, children: cwd }), _jsx(Text, { color: colors.secondary, children: " $ " }), _jsx(TextInput, { value: value, onChange: setValue, onSubmit: handleSubmit })] })] }));
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=TerminalPrompt.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface CommandExample {
|
|
2
|
+
cmd: string;
|
|
3
|
+
desc: string;
|
|
4
|
+
}
|
|
5
|
+
export interface CommandMeta {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
usage: string;
|
|
9
|
+
examples: CommandExample[];
|
|
10
|
+
options?: Array<{
|
|
11
|
+
flag: string;
|
|
12
|
+
description: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export declare const commandsMeta: CommandMeta[];
|
|
16
|
+
export declare function getCommandMeta(name: string): CommandMeta | undefined;
|
|
17
|
+
//# sourceMappingURL=commands-meta.d.ts.map
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
export const commandsMeta = [
|
|
2
|
+
{
|
|
3
|
+
name: 'pwd',
|
|
4
|
+
description: '現在いる場所(ディレクトリ)を表示します。',
|
|
5
|
+
usage: 'pwd',
|
|
6
|
+
examples: [
|
|
7
|
+
{ cmd: 'pwd', desc: '今いるディレクトリのパスを表示' },
|
|
8
|
+
],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
name: 'ls',
|
|
12
|
+
description: '今いるディレクトリの中身を一覧表示します。',
|
|
13
|
+
usage: 'ls [パス]',
|
|
14
|
+
examples: [
|
|
15
|
+
{ cmd: 'ls', desc: '今いるフォルダの中身を表示' },
|
|
16
|
+
{ cmd: 'ls /etc', desc: '/etc フォルダの中身を表示' },
|
|
17
|
+
{ cmd: 'ls -la', desc: '隠しファイルも含めて詳しく表示' },
|
|
18
|
+
],
|
|
19
|
+
options: [
|
|
20
|
+
{ flag: '-a', description: '隠しファイルも表示' },
|
|
21
|
+
{ flag: '-l', description: '詳細表示' },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'cd',
|
|
26
|
+
description: '別のディレクトリに移動します。',
|
|
27
|
+
usage: 'cd <パス>',
|
|
28
|
+
examples: [
|
|
29
|
+
{ cmd: 'cd /home', desc: '/home に移動' },
|
|
30
|
+
{ cmd: 'cd ..', desc: '1つ上のフォルダに戻る' },
|
|
31
|
+
{ cmd: 'cd メモ', desc: 'メモ フォルダに入る' },
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'cat',
|
|
36
|
+
description: 'ファイルの中身を表示します。',
|
|
37
|
+
usage: 'cat <ファイル名>',
|
|
38
|
+
examples: [
|
|
39
|
+
{ cmd: 'cat file.txt', desc: 'file.txt の中身を表示' },
|
|
40
|
+
{ cmd: 'cat /var/log/app.log', desc: 'パスを指定して表示' },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'grep',
|
|
45
|
+
description: 'ファイルの中から指定した文字列を探します。',
|
|
46
|
+
usage: 'grep <探す文字> <ファイル名>',
|
|
47
|
+
examples: [
|
|
48
|
+
{ cmd: 'grep ERROR app.log', desc: 'app.log から "ERROR" を含む行を探す' },
|
|
49
|
+
{ cmd: 'grep -n "port" config.json', desc: '行番号付きで "port" を探す' },
|
|
50
|
+
{ cmd: 'grep -i hello file.txt', desc: '大文字小文字を区別せず探す' },
|
|
51
|
+
],
|
|
52
|
+
options: [
|
|
53
|
+
{ flag: '-i', description: '大文字小文字を区別しない' },
|
|
54
|
+
{ flag: '-n', description: '行番号を表示' },
|
|
55
|
+
{ flag: '-r', description: 'フォルダの中も全部探す' },
|
|
56
|
+
{ flag: '-c', description: '見つかった行の数だけ表示' },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'cp',
|
|
61
|
+
description: 'ファイルをコピーします。',
|
|
62
|
+
usage: 'cp <コピー元> <コピー先>',
|
|
63
|
+
examples: [
|
|
64
|
+
{ cmd: 'cp file.txt file.bak', desc: 'file.txt のバックアップを作成' },
|
|
65
|
+
{ cmd: 'cp memo.txt メモ/', desc: 'memo.txt を メモ/ フォルダにコピー' },
|
|
66
|
+
{ cmd: 'cp -r src/ backup/', desc: 'src フォルダを丸ごとコピー' },
|
|
67
|
+
],
|
|
68
|
+
options: [
|
|
69
|
+
{ flag: '-r', description: 'フォルダの中身もまとめてコピー' },
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'echo',
|
|
74
|
+
description: '文字を表示したり、ファイルに書き込みます。',
|
|
75
|
+
usage: 'echo <文字列>',
|
|
76
|
+
examples: [
|
|
77
|
+
{ cmd: 'echo "Hello"', desc: '画面に Hello と表示' },
|
|
78
|
+
{ cmd: 'echo "data" > out.txt', desc: 'out.txt に "data" を書き込む(上書き)' },
|
|
79
|
+
{ cmd: 'echo "追記" >> out.txt', desc: 'out.txt の末尾に追記' },
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'mkdir',
|
|
84
|
+
description: '新しいフォルダを作ります。',
|
|
85
|
+
usage: 'mkdir <フォルダ名>',
|
|
86
|
+
examples: [
|
|
87
|
+
{ cmd: 'mkdir src', desc: 'src フォルダを作成' },
|
|
88
|
+
{ cmd: 'mkdir -p src/components/ui', desc: '途中のフォルダもまとめて作成' },
|
|
89
|
+
],
|
|
90
|
+
options: [
|
|
91
|
+
{ flag: '-p', description: '途中のフォルダも一気に作成' },
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'mv',
|
|
96
|
+
description: 'ファイルを移動、または名前を変更します。',
|
|
97
|
+
usage: 'mv <移動元> <移動先>',
|
|
98
|
+
examples: [
|
|
99
|
+
{ cmd: 'mv old.txt new.txt', desc: 'ファイル名を old.txt → new.txt に変更' },
|
|
100
|
+
{ cmd: 'mv file.txt src/', desc: 'file.txt を src/ フォルダに移動' },
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'rm',
|
|
105
|
+
description: 'ファイルやフォルダを削除します。',
|
|
106
|
+
usage: 'rm <ファイル名>',
|
|
107
|
+
examples: [
|
|
108
|
+
{ cmd: 'rm file.txt', desc: 'ファイルを1つ削除' },
|
|
109
|
+
{ cmd: 'rm -r old_dir', desc: 'フォルダごとまるっと削除' },
|
|
110
|
+
{ cmd: 'rm -rf temp/', desc: '確認なしで強制的に削除' },
|
|
111
|
+
],
|
|
112
|
+
options: [
|
|
113
|
+
{ flag: '-r', description: 'フォルダの中身もまとめて削除' },
|
|
114
|
+
{ flag: '-f', description: '確認なしで強制削除' },
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'find',
|
|
119
|
+
description: 'ファイルやフォルダを名前で探します。',
|
|
120
|
+
usage: 'find <場所> -name <名前>',
|
|
121
|
+
examples: [
|
|
122
|
+
{ cmd: 'find .', desc: '今いるフォルダの中身をすべて表示' },
|
|
123
|
+
{ cmd: 'find . -name "*.txt"', desc: '.txt で終わるファイルを探す' },
|
|
124
|
+
{ cmd: 'find . -name "*.tmp"', desc: '.tmp ファイルを探す' },
|
|
125
|
+
{ cmd: 'find /var -type f', desc: '/var の中のファイルだけ表示' },
|
|
126
|
+
],
|
|
127
|
+
options: [
|
|
128
|
+
{ flag: '-name "パターン"', description: '名前のパターンで探す(* はワイルドカード)' },
|
|
129
|
+
{ flag: '-type f', description: 'ファイルだけに絞る' },
|
|
130
|
+
{ flag: '-type d', description: 'フォルダだけに絞る' },
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: 'touch',
|
|
135
|
+
description: '空のファイルを新しく作ります。',
|
|
136
|
+
usage: 'touch <ファイル名>',
|
|
137
|
+
examples: [
|
|
138
|
+
{ cmd: 'touch new_file.txt', desc: '空の new_file.txt を作成' },
|
|
139
|
+
{ cmd: 'touch README.md', desc: '空の README.md を作成' },
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'head',
|
|
144
|
+
description: 'ファイルの先頭部分だけ表示します。',
|
|
145
|
+
usage: 'head <ファイル名>',
|
|
146
|
+
examples: [
|
|
147
|
+
{ cmd: 'head file.txt', desc: '先頭10行を表示(デフォルト)' },
|
|
148
|
+
{ cmd: 'head -n 5 log.txt', desc: '先頭5行だけ表示' },
|
|
149
|
+
],
|
|
150
|
+
options: [
|
|
151
|
+
{ flag: '-n 数字', description: '表示する行数を指定' },
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'tail',
|
|
156
|
+
description: 'ファイルの末尾部分だけ表示します。',
|
|
157
|
+
usage: 'tail <ファイル名>',
|
|
158
|
+
examples: [
|
|
159
|
+
{ cmd: 'tail file.txt', desc: '末尾10行を表示(デフォルト)' },
|
|
160
|
+
{ cmd: 'tail -n 20 log.txt', desc: '末尾20行だけ表示' },
|
|
161
|
+
],
|
|
162
|
+
options: [
|
|
163
|
+
{ flag: '-n 数字', description: '表示する行数を指定' },
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'wc',
|
|
168
|
+
description: 'ファイルの行数・単語数・バイト数を数えます。',
|
|
169
|
+
usage: 'wc <ファイル名>',
|
|
170
|
+
examples: [
|
|
171
|
+
{ cmd: 'wc file.txt', desc: '行数・単語数・バイト数をすべて表示' },
|
|
172
|
+
{ cmd: 'wc -l log.txt', desc: '行数だけ表示' },
|
|
173
|
+
{ cmd: 'cat file.txt | wc -w', desc: 'パイプで受け取って単語数を表示' },
|
|
174
|
+
],
|
|
175
|
+
options: [
|
|
176
|
+
{ flag: '-l', description: '行数だけ表示' },
|
|
177
|
+
{ flag: '-w', description: '単語数だけ表示' },
|
|
178
|
+
{ flag: '-c', description: 'バイト数だけ表示' },
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: 'sort',
|
|
183
|
+
description: 'ファイルの中身を並び替えます。',
|
|
184
|
+
usage: 'sort <ファイル名>',
|
|
185
|
+
examples: [
|
|
186
|
+
{ cmd: 'sort names.txt', desc: 'あいうえお順に並び替え' },
|
|
187
|
+
{ cmd: 'sort -n numbers.txt', desc: '数字の小さい順に並び替え' },
|
|
188
|
+
{ cmd: 'sort -r data.txt', desc: '逆順に並び替え' },
|
|
189
|
+
],
|
|
190
|
+
options: [
|
|
191
|
+
{ flag: '-r', description: '逆順に並べる' },
|
|
192
|
+
{ flag: '-n', description: '数字として並べる' },
|
|
193
|
+
{ flag: '-t 文字', description: '区切り文字を指定' },
|
|
194
|
+
{ flag: '-k 番号', description: '何番目の項目で並べるか指定' },
|
|
195
|
+
],
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: 'uniq',
|
|
199
|
+
description: '連続する同じ行をまとめます(重複削除)。',
|
|
200
|
+
usage: 'uniq <ファイル名>',
|
|
201
|
+
examples: [
|
|
202
|
+
{ cmd: 'sort data.txt | uniq', desc: 'まずsortしてから重複を削除' },
|
|
203
|
+
{ cmd: 'sort data.txt | uniq -c', desc: '重複を削除して出現回数も表示' },
|
|
204
|
+
],
|
|
205
|
+
options: [
|
|
206
|
+
{ flag: '-c', description: '何回出てきたか回数を表示' },
|
|
207
|
+
],
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: 'cut',
|
|
211
|
+
description: '各行から特定の列だけ切り出します。',
|
|
212
|
+
usage: 'cut -d <区切り文字> -f <列番号> <ファイル>',
|
|
213
|
+
examples: [
|
|
214
|
+
{ cmd: 'cut -d, -f1 data.csv', desc: 'CSVの1列目だけ取り出す' },
|
|
215
|
+
{ cmd: 'cut -d: -f1,3 /etc/passwd', desc: ': 区切りの1列目と3列目を取り出す' },
|
|
216
|
+
],
|
|
217
|
+
options: [
|
|
218
|
+
{ flag: '-d 文字', description: '区切り文字を指定(, や : など)' },
|
|
219
|
+
{ flag: '-f 番号', description: '取り出す列の番号を指定' },
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: 'chmod',
|
|
224
|
+
description: 'ファイルの実行権限などを変更します。',
|
|
225
|
+
usage: 'chmod <モード> <ファイル>',
|
|
226
|
+
examples: [
|
|
227
|
+
{ cmd: 'chmod 755 script.sh', desc: '実行可能にする(数字指定)' },
|
|
228
|
+
{ cmd: 'chmod +x start.sh', desc: '実行権限を追加' },
|
|
229
|
+
],
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: 'git',
|
|
233
|
+
description: 'バージョン管理コマンド(シミュレーション)。',
|
|
234
|
+
usage: 'git <サブコマンド>',
|
|
235
|
+
examples: [
|
|
236
|
+
{ cmd: 'git status', desc: '変更状態を確認' },
|
|
237
|
+
{ cmd: 'git log', desc: '変更履歴を表示' },
|
|
238
|
+
{ cmd: 'git branch', desc: 'ブランチ一覧を表示' },
|
|
239
|
+
{ cmd: 'git checkout -b feature', desc: '新しいブランチを作って切り替え' },
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'man',
|
|
244
|
+
description: 'コマンドの使い方を表示します。',
|
|
245
|
+
usage: 'man <コマンド名>',
|
|
246
|
+
examples: [
|
|
247
|
+
{ cmd: 'man', desc: '全コマンドの一覧を表示' },
|
|
248
|
+
{ cmd: 'man ls', desc: 'ls の使い方を表示' },
|
|
249
|
+
{ cmd: 'man grep', desc: 'grep の使い方を表示' },
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
];
|
|
253
|
+
export function getCommandMeta(name) {
|
|
254
|
+
return commandsMeta.find((cmd) => cmd.name === name);
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=commands-meta.js.map
|